fullcalendar.js 607 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933
  1. /*!
  2. * FullCalendar v3.8.0
  3. * Docs & License: https://fullcalendar.io/
  4. * (c) 2017 Adam Shaw
  5. */
  6. (function webpackUniversalModuleDefinition(root, factory) {
  7. if(typeof exports === 'object' && typeof module === 'object')
  8. module.exports = factory(require("moment"), require("jquery"));
  9. else if(typeof define === 'function' && define.amd)
  10. define(["moment", "jquery"], factory);
  11. else if(typeof exports === 'object')
  12. exports["FullCalendar"] = factory(require("moment"), require("jquery"));
  13. else
  14. root["FullCalendar"] = factory(root["moment"], root["jQuery"]);
  15. })(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_3__) {
  16. return /******/ (function(modules) { // webpackBootstrap
  17. /******/ // The module cache
  18. /******/ var installedModules = {};
  19. /******/
  20. /******/ // The require function
  21. /******/ function __webpack_require__(moduleId) {
  22. /******/
  23. /******/ // Check if module is in cache
  24. /******/ if(installedModules[moduleId]) {
  25. /******/ return installedModules[moduleId].exports;
  26. /******/ }
  27. /******/ // Create a new module (and put it into the cache)
  28. /******/ var module = installedModules[moduleId] = {
  29. /******/ i: moduleId,
  30. /******/ l: false,
  31. /******/ exports: {}
  32. /******/ };
  33. /******/
  34. /******/ // Execute the module function
  35. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36. /******/
  37. /******/ // Flag the module as loaded
  38. /******/ module.l = true;
  39. /******/
  40. /******/ // Return the exports of the module
  41. /******/ return module.exports;
  42. /******/ }
  43. /******/
  44. /******/
  45. /******/ // expose the modules object (__webpack_modules__)
  46. /******/ __webpack_require__.m = modules;
  47. /******/
  48. /******/ // expose the module cache
  49. /******/ __webpack_require__.c = installedModules;
  50. /******/
  51. /******/ // define getter function for harmony exports
  52. /******/ __webpack_require__.d = function(exports, name, getter) {
  53. /******/ if(!__webpack_require__.o(exports, name)) {
  54. /******/ Object.defineProperty(exports, name, {
  55. /******/ configurable: false,
  56. /******/ enumerable: true,
  57. /******/ get: getter
  58. /******/ });
  59. /******/ }
  60. /******/ };
  61. /******/
  62. /******/ // getDefaultExport function for compatibility with non-harmony modules
  63. /******/ __webpack_require__.n = function(module) {
  64. /******/ var getter = module && module.__esModule ?
  65. /******/ function getDefault() { return module['default']; } :
  66. /******/ function getModuleExports() { return module; };
  67. /******/ __webpack_require__.d(getter, 'a', getter);
  68. /******/ return getter;
  69. /******/ };
  70. /******/
  71. /******/ // Object.prototype.hasOwnProperty.call
  72. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  73. /******/
  74. /******/ // __webpack_public_path__
  75. /******/ __webpack_require__.p = "";
  76. /******/
  77. /******/ // Load entry module and return exports
  78. /******/ return __webpack_require__(__webpack_require__.s = 232);
  79. /******/ })
  80. /************************************************************************/
  81. /******/ ([
  82. /* 0 */
  83. /***/ (function(module, exports) {
  84. module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
  85. /***/ }),
  86. /* 1 */,
  87. /* 2 */
  88. /***/ (function(module, exports) {
  89. /*
  90. derived from:
  91. https://github.com/Microsoft/tslib/blob/v1.6.0/tslib.js
  92. only include the helpers we need, to keep down filesize
  93. */
  94. var extendStatics = Object.setPrototypeOf ||
  95. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  96. function (d, b) { for (var p in b)
  97. if (b.hasOwnProperty(p))
  98. d[p] = b[p]; };
  99. exports.__extends = function (d, b) {
  100. extendStatics(d, b);
  101. function __() { this.constructor = d; }
  102. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  103. };
  104. /***/ }),
  105. /* 3 */
  106. /***/ (function(module, exports) {
  107. module.exports = __WEBPACK_EXTERNAL_MODULE_3__;
  108. /***/ }),
  109. /* 4 */
  110. /***/ (function(module, exports, __webpack_require__) {
  111. Object.defineProperty(exports, "__esModule", { value: true });
  112. var moment = __webpack_require__(0);
  113. var $ = __webpack_require__(3);
  114. /* FullCalendar-specific DOM Utilities
  115. ----------------------------------------------------------------------------------------------------------------------*/
  116. // Given the scrollbar widths of some other container, create borders/margins on rowEls in order to match the left
  117. // and right space that was offset by the scrollbars. A 1-pixel border first, then margin beyond that.
  118. function compensateScroll(rowEls, scrollbarWidths) {
  119. if (scrollbarWidths.left) {
  120. rowEls.css({
  121. 'border-left-width': 1,
  122. 'margin-left': scrollbarWidths.left - 1
  123. });
  124. }
  125. if (scrollbarWidths.right) {
  126. rowEls.css({
  127. 'border-right-width': 1,
  128. 'margin-right': scrollbarWidths.right - 1
  129. });
  130. }
  131. }
  132. exports.compensateScroll = compensateScroll;
  133. // Undoes compensateScroll and restores all borders/margins
  134. function uncompensateScroll(rowEls) {
  135. rowEls.css({
  136. 'margin-left': '',
  137. 'margin-right': '',
  138. 'border-left-width': '',
  139. 'border-right-width': ''
  140. });
  141. }
  142. exports.uncompensateScroll = uncompensateScroll;
  143. // Make the mouse cursor express that an event is not allowed in the current area
  144. function disableCursor() {
  145. $('body').addClass('fc-not-allowed');
  146. }
  147. exports.disableCursor = disableCursor;
  148. // Returns the mouse cursor to its original look
  149. function enableCursor() {
  150. $('body').removeClass('fc-not-allowed');
  151. }
  152. exports.enableCursor = enableCursor;
  153. // Given a total available height to fill, have `els` (essentially child rows) expand to accomodate.
  154. // By default, all elements that are shorter than the recommended height are expanded uniformly, not considering
  155. // any other els that are already too tall. if `shouldRedistribute` is on, it considers these tall rows and
  156. // reduces the available height.
  157. function distributeHeight(els, availableHeight, shouldRedistribute) {
  158. // *FLOORING NOTE*: we floor in certain places because zoom can give inaccurate floating-point dimensions,
  159. // and it is better to be shorter than taller, to avoid creating unnecessary scrollbars.
  160. var minOffset1 = Math.floor(availableHeight / els.length); // for non-last element
  161. var minOffset2 = Math.floor(availableHeight - minOffset1 * (els.length - 1)); // for last element *FLOORING NOTE*
  162. var flexEls = []; // elements that are allowed to expand. array of DOM nodes
  163. var flexOffsets = []; // amount of vertical space it takes up
  164. var flexHeights = []; // actual css height
  165. var usedHeight = 0;
  166. undistributeHeight(els); // give all elements their natural height
  167. // find elements that are below the recommended height (expandable).
  168. // important to query for heights in a single first pass (to avoid reflow oscillation).
  169. els.each(function (i, el) {
  170. var minOffset = i === els.length - 1 ? minOffset2 : minOffset1;
  171. var naturalOffset = $(el).outerHeight(true);
  172. if (naturalOffset < minOffset) {
  173. flexEls.push(el);
  174. flexOffsets.push(naturalOffset);
  175. flexHeights.push($(el).height());
  176. }
  177. else {
  178. // this element stretches past recommended height (non-expandable). mark the space as occupied.
  179. usedHeight += naturalOffset;
  180. }
  181. });
  182. // readjust the recommended height to only consider the height available to non-maxed-out rows.
  183. if (shouldRedistribute) {
  184. availableHeight -= usedHeight;
  185. minOffset1 = Math.floor(availableHeight / flexEls.length);
  186. minOffset2 = Math.floor(availableHeight - minOffset1 * (flexEls.length - 1)); // *FLOORING NOTE*
  187. }
  188. // assign heights to all expandable elements
  189. $(flexEls).each(function (i, el) {
  190. var minOffset = i === flexEls.length - 1 ? minOffset2 : minOffset1;
  191. var naturalOffset = flexOffsets[i];
  192. var naturalHeight = flexHeights[i];
  193. var newHeight = minOffset - (naturalOffset - naturalHeight); // subtract the margin/padding
  194. if (naturalOffset < minOffset) {
  195. $(el).height(newHeight);
  196. }
  197. });
  198. }
  199. exports.distributeHeight = distributeHeight;
  200. // Undoes distrubuteHeight, restoring all els to their natural height
  201. function undistributeHeight(els) {
  202. els.height('');
  203. }
  204. exports.undistributeHeight = undistributeHeight;
  205. // Given `els`, a jQuery set of <td> cells, find the cell with the largest natural width and set the widths of all the
  206. // cells to be that width.
  207. // PREREQUISITE: if you want a cell to take up width, it needs to have a single inner element w/ display:inline
  208. function matchCellWidths(els) {
  209. var maxInnerWidth = 0;
  210. els.find('> *').each(function (i, innerEl) {
  211. var innerWidth = $(innerEl).outerWidth();
  212. if (innerWidth > maxInnerWidth) {
  213. maxInnerWidth = innerWidth;
  214. }
  215. });
  216. maxInnerWidth++; // sometimes not accurate of width the text needs to stay on one line. insurance
  217. els.width(maxInnerWidth);
  218. return maxInnerWidth;
  219. }
  220. exports.matchCellWidths = matchCellWidths;
  221. // Given one element that resides inside another,
  222. // Subtracts the height of the inner element from the outer element.
  223. function subtractInnerElHeight(outerEl, innerEl) {
  224. var both = outerEl.add(innerEl);
  225. var diff;
  226. // effin' IE8/9/10/11 sometimes returns 0 for dimensions. this weird hack was the only thing that worked
  227. both.css({
  228. position: 'relative',
  229. left: -1 // ensure reflow in case the el was already relative. negative is less likely to cause new scroll
  230. });
  231. diff = outerEl.outerHeight() - innerEl.outerHeight(); // grab the dimensions
  232. both.css({ position: '', left: '' }); // undo hack
  233. return diff;
  234. }
  235. exports.subtractInnerElHeight = subtractInnerElHeight;
  236. /* Element Geom Utilities
  237. ----------------------------------------------------------------------------------------------------------------------*/
  238. // borrowed from https://github.com/jquery/jquery-ui/blob/1.11.0/ui/core.js#L51
  239. function getScrollParent(el) {
  240. var position = el.css('position');
  241. var scrollParent = el.parents().filter(function () {
  242. var parent = $(this);
  243. return (/(auto|scroll)/).test(parent.css('overflow') + parent.css('overflow-y') + parent.css('overflow-x'));
  244. }).eq(0);
  245. return position === 'fixed' || !scrollParent.length ? $(el[0].ownerDocument || document) : scrollParent;
  246. }
  247. exports.getScrollParent = getScrollParent;
  248. // Queries the outer bounding area of a jQuery element.
  249. // Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive).
  250. // Origin is optional.
  251. function getOuterRect(el, origin) {
  252. var offset = el.offset();
  253. var left = offset.left - (origin ? origin.left : 0);
  254. var top = offset.top - (origin ? origin.top : 0);
  255. return {
  256. left: left,
  257. right: left + el.outerWidth(),
  258. top: top,
  259. bottom: top + el.outerHeight()
  260. };
  261. }
  262. exports.getOuterRect = getOuterRect;
  263. // Queries the area within the margin/border/scrollbars of a jQuery element. Does not go within the padding.
  264. // Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive).
  265. // Origin is optional.
  266. // WARNING: given element can't have borders
  267. // NOTE: should use clientLeft/clientTop, but very unreliable cross-browser.
  268. function getClientRect(el, origin) {
  269. var offset = el.offset();
  270. var scrollbarWidths = getScrollbarWidths(el);
  271. var left = offset.left + getCssFloat(el, 'border-left-width') + scrollbarWidths.left - (origin ? origin.left : 0);
  272. var top = offset.top + getCssFloat(el, 'border-top-width') + scrollbarWidths.top - (origin ? origin.top : 0);
  273. return {
  274. left: left,
  275. right: left + el[0].clientWidth,
  276. top: top,
  277. bottom: top + el[0].clientHeight // clientHeight includes padding but NOT scrollbars
  278. };
  279. }
  280. exports.getClientRect = getClientRect;
  281. // Queries the area within the margin/border/padding of a jQuery element. Assumed not to have scrollbars.
  282. // Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive).
  283. // Origin is optional.
  284. function getContentRect(el, origin) {
  285. var offset = el.offset(); // just outside of border, margin not included
  286. var left = offset.left + getCssFloat(el, 'border-left-width') + getCssFloat(el, 'padding-left') -
  287. (origin ? origin.left : 0);
  288. var top = offset.top + getCssFloat(el, 'border-top-width') + getCssFloat(el, 'padding-top') -
  289. (origin ? origin.top : 0);
  290. return {
  291. left: left,
  292. right: left + el.width(),
  293. top: top,
  294. bottom: top + el.height()
  295. };
  296. }
  297. exports.getContentRect = getContentRect;
  298. // Returns the computed left/right/top/bottom scrollbar widths for the given jQuery element.
  299. // WARNING: given element can't have borders (which will cause offsetWidth/offsetHeight to be larger).
  300. // NOTE: should use clientLeft/clientTop, but very unreliable cross-browser.
  301. function getScrollbarWidths(el) {
  302. var leftRightWidth = el[0].offsetWidth - el[0].clientWidth;
  303. var bottomWidth = el[0].offsetHeight - el[0].clientHeight;
  304. var widths;
  305. leftRightWidth = sanitizeScrollbarWidth(leftRightWidth);
  306. bottomWidth = sanitizeScrollbarWidth(bottomWidth);
  307. widths = { left: 0, right: 0, top: 0, bottom: bottomWidth };
  308. if (getIsLeftRtlScrollbars() && el.css('direction') === 'rtl') {
  309. widths.left = leftRightWidth;
  310. }
  311. else {
  312. widths.right = leftRightWidth;
  313. }
  314. return widths;
  315. }
  316. exports.getScrollbarWidths = getScrollbarWidths;
  317. // The scrollbar width computations in getScrollbarWidths are sometimes flawed when it comes to
  318. // retina displays, rounding, and IE11. Massage them into a usable value.
  319. function sanitizeScrollbarWidth(width) {
  320. width = Math.max(0, width); // no negatives
  321. width = Math.round(width);
  322. return width;
  323. }
  324. // Logic for determining if, when the element is right-to-left, the scrollbar appears on the left side
  325. var _isLeftRtlScrollbars = null;
  326. function getIsLeftRtlScrollbars() {
  327. if (_isLeftRtlScrollbars === null) {
  328. _isLeftRtlScrollbars = computeIsLeftRtlScrollbars();
  329. }
  330. return _isLeftRtlScrollbars;
  331. }
  332. function computeIsLeftRtlScrollbars() {
  333. var el = $('<div><div/></div>')
  334. .css({
  335. position: 'absolute',
  336. top: -1000,
  337. left: 0,
  338. border: 0,
  339. padding: 0,
  340. overflow: 'scroll',
  341. direction: 'rtl'
  342. })
  343. .appendTo('body');
  344. var innerEl = el.children();
  345. var res = innerEl.offset().left > el.offset().left; // is the inner div shifted to accommodate a left scrollbar?
  346. el.remove();
  347. return res;
  348. }
  349. // Retrieves a jQuery element's computed CSS value as a floating-point number.
  350. // If the queried value is non-numeric (ex: IE can return "medium" for border width), will just return zero.
  351. function getCssFloat(el, prop) {
  352. return parseFloat(el.css(prop)) || 0;
  353. }
  354. /* Mouse / Touch Utilities
  355. ----------------------------------------------------------------------------------------------------------------------*/
  356. // Returns a boolean whether this was a left mouse click and no ctrl key (which means right click on Mac)
  357. function isPrimaryMouseButton(ev) {
  358. return ev.which === 1 && !ev.ctrlKey;
  359. }
  360. exports.isPrimaryMouseButton = isPrimaryMouseButton;
  361. function getEvX(ev) {
  362. var touches = ev.originalEvent.touches;
  363. // on mobile FF, pageX for touch events is present, but incorrect,
  364. // so, look at touch coordinates first.
  365. if (touches && touches.length) {
  366. return touches[0].pageX;
  367. }
  368. return ev.pageX;
  369. }
  370. exports.getEvX = getEvX;
  371. function getEvY(ev) {
  372. var touches = ev.originalEvent.touches;
  373. // on mobile FF, pageX for touch events is present, but incorrect,
  374. // so, look at touch coordinates first.
  375. if (touches && touches.length) {
  376. return touches[0].pageY;
  377. }
  378. return ev.pageY;
  379. }
  380. exports.getEvY = getEvY;
  381. function getEvIsTouch(ev) {
  382. return /^touch/.test(ev.type);
  383. }
  384. exports.getEvIsTouch = getEvIsTouch;
  385. function preventSelection(el) {
  386. el.addClass('fc-unselectable')
  387. .on('selectstart', preventDefault);
  388. }
  389. exports.preventSelection = preventSelection;
  390. function allowSelection(el) {
  391. el.removeClass('fc-unselectable')
  392. .off('selectstart', preventDefault);
  393. }
  394. exports.allowSelection = allowSelection;
  395. // Stops a mouse/touch event from doing it's native browser action
  396. function preventDefault(ev) {
  397. ev.preventDefault();
  398. }
  399. exports.preventDefault = preventDefault;
  400. /* General Geometry Utils
  401. ----------------------------------------------------------------------------------------------------------------------*/
  402. // Returns a new rectangle that is the intersection of the two rectangles. If they don't intersect, returns false
  403. function intersectRects(rect1, rect2) {
  404. var res = {
  405. left: Math.max(rect1.left, rect2.left),
  406. right: Math.min(rect1.right, rect2.right),
  407. top: Math.max(rect1.top, rect2.top),
  408. bottom: Math.min(rect1.bottom, rect2.bottom)
  409. };
  410. if (res.left < res.right && res.top < res.bottom) {
  411. return res;
  412. }
  413. return false;
  414. }
  415. exports.intersectRects = intersectRects;
  416. // Returns a new point that will have been moved to reside within the given rectangle
  417. function constrainPoint(point, rect) {
  418. return {
  419. left: Math.min(Math.max(point.left, rect.left), rect.right),
  420. top: Math.min(Math.max(point.top, rect.top), rect.bottom)
  421. };
  422. }
  423. exports.constrainPoint = constrainPoint;
  424. // Returns a point that is the center of the given rectangle
  425. function getRectCenter(rect) {
  426. return {
  427. left: (rect.left + rect.right) / 2,
  428. top: (rect.top + rect.bottom) / 2
  429. };
  430. }
  431. exports.getRectCenter = getRectCenter;
  432. // Subtracts point2's coordinates from point1's coordinates, returning a delta
  433. function diffPoints(point1, point2) {
  434. return {
  435. left: point1.left - point2.left,
  436. top: point1.top - point2.top
  437. };
  438. }
  439. exports.diffPoints = diffPoints;
  440. /* Object Ordering by Field
  441. ----------------------------------------------------------------------------------------------------------------------*/
  442. function parseFieldSpecs(input) {
  443. var specs = [];
  444. var tokens = [];
  445. var i;
  446. var token;
  447. if (typeof input === 'string') {
  448. tokens = input.split(/\s*,\s*/);
  449. }
  450. else if (typeof input === 'function') {
  451. tokens = [input];
  452. }
  453. else if ($.isArray(input)) {
  454. tokens = input;
  455. }
  456. for (i = 0; i < tokens.length; i++) {
  457. token = tokens[i];
  458. if (typeof token === 'string') {
  459. specs.push(token.charAt(0) === '-' ?
  460. { field: token.substring(1), order: -1 } :
  461. { field: token, order: 1 });
  462. }
  463. else if (typeof token === 'function') {
  464. specs.push({ func: token });
  465. }
  466. }
  467. return specs;
  468. }
  469. exports.parseFieldSpecs = parseFieldSpecs;
  470. function compareByFieldSpecs(obj1, obj2, fieldSpecs) {
  471. var i;
  472. var cmp;
  473. for (i = 0; i < fieldSpecs.length; i++) {
  474. cmp = compareByFieldSpec(obj1, obj2, fieldSpecs[i]);
  475. if (cmp) {
  476. return cmp;
  477. }
  478. }
  479. return 0;
  480. }
  481. exports.compareByFieldSpecs = compareByFieldSpecs;
  482. function compareByFieldSpec(obj1, obj2, fieldSpec) {
  483. if (fieldSpec.func) {
  484. return fieldSpec.func(obj1, obj2);
  485. }
  486. return flexibleCompare(obj1[fieldSpec.field], obj2[fieldSpec.field]) *
  487. (fieldSpec.order || 1);
  488. }
  489. exports.compareByFieldSpec = compareByFieldSpec;
  490. function flexibleCompare(a, b) {
  491. if (!a && !b) {
  492. return 0;
  493. }
  494. if (b == null) {
  495. return -1;
  496. }
  497. if (a == null) {
  498. return 1;
  499. }
  500. if ($.type(a) === 'string' || $.type(b) === 'string') {
  501. return String(a).localeCompare(String(b));
  502. }
  503. return a - b;
  504. }
  505. exports.flexibleCompare = flexibleCompare;
  506. /* Date Utilities
  507. ----------------------------------------------------------------------------------------------------------------------*/
  508. exports.dayIDs = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
  509. exports.unitsDesc = ['year', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond']; // descending
  510. // Diffs the two moments into a Duration where full-days are recorded first, then the remaining time.
  511. // Moments will have their timezones normalized.
  512. function diffDayTime(a, b) {
  513. return moment.duration({
  514. days: a.clone().stripTime().diff(b.clone().stripTime(), 'days'),
  515. ms: a.time() - b.time() // time-of-day from day start. disregards timezone
  516. });
  517. }
  518. exports.diffDayTime = diffDayTime;
  519. // Diffs the two moments via their start-of-day (regardless of timezone). Produces whole-day durations.
  520. function diffDay(a, b) {
  521. return moment.duration({
  522. days: a.clone().stripTime().diff(b.clone().stripTime(), 'days')
  523. });
  524. }
  525. exports.diffDay = diffDay;
  526. // Diffs two moments, producing a duration, made of a whole-unit-increment of the given unit. Uses rounding.
  527. function diffByUnit(a, b, unit) {
  528. return moment.duration(Math.round(a.diff(b, unit, true)), // returnFloat=true
  529. unit);
  530. }
  531. exports.diffByUnit = diffByUnit;
  532. // Computes the unit name of the largest whole-unit period of time.
  533. // For example, 48 hours will be "days" whereas 49 hours will be "hours".
  534. // Accepts start/end, a range object, or an original duration object.
  535. function computeGreatestUnit(start, end) {
  536. var i;
  537. var unit;
  538. var val;
  539. for (i = 0; i < exports.unitsDesc.length; i++) {
  540. unit = exports.unitsDesc[i];
  541. val = computeRangeAs(unit, start, end);
  542. if (val >= 1 && isInt(val)) {
  543. break;
  544. }
  545. }
  546. return unit; // will be "milliseconds" if nothing else matches
  547. }
  548. exports.computeGreatestUnit = computeGreatestUnit;
  549. // like computeGreatestUnit, but has special abilities to interpret the source input for clues
  550. function computeDurationGreatestUnit(duration, durationInput) {
  551. var unit = computeGreatestUnit(duration);
  552. // prevent days:7 from being interpreted as a week
  553. if (unit === 'week' && typeof durationInput === 'object' && durationInput.days) {
  554. unit = 'day';
  555. }
  556. return unit;
  557. }
  558. exports.computeDurationGreatestUnit = computeDurationGreatestUnit;
  559. // Computes the number of units (like "hours") in the given range.
  560. // Range can be a {start,end} object, separate start/end args, or a Duration.
  561. // Results are based on Moment's .as() and .diff() methods, so results can depend on internal handling
  562. // of month-diffing logic (which tends to vary from version to version).
  563. function computeRangeAs(unit, start, end) {
  564. if (end != null) {
  565. return end.diff(start, unit, true);
  566. }
  567. else if (moment.isDuration(start)) {
  568. return start.as(unit);
  569. }
  570. else {
  571. return start.end.diff(start.start, unit, true);
  572. }
  573. }
  574. // Intelligently divides a range (specified by a start/end params) by a duration
  575. function divideRangeByDuration(start, end, dur) {
  576. var months;
  577. if (durationHasTime(dur)) {
  578. return (end - start) / dur;
  579. }
  580. months = dur.asMonths();
  581. if (Math.abs(months) >= 1 && isInt(months)) {
  582. return end.diff(start, 'months', true) / months;
  583. }
  584. return end.diff(start, 'days', true) / dur.asDays();
  585. }
  586. exports.divideRangeByDuration = divideRangeByDuration;
  587. // Intelligently divides one duration by another
  588. function divideDurationByDuration(dur1, dur2) {
  589. var months1;
  590. var months2;
  591. if (durationHasTime(dur1) || durationHasTime(dur2)) {
  592. return dur1 / dur2;
  593. }
  594. months1 = dur1.asMonths();
  595. months2 = dur2.asMonths();
  596. if (Math.abs(months1) >= 1 && isInt(months1) &&
  597. Math.abs(months2) >= 1 && isInt(months2)) {
  598. return months1 / months2;
  599. }
  600. return dur1.asDays() / dur2.asDays();
  601. }
  602. exports.divideDurationByDuration = divideDurationByDuration;
  603. // Intelligently multiplies a duration by a number
  604. function multiplyDuration(dur, n) {
  605. var months;
  606. if (durationHasTime(dur)) {
  607. return moment.duration(dur * n);
  608. }
  609. months = dur.asMonths();
  610. if (Math.abs(months) >= 1 && isInt(months)) {
  611. return moment.duration({ months: months * n });
  612. }
  613. return moment.duration({ days: dur.asDays() * n });
  614. }
  615. exports.multiplyDuration = multiplyDuration;
  616. // Returns a boolean about whether the given duration has any time parts (hours/minutes/seconds/ms)
  617. function durationHasTime(dur) {
  618. return Boolean(dur.hours() || dur.minutes() || dur.seconds() || dur.milliseconds());
  619. }
  620. exports.durationHasTime = durationHasTime;
  621. function isNativeDate(input) {
  622. return Object.prototype.toString.call(input) === '[object Date]' || input instanceof Date;
  623. }
  624. exports.isNativeDate = isNativeDate;
  625. // Returns a boolean about whether the given input is a time string, like "06:40:00" or "06:00"
  626. function isTimeString(str) {
  627. return typeof str === 'string' &&
  628. /^\d+\:\d+(?:\:\d+\.?(?:\d{3})?)?$/.test(str);
  629. }
  630. exports.isTimeString = isTimeString;
  631. /* Logging and Debug
  632. ----------------------------------------------------------------------------------------------------------------------*/
  633. function log() {
  634. var args = [];
  635. for (var _i = 0; _i < arguments.length; _i++) {
  636. args[_i] = arguments[_i];
  637. }
  638. var console = window.console;
  639. if (console && console.log) {
  640. return console.log.apply(console, args);
  641. }
  642. }
  643. exports.log = log;
  644. function warn() {
  645. var args = [];
  646. for (var _i = 0; _i < arguments.length; _i++) {
  647. args[_i] = arguments[_i];
  648. }
  649. var console = window.console;
  650. if (console && console.warn) {
  651. return console.warn.apply(console, args);
  652. }
  653. else {
  654. return log.apply(null, args);
  655. }
  656. }
  657. exports.warn = warn;
  658. /* General Utilities
  659. ----------------------------------------------------------------------------------------------------------------------*/
  660. var hasOwnPropMethod = {}.hasOwnProperty;
  661. // Merges an array of objects into a single object.
  662. // The second argument allows for an array of property names who's object values will be merged together.
  663. function mergeProps(propObjs, complexProps) {
  664. var dest = {};
  665. var i;
  666. var name;
  667. var complexObjs;
  668. var j;
  669. var val;
  670. var props;
  671. if (complexProps) {
  672. for (i = 0; i < complexProps.length; i++) {
  673. name = complexProps[i];
  674. complexObjs = [];
  675. // collect the trailing object values, stopping when a non-object is discovered
  676. for (j = propObjs.length - 1; j >= 0; j--) {
  677. val = propObjs[j][name];
  678. if (typeof val === 'object') {
  679. complexObjs.unshift(val);
  680. }
  681. else if (val !== undefined) {
  682. dest[name] = val; // if there were no objects, this value will be used
  683. break;
  684. }
  685. }
  686. // if the trailing values were objects, use the merged value
  687. if (complexObjs.length) {
  688. dest[name] = mergeProps(complexObjs);
  689. }
  690. }
  691. }
  692. // copy values into the destination, going from last to first
  693. for (i = propObjs.length - 1; i >= 0; i--) {
  694. props = propObjs[i];
  695. for (name in props) {
  696. if (!(name in dest)) {
  697. dest[name] = props[name];
  698. }
  699. }
  700. }
  701. return dest;
  702. }
  703. exports.mergeProps = mergeProps;
  704. function copyOwnProps(src, dest) {
  705. for (var name_1 in src) {
  706. if (hasOwnProp(src, name_1)) {
  707. dest[name_1] = src[name_1];
  708. }
  709. }
  710. }
  711. exports.copyOwnProps = copyOwnProps;
  712. function hasOwnProp(obj, name) {
  713. return hasOwnPropMethod.call(obj, name);
  714. }
  715. exports.hasOwnProp = hasOwnProp;
  716. function applyAll(functions, thisObj, args) {
  717. if ($.isFunction(functions)) {
  718. functions = [functions];
  719. }
  720. if (functions) {
  721. var i = void 0;
  722. var ret = void 0;
  723. for (i = 0; i < functions.length; i++) {
  724. ret = functions[i].apply(thisObj, args) || ret;
  725. }
  726. return ret;
  727. }
  728. }
  729. exports.applyAll = applyAll;
  730. function removeMatching(array, testFunc) {
  731. var removeCnt = 0;
  732. var i = 0;
  733. while (i < array.length) {
  734. if (testFunc(array[i])) {
  735. array.splice(i, 1);
  736. removeCnt++;
  737. }
  738. else {
  739. i++;
  740. }
  741. }
  742. return removeCnt;
  743. }
  744. exports.removeMatching = removeMatching;
  745. function removeExact(array, exactVal) {
  746. var removeCnt = 0;
  747. var i = 0;
  748. while (i < array.length) {
  749. if (array[i] === exactVal) {
  750. array.splice(i, 1);
  751. removeCnt++;
  752. }
  753. else {
  754. i++;
  755. }
  756. }
  757. return removeCnt;
  758. }
  759. exports.removeExact = removeExact;
  760. function isArraysEqual(a0, a1) {
  761. var len = a0.length;
  762. var i;
  763. if (len == null || len !== a1.length) {
  764. return false;
  765. }
  766. for (i = 0; i < len; i++) {
  767. if (a0[i] !== a1[i]) {
  768. return false;
  769. }
  770. }
  771. return true;
  772. }
  773. exports.isArraysEqual = isArraysEqual;
  774. function firstDefined() {
  775. var args = [];
  776. for (var _i = 0; _i < arguments.length; _i++) {
  777. args[_i] = arguments[_i];
  778. }
  779. for (var i = 0; i < args.length; i++) {
  780. if (args[i] !== undefined) {
  781. return args[i];
  782. }
  783. }
  784. }
  785. exports.firstDefined = firstDefined;
  786. function htmlEscape(s) {
  787. return (s + '').replace(/&/g, '&amp;')
  788. .replace(/</g, '&lt;')
  789. .replace(/>/g, '&gt;')
  790. .replace(/'/g, '&#039;')
  791. .replace(/"/g, '&quot;')
  792. .replace(/\n/g, '<br />');
  793. }
  794. exports.htmlEscape = htmlEscape;
  795. function stripHtmlEntities(text) {
  796. return text.replace(/&.*?;/g, '');
  797. }
  798. exports.stripHtmlEntities = stripHtmlEntities;
  799. // Given a hash of CSS properties, returns a string of CSS.
  800. // Uses property names as-is (no camel-case conversion). Will not make statements for null/undefined values.
  801. function cssToStr(cssProps) {
  802. var statements = [];
  803. $.each(cssProps, function (name, val) {
  804. if (val != null) {
  805. statements.push(name + ':' + val);
  806. }
  807. });
  808. return statements.join(';');
  809. }
  810. exports.cssToStr = cssToStr;
  811. // Given an object hash of HTML attribute names to values,
  812. // generates a string that can be injected between < > in HTML
  813. function attrsToStr(attrs) {
  814. var parts = [];
  815. $.each(attrs, function (name, val) {
  816. if (val != null) {
  817. parts.push(name + '="' + htmlEscape(val) + '"');
  818. }
  819. });
  820. return parts.join(' ');
  821. }
  822. exports.attrsToStr = attrsToStr;
  823. function capitaliseFirstLetter(str) {
  824. return str.charAt(0).toUpperCase() + str.slice(1);
  825. }
  826. exports.capitaliseFirstLetter = capitaliseFirstLetter;
  827. function compareNumbers(a, b) {
  828. return a - b;
  829. }
  830. exports.compareNumbers = compareNumbers;
  831. function isInt(n) {
  832. return n % 1 === 0;
  833. }
  834. exports.isInt = isInt;
  835. // Returns a method bound to the given object context.
  836. // Just like one of the jQuery.proxy signatures, but without the undesired behavior of treating the same method with
  837. // different contexts as identical when binding/unbinding events.
  838. function proxy(obj, methodName) {
  839. var method = obj[methodName];
  840. return function () {
  841. return method.apply(obj, arguments);
  842. };
  843. }
  844. exports.proxy = proxy;
  845. // Returns a function, that, as long as it continues to be invoked, will not
  846. // be triggered. The function will be called after it stops being called for
  847. // N milliseconds. If `immediate` is passed, trigger the function on the
  848. // leading edge, instead of the trailing.
  849. // https://github.com/jashkenas/underscore/blob/1.6.0/underscore.js#L714
  850. function debounce(func, wait, immediate) {
  851. if (immediate === void 0) { immediate = false; }
  852. var timeout;
  853. var args;
  854. var context;
  855. var timestamp;
  856. var result;
  857. var later = function () {
  858. var last = +new Date() - timestamp;
  859. if (last < wait) {
  860. timeout = setTimeout(later, wait - last);
  861. }
  862. else {
  863. timeout = null;
  864. if (!immediate) {
  865. result = func.apply(context, args);
  866. context = args = null;
  867. }
  868. }
  869. };
  870. return function () {
  871. context = this;
  872. args = arguments;
  873. timestamp = +new Date();
  874. var callNow = immediate && !timeout;
  875. if (!timeout) {
  876. timeout = setTimeout(later, wait);
  877. }
  878. if (callNow) {
  879. result = func.apply(context, args);
  880. context = args = null;
  881. }
  882. return result;
  883. };
  884. }
  885. exports.debounce = debounce;
  886. /***/ }),
  887. /* 5 */
  888. /***/ (function(module, exports, __webpack_require__) {
  889. Object.defineProperty(exports, "__esModule", { value: true });
  890. var moment = __webpack_require__(0);
  891. var moment_ext_1 = __webpack_require__(10);
  892. var UnzonedRange = /** @class */ (function () {
  893. function UnzonedRange(startInput, endInput) {
  894. // TODO: move these into footprint.
  895. // Especially, doesn't make sense for null startMs/endMs.
  896. this.isStart = true;
  897. this.isEnd = true;
  898. if (moment.isMoment(startInput)) {
  899. startInput = startInput.clone().stripZone();
  900. }
  901. if (moment.isMoment(endInput)) {
  902. endInput = endInput.clone().stripZone();
  903. }
  904. if (startInput) {
  905. this.startMs = startInput.valueOf();
  906. }
  907. if (endInput) {
  908. this.endMs = endInput.valueOf();
  909. }
  910. }
  911. /*
  912. SIDEEFFECT: will mutate eventRanges.
  913. Will return a new array result.
  914. Only works for non-open-ended ranges.
  915. */
  916. UnzonedRange.invertRanges = function (ranges, constraintRange) {
  917. var invertedRanges = [];
  918. var startMs = constraintRange.startMs; // the end of the previous range. the start of the new range
  919. var i;
  920. var dateRange;
  921. // ranges need to be in order. required for our date-walking algorithm
  922. ranges.sort(compareUnzonedRanges);
  923. for (i = 0; i < ranges.length; i++) {
  924. dateRange = ranges[i];
  925. // add the span of time before the event (if there is any)
  926. if (dateRange.startMs > startMs) {
  927. invertedRanges.push(new UnzonedRange(startMs, dateRange.startMs));
  928. }
  929. if (dateRange.endMs > startMs) {
  930. startMs = dateRange.endMs;
  931. }
  932. }
  933. // add the span of time after the last event (if there is any)
  934. if (startMs < constraintRange.endMs) {
  935. invertedRanges.push(new UnzonedRange(startMs, constraintRange.endMs));
  936. }
  937. return invertedRanges;
  938. };
  939. UnzonedRange.prototype.intersect = function (otherRange) {
  940. var startMs = this.startMs;
  941. var endMs = this.endMs;
  942. var newRange = null;
  943. if (otherRange.startMs != null) {
  944. if (startMs == null) {
  945. startMs = otherRange.startMs;
  946. }
  947. else {
  948. startMs = Math.max(startMs, otherRange.startMs);
  949. }
  950. }
  951. if (otherRange.endMs != null) {
  952. if (endMs == null) {
  953. endMs = otherRange.endMs;
  954. }
  955. else {
  956. endMs = Math.min(endMs, otherRange.endMs);
  957. }
  958. }
  959. if (startMs == null || endMs == null || startMs < endMs) {
  960. newRange = new UnzonedRange(startMs, endMs);
  961. newRange.isStart = this.isStart && startMs === this.startMs;
  962. newRange.isEnd = this.isEnd && endMs === this.endMs;
  963. }
  964. return newRange;
  965. };
  966. UnzonedRange.prototype.intersectsWith = function (otherRange) {
  967. return (this.endMs == null || otherRange.startMs == null || this.endMs > otherRange.startMs) &&
  968. (this.startMs == null || otherRange.endMs == null || this.startMs < otherRange.endMs);
  969. };
  970. UnzonedRange.prototype.containsRange = function (innerRange) {
  971. return (this.startMs == null || (innerRange.startMs != null && innerRange.startMs >= this.startMs)) &&
  972. (this.endMs == null || (innerRange.endMs != null && innerRange.endMs <= this.endMs));
  973. };
  974. // `date` can be a moment, a Date, or a millisecond time.
  975. UnzonedRange.prototype.containsDate = function (date) {
  976. var ms = date.valueOf();
  977. return (this.startMs == null || ms >= this.startMs) &&
  978. (this.endMs == null || ms < this.endMs);
  979. };
  980. // If the given date is not within the given range, move it inside.
  981. // (If it's past the end, make it one millisecond before the end).
  982. // `date` can be a moment, a Date, or a millisecond time.
  983. // Returns a MS-time.
  984. UnzonedRange.prototype.constrainDate = function (date) {
  985. var ms = date.valueOf();
  986. if (this.startMs != null && ms < this.startMs) {
  987. ms = this.startMs;
  988. }
  989. if (this.endMs != null && ms >= this.endMs) {
  990. ms = this.endMs - 1;
  991. }
  992. return ms;
  993. };
  994. UnzonedRange.prototype.equals = function (otherRange) {
  995. return this.startMs === otherRange.startMs && this.endMs === otherRange.endMs;
  996. };
  997. UnzonedRange.prototype.clone = function () {
  998. var range = new UnzonedRange(this.startMs, this.endMs);
  999. range.isStart = this.isStart;
  1000. range.isEnd = this.isEnd;
  1001. return range;
  1002. };
  1003. // Returns an ambig-zoned moment from startMs.
  1004. // BEWARE: returned moment is not localized.
  1005. // Formatting and start-of-week will be default.
  1006. UnzonedRange.prototype.getStart = function () {
  1007. if (this.startMs != null) {
  1008. return moment_ext_1.default.utc(this.startMs).stripZone();
  1009. }
  1010. return null;
  1011. };
  1012. // Returns an ambig-zoned moment from startMs.
  1013. // BEWARE: returned moment is not localized.
  1014. // Formatting and start-of-week will be default.
  1015. UnzonedRange.prototype.getEnd = function () {
  1016. if (this.endMs != null) {
  1017. return moment_ext_1.default.utc(this.endMs).stripZone();
  1018. }
  1019. return null;
  1020. };
  1021. UnzonedRange.prototype.as = function (unit) {
  1022. return moment.utc(this.endMs).diff(moment.utc(this.startMs), unit, true);
  1023. };
  1024. return UnzonedRange;
  1025. }());
  1026. exports.default = UnzonedRange;
  1027. /*
  1028. Only works for non-open-ended ranges.
  1029. */
  1030. function compareUnzonedRanges(range1, range2) {
  1031. return range1.startMs - range2.startMs; // earlier ranges go first
  1032. }
  1033. /***/ }),
  1034. /* 6 */
  1035. /***/ (function(module, exports, __webpack_require__) {
  1036. Object.defineProperty(exports, "__esModule", { value: true });
  1037. var tslib_1 = __webpack_require__(2);
  1038. var $ = __webpack_require__(3);
  1039. var ParsableModelMixin_1 = __webpack_require__(204);
  1040. var Class_1 = __webpack_require__(32);
  1041. var EventDefParser_1 = __webpack_require__(49);
  1042. var EventSource = /** @class */ (function (_super) {
  1043. tslib_1.__extends(EventSource, _super);
  1044. // can we do away with calendar? at least for the abstract?
  1045. // useful for buildEventDef
  1046. function EventSource(calendar) {
  1047. var _this = _super.call(this) || this;
  1048. _this.calendar = calendar;
  1049. _this.className = [];
  1050. _this.uid = String(EventSource.uuid++);
  1051. return _this;
  1052. }
  1053. /*
  1054. rawInput can be any data type!
  1055. */
  1056. EventSource.parse = function (rawInput, calendar) {
  1057. var source = new this(calendar);
  1058. if (typeof rawInput === 'object') {
  1059. if (source.applyProps(rawInput)) {
  1060. return source;
  1061. }
  1062. }
  1063. return false;
  1064. };
  1065. EventSource.normalizeId = function (id) {
  1066. if (id) {
  1067. return String(id);
  1068. }
  1069. return null;
  1070. };
  1071. EventSource.prototype.fetch = function (start, end, timezone) {
  1072. // subclasses must implement. must return a promise.
  1073. };
  1074. EventSource.prototype.removeEventDefsById = function (eventDefId) {
  1075. // optional for subclasses to implement
  1076. };
  1077. EventSource.prototype.removeAllEventDefs = function () {
  1078. // optional for subclasses to implement
  1079. };
  1080. /*
  1081. For compairing/matching
  1082. */
  1083. EventSource.prototype.getPrimitive = function (otherSource) {
  1084. // subclasses must implement
  1085. };
  1086. EventSource.prototype.parseEventDefs = function (rawEventDefs) {
  1087. var i;
  1088. var eventDef;
  1089. var eventDefs = [];
  1090. for (i = 0; i < rawEventDefs.length; i++) {
  1091. eventDef = this.parseEventDef(rawEventDefs[i]);
  1092. if (eventDef) {
  1093. eventDefs.push(eventDef);
  1094. }
  1095. }
  1096. return eventDefs;
  1097. };
  1098. EventSource.prototype.parseEventDef = function (rawInput) {
  1099. var calendarTransform = this.calendar.opt('eventDataTransform');
  1100. var sourceTransform = this.eventDataTransform;
  1101. if (calendarTransform) {
  1102. rawInput = calendarTransform(rawInput);
  1103. }
  1104. if (sourceTransform) {
  1105. rawInput = sourceTransform(rawInput);
  1106. }
  1107. return EventDefParser_1.default.parse(rawInput, this);
  1108. };
  1109. EventSource.prototype.applyManualStandardProps = function (rawProps) {
  1110. if (rawProps.id != null) {
  1111. this.id = EventSource.normalizeId(rawProps.id);
  1112. }
  1113. // TODO: converge with EventDef
  1114. if ($.isArray(rawProps.className)) {
  1115. this.className = rawProps.className;
  1116. }
  1117. else if (typeof rawProps.className === 'string') {
  1118. this.className = rawProps.className.split(/\s+/);
  1119. }
  1120. return true;
  1121. };
  1122. EventSource.uuid = 0;
  1123. EventSource.defineStandardProps = ParsableModelMixin_1.default.defineStandardProps;
  1124. EventSource.copyVerbatimStandardProps = ParsableModelMixin_1.default.copyVerbatimStandardProps;
  1125. return EventSource;
  1126. }(Class_1.default));
  1127. exports.default = EventSource;
  1128. ParsableModelMixin_1.default.mixInto(EventSource);
  1129. // Parsing
  1130. // ---------------------------------------------------------------------------------------------------------------------
  1131. EventSource.defineStandardProps({
  1132. // manually process...
  1133. id: false,
  1134. className: false,
  1135. // automatically transfer...
  1136. color: true,
  1137. backgroundColor: true,
  1138. borderColor: true,
  1139. textColor: true,
  1140. editable: true,
  1141. startEditable: true,
  1142. durationEditable: true,
  1143. rendering: true,
  1144. overlap: true,
  1145. constraint: true,
  1146. allDayDefault: true,
  1147. eventDataTransform: true
  1148. });
  1149. /***/ }),
  1150. /* 7 */
  1151. /***/ (function(module, exports, __webpack_require__) {
  1152. /*
  1153. Utility methods for easily listening to events on another object,
  1154. and more importantly, easily unlistening from them.
  1155. USAGE:
  1156. import { default as ListenerMixin, ListenerInterface } from './ListenerMixin'
  1157. in class:
  1158. listenTo: ListenerInterface['listenTo']
  1159. stopListeningTo: ListenerInterface['stopListeningTo']
  1160. after class:
  1161. ListenerMixin.mixInto(TheClass)
  1162. */
  1163. Object.defineProperty(exports, "__esModule", { value: true });
  1164. var tslib_1 = __webpack_require__(2);
  1165. var $ = __webpack_require__(3);
  1166. var Mixin_1 = __webpack_require__(14);
  1167. var guid = 0;
  1168. var ListenerMixin = /** @class */ (function (_super) {
  1169. tslib_1.__extends(ListenerMixin, _super);
  1170. function ListenerMixin() {
  1171. return _super !== null && _super.apply(this, arguments) || this;
  1172. }
  1173. /*
  1174. Given an `other` object that has on/off methods, bind the given `callback` to an event by the given name.
  1175. The `callback` will be called with the `this` context of the object that .listenTo is being called on.
  1176. Can be called:
  1177. .listenTo(other, eventName, callback)
  1178. OR
  1179. .listenTo(other, {
  1180. eventName1: callback1,
  1181. eventName2: callback2
  1182. })
  1183. */
  1184. ListenerMixin.prototype.listenTo = function (other, arg, callback) {
  1185. if (typeof arg === 'object') {
  1186. for (var eventName in arg) {
  1187. if (arg.hasOwnProperty(eventName)) {
  1188. this.listenTo(other, eventName, arg[eventName]);
  1189. }
  1190. }
  1191. }
  1192. else if (typeof arg === 'string') {
  1193. other.on(arg + '.' + this.getListenerNamespace(), // use event namespacing to identify this object
  1194. $.proxy(callback, this) // always use `this` context
  1195. // the usually-undesired jQuery guid behavior doesn't matter,
  1196. // because we always unbind via namespace
  1197. );
  1198. }
  1199. };
  1200. /*
  1201. Causes the current object to stop listening to events on the `other` object.
  1202. `eventName` is optional. If omitted, will stop listening to ALL events on `other`.
  1203. */
  1204. ListenerMixin.prototype.stopListeningTo = function (other, eventName) {
  1205. other.off((eventName || '') + '.' + this.getListenerNamespace());
  1206. };
  1207. /*
  1208. Returns a string, unique to this object, to be used for event namespacing
  1209. */
  1210. ListenerMixin.prototype.getListenerNamespace = function () {
  1211. if (this.listenerId == null) {
  1212. this.listenerId = guid++;
  1213. }
  1214. return '_listener' + this.listenerId;
  1215. };
  1216. return ListenerMixin;
  1217. }(Mixin_1.default));
  1218. exports.default = ListenerMixin;
  1219. /***/ }),
  1220. /* 8 */,
  1221. /* 9 */,
  1222. /* 10 */
  1223. /***/ (function(module, exports, __webpack_require__) {
  1224. Object.defineProperty(exports, "__esModule", { value: true });
  1225. var moment = __webpack_require__(0);
  1226. var $ = __webpack_require__(3);
  1227. var util_1 = __webpack_require__(4);
  1228. var ambigDateOfMonthRegex = /^\s*\d{4}-\d\d$/;
  1229. var ambigTimeOrZoneRegex = /^\s*\d{4}-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?)?$/;
  1230. var newMomentProto = moment.fn; // where we will attach our new methods
  1231. exports.newMomentProto = newMomentProto;
  1232. var oldMomentProto = $.extend({}, newMomentProto); // copy of original moment methods
  1233. exports.oldMomentProto = oldMomentProto;
  1234. // tell momentjs to transfer these properties upon clone
  1235. var momentProperties = moment.momentProperties;
  1236. momentProperties.push('_fullCalendar');
  1237. momentProperties.push('_ambigTime');
  1238. momentProperties.push('_ambigZone');
  1239. /*
  1240. Call this if you want Moment's original format method to be used
  1241. */
  1242. function oldMomentFormat(mom, formatStr) {
  1243. return oldMomentProto.format.call(mom, formatStr); // oldMomentProto defined in moment-ext.js
  1244. }
  1245. exports.oldMomentFormat = oldMomentFormat;
  1246. // Creating
  1247. // -------------------------------------------------------------------------------------------------
  1248. // Creates a new moment, similar to the vanilla moment(...) constructor, but with
  1249. // extra features (ambiguous time, enhanced formatting). When given an existing moment,
  1250. // it will function as a clone (and retain the zone of the moment). Anything else will
  1251. // result in a moment in the local zone.
  1252. var momentExt = function () {
  1253. return makeMoment(arguments);
  1254. };
  1255. exports.default = momentExt;
  1256. // Sames as momentExt, but forces the resulting moment to be in the UTC timezone.
  1257. momentExt.utc = function () {
  1258. var mom = makeMoment(arguments, true);
  1259. // Force it into UTC because makeMoment doesn't guarantee it
  1260. // (if given a pre-existing moment for example)
  1261. if (mom.hasTime()) {
  1262. mom.utc();
  1263. }
  1264. return mom;
  1265. };
  1266. // Same as momentExt, but when given an ISO8601 string, the timezone offset is preserved.
  1267. // ISO8601 strings with no timezone offset will become ambiguously zoned.
  1268. momentExt.parseZone = function () {
  1269. return makeMoment(arguments, true, true);
  1270. };
  1271. // Builds an enhanced moment from args. When given an existing moment, it clones. When given a
  1272. // native Date, or called with no arguments (the current time), the resulting moment will be local.
  1273. // Anything else needs to be "parsed" (a string or an array), and will be affected by:
  1274. // parseAsUTC - if there is no zone information, should we parse the input in UTC?
  1275. // parseZone - if there is zone information, should we force the zone of the moment?
  1276. function makeMoment(args, parseAsUTC, parseZone) {
  1277. if (parseAsUTC === void 0) { parseAsUTC = false; }
  1278. if (parseZone === void 0) { parseZone = false; }
  1279. var input = args[0];
  1280. var isSingleString = args.length === 1 && typeof input === 'string';
  1281. var isAmbigTime;
  1282. var isAmbigZone;
  1283. var ambigMatch;
  1284. var mom;
  1285. if (moment.isMoment(input) || util_1.isNativeDate(input) || input === undefined) {
  1286. mom = moment.apply(null, args);
  1287. }
  1288. else {
  1289. isAmbigTime = false;
  1290. isAmbigZone = false;
  1291. if (isSingleString) {
  1292. if (ambigDateOfMonthRegex.test(input)) {
  1293. // accept strings like '2014-05', but convert to the first of the month
  1294. input += '-01';
  1295. args = [input]; // for when we pass it on to moment's constructor
  1296. isAmbigTime = true;
  1297. isAmbigZone = true;
  1298. }
  1299. else if ((ambigMatch = ambigTimeOrZoneRegex.exec(input))) {
  1300. isAmbigTime = !ambigMatch[5]; // no time part?
  1301. isAmbigZone = true;
  1302. }
  1303. }
  1304. else if ($.isArray(input)) {
  1305. // arrays have no timezone information, so assume ambiguous zone
  1306. isAmbigZone = true;
  1307. }
  1308. // otherwise, probably a string with a format
  1309. if (parseAsUTC || isAmbigTime) {
  1310. mom = moment.utc.apply(moment, args);
  1311. }
  1312. else {
  1313. mom = moment.apply(null, args);
  1314. }
  1315. if (isAmbigTime) {
  1316. mom._ambigTime = true;
  1317. mom._ambigZone = true; // ambiguous time always means ambiguous zone
  1318. }
  1319. else if (parseZone) {
  1320. if (isAmbigZone) {
  1321. mom._ambigZone = true;
  1322. }
  1323. else if (isSingleString) {
  1324. mom.utcOffset(input); // if not a valid zone, will assign UTC
  1325. }
  1326. }
  1327. }
  1328. mom._fullCalendar = true; // flag for extended functionality
  1329. return mom;
  1330. }
  1331. // Week Number
  1332. // -------------------------------------------------------------------------------------------------
  1333. // Returns the week number, considering the locale's custom week number calcuation
  1334. // `weeks` is an alias for `week`
  1335. newMomentProto.week = newMomentProto.weeks = function (input) {
  1336. var weekCalc = this._locale._fullCalendar_weekCalc;
  1337. if (input == null && typeof weekCalc === 'function') {
  1338. return weekCalc(this);
  1339. }
  1340. else if (weekCalc === 'ISO') {
  1341. return oldMomentProto.isoWeek.apply(this, arguments); // ISO getter/setter
  1342. }
  1343. return oldMomentProto.week.apply(this, arguments); // local getter/setter
  1344. };
  1345. // Time-of-day
  1346. // -------------------------------------------------------------------------------------------------
  1347. // GETTER
  1348. // Returns a Duration with the hours/minutes/seconds/ms values of the moment.
  1349. // If the moment has an ambiguous time, a duration of 00:00 will be returned.
  1350. //
  1351. // SETTER
  1352. // You can supply a Duration, a Moment, or a Duration-like argument.
  1353. // When setting the time, and the moment has an ambiguous time, it then becomes unambiguous.
  1354. newMomentProto.time = function (time) {
  1355. // Fallback to the original method (if there is one) if this moment wasn't created via FullCalendar.
  1356. // `time` is a generic enough method name where this precaution is necessary to avoid collisions w/ other plugins.
  1357. if (!this._fullCalendar) {
  1358. return oldMomentProto.time.apply(this, arguments);
  1359. }
  1360. if (time == null) {
  1361. return moment.duration({
  1362. hours: this.hours(),
  1363. minutes: this.minutes(),
  1364. seconds: this.seconds(),
  1365. milliseconds: this.milliseconds()
  1366. });
  1367. }
  1368. else {
  1369. this._ambigTime = false; // mark that the moment now has a time
  1370. if (!moment.isDuration(time) && !moment.isMoment(time)) {
  1371. time = moment.duration(time);
  1372. }
  1373. // The day value should cause overflow (so 24 hours becomes 00:00:00 of next day).
  1374. // Only for Duration times, not Moment times.
  1375. var dayHours = 0;
  1376. if (moment.isDuration(time)) {
  1377. dayHours = Math.floor(time.asDays()) * 24;
  1378. }
  1379. // We need to set the individual fields.
  1380. // Can't use startOf('day') then add duration. In case of DST at start of day.
  1381. return this.hours(dayHours + time.hours())
  1382. .minutes(time.minutes())
  1383. .seconds(time.seconds())
  1384. .milliseconds(time.milliseconds());
  1385. }
  1386. };
  1387. // Converts the moment to UTC, stripping out its time-of-day and timezone offset,
  1388. // but preserving its YMD. A moment with a stripped time will display no time
  1389. // nor timezone offset when .format() is called.
  1390. newMomentProto.stripTime = function () {
  1391. if (!this._ambigTime) {
  1392. this.utc(true); // keepLocalTime=true (for keeping *date* value)
  1393. // set time to zero
  1394. this.set({
  1395. hours: 0,
  1396. minutes: 0,
  1397. seconds: 0,
  1398. ms: 0
  1399. });
  1400. // Mark the time as ambiguous. This needs to happen after the .utc() call, which might call .utcOffset(),
  1401. // which clears all ambig flags.
  1402. this._ambigTime = true;
  1403. this._ambigZone = true; // if ambiguous time, also ambiguous timezone offset
  1404. }
  1405. return this; // for chaining
  1406. };
  1407. // Returns if the moment has a non-ambiguous time (boolean)
  1408. newMomentProto.hasTime = function () {
  1409. return !this._ambigTime;
  1410. };
  1411. // Timezone
  1412. // -------------------------------------------------------------------------------------------------
  1413. // Converts the moment to UTC, stripping out its timezone offset, but preserving its
  1414. // YMD and time-of-day. A moment with a stripped timezone offset will display no
  1415. // timezone offset when .format() is called.
  1416. newMomentProto.stripZone = function () {
  1417. var wasAmbigTime;
  1418. if (!this._ambigZone) {
  1419. wasAmbigTime = this._ambigTime;
  1420. this.utc(true); // keepLocalTime=true (for keeping date and time values)
  1421. // the above call to .utc()/.utcOffset() unfortunately might clear the ambig flags, so restore
  1422. this._ambigTime = wasAmbigTime || false;
  1423. // Mark the zone as ambiguous. This needs to happen after the .utc() call, which might call .utcOffset(),
  1424. // which clears the ambig flags.
  1425. this._ambigZone = true;
  1426. }
  1427. return this; // for chaining
  1428. };
  1429. // Returns of the moment has a non-ambiguous timezone offset (boolean)
  1430. newMomentProto.hasZone = function () {
  1431. return !this._ambigZone;
  1432. };
  1433. // implicitly marks a zone
  1434. newMomentProto.local = function (keepLocalTime) {
  1435. // for when converting from ambiguously-zoned to local,
  1436. // keep the time values when converting from UTC -> local
  1437. oldMomentProto.local.call(this, this._ambigZone || keepLocalTime);
  1438. // ensure non-ambiguous
  1439. // this probably already happened via local() -> utcOffset(), but don't rely on Moment's internals
  1440. this._ambigTime = false;
  1441. this._ambigZone = false;
  1442. return this; // for chaining
  1443. };
  1444. // implicitly marks a zone
  1445. newMomentProto.utc = function (keepLocalTime) {
  1446. oldMomentProto.utc.call(this, keepLocalTime);
  1447. // ensure non-ambiguous
  1448. // this probably already happened via utc() -> utcOffset(), but don't rely on Moment's internals
  1449. this._ambigTime = false;
  1450. this._ambigZone = false;
  1451. return this;
  1452. };
  1453. // implicitly marks a zone (will probably get called upon .utc() and .local())
  1454. newMomentProto.utcOffset = function (tzo) {
  1455. if (tzo != null) {
  1456. // these assignments needs to happen before the original zone method is called.
  1457. // I forget why, something to do with a browser crash.
  1458. this._ambigTime = false;
  1459. this._ambigZone = false;
  1460. }
  1461. return oldMomentProto.utcOffset.apply(this, arguments);
  1462. };
  1463. /***/ }),
  1464. /* 11 */
  1465. /***/ (function(module, exports, __webpack_require__) {
  1466. /*
  1467. USAGE:
  1468. import { default as EmitterMixin, EmitterInterface } from './EmitterMixin'
  1469. in class:
  1470. on: EmitterInterface['on']
  1471. one: EmitterInterface['one']
  1472. off: EmitterInterface['off']
  1473. trigger: EmitterInterface['trigger']
  1474. triggerWith: EmitterInterface['triggerWith']
  1475. hasHandlers: EmitterInterface['hasHandlers']
  1476. after class:
  1477. EmitterMixin.mixInto(TheClass)
  1478. */
  1479. Object.defineProperty(exports, "__esModule", { value: true });
  1480. var tslib_1 = __webpack_require__(2);
  1481. var $ = __webpack_require__(3);
  1482. var Mixin_1 = __webpack_require__(14);
  1483. var EmitterMixin = /** @class */ (function (_super) {
  1484. tslib_1.__extends(EmitterMixin, _super);
  1485. function EmitterMixin() {
  1486. return _super !== null && _super.apply(this, arguments) || this;
  1487. }
  1488. // jQuery-ification via $(this) allows a non-DOM object to have
  1489. // the same event handling capabilities (including namespaces).
  1490. EmitterMixin.prototype.on = function (types, handler) {
  1491. $(this).on(types, this._prepareIntercept(handler));
  1492. return this; // for chaining
  1493. };
  1494. EmitterMixin.prototype.one = function (types, handler) {
  1495. $(this).one(types, this._prepareIntercept(handler));
  1496. return this; // for chaining
  1497. };
  1498. EmitterMixin.prototype._prepareIntercept = function (handler) {
  1499. // handlers are always called with an "event" object as their first param.
  1500. // sneak the `this` context and arguments into the extra parameter object
  1501. // and forward them on to the original handler.
  1502. var intercept = function (ev, extra) {
  1503. return handler.apply(extra.context || this, extra.args || []);
  1504. };
  1505. // mimick jQuery's internal "proxy" system (risky, I know)
  1506. // causing all functions with the same .guid to appear to be the same.
  1507. // https://github.com/jquery/jquery/blob/2.2.4/src/core.js#L448
  1508. // this is needed for calling .off with the original non-intercept handler.
  1509. if (!handler.guid) {
  1510. handler.guid = $.guid++;
  1511. }
  1512. intercept.guid = handler.guid;
  1513. return intercept;
  1514. };
  1515. EmitterMixin.prototype.off = function (types, handler) {
  1516. $(this).off(types, handler);
  1517. return this; // for chaining
  1518. };
  1519. EmitterMixin.prototype.trigger = function (types) {
  1520. var args = [];
  1521. for (var _i = 1; _i < arguments.length; _i++) {
  1522. args[_i - 1] = arguments[_i];
  1523. }
  1524. // pass in "extra" info to the intercept
  1525. $(this).triggerHandler(types, { args: args });
  1526. return this; // for chaining
  1527. };
  1528. EmitterMixin.prototype.triggerWith = function (types, context, args) {
  1529. // `triggerHandler` is less reliant on the DOM compared to `trigger`.
  1530. // pass in "extra" info to the intercept.
  1531. $(this).triggerHandler(types, { context: context, args: args });
  1532. return this; // for chaining
  1533. };
  1534. EmitterMixin.prototype.hasHandlers = function (type) {
  1535. var hash = $._data(this, 'events'); // http://blog.jquery.com/2012/08/09/jquery-1-8-released/
  1536. return hash && hash[type] && hash[type].length > 0;
  1537. };
  1538. return EmitterMixin;
  1539. }(Mixin_1.default));
  1540. exports.default = EmitterMixin;
  1541. /***/ }),
  1542. /* 12 */
  1543. /***/ (function(module, exports) {
  1544. Object.defineProperty(exports, "__esModule", { value: true });
  1545. /*
  1546. Meant to be immutable
  1547. */
  1548. var ComponentFootprint = /** @class */ (function () {
  1549. function ComponentFootprint(unzonedRange, isAllDay) {
  1550. this.isAllDay = false; // component can choose to ignore this
  1551. this.unzonedRange = unzonedRange;
  1552. this.isAllDay = isAllDay;
  1553. }
  1554. /*
  1555. Only works for non-open-ended ranges.
  1556. */
  1557. ComponentFootprint.prototype.toLegacy = function (calendar) {
  1558. return {
  1559. start: calendar.msToMoment(this.unzonedRange.startMs, this.isAllDay),
  1560. end: calendar.msToMoment(this.unzonedRange.endMs, this.isAllDay)
  1561. };
  1562. };
  1563. return ComponentFootprint;
  1564. }());
  1565. exports.default = ComponentFootprint;
  1566. /***/ }),
  1567. /* 13 */
  1568. /***/ (function(module, exports, __webpack_require__) {
  1569. Object.defineProperty(exports, "__esModule", { value: true });
  1570. var tslib_1 = __webpack_require__(2);
  1571. var EventDef_1 = __webpack_require__(33);
  1572. var EventInstance_1 = __webpack_require__(205);
  1573. var EventDateProfile_1 = __webpack_require__(17);
  1574. var SingleEventDef = /** @class */ (function (_super) {
  1575. tslib_1.__extends(SingleEventDef, _super);
  1576. function SingleEventDef() {
  1577. return _super !== null && _super.apply(this, arguments) || this;
  1578. }
  1579. /*
  1580. Will receive start/end params, but will be ignored.
  1581. */
  1582. SingleEventDef.prototype.buildInstances = function () {
  1583. return [this.buildInstance()];
  1584. };
  1585. SingleEventDef.prototype.buildInstance = function () {
  1586. return new EventInstance_1.default(this, // definition
  1587. this.dateProfile);
  1588. };
  1589. SingleEventDef.prototype.isAllDay = function () {
  1590. return this.dateProfile.isAllDay();
  1591. };
  1592. SingleEventDef.prototype.clone = function () {
  1593. var def = _super.prototype.clone.call(this);
  1594. def.dateProfile = this.dateProfile;
  1595. return def;
  1596. };
  1597. SingleEventDef.prototype.rezone = function () {
  1598. var calendar = this.source.calendar;
  1599. var dateProfile = this.dateProfile;
  1600. this.dateProfile = new EventDateProfile_1.default(calendar.moment(dateProfile.start), dateProfile.end ? calendar.moment(dateProfile.end) : null, calendar);
  1601. };
  1602. /*
  1603. NOTE: if super-method fails, should still attempt to apply
  1604. */
  1605. SingleEventDef.prototype.applyManualStandardProps = function (rawProps) {
  1606. var superSuccess = _super.prototype.applyManualStandardProps.call(this, rawProps);
  1607. var dateProfile = EventDateProfile_1.default.parse(rawProps, this.source); // returns null on failure
  1608. if (dateProfile) {
  1609. this.dateProfile = dateProfile;
  1610. // make sure `date` shows up in the legacy event objects as-is
  1611. if (rawProps.date != null) {
  1612. this.miscProps.date = rawProps.date;
  1613. }
  1614. return superSuccess;
  1615. }
  1616. else {
  1617. return false;
  1618. }
  1619. };
  1620. return SingleEventDef;
  1621. }(EventDef_1.default));
  1622. exports.default = SingleEventDef;
  1623. // Parsing
  1624. // ---------------------------------------------------------------------------------------------------------------------
  1625. SingleEventDef.defineStandardProps({
  1626. start: false,
  1627. date: false,
  1628. end: false,
  1629. allDay: false
  1630. });
  1631. /***/ }),
  1632. /* 14 */
  1633. /***/ (function(module, exports) {
  1634. Object.defineProperty(exports, "__esModule", { value: true });
  1635. var Mixin = /** @class */ (function () {
  1636. function Mixin() {
  1637. }
  1638. Mixin.mixInto = function (destClass) {
  1639. var _this = this;
  1640. Object.getOwnPropertyNames(this.prototype).forEach(function (name) {
  1641. if (!destClass.prototype[name]) {
  1642. destClass.prototype[name] = _this.prototype[name];
  1643. }
  1644. });
  1645. };
  1646. /*
  1647. will override existing methods
  1648. TODO: remove! not used anymore
  1649. */
  1650. Mixin.mixOver = function (destClass) {
  1651. var _this = this;
  1652. Object.getOwnPropertyNames(this.prototype).forEach(function (name) {
  1653. destClass.prototype[name] = _this.prototype[name];
  1654. });
  1655. };
  1656. return Mixin;
  1657. }());
  1658. exports.default = Mixin;
  1659. /***/ }),
  1660. /* 15 */
  1661. /***/ (function(module, exports) {
  1662. Object.defineProperty(exports, "__esModule", { value: true });
  1663. var Interaction = /** @class */ (function () {
  1664. function Interaction(component) {
  1665. this.view = component._getView();
  1666. this.component = component;
  1667. }
  1668. Interaction.prototype.opt = function (name) {
  1669. return this.view.opt(name);
  1670. };
  1671. Interaction.prototype.end = function () {
  1672. // subclasses can implement
  1673. };
  1674. return Interaction;
  1675. }());
  1676. exports.default = Interaction;
  1677. /***/ }),
  1678. /* 16 */
  1679. /***/ (function(module, exports, __webpack_require__) {
  1680. Object.defineProperty(exports, "__esModule", { value: true });
  1681. exports.version = '3.8.0';
  1682. // When introducing internal API incompatibilities (where fullcalendar plugins would break),
  1683. // the minor version of the calendar should be upped (ex: 2.7.2 -> 2.8.0)
  1684. // and the below integer should be incremented.
  1685. exports.internalApiVersion = 12;
  1686. var util_1 = __webpack_require__(4);
  1687. exports.applyAll = util_1.applyAll;
  1688. exports.debounce = util_1.debounce;
  1689. exports.isInt = util_1.isInt;
  1690. exports.htmlEscape = util_1.htmlEscape;
  1691. exports.cssToStr = util_1.cssToStr;
  1692. exports.proxy = util_1.proxy;
  1693. exports.capitaliseFirstLetter = util_1.capitaliseFirstLetter;
  1694. exports.getOuterRect = util_1.getOuterRect;
  1695. exports.getClientRect = util_1.getClientRect;
  1696. exports.getContentRect = util_1.getContentRect;
  1697. exports.getScrollbarWidths = util_1.getScrollbarWidths;
  1698. exports.preventDefault = util_1.preventDefault;
  1699. exports.parseFieldSpecs = util_1.parseFieldSpecs;
  1700. exports.compareByFieldSpecs = util_1.compareByFieldSpecs;
  1701. exports.compareByFieldSpec = util_1.compareByFieldSpec;
  1702. exports.flexibleCompare = util_1.flexibleCompare;
  1703. exports.computeGreatestUnit = util_1.computeGreatestUnit;
  1704. exports.divideRangeByDuration = util_1.divideRangeByDuration;
  1705. exports.divideDurationByDuration = util_1.divideDurationByDuration;
  1706. exports.multiplyDuration = util_1.multiplyDuration;
  1707. exports.durationHasTime = util_1.durationHasTime;
  1708. exports.log = util_1.log;
  1709. exports.warn = util_1.warn;
  1710. exports.removeExact = util_1.removeExact;
  1711. exports.intersectRects = util_1.intersectRects;
  1712. var date_formatting_1 = __webpack_require__(47);
  1713. exports.formatDate = date_formatting_1.formatDate;
  1714. exports.formatRange = date_formatting_1.formatRange;
  1715. exports.queryMostGranularFormatUnit = date_formatting_1.queryMostGranularFormatUnit;
  1716. var locale_1 = __webpack_require__(30);
  1717. exports.datepickerLocale = locale_1.datepickerLocale;
  1718. exports.locale = locale_1.locale;
  1719. var moment_ext_1 = __webpack_require__(10);
  1720. exports.moment = moment_ext_1.default;
  1721. var EmitterMixin_1 = __webpack_require__(11);
  1722. exports.EmitterMixin = EmitterMixin_1.default;
  1723. var ListenerMixin_1 = __webpack_require__(7);
  1724. exports.ListenerMixin = ListenerMixin_1.default;
  1725. var Model_1 = __webpack_require__(48);
  1726. exports.Model = Model_1.default;
  1727. var Constraints_1 = __webpack_require__(203);
  1728. exports.Constraints = Constraints_1.default;
  1729. var UnzonedRange_1 = __webpack_require__(5);
  1730. exports.UnzonedRange = UnzonedRange_1.default;
  1731. var ComponentFootprint_1 = __webpack_require__(12);
  1732. exports.ComponentFootprint = ComponentFootprint_1.default;
  1733. var BusinessHourGenerator_1 = __webpack_require__(208);
  1734. exports.BusinessHourGenerator = BusinessHourGenerator_1.default;
  1735. var EventDef_1 = __webpack_require__(33);
  1736. exports.EventDef = EventDef_1.default;
  1737. var EventDefMutation_1 = __webpack_require__(36);
  1738. exports.EventDefMutation = EventDefMutation_1.default;
  1739. var EventSourceParser_1 = __webpack_require__(37);
  1740. exports.EventSourceParser = EventSourceParser_1.default;
  1741. var EventSource_1 = __webpack_require__(6);
  1742. exports.EventSource = EventSource_1.default;
  1743. var ThemeRegistry_1 = __webpack_require__(51);
  1744. exports.defineThemeSystem = ThemeRegistry_1.defineThemeSystem;
  1745. var EventInstanceGroup_1 = __webpack_require__(18);
  1746. exports.EventInstanceGroup = EventInstanceGroup_1.default;
  1747. var ArrayEventSource_1 = __webpack_require__(52);
  1748. exports.ArrayEventSource = ArrayEventSource_1.default;
  1749. var FuncEventSource_1 = __webpack_require__(211);
  1750. exports.FuncEventSource = FuncEventSource_1.default;
  1751. var JsonFeedEventSource_1 = __webpack_require__(212);
  1752. exports.JsonFeedEventSource = JsonFeedEventSource_1.default;
  1753. var EventFootprint_1 = __webpack_require__(35);
  1754. exports.EventFootprint = EventFootprint_1.default;
  1755. var Class_1 = __webpack_require__(32);
  1756. exports.Class = Class_1.default;
  1757. var Mixin_1 = __webpack_require__(14);
  1758. exports.Mixin = Mixin_1.default;
  1759. var CoordCache_1 = __webpack_require__(53);
  1760. exports.CoordCache = CoordCache_1.default;
  1761. var DragListener_1 = __webpack_require__(54);
  1762. exports.DragListener = DragListener_1.default;
  1763. var Promise_1 = __webpack_require__(19);
  1764. exports.Promise = Promise_1.default;
  1765. var TaskQueue_1 = __webpack_require__(213);
  1766. exports.TaskQueue = TaskQueue_1.default;
  1767. var RenderQueue_1 = __webpack_require__(214);
  1768. exports.RenderQueue = RenderQueue_1.default;
  1769. var Scroller_1 = __webpack_require__(39);
  1770. exports.Scroller = Scroller_1.default;
  1771. var Theme_1 = __webpack_require__(38);
  1772. exports.Theme = Theme_1.default;
  1773. var DateComponent_1 = __webpack_require__(215);
  1774. exports.DateComponent = DateComponent_1.default;
  1775. var InteractiveDateComponent_1 = __webpack_require__(40);
  1776. exports.InteractiveDateComponent = InteractiveDateComponent_1.default;
  1777. var Calendar_1 = __webpack_require__(216);
  1778. exports.Calendar = Calendar_1.default;
  1779. var View_1 = __webpack_require__(41);
  1780. exports.View = View_1.default;
  1781. var ViewRegistry_1 = __webpack_require__(21);
  1782. exports.defineView = ViewRegistry_1.defineView;
  1783. exports.getViewConfig = ViewRegistry_1.getViewConfig;
  1784. var DayTableMixin_1 = __webpack_require__(55);
  1785. exports.DayTableMixin = DayTableMixin_1.default;
  1786. var BusinessHourRenderer_1 = __webpack_require__(56);
  1787. exports.BusinessHourRenderer = BusinessHourRenderer_1.default;
  1788. var EventRenderer_1 = __webpack_require__(42);
  1789. exports.EventRenderer = EventRenderer_1.default;
  1790. var FillRenderer_1 = __webpack_require__(57);
  1791. exports.FillRenderer = FillRenderer_1.default;
  1792. var HelperRenderer_1 = __webpack_require__(58);
  1793. exports.HelperRenderer = HelperRenderer_1.default;
  1794. var ExternalDropping_1 = __webpack_require__(218);
  1795. exports.ExternalDropping = ExternalDropping_1.default;
  1796. var EventResizing_1 = __webpack_require__(219);
  1797. exports.EventResizing = EventResizing_1.default;
  1798. var EventPointing_1 = __webpack_require__(59);
  1799. exports.EventPointing = EventPointing_1.default;
  1800. var EventDragging_1 = __webpack_require__(220);
  1801. exports.EventDragging = EventDragging_1.default;
  1802. var DateSelecting_1 = __webpack_require__(221);
  1803. exports.DateSelecting = DateSelecting_1.default;
  1804. var StandardInteractionsMixin_1 = __webpack_require__(60);
  1805. exports.StandardInteractionsMixin = StandardInteractionsMixin_1.default;
  1806. var AgendaView_1 = __webpack_require__(222);
  1807. exports.AgendaView = AgendaView_1.default;
  1808. var TimeGrid_1 = __webpack_require__(223);
  1809. exports.TimeGrid = TimeGrid_1.default;
  1810. var DayGrid_1 = __webpack_require__(61);
  1811. exports.DayGrid = DayGrid_1.default;
  1812. var BasicView_1 = __webpack_require__(62);
  1813. exports.BasicView = BasicView_1.default;
  1814. var MonthView_1 = __webpack_require__(225);
  1815. exports.MonthView = MonthView_1.default;
  1816. var ListView_1 = __webpack_require__(226);
  1817. exports.ListView = ListView_1.default;
  1818. /***/ }),
  1819. /* 17 */
  1820. /***/ (function(module, exports, __webpack_require__) {
  1821. Object.defineProperty(exports, "__esModule", { value: true });
  1822. var UnzonedRange_1 = __webpack_require__(5);
  1823. /*
  1824. Meant to be immutable
  1825. */
  1826. var EventDateProfile = /** @class */ (function () {
  1827. function EventDateProfile(start, end, calendar) {
  1828. this.start = start;
  1829. this.end = end || null;
  1830. this.unzonedRange = this.buildUnzonedRange(calendar);
  1831. }
  1832. /*
  1833. Needs an EventSource object
  1834. */
  1835. EventDateProfile.parse = function (rawProps, source) {
  1836. var startInput = rawProps.start || rawProps.date;
  1837. var endInput = rawProps.end;
  1838. if (!startInput) {
  1839. return false;
  1840. }
  1841. var calendar = source.calendar;
  1842. var start = calendar.moment(startInput);
  1843. var end = endInput ? calendar.moment(endInput) : null;
  1844. var forcedAllDay = rawProps.allDay;
  1845. var forceEventDuration = calendar.opt('forceEventDuration');
  1846. if (!start.isValid()) {
  1847. return false;
  1848. }
  1849. if (end && (!end.isValid() || !end.isAfter(start))) {
  1850. end = null;
  1851. }
  1852. if (forcedAllDay == null) {
  1853. forcedAllDay = source.allDayDefault;
  1854. if (forcedAllDay == null) {
  1855. forcedAllDay = calendar.opt('allDayDefault');
  1856. }
  1857. }
  1858. if (forcedAllDay === true) {
  1859. start.stripTime();
  1860. if (end) {
  1861. end.stripTime();
  1862. }
  1863. }
  1864. else if (forcedAllDay === false) {
  1865. if (!start.hasTime()) {
  1866. start.time(0);
  1867. }
  1868. if (end && !end.hasTime()) {
  1869. end.time(0);
  1870. }
  1871. }
  1872. if (!end && forceEventDuration) {
  1873. end = calendar.getDefaultEventEnd(!start.hasTime(), start);
  1874. }
  1875. return new EventDateProfile(start, end, calendar);
  1876. };
  1877. EventDateProfile.isStandardProp = function (propName) {
  1878. return propName === 'start' || propName === 'date' || propName === 'end' || propName === 'allDay';
  1879. };
  1880. EventDateProfile.prototype.isAllDay = function () {
  1881. return !(this.start.hasTime() || (this.end && this.end.hasTime()));
  1882. };
  1883. /*
  1884. Needs a Calendar object
  1885. */
  1886. EventDateProfile.prototype.buildUnzonedRange = function (calendar) {
  1887. var startMs = this.start.clone().stripZone().valueOf();
  1888. var endMs = this.getEnd(calendar).stripZone().valueOf();
  1889. return new UnzonedRange_1.default(startMs, endMs);
  1890. };
  1891. /*
  1892. Needs a Calendar object
  1893. */
  1894. EventDateProfile.prototype.getEnd = function (calendar) {
  1895. return this.end ?
  1896. this.end.clone() :
  1897. // derive the end from the start and allDay. compute allDay if necessary
  1898. calendar.getDefaultEventEnd(this.isAllDay(), this.start);
  1899. };
  1900. return EventDateProfile;
  1901. }());
  1902. exports.default = EventDateProfile;
  1903. /***/ }),
  1904. /* 18 */
  1905. /***/ (function(module, exports, __webpack_require__) {
  1906. Object.defineProperty(exports, "__esModule", { value: true });
  1907. var UnzonedRange_1 = __webpack_require__(5);
  1908. var util_1 = __webpack_require__(34);
  1909. var EventRange_1 = __webpack_require__(207);
  1910. /*
  1911. It's expected that there will be at least one EventInstance,
  1912. OR that an explicitEventDef is assigned.
  1913. */
  1914. var EventInstanceGroup = /** @class */ (function () {
  1915. function EventInstanceGroup(eventInstances) {
  1916. this.eventInstances = eventInstances || [];
  1917. }
  1918. EventInstanceGroup.prototype.getAllEventRanges = function (constraintRange) {
  1919. if (constraintRange) {
  1920. return this.sliceNormalRenderRanges(constraintRange);
  1921. }
  1922. else {
  1923. return this.eventInstances.map(util_1.eventInstanceToEventRange);
  1924. }
  1925. };
  1926. EventInstanceGroup.prototype.sliceRenderRanges = function (constraintRange) {
  1927. if (this.isInverse()) {
  1928. return this.sliceInverseRenderRanges(constraintRange);
  1929. }
  1930. else {
  1931. return this.sliceNormalRenderRanges(constraintRange);
  1932. }
  1933. };
  1934. EventInstanceGroup.prototype.sliceNormalRenderRanges = function (constraintRange) {
  1935. var eventInstances = this.eventInstances;
  1936. var i;
  1937. var eventInstance;
  1938. var slicedRange;
  1939. var slicedEventRanges = [];
  1940. for (i = 0; i < eventInstances.length; i++) {
  1941. eventInstance = eventInstances[i];
  1942. slicedRange = eventInstance.dateProfile.unzonedRange.intersect(constraintRange);
  1943. if (slicedRange) {
  1944. slicedEventRanges.push(new EventRange_1.default(slicedRange, eventInstance.def, eventInstance));
  1945. }
  1946. }
  1947. return slicedEventRanges;
  1948. };
  1949. EventInstanceGroup.prototype.sliceInverseRenderRanges = function (constraintRange) {
  1950. var unzonedRanges = this.eventInstances.map(util_1.eventInstanceToUnzonedRange);
  1951. var ownerDef = this.getEventDef();
  1952. unzonedRanges = UnzonedRange_1.default.invertRanges(unzonedRanges, constraintRange);
  1953. return unzonedRanges.map(function (unzonedRange) {
  1954. return new EventRange_1.default(unzonedRange, ownerDef); // don't give an EventInstance
  1955. });
  1956. };
  1957. EventInstanceGroup.prototype.isInverse = function () {
  1958. return this.getEventDef().hasInverseRendering();
  1959. };
  1960. EventInstanceGroup.prototype.getEventDef = function () {
  1961. return this.explicitEventDef || this.eventInstances[0].def;
  1962. };
  1963. return EventInstanceGroup;
  1964. }());
  1965. exports.default = EventInstanceGroup;
  1966. /***/ }),
  1967. /* 19 */
  1968. /***/ (function(module, exports, __webpack_require__) {
  1969. Object.defineProperty(exports, "__esModule", { value: true });
  1970. var $ = __webpack_require__(3);
  1971. var PromiseStub = {
  1972. construct: function (executor) {
  1973. var deferred = $.Deferred();
  1974. var promise = deferred.promise();
  1975. if (typeof executor === 'function') {
  1976. executor(function (val) {
  1977. deferred.resolve(val);
  1978. attachImmediatelyResolvingThen(promise, val);
  1979. }, function () {
  1980. deferred.reject();
  1981. attachImmediatelyRejectingThen(promise);
  1982. });
  1983. }
  1984. return promise;
  1985. },
  1986. resolve: function (val) {
  1987. var deferred = $.Deferred().resolve(val);
  1988. var promise = deferred.promise();
  1989. attachImmediatelyResolvingThen(promise, val);
  1990. return promise;
  1991. },
  1992. reject: function () {
  1993. var deferred = $.Deferred().reject();
  1994. var promise = deferred.promise();
  1995. attachImmediatelyRejectingThen(promise);
  1996. return promise;
  1997. }
  1998. };
  1999. exports.default = PromiseStub;
  2000. function attachImmediatelyResolvingThen(promise, val) {
  2001. promise.then = function (onResolve) {
  2002. if (typeof onResolve === 'function') {
  2003. return PromiseStub.resolve(onResolve(val));
  2004. }
  2005. return promise;
  2006. };
  2007. }
  2008. function attachImmediatelyRejectingThen(promise) {
  2009. promise.then = function (onResolve, onReject) {
  2010. if (typeof onReject === 'function') {
  2011. onReject();
  2012. }
  2013. return promise;
  2014. };
  2015. }
  2016. /***/ }),
  2017. /* 20 */
  2018. /***/ (function(module, exports, __webpack_require__) {
  2019. Object.defineProperty(exports, "__esModule", { value: true });
  2020. var $ = __webpack_require__(3);
  2021. var exportHooks = __webpack_require__(16);
  2022. var EmitterMixin_1 = __webpack_require__(11);
  2023. var ListenerMixin_1 = __webpack_require__(7);
  2024. exportHooks.touchMouseIgnoreWait = 500;
  2025. var globalEmitter = null;
  2026. var neededCount = 0;
  2027. /*
  2028. Listens to document and window-level user-interaction events, like touch events and mouse events,
  2029. and fires these events as-is to whoever is observing a GlobalEmitter.
  2030. Best when used as a singleton via GlobalEmitter.get()
  2031. Normalizes mouse/touch events. For examples:
  2032. - ignores the the simulated mouse events that happen after a quick tap: mousemove+mousedown+mouseup+click
  2033. - compensates for various buggy scenarios where a touchend does not fire
  2034. */
  2035. var GlobalEmitter = /** @class */ (function () {
  2036. function GlobalEmitter() {
  2037. this.isTouching = false;
  2038. this.mouseIgnoreDepth = 0;
  2039. }
  2040. // gets the singleton
  2041. GlobalEmitter.get = function () {
  2042. if (!globalEmitter) {
  2043. globalEmitter = new GlobalEmitter();
  2044. globalEmitter.bind();
  2045. }
  2046. return globalEmitter;
  2047. };
  2048. // called when an object knows it will need a GlobalEmitter in the near future.
  2049. GlobalEmitter.needed = function () {
  2050. GlobalEmitter.get(); // ensures globalEmitter
  2051. neededCount++;
  2052. };
  2053. // called when the object that originally called needed() doesn't need a GlobalEmitter anymore.
  2054. GlobalEmitter.unneeded = function () {
  2055. neededCount--;
  2056. if (!neededCount) {
  2057. globalEmitter.unbind();
  2058. globalEmitter = null;
  2059. }
  2060. };
  2061. GlobalEmitter.prototype.bind = function () {
  2062. var _this = this;
  2063. this.listenTo($(document), {
  2064. touchstart: this.handleTouchStart,
  2065. touchcancel: this.handleTouchCancel,
  2066. touchend: this.handleTouchEnd,
  2067. mousedown: this.handleMouseDown,
  2068. mousemove: this.handleMouseMove,
  2069. mouseup: this.handleMouseUp,
  2070. click: this.handleClick,
  2071. selectstart: this.handleSelectStart,
  2072. contextmenu: this.handleContextMenu
  2073. });
  2074. // because we need to call preventDefault
  2075. // because https://www.chromestatus.com/features/5093566007214080
  2076. // TODO: investigate performance because this is a global handler
  2077. window.addEventListener('touchmove', this.handleTouchMoveProxy = function (ev) {
  2078. _this.handleTouchMove($.Event(ev));
  2079. }, { passive: false } // allows preventDefault()
  2080. );
  2081. // attach a handler to get called when ANY scroll action happens on the page.
  2082. // this was impossible to do with normal on/off because 'scroll' doesn't bubble.
  2083. // http://stackoverflow.com/a/32954565/96342
  2084. window.addEventListener('scroll', this.handleScrollProxy = function (ev) {
  2085. _this.handleScroll($.Event(ev));
  2086. }, true // useCapture
  2087. );
  2088. };
  2089. GlobalEmitter.prototype.unbind = function () {
  2090. this.stopListeningTo($(document));
  2091. window.removeEventListener('touchmove', this.handleTouchMoveProxy);
  2092. window.removeEventListener('scroll', this.handleScrollProxy, true // useCapture
  2093. );
  2094. };
  2095. // Touch Handlers
  2096. // -----------------------------------------------------------------------------------------------------------------
  2097. GlobalEmitter.prototype.handleTouchStart = function (ev) {
  2098. // if a previous touch interaction never ended with a touchend, then implicitly end it,
  2099. // but since a new touch interaction is about to begin, don't start the mouse ignore period.
  2100. this.stopTouch(ev, true); // skipMouseIgnore=true
  2101. this.isTouching = true;
  2102. this.trigger('touchstart', ev);
  2103. };
  2104. GlobalEmitter.prototype.handleTouchMove = function (ev) {
  2105. if (this.isTouching) {
  2106. this.trigger('touchmove', ev);
  2107. }
  2108. };
  2109. GlobalEmitter.prototype.handleTouchCancel = function (ev) {
  2110. if (this.isTouching) {
  2111. this.trigger('touchcancel', ev);
  2112. // Have touchcancel fire an artificial touchend. That way, handlers won't need to listen to both.
  2113. // If touchend fires later, it won't have any effect b/c isTouching will be false.
  2114. this.stopTouch(ev);
  2115. }
  2116. };
  2117. GlobalEmitter.prototype.handleTouchEnd = function (ev) {
  2118. this.stopTouch(ev);
  2119. };
  2120. // Mouse Handlers
  2121. // -----------------------------------------------------------------------------------------------------------------
  2122. GlobalEmitter.prototype.handleMouseDown = function (ev) {
  2123. if (!this.shouldIgnoreMouse()) {
  2124. this.trigger('mousedown', ev);
  2125. }
  2126. };
  2127. GlobalEmitter.prototype.handleMouseMove = function (ev) {
  2128. if (!this.shouldIgnoreMouse()) {
  2129. this.trigger('mousemove', ev);
  2130. }
  2131. };
  2132. GlobalEmitter.prototype.handleMouseUp = function (ev) {
  2133. if (!this.shouldIgnoreMouse()) {
  2134. this.trigger('mouseup', ev);
  2135. }
  2136. };
  2137. GlobalEmitter.prototype.handleClick = function (ev) {
  2138. if (!this.shouldIgnoreMouse()) {
  2139. this.trigger('click', ev);
  2140. }
  2141. };
  2142. // Misc Handlers
  2143. // -----------------------------------------------------------------------------------------------------------------
  2144. GlobalEmitter.prototype.handleSelectStart = function (ev) {
  2145. this.trigger('selectstart', ev);
  2146. };
  2147. GlobalEmitter.prototype.handleContextMenu = function (ev) {
  2148. this.trigger('contextmenu', ev);
  2149. };
  2150. GlobalEmitter.prototype.handleScroll = function (ev) {
  2151. this.trigger('scroll', ev);
  2152. };
  2153. // Utils
  2154. // -----------------------------------------------------------------------------------------------------------------
  2155. GlobalEmitter.prototype.stopTouch = function (ev, skipMouseIgnore) {
  2156. if (skipMouseIgnore === void 0) { skipMouseIgnore = false; }
  2157. if (this.isTouching) {
  2158. this.isTouching = false;
  2159. this.trigger('touchend', ev);
  2160. if (!skipMouseIgnore) {
  2161. this.startTouchMouseIgnore();
  2162. }
  2163. }
  2164. };
  2165. GlobalEmitter.prototype.startTouchMouseIgnore = function () {
  2166. var _this = this;
  2167. var wait = exportHooks.touchMouseIgnoreWait;
  2168. if (wait) {
  2169. this.mouseIgnoreDepth++;
  2170. setTimeout(function () {
  2171. _this.mouseIgnoreDepth--;
  2172. }, wait);
  2173. }
  2174. };
  2175. GlobalEmitter.prototype.shouldIgnoreMouse = function () {
  2176. return this.isTouching || Boolean(this.mouseIgnoreDepth);
  2177. };
  2178. return GlobalEmitter;
  2179. }());
  2180. exports.default = GlobalEmitter;
  2181. ListenerMixin_1.default.mixInto(GlobalEmitter);
  2182. EmitterMixin_1.default.mixInto(GlobalEmitter);
  2183. /***/ }),
  2184. /* 21 */
  2185. /***/ (function(module, exports, __webpack_require__) {
  2186. Object.defineProperty(exports, "__esModule", { value: true });
  2187. var exportHooks = __webpack_require__(16);
  2188. exports.viewHash = {};
  2189. exportHooks.views = exports.viewHash;
  2190. function defineView(viewName, viewConfig) {
  2191. exports.viewHash[viewName] = viewConfig;
  2192. }
  2193. exports.defineView = defineView;
  2194. function getViewConfig(viewName) {
  2195. return exports.viewHash[viewName];
  2196. }
  2197. exports.getViewConfig = getViewConfig;
  2198. /***/ }),
  2199. /* 22 */
  2200. /***/ (function(module, exports, __webpack_require__) {
  2201. Object.defineProperty(exports, "__esModule", { value: true });
  2202. var tslib_1 = __webpack_require__(2);
  2203. var util_1 = __webpack_require__(4);
  2204. var DragListener_1 = __webpack_require__(54);
  2205. /* Tracks mouse movements over a component and raises events about which hit the mouse is over.
  2206. ------------------------------------------------------------------------------------------------------------------------
  2207. options:
  2208. - subjectEl
  2209. - subjectCenter
  2210. */
  2211. var HitDragListener = /** @class */ (function (_super) {
  2212. tslib_1.__extends(HitDragListener, _super);
  2213. function HitDragListener(component, options) {
  2214. var _this = _super.call(this, options) || this;
  2215. _this.component = component;
  2216. return _this;
  2217. }
  2218. // Called when drag listening starts (but a real drag has not necessarily began).
  2219. // ev might be undefined if dragging was started manually.
  2220. HitDragListener.prototype.handleInteractionStart = function (ev) {
  2221. var subjectEl = this.subjectEl;
  2222. var subjectRect;
  2223. var origPoint;
  2224. var point;
  2225. this.component.hitsNeeded();
  2226. this.computeScrollBounds(); // for autoscroll
  2227. if (ev) {
  2228. origPoint = { left: util_1.getEvX(ev), top: util_1.getEvY(ev) };
  2229. point = origPoint;
  2230. // constrain the point to bounds of the element being dragged
  2231. if (subjectEl) {
  2232. subjectRect = util_1.getOuterRect(subjectEl); // used for centering as well
  2233. point = util_1.constrainPoint(point, subjectRect);
  2234. }
  2235. this.origHit = this.queryHit(point.left, point.top);
  2236. // treat the center of the subject as the collision point?
  2237. if (subjectEl && this.options.subjectCenter) {
  2238. // only consider the area the subject overlaps the hit. best for large subjects.
  2239. // TODO: skip this if hit didn't supply left/right/top/bottom
  2240. if (this.origHit) {
  2241. subjectRect = util_1.intersectRects(this.origHit, subjectRect) ||
  2242. subjectRect; // in case there is no intersection
  2243. }
  2244. point = util_1.getRectCenter(subjectRect);
  2245. }
  2246. this.coordAdjust = util_1.diffPoints(point, origPoint); // point - origPoint
  2247. }
  2248. else {
  2249. this.origHit = null;
  2250. this.coordAdjust = null;
  2251. }
  2252. // call the super-method. do it after origHit has been computed
  2253. _super.prototype.handleInteractionStart.call(this, ev);
  2254. };
  2255. // Called when the actual drag has started
  2256. HitDragListener.prototype.handleDragStart = function (ev) {
  2257. var hit;
  2258. _super.prototype.handleDragStart.call(this, ev);
  2259. // might be different from this.origHit if the min-distance is large
  2260. hit = this.queryHit(util_1.getEvX(ev), util_1.getEvY(ev));
  2261. // report the initial hit the mouse is over
  2262. // especially important if no min-distance and drag starts immediately
  2263. if (hit) {
  2264. this.handleHitOver(hit);
  2265. }
  2266. };
  2267. // Called when the drag moves
  2268. HitDragListener.prototype.handleDrag = function (dx, dy, ev) {
  2269. var hit;
  2270. _super.prototype.handleDrag.call(this, dx, dy, ev);
  2271. hit = this.queryHit(util_1.getEvX(ev), util_1.getEvY(ev));
  2272. if (!isHitsEqual(hit, this.hit)) {
  2273. if (this.hit) {
  2274. this.handleHitOut();
  2275. }
  2276. if (hit) {
  2277. this.handleHitOver(hit);
  2278. }
  2279. }
  2280. };
  2281. // Called when dragging has been stopped
  2282. HitDragListener.prototype.handleDragEnd = function (ev) {
  2283. this.handleHitDone();
  2284. _super.prototype.handleDragEnd.call(this, ev);
  2285. };
  2286. // Called when a the mouse has just moved over a new hit
  2287. HitDragListener.prototype.handleHitOver = function (hit) {
  2288. var isOrig = isHitsEqual(hit, this.origHit);
  2289. this.hit = hit;
  2290. this.trigger('hitOver', this.hit, isOrig, this.origHit);
  2291. };
  2292. // Called when the mouse has just moved out of a hit
  2293. HitDragListener.prototype.handleHitOut = function () {
  2294. if (this.hit) {
  2295. this.trigger('hitOut', this.hit);
  2296. this.handleHitDone();
  2297. this.hit = null;
  2298. }
  2299. };
  2300. // Called after a hitOut. Also called before a dragStop
  2301. HitDragListener.prototype.handleHitDone = function () {
  2302. if (this.hit) {
  2303. this.trigger('hitDone', this.hit);
  2304. }
  2305. };
  2306. // Called when the interaction ends, whether there was a real drag or not
  2307. HitDragListener.prototype.handleInteractionEnd = function (ev, isCancelled) {
  2308. _super.prototype.handleInteractionEnd.call(this, ev, isCancelled);
  2309. this.origHit = null;
  2310. this.hit = null;
  2311. this.component.hitsNotNeeded();
  2312. };
  2313. // Called when scrolling has stopped, whether through auto scroll, or the user scrolling
  2314. HitDragListener.prototype.handleScrollEnd = function () {
  2315. _super.prototype.handleScrollEnd.call(this);
  2316. // hits' absolute positions will be in new places after a user's scroll.
  2317. // HACK for recomputing.
  2318. if (this.isDragging) {
  2319. this.component.releaseHits();
  2320. this.component.prepareHits();
  2321. }
  2322. };
  2323. // Gets the hit underneath the coordinates for the given mouse event
  2324. HitDragListener.prototype.queryHit = function (left, top) {
  2325. if (this.coordAdjust) {
  2326. left += this.coordAdjust.left;
  2327. top += this.coordAdjust.top;
  2328. }
  2329. return this.component.queryHit(left, top);
  2330. };
  2331. return HitDragListener;
  2332. }(DragListener_1.default));
  2333. exports.default = HitDragListener;
  2334. // Returns `true` if the hits are identically equal. `false` otherwise. Must be from the same component.
  2335. // Two null values will be considered equal, as two "out of the component" states are the same.
  2336. function isHitsEqual(hit0, hit1) {
  2337. if (!hit0 && !hit1) {
  2338. return true;
  2339. }
  2340. if (hit0 && hit1) {
  2341. return hit0.component === hit1.component &&
  2342. isHitPropsWithin(hit0, hit1) &&
  2343. isHitPropsWithin(hit1, hit0); // ensures all props are identical
  2344. }
  2345. return false;
  2346. }
  2347. // Returns true if all of subHit's non-standard properties are within superHit
  2348. function isHitPropsWithin(subHit, superHit) {
  2349. for (var propName in subHit) {
  2350. if (!/^(component|left|right|top|bottom)$/.test(propName)) {
  2351. if (subHit[propName] !== superHit[propName]) {
  2352. return false;
  2353. }
  2354. }
  2355. }
  2356. return true;
  2357. }
  2358. /***/ }),
  2359. /* 23 */,
  2360. /* 24 */,
  2361. /* 25 */,
  2362. /* 26 */,
  2363. /* 27 */,
  2364. /* 28 */,
  2365. /* 29 */,
  2366. /* 30 */
  2367. /***/ (function(module, exports, __webpack_require__) {
  2368. Object.defineProperty(exports, "__esModule", { value: true });
  2369. var $ = __webpack_require__(3);
  2370. var moment = __webpack_require__(0);
  2371. var exportHooks = __webpack_require__(16);
  2372. var options_1 = __webpack_require__(31);
  2373. var util_1 = __webpack_require__(4);
  2374. exports.localeOptionHash = {};
  2375. exportHooks.locales = exports.localeOptionHash;
  2376. // NOTE: can't guarantee any of these computations will run because not every locale has datepicker
  2377. // configs, so make sure there are English fallbacks for these in the defaults file.
  2378. var dpComputableOptions = {
  2379. buttonText: function (dpOptions) {
  2380. return {
  2381. // the translations sometimes wrongly contain HTML entities
  2382. prev: util_1.stripHtmlEntities(dpOptions.prevText),
  2383. next: util_1.stripHtmlEntities(dpOptions.nextText),
  2384. today: util_1.stripHtmlEntities(dpOptions.currentText)
  2385. };
  2386. },
  2387. // Produces format strings like "MMMM YYYY" -> "September 2014"
  2388. monthYearFormat: function (dpOptions) {
  2389. return dpOptions.showMonthAfterYear ?
  2390. 'YYYY[' + dpOptions.yearSuffix + '] MMMM' :
  2391. 'MMMM YYYY[' + dpOptions.yearSuffix + ']';
  2392. }
  2393. };
  2394. var momComputableOptions = {
  2395. // Produces format strings like "ddd M/D" -> "Fri 9/15"
  2396. dayOfMonthFormat: function (momOptions, fcOptions) {
  2397. var format = momOptions.longDateFormat('l'); // for the format like "M/D/YYYY"
  2398. // strip the year off the edge, as well as other misc non-whitespace chars
  2399. format = format.replace(/^Y+[^\w\s]*|[^\w\s]*Y+$/g, '');
  2400. if (fcOptions.isRTL) {
  2401. format += ' ddd'; // for RTL, add day-of-week to end
  2402. }
  2403. else {
  2404. format = 'ddd ' + format; // for LTR, add day-of-week to beginning
  2405. }
  2406. return format;
  2407. },
  2408. // Produces format strings like "h:mma" -> "6:00pm"
  2409. mediumTimeFormat: function (momOptions) {
  2410. return momOptions.longDateFormat('LT')
  2411. .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand
  2412. },
  2413. // Produces format strings like "h(:mm)a" -> "6pm" / "6:30pm"
  2414. smallTimeFormat: function (momOptions) {
  2415. return momOptions.longDateFormat('LT')
  2416. .replace(':mm', '(:mm)')
  2417. .replace(/(\Wmm)$/, '($1)') // like above, but for foreign locales
  2418. .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand
  2419. },
  2420. // Produces format strings like "h(:mm)t" -> "6p" / "6:30p"
  2421. extraSmallTimeFormat: function (momOptions) {
  2422. return momOptions.longDateFormat('LT')
  2423. .replace(':mm', '(:mm)')
  2424. .replace(/(\Wmm)$/, '($1)') // like above, but for foreign locales
  2425. .replace(/\s*a$/i, 't'); // convert to AM/PM/am/pm to lowercase one-letter. remove any spaces beforehand
  2426. },
  2427. // Produces format strings like "ha" / "H" -> "6pm" / "18"
  2428. hourFormat: function (momOptions) {
  2429. return momOptions.longDateFormat('LT')
  2430. .replace(':mm', '')
  2431. .replace(/(\Wmm)$/, '') // like above, but for foreign locales
  2432. .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand
  2433. },
  2434. // Produces format strings like "h:mm" -> "6:30" (with no AM/PM)
  2435. noMeridiemTimeFormat: function (momOptions) {
  2436. return momOptions.longDateFormat('LT')
  2437. .replace(/\s*a$/i, ''); // remove trailing AM/PM
  2438. }
  2439. };
  2440. // options that should be computed off live calendar options (considers override options)
  2441. // TODO: best place for this? related to locale?
  2442. // TODO: flipping text based on isRTL is a bad idea because the CSS `direction` might want to handle it
  2443. var instanceComputableOptions = {
  2444. // Produces format strings for results like "Mo 16"
  2445. smallDayDateFormat: function (options) {
  2446. return options.isRTL ?
  2447. 'D dd' :
  2448. 'dd D';
  2449. },
  2450. // Produces format strings for results like "Wk 5"
  2451. weekFormat: function (options) {
  2452. return options.isRTL ?
  2453. 'w[ ' + options.weekNumberTitle + ']' :
  2454. '[' + options.weekNumberTitle + ' ]w';
  2455. },
  2456. // Produces format strings for results like "Wk5"
  2457. smallWeekFormat: function (options) {
  2458. return options.isRTL ?
  2459. 'w[' + options.weekNumberTitle + ']' :
  2460. '[' + options.weekNumberTitle + ']w';
  2461. }
  2462. };
  2463. // TODO: make these computable properties in optionsManager
  2464. function populateInstanceComputableOptions(options) {
  2465. $.each(instanceComputableOptions, function (name, func) {
  2466. if (options[name] == null) {
  2467. options[name] = func(options);
  2468. }
  2469. });
  2470. }
  2471. exports.populateInstanceComputableOptions = populateInstanceComputableOptions;
  2472. // Initialize jQuery UI datepicker translations while using some of the translations
  2473. // Will set this as the default locales for datepicker.
  2474. function datepickerLocale(localeCode, dpLocaleCode, dpOptions) {
  2475. // get the FullCalendar internal option hash for this locale. create if necessary
  2476. var fcOptions = exports.localeOptionHash[localeCode] || (exports.localeOptionHash[localeCode] = {});
  2477. // transfer some simple options from datepicker to fc
  2478. fcOptions.isRTL = dpOptions.isRTL;
  2479. fcOptions.weekNumberTitle = dpOptions.weekHeader;
  2480. // compute some more complex options from datepicker
  2481. $.each(dpComputableOptions, function (name, func) {
  2482. fcOptions[name] = func(dpOptions);
  2483. });
  2484. var jqDatePicker = $.datepicker;
  2485. // is jQuery UI Datepicker is on the page?
  2486. if (jqDatePicker) {
  2487. // Register the locale data.
  2488. // FullCalendar and MomentJS use locale codes like "pt-br" but Datepicker
  2489. // does it like "pt-BR" or if it doesn't have the locale, maybe just "pt".
  2490. // Make an alias so the locale can be referenced either way.
  2491. jqDatePicker.regional[dpLocaleCode] =
  2492. jqDatePicker.regional[localeCode] = // alias
  2493. dpOptions;
  2494. // Alias 'en' to the default locale data. Do this every time.
  2495. jqDatePicker.regional.en = jqDatePicker.regional[''];
  2496. // Set as Datepicker's global defaults.
  2497. jqDatePicker.setDefaults(dpOptions);
  2498. }
  2499. }
  2500. exports.datepickerLocale = datepickerLocale;
  2501. // Sets FullCalendar-specific translations. Will set the locales as the global default.
  2502. function locale(localeCode, newFcOptions) {
  2503. var fcOptions;
  2504. var momOptions;
  2505. // get the FullCalendar internal option hash for this locale. create if necessary
  2506. fcOptions = exports.localeOptionHash[localeCode] || (exports.localeOptionHash[localeCode] = {});
  2507. // provided new options for this locales? merge them in
  2508. if (newFcOptions) {
  2509. fcOptions = exports.localeOptionHash[localeCode] = options_1.mergeOptions([fcOptions, newFcOptions]);
  2510. }
  2511. // compute locale options that weren't defined.
  2512. // always do this. newFcOptions can be undefined when initializing from i18n file,
  2513. // so no way to tell if this is an initialization or a default-setting.
  2514. momOptions = getMomentLocaleData(localeCode); // will fall back to en
  2515. $.each(momComputableOptions, function (name, func) {
  2516. if (fcOptions[name] == null) {
  2517. fcOptions[name] = (func)(momOptions, fcOptions);
  2518. }
  2519. });
  2520. // set it as the default locale for FullCalendar
  2521. options_1.globalDefaults.locale = localeCode;
  2522. }
  2523. exports.locale = locale;
  2524. // Returns moment's internal locale data. If doesn't exist, returns English.
  2525. function getMomentLocaleData(localeCode) {
  2526. return moment.localeData(localeCode) || moment.localeData('en');
  2527. }
  2528. exports.getMomentLocaleData = getMomentLocaleData;
  2529. // Initialize English by forcing computation of moment-derived options.
  2530. // Also, sets it as the default.
  2531. locale('en', options_1.englishDefaults);
  2532. /***/ }),
  2533. /* 31 */
  2534. /***/ (function(module, exports, __webpack_require__) {
  2535. Object.defineProperty(exports, "__esModule", { value: true });
  2536. var util_1 = __webpack_require__(4);
  2537. exports.globalDefaults = {
  2538. titleRangeSeparator: ' \u2013 ',
  2539. monthYearFormat: 'MMMM YYYY',
  2540. defaultTimedEventDuration: '02:00:00',
  2541. defaultAllDayEventDuration: { days: 1 },
  2542. forceEventDuration: false,
  2543. nextDayThreshold: '09:00:00',
  2544. // display
  2545. columnHeader: true,
  2546. defaultView: 'month',
  2547. aspectRatio: 1.35,
  2548. header: {
  2549. left: 'title',
  2550. center: '',
  2551. right: 'today prev,next'
  2552. },
  2553. weekends: true,
  2554. weekNumbers: false,
  2555. weekNumberTitle: 'W',
  2556. weekNumberCalculation: 'local',
  2557. // editable: false,
  2558. // nowIndicator: false,
  2559. scrollTime: '06:00:00',
  2560. minTime: '00:00:00',
  2561. maxTime: '24:00:00',
  2562. showNonCurrentDates: true,
  2563. // event ajax
  2564. lazyFetching: true,
  2565. startParam: 'start',
  2566. endParam: 'end',
  2567. timezoneParam: 'timezone',
  2568. timezone: false,
  2569. // allDayDefault: undefined,
  2570. // locale
  2571. locale: null,
  2572. isRTL: false,
  2573. buttonText: {
  2574. prev: 'prev',
  2575. next: 'next',
  2576. prevYear: 'prev year',
  2577. nextYear: 'next year',
  2578. year: 'year',
  2579. today: 'today',
  2580. month: 'month',
  2581. week: 'week',
  2582. day: 'day'
  2583. },
  2584. // buttonIcons: null,
  2585. allDayText: 'all-day',
  2586. // allows setting a min-height to the event segment to prevent short events overlapping each other
  2587. agendaEventMinHeight: 0,
  2588. // jquery-ui theming
  2589. theme: false,
  2590. // themeButtonIcons: null,
  2591. // eventResizableFromStart: false,
  2592. dragOpacity: .75,
  2593. dragRevertDuration: 500,
  2594. dragScroll: true,
  2595. // selectable: false,
  2596. unselectAuto: true,
  2597. // selectMinDistance: 0,
  2598. dropAccept: '*',
  2599. eventOrder: 'title',
  2600. // eventRenderWait: null,
  2601. eventLimit: false,
  2602. eventLimitText: 'more',
  2603. eventLimitClick: 'popover',
  2604. dayPopoverFormat: 'LL',
  2605. handleWindowResize: true,
  2606. windowResizeDelay: 100,
  2607. longPressDelay: 1000
  2608. };
  2609. exports.englishDefaults = {
  2610. dayPopoverFormat: 'dddd, MMMM D'
  2611. };
  2612. exports.rtlDefaults = {
  2613. header: {
  2614. left: 'next,prev today',
  2615. center: '',
  2616. right: 'title'
  2617. },
  2618. buttonIcons: {
  2619. prev: 'right-single-arrow',
  2620. next: 'left-single-arrow',
  2621. prevYear: 'right-double-arrow',
  2622. nextYear: 'left-double-arrow'
  2623. },
  2624. themeButtonIcons: {
  2625. prev: 'circle-triangle-e',
  2626. next: 'circle-triangle-w',
  2627. nextYear: 'seek-prev',
  2628. prevYear: 'seek-next'
  2629. }
  2630. };
  2631. var complexOptions = [
  2632. 'header',
  2633. 'footer',
  2634. 'buttonText',
  2635. 'buttonIcons',
  2636. 'themeButtonIcons'
  2637. ];
  2638. // Merges an array of option objects into a single object
  2639. function mergeOptions(optionObjs) {
  2640. return util_1.mergeProps(optionObjs, complexOptions);
  2641. }
  2642. exports.mergeOptions = mergeOptions;
  2643. /***/ }),
  2644. /* 32 */
  2645. /***/ (function(module, exports, __webpack_require__) {
  2646. Object.defineProperty(exports, "__esModule", { value: true });
  2647. var tslib_1 = __webpack_require__(2);
  2648. var util_1 = __webpack_require__(4);
  2649. // Class that all other classes will inherit from
  2650. var Class = /** @class */ (function () {
  2651. function Class() {
  2652. }
  2653. // Called on a class to create a subclass.
  2654. // LIMITATION: cannot provide a constructor!
  2655. Class.extend = function (members) {
  2656. var SubClass = /** @class */ (function (_super) {
  2657. tslib_1.__extends(SubClass, _super);
  2658. function SubClass() {
  2659. return _super !== null && _super.apply(this, arguments) || this;
  2660. }
  2661. return SubClass;
  2662. }(this));
  2663. util_1.copyOwnProps(members, SubClass.prototype);
  2664. return SubClass;
  2665. };
  2666. // Adds new member variables/methods to the class's prototype.
  2667. // Can be called with another class, or a plain object hash containing new members.
  2668. Class.mixin = function (members) {
  2669. util_1.copyOwnProps(members, this.prototype);
  2670. };
  2671. return Class;
  2672. }());
  2673. exports.default = Class;
  2674. /***/ }),
  2675. /* 33 */
  2676. /***/ (function(module, exports, __webpack_require__) {
  2677. Object.defineProperty(exports, "__esModule", { value: true });
  2678. var $ = __webpack_require__(3);
  2679. var ParsableModelMixin_1 = __webpack_require__(204);
  2680. var EventDef = /** @class */ (function () {
  2681. function EventDef(source) {
  2682. this.source = source;
  2683. this.className = [];
  2684. this.miscProps = {};
  2685. }
  2686. EventDef.parse = function (rawInput, source) {
  2687. var def = new this(source);
  2688. if (def.applyProps(rawInput)) {
  2689. return def;
  2690. }
  2691. return false;
  2692. };
  2693. EventDef.normalizeId = function (id) {
  2694. return String(id);
  2695. };
  2696. EventDef.generateId = function () {
  2697. return '_fc' + (EventDef.uuid++);
  2698. };
  2699. EventDef.prototype.clone = function () {
  2700. var copy = new this.constructor(this.source);
  2701. copy.id = this.id;
  2702. copy.rawId = this.rawId;
  2703. copy.uid = this.uid; // not really unique anymore :(
  2704. EventDef.copyVerbatimStandardProps(this, copy);
  2705. copy.className = this.className.slice(); // copy
  2706. copy.miscProps = $.extend({}, this.miscProps);
  2707. return copy;
  2708. };
  2709. EventDef.prototype.hasInverseRendering = function () {
  2710. return this.getRendering() === 'inverse-background';
  2711. };
  2712. EventDef.prototype.hasBgRendering = function () {
  2713. var rendering = this.getRendering();
  2714. return rendering === 'inverse-background' || rendering === 'background';
  2715. };
  2716. EventDef.prototype.getRendering = function () {
  2717. if (this.rendering != null) {
  2718. return this.rendering;
  2719. }
  2720. return this.source.rendering;
  2721. };
  2722. EventDef.prototype.getConstraint = function () {
  2723. if (this.constraint != null) {
  2724. return this.constraint;
  2725. }
  2726. if (this.source.constraint != null) {
  2727. return this.source.constraint;
  2728. }
  2729. return this.source.calendar.opt('eventConstraint'); // what about View option?
  2730. };
  2731. EventDef.prototype.getOverlap = function () {
  2732. if (this.overlap != null) {
  2733. return this.overlap;
  2734. }
  2735. if (this.source.overlap != null) {
  2736. return this.source.overlap;
  2737. }
  2738. return this.source.calendar.opt('eventOverlap'); // what about View option?
  2739. };
  2740. EventDef.prototype.isStartExplicitlyEditable = function () {
  2741. if (this.startEditable != null) {
  2742. return this.startEditable;
  2743. }
  2744. return this.source.startEditable;
  2745. };
  2746. EventDef.prototype.isDurationExplicitlyEditable = function () {
  2747. if (this.durationEditable != null) {
  2748. return this.durationEditable;
  2749. }
  2750. return this.source.durationEditable;
  2751. };
  2752. EventDef.prototype.isExplicitlyEditable = function () {
  2753. if (this.editable != null) {
  2754. return this.editable;
  2755. }
  2756. return this.source.editable;
  2757. };
  2758. EventDef.prototype.toLegacy = function () {
  2759. var obj = $.extend({}, this.miscProps);
  2760. obj._id = this.uid;
  2761. obj.source = this.source;
  2762. obj.className = this.className.slice(); // copy
  2763. obj.allDay = this.isAllDay();
  2764. if (this.rawId != null) {
  2765. obj.id = this.rawId;
  2766. }
  2767. EventDef.copyVerbatimStandardProps(this, obj);
  2768. return obj;
  2769. };
  2770. EventDef.prototype.applyManualStandardProps = function (rawProps) {
  2771. if (rawProps.id != null) {
  2772. this.id = EventDef.normalizeId((this.rawId = rawProps.id));
  2773. }
  2774. else {
  2775. this.id = EventDef.generateId();
  2776. }
  2777. if (rawProps._id != null) {
  2778. this.uid = String(rawProps._id);
  2779. }
  2780. else {
  2781. this.uid = EventDef.generateId();
  2782. }
  2783. // TODO: converge with EventSource
  2784. if ($.isArray(rawProps.className)) {
  2785. this.className = rawProps.className;
  2786. }
  2787. if (typeof rawProps.className === 'string') {
  2788. this.className = rawProps.className.split(/\s+/);
  2789. }
  2790. return true;
  2791. };
  2792. EventDef.prototype.applyMiscProps = function (rawProps) {
  2793. $.extend(this.miscProps, rawProps);
  2794. };
  2795. EventDef.uuid = 0;
  2796. EventDef.defineStandardProps = ParsableModelMixin_1.default.defineStandardProps;
  2797. EventDef.copyVerbatimStandardProps = ParsableModelMixin_1.default.copyVerbatimStandardProps;
  2798. return EventDef;
  2799. }());
  2800. exports.default = EventDef;
  2801. ParsableModelMixin_1.default.mixInto(EventDef);
  2802. EventDef.defineStandardProps({
  2803. // not automatically assigned (`false`)
  2804. _id: false,
  2805. id: false,
  2806. className: false,
  2807. source: false,
  2808. // automatically assigned (`true`)
  2809. title: true,
  2810. url: true,
  2811. rendering: true,
  2812. constraint: true,
  2813. overlap: true,
  2814. editable: true,
  2815. startEditable: true,
  2816. durationEditable: true,
  2817. color: true,
  2818. backgroundColor: true,
  2819. borderColor: true,
  2820. textColor: true
  2821. });
  2822. /***/ }),
  2823. /* 34 */
  2824. /***/ (function(module, exports, __webpack_require__) {
  2825. Object.defineProperty(exports, "__esModule", { value: true });
  2826. var EventRange_1 = __webpack_require__(207);
  2827. var EventFootprint_1 = __webpack_require__(35);
  2828. var ComponentFootprint_1 = __webpack_require__(12);
  2829. function eventDefsToEventInstances(eventDefs, unzonedRange) {
  2830. var eventInstances = [];
  2831. var i;
  2832. for (i = 0; i < eventDefs.length; i++) {
  2833. eventInstances.push.apply(eventInstances, // append
  2834. eventDefs[i].buildInstances(unzonedRange));
  2835. }
  2836. return eventInstances;
  2837. }
  2838. exports.eventDefsToEventInstances = eventDefsToEventInstances;
  2839. function eventInstanceToEventRange(eventInstance) {
  2840. return new EventRange_1.default(eventInstance.dateProfile.unzonedRange, eventInstance.def, eventInstance);
  2841. }
  2842. exports.eventInstanceToEventRange = eventInstanceToEventRange;
  2843. function eventRangeToEventFootprint(eventRange) {
  2844. return new EventFootprint_1.default(new ComponentFootprint_1.default(eventRange.unzonedRange, eventRange.eventDef.isAllDay()), eventRange.eventDef, eventRange.eventInstance // might not exist
  2845. );
  2846. }
  2847. exports.eventRangeToEventFootprint = eventRangeToEventFootprint;
  2848. function eventInstanceToUnzonedRange(eventInstance) {
  2849. return eventInstance.dateProfile.unzonedRange;
  2850. }
  2851. exports.eventInstanceToUnzonedRange = eventInstanceToUnzonedRange;
  2852. function eventFootprintToComponentFootprint(eventFootprint) {
  2853. return eventFootprint.componentFootprint;
  2854. }
  2855. exports.eventFootprintToComponentFootprint = eventFootprintToComponentFootprint;
  2856. /***/ }),
  2857. /* 35 */
  2858. /***/ (function(module, exports) {
  2859. Object.defineProperty(exports, "__esModule", { value: true });
  2860. var EventFootprint = /** @class */ (function () {
  2861. function EventFootprint(componentFootprint, eventDef, eventInstance) {
  2862. this.componentFootprint = componentFootprint;
  2863. this.eventDef = eventDef;
  2864. if (eventInstance) {
  2865. this.eventInstance = eventInstance;
  2866. }
  2867. }
  2868. EventFootprint.prototype.getEventLegacy = function () {
  2869. return (this.eventInstance || this.eventDef).toLegacy();
  2870. };
  2871. return EventFootprint;
  2872. }());
  2873. exports.default = EventFootprint;
  2874. /***/ }),
  2875. /* 36 */
  2876. /***/ (function(module, exports, __webpack_require__) {
  2877. Object.defineProperty(exports, "__esModule", { value: true });
  2878. var util_1 = __webpack_require__(4);
  2879. var EventDateProfile_1 = __webpack_require__(17);
  2880. var EventDef_1 = __webpack_require__(33);
  2881. var EventDefDateMutation_1 = __webpack_require__(50);
  2882. var SingleEventDef_1 = __webpack_require__(13);
  2883. var EventDefMutation = /** @class */ (function () {
  2884. function EventDefMutation() {
  2885. }
  2886. EventDefMutation.createFromRawProps = function (eventInstance, rawProps, largeUnit) {
  2887. var eventDef = eventInstance.def;
  2888. var dateProps = {};
  2889. var standardProps = {};
  2890. var miscProps = {};
  2891. var verbatimStandardProps = {};
  2892. var eventDefId = null;
  2893. var className = null;
  2894. var propName;
  2895. var dateProfile;
  2896. var dateMutation;
  2897. var defMutation;
  2898. for (propName in rawProps) {
  2899. if (EventDateProfile_1.default.isStandardProp(propName)) {
  2900. dateProps[propName] = rawProps[propName];
  2901. }
  2902. else if (eventDef.isStandardProp(propName)) {
  2903. standardProps[propName] = rawProps[propName];
  2904. }
  2905. else if (eventDef.miscProps[propName] !== rawProps[propName]) {
  2906. miscProps[propName] = rawProps[propName];
  2907. }
  2908. }
  2909. dateProfile = EventDateProfile_1.default.parse(dateProps, eventDef.source);
  2910. if (dateProfile) {
  2911. dateMutation = EventDefDateMutation_1.default.createFromDiff(eventInstance.dateProfile, dateProfile, largeUnit);
  2912. }
  2913. if (standardProps.id !== eventDef.id) {
  2914. eventDefId = standardProps.id; // only apply if there's a change
  2915. }
  2916. if (!util_1.isArraysEqual(standardProps.className, eventDef.className)) {
  2917. className = standardProps.className; // only apply if there's a change
  2918. }
  2919. EventDef_1.default.copyVerbatimStandardProps(standardProps, // src
  2920. verbatimStandardProps // dest
  2921. );
  2922. defMutation = new EventDefMutation();
  2923. defMutation.eventDefId = eventDefId;
  2924. defMutation.className = className;
  2925. defMutation.verbatimStandardProps = verbatimStandardProps;
  2926. defMutation.miscProps = miscProps;
  2927. if (dateMutation) {
  2928. defMutation.dateMutation = dateMutation;
  2929. }
  2930. return defMutation;
  2931. };
  2932. /*
  2933. eventDef assumed to be a SingleEventDef.
  2934. returns an undo function.
  2935. */
  2936. EventDefMutation.prototype.mutateSingle = function (eventDef) {
  2937. var origDateProfile;
  2938. if (this.dateMutation) {
  2939. origDateProfile = eventDef.dateProfile;
  2940. eventDef.dateProfile = this.dateMutation.buildNewDateProfile(origDateProfile, eventDef.source.calendar);
  2941. }
  2942. // can't undo
  2943. // TODO: more DRY with EventDef::applyManualStandardProps
  2944. if (this.eventDefId != null) {
  2945. eventDef.id = EventDef_1.default.normalizeId((eventDef.rawId = this.eventDefId));
  2946. }
  2947. // can't undo
  2948. // TODO: more DRY with EventDef::applyManualStandardProps
  2949. if (this.className) {
  2950. eventDef.className = this.className;
  2951. }
  2952. // can't undo
  2953. if (this.verbatimStandardProps) {
  2954. SingleEventDef_1.default.copyVerbatimStandardProps(this.verbatimStandardProps, // src
  2955. eventDef // dest
  2956. );
  2957. }
  2958. // can't undo
  2959. if (this.miscProps) {
  2960. eventDef.applyMiscProps(this.miscProps);
  2961. }
  2962. if (origDateProfile) {
  2963. return function () {
  2964. eventDef.dateProfile = origDateProfile;
  2965. };
  2966. }
  2967. else {
  2968. return function () { };
  2969. }
  2970. };
  2971. EventDefMutation.prototype.setDateMutation = function (dateMutation) {
  2972. if (dateMutation && !dateMutation.isEmpty()) {
  2973. this.dateMutation = dateMutation;
  2974. }
  2975. else {
  2976. this.dateMutation = null;
  2977. }
  2978. };
  2979. EventDefMutation.prototype.isEmpty = function () {
  2980. return !this.dateMutation;
  2981. };
  2982. return EventDefMutation;
  2983. }());
  2984. exports.default = EventDefMutation;
  2985. /***/ }),
  2986. /* 37 */
  2987. /***/ (function(module, exports) {
  2988. Object.defineProperty(exports, "__esModule", { value: true });
  2989. exports.default = {
  2990. sourceClasses: [],
  2991. registerClass: function (EventSourceClass) {
  2992. this.sourceClasses.unshift(EventSourceClass); // give highest priority
  2993. },
  2994. parse: function (rawInput, calendar) {
  2995. var sourceClasses = this.sourceClasses;
  2996. var i;
  2997. var eventSource;
  2998. for (i = 0; i < sourceClasses.length; i++) {
  2999. eventSource = sourceClasses[i].parse(rawInput, calendar);
  3000. if (eventSource) {
  3001. return eventSource;
  3002. }
  3003. }
  3004. }
  3005. };
  3006. /***/ }),
  3007. /* 38 */
  3008. /***/ (function(module, exports, __webpack_require__) {
  3009. Object.defineProperty(exports, "__esModule", { value: true });
  3010. var $ = __webpack_require__(3);
  3011. var Theme = /** @class */ (function () {
  3012. function Theme(optionsManager) {
  3013. this.optionsManager = optionsManager;
  3014. this.processIconOverride();
  3015. }
  3016. Theme.prototype.processIconOverride = function () {
  3017. if (this.iconOverrideOption) {
  3018. this.setIconOverride(this.optionsManager.get(this.iconOverrideOption));
  3019. }
  3020. };
  3021. Theme.prototype.setIconOverride = function (iconOverrideHash) {
  3022. var iconClassesCopy;
  3023. var buttonName;
  3024. if ($.isPlainObject(iconOverrideHash)) {
  3025. iconClassesCopy = $.extend({}, this.iconClasses);
  3026. for (buttonName in iconOverrideHash) {
  3027. iconClassesCopy[buttonName] = this.applyIconOverridePrefix(iconOverrideHash[buttonName]);
  3028. }
  3029. this.iconClasses = iconClassesCopy;
  3030. }
  3031. else if (iconOverrideHash === false) {
  3032. this.iconClasses = {};
  3033. }
  3034. };
  3035. Theme.prototype.applyIconOverridePrefix = function (className) {
  3036. var prefix = this.iconOverridePrefix;
  3037. if (prefix && className.indexOf(prefix) !== 0) {
  3038. className = prefix + className;
  3039. }
  3040. return className;
  3041. };
  3042. Theme.prototype.getClass = function (key) {
  3043. return this.classes[key] || '';
  3044. };
  3045. Theme.prototype.getIconClass = function (buttonName) {
  3046. var className = this.iconClasses[buttonName];
  3047. if (className) {
  3048. return this.baseIconClass + ' ' + className;
  3049. }
  3050. return '';
  3051. };
  3052. Theme.prototype.getCustomButtonIconClass = function (customButtonProps) {
  3053. var className;
  3054. if (this.iconOverrideCustomButtonOption) {
  3055. className = customButtonProps[this.iconOverrideCustomButtonOption];
  3056. if (className) {
  3057. return this.baseIconClass + ' ' + this.applyIconOverridePrefix(className);
  3058. }
  3059. }
  3060. return '';
  3061. };
  3062. return Theme;
  3063. }());
  3064. exports.default = Theme;
  3065. Theme.prototype.classes = {};
  3066. Theme.prototype.iconClasses = {};
  3067. Theme.prototype.baseIconClass = '';
  3068. Theme.prototype.iconOverridePrefix = '';
  3069. /***/ }),
  3070. /* 39 */
  3071. /***/ (function(module, exports, __webpack_require__) {
  3072. Object.defineProperty(exports, "__esModule", { value: true });
  3073. var tslib_1 = __webpack_require__(2);
  3074. var $ = __webpack_require__(3);
  3075. var util_1 = __webpack_require__(4);
  3076. var Class_1 = __webpack_require__(32);
  3077. /*
  3078. Embodies a div that has potential scrollbars
  3079. */
  3080. var Scroller = /** @class */ (function (_super) {
  3081. tslib_1.__extends(Scroller, _super);
  3082. function Scroller(options) {
  3083. var _this = _super.call(this) || this;
  3084. options = options || {};
  3085. _this.overflowX = options.overflowX || options.overflow || 'auto';
  3086. _this.overflowY = options.overflowY || options.overflow || 'auto';
  3087. return _this;
  3088. }
  3089. Scroller.prototype.render = function () {
  3090. this.el = this.renderEl();
  3091. this.applyOverflow();
  3092. };
  3093. Scroller.prototype.renderEl = function () {
  3094. return (this.scrollEl = $('<div class="fc-scroller"></div>'));
  3095. };
  3096. // sets to natural height, unlocks overflow
  3097. Scroller.prototype.clear = function () {
  3098. this.setHeight('auto');
  3099. this.applyOverflow();
  3100. };
  3101. Scroller.prototype.destroy = function () {
  3102. this.el.remove();
  3103. };
  3104. // Overflow
  3105. // -----------------------------------------------------------------------------------------------------------------
  3106. Scroller.prototype.applyOverflow = function () {
  3107. this.scrollEl.css({
  3108. 'overflow-x': this.overflowX,
  3109. 'overflow-y': this.overflowY
  3110. });
  3111. };
  3112. // Causes any 'auto' overflow values to resolves to 'scroll' or 'hidden'.
  3113. // Useful for preserving scrollbar widths regardless of future resizes.
  3114. // Can pass in scrollbarWidths for optimization.
  3115. Scroller.prototype.lockOverflow = function (scrollbarWidths) {
  3116. var overflowX = this.overflowX;
  3117. var overflowY = this.overflowY;
  3118. scrollbarWidths = scrollbarWidths || this.getScrollbarWidths();
  3119. if (overflowX === 'auto') {
  3120. overflowX = (scrollbarWidths.top || scrollbarWidths.bottom || // horizontal scrollbars?
  3121. // OR scrolling pane with massless scrollbars?
  3122. this.scrollEl[0].scrollWidth - 1 > this.scrollEl[0].clientWidth) ? 'scroll' : 'hidden';
  3123. }
  3124. if (overflowY === 'auto') {
  3125. overflowY = (scrollbarWidths.left || scrollbarWidths.right || // vertical scrollbars?
  3126. // OR scrolling pane with massless scrollbars?
  3127. this.scrollEl[0].scrollHeight - 1 > this.scrollEl[0].clientHeight) ? 'scroll' : 'hidden';
  3128. }
  3129. this.scrollEl.css({ 'overflow-x': overflowX, 'overflow-y': overflowY });
  3130. };
  3131. // Getters / Setters
  3132. // -----------------------------------------------------------------------------------------------------------------
  3133. Scroller.prototype.setHeight = function (height) {
  3134. this.scrollEl.height(height);
  3135. };
  3136. Scroller.prototype.getScrollTop = function () {
  3137. return this.scrollEl.scrollTop();
  3138. };
  3139. Scroller.prototype.setScrollTop = function (top) {
  3140. this.scrollEl.scrollTop(top);
  3141. };
  3142. Scroller.prototype.getClientWidth = function () {
  3143. return this.scrollEl[0].clientWidth;
  3144. };
  3145. Scroller.prototype.getClientHeight = function () {
  3146. return this.scrollEl[0].clientHeight;
  3147. };
  3148. Scroller.prototype.getScrollbarWidths = function () {
  3149. return util_1.getScrollbarWidths(this.scrollEl);
  3150. };
  3151. return Scroller;
  3152. }(Class_1.default));
  3153. exports.default = Scroller;
  3154. /***/ }),
  3155. /* 40 */
  3156. /***/ (function(module, exports, __webpack_require__) {
  3157. Object.defineProperty(exports, "__esModule", { value: true });
  3158. var tslib_1 = __webpack_require__(2);
  3159. var $ = __webpack_require__(3);
  3160. var util_1 = __webpack_require__(4);
  3161. var DateComponent_1 = __webpack_require__(215);
  3162. var GlobalEmitter_1 = __webpack_require__(20);
  3163. var InteractiveDateComponent = /** @class */ (function (_super) {
  3164. tslib_1.__extends(InteractiveDateComponent, _super);
  3165. function InteractiveDateComponent(_view, _options) {
  3166. var _this = _super.call(this, _view, _options) || this;
  3167. // self-config, overridable by subclasses
  3168. _this.segSelector = '.fc-event-container > *'; // what constitutes an event element?
  3169. if (_this.dateSelectingClass) {
  3170. _this.dateClicking = new _this.dateClickingClass(_this);
  3171. }
  3172. if (_this.dateSelectingClass) {
  3173. _this.dateSelecting = new _this.dateSelectingClass(_this);
  3174. }
  3175. if (_this.eventPointingClass) {
  3176. _this.eventPointing = new _this.eventPointingClass(_this);
  3177. }
  3178. if (_this.eventDraggingClass && _this.eventPointing) {
  3179. _this.eventDragging = new _this.eventDraggingClass(_this, _this.eventPointing);
  3180. }
  3181. if (_this.eventResizingClass && _this.eventPointing) {
  3182. _this.eventResizing = new _this.eventResizingClass(_this, _this.eventPointing);
  3183. }
  3184. if (_this.externalDroppingClass) {
  3185. _this.externalDropping = new _this.externalDroppingClass(_this);
  3186. }
  3187. return _this;
  3188. }
  3189. // Sets the container element that the view should render inside of, does global DOM-related initializations,
  3190. // and renders all the non-date-related content inside.
  3191. InteractiveDateComponent.prototype.setElement = function (el) {
  3192. _super.prototype.setElement.call(this, el);
  3193. if (this.dateClicking) {
  3194. this.dateClicking.bindToEl(el);
  3195. }
  3196. if (this.dateSelecting) {
  3197. this.dateSelecting.bindToEl(el);
  3198. }
  3199. this.bindAllSegHandlersToEl(el);
  3200. };
  3201. InteractiveDateComponent.prototype.removeElement = function () {
  3202. this.endInteractions();
  3203. _super.prototype.removeElement.call(this);
  3204. };
  3205. InteractiveDateComponent.prototype.executeEventUnrender = function () {
  3206. this.endInteractions();
  3207. _super.prototype.executeEventUnrender.call(this);
  3208. };
  3209. InteractiveDateComponent.prototype.bindGlobalHandlers = function () {
  3210. _super.prototype.bindGlobalHandlers.call(this);
  3211. if (this.externalDropping) {
  3212. this.externalDropping.bindToDocument();
  3213. }
  3214. };
  3215. InteractiveDateComponent.prototype.unbindGlobalHandlers = function () {
  3216. _super.prototype.unbindGlobalHandlers.call(this);
  3217. if (this.externalDropping) {
  3218. this.externalDropping.unbindFromDocument();
  3219. }
  3220. };
  3221. InteractiveDateComponent.prototype.bindDateHandlerToEl = function (el, name, handler) {
  3222. var _this = this;
  3223. // attach a handler to the grid's root element.
  3224. // jQuery will take care of unregistering them when removeElement gets called.
  3225. this.el.on(name, function (ev) {
  3226. if (!$(ev.target).is(_this.segSelector + ',' + // directly on an event element
  3227. _this.segSelector + ' *,' + // within an event element
  3228. '.fc-more,' + // a "more.." link
  3229. 'a[data-goto]' // a clickable nav link
  3230. )) {
  3231. return handler.call(_this, ev);
  3232. }
  3233. });
  3234. };
  3235. InteractiveDateComponent.prototype.bindAllSegHandlersToEl = function (el) {
  3236. [
  3237. this.eventPointing,
  3238. this.eventDragging,
  3239. this.eventResizing
  3240. ].forEach(function (eventInteraction) {
  3241. if (eventInteraction) {
  3242. eventInteraction.bindToEl(el);
  3243. }
  3244. });
  3245. };
  3246. InteractiveDateComponent.prototype.bindSegHandlerToEl = function (el, name, handler) {
  3247. var _this = this;
  3248. el.on(name, this.segSelector, function (ev) {
  3249. var seg = $(ev.currentTarget).data('fc-seg'); // grab segment data. put there by View::renderEventsPayload
  3250. if (seg && !_this.shouldIgnoreEventPointing()) {
  3251. return handler.call(_this, seg, ev); // context will be the Grid
  3252. }
  3253. });
  3254. };
  3255. InteractiveDateComponent.prototype.shouldIgnoreMouse = function () {
  3256. // HACK
  3257. // This will still work even though bindDateHandlerToEl doesn't use GlobalEmitter.
  3258. return GlobalEmitter_1.default.get().shouldIgnoreMouse();
  3259. };
  3260. InteractiveDateComponent.prototype.shouldIgnoreTouch = function () {
  3261. var view = this._getView();
  3262. // On iOS (and Android?) when a new selection is initiated overtop another selection,
  3263. // the touchend never fires because the elements gets removed mid-touch-interaction (my theory).
  3264. // HACK: simply don't allow this to happen.
  3265. // ALSO: prevent selection when an *event* is already raised.
  3266. return view.isSelected || view.selectedEvent;
  3267. };
  3268. InteractiveDateComponent.prototype.shouldIgnoreEventPointing = function () {
  3269. // only call the handlers if there is not a drag/resize in progress
  3270. return (this.eventDragging && this.eventDragging.isDragging) ||
  3271. (this.eventResizing && this.eventResizing.isResizing);
  3272. };
  3273. InteractiveDateComponent.prototype.canStartSelection = function (seg, ev) {
  3274. return util_1.getEvIsTouch(ev) &&
  3275. !this.canStartResize(seg, ev) &&
  3276. (this.isEventDefDraggable(seg.footprint.eventDef) ||
  3277. this.isEventDefResizable(seg.footprint.eventDef));
  3278. };
  3279. InteractiveDateComponent.prototype.canStartDrag = function (seg, ev) {
  3280. return !this.canStartResize(seg, ev) &&
  3281. this.isEventDefDraggable(seg.footprint.eventDef);
  3282. };
  3283. InteractiveDateComponent.prototype.canStartResize = function (seg, ev) {
  3284. var view = this._getView();
  3285. var eventDef = seg.footprint.eventDef;
  3286. return (!util_1.getEvIsTouch(ev) || view.isEventDefSelected(eventDef)) &&
  3287. this.isEventDefResizable(eventDef) &&
  3288. $(ev.target).is('.fc-resizer');
  3289. };
  3290. // Kills all in-progress dragging.
  3291. // Useful for when public API methods that result in re-rendering are invoked during a drag.
  3292. // Also useful for when touch devices misbehave and don't fire their touchend.
  3293. InteractiveDateComponent.prototype.endInteractions = function () {
  3294. [
  3295. this.dateClicking,
  3296. this.dateSelecting,
  3297. this.eventPointing,
  3298. this.eventDragging,
  3299. this.eventResizing
  3300. ].forEach(function (interaction) {
  3301. if (interaction) {
  3302. interaction.end();
  3303. }
  3304. });
  3305. };
  3306. // Event Drag-n-Drop
  3307. // ---------------------------------------------------------------------------------------------------------------
  3308. // Computes if the given event is allowed to be dragged by the user
  3309. InteractiveDateComponent.prototype.isEventDefDraggable = function (eventDef) {
  3310. return this.isEventDefStartEditable(eventDef);
  3311. };
  3312. InteractiveDateComponent.prototype.isEventDefStartEditable = function (eventDef) {
  3313. var isEditable = eventDef.isStartExplicitlyEditable();
  3314. if (isEditable == null) {
  3315. isEditable = this.opt('eventStartEditable');
  3316. if (isEditable == null) {
  3317. isEditable = this.isEventDefGenerallyEditable(eventDef);
  3318. }
  3319. }
  3320. return isEditable;
  3321. };
  3322. InteractiveDateComponent.prototype.isEventDefGenerallyEditable = function (eventDef) {
  3323. var isEditable = eventDef.isExplicitlyEditable();
  3324. if (isEditable == null) {
  3325. isEditable = this.opt('editable');
  3326. }
  3327. return isEditable;
  3328. };
  3329. // Event Resizing
  3330. // ---------------------------------------------------------------------------------------------------------------
  3331. // Computes if the given event is allowed to be resized from its starting edge
  3332. InteractiveDateComponent.prototype.isEventDefResizableFromStart = function (eventDef) {
  3333. return this.opt('eventResizableFromStart') && this.isEventDefResizable(eventDef);
  3334. };
  3335. // Computes if the given event is allowed to be resized from its ending edge
  3336. InteractiveDateComponent.prototype.isEventDefResizableFromEnd = function (eventDef) {
  3337. return this.isEventDefResizable(eventDef);
  3338. };
  3339. // Computes if the given event is allowed to be resized by the user at all
  3340. InteractiveDateComponent.prototype.isEventDefResizable = function (eventDef) {
  3341. var isResizable = eventDef.isDurationExplicitlyEditable();
  3342. if (isResizable == null) {
  3343. isResizable = this.opt('eventDurationEditable');
  3344. if (isResizable == null) {
  3345. isResizable = this.isEventDefGenerallyEditable(eventDef);
  3346. }
  3347. }
  3348. return isResizable;
  3349. };
  3350. // Event Mutation / Constraints
  3351. // ---------------------------------------------------------------------------------------------------------------
  3352. // Diffs the two dates, returning a duration, based on granularity of the grid
  3353. // TODO: port isTimeScale into this system?
  3354. InteractiveDateComponent.prototype.diffDates = function (a, b) {
  3355. if (this.largeUnit) {
  3356. return util_1.diffByUnit(a, b, this.largeUnit);
  3357. }
  3358. else {
  3359. return util_1.diffDayTime(a, b);
  3360. }
  3361. };
  3362. // is it allowed, in relation to the view's validRange?
  3363. // NOTE: very similar to isExternalInstanceGroupAllowed
  3364. InteractiveDateComponent.prototype.isEventInstanceGroupAllowed = function (eventInstanceGroup) {
  3365. var view = this._getView();
  3366. var dateProfile = this.dateProfile;
  3367. var eventFootprints = this.eventRangesToEventFootprints(eventInstanceGroup.getAllEventRanges());
  3368. var i;
  3369. for (i = 0; i < eventFootprints.length; i++) {
  3370. // TODO: just use getAllEventRanges directly
  3371. if (!dateProfile.validUnzonedRange.containsRange(eventFootprints[i].componentFootprint.unzonedRange)) {
  3372. return false;
  3373. }
  3374. }
  3375. return view.calendar.constraints.isEventInstanceGroupAllowed(eventInstanceGroup);
  3376. };
  3377. // NOTE: very similar to isEventInstanceGroupAllowed
  3378. // when it's a completely anonymous external drag, no event.
  3379. InteractiveDateComponent.prototype.isExternalInstanceGroupAllowed = function (eventInstanceGroup) {
  3380. var view = this._getView();
  3381. var dateProfile = this.dateProfile;
  3382. var eventFootprints = this.eventRangesToEventFootprints(eventInstanceGroup.getAllEventRanges());
  3383. var i;
  3384. for (i = 0; i < eventFootprints.length; i++) {
  3385. if (!dateProfile.validUnzonedRange.containsRange(eventFootprints[i].componentFootprint.unzonedRange)) {
  3386. return false;
  3387. }
  3388. }
  3389. for (i = 0; i < eventFootprints.length; i++) {
  3390. // treat it as a selection
  3391. // TODO: pass in eventInstanceGroup instead
  3392. // because we don't want calendar's constraint system to depend on a component's
  3393. // determination of footprints.
  3394. if (!view.calendar.constraints.isSelectionFootprintAllowed(eventFootprints[i].componentFootprint)) {
  3395. return false;
  3396. }
  3397. }
  3398. return true;
  3399. };
  3400. return InteractiveDateComponent;
  3401. }(DateComponent_1.default));
  3402. exports.default = InteractiveDateComponent;
  3403. /***/ }),
  3404. /* 41 */
  3405. /***/ (function(module, exports, __webpack_require__) {
  3406. Object.defineProperty(exports, "__esModule", { value: true });
  3407. var tslib_1 = __webpack_require__(2);
  3408. var $ = __webpack_require__(3);
  3409. var moment = __webpack_require__(0);
  3410. var util_1 = __webpack_require__(4);
  3411. var RenderQueue_1 = __webpack_require__(214);
  3412. var DateProfileGenerator_1 = __webpack_require__(217);
  3413. var InteractiveDateComponent_1 = __webpack_require__(40);
  3414. var GlobalEmitter_1 = __webpack_require__(20);
  3415. var UnzonedRange_1 = __webpack_require__(5);
  3416. /* An abstract class from which other views inherit from
  3417. ----------------------------------------------------------------------------------------------------------------------*/
  3418. var View = /** @class */ (function (_super) {
  3419. tslib_1.__extends(View, _super);
  3420. function View(calendar, viewSpec) {
  3421. var _this = _super.call(this, null, viewSpec.options) || this;
  3422. _this.batchRenderDepth = 0;
  3423. _this.isSelected = false; // boolean whether a range of time is user-selected or not
  3424. _this.calendar = calendar;
  3425. _this.viewSpec = viewSpec;
  3426. // shortcuts
  3427. _this.type = viewSpec.type;
  3428. // .name is deprecated
  3429. _this.name = _this.type;
  3430. _this.initRenderQueue();
  3431. _this.initHiddenDays();
  3432. _this.dateProfileGenerator = new _this.dateProfileGeneratorClass(_this);
  3433. _this.bindBaseRenderHandlers();
  3434. _this.eventOrderSpecs = util_1.parseFieldSpecs(_this.opt('eventOrder'));
  3435. // legacy
  3436. if (_this['initialize']) {
  3437. _this['initialize']();
  3438. }
  3439. return _this;
  3440. }
  3441. View.prototype._getView = function () {
  3442. return this;
  3443. };
  3444. // Retrieves an option with the given name
  3445. View.prototype.opt = function (name) {
  3446. return this.options[name];
  3447. };
  3448. /* Render Queue
  3449. ------------------------------------------------------------------------------------------------------------------*/
  3450. View.prototype.initRenderQueue = function () {
  3451. this.renderQueue = new RenderQueue_1.default({
  3452. event: this.opt('eventRenderWait')
  3453. });
  3454. this.renderQueue.on('start', this.onRenderQueueStart.bind(this));
  3455. this.renderQueue.on('stop', this.onRenderQueueStop.bind(this));
  3456. this.on('before:change', this.startBatchRender);
  3457. this.on('change', this.stopBatchRender);
  3458. };
  3459. View.prototype.onRenderQueueStart = function () {
  3460. this.calendar.freezeContentHeight();
  3461. this.addScroll(this.queryScroll());
  3462. };
  3463. View.prototype.onRenderQueueStop = function () {
  3464. if (this.calendar.updateViewSize()) {
  3465. this.popScroll();
  3466. }
  3467. this.calendar.thawContentHeight();
  3468. };
  3469. View.prototype.startBatchRender = function () {
  3470. if (!(this.batchRenderDepth++)) {
  3471. this.renderQueue.pause();
  3472. }
  3473. };
  3474. View.prototype.stopBatchRender = function () {
  3475. if (!(--this.batchRenderDepth)) {
  3476. this.renderQueue.resume();
  3477. }
  3478. };
  3479. View.prototype.requestRender = function (func, namespace, actionType) {
  3480. this.renderQueue.queue(func, namespace, actionType);
  3481. };
  3482. // given func will auto-bind to `this`
  3483. View.prototype.whenSizeUpdated = function (func) {
  3484. if (this.renderQueue.isRunning) {
  3485. this.renderQueue.one('stop', func.bind(this));
  3486. }
  3487. else {
  3488. func.call(this);
  3489. }
  3490. };
  3491. /* Title and Date Formatting
  3492. ------------------------------------------------------------------------------------------------------------------*/
  3493. // Computes what the title at the top of the calendar should be for this view
  3494. View.prototype.computeTitle = function (dateProfile) {
  3495. var unzonedRange;
  3496. // for views that span a large unit of time, show the proper interval, ignoring stray days before and after
  3497. if (/^(year|month)$/.test(dateProfile.currentRangeUnit)) {
  3498. unzonedRange = dateProfile.currentUnzonedRange;
  3499. }
  3500. else {
  3501. unzonedRange = dateProfile.activeUnzonedRange;
  3502. }
  3503. return this.formatRange({
  3504. start: this.calendar.msToMoment(unzonedRange.startMs, dateProfile.isRangeAllDay),
  3505. end: this.calendar.msToMoment(unzonedRange.endMs, dateProfile.isRangeAllDay)
  3506. }, dateProfile.isRangeAllDay, this.opt('titleFormat') || this.computeTitleFormat(dateProfile), this.opt('titleRangeSeparator'));
  3507. };
  3508. // Generates the format string that should be used to generate the title for the current date range.
  3509. // Attempts to compute the most appropriate format if not explicitly specified with `titleFormat`.
  3510. View.prototype.computeTitleFormat = function (dateProfile) {
  3511. var currentRangeUnit = dateProfile.currentRangeUnit;
  3512. if (currentRangeUnit === 'year') {
  3513. return 'YYYY';
  3514. }
  3515. else if (currentRangeUnit === 'month') {
  3516. return this.opt('monthYearFormat'); // like "September 2014"
  3517. }
  3518. else if (dateProfile.currentUnzonedRange.as('days') > 1) {
  3519. return 'll'; // multi-day range. shorter, like "Sep 9 - 10 2014"
  3520. }
  3521. else {
  3522. return 'LL'; // one day. longer, like "September 9 2014"
  3523. }
  3524. };
  3525. // Date Setting/Unsetting
  3526. // -----------------------------------------------------------------------------------------------------------------
  3527. View.prototype.setDate = function (date) {
  3528. var currentDateProfile = this.get('dateProfile');
  3529. var newDateProfile = this.dateProfileGenerator.build(date, undefined, true); // forceToValid=true
  3530. if (!currentDateProfile ||
  3531. !currentDateProfile.activeUnzonedRange.equals(newDateProfile.activeUnzonedRange)) {
  3532. this.set('dateProfile', newDateProfile);
  3533. }
  3534. };
  3535. View.prototype.unsetDate = function () {
  3536. this.unset('dateProfile');
  3537. };
  3538. // Event Data
  3539. // -----------------------------------------------------------------------------------------------------------------
  3540. View.prototype.fetchInitialEvents = function (dateProfile) {
  3541. var calendar = this.calendar;
  3542. var forceAllDay = dateProfile.isRangeAllDay && !this.usesMinMaxTime;
  3543. return calendar.requestEvents(calendar.msToMoment(dateProfile.activeUnzonedRange.startMs, forceAllDay), calendar.msToMoment(dateProfile.activeUnzonedRange.endMs, forceAllDay));
  3544. };
  3545. View.prototype.bindEventChanges = function () {
  3546. this.listenTo(this.calendar, 'eventsReset', this.resetEvents); // TODO: make this a real event
  3547. };
  3548. View.prototype.unbindEventChanges = function () {
  3549. this.stopListeningTo(this.calendar, 'eventsReset');
  3550. };
  3551. View.prototype.setEvents = function (eventsPayload) {
  3552. this.set('currentEvents', eventsPayload);
  3553. this.set('hasEvents', true);
  3554. };
  3555. View.prototype.unsetEvents = function () {
  3556. this.unset('currentEvents');
  3557. this.unset('hasEvents');
  3558. };
  3559. View.prototype.resetEvents = function (eventsPayload) {
  3560. this.startBatchRender();
  3561. this.unsetEvents();
  3562. this.setEvents(eventsPayload);
  3563. this.stopBatchRender();
  3564. };
  3565. // Date High-level Rendering
  3566. // -----------------------------------------------------------------------------------------------------------------
  3567. View.prototype.requestDateRender = function (dateProfile) {
  3568. var _this = this;
  3569. this.requestRender(function () {
  3570. _this.executeDateRender(dateProfile);
  3571. }, 'date', 'init');
  3572. };
  3573. View.prototype.requestDateUnrender = function () {
  3574. var _this = this;
  3575. this.requestRender(function () {
  3576. _this.executeDateUnrender();
  3577. }, 'date', 'destroy');
  3578. };
  3579. // if dateProfile not specified, uses current
  3580. View.prototype.executeDateRender = function (dateProfile) {
  3581. _super.prototype.executeDateRender.call(this, dateProfile);
  3582. if (this['render']) {
  3583. this['render'](); // TODO: deprecate
  3584. }
  3585. this.trigger('datesRendered');
  3586. this.addScroll({ isDateInit: true });
  3587. this.startNowIndicator(); // shouldn't render yet because updateSize will be called soon
  3588. };
  3589. View.prototype.executeDateUnrender = function () {
  3590. this.unselect();
  3591. this.stopNowIndicator();
  3592. this.trigger('before:datesUnrendered');
  3593. if (this['destroy']) {
  3594. this['destroy'](); // TODO: deprecate
  3595. }
  3596. _super.prototype.executeDateUnrender.call(this);
  3597. };
  3598. // "Base" rendering
  3599. // -----------------------------------------------------------------------------------------------------------------
  3600. View.prototype.bindBaseRenderHandlers = function () {
  3601. var _this = this;
  3602. this.on('datesRendered', function () {
  3603. _this.whenSizeUpdated(_this.triggerViewRender);
  3604. });
  3605. this.on('before:datesUnrendered', function () {
  3606. _this.triggerViewDestroy();
  3607. });
  3608. };
  3609. View.prototype.triggerViewRender = function () {
  3610. this.publiclyTrigger('viewRender', {
  3611. context: this,
  3612. args: [this, this.el]
  3613. });
  3614. };
  3615. View.prototype.triggerViewDestroy = function () {
  3616. this.publiclyTrigger('viewDestroy', {
  3617. context: this,
  3618. args: [this, this.el]
  3619. });
  3620. };
  3621. // Event High-level Rendering
  3622. // -----------------------------------------------------------------------------------------------------------------
  3623. View.prototype.requestEventsRender = function (eventsPayload) {
  3624. var _this = this;
  3625. this.requestRender(function () {
  3626. _this.executeEventRender(eventsPayload);
  3627. _this.whenSizeUpdated(_this.triggerAfterEventsRendered);
  3628. }, 'event', 'init');
  3629. };
  3630. View.prototype.requestEventsUnrender = function () {
  3631. var _this = this;
  3632. this.requestRender(function () {
  3633. _this.triggerBeforeEventsDestroyed();
  3634. _this.executeEventUnrender();
  3635. }, 'event', 'destroy');
  3636. };
  3637. // Business Hour High-level Rendering
  3638. // -----------------------------------------------------------------------------------------------------------------
  3639. View.prototype.requestBusinessHoursRender = function (businessHourGenerator) {
  3640. var _this = this;
  3641. this.requestRender(function () {
  3642. _this.renderBusinessHours(businessHourGenerator);
  3643. }, 'businessHours', 'init');
  3644. };
  3645. View.prototype.requestBusinessHoursUnrender = function () {
  3646. var _this = this;
  3647. this.requestRender(function () {
  3648. _this.unrenderBusinessHours();
  3649. }, 'businessHours', 'destroy');
  3650. };
  3651. // Misc view rendering utils
  3652. // -----------------------------------------------------------------------------------------------------------------
  3653. // Binds DOM handlers to elements that reside outside the view container, such as the document
  3654. View.prototype.bindGlobalHandlers = function () {
  3655. _super.prototype.bindGlobalHandlers.call(this);
  3656. this.listenTo(GlobalEmitter_1.default.get(), {
  3657. touchstart: this.processUnselect,
  3658. mousedown: this.handleDocumentMousedown
  3659. });
  3660. };
  3661. // Unbinds DOM handlers from elements that reside outside the view container
  3662. View.prototype.unbindGlobalHandlers = function () {
  3663. _super.prototype.unbindGlobalHandlers.call(this);
  3664. this.stopListeningTo(GlobalEmitter_1.default.get());
  3665. };
  3666. /* Now Indicator
  3667. ------------------------------------------------------------------------------------------------------------------*/
  3668. // Immediately render the current time indicator and begins re-rendering it at an interval,
  3669. // which is defined by this.getNowIndicatorUnit().
  3670. // TODO: somehow do this for the current whole day's background too
  3671. View.prototype.startNowIndicator = function () {
  3672. var _this = this;
  3673. var unit;
  3674. var update;
  3675. var delay; // ms wait value
  3676. if (this.opt('nowIndicator')) {
  3677. unit = this.getNowIndicatorUnit();
  3678. if (unit) {
  3679. update = util_1.proxy(this, 'updateNowIndicator'); // bind to `this`
  3680. this.initialNowDate = this.calendar.getNow();
  3681. this.initialNowQueriedMs = new Date().valueOf();
  3682. // wait until the beginning of the next interval
  3683. delay = this.initialNowDate.clone().startOf(unit).add(1, unit).valueOf() - this.initialNowDate.valueOf();
  3684. this.nowIndicatorTimeoutID = setTimeout(function () {
  3685. _this.nowIndicatorTimeoutID = null;
  3686. update();
  3687. delay = +moment.duration(1, unit);
  3688. delay = Math.max(100, delay); // prevent too frequent
  3689. _this.nowIndicatorIntervalID = setInterval(update, delay); // update every interval
  3690. }, delay);
  3691. }
  3692. // rendering will be initiated in updateSize
  3693. }
  3694. };
  3695. // rerenders the now indicator, computing the new current time from the amount of time that has passed
  3696. // since the initial getNow call.
  3697. View.prototype.updateNowIndicator = function () {
  3698. if (this.isDatesRendered &&
  3699. this.initialNowDate // activated before?
  3700. ) {
  3701. this.unrenderNowIndicator(); // won't unrender if unnecessary
  3702. this.renderNowIndicator(this.initialNowDate.clone().add(new Date().valueOf() - this.initialNowQueriedMs) // add ms
  3703. );
  3704. this.isNowIndicatorRendered = true;
  3705. }
  3706. };
  3707. // Immediately unrenders the view's current time indicator and stops any re-rendering timers.
  3708. // Won't cause side effects if indicator isn't rendered.
  3709. View.prototype.stopNowIndicator = function () {
  3710. if (this.isNowIndicatorRendered) {
  3711. if (this.nowIndicatorTimeoutID) {
  3712. clearTimeout(this.nowIndicatorTimeoutID);
  3713. this.nowIndicatorTimeoutID = null;
  3714. }
  3715. if (this.nowIndicatorIntervalID) {
  3716. clearInterval(this.nowIndicatorIntervalID);
  3717. this.nowIndicatorIntervalID = null;
  3718. }
  3719. this.unrenderNowIndicator();
  3720. this.isNowIndicatorRendered = false;
  3721. }
  3722. };
  3723. /* Dimensions
  3724. ------------------------------------------------------------------------------------------------------------------*/
  3725. View.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  3726. if (this['setHeight']) {
  3727. this['setHeight'](totalHeight, isAuto);
  3728. }
  3729. else {
  3730. _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
  3731. }
  3732. this.updateNowIndicator();
  3733. };
  3734. /* Scroller
  3735. ------------------------------------------------------------------------------------------------------------------*/
  3736. View.prototype.addScroll = function (scroll) {
  3737. var queuedScroll = this.queuedScroll || (this.queuedScroll = {});
  3738. $.extend(queuedScroll, scroll);
  3739. };
  3740. View.prototype.popScroll = function () {
  3741. this.applyQueuedScroll();
  3742. this.queuedScroll = null;
  3743. };
  3744. View.prototype.applyQueuedScroll = function () {
  3745. if (this.queuedScroll) {
  3746. this.applyScroll(this.queuedScroll);
  3747. }
  3748. };
  3749. View.prototype.queryScroll = function () {
  3750. var scroll = {};
  3751. if (this.isDatesRendered) {
  3752. $.extend(scroll, this.queryDateScroll());
  3753. }
  3754. return scroll;
  3755. };
  3756. View.prototype.applyScroll = function (scroll) {
  3757. if (scroll.isDateInit && this.isDatesRendered) {
  3758. $.extend(scroll, this.computeInitialDateScroll());
  3759. }
  3760. if (this.isDatesRendered) {
  3761. this.applyDateScroll(scroll);
  3762. }
  3763. };
  3764. View.prototype.computeInitialDateScroll = function () {
  3765. return {}; // subclasses must implement
  3766. };
  3767. View.prototype.queryDateScroll = function () {
  3768. return {}; // subclasses must implement
  3769. };
  3770. View.prototype.applyDateScroll = function (scroll) {
  3771. // subclasses must implement
  3772. };
  3773. /* Event Drag-n-Drop
  3774. ------------------------------------------------------------------------------------------------------------------*/
  3775. View.prototype.reportEventDrop = function (eventInstance, eventMutation, el, ev) {
  3776. var eventManager = this.calendar.eventManager;
  3777. var undoFunc = eventManager.mutateEventsWithId(eventInstance.def.id, eventMutation);
  3778. var dateMutation = eventMutation.dateMutation;
  3779. // update the EventInstance, for handlers
  3780. if (dateMutation) {
  3781. eventInstance.dateProfile = dateMutation.buildNewDateProfile(eventInstance.dateProfile, this.calendar);
  3782. }
  3783. this.triggerEventDrop(eventInstance,
  3784. // a drop doesn't necessarily mean a date mutation (ex: resource change)
  3785. (dateMutation && dateMutation.dateDelta) || moment.duration(), undoFunc, el, ev);
  3786. };
  3787. // Triggers event-drop handlers that have subscribed via the API
  3788. View.prototype.triggerEventDrop = function (eventInstance, dateDelta, undoFunc, el, ev) {
  3789. this.publiclyTrigger('eventDrop', {
  3790. context: el[0],
  3791. args: [
  3792. eventInstance.toLegacy(),
  3793. dateDelta,
  3794. undoFunc,
  3795. ev,
  3796. {},
  3797. this
  3798. ]
  3799. });
  3800. };
  3801. /* External Element Drag-n-Drop
  3802. ------------------------------------------------------------------------------------------------------------------*/
  3803. // Must be called when an external element, via jQuery UI, has been dropped onto the calendar.
  3804. // `meta` is the parsed data that has been embedded into the dragging event.
  3805. // `dropLocation` is an object that contains the new zoned start/end/allDay values for the event.
  3806. View.prototype.reportExternalDrop = function (singleEventDef, isEvent, isSticky, el, ev, ui) {
  3807. if (isEvent) {
  3808. this.calendar.eventManager.addEventDef(singleEventDef, isSticky);
  3809. }
  3810. this.triggerExternalDrop(singleEventDef, isEvent, el, ev, ui);
  3811. };
  3812. // Triggers external-drop handlers that have subscribed via the API
  3813. View.prototype.triggerExternalDrop = function (singleEventDef, isEvent, el, ev, ui) {
  3814. // trigger 'drop' regardless of whether element represents an event
  3815. this.publiclyTrigger('drop', {
  3816. context: el[0],
  3817. args: [
  3818. singleEventDef.dateProfile.start.clone(),
  3819. ev,
  3820. ui,
  3821. this
  3822. ]
  3823. });
  3824. if (isEvent) {
  3825. // signal an external event landed
  3826. this.publiclyTrigger('eventReceive', {
  3827. context: this,
  3828. args: [
  3829. singleEventDef.buildInstance().toLegacy(),
  3830. this
  3831. ]
  3832. });
  3833. }
  3834. };
  3835. /* Event Resizing
  3836. ------------------------------------------------------------------------------------------------------------------*/
  3837. // Must be called when an event in the view has been resized to a new length
  3838. View.prototype.reportEventResize = function (eventInstance, eventMutation, el, ev) {
  3839. var eventManager = this.calendar.eventManager;
  3840. var undoFunc = eventManager.mutateEventsWithId(eventInstance.def.id, eventMutation);
  3841. // update the EventInstance, for handlers
  3842. eventInstance.dateProfile = eventMutation.dateMutation.buildNewDateProfile(eventInstance.dateProfile, this.calendar);
  3843. this.triggerEventResize(eventInstance, eventMutation.dateMutation.endDelta, undoFunc, el, ev);
  3844. };
  3845. // Triggers event-resize handlers that have subscribed via the API
  3846. View.prototype.triggerEventResize = function (eventInstance, durationDelta, undoFunc, el, ev) {
  3847. this.publiclyTrigger('eventResize', {
  3848. context: el[0],
  3849. args: [
  3850. eventInstance.toLegacy(),
  3851. durationDelta,
  3852. undoFunc,
  3853. ev,
  3854. {},
  3855. this
  3856. ]
  3857. });
  3858. };
  3859. /* Selection (time range)
  3860. ------------------------------------------------------------------------------------------------------------------*/
  3861. // Selects a date span on the view. `start` and `end` are both Moments.
  3862. // `ev` is the native mouse event that begin the interaction.
  3863. View.prototype.select = function (footprint, ev) {
  3864. this.unselect(ev);
  3865. this.renderSelectionFootprint(footprint);
  3866. this.reportSelection(footprint, ev);
  3867. };
  3868. View.prototype.renderSelectionFootprint = function (footprint) {
  3869. if (this['renderSelection']) {
  3870. this['renderSelection'](footprint.toLegacy(this.calendar));
  3871. }
  3872. else {
  3873. _super.prototype.renderSelectionFootprint.call(this, footprint);
  3874. }
  3875. };
  3876. // Called when a new selection is made. Updates internal state and triggers handlers.
  3877. View.prototype.reportSelection = function (footprint, ev) {
  3878. this.isSelected = true;
  3879. this.triggerSelect(footprint, ev);
  3880. };
  3881. // Triggers handlers to 'select'
  3882. View.prototype.triggerSelect = function (footprint, ev) {
  3883. var dateProfile = this.calendar.footprintToDateProfile(footprint); // abuse of "Event"DateProfile?
  3884. this.publiclyTrigger('select', {
  3885. context: this,
  3886. args: [
  3887. dateProfile.start,
  3888. dateProfile.end,
  3889. ev,
  3890. this
  3891. ]
  3892. });
  3893. };
  3894. // Undoes a selection. updates in the internal state and triggers handlers.
  3895. // `ev` is the native mouse event that began the interaction.
  3896. View.prototype.unselect = function (ev) {
  3897. if (this.isSelected) {
  3898. this.isSelected = false;
  3899. if (this['destroySelection']) {
  3900. this['destroySelection'](); // TODO: deprecate
  3901. }
  3902. this.unrenderSelection();
  3903. this.publiclyTrigger('unselect', {
  3904. context: this,
  3905. args: [ev, this]
  3906. });
  3907. }
  3908. };
  3909. /* Event Selection
  3910. ------------------------------------------------------------------------------------------------------------------*/
  3911. View.prototype.selectEventInstance = function (eventInstance) {
  3912. if (!this.selectedEventInstance ||
  3913. this.selectedEventInstance !== eventInstance) {
  3914. this.unselectEventInstance();
  3915. this.getEventSegs().forEach(function (seg) {
  3916. if (seg.footprint.eventInstance === eventInstance &&
  3917. seg.el // necessary?
  3918. ) {
  3919. seg.el.addClass('fc-selected');
  3920. }
  3921. });
  3922. this.selectedEventInstance = eventInstance;
  3923. }
  3924. };
  3925. View.prototype.unselectEventInstance = function () {
  3926. if (this.selectedEventInstance) {
  3927. this.getEventSegs().forEach(function (seg) {
  3928. if (seg.el) {
  3929. seg.el.removeClass('fc-selected');
  3930. }
  3931. });
  3932. this.selectedEventInstance = null;
  3933. }
  3934. };
  3935. View.prototype.isEventDefSelected = function (eventDef) {
  3936. // event references might change on refetchEvents(), while selectedEventInstance doesn't,
  3937. // so compare IDs
  3938. return this.selectedEventInstance && this.selectedEventInstance.def.id === eventDef.id;
  3939. };
  3940. /* Mouse / Touch Unselecting (time range & event unselection)
  3941. ------------------------------------------------------------------------------------------------------------------*/
  3942. // TODO: move consistently to down/start or up/end?
  3943. // TODO: don't kill previous selection if touch scrolling
  3944. View.prototype.handleDocumentMousedown = function (ev) {
  3945. if (util_1.isPrimaryMouseButton(ev)) {
  3946. this.processUnselect(ev);
  3947. }
  3948. };
  3949. View.prototype.processUnselect = function (ev) {
  3950. this.processRangeUnselect(ev);
  3951. this.processEventUnselect(ev);
  3952. };
  3953. View.prototype.processRangeUnselect = function (ev) {
  3954. var ignore;
  3955. // is there a time-range selection?
  3956. if (this.isSelected && this.opt('unselectAuto')) {
  3957. // only unselect if the clicked element is not identical to or inside of an 'unselectCancel' element
  3958. ignore = this.opt('unselectCancel');
  3959. if (!ignore || !$(ev.target).closest(ignore).length) {
  3960. this.unselect(ev);
  3961. }
  3962. }
  3963. };
  3964. View.prototype.processEventUnselect = function (ev) {
  3965. if (this.selectedEventInstance) {
  3966. if (!$(ev.target).closest('.fc-selected').length) {
  3967. this.unselectEventInstance();
  3968. }
  3969. }
  3970. };
  3971. /* Triggers
  3972. ------------------------------------------------------------------------------------------------------------------*/
  3973. View.prototype.triggerBaseRendered = function () {
  3974. this.publiclyTrigger('viewRender', {
  3975. context: this,
  3976. args: [this, this.el]
  3977. });
  3978. };
  3979. View.prototype.triggerBaseUnrendered = function () {
  3980. this.publiclyTrigger('viewDestroy', {
  3981. context: this,
  3982. args: [this, this.el]
  3983. });
  3984. };
  3985. // Triggers handlers to 'dayClick'
  3986. // Span has start/end of the clicked area. Only the start is useful.
  3987. View.prototype.triggerDayClick = function (footprint, dayEl, ev) {
  3988. var dateProfile = this.calendar.footprintToDateProfile(footprint); // abuse of "Event"DateProfile?
  3989. this.publiclyTrigger('dayClick', {
  3990. context: dayEl,
  3991. args: [dateProfile.start, ev, this]
  3992. });
  3993. };
  3994. /* Date Utils
  3995. ------------------------------------------------------------------------------------------------------------------*/
  3996. // For DateComponent::getDayClasses
  3997. View.prototype.isDateInOtherMonth = function (date, dateProfile) {
  3998. return false;
  3999. };
  4000. // Arguments after name will be forwarded to a hypothetical function value
  4001. // WARNING: passed-in arguments will be given to generator functions as-is and can cause side-effects.
  4002. // Always clone your objects if you fear mutation.
  4003. View.prototype.getUnzonedRangeOption = function (name) {
  4004. var val = this.opt(name);
  4005. if (typeof val === 'function') {
  4006. val = val.apply(null, Array.prototype.slice.call(arguments, 1));
  4007. }
  4008. if (val) {
  4009. return this.calendar.parseUnzonedRange(val);
  4010. }
  4011. };
  4012. /* Hidden Days
  4013. ------------------------------------------------------------------------------------------------------------------*/
  4014. // Initializes internal variables related to calculating hidden days-of-week
  4015. View.prototype.initHiddenDays = function () {
  4016. var hiddenDays = this.opt('hiddenDays') || []; // array of day-of-week indices that are hidden
  4017. var isHiddenDayHash = []; // is the day-of-week hidden? (hash with day-of-week-index -> bool)
  4018. var dayCnt = 0;
  4019. var i;
  4020. if (this.opt('weekends') === false) {
  4021. hiddenDays.push(0, 6); // 0=sunday, 6=saturday
  4022. }
  4023. for (i = 0; i < 7; i++) {
  4024. if (!(isHiddenDayHash[i] = $.inArray(i, hiddenDays) !== -1)) {
  4025. dayCnt++;
  4026. }
  4027. }
  4028. if (!dayCnt) {
  4029. throw new Error('invalid hiddenDays'); // all days were hidden? bad.
  4030. }
  4031. this.isHiddenDayHash = isHiddenDayHash;
  4032. };
  4033. // Remove days from the beginning and end of the range that are computed as hidden.
  4034. // If the whole range is trimmed off, returns null
  4035. View.prototype.trimHiddenDays = function (inputUnzonedRange) {
  4036. var start = inputUnzonedRange.getStart();
  4037. var end = inputUnzonedRange.getEnd();
  4038. if (start) {
  4039. start = this.skipHiddenDays(start);
  4040. }
  4041. if (end) {
  4042. end = this.skipHiddenDays(end, -1, true);
  4043. }
  4044. if (start === null || end === null || start < end) {
  4045. return new UnzonedRange_1.default(start, end);
  4046. }
  4047. return null;
  4048. };
  4049. // Is the current day hidden?
  4050. // `day` is a day-of-week index (0-6), or a Moment
  4051. View.prototype.isHiddenDay = function (day) {
  4052. if (moment.isMoment(day)) {
  4053. day = day.day();
  4054. }
  4055. return this.isHiddenDayHash[day];
  4056. };
  4057. // Incrementing the current day until it is no longer a hidden day, returning a copy.
  4058. // DOES NOT CONSIDER validUnzonedRange!
  4059. // If the initial value of `date` is not a hidden day, don't do anything.
  4060. // Pass `isExclusive` as `true` if you are dealing with an end date.
  4061. // `inc` defaults to `1` (increment one day forward each time)
  4062. View.prototype.skipHiddenDays = function (date, inc, isExclusive) {
  4063. if (inc === void 0) { inc = 1; }
  4064. if (isExclusive === void 0) { isExclusive = false; }
  4065. var out = date.clone();
  4066. while (this.isHiddenDayHash[(out.day() + (isExclusive ? inc : 0) + 7) % 7]) {
  4067. out.add(inc, 'days');
  4068. }
  4069. return out;
  4070. };
  4071. return View;
  4072. }(InteractiveDateComponent_1.default));
  4073. exports.default = View;
  4074. View.prototype.usesMinMaxTime = false;
  4075. View.prototype.dateProfileGeneratorClass = DateProfileGenerator_1.default;
  4076. View.watch('displayingDates', ['isInDom', 'dateProfile'], function (deps) {
  4077. this.requestDateRender(deps.dateProfile);
  4078. }, function () {
  4079. this.requestDateUnrender();
  4080. });
  4081. View.watch('displayingBusinessHours', ['displayingDates', 'businessHourGenerator'], function (deps) {
  4082. this.requestBusinessHoursRender(deps.businessHourGenerator);
  4083. }, function () {
  4084. this.requestBusinessHoursUnrender();
  4085. });
  4086. View.watch('initialEvents', ['dateProfile'], function (deps) {
  4087. return this.fetchInitialEvents(deps.dateProfile);
  4088. });
  4089. View.watch('bindingEvents', ['initialEvents'], function (deps) {
  4090. this.setEvents(deps.initialEvents);
  4091. this.bindEventChanges();
  4092. }, function () {
  4093. this.unbindEventChanges();
  4094. this.unsetEvents();
  4095. });
  4096. View.watch('displayingEvents', ['displayingDates', 'hasEvents'], function () {
  4097. this.requestEventsRender(this.get('currentEvents'));
  4098. }, function () {
  4099. this.requestEventsUnrender();
  4100. });
  4101. View.watch('title', ['dateProfile'], function (deps) {
  4102. return (this.title = this.computeTitle(deps.dateProfile)); // assign to View for legacy reasons
  4103. });
  4104. View.watch('legacyDateProps', ['dateProfile'], function (deps) {
  4105. var calendar = this.calendar;
  4106. var dateProfile = deps.dateProfile;
  4107. // DEPRECATED, but we need to keep it updated...
  4108. this.start = calendar.msToMoment(dateProfile.activeUnzonedRange.startMs, dateProfile.isRangeAllDay);
  4109. this.end = calendar.msToMoment(dateProfile.activeUnzonedRange.endMs, dateProfile.isRangeAllDay);
  4110. this.intervalStart = calendar.msToMoment(dateProfile.currentUnzonedRange.startMs, dateProfile.isRangeAllDay);
  4111. this.intervalEnd = calendar.msToMoment(dateProfile.currentUnzonedRange.endMs, dateProfile.isRangeAllDay);
  4112. });
  4113. /***/ }),
  4114. /* 42 */
  4115. /***/ (function(module, exports, __webpack_require__) {
  4116. Object.defineProperty(exports, "__esModule", { value: true });
  4117. var $ = __webpack_require__(3);
  4118. var util_1 = __webpack_require__(4);
  4119. var EventRenderer = /** @class */ (function () {
  4120. function EventRenderer(component, fillRenderer) {
  4121. this.view = component._getView();
  4122. this.component = component;
  4123. this.fillRenderer = fillRenderer;
  4124. }
  4125. EventRenderer.prototype.opt = function (name) {
  4126. return this.view.opt(name);
  4127. };
  4128. // Updates values that rely on options and also relate to range
  4129. EventRenderer.prototype.rangeUpdated = function () {
  4130. var displayEventTime;
  4131. var displayEventEnd;
  4132. this.eventTimeFormat =
  4133. this.opt('eventTimeFormat') ||
  4134. this.opt('timeFormat') || // deprecated
  4135. this.computeEventTimeFormat();
  4136. displayEventTime = this.opt('displayEventTime');
  4137. if (displayEventTime == null) {
  4138. displayEventTime = this.computeDisplayEventTime(); // might be based off of range
  4139. }
  4140. displayEventEnd = this.opt('displayEventEnd');
  4141. if (displayEventEnd == null) {
  4142. displayEventEnd = this.computeDisplayEventEnd(); // might be based off of range
  4143. }
  4144. this.displayEventTime = displayEventTime;
  4145. this.displayEventEnd = displayEventEnd;
  4146. };
  4147. EventRenderer.prototype.render = function (eventsPayload) {
  4148. var dateProfile = this.component._getDateProfile();
  4149. var eventDefId;
  4150. var instanceGroup;
  4151. var eventRanges;
  4152. var bgRanges = [];
  4153. var fgRanges = [];
  4154. for (eventDefId in eventsPayload) {
  4155. instanceGroup = eventsPayload[eventDefId];
  4156. eventRanges = instanceGroup.sliceRenderRanges(dateProfile.activeUnzonedRange);
  4157. if (instanceGroup.getEventDef().hasBgRendering()) {
  4158. bgRanges.push.apply(bgRanges, eventRanges);
  4159. }
  4160. else {
  4161. fgRanges.push.apply(fgRanges, eventRanges);
  4162. }
  4163. }
  4164. this.renderBgRanges(bgRanges);
  4165. this.renderFgRanges(fgRanges);
  4166. };
  4167. EventRenderer.prototype.unrender = function () {
  4168. this.unrenderBgRanges();
  4169. this.unrenderFgRanges();
  4170. };
  4171. EventRenderer.prototype.renderFgRanges = function (eventRanges) {
  4172. var eventFootprints = this.component.eventRangesToEventFootprints(eventRanges);
  4173. var segs = this.component.eventFootprintsToSegs(eventFootprints);
  4174. // render an `.el` on each seg
  4175. // returns a subset of the segs. segs that were actually rendered
  4176. segs = this.renderFgSegEls(segs);
  4177. if (this.renderFgSegs(segs) !== false) {
  4178. this.fgSegs = segs;
  4179. }
  4180. };
  4181. EventRenderer.prototype.unrenderFgRanges = function () {
  4182. this.unrenderFgSegs(this.fgSegs || []);
  4183. this.fgSegs = null;
  4184. };
  4185. EventRenderer.prototype.renderBgRanges = function (eventRanges) {
  4186. var eventFootprints = this.component.eventRangesToEventFootprints(eventRanges);
  4187. var segs = this.component.eventFootprintsToSegs(eventFootprints);
  4188. if (this.renderBgSegs(segs) !== false) {
  4189. this.bgSegs = segs;
  4190. }
  4191. };
  4192. EventRenderer.prototype.unrenderBgRanges = function () {
  4193. this.unrenderBgSegs();
  4194. this.bgSegs = null;
  4195. };
  4196. EventRenderer.prototype.getSegs = function () {
  4197. return (this.bgSegs || []).concat(this.fgSegs || []);
  4198. };
  4199. // Renders foreground event segments onto the grid
  4200. EventRenderer.prototype.renderFgSegs = function (segs) {
  4201. // subclasses must implement
  4202. // segs already has rendered els, and has been filtered.
  4203. return false; // signal failure if not implemented
  4204. };
  4205. // Unrenders all currently rendered foreground segments
  4206. EventRenderer.prototype.unrenderFgSegs = function (segs) {
  4207. // subclasses must implement
  4208. };
  4209. EventRenderer.prototype.renderBgSegs = function (segs) {
  4210. var _this = this;
  4211. if (this.fillRenderer) {
  4212. this.fillRenderer.renderSegs('bgEvent', segs, {
  4213. getClasses: function (seg) {
  4214. return _this.getBgClasses(seg.footprint.eventDef);
  4215. },
  4216. getCss: function (seg) {
  4217. return {
  4218. 'background-color': _this.getBgColor(seg.footprint.eventDef)
  4219. };
  4220. },
  4221. filterEl: function (seg, el) {
  4222. return _this.filterEventRenderEl(seg.footprint, el);
  4223. }
  4224. });
  4225. }
  4226. else {
  4227. return false; // signal failure if no fillRenderer
  4228. }
  4229. };
  4230. EventRenderer.prototype.unrenderBgSegs = function () {
  4231. if (this.fillRenderer) {
  4232. this.fillRenderer.unrender('bgEvent');
  4233. }
  4234. };
  4235. // Renders and assigns an `el` property for each foreground event segment.
  4236. // Only returns segments that successfully rendered.
  4237. EventRenderer.prototype.renderFgSegEls = function (segs, disableResizing) {
  4238. var _this = this;
  4239. if (disableResizing === void 0) { disableResizing = false; }
  4240. var hasEventRenderHandlers = this.view.hasPublicHandlers('eventRender');
  4241. var html = '';
  4242. var renderedSegs = [];
  4243. var i;
  4244. if (segs.length) {
  4245. // build a large concatenation of event segment HTML
  4246. for (i = 0; i < segs.length; i++) {
  4247. this.beforeFgSegHtml(segs[i]);
  4248. html += this.fgSegHtml(segs[i], disableResizing);
  4249. }
  4250. // Grab individual elements from the combined HTML string. Use each as the default rendering.
  4251. // Then, compute the 'el' for each segment. An el might be null if the eventRender callback returned false.
  4252. $(html).each(function (i, node) {
  4253. var seg = segs[i];
  4254. var el = $(node);
  4255. if (hasEventRenderHandlers) {
  4256. el = _this.filterEventRenderEl(seg.footprint, el);
  4257. }
  4258. if (el) {
  4259. el.data('fc-seg', seg); // used by handlers
  4260. seg.el = el;
  4261. renderedSegs.push(seg);
  4262. }
  4263. });
  4264. }
  4265. return renderedSegs;
  4266. };
  4267. EventRenderer.prototype.beforeFgSegHtml = function (seg) {
  4268. };
  4269. // Generates the HTML for the default rendering of a foreground event segment. Used by renderFgSegEls()
  4270. EventRenderer.prototype.fgSegHtml = function (seg, disableResizing) {
  4271. // subclasses should implement
  4272. };
  4273. // Generic utility for generating the HTML classNames for an event segment's element
  4274. EventRenderer.prototype.getSegClasses = function (seg, isDraggable, isResizable) {
  4275. var classes = [
  4276. 'fc-event',
  4277. seg.isStart ? 'fc-start' : 'fc-not-start',
  4278. seg.isEnd ? 'fc-end' : 'fc-not-end'
  4279. ].concat(this.getClasses(seg.footprint.eventDef));
  4280. if (isDraggable) {
  4281. classes.push('fc-draggable');
  4282. }
  4283. if (isResizable) {
  4284. classes.push('fc-resizable');
  4285. }
  4286. // event is currently selected? attach a className.
  4287. if (this.view.isEventDefSelected(seg.footprint.eventDef)) {
  4288. classes.push('fc-selected');
  4289. }
  4290. return classes;
  4291. };
  4292. // Given an event and the default element used for rendering, returns the element that should actually be used.
  4293. // Basically runs events and elements through the eventRender hook.
  4294. EventRenderer.prototype.filterEventRenderEl = function (eventFootprint, el) {
  4295. var legacy = eventFootprint.getEventLegacy();
  4296. var custom = this.view.publiclyTrigger('eventRender', {
  4297. context: legacy,
  4298. args: [legacy, el, this.view]
  4299. });
  4300. if (custom === false) {
  4301. el = null;
  4302. }
  4303. else if (custom && custom !== true) {
  4304. el = $(custom);
  4305. }
  4306. return el;
  4307. };
  4308. // Compute the text that should be displayed on an event's element.
  4309. // `range` can be the Event object itself, or something range-like, with at least a `start`.
  4310. // If event times are disabled, or the event has no time, will return a blank string.
  4311. // If not specified, formatStr will default to the eventTimeFormat setting,
  4312. // and displayEnd will default to the displayEventEnd setting.
  4313. EventRenderer.prototype.getTimeText = function (eventFootprint, formatStr, displayEnd) {
  4314. return this._getTimeText(eventFootprint.eventInstance.dateProfile.start, eventFootprint.eventInstance.dateProfile.end, eventFootprint.componentFootprint.isAllDay, formatStr, displayEnd);
  4315. };
  4316. EventRenderer.prototype._getTimeText = function (start, end, isAllDay, formatStr, displayEnd) {
  4317. if (formatStr == null) {
  4318. formatStr = this.eventTimeFormat;
  4319. }
  4320. if (displayEnd == null) {
  4321. displayEnd = this.displayEventEnd;
  4322. }
  4323. if (this.displayEventTime && !isAllDay) {
  4324. if (displayEnd && end) {
  4325. return this.view.formatRange({ start: start, end: end }, false, // allDay
  4326. formatStr);
  4327. }
  4328. else {
  4329. return start.format(formatStr);
  4330. }
  4331. }
  4332. return '';
  4333. };
  4334. EventRenderer.prototype.computeEventTimeFormat = function () {
  4335. return this.opt('smallTimeFormat');
  4336. };
  4337. EventRenderer.prototype.computeDisplayEventTime = function () {
  4338. return true;
  4339. };
  4340. EventRenderer.prototype.computeDisplayEventEnd = function () {
  4341. return true;
  4342. };
  4343. EventRenderer.prototype.getBgClasses = function (eventDef) {
  4344. var classNames = this.getClasses(eventDef);
  4345. classNames.push('fc-bgevent');
  4346. return classNames;
  4347. };
  4348. EventRenderer.prototype.getClasses = function (eventDef) {
  4349. var objs = this.getStylingObjs(eventDef);
  4350. var i;
  4351. var classNames = [];
  4352. for (i = 0; i < objs.length; i++) {
  4353. classNames.push.apply(// append
  4354. classNames, objs[i].eventClassName || objs[i].className || []);
  4355. }
  4356. return classNames;
  4357. };
  4358. // Utility for generating event skin-related CSS properties
  4359. EventRenderer.prototype.getSkinCss = function (eventDef) {
  4360. return {
  4361. 'background-color': this.getBgColor(eventDef),
  4362. 'border-color': this.getBorderColor(eventDef),
  4363. color: this.getTextColor(eventDef)
  4364. };
  4365. };
  4366. // Queries for caller-specified color, then falls back to default
  4367. EventRenderer.prototype.getBgColor = function (eventDef) {
  4368. var objs = this.getStylingObjs(eventDef);
  4369. var i;
  4370. var val;
  4371. for (i = 0; i < objs.length && !val; i++) {
  4372. val = objs[i].eventBackgroundColor || objs[i].eventColor ||
  4373. objs[i].backgroundColor || objs[i].color;
  4374. }
  4375. if (!val) {
  4376. val = this.opt('eventBackgroundColor') || this.opt('eventColor');
  4377. }
  4378. return val;
  4379. };
  4380. // Queries for caller-specified color, then falls back to default
  4381. EventRenderer.prototype.getBorderColor = function (eventDef) {
  4382. var objs = this.getStylingObjs(eventDef);
  4383. var i;
  4384. var val;
  4385. for (i = 0; i < objs.length && !val; i++) {
  4386. val = objs[i].eventBorderColor || objs[i].eventColor ||
  4387. objs[i].borderColor || objs[i].color;
  4388. }
  4389. if (!val) {
  4390. val = this.opt('eventBorderColor') || this.opt('eventColor');
  4391. }
  4392. return val;
  4393. };
  4394. // Queries for caller-specified color, then falls back to default
  4395. EventRenderer.prototype.getTextColor = function (eventDef) {
  4396. var objs = this.getStylingObjs(eventDef);
  4397. var i;
  4398. var val;
  4399. for (i = 0; i < objs.length && !val; i++) {
  4400. val = objs[i].eventTextColor ||
  4401. objs[i].textColor;
  4402. }
  4403. if (!val) {
  4404. val = this.opt('eventTextColor');
  4405. }
  4406. return val;
  4407. };
  4408. EventRenderer.prototype.getStylingObjs = function (eventDef) {
  4409. var objs = this.getFallbackStylingObjs(eventDef);
  4410. objs.unshift(eventDef);
  4411. return objs;
  4412. };
  4413. EventRenderer.prototype.getFallbackStylingObjs = function (eventDef) {
  4414. return [eventDef.source];
  4415. };
  4416. EventRenderer.prototype.sortEventSegs = function (segs) {
  4417. segs.sort(util_1.proxy(this, 'compareEventSegs'));
  4418. };
  4419. // A cmp function for determining which segments should take visual priority
  4420. EventRenderer.prototype.compareEventSegs = function (seg1, seg2) {
  4421. var f1 = seg1.footprint.componentFootprint;
  4422. var r1 = f1.unzonedRange;
  4423. var f2 = seg2.footprint.componentFootprint;
  4424. var r2 = f2.unzonedRange;
  4425. return r1.startMs - r2.startMs || // earlier events go first
  4426. (r2.endMs - r2.startMs) - (r1.endMs - r1.startMs) || // tie? longer events go first
  4427. f2.isAllDay - f1.isAllDay || // tie? put all-day events first (booleans cast to 0/1)
  4428. util_1.compareByFieldSpecs(seg1.footprint.eventDef, seg2.footprint.eventDef, this.view.eventOrderSpecs);
  4429. };
  4430. return EventRenderer;
  4431. }());
  4432. exports.default = EventRenderer;
  4433. /***/ }),
  4434. /* 43 */,
  4435. /* 44 */,
  4436. /* 45 */,
  4437. /* 46 */,
  4438. /* 47 */
  4439. /***/ (function(module, exports, __webpack_require__) {
  4440. Object.defineProperty(exports, "__esModule", { value: true });
  4441. var moment_ext_1 = __webpack_require__(10);
  4442. // Plugin
  4443. // -------------------------------------------------------------------------------------------------
  4444. moment_ext_1.newMomentProto.format = function () {
  4445. if (this._fullCalendar && arguments[0]) {
  4446. return formatDate(this, arguments[0]); // our extended formatting
  4447. }
  4448. if (this._ambigTime) {
  4449. return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD');
  4450. }
  4451. if (this._ambigZone) {
  4452. return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD[T]HH:mm:ss');
  4453. }
  4454. if (this._fullCalendar) {
  4455. // moment.format() doesn't ensure english, but we want to.
  4456. return moment_ext_1.oldMomentFormat(englishMoment(this));
  4457. }
  4458. return moment_ext_1.oldMomentProto.format.apply(this, arguments);
  4459. };
  4460. moment_ext_1.newMomentProto.toISOString = function () {
  4461. if (this._ambigTime) {
  4462. return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD');
  4463. }
  4464. if (this._ambigZone) {
  4465. return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD[T]HH:mm:ss');
  4466. }
  4467. if (this._fullCalendar) {
  4468. // depending on browser, moment might not output english. ensure english.
  4469. // https://github.com/moment/moment/blob/2.18.1/src/lib/moment/format.js#L22
  4470. return moment_ext_1.oldMomentProto.toISOString.apply(englishMoment(this), arguments);
  4471. }
  4472. return moment_ext_1.oldMomentProto.toISOString.apply(this, arguments);
  4473. };
  4474. function englishMoment(mom) {
  4475. if (mom.locale() !== 'en') {
  4476. return mom.clone().locale('en');
  4477. }
  4478. return mom;
  4479. }
  4480. // Config
  4481. // ---------------------------------------------------------------------------------------------------------------------
  4482. /*
  4483. Inserted between chunks in the fake ("intermediate") formatting string.
  4484. Important that it passes as whitespace (\s) because moment often identifies non-standalone months
  4485. via a regexp with an \s.
  4486. */
  4487. var PART_SEPARATOR = '\u000b'; // vertical tab
  4488. /*
  4489. Inserted as the first character of a literal-text chunk to indicate that the literal text is not actually literal text,
  4490. but rather, a "special" token that has custom rendering (see specialTokens map).
  4491. */
  4492. var SPECIAL_TOKEN_MARKER = '\u001f'; // information separator 1
  4493. /*
  4494. Inserted at the beginning and end of a span of text that must have non-zero numeric characters.
  4495. Handling of these markers is done in a post-processing step at the very end of text rendering.
  4496. */
  4497. var MAYBE_MARKER = '\u001e'; // information separator 2
  4498. var MAYBE_REGEXP = new RegExp(MAYBE_MARKER + '([^' + MAYBE_MARKER + ']*)' + MAYBE_MARKER, 'g'); // must be global
  4499. /*
  4500. Addition formatting tokens we want recognized
  4501. */
  4502. var specialTokens = {
  4503. t: function (date) {
  4504. return moment_ext_1.oldMomentFormat(date, 'a').charAt(0);
  4505. },
  4506. T: function (date) {
  4507. return moment_ext_1.oldMomentFormat(date, 'A').charAt(0);
  4508. }
  4509. };
  4510. /*
  4511. The first characters of formatting tokens for units that are 1 day or larger.
  4512. `value` is for ranking relative size (lower means bigger).
  4513. `unit` is a normalized unit, used for comparing moments.
  4514. */
  4515. var largeTokenMap = {
  4516. Y: { value: 1, unit: 'year' },
  4517. M: { value: 2, unit: 'month' },
  4518. W: { value: 3, unit: 'week' },
  4519. w: { value: 3, unit: 'week' },
  4520. D: { value: 4, unit: 'day' },
  4521. d: { value: 4, unit: 'day' } // day of week
  4522. };
  4523. // Single Date Formatting
  4524. // ---------------------------------------------------------------------------------------------------------------------
  4525. /*
  4526. Formats `date` with a Moment formatting string, but allow our non-zero areas and special token
  4527. */
  4528. function formatDate(date, formatStr) {
  4529. return renderFakeFormatString(getParsedFormatString(formatStr).fakeFormatString, date);
  4530. }
  4531. exports.formatDate = formatDate;
  4532. // Date Range Formatting
  4533. // -------------------------------------------------------------------------------------------------
  4534. // TODO: make it work with timezone offset
  4535. /*
  4536. Using a formatting string meant for a single date, generate a range string, like
  4537. "Sep 2 - 9 2013", that intelligently inserts a separator where the dates differ.
  4538. If the dates are the same as far as the format string is concerned, just return a single
  4539. rendering of one date, without any separator.
  4540. */
  4541. function formatRange(date1, date2, formatStr, separator, isRTL) {
  4542. var localeData;
  4543. date1 = moment_ext_1.default.parseZone(date1);
  4544. date2 = moment_ext_1.default.parseZone(date2);
  4545. localeData = date1.localeData();
  4546. // Expand localized format strings, like "LL" -> "MMMM D YYYY".
  4547. // BTW, this is not important for `formatDate` because it is impossible to put custom tokens
  4548. // or non-zero areas in Moment's localized format strings.
  4549. formatStr = localeData.longDateFormat(formatStr) || formatStr;
  4550. return renderParsedFormat(getParsedFormatString(formatStr), date1, date2, separator || ' - ', isRTL);
  4551. }
  4552. exports.formatRange = formatRange;
  4553. /*
  4554. Renders a range with an already-parsed format string.
  4555. */
  4556. function renderParsedFormat(parsedFormat, date1, date2, separator, isRTL) {
  4557. var sameUnits = parsedFormat.sameUnits;
  4558. var unzonedDate1 = date1.clone().stripZone(); // for same-unit comparisons
  4559. var unzonedDate2 = date2.clone().stripZone(); // "
  4560. var renderedParts1 = renderFakeFormatStringParts(parsedFormat.fakeFormatString, date1);
  4561. var renderedParts2 = renderFakeFormatStringParts(parsedFormat.fakeFormatString, date2);
  4562. var leftI;
  4563. var leftStr = '';
  4564. var rightI;
  4565. var rightStr = '';
  4566. var middleI;
  4567. var middleStr1 = '';
  4568. var middleStr2 = '';
  4569. var middleStr = '';
  4570. // Start at the leftmost side of the formatting string and continue until you hit a token
  4571. // that is not the same between dates.
  4572. for (leftI = 0; leftI < sameUnits.length && (!sameUnits[leftI] || unzonedDate1.isSame(unzonedDate2, sameUnits[leftI])); leftI++) {
  4573. leftStr += renderedParts1[leftI];
  4574. }
  4575. // Similarly, start at the rightmost side of the formatting string and move left
  4576. for (rightI = sameUnits.length - 1; rightI > leftI && (!sameUnits[rightI] || unzonedDate1.isSame(unzonedDate2, sameUnits[rightI])); rightI--) {
  4577. // If current chunk is on the boundary of unique date-content, and is a special-case
  4578. // date-formatting postfix character, then don't consume it. Consider it unique date-content.
  4579. // TODO: make configurable
  4580. if (rightI - 1 === leftI && renderedParts1[rightI] === '.') {
  4581. break;
  4582. }
  4583. rightStr = renderedParts1[rightI] + rightStr;
  4584. }
  4585. // The area in the middle is different for both of the dates.
  4586. // Collect them distinctly so we can jam them together later.
  4587. for (middleI = leftI; middleI <= rightI; middleI++) {
  4588. middleStr1 += renderedParts1[middleI];
  4589. middleStr2 += renderedParts2[middleI];
  4590. }
  4591. if (middleStr1 || middleStr2) {
  4592. if (isRTL) {
  4593. middleStr = middleStr2 + separator + middleStr1;
  4594. }
  4595. else {
  4596. middleStr = middleStr1 + separator + middleStr2;
  4597. }
  4598. }
  4599. return processMaybeMarkers(leftStr + middleStr + rightStr);
  4600. }
  4601. // Format String Parsing
  4602. // ---------------------------------------------------------------------------------------------------------------------
  4603. var parsedFormatStrCache = {};
  4604. /*
  4605. Returns a parsed format string, leveraging a cache.
  4606. */
  4607. function getParsedFormatString(formatStr) {
  4608. return parsedFormatStrCache[formatStr] ||
  4609. (parsedFormatStrCache[formatStr] = parseFormatString(formatStr));
  4610. }
  4611. /*
  4612. Parses a format string into the following:
  4613. - fakeFormatString: a momentJS formatting string, littered with special control characters that get post-processed.
  4614. - sameUnits: for every part in fakeFormatString, if the part is a token, the value will be a unit string (like "day"),
  4615. that indicates how similar a range's start & end must be in order to share the same formatted text.
  4616. If not a token, then the value is null.
  4617. Always a flat array (not nested liked "chunks").
  4618. */
  4619. function parseFormatString(formatStr) {
  4620. var chunks = chunkFormatString(formatStr);
  4621. return {
  4622. fakeFormatString: buildFakeFormatString(chunks),
  4623. sameUnits: buildSameUnits(chunks)
  4624. };
  4625. }
  4626. /*
  4627. Break the formatting string into an array of chunks.
  4628. A 'maybe' chunk will have nested chunks.
  4629. */
  4630. function chunkFormatString(formatStr) {
  4631. var chunks = [];
  4632. var match;
  4633. // TODO: more descrimination
  4634. // \4 is a backreference to the first character of a multi-character set.
  4635. var chunker = /\[([^\]]*)\]|\(([^\)]*)\)|(LTS|LT|(\w)\4*o?)|([^\w\[\(]+)/g;
  4636. while ((match = chunker.exec(formatStr))) {
  4637. if (match[1]) {
  4638. chunks.push.apply(chunks, // append
  4639. splitStringLiteral(match[1]));
  4640. }
  4641. else if (match[2]) {
  4642. chunks.push({ maybe: chunkFormatString(match[2]) });
  4643. }
  4644. else if (match[3]) {
  4645. chunks.push({ token: match[3] });
  4646. }
  4647. else if (match[5]) {
  4648. chunks.push.apply(chunks, // append
  4649. splitStringLiteral(match[5]));
  4650. }
  4651. }
  4652. return chunks;
  4653. }
  4654. /*
  4655. Potentially splits a literal-text string into multiple parts. For special cases.
  4656. */
  4657. function splitStringLiteral(s) {
  4658. if (s === '. ') {
  4659. return ['.', ' ']; // for locales with periods bound to the end of each year/month/date
  4660. }
  4661. else {
  4662. return [s];
  4663. }
  4664. }
  4665. /*
  4666. Given chunks parsed from a real format string, generate a fake (aka "intermediate") format string with special control
  4667. characters that will eventually be given to moment for formatting, and then post-processed.
  4668. */
  4669. function buildFakeFormatString(chunks) {
  4670. var parts = [];
  4671. var i;
  4672. var chunk;
  4673. for (i = 0; i < chunks.length; i++) {
  4674. chunk = chunks[i];
  4675. if (typeof chunk === 'string') {
  4676. parts.push('[' + chunk + ']');
  4677. }
  4678. else if (chunk.token) {
  4679. if (chunk.token in specialTokens) {
  4680. parts.push(SPECIAL_TOKEN_MARKER + // useful during post-processing
  4681. '[' + chunk.token + ']' // preserve as literal text
  4682. );
  4683. }
  4684. else {
  4685. parts.push(chunk.token); // unprotected text implies a format string
  4686. }
  4687. }
  4688. else if (chunk.maybe) {
  4689. parts.push(MAYBE_MARKER + // useful during post-processing
  4690. buildFakeFormatString(chunk.maybe) +
  4691. MAYBE_MARKER);
  4692. }
  4693. }
  4694. return parts.join(PART_SEPARATOR);
  4695. }
  4696. /*
  4697. Given parsed chunks from a real formatting string, generates an array of unit strings (like "day") that indicate
  4698. in which regard two dates must be similar in order to share range formatting text.
  4699. The `chunks` can be nested (because of "maybe" chunks), however, the returned array will be flat.
  4700. */
  4701. function buildSameUnits(chunks) {
  4702. var units = [];
  4703. var i;
  4704. var chunk;
  4705. var tokenInfo;
  4706. for (i = 0; i < chunks.length; i++) {
  4707. chunk = chunks[i];
  4708. if (chunk.token) {
  4709. tokenInfo = largeTokenMap[chunk.token.charAt(0)];
  4710. units.push(tokenInfo ? tokenInfo.unit : 'second'); // default to a very strict same-second
  4711. }
  4712. else if (chunk.maybe) {
  4713. units.push.apply(units, // append
  4714. buildSameUnits(chunk.maybe));
  4715. }
  4716. else {
  4717. units.push(null);
  4718. }
  4719. }
  4720. return units;
  4721. }
  4722. // Rendering to text
  4723. // ---------------------------------------------------------------------------------------------------------------------
  4724. /*
  4725. Formats a date with a fake format string, post-processes the control characters, then returns.
  4726. */
  4727. function renderFakeFormatString(fakeFormatString, date) {
  4728. return processMaybeMarkers(renderFakeFormatStringParts(fakeFormatString, date).join(''));
  4729. }
  4730. /*
  4731. Formats a date into parts that will have been post-processed, EXCEPT for the "maybe" markers.
  4732. */
  4733. function renderFakeFormatStringParts(fakeFormatString, date) {
  4734. var parts = [];
  4735. var fakeRender = moment_ext_1.oldMomentFormat(date, fakeFormatString);
  4736. var fakeParts = fakeRender.split(PART_SEPARATOR);
  4737. var i;
  4738. var fakePart;
  4739. for (i = 0; i < fakeParts.length; i++) {
  4740. fakePart = fakeParts[i];
  4741. if (fakePart.charAt(0) === SPECIAL_TOKEN_MARKER) {
  4742. parts.push(
  4743. // the literal string IS the token's name.
  4744. // call special token's registered function.
  4745. specialTokens[fakePart.substring(1)](date));
  4746. }
  4747. else {
  4748. parts.push(fakePart);
  4749. }
  4750. }
  4751. return parts;
  4752. }
  4753. /*
  4754. Accepts an almost-finally-formatted string and processes the "maybe" control characters, returning a new string.
  4755. */
  4756. function processMaybeMarkers(s) {
  4757. return s.replace(MAYBE_REGEXP, function (m0, m1) {
  4758. if (m1.match(/[1-9]/)) {
  4759. return m1;
  4760. }
  4761. else {
  4762. return '';
  4763. }
  4764. });
  4765. }
  4766. // Misc Utils
  4767. // -------------------------------------------------------------------------------------------------
  4768. /*
  4769. Returns a unit string, either 'year', 'month', 'day', or null for the most granular formatting token in the string.
  4770. */
  4771. function queryMostGranularFormatUnit(formatStr) {
  4772. var chunks = chunkFormatString(formatStr);
  4773. var i;
  4774. var chunk;
  4775. var candidate;
  4776. var best;
  4777. for (i = 0; i < chunks.length; i++) {
  4778. chunk = chunks[i];
  4779. if (chunk.token) {
  4780. candidate = largeTokenMap[chunk.token.charAt(0)];
  4781. if (candidate) {
  4782. if (!best || candidate.value > best.value) {
  4783. best = candidate;
  4784. }
  4785. }
  4786. }
  4787. }
  4788. if (best) {
  4789. return best.unit;
  4790. }
  4791. return null;
  4792. }
  4793. exports.queryMostGranularFormatUnit = queryMostGranularFormatUnit;
  4794. /***/ }),
  4795. /* 48 */
  4796. /***/ (function(module, exports, __webpack_require__) {
  4797. Object.defineProperty(exports, "__esModule", { value: true });
  4798. var tslib_1 = __webpack_require__(2);
  4799. var Class_1 = __webpack_require__(32);
  4800. var EmitterMixin_1 = __webpack_require__(11);
  4801. var ListenerMixin_1 = __webpack_require__(7);
  4802. var Model = /** @class */ (function (_super) {
  4803. tslib_1.__extends(Model, _super);
  4804. function Model() {
  4805. var _this = _super.call(this) || this;
  4806. _this._watchers = {};
  4807. _this._props = {};
  4808. _this.applyGlobalWatchers();
  4809. _this.constructed();
  4810. return _this;
  4811. }
  4812. Model.watch = function (name) {
  4813. var args = [];
  4814. for (var _i = 1; _i < arguments.length; _i++) {
  4815. args[_i - 1] = arguments[_i];
  4816. }
  4817. // subclasses should make a masked-copy of the superclass's map
  4818. // TODO: write test
  4819. if (!this.prototype.hasOwnProperty('_globalWatchArgs')) {
  4820. this.prototype._globalWatchArgs = Object.create(this.prototype._globalWatchArgs);
  4821. }
  4822. this.prototype._globalWatchArgs[name] = args;
  4823. };
  4824. Model.prototype.constructed = function () {
  4825. // useful for monkeypatching. TODO: BaseClass?
  4826. };
  4827. Model.prototype.applyGlobalWatchers = function () {
  4828. var map = this._globalWatchArgs;
  4829. var name;
  4830. for (name in map) {
  4831. this.watch.apply(this, [name].concat(map[name]));
  4832. }
  4833. };
  4834. Model.prototype.has = function (name) {
  4835. return name in this._props;
  4836. };
  4837. Model.prototype.get = function (name) {
  4838. if (name === undefined) {
  4839. return this._props;
  4840. }
  4841. return this._props[name];
  4842. };
  4843. Model.prototype.set = function (name, val) {
  4844. var newProps;
  4845. if (typeof name === 'string') {
  4846. newProps = {};
  4847. newProps[name] = val === undefined ? null : val;
  4848. }
  4849. else {
  4850. newProps = name;
  4851. }
  4852. this.setProps(newProps);
  4853. };
  4854. Model.prototype.reset = function (newProps) {
  4855. var oldProps = this._props;
  4856. var changeset = {}; // will have undefined's to signal unsets
  4857. var name;
  4858. for (name in oldProps) {
  4859. changeset[name] = undefined;
  4860. }
  4861. for (name in newProps) {
  4862. changeset[name] = newProps[name];
  4863. }
  4864. this.setProps(changeset);
  4865. };
  4866. Model.prototype.unset = function (name) {
  4867. var newProps = {};
  4868. var names;
  4869. var i;
  4870. if (typeof name === 'string') {
  4871. names = [name];
  4872. }
  4873. else {
  4874. names = name;
  4875. }
  4876. for (i = 0; i < names.length; i++) {
  4877. newProps[names[i]] = undefined;
  4878. }
  4879. this.setProps(newProps);
  4880. };
  4881. Model.prototype.setProps = function (newProps) {
  4882. var changedProps = {};
  4883. var changedCnt = 0;
  4884. var name;
  4885. var val;
  4886. for (name in newProps) {
  4887. val = newProps[name];
  4888. // a change in value?
  4889. // if an object, don't check equality, because might have been mutated internally.
  4890. // TODO: eventually enforce immutability.
  4891. if (typeof val === 'object' ||
  4892. val !== this._props[name]) {
  4893. changedProps[name] = val;
  4894. changedCnt++;
  4895. }
  4896. }
  4897. if (changedCnt) {
  4898. this.trigger('before:batchChange', changedProps);
  4899. for (name in changedProps) {
  4900. val = changedProps[name];
  4901. this.trigger('before:change', name, val);
  4902. this.trigger('before:change:' + name, val);
  4903. }
  4904. for (name in changedProps) {
  4905. val = changedProps[name];
  4906. if (val === undefined) {
  4907. delete this._props[name];
  4908. }
  4909. else {
  4910. this._props[name] = val;
  4911. }
  4912. this.trigger('change:' + name, val);
  4913. this.trigger('change', name, val);
  4914. }
  4915. this.trigger('batchChange', changedProps);
  4916. }
  4917. };
  4918. Model.prototype.watch = function (name, depList, startFunc, stopFunc) {
  4919. var _this = this;
  4920. this.unwatch(name);
  4921. this._watchers[name] = this._watchDeps(depList, function (deps) {
  4922. var res = startFunc.call(_this, deps);
  4923. if (res && res.then) {
  4924. _this.unset(name); // put in an unset state while resolving
  4925. res.then(function (val) {
  4926. _this.set(name, val);
  4927. });
  4928. }
  4929. else {
  4930. _this.set(name, res);
  4931. }
  4932. }, function (deps) {
  4933. _this.unset(name);
  4934. if (stopFunc) {
  4935. stopFunc.call(_this, deps);
  4936. }
  4937. });
  4938. };
  4939. Model.prototype.unwatch = function (name) {
  4940. var watcher = this._watchers[name];
  4941. if (watcher) {
  4942. delete this._watchers[name];
  4943. watcher.teardown();
  4944. }
  4945. };
  4946. Model.prototype._watchDeps = function (depList, startFunc, stopFunc) {
  4947. var _this = this;
  4948. var queuedChangeCnt = 0;
  4949. var depCnt = depList.length;
  4950. var satisfyCnt = 0;
  4951. var values = {}; // what's passed as the `deps` arguments
  4952. var bindTuples = []; // array of [ eventName, handlerFunc ] arrays
  4953. var isCallingStop = false;
  4954. var onBeforeDepChange = function (depName, val, isOptional) {
  4955. queuedChangeCnt++;
  4956. if (queuedChangeCnt === 1) {
  4957. if (satisfyCnt === depCnt) {
  4958. isCallingStop = true;
  4959. stopFunc(values);
  4960. isCallingStop = false;
  4961. }
  4962. }
  4963. };
  4964. var onDepChange = function (depName, val, isOptional) {
  4965. if (val === undefined) {
  4966. // required dependency that was previously set?
  4967. if (!isOptional && values[depName] !== undefined) {
  4968. satisfyCnt--;
  4969. }
  4970. delete values[depName];
  4971. }
  4972. else {
  4973. // required dependency that was previously unset?
  4974. if (!isOptional && values[depName] === undefined) {
  4975. satisfyCnt++;
  4976. }
  4977. values[depName] = val;
  4978. }
  4979. queuedChangeCnt--;
  4980. if (!queuedChangeCnt) {
  4981. // now finally satisfied or satisfied all along?
  4982. if (satisfyCnt === depCnt) {
  4983. // if the stopFunc initiated another value change, ignore it.
  4984. // it will be processed by another change event anyway.
  4985. if (!isCallingStop) {
  4986. startFunc(values);
  4987. }
  4988. }
  4989. }
  4990. };
  4991. // intercept for .on() that remembers handlers
  4992. var bind = function (eventName, handler) {
  4993. _this.on(eventName, handler);
  4994. bindTuples.push([eventName, handler]);
  4995. };
  4996. // listen to dependency changes
  4997. depList.forEach(function (depName) {
  4998. var isOptional = false;
  4999. if (depName.charAt(0) === '?') {
  5000. depName = depName.substring(1);
  5001. isOptional = true;
  5002. }
  5003. bind('before:change:' + depName, function (val) {
  5004. onBeforeDepChange(depName, val, isOptional);
  5005. });
  5006. bind('change:' + depName, function (val) {
  5007. onDepChange(depName, val, isOptional);
  5008. });
  5009. });
  5010. // process current dependency values
  5011. depList.forEach(function (depName) {
  5012. var isOptional = false;
  5013. if (depName.charAt(0) === '?') {
  5014. depName = depName.substring(1);
  5015. isOptional = true;
  5016. }
  5017. if (_this.has(depName)) {
  5018. values[depName] = _this.get(depName);
  5019. satisfyCnt++;
  5020. }
  5021. else if (isOptional) {
  5022. satisfyCnt++;
  5023. }
  5024. });
  5025. // initially satisfied
  5026. if (satisfyCnt === depCnt) {
  5027. startFunc(values);
  5028. }
  5029. return {
  5030. teardown: function () {
  5031. // remove all handlers
  5032. for (var i = 0; i < bindTuples.length; i++) {
  5033. _this.off(bindTuples[i][0], bindTuples[i][1]);
  5034. }
  5035. bindTuples = null;
  5036. // was satisfied, so call stopFunc
  5037. if (satisfyCnt === depCnt) {
  5038. stopFunc();
  5039. }
  5040. },
  5041. flash: function () {
  5042. if (satisfyCnt === depCnt) {
  5043. stopFunc();
  5044. startFunc(values);
  5045. }
  5046. }
  5047. };
  5048. };
  5049. Model.prototype.flash = function (name) {
  5050. var watcher = this._watchers[name];
  5051. if (watcher) {
  5052. watcher.flash();
  5053. }
  5054. };
  5055. return Model;
  5056. }(Class_1.default));
  5057. exports.default = Model;
  5058. Model.prototype._globalWatchArgs = {}; // mutation protection in Model.watch
  5059. EmitterMixin_1.default.mixInto(Model);
  5060. ListenerMixin_1.default.mixInto(Model);
  5061. /***/ }),
  5062. /* 49 */
  5063. /***/ (function(module, exports, __webpack_require__) {
  5064. Object.defineProperty(exports, "__esModule", { value: true });
  5065. var moment = __webpack_require__(0);
  5066. var util_1 = __webpack_require__(4);
  5067. var SingleEventDef_1 = __webpack_require__(13);
  5068. var RecurringEventDef_1 = __webpack_require__(206);
  5069. exports.default = {
  5070. parse: function (eventInput, source) {
  5071. if (util_1.isTimeString(eventInput.start) || moment.isDuration(eventInput.start) ||
  5072. util_1.isTimeString(eventInput.end) || moment.isDuration(eventInput.end)) {
  5073. return RecurringEventDef_1.default.parse(eventInput, source);
  5074. }
  5075. else {
  5076. return SingleEventDef_1.default.parse(eventInput, source);
  5077. }
  5078. }
  5079. };
  5080. /***/ }),
  5081. /* 50 */
  5082. /***/ (function(module, exports, __webpack_require__) {
  5083. Object.defineProperty(exports, "__esModule", { value: true });
  5084. var util_1 = __webpack_require__(4);
  5085. var EventDateProfile_1 = __webpack_require__(17);
  5086. var EventDefDateMutation = /** @class */ (function () {
  5087. function EventDefDateMutation() {
  5088. this.clearEnd = false;
  5089. this.forceTimed = false;
  5090. this.forceAllDay = false;
  5091. }
  5092. EventDefDateMutation.createFromDiff = function (dateProfile0, dateProfile1, largeUnit) {
  5093. var clearEnd = dateProfile0.end && !dateProfile1.end;
  5094. var forceTimed = dateProfile0.isAllDay() && !dateProfile1.isAllDay();
  5095. var forceAllDay = !dateProfile0.isAllDay() && dateProfile1.isAllDay();
  5096. var dateDelta;
  5097. var endDiff;
  5098. var endDelta;
  5099. var mutation;
  5100. // subtracts the dates in the appropriate way, returning a duration
  5101. function subtractDates(date1, date0) {
  5102. if (largeUnit) {
  5103. return util_1.diffByUnit(date1, date0, largeUnit); // poorly named
  5104. }
  5105. else if (dateProfile1.isAllDay()) {
  5106. return util_1.diffDay(date1, date0); // poorly named
  5107. }
  5108. else {
  5109. return util_1.diffDayTime(date1, date0); // poorly named
  5110. }
  5111. }
  5112. dateDelta = subtractDates(dateProfile1.start, dateProfile0.start);
  5113. if (dateProfile1.end) {
  5114. // use unzonedRanges because dateProfile0.end might be null
  5115. endDiff = subtractDates(dateProfile1.unzonedRange.getEnd(), dateProfile0.unzonedRange.getEnd());
  5116. endDelta = endDiff.subtract(dateDelta);
  5117. }
  5118. mutation = new EventDefDateMutation();
  5119. mutation.clearEnd = clearEnd;
  5120. mutation.forceTimed = forceTimed;
  5121. mutation.forceAllDay = forceAllDay;
  5122. mutation.setDateDelta(dateDelta);
  5123. mutation.setEndDelta(endDelta);
  5124. return mutation;
  5125. };
  5126. /*
  5127. returns an undo function.
  5128. */
  5129. EventDefDateMutation.prototype.buildNewDateProfile = function (eventDateProfile, calendar) {
  5130. var start = eventDateProfile.start.clone();
  5131. var end = null;
  5132. var shouldRezone = false;
  5133. if (eventDateProfile.end && !this.clearEnd) {
  5134. end = eventDateProfile.end.clone();
  5135. }
  5136. else if (this.endDelta && !end) {
  5137. end = calendar.getDefaultEventEnd(eventDateProfile.isAllDay(), start);
  5138. }
  5139. if (this.forceTimed) {
  5140. shouldRezone = true;
  5141. if (!start.hasTime()) {
  5142. start.time(0);
  5143. }
  5144. if (end && !end.hasTime()) {
  5145. end.time(0);
  5146. }
  5147. }
  5148. else if (this.forceAllDay) {
  5149. if (start.hasTime()) {
  5150. start.stripTime();
  5151. }
  5152. if (end && end.hasTime()) {
  5153. end.stripTime();
  5154. }
  5155. }
  5156. if (this.dateDelta) {
  5157. shouldRezone = true;
  5158. start.add(this.dateDelta);
  5159. if (end) {
  5160. end.add(this.dateDelta);
  5161. }
  5162. }
  5163. // do this before adding startDelta to start, so we can work off of start
  5164. if (this.endDelta) {
  5165. shouldRezone = true;
  5166. end.add(this.endDelta);
  5167. }
  5168. if (this.startDelta) {
  5169. shouldRezone = true;
  5170. start.add(this.startDelta);
  5171. }
  5172. if (shouldRezone) {
  5173. start = calendar.applyTimezone(start);
  5174. if (end) {
  5175. end = calendar.applyTimezone(end);
  5176. }
  5177. }
  5178. // TODO: okay to access calendar option?
  5179. if (!end && calendar.opt('forceEventDuration')) {
  5180. end = calendar.getDefaultEventEnd(eventDateProfile.isAllDay(), start);
  5181. }
  5182. return new EventDateProfile_1.default(start, end, calendar);
  5183. };
  5184. EventDefDateMutation.prototype.setDateDelta = function (dateDelta) {
  5185. if (dateDelta && dateDelta.valueOf()) {
  5186. this.dateDelta = dateDelta;
  5187. }
  5188. else {
  5189. this.dateDelta = null;
  5190. }
  5191. };
  5192. EventDefDateMutation.prototype.setStartDelta = function (startDelta) {
  5193. if (startDelta && startDelta.valueOf()) {
  5194. this.startDelta = startDelta;
  5195. }
  5196. else {
  5197. this.startDelta = null;
  5198. }
  5199. };
  5200. EventDefDateMutation.prototype.setEndDelta = function (endDelta) {
  5201. if (endDelta && endDelta.valueOf()) {
  5202. this.endDelta = endDelta;
  5203. }
  5204. else {
  5205. this.endDelta = null;
  5206. }
  5207. };
  5208. EventDefDateMutation.prototype.isEmpty = function () {
  5209. return !this.clearEnd && !this.forceTimed && !this.forceAllDay &&
  5210. !this.dateDelta && !this.startDelta && !this.endDelta;
  5211. };
  5212. return EventDefDateMutation;
  5213. }());
  5214. exports.default = EventDefDateMutation;
  5215. /***/ }),
  5216. /* 51 */
  5217. /***/ (function(module, exports, __webpack_require__) {
  5218. Object.defineProperty(exports, "__esModule", { value: true });
  5219. var StandardTheme_1 = __webpack_require__(209);
  5220. var JqueryUiTheme_1 = __webpack_require__(210);
  5221. var themeClassHash = {};
  5222. function defineThemeSystem(themeName, themeClass) {
  5223. themeClassHash[themeName] = themeClass;
  5224. }
  5225. exports.defineThemeSystem = defineThemeSystem;
  5226. function getThemeSystemClass(themeSetting) {
  5227. if (!themeSetting) {
  5228. return StandardTheme_1.default;
  5229. }
  5230. else if (themeSetting === true) {
  5231. return JqueryUiTheme_1.default;
  5232. }
  5233. else {
  5234. return themeClassHash[themeSetting];
  5235. }
  5236. }
  5237. exports.getThemeSystemClass = getThemeSystemClass;
  5238. /***/ }),
  5239. /* 52 */
  5240. /***/ (function(module, exports, __webpack_require__) {
  5241. Object.defineProperty(exports, "__esModule", { value: true });
  5242. var tslib_1 = __webpack_require__(2);
  5243. var $ = __webpack_require__(3);
  5244. var util_1 = __webpack_require__(4);
  5245. var Promise_1 = __webpack_require__(19);
  5246. var EventSource_1 = __webpack_require__(6);
  5247. var SingleEventDef_1 = __webpack_require__(13);
  5248. var ArrayEventSource = /** @class */ (function (_super) {
  5249. tslib_1.__extends(ArrayEventSource, _super);
  5250. function ArrayEventSource(calendar) {
  5251. var _this = _super.call(this, calendar) || this;
  5252. _this.eventDefs = []; // for if setRawEventDefs is never called
  5253. return _this;
  5254. }
  5255. ArrayEventSource.parse = function (rawInput, calendar) {
  5256. var rawProps;
  5257. // normalize raw input
  5258. if ($.isArray(rawInput.events)) {
  5259. rawProps = rawInput;
  5260. }
  5261. else if ($.isArray(rawInput)) {
  5262. rawProps = { events: rawInput };
  5263. }
  5264. if (rawProps) {
  5265. return EventSource_1.default.parse.call(this, rawProps, calendar);
  5266. }
  5267. return false;
  5268. };
  5269. ArrayEventSource.prototype.setRawEventDefs = function (rawEventDefs) {
  5270. this.rawEventDefs = rawEventDefs;
  5271. this.eventDefs = this.parseEventDefs(rawEventDefs);
  5272. };
  5273. ArrayEventSource.prototype.fetch = function (start, end, timezone) {
  5274. var eventDefs = this.eventDefs;
  5275. var i;
  5276. if (this.currentTimezone != null &&
  5277. this.currentTimezone !== timezone) {
  5278. for (i = 0; i < eventDefs.length; i++) {
  5279. if (eventDefs[i] instanceof SingleEventDef_1.default) {
  5280. eventDefs[i].rezone();
  5281. }
  5282. }
  5283. }
  5284. this.currentTimezone = timezone;
  5285. return Promise_1.default.resolve(eventDefs);
  5286. };
  5287. ArrayEventSource.prototype.addEventDef = function (eventDef) {
  5288. this.eventDefs.push(eventDef);
  5289. };
  5290. /*
  5291. eventDefId already normalized to a string
  5292. */
  5293. ArrayEventSource.prototype.removeEventDefsById = function (eventDefId) {
  5294. return util_1.removeMatching(this.eventDefs, function (eventDef) {
  5295. return eventDef.id === eventDefId;
  5296. });
  5297. };
  5298. ArrayEventSource.prototype.removeAllEventDefs = function () {
  5299. this.eventDefs = [];
  5300. };
  5301. ArrayEventSource.prototype.getPrimitive = function () {
  5302. return this.rawEventDefs;
  5303. };
  5304. ArrayEventSource.prototype.applyManualStandardProps = function (rawProps) {
  5305. var superSuccess = _super.prototype.applyManualStandardProps.call(this, rawProps);
  5306. this.setRawEventDefs(rawProps.events);
  5307. return superSuccess;
  5308. };
  5309. return ArrayEventSource;
  5310. }(EventSource_1.default));
  5311. exports.default = ArrayEventSource;
  5312. ArrayEventSource.defineStandardProps({
  5313. events: false // don't automatically transfer
  5314. });
  5315. /***/ }),
  5316. /* 53 */
  5317. /***/ (function(module, exports, __webpack_require__) {
  5318. Object.defineProperty(exports, "__esModule", { value: true });
  5319. var $ = __webpack_require__(3);
  5320. var util_1 = __webpack_require__(4);
  5321. /*
  5322. A cache for the left/right/top/bottom/width/height values for one or more elements.
  5323. Works with both offset (from topleft document) and position (from offsetParent).
  5324. options:
  5325. - els
  5326. - isHorizontal
  5327. - isVertical
  5328. */
  5329. var CoordCache = /** @class */ (function () {
  5330. function CoordCache(options) {
  5331. this.isHorizontal = false; // whether to query for left/right/width
  5332. this.isVertical = false; // whether to query for top/bottom/height
  5333. this.els = $(options.els);
  5334. this.isHorizontal = options.isHorizontal;
  5335. this.isVertical = options.isVertical;
  5336. this.forcedOffsetParentEl = options.offsetParent ? $(options.offsetParent) : null;
  5337. }
  5338. // Queries the els for coordinates and stores them.
  5339. // Call this method before using and of the get* methods below.
  5340. CoordCache.prototype.build = function () {
  5341. var offsetParentEl = this.forcedOffsetParentEl;
  5342. if (!offsetParentEl && this.els.length > 0) {
  5343. offsetParentEl = this.els.eq(0).offsetParent();
  5344. }
  5345. this.origin = offsetParentEl ?
  5346. offsetParentEl.offset() :
  5347. null;
  5348. this.boundingRect = this.queryBoundingRect();
  5349. if (this.isHorizontal) {
  5350. this.buildElHorizontals();
  5351. }
  5352. if (this.isVertical) {
  5353. this.buildElVerticals();
  5354. }
  5355. };
  5356. // Destroys all internal data about coordinates, freeing memory
  5357. CoordCache.prototype.clear = function () {
  5358. this.origin = null;
  5359. this.boundingRect = null;
  5360. this.lefts = null;
  5361. this.rights = null;
  5362. this.tops = null;
  5363. this.bottoms = null;
  5364. };
  5365. // When called, if coord caches aren't built, builds them
  5366. CoordCache.prototype.ensureBuilt = function () {
  5367. if (!this.origin) {
  5368. this.build();
  5369. }
  5370. };
  5371. // Populates the left/right internal coordinate arrays
  5372. CoordCache.prototype.buildElHorizontals = function () {
  5373. var lefts = [];
  5374. var rights = [];
  5375. this.els.each(function (i, node) {
  5376. var el = $(node);
  5377. var left = el.offset().left;
  5378. var width = el.outerWidth();
  5379. lefts.push(left);
  5380. rights.push(left + width);
  5381. });
  5382. this.lefts = lefts;
  5383. this.rights = rights;
  5384. };
  5385. // Populates the top/bottom internal coordinate arrays
  5386. CoordCache.prototype.buildElVerticals = function () {
  5387. var tops = [];
  5388. var bottoms = [];
  5389. this.els.each(function (i, node) {
  5390. var el = $(node);
  5391. var top = el.offset().top;
  5392. var height = el.outerHeight();
  5393. tops.push(top);
  5394. bottoms.push(top + height);
  5395. });
  5396. this.tops = tops;
  5397. this.bottoms = bottoms;
  5398. };
  5399. // Given a left offset (from document left), returns the index of the el that it horizontally intersects.
  5400. // If no intersection is made, returns undefined.
  5401. CoordCache.prototype.getHorizontalIndex = function (leftOffset) {
  5402. this.ensureBuilt();
  5403. var lefts = this.lefts;
  5404. var rights = this.rights;
  5405. var len = lefts.length;
  5406. var i;
  5407. for (i = 0; i < len; i++) {
  5408. if (leftOffset >= lefts[i] && leftOffset < rights[i]) {
  5409. return i;
  5410. }
  5411. }
  5412. };
  5413. // Given a top offset (from document top), returns the index of the el that it vertically intersects.
  5414. // If no intersection is made, returns undefined.
  5415. CoordCache.prototype.getVerticalIndex = function (topOffset) {
  5416. this.ensureBuilt();
  5417. var tops = this.tops;
  5418. var bottoms = this.bottoms;
  5419. var len = tops.length;
  5420. var i;
  5421. for (i = 0; i < len; i++) {
  5422. if (topOffset >= tops[i] && topOffset < bottoms[i]) {
  5423. return i;
  5424. }
  5425. }
  5426. };
  5427. // Gets the left offset (from document left) of the element at the given index
  5428. CoordCache.prototype.getLeftOffset = function (leftIndex) {
  5429. this.ensureBuilt();
  5430. return this.lefts[leftIndex];
  5431. };
  5432. // Gets the left position (from offsetParent left) of the element at the given index
  5433. CoordCache.prototype.getLeftPosition = function (leftIndex) {
  5434. this.ensureBuilt();
  5435. return this.lefts[leftIndex] - this.origin.left;
  5436. };
  5437. // Gets the right offset (from document left) of the element at the given index.
  5438. // This value is NOT relative to the document's right edge, like the CSS concept of "right" would be.
  5439. CoordCache.prototype.getRightOffset = function (leftIndex) {
  5440. this.ensureBuilt();
  5441. return this.rights[leftIndex];
  5442. };
  5443. // Gets the right position (from offsetParent left) of the element at the given index.
  5444. // This value is NOT relative to the offsetParent's right edge, like the CSS concept of "right" would be.
  5445. CoordCache.prototype.getRightPosition = function (leftIndex) {
  5446. this.ensureBuilt();
  5447. return this.rights[leftIndex] - this.origin.left;
  5448. };
  5449. // Gets the width of the element at the given index
  5450. CoordCache.prototype.getWidth = function (leftIndex) {
  5451. this.ensureBuilt();
  5452. return this.rights[leftIndex] - this.lefts[leftIndex];
  5453. };
  5454. // Gets the top offset (from document top) of the element at the given index
  5455. CoordCache.prototype.getTopOffset = function (topIndex) {
  5456. this.ensureBuilt();
  5457. return this.tops[topIndex];
  5458. };
  5459. // Gets the top position (from offsetParent top) of the element at the given position
  5460. CoordCache.prototype.getTopPosition = function (topIndex) {
  5461. this.ensureBuilt();
  5462. return this.tops[topIndex] - this.origin.top;
  5463. };
  5464. // Gets the bottom offset (from the document top) of the element at the given index.
  5465. // This value is NOT relative to the offsetParent's bottom edge, like the CSS concept of "bottom" would be.
  5466. CoordCache.prototype.getBottomOffset = function (topIndex) {
  5467. this.ensureBuilt();
  5468. return this.bottoms[topIndex];
  5469. };
  5470. // Gets the bottom position (from the offsetParent top) of the element at the given index.
  5471. // This value is NOT relative to the offsetParent's bottom edge, like the CSS concept of "bottom" would be.
  5472. CoordCache.prototype.getBottomPosition = function (topIndex) {
  5473. this.ensureBuilt();
  5474. return this.bottoms[topIndex] - this.origin.top;
  5475. };
  5476. // Gets the height of the element at the given index
  5477. CoordCache.prototype.getHeight = function (topIndex) {
  5478. this.ensureBuilt();
  5479. return this.bottoms[topIndex] - this.tops[topIndex];
  5480. };
  5481. // Bounding Rect
  5482. // TODO: decouple this from CoordCache
  5483. // Compute and return what the elements' bounding rectangle is, from the user's perspective.
  5484. // Right now, only returns a rectangle if constrained by an overflow:scroll element.
  5485. // Returns null if there are no elements
  5486. CoordCache.prototype.queryBoundingRect = function () {
  5487. var scrollParentEl;
  5488. if (this.els.length > 0) {
  5489. scrollParentEl = util_1.getScrollParent(this.els.eq(0));
  5490. if (!scrollParentEl.is(document)) {
  5491. return util_1.getClientRect(scrollParentEl);
  5492. }
  5493. }
  5494. return null;
  5495. };
  5496. CoordCache.prototype.isPointInBounds = function (leftOffset, topOffset) {
  5497. return this.isLeftInBounds(leftOffset) && this.isTopInBounds(topOffset);
  5498. };
  5499. CoordCache.prototype.isLeftInBounds = function (leftOffset) {
  5500. return !this.boundingRect || (leftOffset >= this.boundingRect.left && leftOffset < this.boundingRect.right);
  5501. };
  5502. CoordCache.prototype.isTopInBounds = function (topOffset) {
  5503. return !this.boundingRect || (topOffset >= this.boundingRect.top && topOffset < this.boundingRect.bottom);
  5504. };
  5505. return CoordCache;
  5506. }());
  5507. exports.default = CoordCache;
  5508. /***/ }),
  5509. /* 54 */
  5510. /***/ (function(module, exports, __webpack_require__) {
  5511. Object.defineProperty(exports, "__esModule", { value: true });
  5512. var $ = __webpack_require__(3);
  5513. var util_1 = __webpack_require__(4);
  5514. var ListenerMixin_1 = __webpack_require__(7);
  5515. var GlobalEmitter_1 = __webpack_require__(20);
  5516. /* Tracks a drag's mouse movement, firing various handlers
  5517. ----------------------------------------------------------------------------------------------------------------------*/
  5518. // TODO: use Emitter
  5519. var DragListener = /** @class */ (function () {
  5520. function DragListener(options) {
  5521. this.isInteracting = false;
  5522. this.isDistanceSurpassed = false;
  5523. this.isDelayEnded = false;
  5524. this.isDragging = false;
  5525. this.isTouch = false;
  5526. this.isGeneric = false; // initiated by 'dragstart' (jqui)
  5527. this.shouldCancelTouchScroll = true;
  5528. this.scrollAlwaysKills = false;
  5529. this.isAutoScroll = false;
  5530. // defaults
  5531. this.scrollSensitivity = 30; // pixels from edge for scrolling to start
  5532. this.scrollSpeed = 200; // pixels per second, at maximum speed
  5533. this.scrollIntervalMs = 50; // millisecond wait between scroll increment
  5534. this.options = options || {};
  5535. }
  5536. // Interaction (high-level)
  5537. // -----------------------------------------------------------------------------------------------------------------
  5538. DragListener.prototype.startInteraction = function (ev, extraOptions) {
  5539. if (extraOptions === void 0) { extraOptions = {}; }
  5540. if (ev.type === 'mousedown') {
  5541. if (GlobalEmitter_1.default.get().shouldIgnoreMouse()) {
  5542. return;
  5543. }
  5544. else if (!util_1.isPrimaryMouseButton(ev)) {
  5545. return;
  5546. }
  5547. else {
  5548. ev.preventDefault(); // prevents native selection in most browsers
  5549. }
  5550. }
  5551. if (!this.isInteracting) {
  5552. // process options
  5553. this.delay = util_1.firstDefined(extraOptions.delay, this.options.delay, 0);
  5554. this.minDistance = util_1.firstDefined(extraOptions.distance, this.options.distance, 0);
  5555. this.subjectEl = this.options.subjectEl;
  5556. util_1.preventSelection($('body'));
  5557. this.isInteracting = true;
  5558. this.isTouch = util_1.getEvIsTouch(ev);
  5559. this.isGeneric = ev.type === 'dragstart';
  5560. this.isDelayEnded = false;
  5561. this.isDistanceSurpassed = false;
  5562. this.originX = util_1.getEvX(ev);
  5563. this.originY = util_1.getEvY(ev);
  5564. this.scrollEl = util_1.getScrollParent($(ev.target));
  5565. this.bindHandlers();
  5566. this.initAutoScroll();
  5567. this.handleInteractionStart(ev);
  5568. this.startDelay(ev);
  5569. if (!this.minDistance) {
  5570. this.handleDistanceSurpassed(ev);
  5571. }
  5572. }
  5573. };
  5574. DragListener.prototype.handleInteractionStart = function (ev) {
  5575. this.trigger('interactionStart', ev);
  5576. };
  5577. DragListener.prototype.endInteraction = function (ev, isCancelled) {
  5578. if (this.isInteracting) {
  5579. this.endDrag(ev);
  5580. if (this.delayTimeoutId) {
  5581. clearTimeout(this.delayTimeoutId);
  5582. this.delayTimeoutId = null;
  5583. }
  5584. this.destroyAutoScroll();
  5585. this.unbindHandlers();
  5586. this.isInteracting = false;
  5587. this.handleInteractionEnd(ev, isCancelled);
  5588. util_1.allowSelection($('body'));
  5589. }
  5590. };
  5591. DragListener.prototype.handleInteractionEnd = function (ev, isCancelled) {
  5592. this.trigger('interactionEnd', ev, isCancelled || false);
  5593. };
  5594. // Binding To DOM
  5595. // -----------------------------------------------------------------------------------------------------------------
  5596. DragListener.prototype.bindHandlers = function () {
  5597. // some browsers (Safari in iOS 10) don't allow preventDefault on touch events that are bound after touchstart,
  5598. // so listen to the GlobalEmitter singleton, which is always bound, instead of the document directly.
  5599. var globalEmitter = GlobalEmitter_1.default.get();
  5600. if (this.isGeneric) {
  5601. this.listenTo($(document), {
  5602. drag: this.handleMove,
  5603. dragstop: this.endInteraction
  5604. });
  5605. }
  5606. else if (this.isTouch) {
  5607. this.listenTo(globalEmitter, {
  5608. touchmove: this.handleTouchMove,
  5609. touchend: this.endInteraction,
  5610. scroll: this.handleTouchScroll
  5611. });
  5612. }
  5613. else {
  5614. this.listenTo(globalEmitter, {
  5615. mousemove: this.handleMouseMove,
  5616. mouseup: this.endInteraction
  5617. });
  5618. }
  5619. this.listenTo(globalEmitter, {
  5620. selectstart: util_1.preventDefault,
  5621. contextmenu: util_1.preventDefault // long taps would open menu on Chrome dev tools
  5622. });
  5623. };
  5624. DragListener.prototype.unbindHandlers = function () {
  5625. this.stopListeningTo(GlobalEmitter_1.default.get());
  5626. this.stopListeningTo($(document)); // for isGeneric
  5627. };
  5628. // Drag (high-level)
  5629. // -----------------------------------------------------------------------------------------------------------------
  5630. // extraOptions ignored if drag already started
  5631. DragListener.prototype.startDrag = function (ev, extraOptions) {
  5632. this.startInteraction(ev, extraOptions); // ensure interaction began
  5633. if (!this.isDragging) {
  5634. this.isDragging = true;
  5635. this.handleDragStart(ev);
  5636. }
  5637. };
  5638. DragListener.prototype.handleDragStart = function (ev) {
  5639. this.trigger('dragStart', ev);
  5640. };
  5641. DragListener.prototype.handleMove = function (ev) {
  5642. var dx = util_1.getEvX(ev) - this.originX;
  5643. var dy = util_1.getEvY(ev) - this.originY;
  5644. var minDistance = this.minDistance;
  5645. var distanceSq; // current distance from the origin, squared
  5646. if (!this.isDistanceSurpassed) {
  5647. distanceSq = dx * dx + dy * dy;
  5648. if (distanceSq >= minDistance * minDistance) {
  5649. this.handleDistanceSurpassed(ev);
  5650. }
  5651. }
  5652. if (this.isDragging) {
  5653. this.handleDrag(dx, dy, ev);
  5654. }
  5655. };
  5656. // Called while the mouse is being moved and when we know a legitimate drag is taking place
  5657. DragListener.prototype.handleDrag = function (dx, dy, ev) {
  5658. this.trigger('drag', dx, dy, ev);
  5659. this.updateAutoScroll(ev); // will possibly cause scrolling
  5660. };
  5661. DragListener.prototype.endDrag = function (ev) {
  5662. if (this.isDragging) {
  5663. this.isDragging = false;
  5664. this.handleDragEnd(ev);
  5665. }
  5666. };
  5667. DragListener.prototype.handleDragEnd = function (ev) {
  5668. this.trigger('dragEnd', ev);
  5669. };
  5670. // Delay
  5671. // -----------------------------------------------------------------------------------------------------------------
  5672. DragListener.prototype.startDelay = function (initialEv) {
  5673. var _this = this;
  5674. if (this.delay) {
  5675. this.delayTimeoutId = setTimeout(function () {
  5676. _this.handleDelayEnd(initialEv);
  5677. }, this.delay);
  5678. }
  5679. else {
  5680. this.handleDelayEnd(initialEv);
  5681. }
  5682. };
  5683. DragListener.prototype.handleDelayEnd = function (initialEv) {
  5684. this.isDelayEnded = true;
  5685. if (this.isDistanceSurpassed) {
  5686. this.startDrag(initialEv);
  5687. }
  5688. };
  5689. // Distance
  5690. // -----------------------------------------------------------------------------------------------------------------
  5691. DragListener.prototype.handleDistanceSurpassed = function (ev) {
  5692. this.isDistanceSurpassed = true;
  5693. if (this.isDelayEnded) {
  5694. this.startDrag(ev);
  5695. }
  5696. };
  5697. // Mouse / Touch
  5698. // -----------------------------------------------------------------------------------------------------------------
  5699. DragListener.prototype.handleTouchMove = function (ev) {
  5700. // prevent inertia and touchmove-scrolling while dragging
  5701. if (this.isDragging && this.shouldCancelTouchScroll) {
  5702. ev.preventDefault();
  5703. }
  5704. this.handleMove(ev);
  5705. };
  5706. DragListener.prototype.handleMouseMove = function (ev) {
  5707. this.handleMove(ev);
  5708. };
  5709. // Scrolling (unrelated to auto-scroll)
  5710. // -----------------------------------------------------------------------------------------------------------------
  5711. DragListener.prototype.handleTouchScroll = function (ev) {
  5712. // if the drag is being initiated by touch, but a scroll happens before
  5713. // the drag-initiating delay is over, cancel the drag
  5714. if (!this.isDragging || this.scrollAlwaysKills) {
  5715. this.endInteraction(ev, true); // isCancelled=true
  5716. }
  5717. };
  5718. // Utils
  5719. // -----------------------------------------------------------------------------------------------------------------
  5720. // Triggers a callback. Calls a function in the option hash of the same name.
  5721. // Arguments beyond the first `name` are forwarded on.
  5722. DragListener.prototype.trigger = function (name) {
  5723. var args = [];
  5724. for (var _i = 1; _i < arguments.length; _i++) {
  5725. args[_i - 1] = arguments[_i];
  5726. }
  5727. if (this.options[name]) {
  5728. this.options[name].apply(this, args);
  5729. }
  5730. // makes _methods callable by event name. TODO: kill this
  5731. if (this['_' + name]) {
  5732. this['_' + name].apply(this, args);
  5733. }
  5734. };
  5735. // Auto-scroll
  5736. // -----------------------------------------------------------------------------------------------------------------
  5737. DragListener.prototype.initAutoScroll = function () {
  5738. var scrollEl = this.scrollEl;
  5739. this.isAutoScroll =
  5740. this.options.scroll &&
  5741. scrollEl &&
  5742. !scrollEl.is(window) &&
  5743. !scrollEl.is(document);
  5744. if (this.isAutoScroll) {
  5745. // debounce makes sure rapid calls don't happen
  5746. this.listenTo(scrollEl, 'scroll', util_1.debounce(this.handleDebouncedScroll, 100));
  5747. }
  5748. };
  5749. DragListener.prototype.destroyAutoScroll = function () {
  5750. this.endAutoScroll(); // kill any animation loop
  5751. // remove the scroll handler if there is a scrollEl
  5752. if (this.isAutoScroll) {
  5753. this.stopListeningTo(this.scrollEl, 'scroll'); // will probably get removed by unbindHandlers too :(
  5754. }
  5755. };
  5756. // Computes and stores the bounding rectangle of scrollEl
  5757. DragListener.prototype.computeScrollBounds = function () {
  5758. if (this.isAutoScroll) {
  5759. this.scrollBounds = util_1.getOuterRect(this.scrollEl);
  5760. // TODO: use getClientRect in future. but prevents auto scrolling when on top of scrollbars
  5761. }
  5762. };
  5763. // Called when the dragging is in progress and scrolling should be updated
  5764. DragListener.prototype.updateAutoScroll = function (ev) {
  5765. var sensitivity = this.scrollSensitivity;
  5766. var bounds = this.scrollBounds;
  5767. var topCloseness;
  5768. var bottomCloseness;
  5769. var leftCloseness;
  5770. var rightCloseness;
  5771. var topVel = 0;
  5772. var leftVel = 0;
  5773. if (bounds) {
  5774. // compute closeness to edges. valid range is from 0.0 - 1.0
  5775. topCloseness = (sensitivity - (util_1.getEvY(ev) - bounds.top)) / sensitivity;
  5776. bottomCloseness = (sensitivity - (bounds.bottom - util_1.getEvY(ev))) / sensitivity;
  5777. leftCloseness = (sensitivity - (util_1.getEvX(ev) - bounds.left)) / sensitivity;
  5778. rightCloseness = (sensitivity - (bounds.right - util_1.getEvX(ev))) / sensitivity;
  5779. // translate vertical closeness into velocity.
  5780. // mouse must be completely in bounds for velocity to happen.
  5781. if (topCloseness >= 0 && topCloseness <= 1) {
  5782. topVel = topCloseness * this.scrollSpeed * -1; // negative. for scrolling up
  5783. }
  5784. else if (bottomCloseness >= 0 && bottomCloseness <= 1) {
  5785. topVel = bottomCloseness * this.scrollSpeed;
  5786. }
  5787. // translate horizontal closeness into velocity
  5788. if (leftCloseness >= 0 && leftCloseness <= 1) {
  5789. leftVel = leftCloseness * this.scrollSpeed * -1; // negative. for scrolling left
  5790. }
  5791. else if (rightCloseness >= 0 && rightCloseness <= 1) {
  5792. leftVel = rightCloseness * this.scrollSpeed;
  5793. }
  5794. }
  5795. this.setScrollVel(topVel, leftVel);
  5796. };
  5797. // Sets the speed-of-scrolling for the scrollEl
  5798. DragListener.prototype.setScrollVel = function (topVel, leftVel) {
  5799. this.scrollTopVel = topVel;
  5800. this.scrollLeftVel = leftVel;
  5801. this.constrainScrollVel(); // massages into realistic values
  5802. // if there is non-zero velocity, and an animation loop hasn't already started, then START
  5803. if ((this.scrollTopVel || this.scrollLeftVel) && !this.scrollIntervalId) {
  5804. this.scrollIntervalId = setInterval(util_1.proxy(this, 'scrollIntervalFunc'), // scope to `this`
  5805. this.scrollIntervalMs);
  5806. }
  5807. };
  5808. // Forces scrollTopVel and scrollLeftVel to be zero if scrolling has already gone all the way
  5809. DragListener.prototype.constrainScrollVel = function () {
  5810. var el = this.scrollEl;
  5811. if (this.scrollTopVel < 0) {
  5812. if (el.scrollTop() <= 0) {
  5813. this.scrollTopVel = 0;
  5814. }
  5815. }
  5816. else if (this.scrollTopVel > 0) {
  5817. if (el.scrollTop() + el[0].clientHeight >= el[0].scrollHeight) {
  5818. this.scrollTopVel = 0;
  5819. }
  5820. }
  5821. if (this.scrollLeftVel < 0) {
  5822. if (el.scrollLeft() <= 0) {
  5823. this.scrollLeftVel = 0;
  5824. }
  5825. }
  5826. else if (this.scrollLeftVel > 0) {
  5827. if (el.scrollLeft() + el[0].clientWidth >= el[0].scrollWidth) {
  5828. this.scrollLeftVel = 0;
  5829. }
  5830. }
  5831. };
  5832. // This function gets called during every iteration of the scrolling animation loop
  5833. DragListener.prototype.scrollIntervalFunc = function () {
  5834. var el = this.scrollEl;
  5835. var frac = this.scrollIntervalMs / 1000; // considering animation frequency, what the vel should be mult'd by
  5836. // change the value of scrollEl's scroll
  5837. if (this.scrollTopVel) {
  5838. el.scrollTop(el.scrollTop() + this.scrollTopVel * frac);
  5839. }
  5840. if (this.scrollLeftVel) {
  5841. el.scrollLeft(el.scrollLeft() + this.scrollLeftVel * frac);
  5842. }
  5843. this.constrainScrollVel(); // since the scroll values changed, recompute the velocities
  5844. // if scrolled all the way, which causes the vels to be zero, stop the animation loop
  5845. if (!this.scrollTopVel && !this.scrollLeftVel) {
  5846. this.endAutoScroll();
  5847. }
  5848. };
  5849. // Kills any existing scrolling animation loop
  5850. DragListener.prototype.endAutoScroll = function () {
  5851. if (this.scrollIntervalId) {
  5852. clearInterval(this.scrollIntervalId);
  5853. this.scrollIntervalId = null;
  5854. this.handleScrollEnd();
  5855. }
  5856. };
  5857. // Get called when the scrollEl is scrolled (NOTE: this is delayed via debounce)
  5858. DragListener.prototype.handleDebouncedScroll = function () {
  5859. // recompute all coordinates, but *only* if this is *not* part of our scrolling animation
  5860. if (!this.scrollIntervalId) {
  5861. this.handleScrollEnd();
  5862. }
  5863. };
  5864. DragListener.prototype.handleScrollEnd = function () {
  5865. // Called when scrolling has stopped, whether through auto scroll, or the user scrolling
  5866. };
  5867. return DragListener;
  5868. }());
  5869. exports.default = DragListener;
  5870. ListenerMixin_1.default.mixInto(DragListener);
  5871. /***/ }),
  5872. /* 55 */
  5873. /***/ (function(module, exports, __webpack_require__) {
  5874. Object.defineProperty(exports, "__esModule", { value: true });
  5875. var tslib_1 = __webpack_require__(2);
  5876. var util_1 = __webpack_require__(4);
  5877. var Mixin_1 = __webpack_require__(14);
  5878. /*
  5879. A set of rendering and date-related methods for a visual component comprised of one or more rows of day columns.
  5880. Prerequisite: the object being mixed into needs to be a *Grid*
  5881. */
  5882. var DayTableMixin = /** @class */ (function (_super) {
  5883. tslib_1.__extends(DayTableMixin, _super);
  5884. function DayTableMixin() {
  5885. return _super !== null && _super.apply(this, arguments) || this;
  5886. }
  5887. // Populates internal variables used for date calculation and rendering
  5888. DayTableMixin.prototype.updateDayTable = function () {
  5889. var t = this;
  5890. var view = t.view;
  5891. var calendar = view.calendar;
  5892. var date = calendar.msToUtcMoment(t.dateProfile.renderUnzonedRange.startMs, true);
  5893. var end = calendar.msToUtcMoment(t.dateProfile.renderUnzonedRange.endMs, true);
  5894. var dayIndex = -1;
  5895. var dayIndices = [];
  5896. var dayDates = [];
  5897. var daysPerRow;
  5898. var firstDay;
  5899. var rowCnt;
  5900. while (date.isBefore(end)) {
  5901. if (view.isHiddenDay(date)) {
  5902. dayIndices.push(dayIndex + 0.5); // mark that it's between indices
  5903. }
  5904. else {
  5905. dayIndex++;
  5906. dayIndices.push(dayIndex);
  5907. dayDates.push(date.clone());
  5908. }
  5909. date.add(1, 'days');
  5910. }
  5911. if (this.breakOnWeeks) {
  5912. // count columns until the day-of-week repeats
  5913. firstDay = dayDates[0].day();
  5914. for (daysPerRow = 1; daysPerRow < dayDates.length; daysPerRow++) {
  5915. if (dayDates[daysPerRow].day() === firstDay) {
  5916. break;
  5917. }
  5918. }
  5919. rowCnt = Math.ceil(dayDates.length / daysPerRow);
  5920. }
  5921. else {
  5922. rowCnt = 1;
  5923. daysPerRow = dayDates.length;
  5924. }
  5925. this.dayDates = dayDates;
  5926. this.dayIndices = dayIndices;
  5927. this.daysPerRow = daysPerRow;
  5928. this.rowCnt = rowCnt;
  5929. this.updateDayTableCols();
  5930. };
  5931. // Computes and assigned the colCnt property and updates any options that may be computed from it
  5932. DayTableMixin.prototype.updateDayTableCols = function () {
  5933. this.colCnt = this.computeColCnt();
  5934. this.colHeadFormat =
  5935. this.opt('columnHeaderFormat') ||
  5936. this.opt('columnFormat') || // deprecated
  5937. this.computeColHeadFormat();
  5938. };
  5939. // Determines how many columns there should be in the table
  5940. DayTableMixin.prototype.computeColCnt = function () {
  5941. return this.daysPerRow;
  5942. };
  5943. // Computes the ambiguously-timed moment for the given cell
  5944. DayTableMixin.prototype.getCellDate = function (row, col) {
  5945. return this.dayDates[this.getCellDayIndex(row, col)].clone();
  5946. };
  5947. // Computes the ambiguously-timed date range for the given cell
  5948. DayTableMixin.prototype.getCellRange = function (row, col) {
  5949. var start = this.getCellDate(row, col);
  5950. var end = start.clone().add(1, 'days');
  5951. return { start: start, end: end };
  5952. };
  5953. // Returns the number of day cells, chronologically, from the first of the grid (0-based)
  5954. DayTableMixin.prototype.getCellDayIndex = function (row, col) {
  5955. return row * this.daysPerRow + this.getColDayIndex(col);
  5956. };
  5957. // Returns the numner of day cells, chronologically, from the first cell in *any given row*
  5958. DayTableMixin.prototype.getColDayIndex = function (col) {
  5959. if (this.isRTL) {
  5960. return this.colCnt - 1 - col;
  5961. }
  5962. else {
  5963. return col;
  5964. }
  5965. };
  5966. // Given a date, returns its chronolocial cell-index from the first cell of the grid.
  5967. // If the date lies between cells (because of hiddenDays), returns a floating-point value between offsets.
  5968. // If before the first offset, returns a negative number.
  5969. // If after the last offset, returns an offset past the last cell offset.
  5970. // Only works for *start* dates of cells. Will not work for exclusive end dates for cells.
  5971. DayTableMixin.prototype.getDateDayIndex = function (date) {
  5972. var dayIndices = this.dayIndices;
  5973. var dayOffset = date.diff(this.dayDates[0], 'days');
  5974. if (dayOffset < 0) {
  5975. return dayIndices[0] - 1;
  5976. }
  5977. else if (dayOffset >= dayIndices.length) {
  5978. return dayIndices[dayIndices.length - 1] + 1;
  5979. }
  5980. else {
  5981. return dayIndices[dayOffset];
  5982. }
  5983. };
  5984. /* Options
  5985. ------------------------------------------------------------------------------------------------------------------*/
  5986. // Computes a default column header formatting string if `colFormat` is not explicitly defined
  5987. DayTableMixin.prototype.computeColHeadFormat = function () {
  5988. // if more than one week row, or if there are a lot of columns with not much space,
  5989. // put just the day numbers will be in each cell
  5990. if (this.rowCnt > 1 || this.colCnt > 10) {
  5991. return 'ddd'; // "Sat"
  5992. }
  5993. else if (this.colCnt > 1) {
  5994. return this.opt('dayOfMonthFormat'); // "Sat 12/10"
  5995. }
  5996. else {
  5997. return 'dddd'; // "Saturday"
  5998. }
  5999. };
  6000. /* Slicing
  6001. ------------------------------------------------------------------------------------------------------------------*/
  6002. // Slices up a date range into a segment for every week-row it intersects with
  6003. DayTableMixin.prototype.sliceRangeByRow = function (unzonedRange) {
  6004. var daysPerRow = this.daysPerRow;
  6005. var normalRange = this.view.computeDayRange(unzonedRange); // make whole-day range, considering nextDayThreshold
  6006. var rangeFirst = this.getDateDayIndex(normalRange.start); // inclusive first index
  6007. var rangeLast = this.getDateDayIndex(normalRange.end.clone().subtract(1, 'days')); // inclusive last index
  6008. var segs = [];
  6009. var row;
  6010. var rowFirst;
  6011. var rowLast; // inclusive day-index range for current row
  6012. var segFirst;
  6013. var segLast; // inclusive day-index range for segment
  6014. for (row = 0; row < this.rowCnt; row++) {
  6015. rowFirst = row * daysPerRow;
  6016. rowLast = rowFirst + daysPerRow - 1;
  6017. // intersect segment's offset range with the row's
  6018. segFirst = Math.max(rangeFirst, rowFirst);
  6019. segLast = Math.min(rangeLast, rowLast);
  6020. // deal with in-between indices
  6021. segFirst = Math.ceil(segFirst); // in-between starts round to next cell
  6022. segLast = Math.floor(segLast); // in-between ends round to prev cell
  6023. if (segFirst <= segLast) {
  6024. segs.push({
  6025. row: row,
  6026. // normalize to start of row
  6027. firstRowDayIndex: segFirst - rowFirst,
  6028. lastRowDayIndex: segLast - rowFirst,
  6029. // must be matching integers to be the segment's start/end
  6030. isStart: segFirst === rangeFirst,
  6031. isEnd: segLast === rangeLast
  6032. });
  6033. }
  6034. }
  6035. return segs;
  6036. };
  6037. // Slices up a date range into a segment for every day-cell it intersects with.
  6038. // TODO: make more DRY with sliceRangeByRow somehow.
  6039. DayTableMixin.prototype.sliceRangeByDay = function (unzonedRange) {
  6040. var daysPerRow = this.daysPerRow;
  6041. var normalRange = this.view.computeDayRange(unzonedRange); // make whole-day range, considering nextDayThreshold
  6042. var rangeFirst = this.getDateDayIndex(normalRange.start); // inclusive first index
  6043. var rangeLast = this.getDateDayIndex(normalRange.end.clone().subtract(1, 'days')); // inclusive last index
  6044. var segs = [];
  6045. var row;
  6046. var rowFirst;
  6047. var rowLast; // inclusive day-index range for current row
  6048. var i;
  6049. var segFirst;
  6050. var segLast; // inclusive day-index range for segment
  6051. for (row = 0; row < this.rowCnt; row++) {
  6052. rowFirst = row * daysPerRow;
  6053. rowLast = rowFirst + daysPerRow - 1;
  6054. for (i = rowFirst; i <= rowLast; i++) {
  6055. // intersect segment's offset range with the row's
  6056. segFirst = Math.max(rangeFirst, i);
  6057. segLast = Math.min(rangeLast, i);
  6058. // deal with in-between indices
  6059. segFirst = Math.ceil(segFirst); // in-between starts round to next cell
  6060. segLast = Math.floor(segLast); // in-between ends round to prev cell
  6061. if (segFirst <= segLast) {
  6062. segs.push({
  6063. row: row,
  6064. // normalize to start of row
  6065. firstRowDayIndex: segFirst - rowFirst,
  6066. lastRowDayIndex: segLast - rowFirst,
  6067. // must be matching integers to be the segment's start/end
  6068. isStart: segFirst === rangeFirst,
  6069. isEnd: segLast === rangeLast
  6070. });
  6071. }
  6072. }
  6073. }
  6074. return segs;
  6075. };
  6076. /* Header Rendering
  6077. ------------------------------------------------------------------------------------------------------------------*/
  6078. DayTableMixin.prototype.renderHeadHtml = function () {
  6079. var theme = this.view.calendar.theme;
  6080. return '' +
  6081. '<div class="fc-row ' + theme.getClass('headerRow') + '">' +
  6082. '<table class="' + theme.getClass('tableGrid') + '">' +
  6083. '<thead>' +
  6084. this.renderHeadTrHtml() +
  6085. '</thead>' +
  6086. '</table>' +
  6087. '</div>';
  6088. };
  6089. DayTableMixin.prototype.renderHeadIntroHtml = function () {
  6090. return this.renderIntroHtml(); // fall back to generic
  6091. };
  6092. DayTableMixin.prototype.renderHeadTrHtml = function () {
  6093. return '' +
  6094. '<tr>' +
  6095. (this.isRTL ? '' : this.renderHeadIntroHtml()) +
  6096. this.renderHeadDateCellsHtml() +
  6097. (this.isRTL ? this.renderHeadIntroHtml() : '') +
  6098. '</tr>';
  6099. };
  6100. DayTableMixin.prototype.renderHeadDateCellsHtml = function () {
  6101. var htmls = [];
  6102. var col;
  6103. var date;
  6104. for (col = 0; col < this.colCnt; col++) {
  6105. date = this.getCellDate(0, col);
  6106. htmls.push(this.renderHeadDateCellHtml(date));
  6107. }
  6108. return htmls.join('');
  6109. };
  6110. // TODO: when internalApiVersion, accept an object for HTML attributes
  6111. // (colspan should be no different)
  6112. DayTableMixin.prototype.renderHeadDateCellHtml = function (date, colspan, otherAttrs) {
  6113. var t = this;
  6114. var view = t.view;
  6115. var isDateValid = t.dateProfile.activeUnzonedRange.containsDate(date); // TODO: called too frequently. cache somehow.
  6116. var classNames = [
  6117. 'fc-day-header',
  6118. view.calendar.theme.getClass('widgetHeader')
  6119. ];
  6120. var innerHtml;
  6121. if (typeof t.opt('columnHeaderHtml') === 'function') {
  6122. innerHtml = t.opt('columnHeaderHtml')(date);
  6123. }
  6124. else if (typeof t.opt('columnHeaderText') === 'function') {
  6125. innerHtml = util_1.htmlEscape(t.opt('columnHeaderText')(date));
  6126. }
  6127. else {
  6128. innerHtml = util_1.htmlEscape(date.format(t.colHeadFormat));
  6129. }
  6130. // if only one row of days, the classNames on the header can represent the specific days beneath
  6131. if (t.rowCnt === 1) {
  6132. classNames = classNames.concat(
  6133. // includes the day-of-week class
  6134. // noThemeHighlight=true (don't highlight the header)
  6135. t.getDayClasses(date, true));
  6136. }
  6137. else {
  6138. classNames.push('fc-' + util_1.dayIDs[date.day()]); // only add the day-of-week class
  6139. }
  6140. return '' +
  6141. '<th class="' + classNames.join(' ') + '"' +
  6142. ((isDateValid && t.rowCnt) === 1 ?
  6143. ' data-date="' + date.format('YYYY-MM-DD') + '"' :
  6144. '') +
  6145. (colspan > 1 ?
  6146. ' colspan="' + colspan + '"' :
  6147. '') +
  6148. (otherAttrs ?
  6149. ' ' + otherAttrs :
  6150. '') +
  6151. '>' +
  6152. (isDateValid ?
  6153. // don't make a link if the heading could represent multiple days, or if there's only one day (forceOff)
  6154. view.buildGotoAnchorHtml({ date: date, forceOff: t.rowCnt > 1 || t.colCnt === 1 }, innerHtml) :
  6155. // if not valid, display text, but no link
  6156. innerHtml) +
  6157. '</th>';
  6158. };
  6159. /* Background Rendering
  6160. ------------------------------------------------------------------------------------------------------------------*/
  6161. DayTableMixin.prototype.renderBgTrHtml = function (row) {
  6162. return '' +
  6163. '<tr>' +
  6164. (this.isRTL ? '' : this.renderBgIntroHtml(row)) +
  6165. this.renderBgCellsHtml(row) +
  6166. (this.isRTL ? this.renderBgIntroHtml(row) : '') +
  6167. '</tr>';
  6168. };
  6169. DayTableMixin.prototype.renderBgIntroHtml = function (row) {
  6170. return this.renderIntroHtml(); // fall back to generic
  6171. };
  6172. DayTableMixin.prototype.renderBgCellsHtml = function (row) {
  6173. var htmls = [];
  6174. var col;
  6175. var date;
  6176. for (col = 0; col < this.colCnt; col++) {
  6177. date = this.getCellDate(row, col);
  6178. htmls.push(this.renderBgCellHtml(date));
  6179. }
  6180. return htmls.join('');
  6181. };
  6182. DayTableMixin.prototype.renderBgCellHtml = function (date, otherAttrs) {
  6183. var t = this;
  6184. var view = t.view;
  6185. var isDateValid = t.dateProfile.activeUnzonedRange.containsDate(date); // TODO: called too frequently. cache somehow.
  6186. var classes = t.getDayClasses(date);
  6187. classes.unshift('fc-day', view.calendar.theme.getClass('widgetContent'));
  6188. return '<td class="' + classes.join(' ') + '"' +
  6189. (isDateValid ?
  6190. ' data-date="' + date.format('YYYY-MM-DD') + '"' : // if date has a time, won't format it
  6191. '') +
  6192. (otherAttrs ?
  6193. ' ' + otherAttrs :
  6194. '') +
  6195. '></td>';
  6196. };
  6197. /* Generic
  6198. ------------------------------------------------------------------------------------------------------------------*/
  6199. DayTableMixin.prototype.renderIntroHtml = function () {
  6200. // Generates the default HTML intro for any row. User classes should override
  6201. };
  6202. // TODO: a generic method for dealing with <tr>, RTL, intro
  6203. // when increment internalApiVersion
  6204. // wrapTr (scheduler)
  6205. /* Utils
  6206. ------------------------------------------------------------------------------------------------------------------*/
  6207. // Applies the generic "intro" and "outro" HTML to the given cells.
  6208. // Intro means the leftmost cell when the calendar is LTR and the rightmost cell when RTL. Vice-versa for outro.
  6209. DayTableMixin.prototype.bookendCells = function (trEl) {
  6210. var introHtml = this.renderIntroHtml();
  6211. if (introHtml) {
  6212. if (this.isRTL) {
  6213. trEl.append(introHtml);
  6214. }
  6215. else {
  6216. trEl.prepend(introHtml);
  6217. }
  6218. }
  6219. };
  6220. return DayTableMixin;
  6221. }(Mixin_1.default));
  6222. exports.default = DayTableMixin;
  6223. /***/ }),
  6224. /* 56 */
  6225. /***/ (function(module, exports) {
  6226. Object.defineProperty(exports, "__esModule", { value: true });
  6227. var BusinessHourRenderer = /** @class */ (function () {
  6228. /*
  6229. component implements:
  6230. - eventRangesToEventFootprints
  6231. - eventFootprintsToSegs
  6232. */
  6233. function BusinessHourRenderer(component, fillRenderer) {
  6234. this.component = component;
  6235. this.fillRenderer = fillRenderer;
  6236. }
  6237. BusinessHourRenderer.prototype.render = function (businessHourGenerator) {
  6238. var component = this.component;
  6239. var unzonedRange = component._getDateProfile().activeUnzonedRange;
  6240. var eventInstanceGroup = businessHourGenerator.buildEventInstanceGroup(component.hasAllDayBusinessHours, unzonedRange);
  6241. var eventFootprints = eventInstanceGroup ?
  6242. component.eventRangesToEventFootprints(eventInstanceGroup.sliceRenderRanges(unzonedRange)) :
  6243. [];
  6244. this.renderEventFootprints(eventFootprints);
  6245. };
  6246. BusinessHourRenderer.prototype.renderEventFootprints = function (eventFootprints) {
  6247. var segs = this.component.eventFootprintsToSegs(eventFootprints);
  6248. this.renderSegs(segs);
  6249. this.segs = segs;
  6250. };
  6251. BusinessHourRenderer.prototype.renderSegs = function (segs) {
  6252. if (this.fillRenderer) {
  6253. this.fillRenderer.renderSegs('businessHours', segs, {
  6254. getClasses: function (seg) {
  6255. return ['fc-nonbusiness', 'fc-bgevent'];
  6256. }
  6257. });
  6258. }
  6259. };
  6260. BusinessHourRenderer.prototype.unrender = function () {
  6261. if (this.fillRenderer) {
  6262. this.fillRenderer.unrender('businessHours');
  6263. }
  6264. this.segs = null;
  6265. };
  6266. BusinessHourRenderer.prototype.getSegs = function () {
  6267. return this.segs || [];
  6268. };
  6269. return BusinessHourRenderer;
  6270. }());
  6271. exports.default = BusinessHourRenderer;
  6272. /***/ }),
  6273. /* 57 */
  6274. /***/ (function(module, exports, __webpack_require__) {
  6275. Object.defineProperty(exports, "__esModule", { value: true });
  6276. var $ = __webpack_require__(3);
  6277. var util_1 = __webpack_require__(4);
  6278. var FillRenderer = /** @class */ (function () {
  6279. function FillRenderer(component) {
  6280. this.fillSegTag = 'div';
  6281. this.component = component;
  6282. this.elsByFill = {};
  6283. }
  6284. FillRenderer.prototype.renderFootprint = function (type, componentFootprint, props) {
  6285. this.renderSegs(type, this.component.componentFootprintToSegs(componentFootprint), props);
  6286. };
  6287. FillRenderer.prototype.renderSegs = function (type, segs, props) {
  6288. var els;
  6289. segs = this.buildSegEls(type, segs, props); // assignes `.el` to each seg. returns successfully rendered segs
  6290. els = this.attachSegEls(type, segs);
  6291. if (els) {
  6292. this.reportEls(type, els);
  6293. }
  6294. return segs;
  6295. };
  6296. // Unrenders a specific type of fill that is currently rendered on the grid
  6297. FillRenderer.prototype.unrender = function (type) {
  6298. var el = this.elsByFill[type];
  6299. if (el) {
  6300. el.remove();
  6301. delete this.elsByFill[type];
  6302. }
  6303. };
  6304. // Renders and assigns an `el` property for each fill segment. Generic enough to work with different types.
  6305. // Only returns segments that successfully rendered.
  6306. FillRenderer.prototype.buildSegEls = function (type, segs, props) {
  6307. var _this = this;
  6308. var html = '';
  6309. var renderedSegs = [];
  6310. var i;
  6311. if (segs.length) {
  6312. // build a large concatenation of segment HTML
  6313. for (i = 0; i < segs.length; i++) {
  6314. html += this.buildSegHtml(type, segs[i], props);
  6315. }
  6316. // Grab individual elements from the combined HTML string. Use each as the default rendering.
  6317. // Then, compute the 'el' for each segment.
  6318. $(html).each(function (i, node) {
  6319. var seg = segs[i];
  6320. var el = $(node);
  6321. // allow custom filter methods per-type
  6322. if (props.filterEl) {
  6323. el = props.filterEl(seg, el);
  6324. }
  6325. if (el) {
  6326. el = $(el); // allow custom filter to return raw DOM node
  6327. // correct element type? (would be bad if a non-TD were inserted into a table for example)
  6328. if (el.is(_this.fillSegTag)) {
  6329. seg.el = el;
  6330. renderedSegs.push(seg);
  6331. }
  6332. }
  6333. });
  6334. }
  6335. return renderedSegs;
  6336. };
  6337. // Builds the HTML needed for one fill segment. Generic enough to work with different types.
  6338. FillRenderer.prototype.buildSegHtml = function (type, seg, props) {
  6339. // custom hooks per-type
  6340. var classes = props.getClasses ? props.getClasses(seg) : [];
  6341. var css = util_1.cssToStr(props.getCss ? props.getCss(seg) : {});
  6342. return '<' + this.fillSegTag +
  6343. (classes.length ? ' class="' + classes.join(' ') + '"' : '') +
  6344. (css ? ' style="' + css + '"' : '') +
  6345. ' />';
  6346. };
  6347. // Should return wrapping DOM structure
  6348. FillRenderer.prototype.attachSegEls = function (type, segs) {
  6349. // subclasses must implement
  6350. };
  6351. FillRenderer.prototype.reportEls = function (type, nodes) {
  6352. if (this.elsByFill[type]) {
  6353. this.elsByFill[type] = this.elsByFill[type].add(nodes);
  6354. }
  6355. else {
  6356. this.elsByFill[type] = $(nodes);
  6357. }
  6358. };
  6359. return FillRenderer;
  6360. }());
  6361. exports.default = FillRenderer;
  6362. /***/ }),
  6363. /* 58 */
  6364. /***/ (function(module, exports, __webpack_require__) {
  6365. Object.defineProperty(exports, "__esModule", { value: true });
  6366. var SingleEventDef_1 = __webpack_require__(13);
  6367. var EventFootprint_1 = __webpack_require__(35);
  6368. var EventSource_1 = __webpack_require__(6);
  6369. var HelperRenderer = /** @class */ (function () {
  6370. function HelperRenderer(component, eventRenderer) {
  6371. this.view = component._getView();
  6372. this.component = component;
  6373. this.eventRenderer = eventRenderer;
  6374. }
  6375. HelperRenderer.prototype.renderComponentFootprint = function (componentFootprint) {
  6376. this.renderEventFootprints([
  6377. this.fabricateEventFootprint(componentFootprint)
  6378. ]);
  6379. };
  6380. HelperRenderer.prototype.renderEventDraggingFootprints = function (eventFootprints, sourceSeg, isTouch) {
  6381. this.renderEventFootprints(eventFootprints, sourceSeg, 'fc-dragging', isTouch ? null : this.view.opt('dragOpacity'));
  6382. };
  6383. HelperRenderer.prototype.renderEventResizingFootprints = function (eventFootprints, sourceSeg, isTouch) {
  6384. this.renderEventFootprints(eventFootprints, sourceSeg, 'fc-resizing');
  6385. };
  6386. HelperRenderer.prototype.renderEventFootprints = function (eventFootprints, sourceSeg, extraClassNames, opacity) {
  6387. var segs = this.component.eventFootprintsToSegs(eventFootprints);
  6388. var classNames = 'fc-helper ' + (extraClassNames || '');
  6389. var i;
  6390. // assigns each seg's el and returns a subset of segs that were rendered
  6391. segs = this.eventRenderer.renderFgSegEls(segs);
  6392. for (i = 0; i < segs.length; i++) {
  6393. segs[i].el.addClass(classNames);
  6394. }
  6395. if (opacity != null) {
  6396. for (i = 0; i < segs.length; i++) {
  6397. segs[i].el.css('opacity', opacity);
  6398. }
  6399. }
  6400. this.helperEls = this.renderSegs(segs, sourceSeg);
  6401. };
  6402. /*
  6403. Must return all mock event elements
  6404. */
  6405. HelperRenderer.prototype.renderSegs = function (segs, sourceSeg) {
  6406. // Subclasses must implement
  6407. };
  6408. HelperRenderer.prototype.unrender = function () {
  6409. if (this.helperEls) {
  6410. this.helperEls.remove();
  6411. this.helperEls = null;
  6412. }
  6413. };
  6414. HelperRenderer.prototype.fabricateEventFootprint = function (componentFootprint) {
  6415. var calendar = this.view.calendar;
  6416. var eventDateProfile = calendar.footprintToDateProfile(componentFootprint);
  6417. var dummyEvent = new SingleEventDef_1.default(new EventSource_1.default(calendar));
  6418. var dummyInstance;
  6419. dummyEvent.dateProfile = eventDateProfile;
  6420. dummyInstance = dummyEvent.buildInstance();
  6421. return new EventFootprint_1.default(componentFootprint, dummyEvent, dummyInstance);
  6422. };
  6423. return HelperRenderer;
  6424. }());
  6425. exports.default = HelperRenderer;
  6426. /***/ }),
  6427. /* 59 */
  6428. /***/ (function(module, exports, __webpack_require__) {
  6429. Object.defineProperty(exports, "__esModule", { value: true });
  6430. var tslib_1 = __webpack_require__(2);
  6431. var GlobalEmitter_1 = __webpack_require__(20);
  6432. var Interaction_1 = __webpack_require__(15);
  6433. var EventPointing = /** @class */ (function (_super) {
  6434. tslib_1.__extends(EventPointing, _super);
  6435. function EventPointing() {
  6436. return _super !== null && _super.apply(this, arguments) || this;
  6437. }
  6438. /*
  6439. component must implement:
  6440. - publiclyTrigger
  6441. */
  6442. EventPointing.prototype.bindToEl = function (el) {
  6443. var component = this.component;
  6444. component.bindSegHandlerToEl(el, 'click', this.handleClick.bind(this));
  6445. component.bindSegHandlerToEl(el, 'mouseenter', this.handleMouseover.bind(this));
  6446. component.bindSegHandlerToEl(el, 'mouseleave', this.handleMouseout.bind(this));
  6447. };
  6448. EventPointing.prototype.handleClick = function (seg, ev) {
  6449. var res = this.component.publiclyTrigger('eventClick', {
  6450. context: seg.el[0],
  6451. args: [seg.footprint.getEventLegacy(), ev, this.view]
  6452. });
  6453. if (res === false) {
  6454. ev.preventDefault();
  6455. }
  6456. };
  6457. // Updates internal state and triggers handlers for when an event element is moused over
  6458. EventPointing.prototype.handleMouseover = function (seg, ev) {
  6459. if (!GlobalEmitter_1.default.get().shouldIgnoreMouse() &&
  6460. !this.mousedOverSeg) {
  6461. this.mousedOverSeg = seg;
  6462. // TODO: move to EventSelecting's responsibility
  6463. if (this.view.isEventDefResizable(seg.footprint.eventDef)) {
  6464. seg.el.addClass('fc-allow-mouse-resize');
  6465. }
  6466. this.component.publiclyTrigger('eventMouseover', {
  6467. context: seg.el[0],
  6468. args: [seg.footprint.getEventLegacy(), ev, this.view]
  6469. });
  6470. }
  6471. };
  6472. // Updates internal state and triggers handlers for when an event element is moused out.
  6473. // Can be given no arguments, in which case it will mouseout the segment that was previously moused over.
  6474. EventPointing.prototype.handleMouseout = function (seg, ev) {
  6475. if (this.mousedOverSeg) {
  6476. this.mousedOverSeg = null;
  6477. // TODO: move to EventSelecting's responsibility
  6478. if (this.view.isEventDefResizable(seg.footprint.eventDef)) {
  6479. seg.el.removeClass('fc-allow-mouse-resize');
  6480. }
  6481. this.component.publiclyTrigger('eventMouseout', {
  6482. context: seg.el[0],
  6483. args: [
  6484. seg.footprint.getEventLegacy(),
  6485. ev || {},
  6486. this.view
  6487. ]
  6488. });
  6489. }
  6490. };
  6491. EventPointing.prototype.end = function () {
  6492. if (this.mousedOverSeg) {
  6493. this.handleMouseout(this.mousedOverSeg);
  6494. }
  6495. };
  6496. return EventPointing;
  6497. }(Interaction_1.default));
  6498. exports.default = EventPointing;
  6499. /***/ }),
  6500. /* 60 */
  6501. /***/ (function(module, exports, __webpack_require__) {
  6502. Object.defineProperty(exports, "__esModule", { value: true });
  6503. var tslib_1 = __webpack_require__(2);
  6504. var Mixin_1 = __webpack_require__(14);
  6505. var DateClicking_1 = __webpack_require__(241);
  6506. var DateSelecting_1 = __webpack_require__(221);
  6507. var EventPointing_1 = __webpack_require__(59);
  6508. var EventDragging_1 = __webpack_require__(220);
  6509. var EventResizing_1 = __webpack_require__(219);
  6510. var ExternalDropping_1 = __webpack_require__(218);
  6511. var StandardInteractionsMixin = /** @class */ (function (_super) {
  6512. tslib_1.__extends(StandardInteractionsMixin, _super);
  6513. function StandardInteractionsMixin() {
  6514. return _super !== null && _super.apply(this, arguments) || this;
  6515. }
  6516. return StandardInteractionsMixin;
  6517. }(Mixin_1.default));
  6518. exports.default = StandardInteractionsMixin;
  6519. StandardInteractionsMixin.prototype.dateClickingClass = DateClicking_1.default;
  6520. StandardInteractionsMixin.prototype.dateSelectingClass = DateSelecting_1.default;
  6521. StandardInteractionsMixin.prototype.eventPointingClass = EventPointing_1.default;
  6522. StandardInteractionsMixin.prototype.eventDraggingClass = EventDragging_1.default;
  6523. StandardInteractionsMixin.prototype.eventResizingClass = EventResizing_1.default;
  6524. StandardInteractionsMixin.prototype.externalDroppingClass = ExternalDropping_1.default;
  6525. /***/ }),
  6526. /* 61 */
  6527. /***/ (function(module, exports, __webpack_require__) {
  6528. Object.defineProperty(exports, "__esModule", { value: true });
  6529. var tslib_1 = __webpack_require__(2);
  6530. var $ = __webpack_require__(3);
  6531. var util_1 = __webpack_require__(4);
  6532. var CoordCache_1 = __webpack_require__(53);
  6533. var Popover_1 = __webpack_require__(245);
  6534. var UnzonedRange_1 = __webpack_require__(5);
  6535. var ComponentFootprint_1 = __webpack_require__(12);
  6536. var EventFootprint_1 = __webpack_require__(35);
  6537. var BusinessHourRenderer_1 = __webpack_require__(56);
  6538. var StandardInteractionsMixin_1 = __webpack_require__(60);
  6539. var InteractiveDateComponent_1 = __webpack_require__(40);
  6540. var DayTableMixin_1 = __webpack_require__(55);
  6541. var DayGridEventRenderer_1 = __webpack_require__(246);
  6542. var DayGridHelperRenderer_1 = __webpack_require__(247);
  6543. var DayGridFillRenderer_1 = __webpack_require__(248);
  6544. /* A component that renders a grid of whole-days that runs horizontally. There can be multiple rows, one per week.
  6545. ----------------------------------------------------------------------------------------------------------------------*/
  6546. var DayGrid = /** @class */ (function (_super) {
  6547. tslib_1.__extends(DayGrid, _super);
  6548. function DayGrid(view) {
  6549. var _this = _super.call(this, view) || this;
  6550. _this.cellWeekNumbersVisible = false; // display week numbers in day cell?
  6551. _this.bottomCoordPadding = 0; // hack for extending the hit area for the last row of the coordinate grid
  6552. // isRigid determines whether the individual rows should ignore the contents and be a constant height.
  6553. // Relies on the view's colCnt and rowCnt. In the future, this component should probably be self-sufficient.
  6554. _this.isRigid = false;
  6555. _this.hasAllDayBusinessHours = true;
  6556. return _this;
  6557. }
  6558. // Slices up the given span (unzoned start/end with other misc data) into an array of segments
  6559. DayGrid.prototype.componentFootprintToSegs = function (componentFootprint) {
  6560. var segs = this.sliceRangeByRow(componentFootprint.unzonedRange);
  6561. var i;
  6562. var seg;
  6563. for (i = 0; i < segs.length; i++) {
  6564. seg = segs[i];
  6565. if (this.isRTL) {
  6566. seg.leftCol = this.daysPerRow - 1 - seg.lastRowDayIndex;
  6567. seg.rightCol = this.daysPerRow - 1 - seg.firstRowDayIndex;
  6568. }
  6569. else {
  6570. seg.leftCol = seg.firstRowDayIndex;
  6571. seg.rightCol = seg.lastRowDayIndex;
  6572. }
  6573. }
  6574. return segs;
  6575. };
  6576. /* Date Rendering
  6577. ------------------------------------------------------------------------------------------------------------------*/
  6578. DayGrid.prototype.renderDates = function (dateProfile) {
  6579. this.dateProfile = dateProfile;
  6580. this.updateDayTable();
  6581. this.renderGrid();
  6582. };
  6583. DayGrid.prototype.unrenderDates = function () {
  6584. this.removeSegPopover();
  6585. };
  6586. // Renders the rows and columns into the component's `this.el`, which should already be assigned.
  6587. DayGrid.prototype.renderGrid = function () {
  6588. var view = this.view;
  6589. var rowCnt = this.rowCnt;
  6590. var colCnt = this.colCnt;
  6591. var html = '';
  6592. var row;
  6593. var col;
  6594. if (this.headContainerEl) {
  6595. this.headContainerEl.html(this.renderHeadHtml());
  6596. }
  6597. for (row = 0; row < rowCnt; row++) {
  6598. html += this.renderDayRowHtml(row, this.isRigid);
  6599. }
  6600. this.el.html(html);
  6601. this.rowEls = this.el.find('.fc-row');
  6602. this.cellEls = this.el.find('.fc-day, .fc-disabled-day');
  6603. this.rowCoordCache = new CoordCache_1.default({
  6604. els: this.rowEls,
  6605. isVertical: true
  6606. });
  6607. this.colCoordCache = new CoordCache_1.default({
  6608. els: this.cellEls.slice(0, this.colCnt),
  6609. isHorizontal: true
  6610. });
  6611. // trigger dayRender with each cell's element
  6612. for (row = 0; row < rowCnt; row++) {
  6613. for (col = 0; col < colCnt; col++) {
  6614. this.publiclyTrigger('dayRender', {
  6615. context: view,
  6616. args: [
  6617. this.getCellDate(row, col),
  6618. this.getCellEl(row, col),
  6619. view
  6620. ]
  6621. });
  6622. }
  6623. }
  6624. };
  6625. // Generates the HTML for a single row, which is a div that wraps a table.
  6626. // `row` is the row number.
  6627. DayGrid.prototype.renderDayRowHtml = function (row, isRigid) {
  6628. var theme = this.view.calendar.theme;
  6629. var classes = ['fc-row', 'fc-week', theme.getClass('dayRow')];
  6630. if (isRigid) {
  6631. classes.push('fc-rigid');
  6632. }
  6633. return '' +
  6634. '<div class="' + classes.join(' ') + '">' +
  6635. '<div class="fc-bg">' +
  6636. '<table class="' + theme.getClass('tableGrid') + '">' +
  6637. this.renderBgTrHtml(row) +
  6638. '</table>' +
  6639. '</div>' +
  6640. '<div class="fc-content-skeleton">' +
  6641. '<table>' +
  6642. (this.getIsNumbersVisible() ?
  6643. '<thead>' +
  6644. this.renderNumberTrHtml(row) +
  6645. '</thead>' :
  6646. '') +
  6647. '</table>' +
  6648. '</div>' +
  6649. '</div>';
  6650. };
  6651. DayGrid.prototype.getIsNumbersVisible = function () {
  6652. return this.getIsDayNumbersVisible() || this.cellWeekNumbersVisible;
  6653. };
  6654. DayGrid.prototype.getIsDayNumbersVisible = function () {
  6655. return this.rowCnt > 1;
  6656. };
  6657. /* Grid Number Rendering
  6658. ------------------------------------------------------------------------------------------------------------------*/
  6659. DayGrid.prototype.renderNumberTrHtml = function (row) {
  6660. return '' +
  6661. '<tr>' +
  6662. (this.isRTL ? '' : this.renderNumberIntroHtml(row)) +
  6663. this.renderNumberCellsHtml(row) +
  6664. (this.isRTL ? this.renderNumberIntroHtml(row) : '') +
  6665. '</tr>';
  6666. };
  6667. DayGrid.prototype.renderNumberIntroHtml = function (row) {
  6668. return this.renderIntroHtml();
  6669. };
  6670. DayGrid.prototype.renderNumberCellsHtml = function (row) {
  6671. var htmls = [];
  6672. var col;
  6673. var date;
  6674. for (col = 0; col < this.colCnt; col++) {
  6675. date = this.getCellDate(row, col);
  6676. htmls.push(this.renderNumberCellHtml(date));
  6677. }
  6678. return htmls.join('');
  6679. };
  6680. // Generates the HTML for the <td>s of the "number" row in the DayGrid's content skeleton.
  6681. // The number row will only exist if either day numbers or week numbers are turned on.
  6682. DayGrid.prototype.renderNumberCellHtml = function (date) {
  6683. var view = this.view;
  6684. var html = '';
  6685. var isDateValid = this.dateProfile.activeUnzonedRange.containsDate(date); // TODO: called too frequently. cache somehow.
  6686. var isDayNumberVisible = this.getIsDayNumbersVisible() && isDateValid;
  6687. var classes;
  6688. var weekCalcFirstDoW;
  6689. if (!isDayNumberVisible && !this.cellWeekNumbersVisible) {
  6690. // no numbers in day cell (week number must be along the side)
  6691. return '<td/>'; // will create an empty space above events :(
  6692. }
  6693. classes = this.getDayClasses(date);
  6694. classes.unshift('fc-day-top');
  6695. if (this.cellWeekNumbersVisible) {
  6696. // To determine the day of week number change under ISO, we cannot
  6697. // rely on moment.js methods such as firstDayOfWeek() or weekday(),
  6698. // because they rely on the locale's dow (possibly overridden by
  6699. // our firstDay option), which may not be Monday. We cannot change
  6700. // dow, because that would affect the calendar start day as well.
  6701. if (date._locale._fullCalendar_weekCalc === 'ISO') {
  6702. weekCalcFirstDoW = 1; // Monday by ISO 8601 definition
  6703. }
  6704. else {
  6705. weekCalcFirstDoW = date._locale.firstDayOfWeek();
  6706. }
  6707. }
  6708. html += '<td class="' + classes.join(' ') + '"' +
  6709. (isDateValid ?
  6710. ' data-date="' + date.format() + '"' :
  6711. '') +
  6712. '>';
  6713. if (this.cellWeekNumbersVisible && (date.day() === weekCalcFirstDoW)) {
  6714. html += view.buildGotoAnchorHtml({ date: date, type: 'week' }, { 'class': 'fc-week-number' }, date.format('w') // inner HTML
  6715. );
  6716. }
  6717. if (isDayNumberVisible) {
  6718. html += view.buildGotoAnchorHtml(date, { 'class': 'fc-day-number' }, date.date() // inner HTML
  6719. );
  6720. }
  6721. html += '</td>';
  6722. return html;
  6723. };
  6724. /* Hit System
  6725. ------------------------------------------------------------------------------------------------------------------*/
  6726. DayGrid.prototype.prepareHits = function () {
  6727. this.colCoordCache.build();
  6728. this.rowCoordCache.build();
  6729. this.rowCoordCache.bottoms[this.rowCnt - 1] += this.bottomCoordPadding; // hack
  6730. };
  6731. DayGrid.prototype.releaseHits = function () {
  6732. this.colCoordCache.clear();
  6733. this.rowCoordCache.clear();
  6734. };
  6735. DayGrid.prototype.queryHit = function (leftOffset, topOffset) {
  6736. if (this.colCoordCache.isLeftInBounds(leftOffset) && this.rowCoordCache.isTopInBounds(topOffset)) {
  6737. var col = this.colCoordCache.getHorizontalIndex(leftOffset);
  6738. var row = this.rowCoordCache.getVerticalIndex(topOffset);
  6739. if (row != null && col != null) {
  6740. return this.getCellHit(row, col);
  6741. }
  6742. }
  6743. };
  6744. DayGrid.prototype.getHitFootprint = function (hit) {
  6745. var range = this.getCellRange(hit.row, hit.col);
  6746. return new ComponentFootprint_1.default(new UnzonedRange_1.default(range.start, range.end), true // all-day?
  6747. );
  6748. };
  6749. DayGrid.prototype.getHitEl = function (hit) {
  6750. return this.getCellEl(hit.row, hit.col);
  6751. };
  6752. /* Cell System
  6753. ------------------------------------------------------------------------------------------------------------------*/
  6754. // FYI: the first column is the leftmost column, regardless of date
  6755. DayGrid.prototype.getCellHit = function (row, col) {
  6756. return {
  6757. row: row,
  6758. col: col,
  6759. component: this,
  6760. left: this.colCoordCache.getLeftOffset(col),
  6761. right: this.colCoordCache.getRightOffset(col),
  6762. top: this.rowCoordCache.getTopOffset(row),
  6763. bottom: this.rowCoordCache.getBottomOffset(row)
  6764. };
  6765. };
  6766. DayGrid.prototype.getCellEl = function (row, col) {
  6767. return this.cellEls.eq(row * this.colCnt + col);
  6768. };
  6769. /* Event Rendering
  6770. ------------------------------------------------------------------------------------------------------------------*/
  6771. // Unrenders all events currently rendered on the grid
  6772. DayGrid.prototype.executeEventUnrender = function () {
  6773. this.removeSegPopover(); // removes the "more.." events popover
  6774. _super.prototype.executeEventUnrender.call(this);
  6775. };
  6776. // Retrieves all rendered segment objects currently rendered on the grid
  6777. DayGrid.prototype.getOwnEventSegs = function () {
  6778. // append the segments from the "more..." popover
  6779. return _super.prototype.getOwnEventSegs.call(this).concat(this.popoverSegs || []);
  6780. };
  6781. /* Event Drag Visualization
  6782. ------------------------------------------------------------------------------------------------------------------*/
  6783. // Renders a visual indication of an event or external element being dragged.
  6784. // `eventLocation` has zoned start and end (optional)
  6785. DayGrid.prototype.renderDrag = function (eventFootprints, seg, isTouch) {
  6786. var i;
  6787. for (i = 0; i < eventFootprints.length; i++) {
  6788. this.renderHighlight(eventFootprints[i].componentFootprint);
  6789. }
  6790. // render drags from OTHER components as helpers
  6791. if (eventFootprints.length && seg && seg.component !== this) {
  6792. this.helperRenderer.renderEventDraggingFootprints(eventFootprints, seg, isTouch);
  6793. return true; // signal helpers rendered
  6794. }
  6795. };
  6796. // Unrenders any visual indication of a hovering event
  6797. DayGrid.prototype.unrenderDrag = function () {
  6798. this.unrenderHighlight();
  6799. this.helperRenderer.unrender();
  6800. };
  6801. /* Event Resize Visualization
  6802. ------------------------------------------------------------------------------------------------------------------*/
  6803. // Renders a visual indication of an event being resized
  6804. DayGrid.prototype.renderEventResize = function (eventFootprints, seg, isTouch) {
  6805. var i;
  6806. for (i = 0; i < eventFootprints.length; i++) {
  6807. this.renderHighlight(eventFootprints[i].componentFootprint);
  6808. }
  6809. this.helperRenderer.renderEventResizingFootprints(eventFootprints, seg, isTouch);
  6810. };
  6811. // Unrenders a visual indication of an event being resized
  6812. DayGrid.prototype.unrenderEventResize = function () {
  6813. this.unrenderHighlight();
  6814. this.helperRenderer.unrender();
  6815. };
  6816. /* More+ Link Popover
  6817. ------------------------------------------------------------------------------------------------------------------*/
  6818. DayGrid.prototype.removeSegPopover = function () {
  6819. if (this.segPopover) {
  6820. this.segPopover.hide(); // in handler, will call segPopover's removeElement
  6821. }
  6822. };
  6823. // Limits the number of "levels" (vertically stacking layers of events) for each row of the grid.
  6824. // `levelLimit` can be false (don't limit), a number, or true (should be computed).
  6825. DayGrid.prototype.limitRows = function (levelLimit) {
  6826. var rowStructs = this.eventRenderer.rowStructs || [];
  6827. var row; // row #
  6828. var rowLevelLimit;
  6829. for (row = 0; row < rowStructs.length; row++) {
  6830. this.unlimitRow(row);
  6831. if (!levelLimit) {
  6832. rowLevelLimit = false;
  6833. }
  6834. else if (typeof levelLimit === 'number') {
  6835. rowLevelLimit = levelLimit;
  6836. }
  6837. else {
  6838. rowLevelLimit = this.computeRowLevelLimit(row);
  6839. }
  6840. if (rowLevelLimit !== false) {
  6841. this.limitRow(row, rowLevelLimit);
  6842. }
  6843. }
  6844. };
  6845. // Computes the number of levels a row will accomodate without going outside its bounds.
  6846. // Assumes the row is "rigid" (maintains a constant height regardless of what is inside).
  6847. // `row` is the row number.
  6848. DayGrid.prototype.computeRowLevelLimit = function (row) {
  6849. var rowEl = this.rowEls.eq(row); // the containing "fake" row div
  6850. var rowHeight = rowEl.height(); // TODO: cache somehow?
  6851. var trEls = this.eventRenderer.rowStructs[row].tbodyEl.children();
  6852. var i;
  6853. var trEl;
  6854. var trHeight;
  6855. function iterInnerHeights(i, childNode) {
  6856. trHeight = Math.max(trHeight, $(childNode).outerHeight());
  6857. }
  6858. // Reveal one level <tr> at a time and stop when we find one out of bounds
  6859. for (i = 0; i < trEls.length; i++) {
  6860. trEl = trEls.eq(i).removeClass('fc-limited'); // reset to original state (reveal)
  6861. // with rowspans>1 and IE8, trEl.outerHeight() would return the height of the largest cell,
  6862. // so instead, find the tallest inner content element.
  6863. trHeight = 0;
  6864. trEl.find('> td > :first-child').each(iterInnerHeights);
  6865. if (trEl.position().top + trHeight > rowHeight) {
  6866. return i;
  6867. }
  6868. }
  6869. return false; // should not limit at all
  6870. };
  6871. // Limits the given grid row to the maximum number of levels and injects "more" links if necessary.
  6872. // `row` is the row number.
  6873. // `levelLimit` is a number for the maximum (inclusive) number of levels allowed.
  6874. DayGrid.prototype.limitRow = function (row, levelLimit) {
  6875. var _this = this;
  6876. var rowStruct = this.eventRenderer.rowStructs[row];
  6877. var moreNodes = []; // array of "more" <a> links and <td> DOM nodes
  6878. var col = 0; // col #, left-to-right (not chronologically)
  6879. var levelSegs; // array of segment objects in the last allowable level, ordered left-to-right
  6880. var cellMatrix; // a matrix (by level, then column) of all <td> jQuery elements in the row
  6881. var limitedNodes; // array of temporarily hidden level <tr> and segment <td> DOM nodes
  6882. var i;
  6883. var seg;
  6884. var segsBelow; // array of segment objects below `seg` in the current `col`
  6885. var totalSegsBelow; // total number of segments below `seg` in any of the columns `seg` occupies
  6886. var colSegsBelow; // array of segment arrays, below seg, one for each column (offset from segs's first column)
  6887. var td;
  6888. var rowspan;
  6889. var segMoreNodes; // array of "more" <td> cells that will stand-in for the current seg's cell
  6890. var j;
  6891. var moreTd;
  6892. var moreWrap;
  6893. var moreLink;
  6894. // Iterates through empty level cells and places "more" links inside if need be
  6895. var emptyCellsUntil = function (endCol) {
  6896. while (col < endCol) {
  6897. segsBelow = _this.getCellSegs(row, col, levelLimit);
  6898. if (segsBelow.length) {
  6899. td = cellMatrix[levelLimit - 1][col];
  6900. moreLink = _this.renderMoreLink(row, col, segsBelow);
  6901. moreWrap = $('<div/>').append(moreLink);
  6902. td.append(moreWrap);
  6903. moreNodes.push(moreWrap[0]);
  6904. }
  6905. col++;
  6906. }
  6907. };
  6908. if (levelLimit && levelLimit < rowStruct.segLevels.length) {
  6909. levelSegs = rowStruct.segLevels[levelLimit - 1];
  6910. cellMatrix = rowStruct.cellMatrix;
  6911. limitedNodes = rowStruct.tbodyEl.children().slice(levelLimit) // get level <tr> elements past the limit
  6912. .addClass('fc-limited').get(); // hide elements and get a simple DOM-nodes array
  6913. // iterate though segments in the last allowable level
  6914. for (i = 0; i < levelSegs.length; i++) {
  6915. seg = levelSegs[i];
  6916. emptyCellsUntil(seg.leftCol); // process empty cells before the segment
  6917. // determine *all* segments below `seg` that occupy the same columns
  6918. colSegsBelow = [];
  6919. totalSegsBelow = 0;
  6920. while (col <= seg.rightCol) {
  6921. segsBelow = this.getCellSegs(row, col, levelLimit);
  6922. colSegsBelow.push(segsBelow);
  6923. totalSegsBelow += segsBelow.length;
  6924. col++;
  6925. }
  6926. if (totalSegsBelow) {
  6927. td = cellMatrix[levelLimit - 1][seg.leftCol]; // the segment's parent cell
  6928. rowspan = td.attr('rowspan') || 1;
  6929. segMoreNodes = [];
  6930. // make a replacement <td> for each column the segment occupies. will be one for each colspan
  6931. for (j = 0; j < colSegsBelow.length; j++) {
  6932. moreTd = $('<td class="fc-more-cell"/>').attr('rowspan', rowspan);
  6933. segsBelow = colSegsBelow[j];
  6934. moreLink = this.renderMoreLink(row, seg.leftCol + j, [seg].concat(segsBelow) // count seg as hidden too
  6935. );
  6936. moreWrap = $('<div/>').append(moreLink);
  6937. moreTd.append(moreWrap);
  6938. segMoreNodes.push(moreTd[0]);
  6939. moreNodes.push(moreTd[0]);
  6940. }
  6941. td.addClass('fc-limited').after($(segMoreNodes)); // hide original <td> and inject replacements
  6942. limitedNodes.push(td[0]);
  6943. }
  6944. }
  6945. emptyCellsUntil(this.colCnt); // finish off the level
  6946. rowStruct.moreEls = $(moreNodes); // for easy undoing later
  6947. rowStruct.limitedEls = $(limitedNodes); // for easy undoing later
  6948. }
  6949. };
  6950. // Reveals all levels and removes all "more"-related elements for a grid's row.
  6951. // `row` is a row number.
  6952. DayGrid.prototype.unlimitRow = function (row) {
  6953. var rowStruct = this.eventRenderer.rowStructs[row];
  6954. if (rowStruct.moreEls) {
  6955. rowStruct.moreEls.remove();
  6956. rowStruct.moreEls = null;
  6957. }
  6958. if (rowStruct.limitedEls) {
  6959. rowStruct.limitedEls.removeClass('fc-limited');
  6960. rowStruct.limitedEls = null;
  6961. }
  6962. };
  6963. // Renders an <a> element that represents hidden event element for a cell.
  6964. // Responsible for attaching click handler as well.
  6965. DayGrid.prototype.renderMoreLink = function (row, col, hiddenSegs) {
  6966. var _this = this;
  6967. var view = this.view;
  6968. return $('<a class="fc-more"/>')
  6969. .text(this.getMoreLinkText(hiddenSegs.length))
  6970. .on('click', function (ev) {
  6971. var clickOption = _this.opt('eventLimitClick');
  6972. var date = _this.getCellDate(row, col);
  6973. var moreEl = $(ev.currentTarget);
  6974. var dayEl = _this.getCellEl(row, col);
  6975. var allSegs = _this.getCellSegs(row, col);
  6976. // rescope the segments to be within the cell's date
  6977. var reslicedAllSegs = _this.resliceDaySegs(allSegs, date);
  6978. var reslicedHiddenSegs = _this.resliceDaySegs(hiddenSegs, date);
  6979. if (typeof clickOption === 'function') {
  6980. // the returned value can be an atomic option
  6981. clickOption = _this.publiclyTrigger('eventLimitClick', {
  6982. context: view,
  6983. args: [
  6984. {
  6985. date: date.clone(),
  6986. dayEl: dayEl,
  6987. moreEl: moreEl,
  6988. segs: reslicedAllSegs,
  6989. hiddenSegs: reslicedHiddenSegs
  6990. },
  6991. ev,
  6992. view
  6993. ]
  6994. });
  6995. }
  6996. if (clickOption === 'popover') {
  6997. _this.showSegPopover(row, col, moreEl, reslicedAllSegs);
  6998. }
  6999. else if (typeof clickOption === 'string') {
  7000. view.calendar.zoomTo(date, clickOption);
  7001. }
  7002. });
  7003. };
  7004. // Reveals the popover that displays all events within a cell
  7005. DayGrid.prototype.showSegPopover = function (row, col, moreLink, segs) {
  7006. var _this = this;
  7007. var view = this.view;
  7008. var moreWrap = moreLink.parent(); // the <div> wrapper around the <a>
  7009. var topEl; // the element we want to match the top coordinate of
  7010. var options;
  7011. if (this.rowCnt === 1) {
  7012. topEl = view.el; // will cause the popover to cover any sort of header
  7013. }
  7014. else {
  7015. topEl = this.rowEls.eq(row); // will align with top of row
  7016. }
  7017. options = {
  7018. className: 'fc-more-popover ' + view.calendar.theme.getClass('popover'),
  7019. content: this.renderSegPopoverContent(row, col, segs),
  7020. parentEl: view.el,
  7021. top: topEl.offset().top,
  7022. autoHide: true,
  7023. viewportConstrain: this.opt('popoverViewportConstrain'),
  7024. hide: function () {
  7025. // kill everything when the popover is hidden
  7026. // notify events to be removed
  7027. if (_this.popoverSegs) {
  7028. _this.triggerBeforeEventSegsDestroyed(_this.popoverSegs);
  7029. }
  7030. _this.segPopover.removeElement();
  7031. _this.segPopover = null;
  7032. _this.popoverSegs = null;
  7033. }
  7034. };
  7035. // Determine horizontal coordinate.
  7036. // We use the moreWrap instead of the <td> to avoid border confusion.
  7037. if (this.isRTL) {
  7038. options.right = moreWrap.offset().left + moreWrap.outerWidth() + 1; // +1 to be over cell border
  7039. }
  7040. else {
  7041. options.left = moreWrap.offset().left - 1; // -1 to be over cell border
  7042. }
  7043. this.segPopover = new Popover_1.default(options);
  7044. this.segPopover.show();
  7045. // the popover doesn't live within the grid's container element, and thus won't get the event
  7046. // delegated-handlers for free. attach event-related handlers to the popover.
  7047. this.bindAllSegHandlersToEl(this.segPopover.el);
  7048. this.triggerAfterEventSegsRendered(segs);
  7049. };
  7050. // Builds the inner DOM contents of the segment popover
  7051. DayGrid.prototype.renderSegPopoverContent = function (row, col, segs) {
  7052. var view = this.view;
  7053. var theme = view.calendar.theme;
  7054. var title = this.getCellDate(row, col).format(this.opt('dayPopoverFormat'));
  7055. var content = $('<div class="fc-header ' + theme.getClass('popoverHeader') + '">' +
  7056. '<span class="fc-close ' + theme.getIconClass('close') + '"></span>' +
  7057. '<span class="fc-title">' +
  7058. util_1.htmlEscape(title) +
  7059. '</span>' +
  7060. '<div class="fc-clear"/>' +
  7061. '</div>' +
  7062. '<div class="fc-body ' + theme.getClass('popoverContent') + '">' +
  7063. '<div class="fc-event-container"></div>' +
  7064. '</div>');
  7065. var segContainer = content.find('.fc-event-container');
  7066. var i;
  7067. // render each seg's `el` and only return the visible segs
  7068. segs = this.eventRenderer.renderFgSegEls(segs, true); // disableResizing=true
  7069. this.popoverSegs = segs;
  7070. for (i = 0; i < segs.length; i++) {
  7071. // because segments in the popover are not part of a grid coordinate system, provide a hint to any
  7072. // grids that want to do drag-n-drop about which cell it came from
  7073. this.hitsNeeded();
  7074. segs[i].hit = this.getCellHit(row, col);
  7075. this.hitsNotNeeded();
  7076. segContainer.append(segs[i].el);
  7077. }
  7078. return content;
  7079. };
  7080. // Given the events within an array of segment objects, reslice them to be in a single day
  7081. DayGrid.prototype.resliceDaySegs = function (segs, dayDate) {
  7082. var dayStart = dayDate.clone();
  7083. var dayEnd = dayStart.clone().add(1, 'days');
  7084. var dayRange = new UnzonedRange_1.default(dayStart, dayEnd);
  7085. var newSegs = [];
  7086. var i;
  7087. var seg;
  7088. var slicedRange;
  7089. for (i = 0; i < segs.length; i++) {
  7090. seg = segs[i];
  7091. slicedRange = seg.footprint.componentFootprint.unzonedRange.intersect(dayRange);
  7092. if (slicedRange) {
  7093. newSegs.push($.extend({}, seg, {
  7094. footprint: new EventFootprint_1.default(new ComponentFootprint_1.default(slicedRange, seg.footprint.componentFootprint.isAllDay), seg.footprint.eventDef, seg.footprint.eventInstance),
  7095. isStart: seg.isStart && slicedRange.isStart,
  7096. isEnd: seg.isEnd && slicedRange.isEnd
  7097. }));
  7098. }
  7099. }
  7100. // force an order because eventsToSegs doesn't guarantee one
  7101. // TODO: research if still needed
  7102. this.eventRenderer.sortEventSegs(newSegs);
  7103. return newSegs;
  7104. };
  7105. // Generates the text that should be inside a "more" link, given the number of events it represents
  7106. DayGrid.prototype.getMoreLinkText = function (num) {
  7107. var opt = this.opt('eventLimitText');
  7108. if (typeof opt === 'function') {
  7109. return opt(num);
  7110. }
  7111. else {
  7112. return '+' + num + ' ' + opt;
  7113. }
  7114. };
  7115. // Returns segments within a given cell.
  7116. // If `startLevel` is specified, returns only events including and below that level. Otherwise returns all segs.
  7117. DayGrid.prototype.getCellSegs = function (row, col, startLevel) {
  7118. var segMatrix = this.eventRenderer.rowStructs[row].segMatrix;
  7119. var level = startLevel || 0;
  7120. var segs = [];
  7121. var seg;
  7122. while (level < segMatrix.length) {
  7123. seg = segMatrix[level][col];
  7124. if (seg) {
  7125. segs.push(seg);
  7126. }
  7127. level++;
  7128. }
  7129. return segs;
  7130. };
  7131. return DayGrid;
  7132. }(InteractiveDateComponent_1.default));
  7133. exports.default = DayGrid;
  7134. DayGrid.prototype.eventRendererClass = DayGridEventRenderer_1.default;
  7135. DayGrid.prototype.businessHourRendererClass = BusinessHourRenderer_1.default;
  7136. DayGrid.prototype.helperRendererClass = DayGridHelperRenderer_1.default;
  7137. DayGrid.prototype.fillRendererClass = DayGridFillRenderer_1.default;
  7138. StandardInteractionsMixin_1.default.mixInto(DayGrid);
  7139. DayTableMixin_1.default.mixInto(DayGrid);
  7140. /***/ }),
  7141. /* 62 */
  7142. /***/ (function(module, exports, __webpack_require__) {
  7143. Object.defineProperty(exports, "__esModule", { value: true });
  7144. var tslib_1 = __webpack_require__(2);
  7145. var $ = __webpack_require__(3);
  7146. var util_1 = __webpack_require__(4);
  7147. var Scroller_1 = __webpack_require__(39);
  7148. var View_1 = __webpack_require__(41);
  7149. var BasicViewDateProfileGenerator_1 = __webpack_require__(224);
  7150. var DayGrid_1 = __webpack_require__(61);
  7151. /* An abstract class for the "basic" views, as well as month view. Renders one or more rows of day cells.
  7152. ----------------------------------------------------------------------------------------------------------------------*/
  7153. // It is a manager for a DayGrid subcomponent, which does most of the heavy lifting.
  7154. // It is responsible for managing width/height.
  7155. var BasicView = /** @class */ (function (_super) {
  7156. tslib_1.__extends(BasicView, _super);
  7157. function BasicView(calendar, viewSpec) {
  7158. var _this = _super.call(this, calendar, viewSpec) || this;
  7159. _this.dayGrid = _this.instantiateDayGrid();
  7160. _this.dayGrid.isRigid = _this.hasRigidRows();
  7161. if (_this.opt('weekNumbers')) {
  7162. if (_this.opt('weekNumbersWithinDays')) {
  7163. _this.dayGrid.cellWeekNumbersVisible = true;
  7164. _this.dayGrid.colWeekNumbersVisible = false;
  7165. }
  7166. else {
  7167. _this.dayGrid.cellWeekNumbersVisible = false;
  7168. _this.dayGrid.colWeekNumbersVisible = true;
  7169. }
  7170. }
  7171. _this.addChild(_this.dayGrid);
  7172. _this.scroller = new Scroller_1.default({
  7173. overflowX: 'hidden',
  7174. overflowY: 'auto'
  7175. });
  7176. return _this;
  7177. }
  7178. // Generates the DayGrid object this view needs. Draws from this.dayGridClass
  7179. BasicView.prototype.instantiateDayGrid = function () {
  7180. // generate a subclass on the fly with BasicView-specific behavior
  7181. // TODO: cache this subclass
  7182. var subclass = makeDayGridSubclass(this.dayGridClass);
  7183. return new subclass(this);
  7184. };
  7185. BasicView.prototype.executeDateRender = function (dateProfile) {
  7186. this.dayGrid.breakOnWeeks = /year|month|week/.test(dateProfile.currentRangeUnit);
  7187. _super.prototype.executeDateRender.call(this, dateProfile);
  7188. };
  7189. BasicView.prototype.renderSkeleton = function () {
  7190. var dayGridContainerEl;
  7191. var dayGridEl;
  7192. this.el.addClass('fc-basic-view').html(this.renderSkeletonHtml());
  7193. this.scroller.render();
  7194. dayGridContainerEl = this.scroller.el.addClass('fc-day-grid-container');
  7195. dayGridEl = $('<div class="fc-day-grid" />').appendTo(dayGridContainerEl);
  7196. this.el.find('.fc-body > tr > td').append(dayGridContainerEl);
  7197. this.dayGrid.headContainerEl = this.el.find('.fc-head-container');
  7198. this.dayGrid.setElement(dayGridEl);
  7199. };
  7200. BasicView.prototype.unrenderSkeleton = function () {
  7201. this.dayGrid.removeElement();
  7202. this.scroller.destroy();
  7203. };
  7204. // Builds the HTML skeleton for the view.
  7205. // The day-grid component will render inside of a container defined by this HTML.
  7206. BasicView.prototype.renderSkeletonHtml = function () {
  7207. var theme = this.calendar.theme;
  7208. return '' +
  7209. '<table class="' + theme.getClass('tableGrid') + '">' +
  7210. (this.opt('columnHeader') ?
  7211. '<thead class="fc-head">' +
  7212. '<tr>' +
  7213. '<td class="fc-head-container ' + theme.getClass('widgetHeader') + '">&nbsp;</td>' +
  7214. '</tr>' +
  7215. '</thead>' :
  7216. '') +
  7217. '<tbody class="fc-body">' +
  7218. '<tr>' +
  7219. '<td class="' + theme.getClass('widgetContent') + '"></td>' +
  7220. '</tr>' +
  7221. '</tbody>' +
  7222. '</table>';
  7223. };
  7224. // Generates an HTML attribute string for setting the width of the week number column, if it is known
  7225. BasicView.prototype.weekNumberStyleAttr = function () {
  7226. if (this.weekNumberWidth != null) {
  7227. return 'style="width:' + this.weekNumberWidth + 'px"';
  7228. }
  7229. return '';
  7230. };
  7231. // Determines whether each row should have a constant height
  7232. BasicView.prototype.hasRigidRows = function () {
  7233. var eventLimit = this.opt('eventLimit');
  7234. return eventLimit && typeof eventLimit !== 'number';
  7235. };
  7236. /* Dimensions
  7237. ------------------------------------------------------------------------------------------------------------------*/
  7238. // Refreshes the horizontal dimensions of the view
  7239. BasicView.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  7240. var eventLimit = this.opt('eventLimit');
  7241. var headRowEl = this.dayGrid.headContainerEl.find('.fc-row');
  7242. var scrollerHeight;
  7243. var scrollbarWidths;
  7244. // hack to give the view some height prior to dayGrid's columns being rendered
  7245. // TODO: separate setting height from scroller VS dayGrid.
  7246. if (!this.dayGrid.rowEls) {
  7247. if (!isAuto) {
  7248. scrollerHeight = this.computeScrollerHeight(totalHeight);
  7249. this.scroller.setHeight(scrollerHeight);
  7250. }
  7251. return;
  7252. }
  7253. _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
  7254. if (this.dayGrid.colWeekNumbersVisible) {
  7255. // Make sure all week number cells running down the side have the same width.
  7256. // Record the width for cells created later.
  7257. this.weekNumberWidth = util_1.matchCellWidths(this.el.find('.fc-week-number'));
  7258. }
  7259. // reset all heights to be natural
  7260. this.scroller.clear();
  7261. util_1.uncompensateScroll(headRowEl);
  7262. this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed
  7263. // is the event limit a constant level number?
  7264. if (eventLimit && typeof eventLimit === 'number') {
  7265. this.dayGrid.limitRows(eventLimit); // limit the levels first so the height can redistribute after
  7266. }
  7267. // distribute the height to the rows
  7268. // (totalHeight is a "recommended" value if isAuto)
  7269. scrollerHeight = this.computeScrollerHeight(totalHeight);
  7270. this.setGridHeight(scrollerHeight, isAuto);
  7271. // is the event limit dynamically calculated?
  7272. if (eventLimit && typeof eventLimit !== 'number') {
  7273. this.dayGrid.limitRows(eventLimit); // limit the levels after the grid's row heights have been set
  7274. }
  7275. if (!isAuto) {
  7276. this.scroller.setHeight(scrollerHeight);
  7277. scrollbarWidths = this.scroller.getScrollbarWidths();
  7278. if (scrollbarWidths.left || scrollbarWidths.right) {
  7279. util_1.compensateScroll(headRowEl, scrollbarWidths);
  7280. // doing the scrollbar compensation might have created text overflow which created more height. redo
  7281. scrollerHeight = this.computeScrollerHeight(totalHeight);
  7282. this.scroller.setHeight(scrollerHeight);
  7283. }
  7284. // guarantees the same scrollbar widths
  7285. this.scroller.lockOverflow(scrollbarWidths);
  7286. }
  7287. };
  7288. // given a desired total height of the view, returns what the height of the scroller should be
  7289. BasicView.prototype.computeScrollerHeight = function (totalHeight) {
  7290. return totalHeight -
  7291. util_1.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
  7292. };
  7293. // Sets the height of just the DayGrid component in this view
  7294. BasicView.prototype.setGridHeight = function (height, isAuto) {
  7295. if (isAuto) {
  7296. util_1.undistributeHeight(this.dayGrid.rowEls); // let the rows be their natural height with no expanding
  7297. }
  7298. else {
  7299. util_1.distributeHeight(this.dayGrid.rowEls, height, true); // true = compensate for height-hogging rows
  7300. }
  7301. };
  7302. /* Scroll
  7303. ------------------------------------------------------------------------------------------------------------------*/
  7304. BasicView.prototype.computeInitialDateScroll = function () {
  7305. return { top: 0 };
  7306. };
  7307. BasicView.prototype.queryDateScroll = function () {
  7308. return { top: this.scroller.getScrollTop() };
  7309. };
  7310. BasicView.prototype.applyDateScroll = function (scroll) {
  7311. if (scroll.top !== undefined) {
  7312. this.scroller.setScrollTop(scroll.top);
  7313. }
  7314. };
  7315. return BasicView;
  7316. }(View_1.default));
  7317. exports.default = BasicView;
  7318. BasicView.prototype.dateProfileGeneratorClass = BasicViewDateProfileGenerator_1.default;
  7319. BasicView.prototype.dayGridClass = DayGrid_1.default;
  7320. // customize the rendering behavior of BasicView's dayGrid
  7321. function makeDayGridSubclass(SuperClass) {
  7322. return /** @class */ (function (_super) {
  7323. tslib_1.__extends(SubClass, _super);
  7324. function SubClass() {
  7325. var _this = _super !== null && _super.apply(this, arguments) || this;
  7326. _this.colWeekNumbersVisible = false; // display week numbers along the side?
  7327. return _this;
  7328. }
  7329. // Generates the HTML that will go before the day-of week header cells
  7330. SubClass.prototype.renderHeadIntroHtml = function () {
  7331. var view = this.view;
  7332. if (this.colWeekNumbersVisible) {
  7333. return '' +
  7334. '<th class="fc-week-number ' + view.calendar.theme.getClass('widgetHeader') + '" ' + view.weekNumberStyleAttr() + '>' +
  7335. '<span>' + // needed for matchCellWidths
  7336. util_1.htmlEscape(this.opt('weekNumberTitle')) +
  7337. '</span>' +
  7338. '</th>';
  7339. }
  7340. return '';
  7341. };
  7342. // Generates the HTML that will go before content-skeleton cells that display the day/week numbers
  7343. SubClass.prototype.renderNumberIntroHtml = function (row) {
  7344. var view = this.view;
  7345. var weekStart = this.getCellDate(row, 0);
  7346. if (this.colWeekNumbersVisible) {
  7347. return '' +
  7348. '<td class="fc-week-number" ' + view.weekNumberStyleAttr() + '>' +
  7349. view.buildGotoAnchorHtml(// aside from link, important for matchCellWidths
  7350. { date: weekStart, type: 'week', forceOff: this.colCnt === 1 }, weekStart.format('w') // inner HTML
  7351. ) +
  7352. '</td>';
  7353. }
  7354. return '';
  7355. };
  7356. // Generates the HTML that goes before the day bg cells for each day-row
  7357. SubClass.prototype.renderBgIntroHtml = function () {
  7358. var view = this.view;
  7359. if (this.colWeekNumbersVisible) {
  7360. return '<td class="fc-week-number ' + view.calendar.theme.getClass('widgetContent') + '" ' +
  7361. view.weekNumberStyleAttr() + '></td>';
  7362. }
  7363. return '';
  7364. };
  7365. // Generates the HTML that goes before every other type of row generated by DayGrid.
  7366. // Affects helper-skeleton and highlight-skeleton rows.
  7367. SubClass.prototype.renderIntroHtml = function () {
  7368. var view = this.view;
  7369. if (this.colWeekNumbersVisible) {
  7370. return '<td class="fc-week-number" ' + view.weekNumberStyleAttr() + '></td>';
  7371. }
  7372. return '';
  7373. };
  7374. SubClass.prototype.getIsNumbersVisible = function () {
  7375. return DayGrid_1.default.prototype.getIsNumbersVisible.apply(this, arguments) || this.colWeekNumbersVisible;
  7376. };
  7377. return SubClass;
  7378. }(SuperClass));
  7379. }
  7380. /***/ }),
  7381. /* 63 */,
  7382. /* 64 */,
  7383. /* 65 */,
  7384. /* 66 */,
  7385. /* 67 */,
  7386. /* 68 */,
  7387. /* 69 */,
  7388. /* 70 */,
  7389. /* 71 */,
  7390. /* 72 */,
  7391. /* 73 */,
  7392. /* 74 */,
  7393. /* 75 */,
  7394. /* 76 */,
  7395. /* 77 */,
  7396. /* 78 */,
  7397. /* 79 */,
  7398. /* 80 */,
  7399. /* 81 */,
  7400. /* 82 */,
  7401. /* 83 */,
  7402. /* 84 */,
  7403. /* 85 */,
  7404. /* 86 */,
  7405. /* 87 */,
  7406. /* 88 */,
  7407. /* 89 */,
  7408. /* 90 */,
  7409. /* 91 */,
  7410. /* 92 */,
  7411. /* 93 */,
  7412. /* 94 */,
  7413. /* 95 */,
  7414. /* 96 */,
  7415. /* 97 */,
  7416. /* 98 */,
  7417. /* 99 */,
  7418. /* 100 */,
  7419. /* 101 */,
  7420. /* 102 */,
  7421. /* 103 */,
  7422. /* 104 */,
  7423. /* 105 */,
  7424. /* 106 */,
  7425. /* 107 */,
  7426. /* 108 */,
  7427. /* 109 */,
  7428. /* 110 */,
  7429. /* 111 */,
  7430. /* 112 */,
  7431. /* 113 */,
  7432. /* 114 */,
  7433. /* 115 */,
  7434. /* 116 */,
  7435. /* 117 */,
  7436. /* 118 */,
  7437. /* 119 */,
  7438. /* 120 */,
  7439. /* 121 */,
  7440. /* 122 */,
  7441. /* 123 */,
  7442. /* 124 */,
  7443. /* 125 */,
  7444. /* 126 */,
  7445. /* 127 */,
  7446. /* 128 */,
  7447. /* 129 */,
  7448. /* 130 */,
  7449. /* 131 */,
  7450. /* 132 */,
  7451. /* 133 */,
  7452. /* 134 */,
  7453. /* 135 */,
  7454. /* 136 */,
  7455. /* 137 */,
  7456. /* 138 */,
  7457. /* 139 */,
  7458. /* 140 */,
  7459. /* 141 */,
  7460. /* 142 */,
  7461. /* 143 */,
  7462. /* 144 */,
  7463. /* 145 */,
  7464. /* 146 */,
  7465. /* 147 */,
  7466. /* 148 */,
  7467. /* 149 */,
  7468. /* 150 */,
  7469. /* 151 */,
  7470. /* 152 */,
  7471. /* 153 */,
  7472. /* 154 */,
  7473. /* 155 */,
  7474. /* 156 */,
  7475. /* 157 */,
  7476. /* 158 */,
  7477. /* 159 */,
  7478. /* 160 */,
  7479. /* 161 */,
  7480. /* 162 */,
  7481. /* 163 */,
  7482. /* 164 */,
  7483. /* 165 */,
  7484. /* 166 */,
  7485. /* 167 */,
  7486. /* 168 */,
  7487. /* 169 */,
  7488. /* 170 */,
  7489. /* 171 */,
  7490. /* 172 */,
  7491. /* 173 */,
  7492. /* 174 */,
  7493. /* 175 */,
  7494. /* 176 */,
  7495. /* 177 */,
  7496. /* 178 */,
  7497. /* 179 */,
  7498. /* 180 */,
  7499. /* 181 */,
  7500. /* 182 */,
  7501. /* 183 */,
  7502. /* 184 */,
  7503. /* 185 */,
  7504. /* 186 */,
  7505. /* 187 */,
  7506. /* 188 */,
  7507. /* 189 */,
  7508. /* 190 */,
  7509. /* 191 */,
  7510. /* 192 */,
  7511. /* 193 */,
  7512. /* 194 */,
  7513. /* 195 */,
  7514. /* 196 */,
  7515. /* 197 */,
  7516. /* 198 */,
  7517. /* 199 */,
  7518. /* 200 */,
  7519. /* 201 */,
  7520. /* 202 */,
  7521. /* 203 */
  7522. /***/ (function(module, exports, __webpack_require__) {
  7523. Object.defineProperty(exports, "__esModule", { value: true });
  7524. var UnzonedRange_1 = __webpack_require__(5);
  7525. var ComponentFootprint_1 = __webpack_require__(12);
  7526. var EventDefParser_1 = __webpack_require__(49);
  7527. var EventSource_1 = __webpack_require__(6);
  7528. var util_1 = __webpack_require__(34);
  7529. var Constraints = /** @class */ (function () {
  7530. function Constraints(eventManager, _calendar) {
  7531. this.eventManager = eventManager;
  7532. this._calendar = _calendar;
  7533. }
  7534. Constraints.prototype.opt = function (name) {
  7535. return this._calendar.opt(name);
  7536. };
  7537. /*
  7538. determines if eventInstanceGroup is allowed,
  7539. in relation to other EVENTS and business hours.
  7540. */
  7541. Constraints.prototype.isEventInstanceGroupAllowed = function (eventInstanceGroup) {
  7542. var eventDef = eventInstanceGroup.getEventDef();
  7543. var eventFootprints = this.eventRangesToEventFootprints(eventInstanceGroup.getAllEventRanges());
  7544. var i;
  7545. var peerEventInstances = this.getPeerEventInstances(eventDef);
  7546. var peerEventRanges = peerEventInstances.map(util_1.eventInstanceToEventRange);
  7547. var peerEventFootprints = this.eventRangesToEventFootprints(peerEventRanges);
  7548. var constraintVal = eventDef.getConstraint();
  7549. var overlapVal = eventDef.getOverlap();
  7550. var eventAllowFunc = this.opt('eventAllow');
  7551. for (i = 0; i < eventFootprints.length; i++) {
  7552. if (!this.isFootprintAllowed(eventFootprints[i].componentFootprint, peerEventFootprints, constraintVal, overlapVal, eventFootprints[i].eventInstance)) {
  7553. return false;
  7554. }
  7555. }
  7556. if (eventAllowFunc) {
  7557. for (i = 0; i < eventFootprints.length; i++) {
  7558. if (eventAllowFunc(eventFootprints[i].componentFootprint.toLegacy(this._calendar), eventFootprints[i].getEventLegacy()) === false) {
  7559. return false;
  7560. }
  7561. }
  7562. }
  7563. return true;
  7564. };
  7565. Constraints.prototype.getPeerEventInstances = function (eventDef) {
  7566. return this.eventManager.getEventInstancesWithoutId(eventDef.id);
  7567. };
  7568. Constraints.prototype.isSelectionFootprintAllowed = function (componentFootprint) {
  7569. var peerEventInstances = this.eventManager.getEventInstances();
  7570. var peerEventRanges = peerEventInstances.map(util_1.eventInstanceToEventRange);
  7571. var peerEventFootprints = this.eventRangesToEventFootprints(peerEventRanges);
  7572. var selectAllowFunc;
  7573. if (this.isFootprintAllowed(componentFootprint, peerEventFootprints, this.opt('selectConstraint'), this.opt('selectOverlap'))) {
  7574. selectAllowFunc = this.opt('selectAllow');
  7575. if (selectAllowFunc) {
  7576. return selectAllowFunc(componentFootprint.toLegacy(this._calendar)) !== false;
  7577. }
  7578. else {
  7579. return true;
  7580. }
  7581. }
  7582. return false;
  7583. };
  7584. Constraints.prototype.isFootprintAllowed = function (componentFootprint, peerEventFootprints, constraintVal, overlapVal, subjectEventInstance // optional
  7585. ) {
  7586. var constraintFootprints; // ComponentFootprint[]
  7587. var overlapEventFootprints; // EventFootprint[]
  7588. if (constraintVal != null) {
  7589. constraintFootprints = this.constraintValToFootprints(constraintVal, componentFootprint.isAllDay);
  7590. if (!this.isFootprintWithinConstraints(componentFootprint, constraintFootprints)) {
  7591. return false;
  7592. }
  7593. }
  7594. overlapEventFootprints = this.collectOverlapEventFootprints(peerEventFootprints, componentFootprint);
  7595. if (overlapVal === false) {
  7596. if (overlapEventFootprints.length) {
  7597. return false;
  7598. }
  7599. }
  7600. else if (typeof overlapVal === 'function') {
  7601. if (!isOverlapsAllowedByFunc(overlapEventFootprints, overlapVal, subjectEventInstance)) {
  7602. return false;
  7603. }
  7604. }
  7605. if (subjectEventInstance) {
  7606. if (!isOverlapEventInstancesAllowed(overlapEventFootprints, subjectEventInstance)) {
  7607. return false;
  7608. }
  7609. }
  7610. return true;
  7611. };
  7612. // Constraint
  7613. // ------------------------------------------------------------------------------------------------
  7614. Constraints.prototype.isFootprintWithinConstraints = function (componentFootprint, constraintFootprints) {
  7615. var i;
  7616. for (i = 0; i < constraintFootprints.length; i++) {
  7617. if (this.footprintContainsFootprint(constraintFootprints[i], componentFootprint)) {
  7618. return true;
  7619. }
  7620. }
  7621. return false;
  7622. };
  7623. Constraints.prototype.constraintValToFootprints = function (constraintVal, isAllDay) {
  7624. var eventInstances;
  7625. if (constraintVal === 'businessHours') {
  7626. return this.buildCurrentBusinessFootprints(isAllDay);
  7627. }
  7628. else if (typeof constraintVal === 'object') {
  7629. eventInstances = this.parseEventDefToInstances(constraintVal); // handles recurring events
  7630. if (!eventInstances) {
  7631. return this.parseFootprints(constraintVal);
  7632. }
  7633. else {
  7634. return this.eventInstancesToFootprints(eventInstances);
  7635. }
  7636. }
  7637. else if (constraintVal != null) {
  7638. eventInstances = this.eventManager.getEventInstancesWithId(constraintVal);
  7639. return this.eventInstancesToFootprints(eventInstances);
  7640. }
  7641. };
  7642. // returns ComponentFootprint[]
  7643. // uses current view's range
  7644. Constraints.prototype.buildCurrentBusinessFootprints = function (isAllDay) {
  7645. var view = this._calendar.view;
  7646. var businessHourGenerator = view.get('businessHourGenerator');
  7647. var unzonedRange = view.dateProfile.activeUnzonedRange;
  7648. var eventInstanceGroup = businessHourGenerator.buildEventInstanceGroup(isAllDay, unzonedRange);
  7649. if (eventInstanceGroup) {
  7650. return this.eventInstancesToFootprints(eventInstanceGroup.eventInstances);
  7651. }
  7652. else {
  7653. return [];
  7654. }
  7655. };
  7656. // conversion util
  7657. Constraints.prototype.eventInstancesToFootprints = function (eventInstances) {
  7658. var eventRanges = eventInstances.map(util_1.eventInstanceToEventRange);
  7659. var eventFootprints = this.eventRangesToEventFootprints(eventRanges);
  7660. return eventFootprints.map(util_1.eventFootprintToComponentFootprint);
  7661. };
  7662. // Overlap
  7663. // ------------------------------------------------------------------------------------------------
  7664. Constraints.prototype.collectOverlapEventFootprints = function (peerEventFootprints, targetFootprint) {
  7665. var overlapEventFootprints = [];
  7666. var i;
  7667. for (i = 0; i < peerEventFootprints.length; i++) {
  7668. if (this.footprintsIntersect(targetFootprint, peerEventFootprints[i].componentFootprint)) {
  7669. overlapEventFootprints.push(peerEventFootprints[i]);
  7670. }
  7671. }
  7672. return overlapEventFootprints;
  7673. };
  7674. // Conversion: eventDefs -> eventInstances -> eventRanges -> eventFootprints -> componentFootprints
  7675. // ------------------------------------------------------------------------------------------------
  7676. // NOTE: this might seem like repetitive code with the Grid class, however, this code is related to
  7677. // constraints whereas the Grid code is related to rendering. Each approach might want to convert
  7678. // eventRanges -> eventFootprints in a different way. Regardless, there are opportunities to make
  7679. // this more DRY.
  7680. /*
  7681. Returns false on invalid input.
  7682. */
  7683. Constraints.prototype.parseEventDefToInstances = function (eventInput) {
  7684. var eventManager = this.eventManager;
  7685. var eventDef = EventDefParser_1.default.parse(eventInput, new EventSource_1.default(this._calendar));
  7686. if (!eventDef) {
  7687. return false;
  7688. }
  7689. return eventDef.buildInstances(eventManager.currentPeriod.unzonedRange);
  7690. };
  7691. Constraints.prototype.eventRangesToEventFootprints = function (eventRanges) {
  7692. var i;
  7693. var eventFootprints = [];
  7694. for (i = 0; i < eventRanges.length; i++) {
  7695. eventFootprints.push.apply(// footprints
  7696. eventFootprints, this.eventRangeToEventFootprints(eventRanges[i]));
  7697. }
  7698. return eventFootprints;
  7699. };
  7700. Constraints.prototype.eventRangeToEventFootprints = function (eventRange) {
  7701. return [util_1.eventRangeToEventFootprint(eventRange)];
  7702. };
  7703. /*
  7704. Parses footprints directly.
  7705. Very similar to EventDateProfile::parse :(
  7706. */
  7707. Constraints.prototype.parseFootprints = function (rawInput) {
  7708. var start;
  7709. var end;
  7710. if (rawInput.start) {
  7711. start = this._calendar.moment(rawInput.start);
  7712. if (!start.isValid()) {
  7713. start = null;
  7714. }
  7715. }
  7716. if (rawInput.end) {
  7717. end = this._calendar.moment(rawInput.end);
  7718. if (!end.isValid()) {
  7719. end = null;
  7720. }
  7721. }
  7722. return [
  7723. new ComponentFootprint_1.default(new UnzonedRange_1.default(start, end), (start && !start.hasTime()) || (end && !end.hasTime()) // isAllDay
  7724. )
  7725. ];
  7726. };
  7727. // Footprint Utils
  7728. // ----------------------------------------------------------------------------------------
  7729. Constraints.prototype.footprintContainsFootprint = function (outerFootprint, innerFootprint) {
  7730. return outerFootprint.unzonedRange.containsRange(innerFootprint.unzonedRange);
  7731. };
  7732. Constraints.prototype.footprintsIntersect = function (footprint0, footprint1) {
  7733. return footprint0.unzonedRange.intersectsWith(footprint1.unzonedRange);
  7734. };
  7735. return Constraints;
  7736. }());
  7737. exports.default = Constraints;
  7738. // optional subjectEventInstance
  7739. function isOverlapsAllowedByFunc(overlapEventFootprints, overlapFunc, subjectEventInstance) {
  7740. var i;
  7741. for (i = 0; i < overlapEventFootprints.length; i++) {
  7742. if (!overlapFunc(overlapEventFootprints[i].eventInstance.toLegacy(), subjectEventInstance ? subjectEventInstance.toLegacy() : null)) {
  7743. return false;
  7744. }
  7745. }
  7746. return true;
  7747. }
  7748. function isOverlapEventInstancesAllowed(overlapEventFootprints, subjectEventInstance) {
  7749. var subjectLegacyInstance = subjectEventInstance.toLegacy();
  7750. var i;
  7751. var overlapEventInstance;
  7752. var overlapEventDef;
  7753. var overlapVal;
  7754. for (i = 0; i < overlapEventFootprints.length; i++) {
  7755. overlapEventInstance = overlapEventFootprints[i].eventInstance;
  7756. overlapEventDef = overlapEventInstance.def;
  7757. // don't need to pass in calendar, because don't want to consider global eventOverlap property,
  7758. // because we already considered that earlier in the process.
  7759. overlapVal = overlapEventDef.getOverlap();
  7760. if (overlapVal === false) {
  7761. return false;
  7762. }
  7763. else if (typeof overlapVal === 'function') {
  7764. if (!overlapVal(overlapEventInstance.toLegacy(), subjectLegacyInstance)) {
  7765. return false;
  7766. }
  7767. }
  7768. }
  7769. return true;
  7770. }
  7771. /***/ }),
  7772. /* 204 */
  7773. /***/ (function(module, exports, __webpack_require__) {
  7774. /*
  7775. USAGE:
  7776. import { default as ParsableModelMixin, ParsableModelInterface } from './ParsableModelMixin'
  7777. in class:
  7778. applyProps: ParsableModelInterface['applyProps']
  7779. applyManualStandardProps: ParsableModelInterface['applyManualStandardProps']
  7780. applyMiscProps: ParsableModelInterface['applyMiscProps']
  7781. isStandardProp: ParsableModelInterface['isStandardProp']
  7782. static defineStandardProps = ParsableModelMixin.defineStandardProps
  7783. static copyVerbatimStandardProps = ParsableModelMixin.copyVerbatimStandardProps
  7784. after class:
  7785. ParsableModelMixin.mixInto(TheClass)
  7786. */
  7787. Object.defineProperty(exports, "__esModule", { value: true });
  7788. var tslib_1 = __webpack_require__(2);
  7789. var util_1 = __webpack_require__(4);
  7790. var Mixin_1 = __webpack_require__(14);
  7791. var ParsableModelMixin = /** @class */ (function (_super) {
  7792. tslib_1.__extends(ParsableModelMixin, _super);
  7793. function ParsableModelMixin() {
  7794. return _super !== null && _super.apply(this, arguments) || this;
  7795. }
  7796. ParsableModelMixin.defineStandardProps = function (propDefs) {
  7797. var proto = this.prototype;
  7798. if (!proto.hasOwnProperty('standardPropMap')) {
  7799. proto.standardPropMap = Object.create(proto.standardPropMap);
  7800. }
  7801. util_1.copyOwnProps(propDefs, proto.standardPropMap);
  7802. };
  7803. ParsableModelMixin.copyVerbatimStandardProps = function (src, dest) {
  7804. var map = this.prototype.standardPropMap;
  7805. var propName;
  7806. for (propName in map) {
  7807. if (src[propName] != null && // in the src object?
  7808. map[propName] === true // false means "copy verbatim"
  7809. ) {
  7810. dest[propName] = src[propName];
  7811. }
  7812. }
  7813. };
  7814. /*
  7815. Returns true/false for success.
  7816. Meant to be only called ONCE, at object creation.
  7817. */
  7818. ParsableModelMixin.prototype.applyProps = function (rawProps) {
  7819. var standardPropMap = this.standardPropMap;
  7820. var manualProps = {};
  7821. var miscProps = {};
  7822. var propName;
  7823. for (propName in rawProps) {
  7824. if (standardPropMap[propName] === true) {
  7825. this[propName] = rawProps[propName];
  7826. }
  7827. else if (standardPropMap[propName] === false) {
  7828. manualProps[propName] = rawProps[propName];
  7829. }
  7830. else {
  7831. miscProps[propName] = rawProps[propName];
  7832. }
  7833. }
  7834. this.applyMiscProps(miscProps);
  7835. return this.applyManualStandardProps(manualProps);
  7836. };
  7837. /*
  7838. If subclasses override, they must call this supermethod and return the boolean response.
  7839. Meant to be only called ONCE, at object creation.
  7840. */
  7841. ParsableModelMixin.prototype.applyManualStandardProps = function (rawProps) {
  7842. return true;
  7843. };
  7844. /*
  7845. Can be called even after initial object creation.
  7846. */
  7847. ParsableModelMixin.prototype.applyMiscProps = function (rawProps) {
  7848. // subclasses can implement
  7849. };
  7850. /*
  7851. TODO: why is this a method when defineStandardProps is static
  7852. */
  7853. ParsableModelMixin.prototype.isStandardProp = function (propName) {
  7854. return propName in this.standardPropMap;
  7855. };
  7856. return ParsableModelMixin;
  7857. }(Mixin_1.default));
  7858. exports.default = ParsableModelMixin;
  7859. ParsableModelMixin.prototype.standardPropMap = {}; // will be cloned by defineStandardProps
  7860. /***/ }),
  7861. /* 205 */
  7862. /***/ (function(module, exports) {
  7863. Object.defineProperty(exports, "__esModule", { value: true });
  7864. var EventInstance = /** @class */ (function () {
  7865. function EventInstance(def, dateProfile) {
  7866. this.def = def;
  7867. this.dateProfile = dateProfile;
  7868. }
  7869. EventInstance.prototype.toLegacy = function () {
  7870. var dateProfile = this.dateProfile;
  7871. var obj = this.def.toLegacy();
  7872. obj.start = dateProfile.start.clone();
  7873. obj.end = dateProfile.end ? dateProfile.end.clone() : null;
  7874. return obj;
  7875. };
  7876. return EventInstance;
  7877. }());
  7878. exports.default = EventInstance;
  7879. /***/ }),
  7880. /* 206 */
  7881. /***/ (function(module, exports, __webpack_require__) {
  7882. Object.defineProperty(exports, "__esModule", { value: true });
  7883. var tslib_1 = __webpack_require__(2);
  7884. var $ = __webpack_require__(3);
  7885. var moment = __webpack_require__(0);
  7886. var EventDef_1 = __webpack_require__(33);
  7887. var EventInstance_1 = __webpack_require__(205);
  7888. var EventDateProfile_1 = __webpack_require__(17);
  7889. var RecurringEventDef = /** @class */ (function (_super) {
  7890. tslib_1.__extends(RecurringEventDef, _super);
  7891. function RecurringEventDef() {
  7892. return _super !== null && _super.apply(this, arguments) || this;
  7893. }
  7894. RecurringEventDef.prototype.isAllDay = function () {
  7895. return !this.startTime && !this.endTime;
  7896. };
  7897. RecurringEventDef.prototype.buildInstances = function (unzonedRange) {
  7898. var calendar = this.source.calendar;
  7899. var unzonedDate = unzonedRange.getStart();
  7900. var unzonedEnd = unzonedRange.getEnd();
  7901. var zonedDayStart;
  7902. var instanceStart;
  7903. var instanceEnd;
  7904. var instances = [];
  7905. while (unzonedDate.isBefore(unzonedEnd)) {
  7906. // if everyday, or this particular day-of-week
  7907. if (!this.dowHash || this.dowHash[unzonedDate.day()]) {
  7908. zonedDayStart = calendar.applyTimezone(unzonedDate);
  7909. instanceStart = zonedDayStart.clone();
  7910. instanceEnd = null;
  7911. if (this.startTime) {
  7912. instanceStart.time(this.startTime);
  7913. }
  7914. else {
  7915. instanceStart.stripTime();
  7916. }
  7917. if (this.endTime) {
  7918. instanceEnd = zonedDayStart.clone().time(this.endTime);
  7919. }
  7920. instances.push(new EventInstance_1.default(this, // definition
  7921. new EventDateProfile_1.default(instanceStart, instanceEnd, calendar)));
  7922. }
  7923. unzonedDate.add(1, 'days');
  7924. }
  7925. return instances;
  7926. };
  7927. RecurringEventDef.prototype.setDow = function (dowNumbers) {
  7928. if (!this.dowHash) {
  7929. this.dowHash = {};
  7930. }
  7931. for (var i = 0; i < dowNumbers.length; i++) {
  7932. this.dowHash[dowNumbers[i]] = true;
  7933. }
  7934. };
  7935. RecurringEventDef.prototype.clone = function () {
  7936. var def = _super.prototype.clone.call(this);
  7937. if (def.startTime) {
  7938. def.startTime = moment.duration(this.startTime);
  7939. }
  7940. if (def.endTime) {
  7941. def.endTime = moment.duration(this.endTime);
  7942. }
  7943. if (this.dowHash) {
  7944. def.dowHash = $.extend({}, this.dowHash);
  7945. }
  7946. return def;
  7947. };
  7948. return RecurringEventDef;
  7949. }(EventDef_1.default));
  7950. exports.default = RecurringEventDef;
  7951. /*
  7952. HACK to work with TypeScript mixins
  7953. NOTE: if super-method fails, should still attempt to apply
  7954. */
  7955. RecurringEventDef.prototype.applyProps = function (rawProps) {
  7956. var superSuccess = EventDef_1.default.prototype.applyProps.call(this, rawProps);
  7957. if (rawProps.start) {
  7958. this.startTime = moment.duration(rawProps.start);
  7959. }
  7960. if (rawProps.end) {
  7961. this.endTime = moment.duration(rawProps.end);
  7962. }
  7963. if (rawProps.dow) {
  7964. this.setDow(rawProps.dow);
  7965. }
  7966. return superSuccess;
  7967. };
  7968. // Parsing
  7969. // ---------------------------------------------------------------------------------------------------------------------
  7970. RecurringEventDef.defineStandardProps({
  7971. start: false,
  7972. end: false,
  7973. dow: false
  7974. });
  7975. /***/ }),
  7976. /* 207 */
  7977. /***/ (function(module, exports) {
  7978. Object.defineProperty(exports, "__esModule", { value: true });
  7979. var EventRange = /** @class */ (function () {
  7980. function EventRange(unzonedRange, eventDef, eventInstance) {
  7981. this.unzonedRange = unzonedRange;
  7982. this.eventDef = eventDef;
  7983. if (eventInstance) {
  7984. this.eventInstance = eventInstance;
  7985. }
  7986. }
  7987. return EventRange;
  7988. }());
  7989. exports.default = EventRange;
  7990. /***/ }),
  7991. /* 208 */
  7992. /***/ (function(module, exports, __webpack_require__) {
  7993. Object.defineProperty(exports, "__esModule", { value: true });
  7994. var $ = __webpack_require__(3);
  7995. var util_1 = __webpack_require__(34);
  7996. var EventInstanceGroup_1 = __webpack_require__(18);
  7997. var RecurringEventDef_1 = __webpack_require__(206);
  7998. var EventSource_1 = __webpack_require__(6);
  7999. var BUSINESS_HOUR_EVENT_DEFAULTS = {
  8000. start: '09:00',
  8001. end: '17:00',
  8002. dow: [1, 2, 3, 4, 5],
  8003. rendering: 'inverse-background'
  8004. // classNames are defined in businessHoursSegClasses
  8005. };
  8006. var BusinessHourGenerator = /** @class */ (function () {
  8007. function BusinessHourGenerator(rawComplexDef, calendar) {
  8008. this.rawComplexDef = rawComplexDef;
  8009. this.calendar = calendar;
  8010. }
  8011. BusinessHourGenerator.prototype.buildEventInstanceGroup = function (isAllDay, unzonedRange) {
  8012. var eventDefs = this.buildEventDefs(isAllDay);
  8013. var eventInstanceGroup;
  8014. if (eventDefs.length) {
  8015. eventInstanceGroup = new EventInstanceGroup_1.default(util_1.eventDefsToEventInstances(eventDefs, unzonedRange));
  8016. // so that inverse-background rendering can happen even when no eventRanges in view
  8017. eventInstanceGroup.explicitEventDef = eventDefs[0];
  8018. return eventInstanceGroup;
  8019. }
  8020. };
  8021. BusinessHourGenerator.prototype.buildEventDefs = function (isAllDay) {
  8022. var rawComplexDef = this.rawComplexDef;
  8023. var rawDefs = [];
  8024. var requireDow = false;
  8025. var i;
  8026. var defs = [];
  8027. if (rawComplexDef === true) {
  8028. rawDefs = [{}]; // will get BUSINESS_HOUR_EVENT_DEFAULTS verbatim
  8029. }
  8030. else if ($.isPlainObject(rawComplexDef)) {
  8031. rawDefs = [rawComplexDef];
  8032. }
  8033. else if ($.isArray(rawComplexDef)) {
  8034. rawDefs = rawComplexDef;
  8035. requireDow = true; // every sub-definition NEEDS a day-of-week
  8036. }
  8037. for (i = 0; i < rawDefs.length; i++) {
  8038. if (!requireDow || rawDefs[i].dow) {
  8039. defs.push(this.buildEventDef(isAllDay, rawDefs[i]));
  8040. }
  8041. }
  8042. return defs;
  8043. };
  8044. BusinessHourGenerator.prototype.buildEventDef = function (isAllDay, rawDef) {
  8045. var fullRawDef = $.extend({}, BUSINESS_HOUR_EVENT_DEFAULTS, rawDef);
  8046. if (isAllDay) {
  8047. fullRawDef.start = null;
  8048. fullRawDef.end = null;
  8049. }
  8050. return RecurringEventDef_1.default.parse(fullRawDef, new EventSource_1.default(this.calendar) // dummy source
  8051. );
  8052. };
  8053. return BusinessHourGenerator;
  8054. }());
  8055. exports.default = BusinessHourGenerator;
  8056. /***/ }),
  8057. /* 209 */
  8058. /***/ (function(module, exports, __webpack_require__) {
  8059. Object.defineProperty(exports, "__esModule", { value: true });
  8060. var tslib_1 = __webpack_require__(2);
  8061. var Theme_1 = __webpack_require__(38);
  8062. var StandardTheme = /** @class */ (function (_super) {
  8063. tslib_1.__extends(StandardTheme, _super);
  8064. function StandardTheme() {
  8065. return _super !== null && _super.apply(this, arguments) || this;
  8066. }
  8067. return StandardTheme;
  8068. }(Theme_1.default));
  8069. exports.default = StandardTheme;
  8070. StandardTheme.prototype.classes = {
  8071. widget: 'fc-unthemed',
  8072. widgetHeader: 'fc-widget-header',
  8073. widgetContent: 'fc-widget-content',
  8074. buttonGroup: 'fc-button-group',
  8075. button: 'fc-button',
  8076. cornerLeft: 'fc-corner-left',
  8077. cornerRight: 'fc-corner-right',
  8078. stateDefault: 'fc-state-default',
  8079. stateActive: 'fc-state-active',
  8080. stateDisabled: 'fc-state-disabled',
  8081. stateHover: 'fc-state-hover',
  8082. stateDown: 'fc-state-down',
  8083. popoverHeader: 'fc-widget-header',
  8084. popoverContent: 'fc-widget-content',
  8085. // day grid
  8086. headerRow: 'fc-widget-header',
  8087. dayRow: 'fc-widget-content',
  8088. // list view
  8089. listView: 'fc-widget-content'
  8090. };
  8091. StandardTheme.prototype.baseIconClass = 'fc-icon';
  8092. StandardTheme.prototype.iconClasses = {
  8093. close: 'fc-icon-x',
  8094. prev: 'fc-icon-left-single-arrow',
  8095. next: 'fc-icon-right-single-arrow',
  8096. prevYear: 'fc-icon-left-double-arrow',
  8097. nextYear: 'fc-icon-right-double-arrow'
  8098. };
  8099. StandardTheme.prototype.iconOverrideOption = 'buttonIcons';
  8100. StandardTheme.prototype.iconOverrideCustomButtonOption = 'icon';
  8101. StandardTheme.prototype.iconOverridePrefix = 'fc-icon-';
  8102. /***/ }),
  8103. /* 210 */
  8104. /***/ (function(module, exports, __webpack_require__) {
  8105. Object.defineProperty(exports, "__esModule", { value: true });
  8106. var tslib_1 = __webpack_require__(2);
  8107. var Theme_1 = __webpack_require__(38);
  8108. var JqueryUiTheme = /** @class */ (function (_super) {
  8109. tslib_1.__extends(JqueryUiTheme, _super);
  8110. function JqueryUiTheme() {
  8111. return _super !== null && _super.apply(this, arguments) || this;
  8112. }
  8113. return JqueryUiTheme;
  8114. }(Theme_1.default));
  8115. exports.default = JqueryUiTheme;
  8116. JqueryUiTheme.prototype.classes = {
  8117. widget: 'ui-widget',
  8118. widgetHeader: 'ui-widget-header',
  8119. widgetContent: 'ui-widget-content',
  8120. buttonGroup: 'fc-button-group',
  8121. button: 'ui-button',
  8122. cornerLeft: 'ui-corner-left',
  8123. cornerRight: 'ui-corner-right',
  8124. stateDefault: 'ui-state-default',
  8125. stateActive: 'ui-state-active',
  8126. stateDisabled: 'ui-state-disabled',
  8127. stateHover: 'ui-state-hover',
  8128. stateDown: 'ui-state-down',
  8129. today: 'ui-state-highlight',
  8130. popoverHeader: 'ui-widget-header',
  8131. popoverContent: 'ui-widget-content',
  8132. // day grid
  8133. headerRow: 'ui-widget-header',
  8134. dayRow: 'ui-widget-content',
  8135. // list view
  8136. listView: 'ui-widget-content'
  8137. };
  8138. JqueryUiTheme.prototype.baseIconClass = 'ui-icon';
  8139. JqueryUiTheme.prototype.iconClasses = {
  8140. close: 'ui-icon-closethick',
  8141. prev: 'ui-icon-circle-triangle-w',
  8142. next: 'ui-icon-circle-triangle-e',
  8143. prevYear: 'ui-icon-seek-prev',
  8144. nextYear: 'ui-icon-seek-next'
  8145. };
  8146. JqueryUiTheme.prototype.iconOverrideOption = 'themeButtonIcons';
  8147. JqueryUiTheme.prototype.iconOverrideCustomButtonOption = 'themeIcon';
  8148. JqueryUiTheme.prototype.iconOverridePrefix = 'ui-icon-';
  8149. /***/ }),
  8150. /* 211 */
  8151. /***/ (function(module, exports, __webpack_require__) {
  8152. Object.defineProperty(exports, "__esModule", { value: true });
  8153. var tslib_1 = __webpack_require__(2);
  8154. var $ = __webpack_require__(3);
  8155. var Promise_1 = __webpack_require__(19);
  8156. var EventSource_1 = __webpack_require__(6);
  8157. var FuncEventSource = /** @class */ (function (_super) {
  8158. tslib_1.__extends(FuncEventSource, _super);
  8159. function FuncEventSource() {
  8160. return _super !== null && _super.apply(this, arguments) || this;
  8161. }
  8162. FuncEventSource.parse = function (rawInput, calendar) {
  8163. var rawProps;
  8164. // normalize raw input
  8165. if ($.isFunction(rawInput.events)) {
  8166. rawProps = rawInput;
  8167. }
  8168. else if ($.isFunction(rawInput)) {
  8169. rawProps = { events: rawInput };
  8170. }
  8171. if (rawProps) {
  8172. return EventSource_1.default.parse.call(this, rawProps, calendar);
  8173. }
  8174. return false;
  8175. };
  8176. FuncEventSource.prototype.fetch = function (start, end, timezone) {
  8177. var _this = this;
  8178. this.calendar.pushLoading();
  8179. return Promise_1.default.construct(function (onResolve) {
  8180. _this.func.call(_this.calendar, start.clone(), end.clone(), timezone, function (rawEventDefs) {
  8181. _this.calendar.popLoading();
  8182. onResolve(_this.parseEventDefs(rawEventDefs));
  8183. });
  8184. });
  8185. };
  8186. FuncEventSource.prototype.getPrimitive = function () {
  8187. return this.func;
  8188. };
  8189. FuncEventSource.prototype.applyManualStandardProps = function (rawProps) {
  8190. var superSuccess = _super.prototype.applyManualStandardProps.call(this, rawProps);
  8191. this.func = rawProps.events;
  8192. return superSuccess;
  8193. };
  8194. return FuncEventSource;
  8195. }(EventSource_1.default));
  8196. exports.default = FuncEventSource;
  8197. FuncEventSource.defineStandardProps({
  8198. events: false // don't automatically transfer
  8199. });
  8200. /***/ }),
  8201. /* 212 */
  8202. /***/ (function(module, exports, __webpack_require__) {
  8203. Object.defineProperty(exports, "__esModule", { value: true });
  8204. var tslib_1 = __webpack_require__(2);
  8205. var $ = __webpack_require__(3);
  8206. var util_1 = __webpack_require__(4);
  8207. var Promise_1 = __webpack_require__(19);
  8208. var EventSource_1 = __webpack_require__(6);
  8209. var JsonFeedEventSource = /** @class */ (function (_super) {
  8210. tslib_1.__extends(JsonFeedEventSource, _super);
  8211. function JsonFeedEventSource() {
  8212. return _super !== null && _super.apply(this, arguments) || this;
  8213. }
  8214. JsonFeedEventSource.parse = function (rawInput, calendar) {
  8215. var rawProps;
  8216. // normalize raw input
  8217. if (typeof rawInput.url === 'string') {
  8218. rawProps = rawInput;
  8219. }
  8220. else if (typeof rawInput === 'string') {
  8221. rawProps = { url: rawInput };
  8222. }
  8223. if (rawProps) {
  8224. return EventSource_1.default.parse.call(this, rawProps, calendar);
  8225. }
  8226. return false;
  8227. };
  8228. JsonFeedEventSource.prototype.fetch = function (start, end, timezone) {
  8229. var _this = this;
  8230. var ajaxSettings = this.ajaxSettings;
  8231. var onSuccess = ajaxSettings.success;
  8232. var onError = ajaxSettings.error;
  8233. var requestParams = this.buildRequestParams(start, end, timezone);
  8234. // todo: eventually handle the promise's then,
  8235. // don't intercept success/error
  8236. // tho will be a breaking API change
  8237. this.calendar.pushLoading();
  8238. return Promise_1.default.construct(function (onResolve, onReject) {
  8239. $.ajax($.extend({}, // destination
  8240. JsonFeedEventSource.AJAX_DEFAULTS, ajaxSettings, {
  8241. url: _this.url,
  8242. data: requestParams,
  8243. success: function (rawEventDefs, status, xhr) {
  8244. var callbackRes;
  8245. _this.calendar.popLoading();
  8246. if (rawEventDefs) {
  8247. callbackRes = util_1.applyAll(onSuccess, _this, [rawEventDefs, status, xhr]); // redirect `this`
  8248. if ($.isArray(callbackRes)) {
  8249. rawEventDefs = callbackRes;
  8250. }
  8251. onResolve(_this.parseEventDefs(rawEventDefs));
  8252. }
  8253. else {
  8254. onReject();
  8255. }
  8256. },
  8257. error: function (xhr, statusText, errorThrown) {
  8258. _this.calendar.popLoading();
  8259. util_1.applyAll(onError, _this, [xhr, statusText, errorThrown]); // redirect `this`
  8260. onReject();
  8261. }
  8262. }));
  8263. });
  8264. };
  8265. JsonFeedEventSource.prototype.buildRequestParams = function (start, end, timezone) {
  8266. var calendar = this.calendar;
  8267. var ajaxSettings = this.ajaxSettings;
  8268. var startParam;
  8269. var endParam;
  8270. var timezoneParam;
  8271. var customRequestParams;
  8272. var params = {};
  8273. startParam = this.startParam;
  8274. if (startParam == null) {
  8275. startParam = calendar.opt('startParam');
  8276. }
  8277. endParam = this.endParam;
  8278. if (endParam == null) {
  8279. endParam = calendar.opt('endParam');
  8280. }
  8281. timezoneParam = this.timezoneParam;
  8282. if (timezoneParam == null) {
  8283. timezoneParam = calendar.opt('timezoneParam');
  8284. }
  8285. // retrieve any outbound GET/POST $.ajax data from the options
  8286. if ($.isFunction(ajaxSettings.data)) {
  8287. // supplied as a function that returns a key/value object
  8288. customRequestParams = ajaxSettings.data();
  8289. }
  8290. else {
  8291. // probably supplied as a straight key/value object
  8292. customRequestParams = ajaxSettings.data || {};
  8293. }
  8294. $.extend(params, customRequestParams);
  8295. params[startParam] = start.format();
  8296. params[endParam] = end.format();
  8297. if (timezone && timezone !== 'local') {
  8298. params[timezoneParam] = timezone;
  8299. }
  8300. return params;
  8301. };
  8302. JsonFeedEventSource.prototype.getPrimitive = function () {
  8303. return this.url;
  8304. };
  8305. JsonFeedEventSource.prototype.applyMiscProps = function (rawProps) {
  8306. this.ajaxSettings = rawProps;
  8307. };
  8308. JsonFeedEventSource.AJAX_DEFAULTS = {
  8309. dataType: 'json',
  8310. cache: false
  8311. };
  8312. return JsonFeedEventSource;
  8313. }(EventSource_1.default));
  8314. exports.default = JsonFeedEventSource;
  8315. JsonFeedEventSource.defineStandardProps({
  8316. // automatically transfer (true)...
  8317. url: true,
  8318. startParam: true,
  8319. endParam: true,
  8320. timezoneParam: true
  8321. });
  8322. /***/ }),
  8323. /* 213 */
  8324. /***/ (function(module, exports, __webpack_require__) {
  8325. Object.defineProperty(exports, "__esModule", { value: true });
  8326. var EmitterMixin_1 = __webpack_require__(11);
  8327. var TaskQueue = /** @class */ (function () {
  8328. function TaskQueue() {
  8329. this.q = [];
  8330. this.isPaused = false;
  8331. this.isRunning = false;
  8332. }
  8333. TaskQueue.prototype.queue = function () {
  8334. var args = [];
  8335. for (var _i = 0; _i < arguments.length; _i++) {
  8336. args[_i] = arguments[_i];
  8337. }
  8338. this.q.push.apply(this.q, args); // append
  8339. this.tryStart();
  8340. };
  8341. TaskQueue.prototype.pause = function () {
  8342. this.isPaused = true;
  8343. };
  8344. TaskQueue.prototype.resume = function () {
  8345. this.isPaused = false;
  8346. this.tryStart();
  8347. };
  8348. TaskQueue.prototype.getIsIdle = function () {
  8349. return !this.isRunning && !this.isPaused;
  8350. };
  8351. TaskQueue.prototype.tryStart = function () {
  8352. if (!this.isRunning && this.canRunNext()) {
  8353. this.isRunning = true;
  8354. this.trigger('start');
  8355. this.runRemaining();
  8356. }
  8357. };
  8358. TaskQueue.prototype.canRunNext = function () {
  8359. return !this.isPaused && this.q.length;
  8360. };
  8361. TaskQueue.prototype.runRemaining = function () {
  8362. var _this = this;
  8363. var task;
  8364. var res;
  8365. do {
  8366. task = this.q.shift(); // always freshly reference q. might have been reassigned.
  8367. res = this.runTask(task);
  8368. if (res && res.then) {
  8369. res.then(function () {
  8370. if (_this.canRunNext()) {
  8371. _this.runRemaining();
  8372. }
  8373. });
  8374. return; // prevent marking as stopped
  8375. }
  8376. } while (this.canRunNext());
  8377. this.trigger('stop'); // not really a 'stop' ... more of a 'drained'
  8378. this.isRunning = false;
  8379. // if 'stop' handler added more tasks.... TODO: write test for this
  8380. this.tryStart();
  8381. };
  8382. TaskQueue.prototype.runTask = function (task) {
  8383. return task(); // task *is* the function, but subclasses can change the format of a task
  8384. };
  8385. return TaskQueue;
  8386. }());
  8387. exports.default = TaskQueue;
  8388. EmitterMixin_1.default.mixInto(TaskQueue);
  8389. /***/ }),
  8390. /* 214 */
  8391. /***/ (function(module, exports, __webpack_require__) {
  8392. Object.defineProperty(exports, "__esModule", { value: true });
  8393. var tslib_1 = __webpack_require__(2);
  8394. var TaskQueue_1 = __webpack_require__(213);
  8395. var RenderQueue = /** @class */ (function (_super) {
  8396. tslib_1.__extends(RenderQueue, _super);
  8397. function RenderQueue(waitsByNamespace) {
  8398. var _this = _super.call(this) || this;
  8399. _this.waitsByNamespace = waitsByNamespace || {};
  8400. return _this;
  8401. }
  8402. RenderQueue.prototype.queue = function (taskFunc, namespace, type) {
  8403. var task = {
  8404. func: taskFunc,
  8405. namespace: namespace,
  8406. type: type
  8407. };
  8408. var waitMs;
  8409. if (namespace) {
  8410. waitMs = this.waitsByNamespace[namespace];
  8411. }
  8412. if (this.waitNamespace) {
  8413. if (namespace === this.waitNamespace && waitMs != null) {
  8414. this.delayWait(waitMs);
  8415. }
  8416. else {
  8417. this.clearWait();
  8418. this.tryStart();
  8419. }
  8420. }
  8421. if (this.compoundTask(task)) {
  8422. if (!this.waitNamespace && waitMs != null) {
  8423. this.startWait(namespace, waitMs);
  8424. }
  8425. else {
  8426. this.tryStart();
  8427. }
  8428. }
  8429. };
  8430. RenderQueue.prototype.startWait = function (namespace, waitMs) {
  8431. this.waitNamespace = namespace;
  8432. this.spawnWait(waitMs);
  8433. };
  8434. RenderQueue.prototype.delayWait = function (waitMs) {
  8435. clearTimeout(this.waitId);
  8436. this.spawnWait(waitMs);
  8437. };
  8438. RenderQueue.prototype.spawnWait = function (waitMs) {
  8439. var _this = this;
  8440. this.waitId = setTimeout(function () {
  8441. _this.waitNamespace = null;
  8442. _this.tryStart();
  8443. }, waitMs);
  8444. };
  8445. RenderQueue.prototype.clearWait = function () {
  8446. if (this.waitNamespace) {
  8447. clearTimeout(this.waitId);
  8448. this.waitId = null;
  8449. this.waitNamespace = null;
  8450. }
  8451. };
  8452. RenderQueue.prototype.canRunNext = function () {
  8453. if (!_super.prototype.canRunNext.call(this)) {
  8454. return false;
  8455. }
  8456. // waiting for a certain namespace to stop receiving tasks?
  8457. if (this.waitNamespace) {
  8458. var q = this.q;
  8459. // if there was a different namespace task in the meantime,
  8460. // that forces all previously-waiting tasks to suddenly execute.
  8461. // TODO: find a way to do this in constant time.
  8462. for (var i = 0; i < q.length; i++) {
  8463. if (q[i].namespace !== this.waitNamespace) {
  8464. return true; // allow execution
  8465. }
  8466. }
  8467. return false;
  8468. }
  8469. return true;
  8470. };
  8471. RenderQueue.prototype.runTask = function (task) {
  8472. task.func();
  8473. };
  8474. RenderQueue.prototype.compoundTask = function (newTask) {
  8475. var q = this.q;
  8476. var shouldAppend = true;
  8477. var i;
  8478. var task;
  8479. if (newTask.namespace && newTask.type === 'destroy') {
  8480. // remove all init/add/remove ops with same namespace, regardless of order
  8481. for (i = q.length - 1; i >= 0; i--) {
  8482. task = q[i];
  8483. switch (task.type) {
  8484. case 'init':
  8485. shouldAppend = false;
  8486. // the latest destroy is cancelled out by not doing the init
  8487. /* falls through */
  8488. case 'add':
  8489. /* falls through */
  8490. case 'remove':
  8491. q.splice(i, 1); // remove task
  8492. }
  8493. }
  8494. }
  8495. if (shouldAppend) {
  8496. q.push(newTask);
  8497. }
  8498. return shouldAppend;
  8499. };
  8500. return RenderQueue;
  8501. }(TaskQueue_1.default));
  8502. exports.default = RenderQueue;
  8503. /***/ }),
  8504. /* 215 */
  8505. /***/ (function(module, exports, __webpack_require__) {
  8506. Object.defineProperty(exports, "__esModule", { value: true });
  8507. var tslib_1 = __webpack_require__(2);
  8508. var $ = __webpack_require__(3);
  8509. var moment = __webpack_require__(0);
  8510. var util_1 = __webpack_require__(4);
  8511. var moment_ext_1 = __webpack_require__(10);
  8512. var date_formatting_1 = __webpack_require__(47);
  8513. var Component_1 = __webpack_require__(233);
  8514. var util_2 = __webpack_require__(34);
  8515. var DateComponent = /** @class */ (function (_super) {
  8516. tslib_1.__extends(DateComponent, _super);
  8517. function DateComponent(_view, _options) {
  8518. var _this = _super.call(this) || this;
  8519. _this.isRTL = false; // frequently accessed options
  8520. _this.hitsNeededDepth = 0; // necessary because multiple callers might need the same hits
  8521. _this.hasAllDayBusinessHours = false; // TODO: unify with largeUnit and isTimeScale?
  8522. _this.isDatesRendered = false;
  8523. // hack to set options prior to the this.opt calls
  8524. if (_view) {
  8525. _this['view'] = _view;
  8526. }
  8527. if (_options) {
  8528. _this['options'] = _options;
  8529. }
  8530. _this.uid = String(DateComponent.guid++);
  8531. _this.childrenByUid = {};
  8532. _this.nextDayThreshold = moment.duration(_this.opt('nextDayThreshold'));
  8533. _this.isRTL = _this.opt('isRTL');
  8534. if (_this.fillRendererClass) {
  8535. _this.fillRenderer = new _this.fillRendererClass(_this);
  8536. }
  8537. if (_this.eventRendererClass) {
  8538. _this.eventRenderer = new _this.eventRendererClass(_this, _this.fillRenderer);
  8539. }
  8540. if (_this.helperRendererClass && _this.eventRenderer) {
  8541. _this.helperRenderer = new _this.helperRendererClass(_this, _this.eventRenderer);
  8542. }
  8543. if (_this.businessHourRendererClass && _this.fillRenderer) {
  8544. _this.businessHourRenderer = new _this.businessHourRendererClass(_this, _this.fillRenderer);
  8545. }
  8546. return _this;
  8547. }
  8548. DateComponent.prototype.addChild = function (child) {
  8549. if (!this.childrenByUid[child.uid]) {
  8550. this.childrenByUid[child.uid] = child;
  8551. return true;
  8552. }
  8553. return false;
  8554. };
  8555. DateComponent.prototype.removeChild = function (child) {
  8556. if (this.childrenByUid[child.uid]) {
  8557. delete this.childrenByUid[child.uid];
  8558. return true;
  8559. }
  8560. return false;
  8561. };
  8562. // TODO: only do if isInDom?
  8563. // TODO: make part of Component, along with children/batch-render system?
  8564. DateComponent.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  8565. this.callChildren('updateSize', arguments);
  8566. };
  8567. // Options
  8568. // -----------------------------------------------------------------------------------------------------------------
  8569. DateComponent.prototype.opt = function (name) {
  8570. return this._getView().opt(name); // default implementation
  8571. };
  8572. DateComponent.prototype.publiclyTrigger = function () {
  8573. var args = [];
  8574. for (var _i = 0; _i < arguments.length; _i++) {
  8575. args[_i] = arguments[_i];
  8576. }
  8577. var calendar = this._getCalendar();
  8578. return calendar.publiclyTrigger.apply(calendar, args);
  8579. };
  8580. DateComponent.prototype.hasPublicHandlers = function () {
  8581. var args = [];
  8582. for (var _i = 0; _i < arguments.length; _i++) {
  8583. args[_i] = arguments[_i];
  8584. }
  8585. var calendar = this._getCalendar();
  8586. return calendar.hasPublicHandlers.apply(calendar, args);
  8587. };
  8588. // Date
  8589. // -----------------------------------------------------------------------------------------------------------------
  8590. DateComponent.prototype.executeDateRender = function (dateProfile) {
  8591. this.dateProfile = dateProfile; // for rendering
  8592. this.renderDates(dateProfile);
  8593. this.isDatesRendered = true;
  8594. this.callChildren('executeDateRender', arguments);
  8595. };
  8596. DateComponent.prototype.executeDateUnrender = function () {
  8597. this.callChildren('executeDateUnrender', arguments);
  8598. this.dateProfile = null;
  8599. this.unrenderDates();
  8600. this.isDatesRendered = false;
  8601. };
  8602. // date-cell content only
  8603. DateComponent.prototype.renderDates = function (dateProfile) {
  8604. // subclasses should implement
  8605. };
  8606. // date-cell content only
  8607. DateComponent.prototype.unrenderDates = function () {
  8608. // subclasses should override
  8609. };
  8610. // Now-Indicator
  8611. // -----------------------------------------------------------------------------------------------------------------
  8612. // Returns a string unit, like 'second' or 'minute' that defined how often the current time indicator
  8613. // should be refreshed. If something falsy is returned, no time indicator is rendered at all.
  8614. DateComponent.prototype.getNowIndicatorUnit = function () {
  8615. // subclasses should implement
  8616. };
  8617. // Renders a current time indicator at the given datetime
  8618. DateComponent.prototype.renderNowIndicator = function (date) {
  8619. this.callChildren('renderNowIndicator', arguments);
  8620. };
  8621. // Undoes the rendering actions from renderNowIndicator
  8622. DateComponent.prototype.unrenderNowIndicator = function () {
  8623. this.callChildren('unrenderNowIndicator', arguments);
  8624. };
  8625. // Business Hours
  8626. // ---------------------------------------------------------------------------------------------------------------
  8627. DateComponent.prototype.renderBusinessHours = function (businessHourGenerator) {
  8628. if (this.businessHourRenderer) {
  8629. this.businessHourRenderer.render(businessHourGenerator);
  8630. }
  8631. this.callChildren('renderBusinessHours', arguments);
  8632. };
  8633. // Unrenders previously-rendered business-hours
  8634. DateComponent.prototype.unrenderBusinessHours = function () {
  8635. this.callChildren('unrenderBusinessHours', arguments);
  8636. if (this.businessHourRenderer) {
  8637. this.businessHourRenderer.unrender();
  8638. }
  8639. };
  8640. // Event Displaying
  8641. // -----------------------------------------------------------------------------------------------------------------
  8642. DateComponent.prototype.executeEventRender = function (eventsPayload) {
  8643. if (this.eventRenderer) {
  8644. this.eventRenderer.rangeUpdated(); // poorly named now
  8645. this.eventRenderer.render(eventsPayload);
  8646. }
  8647. else if (this['renderEvents']) {
  8648. this['renderEvents'](convertEventsPayloadToLegacyArray(eventsPayload));
  8649. }
  8650. this.callChildren('executeEventRender', arguments);
  8651. };
  8652. DateComponent.prototype.executeEventUnrender = function () {
  8653. this.callChildren('executeEventUnrender', arguments);
  8654. if (this.eventRenderer) {
  8655. this.eventRenderer.unrender();
  8656. }
  8657. else if (this['destroyEvents']) {
  8658. this['destroyEvents']();
  8659. }
  8660. };
  8661. DateComponent.prototype.getBusinessHourSegs = function () {
  8662. var segs = this.getOwnBusinessHourSegs();
  8663. this.iterChildren(function (child) {
  8664. segs.push.apply(segs, child.getBusinessHourSegs());
  8665. });
  8666. return segs;
  8667. };
  8668. DateComponent.prototype.getOwnBusinessHourSegs = function () {
  8669. if (this.businessHourRenderer) {
  8670. return this.businessHourRenderer.getSegs();
  8671. }
  8672. return [];
  8673. };
  8674. DateComponent.prototype.getEventSegs = function () {
  8675. var segs = this.getOwnEventSegs();
  8676. this.iterChildren(function (child) {
  8677. segs.push.apply(segs, child.getEventSegs());
  8678. });
  8679. return segs;
  8680. };
  8681. DateComponent.prototype.getOwnEventSegs = function () {
  8682. if (this.eventRenderer) {
  8683. return this.eventRenderer.getSegs();
  8684. }
  8685. return [];
  8686. };
  8687. // Event Rendering Triggering
  8688. // -----------------------------------------------------------------------------------------------------------------
  8689. DateComponent.prototype.triggerAfterEventsRendered = function () {
  8690. this.triggerAfterEventSegsRendered(this.getEventSegs());
  8691. this.publiclyTrigger('eventAfterAllRender', {
  8692. context: this,
  8693. args: [this]
  8694. });
  8695. };
  8696. DateComponent.prototype.triggerAfterEventSegsRendered = function (segs) {
  8697. var _this = this;
  8698. // an optimization, because getEventLegacy is expensive
  8699. if (this.hasPublicHandlers('eventAfterRender')) {
  8700. segs.forEach(function (seg) {
  8701. var legacy;
  8702. if (seg.el) {
  8703. legacy = seg.footprint.getEventLegacy();
  8704. _this.publiclyTrigger('eventAfterRender', {
  8705. context: legacy,
  8706. args: [legacy, seg.el, _this]
  8707. });
  8708. }
  8709. });
  8710. }
  8711. };
  8712. DateComponent.prototype.triggerBeforeEventsDestroyed = function () {
  8713. this.triggerBeforeEventSegsDestroyed(this.getEventSegs());
  8714. };
  8715. DateComponent.prototype.triggerBeforeEventSegsDestroyed = function (segs) {
  8716. var _this = this;
  8717. if (this.hasPublicHandlers('eventDestroy')) {
  8718. segs.forEach(function (seg) {
  8719. var legacy;
  8720. if (seg.el) {
  8721. legacy = seg.footprint.getEventLegacy();
  8722. _this.publiclyTrigger('eventDestroy', {
  8723. context: legacy,
  8724. args: [legacy, seg.el, _this]
  8725. });
  8726. }
  8727. });
  8728. }
  8729. };
  8730. // Event Rendering Utils
  8731. // -----------------------------------------------------------------------------------------------------------------
  8732. // Hides all rendered event segments linked to the given event
  8733. // RECURSIVE with subcomponents
  8734. DateComponent.prototype.showEventsWithId = function (eventDefId) {
  8735. this.getEventSegs().forEach(function (seg) {
  8736. if (seg.footprint.eventDef.id === eventDefId &&
  8737. seg.el // necessary?
  8738. ) {
  8739. seg.el.css('visibility', '');
  8740. }
  8741. });
  8742. this.callChildren('showEventsWithId', arguments);
  8743. };
  8744. // Shows all rendered event segments linked to the given event
  8745. // RECURSIVE with subcomponents
  8746. DateComponent.prototype.hideEventsWithId = function (eventDefId) {
  8747. this.getEventSegs().forEach(function (seg) {
  8748. if (seg.footprint.eventDef.id === eventDefId &&
  8749. seg.el // necessary?
  8750. ) {
  8751. seg.el.css('visibility', 'hidden');
  8752. }
  8753. });
  8754. this.callChildren('hideEventsWithId', arguments);
  8755. };
  8756. // Drag-n-Drop Rendering (for both events and external elements)
  8757. // ---------------------------------------------------------------------------------------------------------------
  8758. // Renders a visual indication of a event or external-element drag over the given drop zone.
  8759. // If an external-element, seg will be `null`.
  8760. // Must return elements used for any mock events.
  8761. DateComponent.prototype.renderDrag = function (eventFootprints, seg, isTouch) {
  8762. var renderedHelper = false;
  8763. this.iterChildren(function (child) {
  8764. if (child.renderDrag(eventFootprints, seg, isTouch)) {
  8765. renderedHelper = true;
  8766. }
  8767. });
  8768. return renderedHelper;
  8769. };
  8770. // Unrenders a visual indication of an event or external-element being dragged.
  8771. DateComponent.prototype.unrenderDrag = function () {
  8772. this.callChildren('unrenderDrag', arguments);
  8773. };
  8774. // Event Resizing
  8775. // ---------------------------------------------------------------------------------------------------------------
  8776. // Renders a visual indication of an event being resized.
  8777. DateComponent.prototype.renderEventResize = function (eventFootprints, seg, isTouch) {
  8778. this.callChildren('renderEventResize', arguments);
  8779. };
  8780. // Unrenders a visual indication of an event being resized.
  8781. DateComponent.prototype.unrenderEventResize = function () {
  8782. this.callChildren('unrenderEventResize', arguments);
  8783. };
  8784. // Selection
  8785. // ---------------------------------------------------------------------------------------------------------------
  8786. // Renders a visual indication of the selection
  8787. // TODO: rename to `renderSelection` after legacy is gone
  8788. DateComponent.prototype.renderSelectionFootprint = function (componentFootprint) {
  8789. this.renderHighlight(componentFootprint);
  8790. this.callChildren('renderSelectionFootprint', arguments);
  8791. };
  8792. // Unrenders a visual indication of selection
  8793. DateComponent.prototype.unrenderSelection = function () {
  8794. this.unrenderHighlight();
  8795. this.callChildren('unrenderSelection', arguments);
  8796. };
  8797. // Highlight
  8798. // ---------------------------------------------------------------------------------------------------------------
  8799. // Renders an emphasis on the given date range. Given a span (unzoned start/end and other misc data)
  8800. DateComponent.prototype.renderHighlight = function (componentFootprint) {
  8801. if (this.fillRenderer) {
  8802. this.fillRenderer.renderFootprint('highlight', componentFootprint, {
  8803. getClasses: function () {
  8804. return ['fc-highlight'];
  8805. }
  8806. });
  8807. }
  8808. this.callChildren('renderHighlight', arguments);
  8809. };
  8810. // Unrenders the emphasis on a date range
  8811. DateComponent.prototype.unrenderHighlight = function () {
  8812. if (this.fillRenderer) {
  8813. this.fillRenderer.unrender('highlight');
  8814. }
  8815. this.callChildren('unrenderHighlight', arguments);
  8816. };
  8817. // Hit Areas
  8818. // ---------------------------------------------------------------------------------------------------------------
  8819. // just because all DateComponents support this interface
  8820. // doesn't mean they need to have their own internal coord system. they can defer to sub-components.
  8821. DateComponent.prototype.hitsNeeded = function () {
  8822. if (!(this.hitsNeededDepth++)) {
  8823. this.prepareHits();
  8824. }
  8825. this.callChildren('hitsNeeded', arguments);
  8826. };
  8827. DateComponent.prototype.hitsNotNeeded = function () {
  8828. if (this.hitsNeededDepth && !(--this.hitsNeededDepth)) {
  8829. this.releaseHits();
  8830. }
  8831. this.callChildren('hitsNotNeeded', arguments);
  8832. };
  8833. DateComponent.prototype.prepareHits = function () {
  8834. // subclasses can implement
  8835. };
  8836. DateComponent.prototype.releaseHits = function () {
  8837. // subclasses can implement
  8838. };
  8839. // Given coordinates from the topleft of the document, return data about the date-related area underneath.
  8840. // Can return an object with arbitrary properties (although top/right/left/bottom are encouraged).
  8841. // Must have a `grid` property, a reference to this current grid. TODO: avoid this
  8842. // The returned object will be processed by getHitFootprint and getHitEl.
  8843. DateComponent.prototype.queryHit = function (leftOffset, topOffset) {
  8844. var childrenByUid = this.childrenByUid;
  8845. var uid;
  8846. var hit;
  8847. for (uid in childrenByUid) {
  8848. hit = childrenByUid[uid].queryHit(leftOffset, topOffset);
  8849. if (hit) {
  8850. break;
  8851. }
  8852. }
  8853. return hit;
  8854. };
  8855. DateComponent.prototype.getSafeHitFootprint = function (hit) {
  8856. var footprint = this.getHitFootprint(hit);
  8857. if (!this.dateProfile.activeUnzonedRange.containsRange(footprint.unzonedRange)) {
  8858. return null;
  8859. }
  8860. return footprint;
  8861. };
  8862. DateComponent.prototype.getHitFootprint = function (hit) {
  8863. // what about being abstract!?
  8864. };
  8865. // Given position-level information about a date-related area within the grid,
  8866. // should return a jQuery element that best represents it. passed to dayClick callback.
  8867. DateComponent.prototype.getHitEl = function (hit) {
  8868. // what about being abstract!?
  8869. };
  8870. /* Converting eventRange -> eventFootprint
  8871. ------------------------------------------------------------------------------------------------------------------*/
  8872. DateComponent.prototype.eventRangesToEventFootprints = function (eventRanges) {
  8873. var eventFootprints = [];
  8874. var i;
  8875. for (i = 0; i < eventRanges.length; i++) {
  8876. eventFootprints.push.apply(// append
  8877. eventFootprints, this.eventRangeToEventFootprints(eventRanges[i]));
  8878. }
  8879. return eventFootprints;
  8880. };
  8881. DateComponent.prototype.eventRangeToEventFootprints = function (eventRange) {
  8882. return [util_2.eventRangeToEventFootprint(eventRange)];
  8883. };
  8884. /* Converting componentFootprint/eventFootprint -> segs
  8885. ------------------------------------------------------------------------------------------------------------------*/
  8886. DateComponent.prototype.eventFootprintsToSegs = function (eventFootprints) {
  8887. var segs = [];
  8888. var i;
  8889. for (i = 0; i < eventFootprints.length; i++) {
  8890. segs.push.apply(segs, this.eventFootprintToSegs(eventFootprints[i]));
  8891. }
  8892. return segs;
  8893. };
  8894. // Given an event's span (unzoned start/end and other misc data), and the event itself,
  8895. // slices into segments and attaches event-derived properties to them.
  8896. // eventSpan - { start, end, isStart, isEnd, otherthings... }
  8897. DateComponent.prototype.eventFootprintToSegs = function (eventFootprint) {
  8898. var unzonedRange = eventFootprint.componentFootprint.unzonedRange;
  8899. var segs;
  8900. var i;
  8901. var seg;
  8902. segs = this.componentFootprintToSegs(eventFootprint.componentFootprint);
  8903. for (i = 0; i < segs.length; i++) {
  8904. seg = segs[i];
  8905. if (!unzonedRange.isStart) {
  8906. seg.isStart = false;
  8907. }
  8908. if (!unzonedRange.isEnd) {
  8909. seg.isEnd = false;
  8910. }
  8911. seg.footprint = eventFootprint;
  8912. // TODO: rename to seg.eventFootprint
  8913. }
  8914. return segs;
  8915. };
  8916. DateComponent.prototype.componentFootprintToSegs = function (componentFootprint) {
  8917. return [];
  8918. };
  8919. // Utils
  8920. // ---------------------------------------------------------------------------------------------------------------
  8921. DateComponent.prototype.callChildren = function (methodName, args) {
  8922. this.iterChildren(function (child) {
  8923. child[methodName].apply(child, args);
  8924. });
  8925. };
  8926. DateComponent.prototype.iterChildren = function (func) {
  8927. var childrenByUid = this.childrenByUid;
  8928. var uid;
  8929. for (uid in childrenByUid) {
  8930. func(childrenByUid[uid]);
  8931. }
  8932. };
  8933. DateComponent.prototype._getCalendar = function () {
  8934. var t = this;
  8935. return t.calendar || t.view.calendar;
  8936. };
  8937. DateComponent.prototype._getView = function () {
  8938. return this.view;
  8939. };
  8940. DateComponent.prototype._getDateProfile = function () {
  8941. return this._getView().get('dateProfile');
  8942. };
  8943. // Generates HTML for an anchor to another view into the calendar.
  8944. // Will either generate an <a> tag or a non-clickable <span> tag, depending on enabled settings.
  8945. // `gotoOptions` can either be a moment input, or an object with the form:
  8946. // { date, type, forceOff }
  8947. // `type` is a view-type like "day" or "week". default value is "day".
  8948. // `attrs` and `innerHtml` are use to generate the rest of the HTML tag.
  8949. DateComponent.prototype.buildGotoAnchorHtml = function (gotoOptions, attrs, innerHtml) {
  8950. var date;
  8951. var type;
  8952. var forceOff;
  8953. var finalOptions;
  8954. if ($.isPlainObject(gotoOptions)) {
  8955. date = gotoOptions.date;
  8956. type = gotoOptions.type;
  8957. forceOff = gotoOptions.forceOff;
  8958. }
  8959. else {
  8960. date = gotoOptions; // a single moment input
  8961. }
  8962. date = moment_ext_1.default(date); // if a string, parse it
  8963. finalOptions = {
  8964. date: date.format('YYYY-MM-DD'),
  8965. type: type || 'day'
  8966. };
  8967. if (typeof attrs === 'string') {
  8968. innerHtml = attrs;
  8969. attrs = null;
  8970. }
  8971. attrs = attrs ? ' ' + util_1.attrsToStr(attrs) : ''; // will have a leading space
  8972. innerHtml = innerHtml || '';
  8973. if (!forceOff && this.opt('navLinks')) {
  8974. return '<a' + attrs +
  8975. ' data-goto="' + util_1.htmlEscape(JSON.stringify(finalOptions)) + '">' +
  8976. innerHtml +
  8977. '</a>';
  8978. }
  8979. else {
  8980. return '<span' + attrs + '>' +
  8981. innerHtml +
  8982. '</span>';
  8983. }
  8984. };
  8985. DateComponent.prototype.getAllDayHtml = function () {
  8986. return this.opt('allDayHtml') || util_1.htmlEscape(this.opt('allDayText'));
  8987. };
  8988. // Computes HTML classNames for a single-day element
  8989. DateComponent.prototype.getDayClasses = function (date, noThemeHighlight) {
  8990. var view = this._getView();
  8991. var classes = [];
  8992. var today;
  8993. if (!this.dateProfile.activeUnzonedRange.containsDate(date)) {
  8994. classes.push('fc-disabled-day'); // TODO: jQuery UI theme?
  8995. }
  8996. else {
  8997. classes.push('fc-' + util_1.dayIDs[date.day()]);
  8998. if (view.isDateInOtherMonth(date, this.dateProfile)) {
  8999. classes.push('fc-other-month');
  9000. }
  9001. today = view.calendar.getNow();
  9002. if (date.isSame(today, 'day')) {
  9003. classes.push('fc-today');
  9004. if (noThemeHighlight !== true) {
  9005. classes.push(view.calendar.theme.getClass('today'));
  9006. }
  9007. }
  9008. else if (date < today) {
  9009. classes.push('fc-past');
  9010. }
  9011. else {
  9012. classes.push('fc-future');
  9013. }
  9014. }
  9015. return classes;
  9016. };
  9017. // Utility for formatting a range. Accepts a range object, formatting string, and optional separator.
  9018. // Displays all-day ranges naturally, with an inclusive end. Takes the current isRTL into account.
  9019. // The timezones of the dates within `range` will be respected.
  9020. DateComponent.prototype.formatRange = function (range, isAllDay, formatStr, separator) {
  9021. var end = range.end;
  9022. if (isAllDay) {
  9023. end = end.clone().subtract(1); // convert to inclusive. last ms of previous day
  9024. }
  9025. return date_formatting_1.formatRange(range.start, end, formatStr, separator, this.isRTL);
  9026. };
  9027. // Compute the number of the give units in the "current" range.
  9028. // Will return a floating-point number. Won't round.
  9029. DateComponent.prototype.currentRangeAs = function (unit) {
  9030. return this._getDateProfile().currentUnzonedRange.as(unit);
  9031. };
  9032. // Returns the date range of the full days the given range visually appears to occupy.
  9033. // Returns a plain object with start/end, NOT an UnzonedRange!
  9034. DateComponent.prototype.computeDayRange = function (unzonedRange) {
  9035. var calendar = this._getCalendar();
  9036. var startDay = calendar.msToUtcMoment(unzonedRange.startMs, true); // the beginning of the day the range starts
  9037. var end = calendar.msToUtcMoment(unzonedRange.endMs);
  9038. var endTimeMS = +end.time(); // # of milliseconds into `endDay`
  9039. var endDay = end.clone().stripTime(); // the beginning of the day the range exclusively ends
  9040. // If the end time is actually inclusively part of the next day and is equal to or
  9041. // beyond the next day threshold, adjust the end to be the exclusive end of `endDay`.
  9042. // Otherwise, leaving it as inclusive will cause it to exclude `endDay`.
  9043. if (endTimeMS && endTimeMS >= this.nextDayThreshold) {
  9044. endDay.add(1, 'days');
  9045. }
  9046. // If end is within `startDay` but not past nextDayThreshold, assign the default duration of one day.
  9047. if (endDay <= startDay) {
  9048. endDay = startDay.clone().add(1, 'days');
  9049. }
  9050. return { start: startDay, end: endDay };
  9051. };
  9052. // Does the given range visually appear to occupy more than one day?
  9053. DateComponent.prototype.isMultiDayRange = function (unzonedRange) {
  9054. var dayRange = this.computeDayRange(unzonedRange);
  9055. return dayRange.end.diff(dayRange.start, 'days') > 1;
  9056. };
  9057. DateComponent.guid = 0; // TODO: better system for this?
  9058. return DateComponent;
  9059. }(Component_1.default));
  9060. exports.default = DateComponent;
  9061. // legacy
  9062. function convertEventsPayloadToLegacyArray(eventsPayload) {
  9063. var eventDefId;
  9064. var eventInstances;
  9065. var legacyEvents = [];
  9066. var i;
  9067. for (eventDefId in eventsPayload) {
  9068. eventInstances = eventsPayload[eventDefId].eventInstances;
  9069. for (i = 0; i < eventInstances.length; i++) {
  9070. legacyEvents.push(eventInstances[i].toLegacy());
  9071. }
  9072. }
  9073. return legacyEvents;
  9074. }
  9075. /***/ }),
  9076. /* 216 */
  9077. /***/ (function(module, exports, __webpack_require__) {
  9078. Object.defineProperty(exports, "__esModule", { value: true });
  9079. var $ = __webpack_require__(3);
  9080. var moment = __webpack_require__(0);
  9081. var util_1 = __webpack_require__(4);
  9082. var options_1 = __webpack_require__(31);
  9083. var Iterator_1 = __webpack_require__(234);
  9084. var GlobalEmitter_1 = __webpack_require__(20);
  9085. var EmitterMixin_1 = __webpack_require__(11);
  9086. var ListenerMixin_1 = __webpack_require__(7);
  9087. var Toolbar_1 = __webpack_require__(235);
  9088. var OptionsManager_1 = __webpack_require__(236);
  9089. var ViewSpecManager_1 = __webpack_require__(237);
  9090. var Constraints_1 = __webpack_require__(203);
  9091. var locale_1 = __webpack_require__(30);
  9092. var moment_ext_1 = __webpack_require__(10);
  9093. var UnzonedRange_1 = __webpack_require__(5);
  9094. var ComponentFootprint_1 = __webpack_require__(12);
  9095. var EventDateProfile_1 = __webpack_require__(17);
  9096. var EventManager_1 = __webpack_require__(238);
  9097. var BusinessHourGenerator_1 = __webpack_require__(208);
  9098. var EventSourceParser_1 = __webpack_require__(37);
  9099. var EventDefParser_1 = __webpack_require__(49);
  9100. var SingleEventDef_1 = __webpack_require__(13);
  9101. var EventDefMutation_1 = __webpack_require__(36);
  9102. var EventSource_1 = __webpack_require__(6);
  9103. var ThemeRegistry_1 = __webpack_require__(51);
  9104. var Calendar = /** @class */ (function () {
  9105. function Calendar(el, overrides) {
  9106. this.loadingLevel = 0; // number of simultaneous loading tasks
  9107. this.ignoreUpdateViewSize = 0;
  9108. this.freezeContentHeightDepth = 0;
  9109. // declare the current calendar instance relies on GlobalEmitter. needed for garbage collection.
  9110. // unneeded() is called in destroy.
  9111. GlobalEmitter_1.default.needed();
  9112. this.el = el;
  9113. this.viewsByType = {};
  9114. this.optionsManager = new OptionsManager_1.default(this, overrides);
  9115. this.viewSpecManager = new ViewSpecManager_1.default(this.optionsManager, this);
  9116. this.initMomentInternals(); // needs to happen after options hash initialized
  9117. this.initCurrentDate();
  9118. this.initEventManager();
  9119. this.constraints = new Constraints_1.default(this.eventManager, this);
  9120. this.constructed();
  9121. }
  9122. Calendar.prototype.constructed = function () {
  9123. // useful for monkeypatching. used?
  9124. };
  9125. Calendar.prototype.getView = function () {
  9126. return this.view;
  9127. };
  9128. Calendar.prototype.publiclyTrigger = function (name, triggerInfo) {
  9129. var optHandler = this.opt(name);
  9130. var context;
  9131. var args;
  9132. if ($.isPlainObject(triggerInfo)) {
  9133. context = triggerInfo.context;
  9134. args = triggerInfo.args;
  9135. }
  9136. else if ($.isArray(triggerInfo)) {
  9137. args = triggerInfo;
  9138. }
  9139. if (context == null) {
  9140. context = this.el[0]; // fallback context
  9141. }
  9142. if (!args) {
  9143. args = [];
  9144. }
  9145. this.triggerWith(name, context, args); // Emitter's method
  9146. if (optHandler) {
  9147. return optHandler.apply(context, args);
  9148. }
  9149. };
  9150. Calendar.prototype.hasPublicHandlers = function (name) {
  9151. return this.hasHandlers(name) ||
  9152. this.opt(name); // handler specified in options
  9153. };
  9154. // Options Public API
  9155. // -----------------------------------------------------------------------------------------------------------------
  9156. // public getter/setter
  9157. Calendar.prototype.option = function (name, value) {
  9158. var newOptionHash;
  9159. if (typeof name === 'string') {
  9160. if (value === undefined) {
  9161. return this.optionsManager.get(name);
  9162. }
  9163. else {
  9164. newOptionHash = {};
  9165. newOptionHash[name] = value;
  9166. this.optionsManager.add(newOptionHash);
  9167. }
  9168. }
  9169. else if (typeof name === 'object') {
  9170. this.optionsManager.add(name);
  9171. }
  9172. };
  9173. // private getter
  9174. Calendar.prototype.opt = function (name) {
  9175. return this.optionsManager.get(name);
  9176. };
  9177. // View
  9178. // -----------------------------------------------------------------------------------------------------------------
  9179. // Given a view name for a custom view or a standard view, creates a ready-to-go View object
  9180. Calendar.prototype.instantiateView = function (viewType) {
  9181. var spec = this.viewSpecManager.getViewSpec(viewType);
  9182. return new spec['class'](this, spec);
  9183. };
  9184. // Returns a boolean about whether the view is okay to instantiate at some point
  9185. Calendar.prototype.isValidViewType = function (viewType) {
  9186. return Boolean(this.viewSpecManager.getViewSpec(viewType));
  9187. };
  9188. Calendar.prototype.changeView = function (viewName, dateOrRange) {
  9189. if (dateOrRange) {
  9190. if (dateOrRange.start && dateOrRange.end) {
  9191. this.optionsManager.recordOverrides({
  9192. visibleRange: dateOrRange
  9193. });
  9194. }
  9195. else {
  9196. this.currentDate = this.moment(dateOrRange).stripZone(); // just like gotoDate
  9197. }
  9198. }
  9199. this.renderView(viewName);
  9200. };
  9201. // Forces navigation to a view for the given date.
  9202. // `viewType` can be a specific view name or a generic one like "week" or "day".
  9203. Calendar.prototype.zoomTo = function (newDate, viewType) {
  9204. var spec;
  9205. viewType = viewType || 'day'; // day is default zoom
  9206. spec = this.viewSpecManager.getViewSpec(viewType) ||
  9207. this.viewSpecManager.getUnitViewSpec(viewType);
  9208. this.currentDate = newDate.clone();
  9209. this.renderView(spec ? spec.type : null);
  9210. };
  9211. // Current Date
  9212. // -----------------------------------------------------------------------------------------------------------------
  9213. Calendar.prototype.initCurrentDate = function () {
  9214. var defaultDateInput = this.opt('defaultDate');
  9215. // compute the initial ambig-timezone date
  9216. if (defaultDateInput != null) {
  9217. this.currentDate = this.moment(defaultDateInput).stripZone();
  9218. }
  9219. else {
  9220. this.currentDate = this.getNow(); // getNow already returns unzoned
  9221. }
  9222. };
  9223. Calendar.prototype.prev = function () {
  9224. var view = this.view;
  9225. var prevInfo = view.dateProfileGenerator.buildPrev(view.get('dateProfile'));
  9226. if (prevInfo.isValid) {
  9227. this.currentDate = prevInfo.date;
  9228. this.renderView();
  9229. }
  9230. };
  9231. Calendar.prototype.next = function () {
  9232. var view = this.view;
  9233. var nextInfo = view.dateProfileGenerator.buildNext(view.get('dateProfile'));
  9234. if (nextInfo.isValid) {
  9235. this.currentDate = nextInfo.date;
  9236. this.renderView();
  9237. }
  9238. };
  9239. Calendar.prototype.prevYear = function () {
  9240. this.currentDate.add(-1, 'years');
  9241. this.renderView();
  9242. };
  9243. Calendar.prototype.nextYear = function () {
  9244. this.currentDate.add(1, 'years');
  9245. this.renderView();
  9246. };
  9247. Calendar.prototype.today = function () {
  9248. this.currentDate = this.getNow(); // should deny like prev/next?
  9249. this.renderView();
  9250. };
  9251. Calendar.prototype.gotoDate = function (zonedDateInput) {
  9252. this.currentDate = this.moment(zonedDateInput).stripZone();
  9253. this.renderView();
  9254. };
  9255. Calendar.prototype.incrementDate = function (delta) {
  9256. this.currentDate.add(moment.duration(delta));
  9257. this.renderView();
  9258. };
  9259. // for external API
  9260. Calendar.prototype.getDate = function () {
  9261. return this.applyTimezone(this.currentDate); // infuse the calendar's timezone
  9262. };
  9263. // Loading Triggering
  9264. // -----------------------------------------------------------------------------------------------------------------
  9265. // Should be called when any type of async data fetching begins
  9266. Calendar.prototype.pushLoading = function () {
  9267. if (!(this.loadingLevel++)) {
  9268. this.publiclyTrigger('loading', [true, this.view]);
  9269. }
  9270. };
  9271. // Should be called when any type of async data fetching completes
  9272. Calendar.prototype.popLoading = function () {
  9273. if (!(--this.loadingLevel)) {
  9274. this.publiclyTrigger('loading', [false, this.view]);
  9275. }
  9276. };
  9277. // High-level Rendering
  9278. // -----------------------------------------------------------------------------------
  9279. Calendar.prototype.render = function () {
  9280. if (!this.contentEl) {
  9281. this.initialRender();
  9282. }
  9283. else if (this.elementVisible()) {
  9284. // mainly for the public API
  9285. this.calcSize();
  9286. this.updateViewSize();
  9287. }
  9288. };
  9289. Calendar.prototype.initialRender = function () {
  9290. var _this = this;
  9291. var el = this.el;
  9292. el.addClass('fc');
  9293. // event delegation for nav links
  9294. el.on('click.fc', 'a[data-goto]', function (ev) {
  9295. var anchorEl = $(ev.currentTarget);
  9296. var gotoOptions = anchorEl.data('goto'); // will automatically parse JSON
  9297. var date = _this.moment(gotoOptions.date);
  9298. var viewType = gotoOptions.type;
  9299. // property like "navLinkDayClick". might be a string or a function
  9300. var customAction = _this.view.opt('navLink' + util_1.capitaliseFirstLetter(viewType) + 'Click');
  9301. if (typeof customAction === 'function') {
  9302. customAction(date, ev);
  9303. }
  9304. else {
  9305. if (typeof customAction === 'string') {
  9306. viewType = customAction;
  9307. }
  9308. _this.zoomTo(date, viewType);
  9309. }
  9310. });
  9311. // called immediately, and upon option change
  9312. this.optionsManager.watch('settingTheme', ['?theme', '?themeSystem'], function (opts) {
  9313. var themeClass = ThemeRegistry_1.getThemeSystemClass(opts.themeSystem || opts.theme);
  9314. var theme = new themeClass(_this.optionsManager);
  9315. var widgetClass = theme.getClass('widget');
  9316. _this.theme = theme;
  9317. if (widgetClass) {
  9318. el.addClass(widgetClass);
  9319. }
  9320. }, function () {
  9321. var widgetClass = _this.theme.getClass('widget');
  9322. _this.theme = null;
  9323. if (widgetClass) {
  9324. el.removeClass(widgetClass);
  9325. }
  9326. });
  9327. this.optionsManager.watch('settingBusinessHourGenerator', ['?businessHours'], function (deps) {
  9328. _this.businessHourGenerator = new BusinessHourGenerator_1.default(deps.businessHours, _this);
  9329. if (_this.view) {
  9330. _this.view.set('businessHourGenerator', _this.businessHourGenerator);
  9331. }
  9332. }, function () {
  9333. _this.businessHourGenerator = null;
  9334. });
  9335. // called immediately, and upon option change.
  9336. // HACK: locale often affects isRTL, so we explicitly listen to that too.
  9337. this.optionsManager.watch('applyingDirClasses', ['?isRTL', '?locale'], function (opts) {
  9338. el.toggleClass('fc-ltr', !opts.isRTL);
  9339. el.toggleClass('fc-rtl', opts.isRTL);
  9340. });
  9341. this.contentEl = $("<div class='fc-view-container'/>").prependTo(el);
  9342. this.initToolbars();
  9343. this.renderHeader();
  9344. this.renderFooter();
  9345. this.renderView(this.opt('defaultView'));
  9346. if (this.opt('handleWindowResize')) {
  9347. $(window).resize(this.windowResizeProxy = util_1.debounce(// prevents rapid calls
  9348. this.windowResize.bind(this), this.opt('windowResizeDelay')));
  9349. }
  9350. };
  9351. Calendar.prototype.destroy = function () {
  9352. if (this.view) {
  9353. this.clearView();
  9354. }
  9355. this.toolbarsManager.proxyCall('removeElement');
  9356. this.contentEl.remove();
  9357. this.el.removeClass('fc fc-ltr fc-rtl');
  9358. // removes theme-related root className
  9359. this.optionsManager.unwatch('settingTheme');
  9360. this.optionsManager.unwatch('settingBusinessHourGenerator');
  9361. this.el.off('.fc'); // unbind nav link handlers
  9362. if (this.windowResizeProxy) {
  9363. $(window).unbind('resize', this.windowResizeProxy);
  9364. this.windowResizeProxy = null;
  9365. }
  9366. GlobalEmitter_1.default.unneeded();
  9367. };
  9368. Calendar.prototype.elementVisible = function () {
  9369. return this.el.is(':visible');
  9370. };
  9371. // Render Queue
  9372. // -----------------------------------------------------------------------------------------------------------------
  9373. Calendar.prototype.bindViewHandlers = function (view) {
  9374. var _this = this;
  9375. view.watch('titleForCalendar', ['title'], function (deps) {
  9376. if (view === _this.view) {
  9377. _this.setToolbarsTitle(deps.title);
  9378. }
  9379. });
  9380. view.watch('dateProfileForCalendar', ['dateProfile'], function (deps) {
  9381. if (view === _this.view) {
  9382. _this.currentDate = deps.dateProfile.date; // might have been constrained by view dates
  9383. _this.updateToolbarButtons(deps.dateProfile);
  9384. }
  9385. });
  9386. };
  9387. Calendar.prototype.unbindViewHandlers = function (view) {
  9388. view.unwatch('titleForCalendar');
  9389. view.unwatch('dateProfileForCalendar');
  9390. };
  9391. // View Rendering
  9392. // -----------------------------------------------------------------------------------
  9393. // Renders a view because of a date change, view-type change, or for the first time.
  9394. // If not given a viewType, keep the current view but render different dates.
  9395. // Accepts an optional scroll state to restore to.
  9396. Calendar.prototype.renderView = function (viewType) {
  9397. var oldView = this.view;
  9398. var newView;
  9399. this.freezeContentHeight();
  9400. if (oldView && viewType && oldView.type !== viewType) {
  9401. this.clearView();
  9402. }
  9403. // if viewType changed, or the view was never created, create a fresh view
  9404. if (!this.view && viewType) {
  9405. newView = this.view =
  9406. this.viewsByType[viewType] ||
  9407. (this.viewsByType[viewType] = this.instantiateView(viewType));
  9408. this.bindViewHandlers(newView);
  9409. newView.startBatchRender(); // so that setElement+setDate rendering are joined
  9410. newView.setElement($("<div class='fc-view fc-" + viewType + "-view' />").appendTo(this.contentEl));
  9411. this.toolbarsManager.proxyCall('activateButton', viewType);
  9412. }
  9413. if (this.view) {
  9414. // prevent unnecessary change firing
  9415. if (this.view.get('businessHourGenerator') !== this.businessHourGenerator) {
  9416. this.view.set('businessHourGenerator', this.businessHourGenerator);
  9417. }
  9418. this.view.setDate(this.currentDate);
  9419. if (newView) {
  9420. newView.stopBatchRender();
  9421. }
  9422. }
  9423. this.thawContentHeight();
  9424. };
  9425. // Unrenders the current view and reflects this change in the Header.
  9426. // Unregsiters the `view`, but does not remove from viewByType hash.
  9427. Calendar.prototype.clearView = function () {
  9428. var currentView = this.view;
  9429. this.toolbarsManager.proxyCall('deactivateButton', currentView.type);
  9430. this.unbindViewHandlers(currentView);
  9431. currentView.removeElement();
  9432. currentView.unsetDate(); // so bindViewHandlers doesn't fire with old values next time
  9433. this.view = null;
  9434. };
  9435. // Destroys the view, including the view object. Then, re-instantiates it and renders it.
  9436. // Maintains the same scroll state.
  9437. // TODO: maintain any other user-manipulated state.
  9438. Calendar.prototype.reinitView = function () {
  9439. var oldView = this.view;
  9440. var scroll = oldView.queryScroll(); // wouldn't be so complicated if Calendar owned the scroll
  9441. this.freezeContentHeight();
  9442. this.clearView();
  9443. this.calcSize();
  9444. this.renderView(oldView.type); // needs the type to freshly render
  9445. this.view.applyScroll(scroll);
  9446. this.thawContentHeight();
  9447. };
  9448. // Resizing
  9449. // -----------------------------------------------------------------------------------
  9450. Calendar.prototype.getSuggestedViewHeight = function () {
  9451. if (this.suggestedViewHeight == null) {
  9452. this.calcSize();
  9453. }
  9454. return this.suggestedViewHeight;
  9455. };
  9456. Calendar.prototype.isHeightAuto = function () {
  9457. return this.opt('contentHeight') === 'auto' || this.opt('height') === 'auto';
  9458. };
  9459. Calendar.prototype.updateViewSize = function (isResize) {
  9460. if (isResize === void 0) { isResize = false; }
  9461. var view = this.view;
  9462. var scroll;
  9463. if (!this.ignoreUpdateViewSize && view) {
  9464. if (isResize) {
  9465. this.calcSize();
  9466. scroll = view.queryScroll();
  9467. }
  9468. this.ignoreUpdateViewSize++;
  9469. view.updateSize(this.getSuggestedViewHeight(), this.isHeightAuto(), isResize);
  9470. this.ignoreUpdateViewSize--;
  9471. if (isResize) {
  9472. view.applyScroll(scroll);
  9473. }
  9474. return true; // signal success
  9475. }
  9476. };
  9477. Calendar.prototype.calcSize = function () {
  9478. if (this.elementVisible()) {
  9479. this._calcSize();
  9480. }
  9481. };
  9482. Calendar.prototype._calcSize = function () {
  9483. var contentHeightInput = this.opt('contentHeight');
  9484. var heightInput = this.opt('height');
  9485. if (typeof contentHeightInput === 'number') {
  9486. this.suggestedViewHeight = contentHeightInput;
  9487. }
  9488. else if (typeof contentHeightInput === 'function') {
  9489. this.suggestedViewHeight = contentHeightInput();
  9490. }
  9491. else if (typeof heightInput === 'number') {
  9492. this.suggestedViewHeight = heightInput - this.queryToolbarsHeight();
  9493. }
  9494. else if (typeof heightInput === 'function') {
  9495. this.suggestedViewHeight = heightInput() - this.queryToolbarsHeight();
  9496. }
  9497. else if (heightInput === 'parent') {
  9498. this.suggestedViewHeight = this.el.parent().height() - this.queryToolbarsHeight();
  9499. }
  9500. else {
  9501. this.suggestedViewHeight = Math.round(this.contentEl.width() /
  9502. Math.max(this.opt('aspectRatio'), .5));
  9503. }
  9504. };
  9505. Calendar.prototype.windowResize = function (ev) {
  9506. if (
  9507. // the purpose: so we don't process jqui "resize" events that have bubbled up
  9508. // cast to any because .target, which is Element, can't be compared to window for some reason.
  9509. ev.target === window &&
  9510. this.view &&
  9511. this.view.isDatesRendered) {
  9512. if (this.updateViewSize(true)) {
  9513. this.publiclyTrigger('windowResize', [this.view]);
  9514. }
  9515. }
  9516. };
  9517. /* Height "Freezing"
  9518. -----------------------------------------------------------------------------*/
  9519. Calendar.prototype.freezeContentHeight = function () {
  9520. if (!(this.freezeContentHeightDepth++)) {
  9521. this.forceFreezeContentHeight();
  9522. }
  9523. };
  9524. Calendar.prototype.forceFreezeContentHeight = function () {
  9525. this.contentEl.css({
  9526. width: '100%',
  9527. height: this.contentEl.height(),
  9528. overflow: 'hidden'
  9529. });
  9530. };
  9531. Calendar.prototype.thawContentHeight = function () {
  9532. this.freezeContentHeightDepth--;
  9533. // always bring back to natural height
  9534. this.contentEl.css({
  9535. width: '',
  9536. height: '',
  9537. overflow: ''
  9538. });
  9539. // but if there are future thaws, re-freeze
  9540. if (this.freezeContentHeightDepth) {
  9541. this.forceFreezeContentHeight();
  9542. }
  9543. };
  9544. // Toolbar
  9545. // -----------------------------------------------------------------------------------------------------------------
  9546. Calendar.prototype.initToolbars = function () {
  9547. this.header = new Toolbar_1.default(this, this.computeHeaderOptions());
  9548. this.footer = new Toolbar_1.default(this, this.computeFooterOptions());
  9549. this.toolbarsManager = new Iterator_1.default([this.header, this.footer]);
  9550. };
  9551. Calendar.prototype.computeHeaderOptions = function () {
  9552. return {
  9553. extraClasses: 'fc-header-toolbar',
  9554. layout: this.opt('header')
  9555. };
  9556. };
  9557. Calendar.prototype.computeFooterOptions = function () {
  9558. return {
  9559. extraClasses: 'fc-footer-toolbar',
  9560. layout: this.opt('footer')
  9561. };
  9562. };
  9563. // can be called repeatedly and Header will rerender
  9564. Calendar.prototype.renderHeader = function () {
  9565. var header = this.header;
  9566. header.setToolbarOptions(this.computeHeaderOptions());
  9567. header.render();
  9568. if (header.el) {
  9569. this.el.prepend(header.el);
  9570. }
  9571. };
  9572. // can be called repeatedly and Footer will rerender
  9573. Calendar.prototype.renderFooter = function () {
  9574. var footer = this.footer;
  9575. footer.setToolbarOptions(this.computeFooterOptions());
  9576. footer.render();
  9577. if (footer.el) {
  9578. this.el.append(footer.el);
  9579. }
  9580. };
  9581. Calendar.prototype.setToolbarsTitle = function (title) {
  9582. this.toolbarsManager.proxyCall('updateTitle', title);
  9583. };
  9584. Calendar.prototype.updateToolbarButtons = function (dateProfile) {
  9585. var now = this.getNow();
  9586. var view = this.view;
  9587. var todayInfo = view.dateProfileGenerator.build(now);
  9588. var prevInfo = view.dateProfileGenerator.buildPrev(view.get('dateProfile'));
  9589. var nextInfo = view.dateProfileGenerator.buildNext(view.get('dateProfile'));
  9590. this.toolbarsManager.proxyCall((todayInfo.isValid && !dateProfile.currentUnzonedRange.containsDate(now)) ?
  9591. 'enableButton' :
  9592. 'disableButton', 'today');
  9593. this.toolbarsManager.proxyCall(prevInfo.isValid ?
  9594. 'enableButton' :
  9595. 'disableButton', 'prev');
  9596. this.toolbarsManager.proxyCall(nextInfo.isValid ?
  9597. 'enableButton' :
  9598. 'disableButton', 'next');
  9599. };
  9600. Calendar.prototype.queryToolbarsHeight = function () {
  9601. return this.toolbarsManager.items.reduce(function (accumulator, toolbar) {
  9602. var toolbarHeight = toolbar.el ? toolbar.el.outerHeight(true) : 0; // includes margin
  9603. return accumulator + toolbarHeight;
  9604. }, 0);
  9605. };
  9606. // Selection
  9607. // -----------------------------------------------------------------------------------------------------------------
  9608. // this public method receives start/end dates in any format, with any timezone
  9609. Calendar.prototype.select = function (zonedStartInput, zonedEndInput) {
  9610. this.view.select(this.buildSelectFootprint.apply(this, arguments));
  9611. };
  9612. Calendar.prototype.unselect = function () {
  9613. if (this.view) {
  9614. this.view.unselect();
  9615. }
  9616. };
  9617. // Given arguments to the select method in the API, returns a span (unzoned start/end and other info)
  9618. Calendar.prototype.buildSelectFootprint = function (zonedStartInput, zonedEndInput) {
  9619. var start = this.moment(zonedStartInput).stripZone();
  9620. var end;
  9621. if (zonedEndInput) {
  9622. end = this.moment(zonedEndInput).stripZone();
  9623. }
  9624. else if (start.hasTime()) {
  9625. end = start.clone().add(this.defaultTimedEventDuration);
  9626. }
  9627. else {
  9628. end = start.clone().add(this.defaultAllDayEventDuration);
  9629. }
  9630. return new ComponentFootprint_1.default(new UnzonedRange_1.default(start, end), !start.hasTime());
  9631. };
  9632. // Date Utils
  9633. // -----------------------------------------------------------------------------------------------------------------
  9634. Calendar.prototype.initMomentInternals = function () {
  9635. var _this = this;
  9636. this.defaultAllDayEventDuration = moment.duration(this.opt('defaultAllDayEventDuration'));
  9637. this.defaultTimedEventDuration = moment.duration(this.opt('defaultTimedEventDuration'));
  9638. // Called immediately, and when any of the options change.
  9639. // Happens before any internal objects rebuild or rerender, because this is very core.
  9640. this.optionsManager.watch('buildingMomentLocale', [
  9641. '?locale', '?monthNames', '?monthNamesShort', '?dayNames', '?dayNamesShort',
  9642. '?firstDay', '?weekNumberCalculation'
  9643. ], function (opts) {
  9644. var weekNumberCalculation = opts.weekNumberCalculation;
  9645. var firstDay = opts.firstDay;
  9646. var _week;
  9647. // normalize
  9648. if (weekNumberCalculation === 'iso') {
  9649. weekNumberCalculation = 'ISO'; // normalize
  9650. }
  9651. var localeData = Object.create(// make a cheap copy
  9652. locale_1.getMomentLocaleData(opts.locale) // will fall back to en
  9653. );
  9654. if (opts.monthNames) {
  9655. localeData._months = opts.monthNames;
  9656. }
  9657. if (opts.monthNamesShort) {
  9658. localeData._monthsShort = opts.monthNamesShort;
  9659. }
  9660. if (opts.dayNames) {
  9661. localeData._weekdays = opts.dayNames;
  9662. }
  9663. if (opts.dayNamesShort) {
  9664. localeData._weekdaysShort = opts.dayNamesShort;
  9665. }
  9666. if (firstDay == null && weekNumberCalculation === 'ISO') {
  9667. firstDay = 1;
  9668. }
  9669. if (firstDay != null) {
  9670. _week = Object.create(localeData._week); // _week: { dow: # }
  9671. _week.dow = firstDay;
  9672. localeData._week = _week;
  9673. }
  9674. if (weekNumberCalculation === 'ISO' ||
  9675. weekNumberCalculation === 'local' ||
  9676. typeof weekNumberCalculation === 'function') {
  9677. localeData._fullCalendar_weekCalc = weekNumberCalculation; // moment-ext will know what to do with it
  9678. }
  9679. _this.localeData = localeData;
  9680. // If the internal current date object already exists, move to new locale.
  9681. // We do NOT need to do this technique for event dates, because this happens when converting to "segments".
  9682. if (_this.currentDate) {
  9683. _this.localizeMoment(_this.currentDate); // sets to localeData
  9684. }
  9685. });
  9686. };
  9687. // Builds a moment using the settings of the current calendar: timezone and locale.
  9688. // Accepts anything the vanilla moment() constructor accepts.
  9689. Calendar.prototype.moment = function () {
  9690. var args = [];
  9691. for (var _i = 0; _i < arguments.length; _i++) {
  9692. args[_i] = arguments[_i];
  9693. }
  9694. var mom;
  9695. if (this.opt('timezone') === 'local') {
  9696. mom = moment_ext_1.default.apply(null, args);
  9697. // Force the moment to be local, because momentExt doesn't guarantee it.
  9698. if (mom.hasTime()) {
  9699. mom.local();
  9700. }
  9701. }
  9702. else if (this.opt('timezone') === 'UTC') {
  9703. mom = moment_ext_1.default.utc.apply(null, args); // process as UTC
  9704. }
  9705. else {
  9706. mom = moment_ext_1.default.parseZone.apply(null, args); // let the input decide the zone
  9707. }
  9708. this.localizeMoment(mom); // TODO
  9709. return mom;
  9710. };
  9711. Calendar.prototype.msToMoment = function (ms, forceAllDay) {
  9712. var mom = moment_ext_1.default.utc(ms); // TODO: optimize by using Date.UTC
  9713. if (forceAllDay) {
  9714. mom.stripTime();
  9715. }
  9716. else {
  9717. mom = this.applyTimezone(mom); // may or may not apply locale
  9718. }
  9719. this.localizeMoment(mom);
  9720. return mom;
  9721. };
  9722. Calendar.prototype.msToUtcMoment = function (ms, forceAllDay) {
  9723. var mom = moment_ext_1.default.utc(ms); // TODO: optimize by using Date.UTC
  9724. if (forceAllDay) {
  9725. mom.stripTime();
  9726. }
  9727. this.localizeMoment(mom);
  9728. return mom;
  9729. };
  9730. // Updates the given moment's locale settings to the current calendar locale settings.
  9731. Calendar.prototype.localizeMoment = function (mom) {
  9732. mom._locale = this.localeData;
  9733. };
  9734. // Returns a boolean about whether or not the calendar knows how to calculate
  9735. // the timezone offset of arbitrary dates in the current timezone.
  9736. Calendar.prototype.getIsAmbigTimezone = function () {
  9737. return this.opt('timezone') !== 'local' && this.opt('timezone') !== 'UTC';
  9738. };
  9739. // Returns a copy of the given date in the current timezone. Has no effect on dates without times.
  9740. Calendar.prototype.applyTimezone = function (date) {
  9741. if (!date.hasTime()) {
  9742. return date.clone();
  9743. }
  9744. var zonedDate = this.moment(date.toArray());
  9745. var timeAdjust = date.time().asMilliseconds() - zonedDate.time().asMilliseconds();
  9746. var adjustedZonedDate;
  9747. // Safari sometimes has problems with this coersion when near DST. Adjust if necessary. (bug #2396)
  9748. if (timeAdjust) {
  9749. adjustedZonedDate = zonedDate.clone().add(timeAdjust); // add milliseconds
  9750. if (date.time().asMilliseconds() - adjustedZonedDate.time().asMilliseconds() === 0) {
  9751. zonedDate = adjustedZonedDate;
  9752. }
  9753. }
  9754. return zonedDate;
  9755. };
  9756. /*
  9757. Assumes the footprint is non-open-ended.
  9758. */
  9759. Calendar.prototype.footprintToDateProfile = function (componentFootprint, ignoreEnd) {
  9760. if (ignoreEnd === void 0) { ignoreEnd = false; }
  9761. var start = moment_ext_1.default.utc(componentFootprint.unzonedRange.startMs);
  9762. var end;
  9763. if (!ignoreEnd) {
  9764. end = moment_ext_1.default.utc(componentFootprint.unzonedRange.endMs);
  9765. }
  9766. if (componentFootprint.isAllDay) {
  9767. start.stripTime();
  9768. if (end) {
  9769. end.stripTime();
  9770. }
  9771. }
  9772. else {
  9773. start = this.applyTimezone(start);
  9774. if (end) {
  9775. end = this.applyTimezone(end);
  9776. }
  9777. }
  9778. return new EventDateProfile_1.default(start, end, this);
  9779. };
  9780. // Returns a moment for the current date, as defined by the client's computer or from the `now` option.
  9781. // Will return an moment with an ambiguous timezone.
  9782. Calendar.prototype.getNow = function () {
  9783. var now = this.opt('now');
  9784. if (typeof now === 'function') {
  9785. now = now();
  9786. }
  9787. return this.moment(now).stripZone();
  9788. };
  9789. // Produces a human-readable string for the given duration.
  9790. // Side-effect: changes the locale of the given duration.
  9791. Calendar.prototype.humanizeDuration = function (duration) {
  9792. return duration.locale(this.opt('locale')).humanize();
  9793. };
  9794. // will return `null` if invalid range
  9795. Calendar.prototype.parseUnzonedRange = function (rangeInput) {
  9796. var start = null;
  9797. var end = null;
  9798. if (rangeInput.start) {
  9799. start = this.moment(rangeInput.start).stripZone();
  9800. }
  9801. if (rangeInput.end) {
  9802. end = this.moment(rangeInput.end).stripZone();
  9803. }
  9804. if (!start && !end) {
  9805. return null;
  9806. }
  9807. if (start && end && end.isBefore(start)) {
  9808. return null;
  9809. }
  9810. return new UnzonedRange_1.default(start, end);
  9811. };
  9812. // Event-Date Utilities
  9813. // -----------------------------------------------------------------------------------------------------------------
  9814. Calendar.prototype.initEventManager = function () {
  9815. var _this = this;
  9816. var eventManager = new EventManager_1.default(this);
  9817. var rawSources = this.opt('eventSources') || [];
  9818. var singleRawSource = this.opt('events');
  9819. this.eventManager = eventManager;
  9820. if (singleRawSource) {
  9821. rawSources.unshift(singleRawSource);
  9822. }
  9823. eventManager.on('release', function (eventsPayload) {
  9824. _this.trigger('eventsReset', eventsPayload);
  9825. });
  9826. eventManager.freeze();
  9827. rawSources.forEach(function (rawSource) {
  9828. var source = EventSourceParser_1.default.parse(rawSource, _this);
  9829. if (source) {
  9830. eventManager.addSource(source);
  9831. }
  9832. });
  9833. eventManager.thaw();
  9834. };
  9835. Calendar.prototype.requestEvents = function (start, end) {
  9836. return this.eventManager.requestEvents(start, end, this.opt('timezone'), !this.opt('lazyFetching'));
  9837. };
  9838. // Get an event's normalized end date. If not present, calculate it from the defaults.
  9839. Calendar.prototype.getEventEnd = function (event) {
  9840. if (event.end) {
  9841. return event.end.clone();
  9842. }
  9843. else {
  9844. return this.getDefaultEventEnd(event.allDay, event.start);
  9845. }
  9846. };
  9847. // Given an event's allDay status and start date, return what its fallback end date should be.
  9848. // TODO: rename to computeDefaultEventEnd
  9849. Calendar.prototype.getDefaultEventEnd = function (allDay, zonedStart) {
  9850. var end = zonedStart.clone();
  9851. if (allDay) {
  9852. end.stripTime().add(this.defaultAllDayEventDuration);
  9853. }
  9854. else {
  9855. end.add(this.defaultTimedEventDuration);
  9856. }
  9857. if (this.getIsAmbigTimezone()) {
  9858. end.stripZone(); // we don't know what the tzo should be
  9859. }
  9860. return end;
  9861. };
  9862. // Public Events API
  9863. // -----------------------------------------------------------------------------------------------------------------
  9864. Calendar.prototype.rerenderEvents = function () {
  9865. this.view.flash('displayingEvents');
  9866. };
  9867. Calendar.prototype.refetchEvents = function () {
  9868. this.eventManager.refetchAllSources();
  9869. };
  9870. Calendar.prototype.renderEvents = function (eventInputs, isSticky) {
  9871. this.eventManager.freeze();
  9872. for (var i = 0; i < eventInputs.length; i++) {
  9873. this.renderEvent(eventInputs[i], isSticky);
  9874. }
  9875. this.eventManager.thaw();
  9876. };
  9877. Calendar.prototype.renderEvent = function (eventInput, isSticky) {
  9878. if (isSticky === void 0) { isSticky = false; }
  9879. var eventManager = this.eventManager;
  9880. var eventDef = EventDefParser_1.default.parse(eventInput, eventInput.source || eventManager.stickySource);
  9881. if (eventDef) {
  9882. eventManager.addEventDef(eventDef, isSticky);
  9883. }
  9884. };
  9885. // legacyQuery operates on legacy event instance objects
  9886. Calendar.prototype.removeEvents = function (legacyQuery) {
  9887. var eventManager = this.eventManager;
  9888. var legacyInstances = [];
  9889. var idMap = {};
  9890. var eventDef;
  9891. var i;
  9892. if (legacyQuery == null) {
  9893. eventManager.removeAllEventDefs(); // persist=true
  9894. }
  9895. else {
  9896. eventManager.getEventInstances().forEach(function (eventInstance) {
  9897. legacyInstances.push(eventInstance.toLegacy());
  9898. });
  9899. legacyInstances = filterLegacyEventInstances(legacyInstances, legacyQuery);
  9900. // compute unique IDs
  9901. for (i = 0; i < legacyInstances.length; i++) {
  9902. eventDef = this.eventManager.getEventDefByUid(legacyInstances[i]._id);
  9903. idMap[eventDef.id] = true;
  9904. }
  9905. eventManager.freeze();
  9906. for (i in idMap) {
  9907. eventManager.removeEventDefsById(i); // persist=true
  9908. }
  9909. eventManager.thaw();
  9910. }
  9911. };
  9912. // legacyQuery operates on legacy event instance objects
  9913. Calendar.prototype.clientEvents = function (legacyQuery) {
  9914. var legacyEventInstances = [];
  9915. this.eventManager.getEventInstances().forEach(function (eventInstance) {
  9916. legacyEventInstances.push(eventInstance.toLegacy());
  9917. });
  9918. return filterLegacyEventInstances(legacyEventInstances, legacyQuery);
  9919. };
  9920. Calendar.prototype.updateEvents = function (eventPropsArray) {
  9921. this.eventManager.freeze();
  9922. for (var i = 0; i < eventPropsArray.length; i++) {
  9923. this.updateEvent(eventPropsArray[i]);
  9924. }
  9925. this.eventManager.thaw();
  9926. };
  9927. Calendar.prototype.updateEvent = function (eventProps) {
  9928. var eventDef = this.eventManager.getEventDefByUid(eventProps._id);
  9929. var eventInstance;
  9930. var eventDefMutation;
  9931. if (eventDef instanceof SingleEventDef_1.default) {
  9932. eventInstance = eventDef.buildInstance();
  9933. eventDefMutation = EventDefMutation_1.default.createFromRawProps(eventInstance, eventProps, // raw props
  9934. null // largeUnit -- who uses it?
  9935. );
  9936. this.eventManager.mutateEventsWithId(eventDef.id, eventDefMutation); // will release
  9937. }
  9938. };
  9939. // Public Event Sources API
  9940. // ------------------------------------------------------------------------------------
  9941. Calendar.prototype.getEventSources = function () {
  9942. return this.eventManager.otherSources.slice(); // clone
  9943. };
  9944. Calendar.prototype.getEventSourceById = function (id) {
  9945. return this.eventManager.getSourceById(EventSource_1.default.normalizeId(id));
  9946. };
  9947. Calendar.prototype.addEventSource = function (sourceInput) {
  9948. var source = EventSourceParser_1.default.parse(sourceInput, this);
  9949. if (source) {
  9950. this.eventManager.addSource(source);
  9951. }
  9952. };
  9953. Calendar.prototype.removeEventSources = function (sourceMultiQuery) {
  9954. var eventManager = this.eventManager;
  9955. var sources;
  9956. var i;
  9957. if (sourceMultiQuery == null) {
  9958. this.eventManager.removeAllSources();
  9959. }
  9960. else {
  9961. sources = eventManager.multiQuerySources(sourceMultiQuery);
  9962. eventManager.freeze();
  9963. for (i = 0; i < sources.length; i++) {
  9964. eventManager.removeSource(sources[i]);
  9965. }
  9966. eventManager.thaw();
  9967. }
  9968. };
  9969. Calendar.prototype.removeEventSource = function (sourceQuery) {
  9970. var eventManager = this.eventManager;
  9971. var sources = eventManager.querySources(sourceQuery);
  9972. var i;
  9973. eventManager.freeze();
  9974. for (i = 0; i < sources.length; i++) {
  9975. eventManager.removeSource(sources[i]);
  9976. }
  9977. eventManager.thaw();
  9978. };
  9979. Calendar.prototype.refetchEventSources = function (sourceMultiQuery) {
  9980. var eventManager = this.eventManager;
  9981. var sources = eventManager.multiQuerySources(sourceMultiQuery);
  9982. var i;
  9983. eventManager.freeze();
  9984. for (i = 0; i < sources.length; i++) {
  9985. eventManager.refetchSource(sources[i]);
  9986. }
  9987. eventManager.thaw();
  9988. };
  9989. // not for internal use. use options module directly instead.
  9990. Calendar.defaults = options_1.globalDefaults;
  9991. Calendar.englishDefaults = options_1.englishDefaults;
  9992. Calendar.rtlDefaults = options_1.rtlDefaults;
  9993. return Calendar;
  9994. }());
  9995. exports.default = Calendar;
  9996. EmitterMixin_1.default.mixInto(Calendar);
  9997. ListenerMixin_1.default.mixInto(Calendar);
  9998. function filterLegacyEventInstances(legacyEventInstances, legacyQuery) {
  9999. if (legacyQuery == null) {
  10000. return legacyEventInstances;
  10001. }
  10002. else if ($.isFunction(legacyQuery)) {
  10003. return legacyEventInstances.filter(legacyQuery);
  10004. }
  10005. else {
  10006. legacyQuery += ''; // normalize to string
  10007. return legacyEventInstances.filter(function (legacyEventInstance) {
  10008. // soft comparison because id not be normalized to string
  10009. // tslint:disable-next-line
  10010. return legacyEventInstance.id == legacyQuery ||
  10011. legacyEventInstance._id === legacyQuery; // can specify internal id, but must exactly match
  10012. });
  10013. }
  10014. }
  10015. /***/ }),
  10016. /* 217 */
  10017. /***/ (function(module, exports, __webpack_require__) {
  10018. Object.defineProperty(exports, "__esModule", { value: true });
  10019. var moment = __webpack_require__(0);
  10020. var util_1 = __webpack_require__(4);
  10021. var UnzonedRange_1 = __webpack_require__(5);
  10022. var DateProfileGenerator = /** @class */ (function () {
  10023. function DateProfileGenerator(_view) {
  10024. this._view = _view;
  10025. }
  10026. DateProfileGenerator.prototype.opt = function (name) {
  10027. return this._view.opt(name);
  10028. };
  10029. DateProfileGenerator.prototype.trimHiddenDays = function (unzonedRange) {
  10030. return this._view.trimHiddenDays(unzonedRange);
  10031. };
  10032. DateProfileGenerator.prototype.msToUtcMoment = function (ms, forceAllDay) {
  10033. return this._view.calendar.msToUtcMoment(ms, forceAllDay);
  10034. };
  10035. /* Date Range Computation
  10036. ------------------------------------------------------------------------------------------------------------------*/
  10037. // Builds a structure with info about what the dates/ranges will be for the "prev" view.
  10038. DateProfileGenerator.prototype.buildPrev = function (currentDateProfile) {
  10039. var prevDate = currentDateProfile.date.clone()
  10040. .startOf(currentDateProfile.currentRangeUnit)
  10041. .subtract(currentDateProfile.dateIncrement);
  10042. return this.build(prevDate, -1);
  10043. };
  10044. // Builds a structure with info about what the dates/ranges will be for the "next" view.
  10045. DateProfileGenerator.prototype.buildNext = function (currentDateProfile) {
  10046. var nextDate = currentDateProfile.date.clone()
  10047. .startOf(currentDateProfile.currentRangeUnit)
  10048. .add(currentDateProfile.dateIncrement);
  10049. return this.build(nextDate, 1);
  10050. };
  10051. // Builds a structure holding dates/ranges for rendering around the given date.
  10052. // Optional direction param indicates whether the date is being incremented/decremented
  10053. // from its previous value. decremented = -1, incremented = 1 (default).
  10054. DateProfileGenerator.prototype.build = function (date, direction, forceToValid) {
  10055. if (forceToValid === void 0) { forceToValid = false; }
  10056. var isDateAllDay = !date.hasTime();
  10057. var validUnzonedRange;
  10058. var minTime = null;
  10059. var maxTime = null;
  10060. var currentInfo;
  10061. var isRangeAllDay;
  10062. var renderUnzonedRange;
  10063. var activeUnzonedRange;
  10064. var isValid;
  10065. validUnzonedRange = this.buildValidRange();
  10066. validUnzonedRange = this.trimHiddenDays(validUnzonedRange);
  10067. if (forceToValid) {
  10068. date = this.msToUtcMoment(validUnzonedRange.constrainDate(date), // returns MS
  10069. isDateAllDay);
  10070. }
  10071. currentInfo = this.buildCurrentRangeInfo(date, direction);
  10072. isRangeAllDay = /^(year|month|week|day)$/.test(currentInfo.unit);
  10073. renderUnzonedRange = this.buildRenderRange(this.trimHiddenDays(currentInfo.unzonedRange), currentInfo.unit, isRangeAllDay);
  10074. renderUnzonedRange = this.trimHiddenDays(renderUnzonedRange);
  10075. activeUnzonedRange = renderUnzonedRange.clone();
  10076. if (!this.opt('showNonCurrentDates')) {
  10077. activeUnzonedRange = activeUnzonedRange.intersect(currentInfo.unzonedRange);
  10078. }
  10079. minTime = moment.duration(this.opt('minTime'));
  10080. maxTime = moment.duration(this.opt('maxTime'));
  10081. activeUnzonedRange = this.adjustActiveRange(activeUnzonedRange, minTime, maxTime);
  10082. activeUnzonedRange = activeUnzonedRange.intersect(validUnzonedRange); // might return null
  10083. if (activeUnzonedRange) {
  10084. date = this.msToUtcMoment(activeUnzonedRange.constrainDate(date), // returns MS
  10085. isDateAllDay);
  10086. }
  10087. // it's invalid if the originally requested date is not contained,
  10088. // or if the range is completely outside of the valid range.
  10089. isValid = currentInfo.unzonedRange.intersectsWith(validUnzonedRange);
  10090. return {
  10091. // constraint for where prev/next operations can go and where events can be dragged/resized to.
  10092. // an object with optional start and end properties.
  10093. validUnzonedRange: validUnzonedRange,
  10094. // range the view is formally responsible for.
  10095. // for example, a month view might have 1st-31st, excluding padded dates
  10096. currentUnzonedRange: currentInfo.unzonedRange,
  10097. // name of largest unit being displayed, like "month" or "week"
  10098. currentRangeUnit: currentInfo.unit,
  10099. isRangeAllDay: isRangeAllDay,
  10100. // dates that display events and accept drag-n-drop
  10101. // will be `null` if no dates accept events
  10102. activeUnzonedRange: activeUnzonedRange,
  10103. // date range with a rendered skeleton
  10104. // includes not-active days that need some sort of DOM
  10105. renderUnzonedRange: renderUnzonedRange,
  10106. // Duration object that denotes the first visible time of any given day
  10107. minTime: minTime,
  10108. // Duration object that denotes the exclusive visible end time of any given day
  10109. maxTime: maxTime,
  10110. isValid: isValid,
  10111. date: date,
  10112. // how far the current date will move for a prev/next operation
  10113. dateIncrement: this.buildDateIncrement(currentInfo.duration)
  10114. // pass a fallback (might be null) ^
  10115. };
  10116. };
  10117. // Builds an object with optional start/end properties.
  10118. // Indicates the minimum/maximum dates to display.
  10119. // not responsible for trimming hidden days.
  10120. DateProfileGenerator.prototype.buildValidRange = function () {
  10121. return this._view.getUnzonedRangeOption('validRange', this._view.calendar.getNow()) ||
  10122. new UnzonedRange_1.default(); // completely open-ended
  10123. };
  10124. // Builds a structure with info about the "current" range, the range that is
  10125. // highlighted as being the current month for example.
  10126. // See build() for a description of `direction`.
  10127. // Guaranteed to have `range` and `unit` properties. `duration` is optional.
  10128. // TODO: accept a MS-time instead of a moment `date`?
  10129. DateProfileGenerator.prototype.buildCurrentRangeInfo = function (date, direction) {
  10130. var viewSpec = this._view.viewSpec;
  10131. var duration = null;
  10132. var unit = null;
  10133. var unzonedRange = null;
  10134. var dayCount;
  10135. if (viewSpec.duration) {
  10136. duration = viewSpec.duration;
  10137. unit = viewSpec.durationUnit;
  10138. unzonedRange = this.buildRangeFromDuration(date, direction, duration, unit);
  10139. }
  10140. else if ((dayCount = this.opt('dayCount'))) {
  10141. unit = 'day';
  10142. unzonedRange = this.buildRangeFromDayCount(date, direction, dayCount);
  10143. }
  10144. else if ((unzonedRange = this.buildCustomVisibleRange(date))) {
  10145. unit = util_1.computeGreatestUnit(unzonedRange.getStart(), unzonedRange.getEnd());
  10146. }
  10147. else {
  10148. duration = this.getFallbackDuration();
  10149. unit = util_1.computeGreatestUnit(duration);
  10150. unzonedRange = this.buildRangeFromDuration(date, direction, duration, unit);
  10151. }
  10152. return { duration: duration, unit: unit, unzonedRange: unzonedRange };
  10153. };
  10154. DateProfileGenerator.prototype.getFallbackDuration = function () {
  10155. return moment.duration({ days: 1 });
  10156. };
  10157. // Returns a new activeUnzonedRange to have time values (un-ambiguate)
  10158. // minTime or maxTime causes the range to expand.
  10159. DateProfileGenerator.prototype.adjustActiveRange = function (unzonedRange, minTime, maxTime) {
  10160. var start = unzonedRange.getStart();
  10161. var end = unzonedRange.getEnd();
  10162. if (this._view.usesMinMaxTime) {
  10163. if (minTime < 0) {
  10164. start.time(0).add(minTime);
  10165. }
  10166. if (maxTime > 24 * 60 * 60 * 1000) {
  10167. end.time(maxTime - (24 * 60 * 60 * 1000));
  10168. }
  10169. }
  10170. return new UnzonedRange_1.default(start, end);
  10171. };
  10172. // Builds the "current" range when it is specified as an explicit duration.
  10173. // `unit` is the already-computed computeGreatestUnit value of duration.
  10174. // TODO: accept a MS-time instead of a moment `date`?
  10175. DateProfileGenerator.prototype.buildRangeFromDuration = function (date, direction, duration, unit) {
  10176. var alignment = this.opt('dateAlignment');
  10177. var dateIncrementInput;
  10178. var dateIncrementDuration;
  10179. var start;
  10180. var end;
  10181. var res;
  10182. // compute what the alignment should be
  10183. if (!alignment) {
  10184. dateIncrementInput = this.opt('dateIncrement');
  10185. if (dateIncrementInput) {
  10186. dateIncrementDuration = moment.duration(dateIncrementInput);
  10187. // use the smaller of the two units
  10188. if (dateIncrementDuration < duration) {
  10189. alignment = util_1.computeDurationGreatestUnit(dateIncrementDuration, dateIncrementInput);
  10190. }
  10191. else {
  10192. alignment = unit;
  10193. }
  10194. }
  10195. else {
  10196. alignment = unit;
  10197. }
  10198. }
  10199. // if the view displays a single day or smaller
  10200. if (duration.as('days') <= 1) {
  10201. if (this._view.isHiddenDay(start)) {
  10202. start = this._view.skipHiddenDays(start, direction);
  10203. start.startOf('day');
  10204. }
  10205. }
  10206. function computeRes() {
  10207. start = date.clone().startOf(alignment);
  10208. end = start.clone().add(duration);
  10209. res = new UnzonedRange_1.default(start, end);
  10210. }
  10211. computeRes();
  10212. // if range is completely enveloped by hidden days, go past the hidden days
  10213. if (!this.trimHiddenDays(res)) {
  10214. date = this._view.skipHiddenDays(date, direction);
  10215. computeRes();
  10216. }
  10217. return res;
  10218. };
  10219. // Builds the "current" range when a dayCount is specified.
  10220. // TODO: accept a MS-time instead of a moment `date`?
  10221. DateProfileGenerator.prototype.buildRangeFromDayCount = function (date, direction, dayCount) {
  10222. var customAlignment = this.opt('dateAlignment');
  10223. var runningCount = 0;
  10224. var start = date.clone();
  10225. var end;
  10226. if (customAlignment) {
  10227. start.startOf(customAlignment);
  10228. }
  10229. start.startOf('day');
  10230. start = this._view.skipHiddenDays(start, direction);
  10231. end = start.clone();
  10232. do {
  10233. end.add(1, 'day');
  10234. if (!this._view.isHiddenDay(end)) {
  10235. runningCount++;
  10236. }
  10237. } while (runningCount < dayCount);
  10238. return new UnzonedRange_1.default(start, end);
  10239. };
  10240. // Builds a normalized range object for the "visible" range,
  10241. // which is a way to define the currentUnzonedRange and activeUnzonedRange at the same time.
  10242. // TODO: accept a MS-time instead of a moment `date`?
  10243. DateProfileGenerator.prototype.buildCustomVisibleRange = function (date) {
  10244. var visibleUnzonedRange = this._view.getUnzonedRangeOption('visibleRange', this._view.calendar.applyTimezone(date) // correct zone. also generates new obj that avoids mutations
  10245. );
  10246. if (visibleUnzonedRange && (visibleUnzonedRange.startMs == null || visibleUnzonedRange.endMs == null)) {
  10247. return null;
  10248. }
  10249. return visibleUnzonedRange;
  10250. };
  10251. // Computes the range that will represent the element/cells for *rendering*,
  10252. // but which may have voided days/times.
  10253. // not responsible for trimming hidden days.
  10254. DateProfileGenerator.prototype.buildRenderRange = function (currentUnzonedRange, currentRangeUnit, isRangeAllDay) {
  10255. return currentUnzonedRange.clone();
  10256. };
  10257. // Compute the duration value that should be added/substracted to the current date
  10258. // when a prev/next operation happens.
  10259. DateProfileGenerator.prototype.buildDateIncrement = function (fallback) {
  10260. var dateIncrementInput = this.opt('dateIncrement');
  10261. var customAlignment;
  10262. if (dateIncrementInput) {
  10263. return moment.duration(dateIncrementInput);
  10264. }
  10265. else if ((customAlignment = this.opt('dateAlignment'))) {
  10266. return moment.duration(1, customAlignment);
  10267. }
  10268. else if (fallback) {
  10269. return fallback;
  10270. }
  10271. else {
  10272. return moment.duration({ days: 1 });
  10273. }
  10274. };
  10275. return DateProfileGenerator;
  10276. }());
  10277. exports.default = DateProfileGenerator;
  10278. /***/ }),
  10279. /* 218 */
  10280. /***/ (function(module, exports, __webpack_require__) {
  10281. Object.defineProperty(exports, "__esModule", { value: true });
  10282. var tslib_1 = __webpack_require__(2);
  10283. var $ = __webpack_require__(3);
  10284. var moment = __webpack_require__(0);
  10285. var exportHooks = __webpack_require__(16);
  10286. var util_1 = __webpack_require__(4);
  10287. var moment_ext_1 = __webpack_require__(10);
  10288. var ListenerMixin_1 = __webpack_require__(7);
  10289. var HitDragListener_1 = __webpack_require__(22);
  10290. var SingleEventDef_1 = __webpack_require__(13);
  10291. var EventInstanceGroup_1 = __webpack_require__(18);
  10292. var EventSource_1 = __webpack_require__(6);
  10293. var Interaction_1 = __webpack_require__(15);
  10294. var ExternalDropping = /** @class */ (function (_super) {
  10295. tslib_1.__extends(ExternalDropping, _super);
  10296. function ExternalDropping() {
  10297. var _this = _super !== null && _super.apply(this, arguments) || this;
  10298. _this.isDragging = false; // jqui-dragging an external element? boolean
  10299. return _this;
  10300. }
  10301. /*
  10302. component impements:
  10303. - eventRangesToEventFootprints
  10304. - isEventInstanceGroupAllowed
  10305. - isExternalInstanceGroupAllowed
  10306. - renderDrag
  10307. - unrenderDrag
  10308. */
  10309. ExternalDropping.prototype.end = function () {
  10310. if (this.dragListener) {
  10311. this.dragListener.endInteraction();
  10312. }
  10313. };
  10314. ExternalDropping.prototype.bindToDocument = function () {
  10315. this.listenTo($(document), {
  10316. dragstart: this.handleDragStart,
  10317. sortstart: this.handleDragStart // jqui
  10318. });
  10319. };
  10320. ExternalDropping.prototype.unbindFromDocument = function () {
  10321. this.stopListeningTo($(document));
  10322. };
  10323. // Called when a jQuery UI drag is initiated anywhere in the DOM
  10324. ExternalDropping.prototype.handleDragStart = function (ev, ui) {
  10325. var el;
  10326. var accept;
  10327. if (this.opt('droppable')) {
  10328. el = $((ui ? ui.item : null) || ev.target);
  10329. // Test that the dragged element passes the dropAccept selector or filter function.
  10330. // FYI, the default is "*" (matches all)
  10331. accept = this.opt('dropAccept');
  10332. if ($.isFunction(accept) ? accept.call(el[0], el) : el.is(accept)) {
  10333. if (!this.isDragging) {
  10334. this.listenToExternalDrag(el, ev, ui);
  10335. }
  10336. }
  10337. }
  10338. };
  10339. // Called when a jQuery UI drag starts and it needs to be monitored for dropping
  10340. ExternalDropping.prototype.listenToExternalDrag = function (el, ev, ui) {
  10341. var _this = this;
  10342. var component = this.component;
  10343. var view = this.view;
  10344. var meta = getDraggedElMeta(el); // extra data about event drop, including possible event to create
  10345. var singleEventDef; // a null value signals an unsuccessful drag
  10346. // listener that tracks mouse movement over date-associated pixel regions
  10347. var dragListener = this.dragListener = new HitDragListener_1.default(component, {
  10348. interactionStart: function () {
  10349. _this.isDragging = true;
  10350. },
  10351. hitOver: function (hit) {
  10352. var isAllowed = true;
  10353. var hitFootprint = hit.component.getSafeHitFootprint(hit); // hit might not belong to this grid
  10354. var mutatedEventInstanceGroup;
  10355. if (hitFootprint) {
  10356. singleEventDef = _this.computeExternalDrop(hitFootprint, meta);
  10357. if (singleEventDef) {
  10358. mutatedEventInstanceGroup = new EventInstanceGroup_1.default(singleEventDef.buildInstances());
  10359. isAllowed = meta.eventProps ? // isEvent?
  10360. component.isEventInstanceGroupAllowed(mutatedEventInstanceGroup) :
  10361. component.isExternalInstanceGroupAllowed(mutatedEventInstanceGroup);
  10362. }
  10363. else {
  10364. isAllowed = false;
  10365. }
  10366. }
  10367. else {
  10368. isAllowed = false;
  10369. }
  10370. if (!isAllowed) {
  10371. singleEventDef = null;
  10372. util_1.disableCursor();
  10373. }
  10374. if (singleEventDef) {
  10375. component.renderDrag(// called without a seg parameter
  10376. component.eventRangesToEventFootprints(mutatedEventInstanceGroup.sliceRenderRanges(component.dateProfile.renderUnzonedRange, view.calendar)));
  10377. }
  10378. },
  10379. hitOut: function () {
  10380. singleEventDef = null; // signal unsuccessful
  10381. },
  10382. hitDone: function () {
  10383. util_1.enableCursor();
  10384. component.unrenderDrag();
  10385. },
  10386. interactionEnd: function (ev) {
  10387. if (singleEventDef) {
  10388. view.reportExternalDrop(singleEventDef, Boolean(meta.eventProps), // isEvent
  10389. Boolean(meta.stick), // isSticky
  10390. el, ev, ui);
  10391. }
  10392. _this.isDragging = false;
  10393. _this.dragListener = null;
  10394. }
  10395. });
  10396. dragListener.startDrag(ev); // start listening immediately
  10397. };
  10398. // Given a hit to be dropped upon, and misc data associated with the jqui drag (guaranteed to be a plain object),
  10399. // returns the zoned start/end dates for the event that would result from the hypothetical drop. end might be null.
  10400. // Returning a null value signals an invalid drop hit.
  10401. // DOES NOT consider overlap/constraint.
  10402. // Assumes both footprints are non-open-ended.
  10403. ExternalDropping.prototype.computeExternalDrop = function (componentFootprint, meta) {
  10404. var calendar = this.view.calendar;
  10405. var start = moment_ext_1.default.utc(componentFootprint.unzonedRange.startMs).stripZone();
  10406. var end;
  10407. var eventDef;
  10408. if (componentFootprint.isAllDay) {
  10409. // if dropped on an all-day span, and element's metadata specified a time, set it
  10410. if (meta.startTime) {
  10411. start.time(meta.startTime);
  10412. }
  10413. else {
  10414. start.stripTime();
  10415. }
  10416. }
  10417. if (meta.duration) {
  10418. end = start.clone().add(meta.duration);
  10419. }
  10420. start = calendar.applyTimezone(start);
  10421. if (end) {
  10422. end = calendar.applyTimezone(end);
  10423. }
  10424. eventDef = SingleEventDef_1.default.parse($.extend({}, meta.eventProps, {
  10425. start: start,
  10426. end: end
  10427. }), new EventSource_1.default(calendar));
  10428. return eventDef;
  10429. };
  10430. return ExternalDropping;
  10431. }(Interaction_1.default));
  10432. exports.default = ExternalDropping;
  10433. ListenerMixin_1.default.mixInto(ExternalDropping);
  10434. /* External-Dragging-Element Data
  10435. ----------------------------------------------------------------------------------------------------------------------*/
  10436. // Require all HTML5 data-* attributes used by FullCalendar to have this prefix.
  10437. // A value of '' will query attributes like data-event. A value of 'fc' will query attributes like data-fc-event.
  10438. exportHooks.dataAttrPrefix = '';
  10439. // Given a jQuery element that might represent a dragged FullCalendar event, returns an intermediate data structure
  10440. // to be used for Event Object creation.
  10441. // A defined `.eventProps`, even when empty, indicates that an event should be created.
  10442. function getDraggedElMeta(el) {
  10443. var prefix = exportHooks.dataAttrPrefix;
  10444. var eventProps; // properties for creating the event, not related to date/time
  10445. var startTime; // a Duration
  10446. var duration;
  10447. var stick;
  10448. if (prefix) {
  10449. prefix += '-';
  10450. }
  10451. eventProps = el.data(prefix + 'event') || null;
  10452. if (eventProps) {
  10453. if (typeof eventProps === 'object') {
  10454. eventProps = $.extend({}, eventProps); // make a copy
  10455. }
  10456. else {
  10457. eventProps = {};
  10458. }
  10459. // pluck special-cased date/time properties
  10460. startTime = eventProps.start;
  10461. if (startTime == null) {
  10462. startTime = eventProps.time;
  10463. } // accept 'time' as well
  10464. duration = eventProps.duration;
  10465. stick = eventProps.stick;
  10466. delete eventProps.start;
  10467. delete eventProps.time;
  10468. delete eventProps.duration;
  10469. delete eventProps.stick;
  10470. }
  10471. // fallback to standalone attribute values for each of the date/time properties
  10472. if (startTime == null) {
  10473. startTime = el.data(prefix + 'start');
  10474. }
  10475. if (startTime == null) {
  10476. startTime = el.data(prefix + 'time');
  10477. } // accept 'time' as well
  10478. if (duration == null) {
  10479. duration = el.data(prefix + 'duration');
  10480. }
  10481. if (stick == null) {
  10482. stick = el.data(prefix + 'stick');
  10483. }
  10484. // massage into correct data types
  10485. startTime = startTime != null ? moment.duration(startTime) : null;
  10486. duration = duration != null ? moment.duration(duration) : null;
  10487. stick = Boolean(stick);
  10488. return { eventProps: eventProps, startTime: startTime, duration: duration, stick: stick };
  10489. }
  10490. /***/ }),
  10491. /* 219 */
  10492. /***/ (function(module, exports, __webpack_require__) {
  10493. Object.defineProperty(exports, "__esModule", { value: true });
  10494. var tslib_1 = __webpack_require__(2);
  10495. var $ = __webpack_require__(3);
  10496. var util_1 = __webpack_require__(4);
  10497. var EventDefMutation_1 = __webpack_require__(36);
  10498. var EventDefDateMutation_1 = __webpack_require__(50);
  10499. var HitDragListener_1 = __webpack_require__(22);
  10500. var Interaction_1 = __webpack_require__(15);
  10501. var EventResizing = /** @class */ (function (_super) {
  10502. tslib_1.__extends(EventResizing, _super);
  10503. /*
  10504. component impements:
  10505. - bindSegHandlerToEl
  10506. - publiclyTrigger
  10507. - diffDates
  10508. - eventRangesToEventFootprints
  10509. - isEventInstanceGroupAllowed
  10510. - getSafeHitFootprint
  10511. */
  10512. function EventResizing(component, eventPointing) {
  10513. var _this = _super.call(this, component) || this;
  10514. _this.isResizing = false;
  10515. _this.eventPointing = eventPointing;
  10516. return _this;
  10517. }
  10518. EventResizing.prototype.end = function () {
  10519. if (this.dragListener) {
  10520. this.dragListener.endInteraction();
  10521. }
  10522. };
  10523. EventResizing.prototype.bindToEl = function (el) {
  10524. var component = this.component;
  10525. component.bindSegHandlerToEl(el, 'mousedown', this.handleMouseDown.bind(this));
  10526. component.bindSegHandlerToEl(el, 'touchstart', this.handleTouchStart.bind(this));
  10527. };
  10528. EventResizing.prototype.handleMouseDown = function (seg, ev) {
  10529. if (this.component.canStartResize(seg, ev)) {
  10530. this.buildDragListener(seg, $(ev.target).is('.fc-start-resizer'))
  10531. .startInteraction(ev, { distance: 5 });
  10532. }
  10533. };
  10534. EventResizing.prototype.handleTouchStart = function (seg, ev) {
  10535. if (this.component.canStartResize(seg, ev)) {
  10536. this.buildDragListener(seg, $(ev.target).is('.fc-start-resizer'))
  10537. .startInteraction(ev);
  10538. }
  10539. };
  10540. // Creates a listener that tracks the user as they resize an event segment.
  10541. // Generic enough to work with any type of Grid.
  10542. EventResizing.prototype.buildDragListener = function (seg, isStart) {
  10543. var _this = this;
  10544. var component = this.component;
  10545. var view = this.view;
  10546. var calendar = view.calendar;
  10547. var eventManager = calendar.eventManager;
  10548. var el = seg.el;
  10549. var eventDef = seg.footprint.eventDef;
  10550. var eventInstance = seg.footprint.eventInstance;
  10551. var isDragging;
  10552. var resizeMutation; // zoned event date properties. falsy if invalid resize
  10553. // Tracks mouse movement over the *grid's* coordinate map
  10554. var dragListener = this.dragListener = new HitDragListener_1.default(component, {
  10555. scroll: this.opt('dragScroll'),
  10556. subjectEl: el,
  10557. interactionStart: function () {
  10558. isDragging = false;
  10559. },
  10560. dragStart: function (ev) {
  10561. isDragging = true;
  10562. // ensure a mouseout on the manipulated event has been reported
  10563. _this.eventPointing.handleMouseout(seg, ev);
  10564. _this.segResizeStart(seg, ev);
  10565. },
  10566. hitOver: function (hit, isOrig, origHit) {
  10567. var isAllowed = true;
  10568. var origHitFootprint = component.getSafeHitFootprint(origHit);
  10569. var hitFootprint = component.getSafeHitFootprint(hit);
  10570. var mutatedEventInstanceGroup;
  10571. if (origHitFootprint && hitFootprint) {
  10572. resizeMutation = isStart ?
  10573. _this.computeEventStartResizeMutation(origHitFootprint, hitFootprint, seg.footprint) :
  10574. _this.computeEventEndResizeMutation(origHitFootprint, hitFootprint, seg.footprint);
  10575. if (resizeMutation) {
  10576. mutatedEventInstanceGroup = eventManager.buildMutatedEventInstanceGroup(eventDef.id, resizeMutation);
  10577. isAllowed = component.isEventInstanceGroupAllowed(mutatedEventInstanceGroup);
  10578. }
  10579. else {
  10580. isAllowed = false;
  10581. }
  10582. }
  10583. else {
  10584. isAllowed = false;
  10585. }
  10586. if (!isAllowed) {
  10587. resizeMutation = null;
  10588. util_1.disableCursor();
  10589. }
  10590. else if (resizeMutation.isEmpty()) {
  10591. // no change. (FYI, event dates might have zones)
  10592. resizeMutation = null;
  10593. }
  10594. if (resizeMutation) {
  10595. view.hideEventsWithId(seg.footprint.eventDef.id);
  10596. view.renderEventResize(component.eventRangesToEventFootprints(mutatedEventInstanceGroup.sliceRenderRanges(component.dateProfile.renderUnzonedRange, calendar)), seg);
  10597. }
  10598. },
  10599. hitOut: function () {
  10600. resizeMutation = null;
  10601. },
  10602. hitDone: function () {
  10603. view.unrenderEventResize(seg);
  10604. view.showEventsWithId(seg.footprint.eventDef.id);
  10605. util_1.enableCursor();
  10606. },
  10607. interactionEnd: function (ev) {
  10608. if (isDragging) {
  10609. _this.segResizeStop(seg, ev);
  10610. }
  10611. if (resizeMutation) {
  10612. // no need to re-show original, will rerender all anyways. esp important if eventRenderWait
  10613. view.reportEventResize(eventInstance, resizeMutation, el, ev);
  10614. }
  10615. _this.dragListener = null;
  10616. }
  10617. });
  10618. return dragListener;
  10619. };
  10620. // Called before event segment resizing starts
  10621. EventResizing.prototype.segResizeStart = function (seg, ev) {
  10622. this.isResizing = true;
  10623. this.component.publiclyTrigger('eventResizeStart', {
  10624. context: seg.el[0],
  10625. args: [
  10626. seg.footprint.getEventLegacy(),
  10627. ev,
  10628. {},
  10629. this.view
  10630. ]
  10631. });
  10632. };
  10633. // Called after event segment resizing stops
  10634. EventResizing.prototype.segResizeStop = function (seg, ev) {
  10635. this.isResizing = false;
  10636. this.component.publiclyTrigger('eventResizeStop', {
  10637. context: seg.el[0],
  10638. args: [
  10639. seg.footprint.getEventLegacy(),
  10640. ev,
  10641. {},
  10642. this.view
  10643. ]
  10644. });
  10645. };
  10646. // Returns new date-information for an event segment being resized from its start
  10647. EventResizing.prototype.computeEventStartResizeMutation = function (startFootprint, endFootprint, origEventFootprint) {
  10648. var origRange = origEventFootprint.componentFootprint.unzonedRange;
  10649. var startDelta = this.component.diffDates(endFootprint.unzonedRange.getStart(), startFootprint.unzonedRange.getStart());
  10650. var dateMutation;
  10651. var eventDefMutation;
  10652. if (origRange.getStart().add(startDelta) < origRange.getEnd()) {
  10653. dateMutation = new EventDefDateMutation_1.default();
  10654. dateMutation.setStartDelta(startDelta);
  10655. eventDefMutation = new EventDefMutation_1.default();
  10656. eventDefMutation.setDateMutation(dateMutation);
  10657. return eventDefMutation;
  10658. }
  10659. return false;
  10660. };
  10661. // Returns new date-information for an event segment being resized from its end
  10662. EventResizing.prototype.computeEventEndResizeMutation = function (startFootprint, endFootprint, origEventFootprint) {
  10663. var origRange = origEventFootprint.componentFootprint.unzonedRange;
  10664. var endDelta = this.component.diffDates(endFootprint.unzonedRange.getEnd(), startFootprint.unzonedRange.getEnd());
  10665. var dateMutation;
  10666. var eventDefMutation;
  10667. if (origRange.getEnd().add(endDelta) > origRange.getStart()) {
  10668. dateMutation = new EventDefDateMutation_1.default();
  10669. dateMutation.setEndDelta(endDelta);
  10670. eventDefMutation = new EventDefMutation_1.default();
  10671. eventDefMutation.setDateMutation(dateMutation);
  10672. return eventDefMutation;
  10673. }
  10674. return false;
  10675. };
  10676. return EventResizing;
  10677. }(Interaction_1.default));
  10678. exports.default = EventResizing;
  10679. /***/ }),
  10680. /* 220 */
  10681. /***/ (function(module, exports, __webpack_require__) {
  10682. Object.defineProperty(exports, "__esModule", { value: true });
  10683. var tslib_1 = __webpack_require__(2);
  10684. var util_1 = __webpack_require__(4);
  10685. var EventDefMutation_1 = __webpack_require__(36);
  10686. var EventDefDateMutation_1 = __webpack_require__(50);
  10687. var DragListener_1 = __webpack_require__(54);
  10688. var HitDragListener_1 = __webpack_require__(22);
  10689. var MouseFollower_1 = __webpack_require__(240);
  10690. var Interaction_1 = __webpack_require__(15);
  10691. var EventDragging = /** @class */ (function (_super) {
  10692. tslib_1.__extends(EventDragging, _super);
  10693. /*
  10694. component implements:
  10695. - bindSegHandlerToEl
  10696. - publiclyTrigger
  10697. - diffDates
  10698. - eventRangesToEventFootprints
  10699. - isEventInstanceGroupAllowed
  10700. */
  10701. function EventDragging(component, eventPointing) {
  10702. var _this = _super.call(this, component) || this;
  10703. _this.isDragging = false;
  10704. _this.eventPointing = eventPointing;
  10705. return _this;
  10706. }
  10707. EventDragging.prototype.end = function () {
  10708. if (this.dragListener) {
  10709. this.dragListener.endInteraction();
  10710. }
  10711. };
  10712. EventDragging.prototype.getSelectionDelay = function () {
  10713. var delay = this.opt('eventLongPressDelay');
  10714. if (delay == null) {
  10715. delay = this.opt('longPressDelay'); // fallback
  10716. }
  10717. return delay;
  10718. };
  10719. EventDragging.prototype.bindToEl = function (el) {
  10720. var component = this.component;
  10721. component.bindSegHandlerToEl(el, 'mousedown', this.handleMousedown.bind(this));
  10722. component.bindSegHandlerToEl(el, 'touchstart', this.handleTouchStart.bind(this));
  10723. };
  10724. EventDragging.prototype.handleMousedown = function (seg, ev) {
  10725. if (this.component.canStartDrag(seg, ev)) {
  10726. this.buildDragListener(seg).startInteraction(ev, { distance: 5 });
  10727. }
  10728. };
  10729. EventDragging.prototype.handleTouchStart = function (seg, ev) {
  10730. var component = this.component;
  10731. var settings = {
  10732. delay: this.view.isEventDefSelected(seg.footprint.eventDef) ? // already selected?
  10733. 0 : this.getSelectionDelay()
  10734. };
  10735. if (component.canStartDrag(seg, ev)) {
  10736. this.buildDragListener(seg).startInteraction(ev, settings);
  10737. }
  10738. else if (component.canStartSelection(seg, ev)) {
  10739. this.buildSelectListener(seg).startInteraction(ev, settings);
  10740. }
  10741. };
  10742. // seg isn't draggable, but let's use a generic DragListener
  10743. // simply for the delay, so it can be selected.
  10744. // Has side effect of setting/unsetting `dragListener`
  10745. EventDragging.prototype.buildSelectListener = function (seg) {
  10746. var _this = this;
  10747. var view = this.view;
  10748. var eventDef = seg.footprint.eventDef;
  10749. var eventInstance = seg.footprint.eventInstance; // null for inverse-background events
  10750. if (this.dragListener) {
  10751. return this.dragListener;
  10752. }
  10753. var dragListener = this.dragListener = new DragListener_1.default({
  10754. dragStart: function (ev) {
  10755. if (dragListener.isTouch &&
  10756. !view.isEventDefSelected(eventDef) &&
  10757. eventInstance) {
  10758. // if not previously selected, will fire after a delay. then, select the event
  10759. view.selectEventInstance(eventInstance);
  10760. }
  10761. },
  10762. interactionEnd: function (ev) {
  10763. _this.dragListener = null;
  10764. }
  10765. });
  10766. return dragListener;
  10767. };
  10768. // Builds a listener that will track user-dragging on an event segment.
  10769. // Generic enough to work with any type of Grid.
  10770. // Has side effect of setting/unsetting `dragListener`
  10771. EventDragging.prototype.buildDragListener = function (seg) {
  10772. var _this = this;
  10773. var component = this.component;
  10774. var view = this.view;
  10775. var calendar = view.calendar;
  10776. var eventManager = calendar.eventManager;
  10777. var el = seg.el;
  10778. var eventDef = seg.footprint.eventDef;
  10779. var eventInstance = seg.footprint.eventInstance; // null for inverse-background events
  10780. var isDragging;
  10781. var mouseFollower; // A clone of the original element that will move with the mouse
  10782. var eventDefMutation;
  10783. if (this.dragListener) {
  10784. return this.dragListener;
  10785. }
  10786. // Tracks mouse movement over the *view's* coordinate map. Allows dragging and dropping between subcomponents
  10787. // of the view.
  10788. var dragListener = this.dragListener = new HitDragListener_1.default(view, {
  10789. scroll: this.opt('dragScroll'),
  10790. subjectEl: el,
  10791. subjectCenter: true,
  10792. interactionStart: function (ev) {
  10793. seg.component = component; // for renderDrag
  10794. isDragging = false;
  10795. mouseFollower = new MouseFollower_1.default(seg.el, {
  10796. additionalClass: 'fc-dragging',
  10797. parentEl: view.el,
  10798. opacity: dragListener.isTouch ? null : _this.opt('dragOpacity'),
  10799. revertDuration: _this.opt('dragRevertDuration'),
  10800. zIndex: 2 // one above the .fc-view
  10801. });
  10802. mouseFollower.hide(); // don't show until we know this is a real drag
  10803. mouseFollower.start(ev);
  10804. },
  10805. dragStart: function (ev) {
  10806. if (dragListener.isTouch &&
  10807. !view.isEventDefSelected(eventDef) &&
  10808. eventInstance) {
  10809. // if not previously selected, will fire after a delay. then, select the event
  10810. view.selectEventInstance(eventInstance);
  10811. }
  10812. isDragging = true;
  10813. // ensure a mouseout on the manipulated event has been reported
  10814. _this.eventPointing.handleMouseout(seg, ev);
  10815. _this.segDragStart(seg, ev);
  10816. view.hideEventsWithId(seg.footprint.eventDef.id);
  10817. },
  10818. hitOver: function (hit, isOrig, origHit) {
  10819. var isAllowed = true;
  10820. var origFootprint;
  10821. var footprint;
  10822. var mutatedEventInstanceGroup;
  10823. // starting hit could be forced (DayGrid.limit)
  10824. if (seg.hit) {
  10825. origHit = seg.hit;
  10826. }
  10827. // hit might not belong to this grid, so query origin grid
  10828. origFootprint = origHit.component.getSafeHitFootprint(origHit);
  10829. footprint = hit.component.getSafeHitFootprint(hit);
  10830. if (origFootprint && footprint) {
  10831. eventDefMutation = _this.computeEventDropMutation(origFootprint, footprint, eventDef);
  10832. if (eventDefMutation) {
  10833. mutatedEventInstanceGroup = eventManager.buildMutatedEventInstanceGroup(eventDef.id, eventDefMutation);
  10834. isAllowed = component.isEventInstanceGroupAllowed(mutatedEventInstanceGroup);
  10835. }
  10836. else {
  10837. isAllowed = false;
  10838. }
  10839. }
  10840. else {
  10841. isAllowed = false;
  10842. }
  10843. if (!isAllowed) {
  10844. eventDefMutation = null;
  10845. util_1.disableCursor();
  10846. }
  10847. // if a valid drop location, have the subclass render a visual indication
  10848. if (eventDefMutation &&
  10849. view.renderDrag(// truthy if rendered something
  10850. component.eventRangesToEventFootprints(mutatedEventInstanceGroup.sliceRenderRanges(component.dateProfile.renderUnzonedRange, calendar)), seg, dragListener.isTouch)) {
  10851. mouseFollower.hide(); // if the subclass is already using a mock event "helper", hide our own
  10852. }
  10853. else {
  10854. mouseFollower.show(); // otherwise, have the helper follow the mouse (no snapping)
  10855. }
  10856. if (isOrig) {
  10857. // needs to have moved hits to be a valid drop
  10858. eventDefMutation = null;
  10859. }
  10860. },
  10861. hitOut: function () {
  10862. view.unrenderDrag(seg); // unrender whatever was done in renderDrag
  10863. mouseFollower.show(); // show in case we are moving out of all hits
  10864. eventDefMutation = null;
  10865. },
  10866. hitDone: function () {
  10867. util_1.enableCursor();
  10868. },
  10869. interactionEnd: function (ev) {
  10870. delete seg.component; // prevent side effects
  10871. // do revert animation if hasn't changed. calls a callback when finished (whether animation or not)
  10872. mouseFollower.stop(!eventDefMutation, function () {
  10873. if (isDragging) {
  10874. view.unrenderDrag(seg);
  10875. _this.segDragStop(seg, ev);
  10876. }
  10877. view.showEventsWithId(seg.footprint.eventDef.id);
  10878. if (eventDefMutation) {
  10879. // no need to re-show original, will rerender all anyways. esp important if eventRenderWait
  10880. view.reportEventDrop(eventInstance, eventDefMutation, el, ev);
  10881. }
  10882. });
  10883. _this.dragListener = null;
  10884. }
  10885. });
  10886. return dragListener;
  10887. };
  10888. // Called before event segment dragging starts
  10889. EventDragging.prototype.segDragStart = function (seg, ev) {
  10890. this.isDragging = true;
  10891. this.component.publiclyTrigger('eventDragStart', {
  10892. context: seg.el[0],
  10893. args: [
  10894. seg.footprint.getEventLegacy(),
  10895. ev,
  10896. {},
  10897. this.view
  10898. ]
  10899. });
  10900. };
  10901. // Called after event segment dragging stops
  10902. EventDragging.prototype.segDragStop = function (seg, ev) {
  10903. this.isDragging = false;
  10904. this.component.publiclyTrigger('eventDragStop', {
  10905. context: seg.el[0],
  10906. args: [
  10907. seg.footprint.getEventLegacy(),
  10908. ev,
  10909. {},
  10910. this.view
  10911. ]
  10912. });
  10913. };
  10914. // DOES NOT consider overlap/constraint
  10915. EventDragging.prototype.computeEventDropMutation = function (startFootprint, endFootprint, eventDef) {
  10916. var eventDefMutation = new EventDefMutation_1.default();
  10917. eventDefMutation.setDateMutation(this.computeEventDateMutation(startFootprint, endFootprint));
  10918. return eventDefMutation;
  10919. };
  10920. EventDragging.prototype.computeEventDateMutation = function (startFootprint, endFootprint) {
  10921. var date0 = startFootprint.unzonedRange.getStart();
  10922. var date1 = endFootprint.unzonedRange.getStart();
  10923. var clearEnd = false;
  10924. var forceTimed = false;
  10925. var forceAllDay = false;
  10926. var dateDelta;
  10927. var dateMutation;
  10928. if (startFootprint.isAllDay !== endFootprint.isAllDay) {
  10929. clearEnd = true;
  10930. if (endFootprint.isAllDay) {
  10931. forceAllDay = true;
  10932. date0.stripTime();
  10933. }
  10934. else {
  10935. forceTimed = true;
  10936. }
  10937. }
  10938. dateDelta = this.component.diffDates(date1, date0);
  10939. dateMutation = new EventDefDateMutation_1.default();
  10940. dateMutation.clearEnd = clearEnd;
  10941. dateMutation.forceTimed = forceTimed;
  10942. dateMutation.forceAllDay = forceAllDay;
  10943. dateMutation.setDateDelta(dateDelta);
  10944. return dateMutation;
  10945. };
  10946. return EventDragging;
  10947. }(Interaction_1.default));
  10948. exports.default = EventDragging;
  10949. /***/ }),
  10950. /* 221 */
  10951. /***/ (function(module, exports, __webpack_require__) {
  10952. Object.defineProperty(exports, "__esModule", { value: true });
  10953. var tslib_1 = __webpack_require__(2);
  10954. var util_1 = __webpack_require__(4);
  10955. var HitDragListener_1 = __webpack_require__(22);
  10956. var ComponentFootprint_1 = __webpack_require__(12);
  10957. var UnzonedRange_1 = __webpack_require__(5);
  10958. var Interaction_1 = __webpack_require__(15);
  10959. var DateSelecting = /** @class */ (function (_super) {
  10960. tslib_1.__extends(DateSelecting, _super);
  10961. /*
  10962. component must implement:
  10963. - bindDateHandlerToEl
  10964. - getSafeHitFootprint
  10965. - renderHighlight
  10966. - unrenderHighlight
  10967. */
  10968. function DateSelecting(component) {
  10969. var _this = _super.call(this, component) || this;
  10970. _this.dragListener = _this.buildDragListener();
  10971. return _this;
  10972. }
  10973. DateSelecting.prototype.end = function () {
  10974. this.dragListener.endInteraction();
  10975. };
  10976. DateSelecting.prototype.getDelay = function () {
  10977. var delay = this.opt('selectLongPressDelay');
  10978. if (delay == null) {
  10979. delay = this.opt('longPressDelay'); // fallback
  10980. }
  10981. return delay;
  10982. };
  10983. DateSelecting.prototype.bindToEl = function (el) {
  10984. var _this = this;
  10985. var component = this.component;
  10986. var dragListener = this.dragListener;
  10987. component.bindDateHandlerToEl(el, 'mousedown', function (ev) {
  10988. if (_this.opt('selectable') && !component.shouldIgnoreMouse()) {
  10989. dragListener.startInteraction(ev, {
  10990. distance: _this.opt('selectMinDistance')
  10991. });
  10992. }
  10993. });
  10994. component.bindDateHandlerToEl(el, 'touchstart', function (ev) {
  10995. if (_this.opt('selectable') && !component.shouldIgnoreTouch()) {
  10996. dragListener.startInteraction(ev, {
  10997. delay: _this.getDelay()
  10998. });
  10999. }
  11000. });
  11001. util_1.preventSelection(el);
  11002. };
  11003. // Creates a listener that tracks the user's drag across day elements, for day selecting.
  11004. DateSelecting.prototype.buildDragListener = function () {
  11005. var _this = this;
  11006. var component = this.component;
  11007. var selectionFootprint; // null if invalid selection
  11008. var dragListener = new HitDragListener_1.default(component, {
  11009. scroll: this.opt('dragScroll'),
  11010. interactionStart: function () {
  11011. selectionFootprint = null;
  11012. },
  11013. dragStart: function (ev) {
  11014. _this.view.unselect(ev); // since we could be rendering a new selection, we want to clear any old one
  11015. },
  11016. hitOver: function (hit, isOrig, origHit) {
  11017. var origHitFootprint;
  11018. var hitFootprint;
  11019. if (origHit) {
  11020. origHitFootprint = component.getSafeHitFootprint(origHit);
  11021. hitFootprint = component.getSafeHitFootprint(hit);
  11022. if (origHitFootprint && hitFootprint) {
  11023. selectionFootprint = _this.computeSelection(origHitFootprint, hitFootprint);
  11024. }
  11025. else {
  11026. selectionFootprint = null;
  11027. }
  11028. if (selectionFootprint) {
  11029. component.renderSelectionFootprint(selectionFootprint);
  11030. }
  11031. else if (selectionFootprint === false) {
  11032. util_1.disableCursor();
  11033. }
  11034. }
  11035. },
  11036. hitOut: function () {
  11037. selectionFootprint = null;
  11038. component.unrenderSelection();
  11039. },
  11040. hitDone: function () {
  11041. util_1.enableCursor();
  11042. },
  11043. interactionEnd: function (ev, isCancelled) {
  11044. if (!isCancelled && selectionFootprint) {
  11045. // the selection will already have been rendered. just report it
  11046. _this.view.reportSelection(selectionFootprint, ev);
  11047. }
  11048. }
  11049. });
  11050. return dragListener;
  11051. };
  11052. // Given the first and last date-spans of a selection, returns another date-span object.
  11053. // Subclasses can override and provide additional data in the span object. Will be passed to renderSelectionFootprint().
  11054. // Will return false if the selection is invalid and this should be indicated to the user.
  11055. // Will return null/undefined if a selection invalid but no error should be reported.
  11056. DateSelecting.prototype.computeSelection = function (footprint0, footprint1) {
  11057. var wholeFootprint = this.computeSelectionFootprint(footprint0, footprint1);
  11058. if (wholeFootprint && !this.isSelectionFootprintAllowed(wholeFootprint)) {
  11059. return false;
  11060. }
  11061. return wholeFootprint;
  11062. };
  11063. // Given two spans, must return the combination of the two.
  11064. // TODO: do this separation of concerns (combining VS validation) for event dnd/resize too.
  11065. // Assumes both footprints are non-open-ended.
  11066. DateSelecting.prototype.computeSelectionFootprint = function (footprint0, footprint1) {
  11067. var ms = [
  11068. footprint0.unzonedRange.startMs,
  11069. footprint0.unzonedRange.endMs,
  11070. footprint1.unzonedRange.startMs,
  11071. footprint1.unzonedRange.endMs
  11072. ];
  11073. ms.sort(util_1.compareNumbers);
  11074. return new ComponentFootprint_1.default(new UnzonedRange_1.default(ms[0], ms[3]), footprint0.isAllDay);
  11075. };
  11076. DateSelecting.prototype.isSelectionFootprintAllowed = function (componentFootprint) {
  11077. return this.component.dateProfile.validUnzonedRange.containsRange(componentFootprint.unzonedRange) &&
  11078. this.view.calendar.constraints.isSelectionFootprintAllowed(componentFootprint);
  11079. };
  11080. return DateSelecting;
  11081. }(Interaction_1.default));
  11082. exports.default = DateSelecting;
  11083. /***/ }),
  11084. /* 222 */
  11085. /***/ (function(module, exports, __webpack_require__) {
  11086. Object.defineProperty(exports, "__esModule", { value: true });
  11087. var tslib_1 = __webpack_require__(2);
  11088. var moment = __webpack_require__(0);
  11089. var $ = __webpack_require__(3);
  11090. var util_1 = __webpack_require__(4);
  11091. var Scroller_1 = __webpack_require__(39);
  11092. var View_1 = __webpack_require__(41);
  11093. var TimeGrid_1 = __webpack_require__(223);
  11094. var DayGrid_1 = __webpack_require__(61);
  11095. var AGENDA_ALL_DAY_EVENT_LIMIT = 5;
  11096. /* An abstract class for all agenda-related views. Displays one more columns with time slots running vertically.
  11097. ----------------------------------------------------------------------------------------------------------------------*/
  11098. // Is a manager for the TimeGrid subcomponent and possibly the DayGrid subcomponent (if allDaySlot is on).
  11099. // Responsible for managing width/height.
  11100. var AgendaView = /** @class */ (function (_super) {
  11101. tslib_1.__extends(AgendaView, _super);
  11102. function AgendaView(calendar, viewSpec) {
  11103. var _this = _super.call(this, calendar, viewSpec) || this;
  11104. _this.usesMinMaxTime = true; // indicates that minTime/maxTime affects rendering
  11105. _this.timeGrid = _this.instantiateTimeGrid();
  11106. _this.addChild(_this.timeGrid);
  11107. if (_this.opt('allDaySlot')) {
  11108. _this.dayGrid = _this.instantiateDayGrid(); // the all-day subcomponent of this view
  11109. _this.addChild(_this.dayGrid);
  11110. }
  11111. _this.scroller = new Scroller_1.default({
  11112. overflowX: 'hidden',
  11113. overflowY: 'auto'
  11114. });
  11115. return _this;
  11116. }
  11117. // Instantiates the TimeGrid object this view needs. Draws from this.timeGridClass
  11118. AgendaView.prototype.instantiateTimeGrid = function () {
  11119. var SubClass = makeTimeGridSubclass(this.timeGridClass);
  11120. return new SubClass(this);
  11121. };
  11122. // Instantiates the DayGrid object this view might need. Draws from this.dayGridClass
  11123. AgendaView.prototype.instantiateDayGrid = function () {
  11124. var SubClass = makeDayGridSubclass(this.dayGridClass);
  11125. return new SubClass(this);
  11126. };
  11127. /* Rendering
  11128. ------------------------------------------------------------------------------------------------------------------*/
  11129. AgendaView.prototype.renderSkeleton = function () {
  11130. var timeGridWrapEl;
  11131. var timeGridEl;
  11132. this.el.addClass('fc-agenda-view').html(this.renderSkeletonHtml());
  11133. this.scroller.render();
  11134. timeGridWrapEl = this.scroller.el.addClass('fc-time-grid-container');
  11135. timeGridEl = $('<div class="fc-time-grid" />').appendTo(timeGridWrapEl);
  11136. this.el.find('.fc-body > tr > td').append(timeGridWrapEl);
  11137. this.timeGrid.headContainerEl = this.el.find('.fc-head-container');
  11138. this.timeGrid.setElement(timeGridEl);
  11139. if (this.dayGrid) {
  11140. this.dayGrid.setElement(this.el.find('.fc-day-grid'));
  11141. // have the day-grid extend it's coordinate area over the <hr> dividing the two grids
  11142. this.dayGrid.bottomCoordPadding = this.dayGrid.el.next('hr').outerHeight();
  11143. }
  11144. };
  11145. AgendaView.prototype.unrenderSkeleton = function () {
  11146. this.timeGrid.removeElement();
  11147. if (this.dayGrid) {
  11148. this.dayGrid.removeElement();
  11149. }
  11150. this.scroller.destroy();
  11151. };
  11152. // Builds the HTML skeleton for the view.
  11153. // The day-grid and time-grid components will render inside containers defined by this HTML.
  11154. AgendaView.prototype.renderSkeletonHtml = function () {
  11155. var theme = this.calendar.theme;
  11156. return '' +
  11157. '<table class="' + theme.getClass('tableGrid') + '">' +
  11158. (this.opt('columnHeader') ?
  11159. '<thead class="fc-head">' +
  11160. '<tr>' +
  11161. '<td class="fc-head-container ' + theme.getClass('widgetHeader') + '">&nbsp;</td>' +
  11162. '</tr>' +
  11163. '</thead>' :
  11164. '') +
  11165. '<tbody class="fc-body">' +
  11166. '<tr>' +
  11167. '<td class="' + theme.getClass('widgetContent') + '">' +
  11168. (this.dayGrid ?
  11169. '<div class="fc-day-grid"/>' +
  11170. '<hr class="fc-divider ' + theme.getClass('widgetHeader') + '"/>' :
  11171. '') +
  11172. '</td>' +
  11173. '</tr>' +
  11174. '</tbody>' +
  11175. '</table>';
  11176. };
  11177. // Generates an HTML attribute string for setting the width of the axis, if it is known
  11178. AgendaView.prototype.axisStyleAttr = function () {
  11179. if (this.axisWidth != null) {
  11180. return 'style="width:' + this.axisWidth + 'px"';
  11181. }
  11182. return '';
  11183. };
  11184. /* Now Indicator
  11185. ------------------------------------------------------------------------------------------------------------------*/
  11186. AgendaView.prototype.getNowIndicatorUnit = function () {
  11187. return this.timeGrid.getNowIndicatorUnit();
  11188. };
  11189. /* Dimensions
  11190. ------------------------------------------------------------------------------------------------------------------*/
  11191. // Adjusts the vertical dimensions of the view to the specified values
  11192. AgendaView.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  11193. var eventLimit;
  11194. var scrollerHeight;
  11195. var scrollbarWidths;
  11196. _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
  11197. // make all axis cells line up, and record the width so newly created axis cells will have it
  11198. this.axisWidth = util_1.matchCellWidths(this.el.find('.fc-axis'));
  11199. // hack to give the view some height prior to timeGrid's columns being rendered
  11200. // TODO: separate setting height from scroller VS timeGrid.
  11201. if (!this.timeGrid.colEls) {
  11202. if (!isAuto) {
  11203. scrollerHeight = this.computeScrollerHeight(totalHeight);
  11204. this.scroller.setHeight(scrollerHeight);
  11205. }
  11206. return;
  11207. }
  11208. // set of fake row elements that must compensate when scroller has scrollbars
  11209. var noScrollRowEls = this.el.find('.fc-row:not(.fc-scroller *)');
  11210. // reset all dimensions back to the original state
  11211. this.timeGrid.bottomRuleEl.hide(); // .show() will be called later if this <hr> is necessary
  11212. this.scroller.clear(); // sets height to 'auto' and clears overflow
  11213. util_1.uncompensateScroll(noScrollRowEls);
  11214. // limit number of events in the all-day area
  11215. if (this.dayGrid) {
  11216. this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed
  11217. eventLimit = this.opt('eventLimit');
  11218. if (eventLimit && typeof eventLimit !== 'number') {
  11219. eventLimit = AGENDA_ALL_DAY_EVENT_LIMIT; // make sure "auto" goes to a real number
  11220. }
  11221. if (eventLimit) {
  11222. this.dayGrid.limitRows(eventLimit);
  11223. }
  11224. }
  11225. if (!isAuto) {
  11226. scrollerHeight = this.computeScrollerHeight(totalHeight);
  11227. this.scroller.setHeight(scrollerHeight);
  11228. scrollbarWidths = this.scroller.getScrollbarWidths();
  11229. if (scrollbarWidths.left || scrollbarWidths.right) {
  11230. // make the all-day and header rows lines up
  11231. util_1.compensateScroll(noScrollRowEls, scrollbarWidths);
  11232. // the scrollbar compensation might have changed text flow, which might affect height, so recalculate
  11233. // and reapply the desired height to the scroller.
  11234. scrollerHeight = this.computeScrollerHeight(totalHeight);
  11235. this.scroller.setHeight(scrollerHeight);
  11236. }
  11237. // guarantees the same scrollbar widths
  11238. this.scroller.lockOverflow(scrollbarWidths);
  11239. // if there's any space below the slats, show the horizontal rule.
  11240. // this won't cause any new overflow, because lockOverflow already called.
  11241. if (this.timeGrid.getTotalSlatHeight() < scrollerHeight) {
  11242. this.timeGrid.bottomRuleEl.show();
  11243. }
  11244. }
  11245. };
  11246. // given a desired total height of the view, returns what the height of the scroller should be
  11247. AgendaView.prototype.computeScrollerHeight = function (totalHeight) {
  11248. return totalHeight -
  11249. util_1.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
  11250. };
  11251. /* Scroll
  11252. ------------------------------------------------------------------------------------------------------------------*/
  11253. // Computes the initial pre-configured scroll state prior to allowing the user to change it
  11254. AgendaView.prototype.computeInitialDateScroll = function () {
  11255. var scrollTime = moment.duration(this.opt('scrollTime'));
  11256. var top = this.timeGrid.computeTimeTop(scrollTime);
  11257. // zoom can give weird floating-point values. rather scroll a little bit further
  11258. top = Math.ceil(top);
  11259. if (top) {
  11260. top++; // to overcome top border that slots beyond the first have. looks better
  11261. }
  11262. return { top: top };
  11263. };
  11264. AgendaView.prototype.queryDateScroll = function () {
  11265. return { top: this.scroller.getScrollTop() };
  11266. };
  11267. AgendaView.prototype.applyDateScroll = function (scroll) {
  11268. if (scroll.top !== undefined) {
  11269. this.scroller.setScrollTop(scroll.top);
  11270. }
  11271. };
  11272. /* Hit Areas
  11273. ------------------------------------------------------------------------------------------------------------------*/
  11274. // forward all hit-related method calls to the grids (dayGrid might not be defined)
  11275. AgendaView.prototype.getHitFootprint = function (hit) {
  11276. // TODO: hit.component is set as a hack to identify where the hit came from
  11277. return hit.component.getHitFootprint(hit);
  11278. };
  11279. AgendaView.prototype.getHitEl = function (hit) {
  11280. // TODO: hit.component is set as a hack to identify where the hit came from
  11281. return hit.component.getHitEl(hit);
  11282. };
  11283. /* Event Rendering
  11284. ------------------------------------------------------------------------------------------------------------------*/
  11285. AgendaView.prototype.executeEventRender = function (eventsPayload) {
  11286. var dayEventsPayload = {};
  11287. var timedEventsPayload = {};
  11288. var id;
  11289. var eventInstanceGroup;
  11290. // separate the events into all-day and timed
  11291. for (id in eventsPayload) {
  11292. eventInstanceGroup = eventsPayload[id];
  11293. if (eventInstanceGroup.getEventDef().isAllDay()) {
  11294. dayEventsPayload[id] = eventInstanceGroup;
  11295. }
  11296. else {
  11297. timedEventsPayload[id] = eventInstanceGroup;
  11298. }
  11299. }
  11300. this.timeGrid.executeEventRender(timedEventsPayload);
  11301. if (this.dayGrid) {
  11302. this.dayGrid.executeEventRender(dayEventsPayload);
  11303. }
  11304. };
  11305. /* Dragging/Resizing Routing
  11306. ------------------------------------------------------------------------------------------------------------------*/
  11307. // A returned value of `true` signals that a mock "helper" event has been rendered.
  11308. AgendaView.prototype.renderDrag = function (eventFootprints, seg, isTouch) {
  11309. var groups = groupEventFootprintsByAllDay(eventFootprints);
  11310. var renderedHelper = false;
  11311. renderedHelper = this.timeGrid.renderDrag(groups.timed, seg, isTouch);
  11312. if (this.dayGrid) {
  11313. renderedHelper = this.dayGrid.renderDrag(groups.allDay, seg, isTouch) || renderedHelper;
  11314. }
  11315. return renderedHelper;
  11316. };
  11317. AgendaView.prototype.renderEventResize = function (eventFootprints, seg, isTouch) {
  11318. var groups = groupEventFootprintsByAllDay(eventFootprints);
  11319. this.timeGrid.renderEventResize(groups.timed, seg, isTouch);
  11320. if (this.dayGrid) {
  11321. this.dayGrid.renderEventResize(groups.allDay, seg, isTouch);
  11322. }
  11323. };
  11324. /* Selection
  11325. ------------------------------------------------------------------------------------------------------------------*/
  11326. // Renders a visual indication of a selection
  11327. AgendaView.prototype.renderSelectionFootprint = function (componentFootprint) {
  11328. if (!componentFootprint.isAllDay) {
  11329. this.timeGrid.renderSelectionFootprint(componentFootprint);
  11330. }
  11331. else if (this.dayGrid) {
  11332. this.dayGrid.renderSelectionFootprint(componentFootprint);
  11333. }
  11334. };
  11335. return AgendaView;
  11336. }(View_1.default));
  11337. exports.default = AgendaView;
  11338. AgendaView.prototype.timeGridClass = TimeGrid_1.default;
  11339. AgendaView.prototype.dayGridClass = DayGrid_1.default;
  11340. // Will customize the rendering behavior of the AgendaView's timeGrid
  11341. function makeTimeGridSubclass(SuperClass) {
  11342. return /** @class */ (function (_super) {
  11343. tslib_1.__extends(SubClass, _super);
  11344. function SubClass() {
  11345. return _super !== null && _super.apply(this, arguments) || this;
  11346. }
  11347. // Generates the HTML that will go before the day-of week header cells
  11348. SubClass.prototype.renderHeadIntroHtml = function () {
  11349. var view = this.view;
  11350. var calendar = view.calendar;
  11351. var weekStart = calendar.msToUtcMoment(this.dateProfile.renderUnzonedRange.startMs, true);
  11352. var weekText;
  11353. if (this.opt('weekNumbers')) {
  11354. weekText = weekStart.format(this.opt('smallWeekFormat'));
  11355. return '' +
  11356. '<th class="fc-axis fc-week-number ' + calendar.theme.getClass('widgetHeader') + '" ' + view.axisStyleAttr() + '>' +
  11357. view.buildGotoAnchorHtml(// aside from link, important for matchCellWidths
  11358. { date: weekStart, type: 'week', forceOff: this.colCnt > 1 }, util_1.htmlEscape(weekText) // inner HTML
  11359. ) +
  11360. '</th>';
  11361. }
  11362. else {
  11363. return '<th class="fc-axis ' + calendar.theme.getClass('widgetHeader') + '" ' + view.axisStyleAttr() + '></th>';
  11364. }
  11365. };
  11366. // Generates the HTML that goes before the bg of the TimeGrid slot area. Long vertical column.
  11367. SubClass.prototype.renderBgIntroHtml = function () {
  11368. var view = this.view;
  11369. return '<td class="fc-axis ' + view.calendar.theme.getClass('widgetContent') + '" ' + view.axisStyleAttr() + '></td>';
  11370. };
  11371. // Generates the HTML that goes before all other types of cells.
  11372. // Affects content-skeleton, helper-skeleton, highlight-skeleton for both the time-grid and day-grid.
  11373. SubClass.prototype.renderIntroHtml = function () {
  11374. var view = this.view;
  11375. return '<td class="fc-axis" ' + view.axisStyleAttr() + '></td>';
  11376. };
  11377. return SubClass;
  11378. }(SuperClass));
  11379. }
  11380. // Will customize the rendering behavior of the AgendaView's dayGrid
  11381. function makeDayGridSubclass(SuperClass) {
  11382. return /** @class */ (function (_super) {
  11383. tslib_1.__extends(SubClass, _super);
  11384. function SubClass() {
  11385. return _super !== null && _super.apply(this, arguments) || this;
  11386. }
  11387. // Generates the HTML that goes before the all-day cells
  11388. SubClass.prototype.renderBgIntroHtml = function () {
  11389. var view = this.view;
  11390. return '' +
  11391. '<td class="fc-axis ' + view.calendar.theme.getClass('widgetContent') + '" ' + view.axisStyleAttr() + '>' +
  11392. '<span>' + // needed for matchCellWidths
  11393. view.getAllDayHtml() +
  11394. '</span>' +
  11395. '</td>';
  11396. };
  11397. // Generates the HTML that goes before all other types of cells.
  11398. // Affects content-skeleton, helper-skeleton, highlight-skeleton for both the time-grid and day-grid.
  11399. SubClass.prototype.renderIntroHtml = function () {
  11400. var view = this.view;
  11401. return '<td class="fc-axis" ' + view.axisStyleAttr() + '></td>';
  11402. };
  11403. return SubClass;
  11404. }(SuperClass));
  11405. }
  11406. function groupEventFootprintsByAllDay(eventFootprints) {
  11407. var allDay = [];
  11408. var timed = [];
  11409. var i;
  11410. for (i = 0; i < eventFootprints.length; i++) {
  11411. if (eventFootprints[i].componentFootprint.isAllDay) {
  11412. allDay.push(eventFootprints[i]);
  11413. }
  11414. else {
  11415. timed.push(eventFootprints[i]);
  11416. }
  11417. }
  11418. return { allDay: allDay, timed: timed };
  11419. }
  11420. /***/ }),
  11421. /* 223 */
  11422. /***/ (function(module, exports, __webpack_require__) {
  11423. Object.defineProperty(exports, "__esModule", { value: true });
  11424. var tslib_1 = __webpack_require__(2);
  11425. var $ = __webpack_require__(3);
  11426. var moment = __webpack_require__(0);
  11427. var util_1 = __webpack_require__(4);
  11428. var InteractiveDateComponent_1 = __webpack_require__(40);
  11429. var BusinessHourRenderer_1 = __webpack_require__(56);
  11430. var StandardInteractionsMixin_1 = __webpack_require__(60);
  11431. var DayTableMixin_1 = __webpack_require__(55);
  11432. var CoordCache_1 = __webpack_require__(53);
  11433. var UnzonedRange_1 = __webpack_require__(5);
  11434. var ComponentFootprint_1 = __webpack_require__(12);
  11435. var TimeGridEventRenderer_1 = __webpack_require__(242);
  11436. var TimeGridHelperRenderer_1 = __webpack_require__(243);
  11437. var TimeGridFillRenderer_1 = __webpack_require__(244);
  11438. /* A component that renders one or more columns of vertical time slots
  11439. ----------------------------------------------------------------------------------------------------------------------*/
  11440. // We mixin DayTable, even though there is only a single row of days
  11441. // potential nice values for the slot-duration and interval-duration
  11442. // from largest to smallest
  11443. var AGENDA_STOCK_SUB_DURATIONS = [
  11444. { hours: 1 },
  11445. { minutes: 30 },
  11446. { minutes: 15 },
  11447. { seconds: 30 },
  11448. { seconds: 15 }
  11449. ];
  11450. var TimeGrid = /** @class */ (function (_super) {
  11451. tslib_1.__extends(TimeGrid, _super);
  11452. function TimeGrid(view) {
  11453. var _this = _super.call(this, view) || this;
  11454. _this.processOptions();
  11455. return _this;
  11456. }
  11457. // Slices up the given span (unzoned start/end with other misc data) into an array of segments
  11458. TimeGrid.prototype.componentFootprintToSegs = function (componentFootprint) {
  11459. var segs = this.sliceRangeByTimes(componentFootprint.unzonedRange);
  11460. var i;
  11461. for (i = 0; i < segs.length; i++) {
  11462. if (this.isRTL) {
  11463. segs[i].col = this.daysPerRow - 1 - segs[i].dayIndex;
  11464. }
  11465. else {
  11466. segs[i].col = segs[i].dayIndex;
  11467. }
  11468. }
  11469. return segs;
  11470. };
  11471. /* Date Handling
  11472. ------------------------------------------------------------------------------------------------------------------*/
  11473. TimeGrid.prototype.sliceRangeByTimes = function (unzonedRange) {
  11474. var segs = [];
  11475. var segRange;
  11476. var dayIndex;
  11477. for (dayIndex = 0; dayIndex < this.daysPerRow; dayIndex++) {
  11478. segRange = unzonedRange.intersect(this.dayRanges[dayIndex]);
  11479. if (segRange) {
  11480. segs.push({
  11481. startMs: segRange.startMs,
  11482. endMs: segRange.endMs,
  11483. isStart: segRange.isStart,
  11484. isEnd: segRange.isEnd,
  11485. dayIndex: dayIndex
  11486. });
  11487. }
  11488. }
  11489. return segs;
  11490. };
  11491. /* Options
  11492. ------------------------------------------------------------------------------------------------------------------*/
  11493. // Parses various options into properties of this object
  11494. TimeGrid.prototype.processOptions = function () {
  11495. var slotDuration = this.opt('slotDuration');
  11496. var snapDuration = this.opt('snapDuration');
  11497. var input;
  11498. slotDuration = moment.duration(slotDuration);
  11499. snapDuration = snapDuration ? moment.duration(snapDuration) : slotDuration;
  11500. this.slotDuration = slotDuration;
  11501. this.snapDuration = snapDuration;
  11502. this.snapsPerSlot = slotDuration / snapDuration; // TODO: ensure an integer multiple?
  11503. // might be an array value (for TimelineView).
  11504. // if so, getting the most granular entry (the last one probably).
  11505. input = this.opt('slotLabelFormat');
  11506. if ($.isArray(input)) {
  11507. input = input[input.length - 1];
  11508. }
  11509. this.labelFormat = input ||
  11510. this.opt('smallTimeFormat'); // the computed default
  11511. input = this.opt('slotLabelInterval');
  11512. this.labelInterval = input ?
  11513. moment.duration(input) :
  11514. this.computeLabelInterval(slotDuration);
  11515. };
  11516. // Computes an automatic value for slotLabelInterval
  11517. TimeGrid.prototype.computeLabelInterval = function (slotDuration) {
  11518. var i;
  11519. var labelInterval;
  11520. var slotsPerLabel;
  11521. // find the smallest stock label interval that results in more than one slots-per-label
  11522. for (i = AGENDA_STOCK_SUB_DURATIONS.length - 1; i >= 0; i--) {
  11523. labelInterval = moment.duration(AGENDA_STOCK_SUB_DURATIONS[i]);
  11524. slotsPerLabel = util_1.divideDurationByDuration(labelInterval, slotDuration);
  11525. if (util_1.isInt(slotsPerLabel) && slotsPerLabel > 1) {
  11526. return labelInterval;
  11527. }
  11528. }
  11529. return moment.duration(slotDuration); // fall back. clone
  11530. };
  11531. /* Date Rendering
  11532. ------------------------------------------------------------------------------------------------------------------*/
  11533. TimeGrid.prototype.renderDates = function (dateProfile) {
  11534. this.dateProfile = dateProfile;
  11535. this.updateDayTable();
  11536. this.renderSlats();
  11537. this.renderColumns();
  11538. };
  11539. TimeGrid.prototype.unrenderDates = function () {
  11540. // this.unrenderSlats(); // don't need this because repeated .html() calls clear
  11541. this.unrenderColumns();
  11542. };
  11543. TimeGrid.prototype.renderSkeleton = function () {
  11544. var theme = this.view.calendar.theme;
  11545. this.el.html('<div class="fc-bg"></div>' +
  11546. '<div class="fc-slats"></div>' +
  11547. '<hr class="fc-divider ' + theme.getClass('widgetHeader') + '" style="display:none" />');
  11548. this.bottomRuleEl = this.el.find('hr');
  11549. };
  11550. TimeGrid.prototype.renderSlats = function () {
  11551. var theme = this.view.calendar.theme;
  11552. this.slatContainerEl = this.el.find('> .fc-slats')
  11553. .html(// avoids needing ::unrenderSlats()
  11554. '<table class="' + theme.getClass('tableGrid') + '">' +
  11555. this.renderSlatRowHtml() +
  11556. '</table>');
  11557. this.slatEls = this.slatContainerEl.find('tr');
  11558. this.slatCoordCache = new CoordCache_1.default({
  11559. els: this.slatEls,
  11560. isVertical: true
  11561. });
  11562. };
  11563. // Generates the HTML for the horizontal "slats" that run width-wise. Has a time axis on a side. Depends on RTL.
  11564. TimeGrid.prototype.renderSlatRowHtml = function () {
  11565. var view = this.view;
  11566. var calendar = view.calendar;
  11567. var theme = calendar.theme;
  11568. var isRTL = this.isRTL;
  11569. var dateProfile = this.dateProfile;
  11570. var html = '';
  11571. var slotTime = moment.duration(+dateProfile.minTime); // wish there was .clone() for durations
  11572. var slotIterator = moment.duration(0);
  11573. var slotDate; // will be on the view's first day, but we only care about its time
  11574. var isLabeled;
  11575. var axisHtml;
  11576. // Calculate the time for each slot
  11577. while (slotTime < dateProfile.maxTime) {
  11578. slotDate = calendar.msToUtcMoment(dateProfile.renderUnzonedRange.startMs).time(slotTime);
  11579. isLabeled = util_1.isInt(util_1.divideDurationByDuration(slotIterator, this.labelInterval));
  11580. axisHtml =
  11581. '<td class="fc-axis fc-time ' + theme.getClass('widgetContent') + '" ' + view.axisStyleAttr() + '>' +
  11582. (isLabeled ?
  11583. '<span>' + // for matchCellWidths
  11584. util_1.htmlEscape(slotDate.format(this.labelFormat)) +
  11585. '</span>' :
  11586. '') +
  11587. '</td>';
  11588. html +=
  11589. '<tr data-time="' + slotDate.format('HH:mm:ss') + '"' +
  11590. (isLabeled ? '' : ' class="fc-minor"') +
  11591. '>' +
  11592. (!isRTL ? axisHtml : '') +
  11593. '<td class="' + theme.getClass('widgetContent') + '"/>' +
  11594. (isRTL ? axisHtml : '') +
  11595. '</tr>';
  11596. slotTime.add(this.slotDuration);
  11597. slotIterator.add(this.slotDuration);
  11598. }
  11599. return html;
  11600. };
  11601. TimeGrid.prototype.renderColumns = function () {
  11602. var dateProfile = this.dateProfile;
  11603. var theme = this.view.calendar.theme;
  11604. this.dayRanges = this.dayDates.map(function (dayDate) {
  11605. return new UnzonedRange_1.default(dayDate.clone().add(dateProfile.minTime), dayDate.clone().add(dateProfile.maxTime));
  11606. });
  11607. if (this.headContainerEl) {
  11608. this.headContainerEl.html(this.renderHeadHtml());
  11609. }
  11610. this.el.find('> .fc-bg').html('<table class="' + theme.getClass('tableGrid') + '">' +
  11611. this.renderBgTrHtml(0) + // row=0
  11612. '</table>');
  11613. this.colEls = this.el.find('.fc-day, .fc-disabled-day');
  11614. this.colCoordCache = new CoordCache_1.default({
  11615. els: this.colEls,
  11616. isHorizontal: true
  11617. });
  11618. this.renderContentSkeleton();
  11619. };
  11620. TimeGrid.prototype.unrenderColumns = function () {
  11621. this.unrenderContentSkeleton();
  11622. };
  11623. /* Content Skeleton
  11624. ------------------------------------------------------------------------------------------------------------------*/
  11625. // Renders the DOM that the view's content will live in
  11626. TimeGrid.prototype.renderContentSkeleton = function () {
  11627. var cellHtml = '';
  11628. var i;
  11629. var skeletonEl;
  11630. for (i = 0; i < this.colCnt; i++) {
  11631. cellHtml +=
  11632. '<td>' +
  11633. '<div class="fc-content-col">' +
  11634. '<div class="fc-event-container fc-helper-container"></div>' +
  11635. '<div class="fc-event-container"></div>' +
  11636. '<div class="fc-highlight-container"></div>' +
  11637. '<div class="fc-bgevent-container"></div>' +
  11638. '<div class="fc-business-container"></div>' +
  11639. '</div>' +
  11640. '</td>';
  11641. }
  11642. skeletonEl = this.contentSkeletonEl = $('<div class="fc-content-skeleton">' +
  11643. '<table>' +
  11644. '<tr>' + cellHtml + '</tr>' +
  11645. '</table>' +
  11646. '</div>');
  11647. this.colContainerEls = skeletonEl.find('.fc-content-col');
  11648. this.helperContainerEls = skeletonEl.find('.fc-helper-container');
  11649. this.fgContainerEls = skeletonEl.find('.fc-event-container:not(.fc-helper-container)');
  11650. this.bgContainerEls = skeletonEl.find('.fc-bgevent-container');
  11651. this.highlightContainerEls = skeletonEl.find('.fc-highlight-container');
  11652. this.businessContainerEls = skeletonEl.find('.fc-business-container');
  11653. this.bookendCells(skeletonEl.find('tr')); // TODO: do this on string level
  11654. this.el.append(skeletonEl);
  11655. };
  11656. TimeGrid.prototype.unrenderContentSkeleton = function () {
  11657. this.contentSkeletonEl.remove();
  11658. this.contentSkeletonEl = null;
  11659. this.colContainerEls = null;
  11660. this.helperContainerEls = null;
  11661. this.fgContainerEls = null;
  11662. this.bgContainerEls = null;
  11663. this.highlightContainerEls = null;
  11664. this.businessContainerEls = null;
  11665. };
  11666. // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's col
  11667. TimeGrid.prototype.groupSegsByCol = function (segs) {
  11668. var segsByCol = [];
  11669. var i;
  11670. for (i = 0; i < this.colCnt; i++) {
  11671. segsByCol.push([]);
  11672. }
  11673. for (i = 0; i < segs.length; i++) {
  11674. segsByCol[segs[i].col].push(segs[i]);
  11675. }
  11676. return segsByCol;
  11677. };
  11678. // Given segments grouped by column, insert the segments' elements into a parallel array of container
  11679. // elements, each living within a column.
  11680. TimeGrid.prototype.attachSegsByCol = function (segsByCol, containerEls) {
  11681. var col;
  11682. var segs;
  11683. var i;
  11684. for (col = 0; col < this.colCnt; col++) {
  11685. segs = segsByCol[col];
  11686. for (i = 0; i < segs.length; i++) {
  11687. containerEls.eq(col).append(segs[i].el);
  11688. }
  11689. }
  11690. };
  11691. /* Now Indicator
  11692. ------------------------------------------------------------------------------------------------------------------*/
  11693. TimeGrid.prototype.getNowIndicatorUnit = function () {
  11694. return 'minute'; // will refresh on the minute
  11695. };
  11696. TimeGrid.prototype.renderNowIndicator = function (date) {
  11697. // HACK: if date columns not ready for some reason (scheduler)
  11698. if (!this.colContainerEls) {
  11699. return;
  11700. }
  11701. // seg system might be overkill, but it handles scenario where line needs to be rendered
  11702. // more than once because of columns with the same date (resources columns for example)
  11703. var segs = this.componentFootprintToSegs(new ComponentFootprint_1.default(new UnzonedRange_1.default(date, date.valueOf() + 1), // protect against null range
  11704. false // all-day
  11705. ));
  11706. var top = this.computeDateTop(date, date);
  11707. var nodes = [];
  11708. var i;
  11709. // render lines within the columns
  11710. for (i = 0; i < segs.length; i++) {
  11711. nodes.push($('<div class="fc-now-indicator fc-now-indicator-line"></div>')
  11712. .css('top', top)
  11713. .appendTo(this.colContainerEls.eq(segs[i].col))[0]);
  11714. }
  11715. // render an arrow over the axis
  11716. if (segs.length > 0) {
  11717. nodes.push($('<div class="fc-now-indicator fc-now-indicator-arrow"></div>')
  11718. .css('top', top)
  11719. .appendTo(this.el.find('.fc-content-skeleton'))[0]);
  11720. }
  11721. this.nowIndicatorEls = $(nodes);
  11722. };
  11723. TimeGrid.prototype.unrenderNowIndicator = function () {
  11724. if (this.nowIndicatorEls) {
  11725. this.nowIndicatorEls.remove();
  11726. this.nowIndicatorEls = null;
  11727. }
  11728. };
  11729. /* Coordinates
  11730. ------------------------------------------------------------------------------------------------------------------*/
  11731. TimeGrid.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  11732. _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
  11733. this.slatCoordCache.build();
  11734. if (isResize) {
  11735. this.updateSegVerticals([].concat(this.eventRenderer.getSegs(), this.businessSegs || []));
  11736. }
  11737. };
  11738. TimeGrid.prototype.getTotalSlatHeight = function () {
  11739. return this.slatContainerEl.outerHeight();
  11740. };
  11741. // Computes the top coordinate, relative to the bounds of the grid, of the given date.
  11742. // `ms` can be a millisecond UTC time OR a UTC moment.
  11743. // A `startOfDayDate` must be given for avoiding ambiguity over how to treat midnight.
  11744. TimeGrid.prototype.computeDateTop = function (ms, startOfDayDate) {
  11745. return this.computeTimeTop(moment.duration(ms - startOfDayDate.clone().stripTime()));
  11746. };
  11747. // Computes the top coordinate, relative to the bounds of the grid, of the given time (a Duration).
  11748. TimeGrid.prototype.computeTimeTop = function (time) {
  11749. var len = this.slatEls.length;
  11750. var dateProfile = this.dateProfile;
  11751. var slatCoverage = (time - dateProfile.minTime) / this.slotDuration; // floating-point value of # of slots covered
  11752. var slatIndex;
  11753. var slatRemainder;
  11754. // compute a floating-point number for how many slats should be progressed through.
  11755. // from 0 to number of slats (inclusive)
  11756. // constrained because minTime/maxTime might be customized.
  11757. slatCoverage = Math.max(0, slatCoverage);
  11758. slatCoverage = Math.min(len, slatCoverage);
  11759. // an integer index of the furthest whole slat
  11760. // from 0 to number slats (*exclusive*, so len-1)
  11761. slatIndex = Math.floor(slatCoverage);
  11762. slatIndex = Math.min(slatIndex, len - 1);
  11763. // how much further through the slatIndex slat (from 0.0-1.0) must be covered in addition.
  11764. // could be 1.0 if slatCoverage is covering *all* the slots
  11765. slatRemainder = slatCoverage - slatIndex;
  11766. return this.slatCoordCache.getTopPosition(slatIndex) +
  11767. this.slatCoordCache.getHeight(slatIndex) * slatRemainder;
  11768. };
  11769. // Refreshes the CSS top/bottom coordinates for each segment element.
  11770. // Works when called after initial render, after a window resize/zoom for example.
  11771. TimeGrid.prototype.updateSegVerticals = function (segs) {
  11772. this.computeSegVerticals(segs);
  11773. this.assignSegVerticals(segs);
  11774. };
  11775. // For each segment in an array, computes and assigns its top and bottom properties
  11776. TimeGrid.prototype.computeSegVerticals = function (segs) {
  11777. var eventMinHeight = this.opt('agendaEventMinHeight');
  11778. var i;
  11779. var seg;
  11780. var dayDate;
  11781. for (i = 0; i < segs.length; i++) {
  11782. seg = segs[i];
  11783. dayDate = this.dayDates[seg.dayIndex];
  11784. seg.top = this.computeDateTop(seg.startMs, dayDate);
  11785. seg.bottom = Math.max(seg.top + eventMinHeight, this.computeDateTop(seg.endMs, dayDate));
  11786. }
  11787. };
  11788. // Given segments that already have their top/bottom properties computed, applies those values to
  11789. // the segments' elements.
  11790. TimeGrid.prototype.assignSegVerticals = function (segs) {
  11791. var i;
  11792. var seg;
  11793. for (i = 0; i < segs.length; i++) {
  11794. seg = segs[i];
  11795. seg.el.css(this.generateSegVerticalCss(seg));
  11796. }
  11797. };
  11798. // Generates an object with CSS properties for the top/bottom coordinates of a segment element
  11799. TimeGrid.prototype.generateSegVerticalCss = function (seg) {
  11800. return {
  11801. top: seg.top,
  11802. bottom: -seg.bottom // flipped because needs to be space beyond bottom edge of event container
  11803. };
  11804. };
  11805. /* Hit System
  11806. ------------------------------------------------------------------------------------------------------------------*/
  11807. TimeGrid.prototype.prepareHits = function () {
  11808. this.colCoordCache.build();
  11809. this.slatCoordCache.build();
  11810. };
  11811. TimeGrid.prototype.releaseHits = function () {
  11812. this.colCoordCache.clear();
  11813. // NOTE: don't clear slatCoordCache because we rely on it for computeTimeTop
  11814. };
  11815. TimeGrid.prototype.queryHit = function (leftOffset, topOffset) {
  11816. var snapsPerSlot = this.snapsPerSlot;
  11817. var colCoordCache = this.colCoordCache;
  11818. var slatCoordCache = this.slatCoordCache;
  11819. if (colCoordCache.isLeftInBounds(leftOffset) && slatCoordCache.isTopInBounds(topOffset)) {
  11820. var colIndex = colCoordCache.getHorizontalIndex(leftOffset);
  11821. var slatIndex = slatCoordCache.getVerticalIndex(topOffset);
  11822. if (colIndex != null && slatIndex != null) {
  11823. var slatTop = slatCoordCache.getTopOffset(slatIndex);
  11824. var slatHeight = slatCoordCache.getHeight(slatIndex);
  11825. var partial = (topOffset - slatTop) / slatHeight; // floating point number between 0 and 1
  11826. var localSnapIndex = Math.floor(partial * snapsPerSlot); // the snap # relative to start of slat
  11827. var snapIndex = slatIndex * snapsPerSlot + localSnapIndex;
  11828. var snapTop = slatTop + (localSnapIndex / snapsPerSlot) * slatHeight;
  11829. var snapBottom = slatTop + ((localSnapIndex + 1) / snapsPerSlot) * slatHeight;
  11830. return {
  11831. col: colIndex,
  11832. snap: snapIndex,
  11833. component: this,
  11834. left: colCoordCache.getLeftOffset(colIndex),
  11835. right: colCoordCache.getRightOffset(colIndex),
  11836. top: snapTop,
  11837. bottom: snapBottom
  11838. };
  11839. }
  11840. }
  11841. };
  11842. TimeGrid.prototype.getHitFootprint = function (hit) {
  11843. var start = this.getCellDate(0, hit.col); // row=0
  11844. var time = this.computeSnapTime(hit.snap); // pass in the snap-index
  11845. var end;
  11846. start.time(time);
  11847. end = start.clone().add(this.snapDuration);
  11848. return new ComponentFootprint_1.default(new UnzonedRange_1.default(start, end), false // all-day?
  11849. );
  11850. };
  11851. // Given a row number of the grid, representing a "snap", returns a time (Duration) from its start-of-day
  11852. TimeGrid.prototype.computeSnapTime = function (snapIndex) {
  11853. return moment.duration(this.dateProfile.minTime + this.snapDuration * snapIndex);
  11854. };
  11855. TimeGrid.prototype.getHitEl = function (hit) {
  11856. return this.colEls.eq(hit.col);
  11857. };
  11858. /* Event Drag Visualization
  11859. ------------------------------------------------------------------------------------------------------------------*/
  11860. // Renders a visual indication of an event being dragged over the specified date(s).
  11861. // A returned value of `true` signals that a mock "helper" event has been rendered.
  11862. TimeGrid.prototype.renderDrag = function (eventFootprints, seg, isTouch) {
  11863. var i;
  11864. if (seg) {
  11865. if (eventFootprints.length) {
  11866. this.helperRenderer.renderEventDraggingFootprints(eventFootprints, seg, isTouch);
  11867. // signal that a helper has been rendered
  11868. return true;
  11869. }
  11870. }
  11871. else {
  11872. for (i = 0; i < eventFootprints.length; i++) {
  11873. this.renderHighlight(eventFootprints[i].componentFootprint);
  11874. }
  11875. }
  11876. };
  11877. // Unrenders any visual indication of an event being dragged
  11878. TimeGrid.prototype.unrenderDrag = function () {
  11879. this.unrenderHighlight();
  11880. this.helperRenderer.unrender();
  11881. };
  11882. /* Event Resize Visualization
  11883. ------------------------------------------------------------------------------------------------------------------*/
  11884. // Renders a visual indication of an event being resized
  11885. TimeGrid.prototype.renderEventResize = function (eventFootprints, seg, isTouch) {
  11886. this.helperRenderer.renderEventResizingFootprints(eventFootprints, seg, isTouch);
  11887. };
  11888. // Unrenders any visual indication of an event being resized
  11889. TimeGrid.prototype.unrenderEventResize = function () {
  11890. this.helperRenderer.unrender();
  11891. };
  11892. /* Selection
  11893. ------------------------------------------------------------------------------------------------------------------*/
  11894. // Renders a visual indication of a selection. Overrides the default, which was to simply render a highlight.
  11895. TimeGrid.prototype.renderSelectionFootprint = function (componentFootprint) {
  11896. if (this.opt('selectHelper')) {
  11897. this.helperRenderer.renderComponentFootprint(componentFootprint);
  11898. }
  11899. else {
  11900. this.renderHighlight(componentFootprint);
  11901. }
  11902. };
  11903. // Unrenders any visual indication of a selection
  11904. TimeGrid.prototype.unrenderSelection = function () {
  11905. this.helperRenderer.unrender();
  11906. this.unrenderHighlight();
  11907. };
  11908. return TimeGrid;
  11909. }(InteractiveDateComponent_1.default));
  11910. exports.default = TimeGrid;
  11911. TimeGrid.prototype.eventRendererClass = TimeGridEventRenderer_1.default;
  11912. TimeGrid.prototype.businessHourRendererClass = BusinessHourRenderer_1.default;
  11913. TimeGrid.prototype.helperRendererClass = TimeGridHelperRenderer_1.default;
  11914. TimeGrid.prototype.fillRendererClass = TimeGridFillRenderer_1.default;
  11915. StandardInteractionsMixin_1.default.mixInto(TimeGrid);
  11916. DayTableMixin_1.default.mixInto(TimeGrid);
  11917. /***/ }),
  11918. /* 224 */
  11919. /***/ (function(module, exports, __webpack_require__) {
  11920. Object.defineProperty(exports, "__esModule", { value: true });
  11921. var tslib_1 = __webpack_require__(2);
  11922. var UnzonedRange_1 = __webpack_require__(5);
  11923. var DateProfileGenerator_1 = __webpack_require__(217);
  11924. var BasicViewDateProfileGenerator = /** @class */ (function (_super) {
  11925. tslib_1.__extends(BasicViewDateProfileGenerator, _super);
  11926. function BasicViewDateProfileGenerator() {
  11927. return _super !== null && _super.apply(this, arguments) || this;
  11928. }
  11929. // Computes the date range that will be rendered.
  11930. BasicViewDateProfileGenerator.prototype.buildRenderRange = function (currentUnzonedRange, currentRangeUnit, isRangeAllDay) {
  11931. var renderUnzonedRange = _super.prototype.buildRenderRange.call(this, currentUnzonedRange, currentRangeUnit, isRangeAllDay); // an UnzonedRange
  11932. var start = this.msToUtcMoment(renderUnzonedRange.startMs, isRangeAllDay);
  11933. var end = this.msToUtcMoment(renderUnzonedRange.endMs, isRangeAllDay);
  11934. // year and month views should be aligned with weeks. this is already done for week
  11935. if (/^(year|month)$/.test(currentRangeUnit)) {
  11936. start.startOf('week');
  11937. // make end-of-week if not already
  11938. if (end.weekday()) {
  11939. end.add(1, 'week').startOf('week'); // exclusively move backwards
  11940. }
  11941. }
  11942. return new UnzonedRange_1.default(start, end);
  11943. };
  11944. return BasicViewDateProfileGenerator;
  11945. }(DateProfileGenerator_1.default));
  11946. exports.default = BasicViewDateProfileGenerator;
  11947. /***/ }),
  11948. /* 225 */
  11949. /***/ (function(module, exports, __webpack_require__) {
  11950. Object.defineProperty(exports, "__esModule", { value: true });
  11951. var tslib_1 = __webpack_require__(2);
  11952. var moment = __webpack_require__(0);
  11953. var util_1 = __webpack_require__(4);
  11954. var BasicView_1 = __webpack_require__(62);
  11955. var MonthViewDateProfileGenerator_1 = __webpack_require__(249);
  11956. /* A month view with day cells running in rows (one-per-week) and columns
  11957. ----------------------------------------------------------------------------------------------------------------------*/
  11958. var MonthView = /** @class */ (function (_super) {
  11959. tslib_1.__extends(MonthView, _super);
  11960. function MonthView() {
  11961. return _super !== null && _super.apply(this, arguments) || this;
  11962. }
  11963. // Overrides the default BasicView behavior to have special multi-week auto-height logic
  11964. MonthView.prototype.setGridHeight = function (height, isAuto) {
  11965. // if auto, make the height of each row the height that it would be if there were 6 weeks
  11966. if (isAuto) {
  11967. height *= this.dayGrid.rowCnt / 6;
  11968. }
  11969. util_1.distributeHeight(this.dayGrid.rowEls, height, !isAuto); // if auto, don't compensate for height-hogging rows
  11970. };
  11971. MonthView.prototype.isDateInOtherMonth = function (date, dateProfile) {
  11972. return date.month() !== moment.utc(dateProfile.currentUnzonedRange.startMs).month(); // TODO: optimize
  11973. };
  11974. return MonthView;
  11975. }(BasicView_1.default));
  11976. exports.default = MonthView;
  11977. MonthView.prototype.dateProfileGeneratorClass = MonthViewDateProfileGenerator_1.default;
  11978. /***/ }),
  11979. /* 226 */
  11980. /***/ (function(module, exports, __webpack_require__) {
  11981. Object.defineProperty(exports, "__esModule", { value: true });
  11982. var tslib_1 = __webpack_require__(2);
  11983. var $ = __webpack_require__(3);
  11984. var util_1 = __webpack_require__(4);
  11985. var UnzonedRange_1 = __webpack_require__(5);
  11986. var View_1 = __webpack_require__(41);
  11987. var Scroller_1 = __webpack_require__(39);
  11988. var ListEventRenderer_1 = __webpack_require__(250);
  11989. var ListEventPointing_1 = __webpack_require__(251);
  11990. /*
  11991. Responsible for the scroller, and forwarding event-related actions into the "grid".
  11992. */
  11993. var ListView = /** @class */ (function (_super) {
  11994. tslib_1.__extends(ListView, _super);
  11995. function ListView(calendar, viewSpec) {
  11996. var _this = _super.call(this, calendar, viewSpec) || this;
  11997. _this.segSelector = '.fc-list-item'; // which elements accept event actions
  11998. _this.scroller = new Scroller_1.default({
  11999. overflowX: 'hidden',
  12000. overflowY: 'auto'
  12001. });
  12002. return _this;
  12003. }
  12004. ListView.prototype.renderSkeleton = function () {
  12005. this.el.addClass('fc-list-view ' +
  12006. this.calendar.theme.getClass('listView'));
  12007. this.scroller.render();
  12008. this.scroller.el.appendTo(this.el);
  12009. this.contentEl = this.scroller.scrollEl; // shortcut
  12010. };
  12011. ListView.prototype.unrenderSkeleton = function () {
  12012. this.scroller.destroy(); // will remove the Grid too
  12013. };
  12014. ListView.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  12015. this.scroller.setHeight(this.computeScrollerHeight(totalHeight));
  12016. };
  12017. ListView.prototype.computeScrollerHeight = function (totalHeight) {
  12018. return totalHeight -
  12019. util_1.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
  12020. };
  12021. ListView.prototype.renderDates = function (dateProfile) {
  12022. var calendar = this.calendar;
  12023. var dayStart = calendar.msToUtcMoment(dateProfile.renderUnzonedRange.startMs, true);
  12024. var viewEnd = calendar.msToUtcMoment(dateProfile.renderUnzonedRange.endMs, true);
  12025. var dayDates = [];
  12026. var dayRanges = [];
  12027. while (dayStart < viewEnd) {
  12028. dayDates.push(dayStart.clone());
  12029. dayRanges.push(new UnzonedRange_1.default(dayStart, dayStart.clone().add(1, 'day')));
  12030. dayStart.add(1, 'day');
  12031. }
  12032. this.dayDates = dayDates;
  12033. this.dayRanges = dayRanges;
  12034. // all real rendering happens in EventRenderer
  12035. };
  12036. // slices by day
  12037. ListView.prototype.componentFootprintToSegs = function (footprint) {
  12038. var dayRanges = this.dayRanges;
  12039. var dayIndex;
  12040. var segRange;
  12041. var seg;
  12042. var segs = [];
  12043. for (dayIndex = 0; dayIndex < dayRanges.length; dayIndex++) {
  12044. segRange = footprint.unzonedRange.intersect(dayRanges[dayIndex]);
  12045. if (segRange) {
  12046. seg = {
  12047. startMs: segRange.startMs,
  12048. endMs: segRange.endMs,
  12049. isStart: segRange.isStart,
  12050. isEnd: segRange.isEnd,
  12051. dayIndex: dayIndex
  12052. };
  12053. segs.push(seg);
  12054. // detect when footprint won't go fully into the next day,
  12055. // and mutate the latest seg to the be the end.
  12056. if (!seg.isEnd && !footprint.isAllDay &&
  12057. dayIndex + 1 < dayRanges.length &&
  12058. footprint.unzonedRange.endMs < dayRanges[dayIndex + 1].startMs + this.nextDayThreshold) {
  12059. seg.endMs = footprint.unzonedRange.endMs;
  12060. seg.isEnd = true;
  12061. break;
  12062. }
  12063. }
  12064. }
  12065. return segs;
  12066. };
  12067. ListView.prototype.renderEmptyMessage = function () {
  12068. this.contentEl.html('<div class="fc-list-empty-wrap2">' + // TODO: try less wraps
  12069. '<div class="fc-list-empty-wrap1">' +
  12070. '<div class="fc-list-empty">' +
  12071. util_1.htmlEscape(this.opt('noEventsMessage')) +
  12072. '</div>' +
  12073. '</div>' +
  12074. '</div>');
  12075. };
  12076. // render the event segments in the view
  12077. ListView.prototype.renderSegList = function (allSegs) {
  12078. var segsByDay = this.groupSegsByDay(allSegs); // sparse array
  12079. var dayIndex;
  12080. var daySegs;
  12081. var i;
  12082. var tableEl = $('<table class="fc-list-table ' + this.calendar.theme.getClass('tableList') + '"><tbody/></table>');
  12083. var tbodyEl = tableEl.find('tbody');
  12084. for (dayIndex = 0; dayIndex < segsByDay.length; dayIndex++) {
  12085. daySegs = segsByDay[dayIndex];
  12086. if (daySegs) {
  12087. // append a day header
  12088. tbodyEl.append(this.dayHeaderHtml(this.dayDates[dayIndex]));
  12089. this.eventRenderer.sortEventSegs(daySegs);
  12090. for (i = 0; i < daySegs.length; i++) {
  12091. tbodyEl.append(daySegs[i].el); // append event row
  12092. }
  12093. }
  12094. }
  12095. this.contentEl.empty().append(tableEl);
  12096. };
  12097. // Returns a sparse array of arrays, segs grouped by their dayIndex
  12098. ListView.prototype.groupSegsByDay = function (segs) {
  12099. var segsByDay = []; // sparse array
  12100. var i;
  12101. var seg;
  12102. for (i = 0; i < segs.length; i++) {
  12103. seg = segs[i];
  12104. (segsByDay[seg.dayIndex] || (segsByDay[seg.dayIndex] = []))
  12105. .push(seg);
  12106. }
  12107. return segsByDay;
  12108. };
  12109. // generates the HTML for the day headers that live amongst the event rows
  12110. ListView.prototype.dayHeaderHtml = function (dayDate) {
  12111. var mainFormat = this.opt('listDayFormat');
  12112. var altFormat = this.opt('listDayAltFormat');
  12113. return '<tr class="fc-list-heading" data-date="' + dayDate.format('YYYY-MM-DD') + '">' +
  12114. '<td class="' + this.calendar.theme.getClass('widgetHeader') + '" colspan="3">' +
  12115. (mainFormat ?
  12116. this.buildGotoAnchorHtml(dayDate, { 'class': 'fc-list-heading-main' }, util_1.htmlEscape(dayDate.format(mainFormat)) // inner HTML
  12117. ) :
  12118. '') +
  12119. (altFormat ?
  12120. this.buildGotoAnchorHtml(dayDate, { 'class': 'fc-list-heading-alt' }, util_1.htmlEscape(dayDate.format(altFormat)) // inner HTML
  12121. ) :
  12122. '') +
  12123. '</td>' +
  12124. '</tr>';
  12125. };
  12126. return ListView;
  12127. }(View_1.default));
  12128. exports.default = ListView;
  12129. ListView.prototype.eventRendererClass = ListEventRenderer_1.default;
  12130. ListView.prototype.eventPointingClass = ListEventPointing_1.default;
  12131. /***/ }),
  12132. /* 227 */,
  12133. /* 228 */,
  12134. /* 229 */,
  12135. /* 230 */,
  12136. /* 231 */,
  12137. /* 232 */
  12138. /***/ (function(module, exports, __webpack_require__) {
  12139. var $ = __webpack_require__(3);
  12140. var exportHooks = __webpack_require__(16);
  12141. var util_1 = __webpack_require__(4);
  12142. var Calendar_1 = __webpack_require__(216);
  12143. // for intentional side-effects
  12144. __webpack_require__(10);
  12145. __webpack_require__(47);
  12146. __webpack_require__(252);
  12147. __webpack_require__(253);
  12148. __webpack_require__(255);
  12149. __webpack_require__(256);
  12150. __webpack_require__(257);
  12151. __webpack_require__(258);
  12152. $.fullCalendar = exportHooks;
  12153. $.fn.fullCalendar = function (options) {
  12154. var args = Array.prototype.slice.call(arguments, 1); // for a possible method call
  12155. var res = this; // what this function will return (this jQuery object by default)
  12156. this.each(function (i, _element) {
  12157. var element = $(_element);
  12158. var calendar = element.data('fullCalendar'); // get the existing calendar object (if any)
  12159. var singleRes; // the returned value of this single method call
  12160. // a method call
  12161. if (typeof options === 'string') {
  12162. if (options === 'getCalendar') {
  12163. if (!i) {
  12164. res = calendar;
  12165. }
  12166. }
  12167. else if (options === 'destroy') {
  12168. if (calendar) {
  12169. calendar.destroy();
  12170. element.removeData('fullCalendar');
  12171. }
  12172. }
  12173. else if (!calendar) {
  12174. util_1.warn('Attempting to call a FullCalendar method on an element with no calendar.');
  12175. }
  12176. else if ($.isFunction(calendar[options])) {
  12177. singleRes = calendar[options].apply(calendar, args);
  12178. if (!i) {
  12179. res = singleRes; // record the first method call result
  12180. }
  12181. if (options === 'destroy') {
  12182. element.removeData('fullCalendar');
  12183. }
  12184. }
  12185. else {
  12186. util_1.warn("'" + options + "' is an unknown FullCalendar method.");
  12187. }
  12188. }
  12189. else if (!calendar) {
  12190. calendar = new Calendar_1.default(element, options);
  12191. element.data('fullCalendar', calendar);
  12192. calendar.render();
  12193. }
  12194. });
  12195. return res;
  12196. };
  12197. module.exports = exportHooks;
  12198. /***/ }),
  12199. /* 233 */
  12200. /***/ (function(module, exports, __webpack_require__) {
  12201. Object.defineProperty(exports, "__esModule", { value: true });
  12202. var tslib_1 = __webpack_require__(2);
  12203. var Model_1 = __webpack_require__(48);
  12204. var Component = /** @class */ (function (_super) {
  12205. tslib_1.__extends(Component, _super);
  12206. function Component() {
  12207. return _super !== null && _super.apply(this, arguments) || this;
  12208. }
  12209. Component.prototype.setElement = function (el) {
  12210. this.el = el;
  12211. this.bindGlobalHandlers();
  12212. this.renderSkeleton();
  12213. this.set('isInDom', true);
  12214. };
  12215. Component.prototype.removeElement = function () {
  12216. this.unset('isInDom');
  12217. this.unrenderSkeleton();
  12218. this.unbindGlobalHandlers();
  12219. this.el.remove();
  12220. // NOTE: don't null-out this.el in case the View was destroyed within an API callback.
  12221. // We don't null-out the View's other jQuery element references upon destroy,
  12222. // so we shouldn't kill this.el either.
  12223. };
  12224. Component.prototype.bindGlobalHandlers = function () {
  12225. // subclasses can override
  12226. };
  12227. Component.prototype.unbindGlobalHandlers = function () {
  12228. // subclasses can override
  12229. };
  12230. /*
  12231. NOTE: Can't have a `render` method. Read the deprecation notice in View::executeDateRender
  12232. */
  12233. // Renders the basic structure of the view before any content is rendered
  12234. Component.prototype.renderSkeleton = function () {
  12235. // subclasses should implement
  12236. };
  12237. // Unrenders the basic structure of the view
  12238. Component.prototype.unrenderSkeleton = function () {
  12239. // subclasses should implement
  12240. };
  12241. return Component;
  12242. }(Model_1.default));
  12243. exports.default = Component;
  12244. /***/ }),
  12245. /* 234 */
  12246. /***/ (function(module, exports) {
  12247. Object.defineProperty(exports, "__esModule", { value: true });
  12248. var Iterator = /** @class */ (function () {
  12249. function Iterator(items) {
  12250. this.items = items || [];
  12251. }
  12252. /* Calls a method on every item passing the arguments through */
  12253. Iterator.prototype.proxyCall = function (methodName) {
  12254. var args = [];
  12255. for (var _i = 1; _i < arguments.length; _i++) {
  12256. args[_i - 1] = arguments[_i];
  12257. }
  12258. var results = [];
  12259. this.items.forEach(function (item) {
  12260. results.push(item[methodName].apply(item, args));
  12261. });
  12262. return results;
  12263. };
  12264. return Iterator;
  12265. }());
  12266. exports.default = Iterator;
  12267. /***/ }),
  12268. /* 235 */
  12269. /***/ (function(module, exports, __webpack_require__) {
  12270. Object.defineProperty(exports, "__esModule", { value: true });
  12271. var $ = __webpack_require__(3);
  12272. var util_1 = __webpack_require__(4);
  12273. /* Toolbar with buttons and title
  12274. ----------------------------------------------------------------------------------------------------------------------*/
  12275. var Toolbar = /** @class */ (function () {
  12276. function Toolbar(calendar, toolbarOptions) {
  12277. this.el = null; // mirrors local `el`
  12278. this.viewsWithButtons = [];
  12279. this.calendar = calendar;
  12280. this.toolbarOptions = toolbarOptions;
  12281. }
  12282. // method to update toolbar-specific options, not calendar-wide options
  12283. Toolbar.prototype.setToolbarOptions = function (newToolbarOptions) {
  12284. this.toolbarOptions = newToolbarOptions;
  12285. };
  12286. // can be called repeatedly and will rerender
  12287. Toolbar.prototype.render = function () {
  12288. var sections = this.toolbarOptions.layout;
  12289. var el = this.el;
  12290. if (sections) {
  12291. if (!el) {
  12292. el = this.el = $("<div class='fc-toolbar " + this.toolbarOptions.extraClasses + "'/>");
  12293. }
  12294. else {
  12295. el.empty();
  12296. }
  12297. el.append(this.renderSection('left'))
  12298. .append(this.renderSection('right'))
  12299. .append(this.renderSection('center'))
  12300. .append('<div class="fc-clear"/>');
  12301. }
  12302. else {
  12303. this.removeElement();
  12304. }
  12305. };
  12306. Toolbar.prototype.removeElement = function () {
  12307. if (this.el) {
  12308. this.el.remove();
  12309. this.el = null;
  12310. }
  12311. };
  12312. Toolbar.prototype.renderSection = function (position) {
  12313. var _this = this;
  12314. var calendar = this.calendar;
  12315. var theme = calendar.theme;
  12316. var optionsManager = calendar.optionsManager;
  12317. var viewSpecManager = calendar.viewSpecManager;
  12318. var sectionEl = $('<div class="fc-' + position + '"/>');
  12319. var buttonStr = this.toolbarOptions.layout[position];
  12320. var calendarCustomButtons = optionsManager.get('customButtons') || {};
  12321. var calendarButtonTextOverrides = optionsManager.overrides.buttonText || {};
  12322. var calendarButtonText = optionsManager.get('buttonText') || {};
  12323. if (buttonStr) {
  12324. $.each(buttonStr.split(' '), function (i, buttonGroupStr) {
  12325. var groupChildren = $();
  12326. var isOnlyButtons = true;
  12327. var groupEl;
  12328. $.each(buttonGroupStr.split(','), function (j, buttonName) {
  12329. var customButtonProps;
  12330. var viewSpec;
  12331. var buttonClick;
  12332. var buttonIcon; // only one of these will be set
  12333. var buttonText; // "
  12334. var buttonInnerHtml;
  12335. var buttonClasses;
  12336. var buttonEl;
  12337. if (buttonName === 'title') {
  12338. groupChildren = groupChildren.add($('<h2>&nbsp;</h2>')); // we always want it to take up height
  12339. isOnlyButtons = false;
  12340. }
  12341. else {
  12342. if ((customButtonProps = calendarCustomButtons[buttonName])) {
  12343. buttonClick = function (ev) {
  12344. if (customButtonProps.click) {
  12345. customButtonProps.click.call(buttonEl[0], ev);
  12346. }
  12347. };
  12348. (buttonIcon = theme.getCustomButtonIconClass(customButtonProps)) ||
  12349. (buttonIcon = theme.getIconClass(buttonName)) ||
  12350. (buttonText = customButtonProps.text);
  12351. }
  12352. else if ((viewSpec = viewSpecManager.getViewSpec(buttonName))) {
  12353. _this.viewsWithButtons.push(buttonName);
  12354. buttonClick = function () {
  12355. calendar.changeView(buttonName);
  12356. };
  12357. (buttonText = viewSpec.buttonTextOverride) ||
  12358. (buttonIcon = theme.getIconClass(buttonName)) ||
  12359. (buttonText = viewSpec.buttonTextDefault);
  12360. }
  12361. else if (calendar[buttonName]) {
  12362. buttonClick = function () {
  12363. calendar[buttonName]();
  12364. };
  12365. (buttonText = calendarButtonTextOverrides[buttonName]) ||
  12366. (buttonIcon = theme.getIconClass(buttonName)) ||
  12367. (buttonText = calendarButtonText[buttonName]);
  12368. // ^ everything else is considered default
  12369. }
  12370. if (buttonClick) {
  12371. buttonClasses = [
  12372. 'fc-' + buttonName + '-button',
  12373. theme.getClass('button'),
  12374. theme.getClass('stateDefault')
  12375. ];
  12376. if (buttonText) {
  12377. buttonInnerHtml = util_1.htmlEscape(buttonText);
  12378. }
  12379. else if (buttonIcon) {
  12380. buttonInnerHtml = "<span class='" + buttonIcon + "'></span>";
  12381. }
  12382. buttonEl = $(// type="button" so that it doesn't submit a form
  12383. '<button type="button" class="' + buttonClasses.join(' ') + '">' +
  12384. buttonInnerHtml +
  12385. '</button>')
  12386. .click(function (ev) {
  12387. // don't process clicks for disabled buttons
  12388. if (!buttonEl.hasClass(theme.getClass('stateDisabled'))) {
  12389. buttonClick(ev);
  12390. // after the click action, if the button becomes the "active" tab, or disabled,
  12391. // it should never have a hover class, so remove it now.
  12392. if (buttonEl.hasClass(theme.getClass('stateActive')) ||
  12393. buttonEl.hasClass(theme.getClass('stateDisabled'))) {
  12394. buttonEl.removeClass(theme.getClass('stateHover'));
  12395. }
  12396. }
  12397. })
  12398. .mousedown(function () {
  12399. // the *down* effect (mouse pressed in).
  12400. // only on buttons that are not the "active" tab, or disabled
  12401. buttonEl
  12402. .not('.' + theme.getClass('stateActive'))
  12403. .not('.' + theme.getClass('stateDisabled'))
  12404. .addClass(theme.getClass('stateDown'));
  12405. })
  12406. .mouseup(function () {
  12407. // undo the *down* effect
  12408. buttonEl.removeClass(theme.getClass('stateDown'));
  12409. })
  12410. .hover(function () {
  12411. // the *hover* effect.
  12412. // only on buttons that are not the "active" tab, or disabled
  12413. buttonEl
  12414. .not('.' + theme.getClass('stateActive'))
  12415. .not('.' + theme.getClass('stateDisabled'))
  12416. .addClass(theme.getClass('stateHover'));
  12417. }, function () {
  12418. // undo the *hover* effect
  12419. buttonEl
  12420. .removeClass(theme.getClass('stateHover'))
  12421. .removeClass(theme.getClass('stateDown')); // if mouseleave happens before mouseup
  12422. });
  12423. groupChildren = groupChildren.add(buttonEl);
  12424. }
  12425. }
  12426. });
  12427. if (isOnlyButtons) {
  12428. groupChildren
  12429. .first().addClass(theme.getClass('cornerLeft')).end()
  12430. .last().addClass(theme.getClass('cornerRight')).end();
  12431. }
  12432. if (groupChildren.length > 1) {
  12433. groupEl = $('<div/>');
  12434. if (isOnlyButtons) {
  12435. groupEl.addClass(theme.getClass('buttonGroup'));
  12436. }
  12437. groupEl.append(groupChildren);
  12438. sectionEl.append(groupEl);
  12439. }
  12440. else {
  12441. sectionEl.append(groupChildren); // 1 or 0 children
  12442. }
  12443. });
  12444. }
  12445. return sectionEl;
  12446. };
  12447. Toolbar.prototype.updateTitle = function (text) {
  12448. if (this.el) {
  12449. this.el.find('h2').text(text);
  12450. }
  12451. };
  12452. Toolbar.prototype.activateButton = function (buttonName) {
  12453. if (this.el) {
  12454. this.el.find('.fc-' + buttonName + '-button')
  12455. .addClass(this.calendar.theme.getClass('stateActive'));
  12456. }
  12457. };
  12458. Toolbar.prototype.deactivateButton = function (buttonName) {
  12459. if (this.el) {
  12460. this.el.find('.fc-' + buttonName + '-button')
  12461. .removeClass(this.calendar.theme.getClass('stateActive'));
  12462. }
  12463. };
  12464. Toolbar.prototype.disableButton = function (buttonName) {
  12465. if (this.el) {
  12466. this.el.find('.fc-' + buttonName + '-button')
  12467. .prop('disabled', true)
  12468. .addClass(this.calendar.theme.getClass('stateDisabled'));
  12469. }
  12470. };
  12471. Toolbar.prototype.enableButton = function (buttonName) {
  12472. if (this.el) {
  12473. this.el.find('.fc-' + buttonName + '-button')
  12474. .prop('disabled', false)
  12475. .removeClass(this.calendar.theme.getClass('stateDisabled'));
  12476. }
  12477. };
  12478. Toolbar.prototype.getViewsWithButtons = function () {
  12479. return this.viewsWithButtons;
  12480. };
  12481. return Toolbar;
  12482. }());
  12483. exports.default = Toolbar;
  12484. /***/ }),
  12485. /* 236 */
  12486. /***/ (function(module, exports, __webpack_require__) {
  12487. Object.defineProperty(exports, "__esModule", { value: true });
  12488. var tslib_1 = __webpack_require__(2);
  12489. var $ = __webpack_require__(3);
  12490. var util_1 = __webpack_require__(4);
  12491. var options_1 = __webpack_require__(31);
  12492. var locale_1 = __webpack_require__(30);
  12493. var Model_1 = __webpack_require__(48);
  12494. var OptionsManager = /** @class */ (function (_super) {
  12495. tslib_1.__extends(OptionsManager, _super);
  12496. function OptionsManager(_calendar, overrides) {
  12497. var _this = _super.call(this) || this;
  12498. _this._calendar = _calendar;
  12499. _this.overrides = $.extend({}, overrides); // make a copy
  12500. _this.dynamicOverrides = {};
  12501. _this.compute();
  12502. return _this;
  12503. }
  12504. OptionsManager.prototype.add = function (newOptionHash) {
  12505. var optionCnt = 0;
  12506. var optionName;
  12507. this.recordOverrides(newOptionHash); // will trigger this model's watchers
  12508. for (optionName in newOptionHash) {
  12509. optionCnt++;
  12510. }
  12511. // special-case handling of single option change.
  12512. // if only one option change, `optionName` will be its name.
  12513. if (optionCnt === 1) {
  12514. if (optionName === 'height' || optionName === 'contentHeight' || optionName === 'aspectRatio') {
  12515. this._calendar.updateViewSize(true); // isResize=true
  12516. return;
  12517. }
  12518. else if (optionName === 'defaultDate') {
  12519. return; // can't change date this way. use gotoDate instead
  12520. }
  12521. else if (optionName === 'businessHours') {
  12522. return; // this model already reacts to this
  12523. }
  12524. else if (optionName === 'timezone') {
  12525. this._calendar.view.flash('initialEvents');
  12526. return;
  12527. }
  12528. }
  12529. // catch-all. rerender the header and footer and rebuild/rerender the current view
  12530. this._calendar.renderHeader();
  12531. this._calendar.renderFooter();
  12532. // even non-current views will be affected by this option change. do before rerender
  12533. // TODO: detangle
  12534. this._calendar.viewsByType = {};
  12535. this._calendar.reinitView();
  12536. };
  12537. // Computes the flattened options hash for the calendar and assigns to `this.options`.
  12538. // Assumes this.overrides and this.dynamicOverrides have already been initialized.
  12539. OptionsManager.prototype.compute = function () {
  12540. var locale;
  12541. var localeDefaults;
  12542. var isRTL;
  12543. var dirDefaults;
  12544. var rawOptions;
  12545. locale = util_1.firstDefined(// explicit locale option given?
  12546. this.dynamicOverrides.locale, this.overrides.locale);
  12547. localeDefaults = locale_1.localeOptionHash[locale];
  12548. if (!localeDefaults) {
  12549. locale = options_1.globalDefaults.locale;
  12550. localeDefaults = locale_1.localeOptionHash[locale] || {};
  12551. }
  12552. isRTL = util_1.firstDefined(// based on options computed so far, is direction RTL?
  12553. this.dynamicOverrides.isRTL, this.overrides.isRTL, localeDefaults.isRTL, options_1.globalDefaults.isRTL);
  12554. dirDefaults = isRTL ? options_1.rtlDefaults : {};
  12555. this.dirDefaults = dirDefaults;
  12556. this.localeDefaults = localeDefaults;
  12557. rawOptions = options_1.mergeOptions([
  12558. options_1.globalDefaults,
  12559. dirDefaults,
  12560. localeDefaults,
  12561. this.overrides,
  12562. this.dynamicOverrides
  12563. ]);
  12564. locale_1.populateInstanceComputableOptions(rawOptions); // fill in gaps with computed options
  12565. this.reset(rawOptions);
  12566. };
  12567. // stores the new options internally, but does not rerender anything.
  12568. OptionsManager.prototype.recordOverrides = function (newOptionHash) {
  12569. var optionName;
  12570. for (optionName in newOptionHash) {
  12571. this.dynamicOverrides[optionName] = newOptionHash[optionName];
  12572. }
  12573. this._calendar.viewSpecManager.clearCache(); // the dynamic override invalidates the options in this cache, so just clear it
  12574. this.compute(); // this.options needs to be recomputed after the dynamic override
  12575. };
  12576. return OptionsManager;
  12577. }(Model_1.default));
  12578. exports.default = OptionsManager;
  12579. /***/ }),
  12580. /* 237 */
  12581. /***/ (function(module, exports, __webpack_require__) {
  12582. Object.defineProperty(exports, "__esModule", { value: true });
  12583. var moment = __webpack_require__(0);
  12584. var $ = __webpack_require__(3);
  12585. var ViewRegistry_1 = __webpack_require__(21);
  12586. var util_1 = __webpack_require__(4);
  12587. var options_1 = __webpack_require__(31);
  12588. var locale_1 = __webpack_require__(30);
  12589. var ViewSpecManager = /** @class */ (function () {
  12590. function ViewSpecManager(optionsManager, _calendar) {
  12591. this.optionsManager = optionsManager;
  12592. this._calendar = _calendar;
  12593. this.clearCache();
  12594. }
  12595. ViewSpecManager.prototype.clearCache = function () {
  12596. this.viewSpecCache = {};
  12597. };
  12598. // Gets information about how to create a view. Will use a cache.
  12599. ViewSpecManager.prototype.getViewSpec = function (viewType) {
  12600. var cache = this.viewSpecCache;
  12601. return cache[viewType] || (cache[viewType] = this.buildViewSpec(viewType));
  12602. };
  12603. // Given a duration singular unit, like "week" or "day", finds a matching view spec.
  12604. // Preference is given to views that have corresponding buttons.
  12605. ViewSpecManager.prototype.getUnitViewSpec = function (unit) {
  12606. var viewTypes;
  12607. var i;
  12608. var spec;
  12609. if ($.inArray(unit, util_1.unitsDesc) !== -1) {
  12610. // put views that have buttons first. there will be duplicates, but oh well
  12611. viewTypes = this._calendar.header.getViewsWithButtons(); // TODO: include footer as well?
  12612. $.each(ViewRegistry_1.viewHash, function (viewType) {
  12613. viewTypes.push(viewType);
  12614. });
  12615. for (i = 0; i < viewTypes.length; i++) {
  12616. spec = this.getViewSpec(viewTypes[i]);
  12617. if (spec) {
  12618. if (spec.singleUnit === unit) {
  12619. return spec;
  12620. }
  12621. }
  12622. }
  12623. }
  12624. };
  12625. // Builds an object with information on how to create a given view
  12626. ViewSpecManager.prototype.buildViewSpec = function (requestedViewType) {
  12627. var viewOverrides = this.optionsManager.overrides.views || {};
  12628. var specChain = []; // for the view. lowest to highest priority
  12629. var defaultsChain = []; // for the view. lowest to highest priority
  12630. var overridesChain = []; // for the view. lowest to highest priority
  12631. var viewType = requestedViewType;
  12632. var spec; // for the view
  12633. var overrides; // for the view
  12634. var durationInput;
  12635. var duration;
  12636. var unit;
  12637. // iterate from the specific view definition to a more general one until we hit an actual View class
  12638. while (viewType) {
  12639. spec = ViewRegistry_1.viewHash[viewType];
  12640. overrides = viewOverrides[viewType];
  12641. viewType = null; // clear. might repopulate for another iteration
  12642. if (typeof spec === 'function') {
  12643. spec = { 'class': spec };
  12644. }
  12645. if (spec) {
  12646. specChain.unshift(spec);
  12647. defaultsChain.unshift(spec.defaults || {});
  12648. durationInput = durationInput || spec.duration;
  12649. viewType = viewType || spec.type;
  12650. }
  12651. if (overrides) {
  12652. overridesChain.unshift(overrides); // view-specific option hashes have options at zero-level
  12653. durationInput = durationInput || overrides.duration;
  12654. viewType = viewType || overrides.type;
  12655. }
  12656. }
  12657. spec = util_1.mergeProps(specChain);
  12658. spec.type = requestedViewType;
  12659. if (!spec['class']) {
  12660. return false;
  12661. }
  12662. // fall back to top-level `duration` option
  12663. durationInput = durationInput ||
  12664. this.optionsManager.dynamicOverrides.duration ||
  12665. this.optionsManager.overrides.duration;
  12666. if (durationInput) {
  12667. duration = moment.duration(durationInput);
  12668. if (duration.valueOf()) {
  12669. unit = util_1.computeDurationGreatestUnit(duration, durationInput);
  12670. spec.duration = duration;
  12671. spec.durationUnit = unit;
  12672. // view is a single-unit duration, like "week" or "day"
  12673. // incorporate options for this. lowest priority
  12674. if (duration.as(unit) === 1) {
  12675. spec.singleUnit = unit;
  12676. overridesChain.unshift(viewOverrides[unit] || {});
  12677. }
  12678. }
  12679. }
  12680. spec.defaults = options_1.mergeOptions(defaultsChain);
  12681. spec.overrides = options_1.mergeOptions(overridesChain);
  12682. this.buildViewSpecOptions(spec);
  12683. this.buildViewSpecButtonText(spec, requestedViewType);
  12684. return spec;
  12685. };
  12686. // Builds and assigns a view spec's options object from its already-assigned defaults and overrides
  12687. ViewSpecManager.prototype.buildViewSpecOptions = function (spec) {
  12688. var optionsManager = this.optionsManager;
  12689. spec.options = options_1.mergeOptions([
  12690. options_1.globalDefaults,
  12691. spec.defaults,
  12692. optionsManager.dirDefaults,
  12693. optionsManager.localeDefaults,
  12694. optionsManager.overrides,
  12695. spec.overrides,
  12696. optionsManager.dynamicOverrides // dynamically set via setter. highest precedence
  12697. ]);
  12698. locale_1.populateInstanceComputableOptions(spec.options);
  12699. };
  12700. // Computes and assigns a view spec's buttonText-related options
  12701. ViewSpecManager.prototype.buildViewSpecButtonText = function (spec, requestedViewType) {
  12702. var optionsManager = this.optionsManager;
  12703. // given an options object with a possible `buttonText` hash, lookup the buttonText for the
  12704. // requested view, falling back to a generic unit entry like "week" or "day"
  12705. function queryButtonText(options) {
  12706. var buttonText = options.buttonText || {};
  12707. return buttonText[requestedViewType] ||
  12708. // view can decide to look up a certain key
  12709. (spec.buttonTextKey ? buttonText[spec.buttonTextKey] : null) ||
  12710. // a key like "month"
  12711. (spec.singleUnit ? buttonText[spec.singleUnit] : null);
  12712. }
  12713. // highest to lowest priority
  12714. spec.buttonTextOverride =
  12715. queryButtonText(optionsManager.dynamicOverrides) ||
  12716. queryButtonText(optionsManager.overrides) || // constructor-specified buttonText lookup hash takes precedence
  12717. spec.overrides.buttonText; // `buttonText` for view-specific options is a string
  12718. // highest to lowest priority. mirrors buildViewSpecOptions
  12719. spec.buttonTextDefault =
  12720. queryButtonText(optionsManager.localeDefaults) ||
  12721. queryButtonText(optionsManager.dirDefaults) ||
  12722. spec.defaults.buttonText || // a single string. from ViewSubclass.defaults
  12723. queryButtonText(options_1.globalDefaults) ||
  12724. (spec.duration ? this._calendar.humanizeDuration(spec.duration) : null) || // like "3 days"
  12725. requestedViewType; // fall back to given view name
  12726. };
  12727. return ViewSpecManager;
  12728. }());
  12729. exports.default = ViewSpecManager;
  12730. /***/ }),
  12731. /* 238 */
  12732. /***/ (function(module, exports, __webpack_require__) {
  12733. Object.defineProperty(exports, "__esModule", { value: true });
  12734. var $ = __webpack_require__(3);
  12735. var util_1 = __webpack_require__(4);
  12736. var EventPeriod_1 = __webpack_require__(239);
  12737. var ArrayEventSource_1 = __webpack_require__(52);
  12738. var EventSource_1 = __webpack_require__(6);
  12739. var EventSourceParser_1 = __webpack_require__(37);
  12740. var SingleEventDef_1 = __webpack_require__(13);
  12741. var EventInstanceGroup_1 = __webpack_require__(18);
  12742. var EmitterMixin_1 = __webpack_require__(11);
  12743. var ListenerMixin_1 = __webpack_require__(7);
  12744. var EventManager = /** @class */ (function () {
  12745. function EventManager(calendar) {
  12746. this.calendar = calendar;
  12747. this.stickySource = new ArrayEventSource_1.default(calendar);
  12748. this.otherSources = [];
  12749. }
  12750. EventManager.prototype.requestEvents = function (start, end, timezone, force) {
  12751. if (force ||
  12752. !this.currentPeriod ||
  12753. !this.currentPeriod.isWithinRange(start, end) ||
  12754. timezone !== this.currentPeriod.timezone) {
  12755. this.setPeriod(// will change this.currentPeriod
  12756. new EventPeriod_1.default(start, end, timezone));
  12757. }
  12758. return this.currentPeriod.whenReleased();
  12759. };
  12760. // Source Adding/Removing
  12761. // -----------------------------------------------------------------------------------------------------------------
  12762. EventManager.prototype.addSource = function (eventSource) {
  12763. this.otherSources.push(eventSource);
  12764. if (this.currentPeriod) {
  12765. this.currentPeriod.requestSource(eventSource); // might release
  12766. }
  12767. };
  12768. EventManager.prototype.removeSource = function (doomedSource) {
  12769. util_1.removeExact(this.otherSources, doomedSource);
  12770. if (this.currentPeriod) {
  12771. this.currentPeriod.purgeSource(doomedSource); // might release
  12772. }
  12773. };
  12774. EventManager.prototype.removeAllSources = function () {
  12775. this.otherSources = [];
  12776. if (this.currentPeriod) {
  12777. this.currentPeriod.purgeAllSources(); // might release
  12778. }
  12779. };
  12780. // Source Refetching
  12781. // -----------------------------------------------------------------------------------------------------------------
  12782. EventManager.prototype.refetchSource = function (eventSource) {
  12783. var currentPeriod = this.currentPeriod;
  12784. if (currentPeriod) {
  12785. currentPeriod.freeze();
  12786. currentPeriod.purgeSource(eventSource);
  12787. currentPeriod.requestSource(eventSource);
  12788. currentPeriod.thaw();
  12789. }
  12790. };
  12791. EventManager.prototype.refetchAllSources = function () {
  12792. var currentPeriod = this.currentPeriod;
  12793. if (currentPeriod) {
  12794. currentPeriod.freeze();
  12795. currentPeriod.purgeAllSources();
  12796. currentPeriod.requestSources(this.getSources());
  12797. currentPeriod.thaw();
  12798. }
  12799. };
  12800. // Source Querying
  12801. // -----------------------------------------------------------------------------------------------------------------
  12802. EventManager.prototype.getSources = function () {
  12803. return [this.stickySource].concat(this.otherSources);
  12804. };
  12805. // like querySources, but accepts multple match criteria (like multiple IDs)
  12806. EventManager.prototype.multiQuerySources = function (matchInputs) {
  12807. // coerce into an array
  12808. if (!matchInputs) {
  12809. matchInputs = [];
  12810. }
  12811. else if (!$.isArray(matchInputs)) {
  12812. matchInputs = [matchInputs];
  12813. }
  12814. var matchingSources = [];
  12815. var i;
  12816. // resolve raw inputs to real event source objects
  12817. for (i = 0; i < matchInputs.length; i++) {
  12818. matchingSources.push.apply(// append
  12819. matchingSources, this.querySources(matchInputs[i]));
  12820. }
  12821. return matchingSources;
  12822. };
  12823. // matchInput can either by a real event source object, an ID, or the function/URL for the source.
  12824. // returns an array of matching source objects.
  12825. EventManager.prototype.querySources = function (matchInput) {
  12826. var sources = this.otherSources;
  12827. var i;
  12828. var source;
  12829. // given a proper event source object
  12830. for (i = 0; i < sources.length; i++) {
  12831. source = sources[i];
  12832. if (source === matchInput) {
  12833. return [source];
  12834. }
  12835. }
  12836. // an ID match
  12837. source = this.getSourceById(EventSource_1.default.normalizeId(matchInput));
  12838. if (source) {
  12839. return [source];
  12840. }
  12841. // parse as an event source
  12842. matchInput = EventSourceParser_1.default.parse(matchInput, this.calendar);
  12843. if (matchInput) {
  12844. return $.grep(sources, function (source) {
  12845. return isSourcesEquivalent(matchInput, source);
  12846. });
  12847. }
  12848. };
  12849. /*
  12850. ID assumed to already be normalized
  12851. */
  12852. EventManager.prototype.getSourceById = function (id) {
  12853. return $.grep(this.otherSources, function (source) {
  12854. return source.id && source.id === id;
  12855. })[0];
  12856. };
  12857. // Event-Period
  12858. // -----------------------------------------------------------------------------------------------------------------
  12859. EventManager.prototype.setPeriod = function (eventPeriod) {
  12860. if (this.currentPeriod) {
  12861. this.unbindPeriod(this.currentPeriod);
  12862. this.currentPeriod = null;
  12863. }
  12864. this.currentPeriod = eventPeriod;
  12865. this.bindPeriod(eventPeriod);
  12866. eventPeriod.requestSources(this.getSources());
  12867. };
  12868. EventManager.prototype.bindPeriod = function (eventPeriod) {
  12869. this.listenTo(eventPeriod, 'release', function (eventsPayload) {
  12870. this.trigger('release', eventsPayload);
  12871. });
  12872. };
  12873. EventManager.prototype.unbindPeriod = function (eventPeriod) {
  12874. this.stopListeningTo(eventPeriod);
  12875. };
  12876. // Event Getting/Adding/Removing
  12877. // -----------------------------------------------------------------------------------------------------------------
  12878. EventManager.prototype.getEventDefByUid = function (uid) {
  12879. if (this.currentPeriod) {
  12880. return this.currentPeriod.getEventDefByUid(uid);
  12881. }
  12882. };
  12883. EventManager.prototype.addEventDef = function (eventDef, isSticky) {
  12884. if (isSticky) {
  12885. this.stickySource.addEventDef(eventDef);
  12886. }
  12887. if (this.currentPeriod) {
  12888. this.currentPeriod.addEventDef(eventDef); // might release
  12889. }
  12890. };
  12891. EventManager.prototype.removeEventDefsById = function (eventId) {
  12892. this.getSources().forEach(function (eventSource) {
  12893. eventSource.removeEventDefsById(eventId);
  12894. });
  12895. if (this.currentPeriod) {
  12896. this.currentPeriod.removeEventDefsById(eventId); // might release
  12897. }
  12898. };
  12899. EventManager.prototype.removeAllEventDefs = function () {
  12900. this.getSources().forEach(function (eventSource) {
  12901. eventSource.removeAllEventDefs();
  12902. });
  12903. if (this.currentPeriod) {
  12904. this.currentPeriod.removeAllEventDefs();
  12905. }
  12906. };
  12907. // Event Mutating
  12908. // -----------------------------------------------------------------------------------------------------------------
  12909. /*
  12910. Returns an undo function.
  12911. */
  12912. EventManager.prototype.mutateEventsWithId = function (eventDefId, eventDefMutation) {
  12913. var currentPeriod = this.currentPeriod;
  12914. var eventDefs;
  12915. var undoFuncs = [];
  12916. if (currentPeriod) {
  12917. currentPeriod.freeze();
  12918. eventDefs = currentPeriod.getEventDefsById(eventDefId);
  12919. eventDefs.forEach(function (eventDef) {
  12920. // add/remove esp because id might change
  12921. currentPeriod.removeEventDef(eventDef);
  12922. undoFuncs.push(eventDefMutation.mutateSingle(eventDef));
  12923. currentPeriod.addEventDef(eventDef);
  12924. });
  12925. currentPeriod.thaw();
  12926. return function () {
  12927. currentPeriod.freeze();
  12928. for (var i = 0; i < eventDefs.length; i++) {
  12929. currentPeriod.removeEventDef(eventDefs[i]);
  12930. undoFuncs[i]();
  12931. currentPeriod.addEventDef(eventDefs[i]);
  12932. }
  12933. currentPeriod.thaw();
  12934. };
  12935. }
  12936. return function () { };
  12937. };
  12938. /*
  12939. copies and then mutates
  12940. */
  12941. EventManager.prototype.buildMutatedEventInstanceGroup = function (eventDefId, eventDefMutation) {
  12942. var eventDefs = this.getEventDefsById(eventDefId);
  12943. var i;
  12944. var defCopy;
  12945. var allInstances = [];
  12946. for (i = 0; i < eventDefs.length; i++) {
  12947. defCopy = eventDefs[i].clone();
  12948. if (defCopy instanceof SingleEventDef_1.default) {
  12949. eventDefMutation.mutateSingle(defCopy);
  12950. allInstances.push.apply(allInstances, // append
  12951. defCopy.buildInstances());
  12952. }
  12953. }
  12954. return new EventInstanceGroup_1.default(allInstances);
  12955. };
  12956. // Freezing
  12957. // -----------------------------------------------------------------------------------------------------------------
  12958. EventManager.prototype.freeze = function () {
  12959. if (this.currentPeriod) {
  12960. this.currentPeriod.freeze();
  12961. }
  12962. };
  12963. EventManager.prototype.thaw = function () {
  12964. if (this.currentPeriod) {
  12965. this.currentPeriod.thaw();
  12966. }
  12967. };
  12968. // methods that simply forward to EventPeriod
  12969. EventManager.prototype.getEventDefsById = function (eventDefId) {
  12970. return this.currentPeriod.getEventDefsById(eventDefId);
  12971. };
  12972. EventManager.prototype.getEventInstances = function () {
  12973. return this.currentPeriod.getEventInstances();
  12974. };
  12975. EventManager.prototype.getEventInstancesWithId = function (eventDefId) {
  12976. return this.currentPeriod.getEventInstancesWithId(eventDefId);
  12977. };
  12978. EventManager.prototype.getEventInstancesWithoutId = function (eventDefId) {
  12979. return this.currentPeriod.getEventInstancesWithoutId(eventDefId);
  12980. };
  12981. return EventManager;
  12982. }());
  12983. exports.default = EventManager;
  12984. EmitterMixin_1.default.mixInto(EventManager);
  12985. ListenerMixin_1.default.mixInto(EventManager);
  12986. function isSourcesEquivalent(source0, source1) {
  12987. return source0.getPrimitive() === source1.getPrimitive();
  12988. }
  12989. /***/ }),
  12990. /* 239 */
  12991. /***/ (function(module, exports, __webpack_require__) {
  12992. Object.defineProperty(exports, "__esModule", { value: true });
  12993. var $ = __webpack_require__(3);
  12994. var util_1 = __webpack_require__(4);
  12995. var Promise_1 = __webpack_require__(19);
  12996. var EmitterMixin_1 = __webpack_require__(11);
  12997. var UnzonedRange_1 = __webpack_require__(5);
  12998. var EventInstanceGroup_1 = __webpack_require__(18);
  12999. var EventPeriod = /** @class */ (function () {
  13000. function EventPeriod(start, end, timezone) {
  13001. this.pendingCnt = 0;
  13002. this.freezeDepth = 0;
  13003. this.stuntedReleaseCnt = 0;
  13004. this.releaseCnt = 0;
  13005. this.start = start;
  13006. this.end = end;
  13007. this.timezone = timezone;
  13008. this.unzonedRange = new UnzonedRange_1.default(start.clone().stripZone(), end.clone().stripZone());
  13009. this.requestsByUid = {};
  13010. this.eventDefsByUid = {};
  13011. this.eventDefsById = {};
  13012. this.eventInstanceGroupsById = {};
  13013. }
  13014. EventPeriod.prototype.isWithinRange = function (start, end) {
  13015. // TODO: use a range util function?
  13016. return !start.isBefore(this.start) && !end.isAfter(this.end);
  13017. };
  13018. // Requesting and Purging
  13019. // -----------------------------------------------------------------------------------------------------------------
  13020. EventPeriod.prototype.requestSources = function (sources) {
  13021. this.freeze();
  13022. for (var i = 0; i < sources.length; i++) {
  13023. this.requestSource(sources[i]);
  13024. }
  13025. this.thaw();
  13026. };
  13027. EventPeriod.prototype.requestSource = function (source) {
  13028. var _this = this;
  13029. var request = { source: source, status: 'pending', eventDefs: null };
  13030. this.requestsByUid[source.uid] = request;
  13031. this.pendingCnt += 1;
  13032. source.fetch(this.start, this.end, this.timezone).then(function (eventDefs) {
  13033. if (request.status !== 'cancelled') {
  13034. request.status = 'completed';
  13035. request.eventDefs = eventDefs;
  13036. _this.addEventDefs(eventDefs);
  13037. _this.pendingCnt--;
  13038. _this.tryRelease();
  13039. }
  13040. }, function () {
  13041. if (request.status !== 'cancelled') {
  13042. request.status = 'failed';
  13043. _this.pendingCnt--;
  13044. _this.tryRelease();
  13045. }
  13046. });
  13047. };
  13048. EventPeriod.prototype.purgeSource = function (source) {
  13049. var request = this.requestsByUid[source.uid];
  13050. if (request) {
  13051. delete this.requestsByUid[source.uid];
  13052. if (request.status === 'pending') {
  13053. request.status = 'cancelled';
  13054. this.pendingCnt--;
  13055. this.tryRelease();
  13056. }
  13057. else if (request.status === 'completed') {
  13058. request.eventDefs.forEach(this.removeEventDef.bind(this));
  13059. }
  13060. }
  13061. };
  13062. EventPeriod.prototype.purgeAllSources = function () {
  13063. var requestsByUid = this.requestsByUid;
  13064. var uid;
  13065. var request;
  13066. var completedCnt = 0;
  13067. for (uid in requestsByUid) {
  13068. request = requestsByUid[uid];
  13069. if (request.status === 'pending') {
  13070. request.status = 'cancelled';
  13071. }
  13072. else if (request.status === 'completed') {
  13073. completedCnt++;
  13074. }
  13075. }
  13076. this.requestsByUid = {};
  13077. this.pendingCnt = 0;
  13078. if (completedCnt) {
  13079. this.removeAllEventDefs(); // might release
  13080. }
  13081. };
  13082. // Event Definitions
  13083. // -----------------------------------------------------------------------------------------------------------------
  13084. EventPeriod.prototype.getEventDefByUid = function (eventDefUid) {
  13085. return this.eventDefsByUid[eventDefUid];
  13086. };
  13087. EventPeriod.prototype.getEventDefsById = function (eventDefId) {
  13088. var a = this.eventDefsById[eventDefId];
  13089. if (a) {
  13090. return a.slice(); // clone
  13091. }
  13092. return [];
  13093. };
  13094. EventPeriod.prototype.addEventDefs = function (eventDefs) {
  13095. for (var i = 0; i < eventDefs.length; i++) {
  13096. this.addEventDef(eventDefs[i]);
  13097. }
  13098. };
  13099. EventPeriod.prototype.addEventDef = function (eventDef) {
  13100. var eventDefsById = this.eventDefsById;
  13101. var eventDefId = eventDef.id;
  13102. var eventDefs = eventDefsById[eventDefId] || (eventDefsById[eventDefId] = []);
  13103. var eventInstances = eventDef.buildInstances(this.unzonedRange);
  13104. var i;
  13105. eventDefs.push(eventDef);
  13106. this.eventDefsByUid[eventDef.uid] = eventDef;
  13107. for (i = 0; i < eventInstances.length; i++) {
  13108. this.addEventInstance(eventInstances[i], eventDefId);
  13109. }
  13110. };
  13111. EventPeriod.prototype.removeEventDefsById = function (eventDefId) {
  13112. var _this = this;
  13113. this.getEventDefsById(eventDefId).forEach(function (eventDef) {
  13114. _this.removeEventDef(eventDef);
  13115. });
  13116. };
  13117. EventPeriod.prototype.removeAllEventDefs = function () {
  13118. var isEmpty = $.isEmptyObject(this.eventDefsByUid);
  13119. this.eventDefsByUid = {};
  13120. this.eventDefsById = {};
  13121. this.eventInstanceGroupsById = {};
  13122. if (!isEmpty) {
  13123. this.tryRelease();
  13124. }
  13125. };
  13126. EventPeriod.prototype.removeEventDef = function (eventDef) {
  13127. var eventDefsById = this.eventDefsById;
  13128. var eventDefs = eventDefsById[eventDef.id];
  13129. delete this.eventDefsByUid[eventDef.uid];
  13130. if (eventDefs) {
  13131. util_1.removeExact(eventDefs, eventDef);
  13132. if (!eventDefs.length) {
  13133. delete eventDefsById[eventDef.id];
  13134. }
  13135. this.removeEventInstancesForDef(eventDef);
  13136. }
  13137. };
  13138. // Event Instances
  13139. // -----------------------------------------------------------------------------------------------------------------
  13140. EventPeriod.prototype.getEventInstances = function () {
  13141. var eventInstanceGroupsById = this.eventInstanceGroupsById;
  13142. var eventInstances = [];
  13143. var id;
  13144. for (id in eventInstanceGroupsById) {
  13145. eventInstances.push.apply(eventInstances, // append
  13146. eventInstanceGroupsById[id].eventInstances);
  13147. }
  13148. return eventInstances;
  13149. };
  13150. EventPeriod.prototype.getEventInstancesWithId = function (eventDefId) {
  13151. var eventInstanceGroup = this.eventInstanceGroupsById[eventDefId];
  13152. if (eventInstanceGroup) {
  13153. return eventInstanceGroup.eventInstances.slice(); // clone
  13154. }
  13155. return [];
  13156. };
  13157. EventPeriod.prototype.getEventInstancesWithoutId = function (eventDefId) {
  13158. var eventInstanceGroupsById = this.eventInstanceGroupsById;
  13159. var matchingInstances = [];
  13160. var id;
  13161. for (id in eventInstanceGroupsById) {
  13162. if (id !== eventDefId) {
  13163. matchingInstances.push.apply(matchingInstances, // append
  13164. eventInstanceGroupsById[id].eventInstances);
  13165. }
  13166. }
  13167. return matchingInstances;
  13168. };
  13169. EventPeriod.prototype.addEventInstance = function (eventInstance, eventDefId) {
  13170. var eventInstanceGroupsById = this.eventInstanceGroupsById;
  13171. var eventInstanceGroup = eventInstanceGroupsById[eventDefId] ||
  13172. (eventInstanceGroupsById[eventDefId] = new EventInstanceGroup_1.default());
  13173. eventInstanceGroup.eventInstances.push(eventInstance);
  13174. this.tryRelease();
  13175. };
  13176. EventPeriod.prototype.removeEventInstancesForDef = function (eventDef) {
  13177. var eventInstanceGroupsById = this.eventInstanceGroupsById;
  13178. var eventInstanceGroup = eventInstanceGroupsById[eventDef.id];
  13179. var removeCnt;
  13180. if (eventInstanceGroup) {
  13181. removeCnt = util_1.removeMatching(eventInstanceGroup.eventInstances, function (currentEventInstance) {
  13182. return currentEventInstance.def === eventDef;
  13183. });
  13184. if (!eventInstanceGroup.eventInstances.length) {
  13185. delete eventInstanceGroupsById[eventDef.id];
  13186. }
  13187. if (removeCnt) {
  13188. this.tryRelease();
  13189. }
  13190. }
  13191. };
  13192. // Releasing and Freezing
  13193. // -----------------------------------------------------------------------------------------------------------------
  13194. EventPeriod.prototype.tryRelease = function () {
  13195. if (!this.pendingCnt) {
  13196. if (!this.freezeDepth) {
  13197. this.release();
  13198. }
  13199. else {
  13200. this.stuntedReleaseCnt++;
  13201. }
  13202. }
  13203. };
  13204. EventPeriod.prototype.release = function () {
  13205. this.releaseCnt++;
  13206. this.trigger('release', this.eventInstanceGroupsById);
  13207. };
  13208. EventPeriod.prototype.whenReleased = function () {
  13209. var _this = this;
  13210. if (this.releaseCnt) {
  13211. return Promise_1.default.resolve(this.eventInstanceGroupsById);
  13212. }
  13213. else {
  13214. return Promise_1.default.construct(function (onResolve) {
  13215. _this.one('release', onResolve);
  13216. });
  13217. }
  13218. };
  13219. EventPeriod.prototype.freeze = function () {
  13220. if (!(this.freezeDepth++)) {
  13221. this.stuntedReleaseCnt = 0;
  13222. }
  13223. };
  13224. EventPeriod.prototype.thaw = function () {
  13225. if (!(--this.freezeDepth) && this.stuntedReleaseCnt && !this.pendingCnt) {
  13226. this.release();
  13227. }
  13228. };
  13229. return EventPeriod;
  13230. }());
  13231. exports.default = EventPeriod;
  13232. EmitterMixin_1.default.mixInto(EventPeriod);
  13233. /***/ }),
  13234. /* 240 */
  13235. /***/ (function(module, exports, __webpack_require__) {
  13236. Object.defineProperty(exports, "__esModule", { value: true });
  13237. var $ = __webpack_require__(3);
  13238. var util_1 = __webpack_require__(4);
  13239. var ListenerMixin_1 = __webpack_require__(7);
  13240. /* Creates a clone of an element and lets it track the mouse as it moves
  13241. ----------------------------------------------------------------------------------------------------------------------*/
  13242. var MouseFollower = /** @class */ (function () {
  13243. function MouseFollower(sourceEl, options) {
  13244. this.isFollowing = false;
  13245. this.isHidden = false;
  13246. this.isAnimating = false; // doing the revert animation?
  13247. this.options = options = options || {};
  13248. this.sourceEl = sourceEl;
  13249. this.parentEl = options.parentEl ? $(options.parentEl) : sourceEl.parent(); // default to sourceEl's parent
  13250. }
  13251. // Causes the element to start following the mouse
  13252. MouseFollower.prototype.start = function (ev) {
  13253. if (!this.isFollowing) {
  13254. this.isFollowing = true;
  13255. this.y0 = util_1.getEvY(ev);
  13256. this.x0 = util_1.getEvX(ev);
  13257. this.topDelta = 0;
  13258. this.leftDelta = 0;
  13259. if (!this.isHidden) {
  13260. this.updatePosition();
  13261. }
  13262. if (util_1.getEvIsTouch(ev)) {
  13263. this.listenTo($(document), 'touchmove', this.handleMove);
  13264. }
  13265. else {
  13266. this.listenTo($(document), 'mousemove', this.handleMove);
  13267. }
  13268. }
  13269. };
  13270. // Causes the element to stop following the mouse. If shouldRevert is true, will animate back to original position.
  13271. // `callback` gets invoked when the animation is complete. If no animation, it is invoked immediately.
  13272. MouseFollower.prototype.stop = function (shouldRevert, callback) {
  13273. var _this = this;
  13274. var revertDuration = this.options.revertDuration;
  13275. var complete = function () {
  13276. _this.isAnimating = false;
  13277. _this.removeElement();
  13278. _this.top0 = _this.left0 = null; // reset state for future updatePosition calls
  13279. if (callback) {
  13280. callback();
  13281. }
  13282. };
  13283. if (this.isFollowing && !this.isAnimating) {
  13284. this.isFollowing = false;
  13285. this.stopListeningTo($(document));
  13286. if (shouldRevert && revertDuration && !this.isHidden) {
  13287. this.isAnimating = true;
  13288. this.el.animate({
  13289. top: this.top0,
  13290. left: this.left0
  13291. }, {
  13292. duration: revertDuration,
  13293. complete: complete
  13294. });
  13295. }
  13296. else {
  13297. complete();
  13298. }
  13299. }
  13300. };
  13301. // Gets the tracking element. Create it if necessary
  13302. MouseFollower.prototype.getEl = function () {
  13303. var el = this.el;
  13304. if (!el) {
  13305. el = this.el = this.sourceEl.clone()
  13306. .addClass(this.options.additionalClass || '')
  13307. .css({
  13308. position: 'absolute',
  13309. visibility: '',
  13310. display: this.isHidden ? 'none' : '',
  13311. margin: 0,
  13312. right: 'auto',
  13313. bottom: 'auto',
  13314. width: this.sourceEl.width(),
  13315. height: this.sourceEl.height(),
  13316. opacity: this.options.opacity || '',
  13317. zIndex: this.options.zIndex
  13318. });
  13319. // we don't want long taps or any mouse interaction causing selection/menus.
  13320. // would use preventSelection(), but that prevents selectstart, causing problems.
  13321. el.addClass('fc-unselectable');
  13322. el.appendTo(this.parentEl);
  13323. }
  13324. return el;
  13325. };
  13326. // Removes the tracking element if it has already been created
  13327. MouseFollower.prototype.removeElement = function () {
  13328. if (this.el) {
  13329. this.el.remove();
  13330. this.el = null;
  13331. }
  13332. };
  13333. // Update the CSS position of the tracking element
  13334. MouseFollower.prototype.updatePosition = function () {
  13335. var sourceOffset;
  13336. var origin;
  13337. this.getEl(); // ensure this.el
  13338. // make sure origin info was computed
  13339. if (this.top0 == null) {
  13340. sourceOffset = this.sourceEl.offset();
  13341. origin = this.el.offsetParent().offset();
  13342. this.top0 = sourceOffset.top - origin.top;
  13343. this.left0 = sourceOffset.left - origin.left;
  13344. }
  13345. this.el.css({
  13346. top: this.top0 + this.topDelta,
  13347. left: this.left0 + this.leftDelta
  13348. });
  13349. };
  13350. // Gets called when the user moves the mouse
  13351. MouseFollower.prototype.handleMove = function (ev) {
  13352. this.topDelta = util_1.getEvY(ev) - this.y0;
  13353. this.leftDelta = util_1.getEvX(ev) - this.x0;
  13354. if (!this.isHidden) {
  13355. this.updatePosition();
  13356. }
  13357. };
  13358. // Temporarily makes the tracking element invisible. Can be called before following starts
  13359. MouseFollower.prototype.hide = function () {
  13360. if (!this.isHidden) {
  13361. this.isHidden = true;
  13362. if (this.el) {
  13363. this.el.hide();
  13364. }
  13365. }
  13366. };
  13367. // Show the tracking element after it has been temporarily hidden
  13368. MouseFollower.prototype.show = function () {
  13369. if (this.isHidden) {
  13370. this.isHidden = false;
  13371. this.updatePosition();
  13372. this.getEl().show();
  13373. }
  13374. };
  13375. return MouseFollower;
  13376. }());
  13377. exports.default = MouseFollower;
  13378. ListenerMixin_1.default.mixInto(MouseFollower);
  13379. /***/ }),
  13380. /* 241 */
  13381. /***/ (function(module, exports, __webpack_require__) {
  13382. Object.defineProperty(exports, "__esModule", { value: true });
  13383. var tslib_1 = __webpack_require__(2);
  13384. var HitDragListener_1 = __webpack_require__(22);
  13385. var Interaction_1 = __webpack_require__(15);
  13386. var DateClicking = /** @class */ (function (_super) {
  13387. tslib_1.__extends(DateClicking, _super);
  13388. /*
  13389. component must implement:
  13390. - bindDateHandlerToEl
  13391. - getSafeHitFootprint
  13392. - getHitEl
  13393. */
  13394. function DateClicking(component) {
  13395. var _this = _super.call(this, component) || this;
  13396. _this.dragListener = _this.buildDragListener();
  13397. return _this;
  13398. }
  13399. DateClicking.prototype.end = function () {
  13400. this.dragListener.endInteraction();
  13401. };
  13402. DateClicking.prototype.bindToEl = function (el) {
  13403. var component = this.component;
  13404. var dragListener = this.dragListener;
  13405. component.bindDateHandlerToEl(el, 'mousedown', function (ev) {
  13406. if (!component.shouldIgnoreMouse()) {
  13407. dragListener.startInteraction(ev);
  13408. }
  13409. });
  13410. component.bindDateHandlerToEl(el, 'touchstart', function (ev) {
  13411. if (!component.shouldIgnoreTouch()) {
  13412. dragListener.startInteraction(ev);
  13413. }
  13414. });
  13415. };
  13416. // Creates a listener that tracks the user's drag across day elements, for day clicking.
  13417. DateClicking.prototype.buildDragListener = function () {
  13418. var _this = this;
  13419. var component = this.component;
  13420. var dayClickHit; // null if invalid dayClick
  13421. var dragListener = new HitDragListener_1.default(component, {
  13422. scroll: this.opt('dragScroll'),
  13423. interactionStart: function () {
  13424. dayClickHit = dragListener.origHit;
  13425. },
  13426. hitOver: function (hit, isOrig, origHit) {
  13427. // if user dragged to another cell at any point, it can no longer be a dayClick
  13428. if (!isOrig) {
  13429. dayClickHit = null;
  13430. }
  13431. },
  13432. hitOut: function () {
  13433. dayClickHit = null;
  13434. },
  13435. interactionEnd: function (ev, isCancelled) {
  13436. var componentFootprint;
  13437. if (!isCancelled && dayClickHit) {
  13438. componentFootprint = component.getSafeHitFootprint(dayClickHit);
  13439. if (componentFootprint) {
  13440. _this.view.triggerDayClick(componentFootprint, component.getHitEl(dayClickHit), ev);
  13441. }
  13442. }
  13443. }
  13444. });
  13445. // because dragListener won't be called with any time delay, "dragging" will begin immediately,
  13446. // which will kill any touchmoving/scrolling. Prevent this.
  13447. dragListener.shouldCancelTouchScroll = false;
  13448. dragListener.scrollAlwaysKills = true;
  13449. return dragListener;
  13450. };
  13451. return DateClicking;
  13452. }(Interaction_1.default));
  13453. exports.default = DateClicking;
  13454. /***/ }),
  13455. /* 242 */
  13456. /***/ (function(module, exports, __webpack_require__) {
  13457. Object.defineProperty(exports, "__esModule", { value: true });
  13458. var tslib_1 = __webpack_require__(2);
  13459. var util_1 = __webpack_require__(4);
  13460. var EventRenderer_1 = __webpack_require__(42);
  13461. /*
  13462. Only handles foreground segs.
  13463. Does not own rendering. Use for low-level util methods by TimeGrid.
  13464. */
  13465. var TimeGridEventRenderer = /** @class */ (function (_super) {
  13466. tslib_1.__extends(TimeGridEventRenderer, _super);
  13467. function TimeGridEventRenderer(timeGrid, fillRenderer) {
  13468. var _this = _super.call(this, timeGrid, fillRenderer) || this;
  13469. _this.timeGrid = timeGrid;
  13470. return _this;
  13471. }
  13472. TimeGridEventRenderer.prototype.renderFgSegs = function (segs) {
  13473. this.renderFgSegsIntoContainers(segs, this.timeGrid.fgContainerEls);
  13474. };
  13475. // Given an array of foreground segments, render a DOM element for each, computes position,
  13476. // and attaches to the column inner-container elements.
  13477. TimeGridEventRenderer.prototype.renderFgSegsIntoContainers = function (segs, containerEls) {
  13478. var segsByCol;
  13479. var col;
  13480. segsByCol = this.timeGrid.groupSegsByCol(segs);
  13481. for (col = 0; col < this.timeGrid.colCnt; col++) {
  13482. this.updateFgSegCoords(segsByCol[col]);
  13483. }
  13484. this.timeGrid.attachSegsByCol(segsByCol, containerEls);
  13485. };
  13486. TimeGridEventRenderer.prototype.unrenderFgSegs = function () {
  13487. if (this.fgSegs) {
  13488. this.fgSegs.forEach(function (seg) {
  13489. seg.el.remove();
  13490. });
  13491. }
  13492. };
  13493. // Computes a default event time formatting string if `timeFormat` is not explicitly defined
  13494. TimeGridEventRenderer.prototype.computeEventTimeFormat = function () {
  13495. return this.opt('noMeridiemTimeFormat'); // like "6:30" (no AM/PM)
  13496. };
  13497. // Computes a default `displayEventEnd` value if one is not expliclty defined
  13498. TimeGridEventRenderer.prototype.computeDisplayEventEnd = function () {
  13499. return true;
  13500. };
  13501. // Renders the HTML for a single event segment's default rendering
  13502. TimeGridEventRenderer.prototype.fgSegHtml = function (seg, disableResizing) {
  13503. var view = this.view;
  13504. var calendar = view.calendar;
  13505. var componentFootprint = seg.footprint.componentFootprint;
  13506. var isAllDay = componentFootprint.isAllDay;
  13507. var eventDef = seg.footprint.eventDef;
  13508. var isDraggable = view.isEventDefDraggable(eventDef);
  13509. var isResizableFromStart = !disableResizing && seg.isStart && view.isEventDefResizableFromStart(eventDef);
  13510. var isResizableFromEnd = !disableResizing && seg.isEnd && view.isEventDefResizableFromEnd(eventDef);
  13511. var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd);
  13512. var skinCss = util_1.cssToStr(this.getSkinCss(eventDef));
  13513. var timeText;
  13514. var fullTimeText; // more verbose time text. for the print stylesheet
  13515. var startTimeText; // just the start time text
  13516. classes.unshift('fc-time-grid-event', 'fc-v-event');
  13517. // if the event appears to span more than one day...
  13518. if (view.isMultiDayRange(componentFootprint.unzonedRange)) {
  13519. // Don't display time text on segments that run entirely through a day.
  13520. // That would appear as midnight-midnight and would look dumb.
  13521. // Otherwise, display the time text for the *segment's* times (like 6pm-midnight or midnight-10am)
  13522. if (seg.isStart || seg.isEnd) {
  13523. var zonedStart = calendar.msToMoment(seg.startMs);
  13524. var zonedEnd = calendar.msToMoment(seg.endMs);
  13525. timeText = this._getTimeText(zonedStart, zonedEnd, isAllDay);
  13526. fullTimeText = this._getTimeText(zonedStart, zonedEnd, isAllDay, 'LT');
  13527. startTimeText = this._getTimeText(zonedStart, zonedEnd, isAllDay, null, false); // displayEnd=false
  13528. }
  13529. }
  13530. else {
  13531. // Display the normal time text for the *event's* times
  13532. timeText = this.getTimeText(seg.footprint);
  13533. fullTimeText = this.getTimeText(seg.footprint, 'LT');
  13534. startTimeText = this.getTimeText(seg.footprint, null, false); // displayEnd=false
  13535. }
  13536. return '<a class="' + classes.join(' ') + '"' +
  13537. (eventDef.url ?
  13538. ' href="' + util_1.htmlEscape(eventDef.url) + '"' :
  13539. '') +
  13540. (skinCss ?
  13541. ' style="' + skinCss + '"' :
  13542. '') +
  13543. '>' +
  13544. '<div class="fc-content">' +
  13545. (timeText ?
  13546. '<div class="fc-time"' +
  13547. ' data-start="' + util_1.htmlEscape(startTimeText) + '"' +
  13548. ' data-full="' + util_1.htmlEscape(fullTimeText) + '"' +
  13549. '>' +
  13550. '<span>' + util_1.htmlEscape(timeText) + '</span>' +
  13551. '</div>' :
  13552. '') +
  13553. (eventDef.title ?
  13554. '<div class="fc-title">' +
  13555. util_1.htmlEscape(eventDef.title) +
  13556. '</div>' :
  13557. '') +
  13558. '</div>' +
  13559. '<div class="fc-bg"/>' +
  13560. /* TODO: write CSS for this
  13561. (isResizableFromStart ?
  13562. '<div class="fc-resizer fc-start-resizer" />' :
  13563. ''
  13564. ) +
  13565. */
  13566. (isResizableFromEnd ?
  13567. '<div class="fc-resizer fc-end-resizer" />' :
  13568. '') +
  13569. '</a>';
  13570. };
  13571. // Given segments that are assumed to all live in the *same column*,
  13572. // compute their verical/horizontal coordinates and assign to their elements.
  13573. TimeGridEventRenderer.prototype.updateFgSegCoords = function (segs) {
  13574. this.timeGrid.computeSegVerticals(segs); // horizontals relies on this
  13575. this.computeFgSegHorizontals(segs); // compute horizontal coordinates, z-index's, and reorder the array
  13576. this.timeGrid.assignSegVerticals(segs);
  13577. this.assignFgSegHorizontals(segs);
  13578. };
  13579. // Given an array of segments that are all in the same column, sets the backwardCoord and forwardCoord on each.
  13580. // NOTE: Also reorders the given array by date!
  13581. TimeGridEventRenderer.prototype.computeFgSegHorizontals = function (segs) {
  13582. var levels;
  13583. var level0;
  13584. var i;
  13585. this.sortEventSegs(segs); // order by certain criteria
  13586. levels = buildSlotSegLevels(segs);
  13587. computeForwardSlotSegs(levels);
  13588. if ((level0 = levels[0])) {
  13589. for (i = 0; i < level0.length; i++) {
  13590. computeSlotSegPressures(level0[i]);
  13591. }
  13592. for (i = 0; i < level0.length; i++) {
  13593. this.computeFgSegForwardBack(level0[i], 0, 0);
  13594. }
  13595. }
  13596. };
  13597. // Calculate seg.forwardCoord and seg.backwardCoord for the segment, where both values range
  13598. // from 0 to 1. If the calendar is left-to-right, the seg.backwardCoord maps to "left" and
  13599. // seg.forwardCoord maps to "right" (via percentage). Vice-versa if the calendar is right-to-left.
  13600. //
  13601. // The segment might be part of a "series", which means consecutive segments with the same pressure
  13602. // who's width is unknown until an edge has been hit. `seriesBackwardPressure` is the number of
  13603. // segments behind this one in the current series, and `seriesBackwardCoord` is the starting
  13604. // coordinate of the first segment in the series.
  13605. TimeGridEventRenderer.prototype.computeFgSegForwardBack = function (seg, seriesBackwardPressure, seriesBackwardCoord) {
  13606. var forwardSegs = seg.forwardSegs;
  13607. var i;
  13608. if (seg.forwardCoord === undefined) {
  13609. if (!forwardSegs.length) {
  13610. // if there are no forward segments, this segment should butt up against the edge
  13611. seg.forwardCoord = 1;
  13612. }
  13613. else {
  13614. // sort highest pressure first
  13615. this.sortForwardSegs(forwardSegs);
  13616. // this segment's forwardCoord will be calculated from the backwardCoord of the
  13617. // highest-pressure forward segment.
  13618. this.computeFgSegForwardBack(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord);
  13619. seg.forwardCoord = forwardSegs[0].backwardCoord;
  13620. }
  13621. // calculate the backwardCoord from the forwardCoord. consider the series
  13622. seg.backwardCoord = seg.forwardCoord -
  13623. (seg.forwardCoord - seriesBackwardCoord) / // available width for series
  13624. (seriesBackwardPressure + 1); // # of segments in the series
  13625. // use this segment's coordinates to computed the coordinates of the less-pressurized
  13626. // forward segments
  13627. for (i = 0; i < forwardSegs.length; i++) {
  13628. this.computeFgSegForwardBack(forwardSegs[i], 0, seg.forwardCoord);
  13629. }
  13630. }
  13631. };
  13632. TimeGridEventRenderer.prototype.sortForwardSegs = function (forwardSegs) {
  13633. forwardSegs.sort(util_1.proxy(this, 'compareForwardSegs'));
  13634. };
  13635. // A cmp function for determining which forward segment to rely on more when computing coordinates.
  13636. TimeGridEventRenderer.prototype.compareForwardSegs = function (seg1, seg2) {
  13637. // put higher-pressure first
  13638. return seg2.forwardPressure - seg1.forwardPressure ||
  13639. // put segments that are closer to initial edge first (and favor ones with no coords yet)
  13640. (seg1.backwardCoord || 0) - (seg2.backwardCoord || 0) ||
  13641. // do normal sorting...
  13642. this.compareEventSegs(seg1, seg2);
  13643. };
  13644. // Given foreground event segments that have already had their position coordinates computed,
  13645. // assigns position-related CSS values to their elements.
  13646. TimeGridEventRenderer.prototype.assignFgSegHorizontals = function (segs) {
  13647. var i;
  13648. var seg;
  13649. for (i = 0; i < segs.length; i++) {
  13650. seg = segs[i];
  13651. seg.el.css(this.generateFgSegHorizontalCss(seg));
  13652. // if the height is short, add a className for alternate styling
  13653. if (seg.bottom - seg.top < 30) {
  13654. seg.el.addClass('fc-short');
  13655. }
  13656. }
  13657. };
  13658. // Generates an object with CSS properties/values that should be applied to an event segment element.
  13659. // Contains important positioning-related properties that should be applied to any event element, customized or not.
  13660. TimeGridEventRenderer.prototype.generateFgSegHorizontalCss = function (seg) {
  13661. var shouldOverlap = this.opt('slotEventOverlap');
  13662. var backwardCoord = seg.backwardCoord; // the left side if LTR. the right side if RTL. floating-point
  13663. var forwardCoord = seg.forwardCoord; // the right side if LTR. the left side if RTL. floating-point
  13664. var props = this.timeGrid.generateSegVerticalCss(seg); // get top/bottom first
  13665. var isRTL = this.timeGrid.isRTL;
  13666. var left; // amount of space from left edge, a fraction of the total width
  13667. var right; // amount of space from right edge, a fraction of the total width
  13668. if (shouldOverlap) {
  13669. // double the width, but don't go beyond the maximum forward coordinate (1.0)
  13670. forwardCoord = Math.min(1, backwardCoord + (forwardCoord - backwardCoord) * 2);
  13671. }
  13672. if (isRTL) {
  13673. left = 1 - forwardCoord;
  13674. right = backwardCoord;
  13675. }
  13676. else {
  13677. left = backwardCoord;
  13678. right = 1 - forwardCoord;
  13679. }
  13680. props.zIndex = seg.level + 1; // convert from 0-base to 1-based
  13681. props.left = left * 100 + '%';
  13682. props.right = right * 100 + '%';
  13683. if (shouldOverlap && seg.forwardPressure) {
  13684. // add padding to the edge so that forward stacked events don't cover the resizer's icon
  13685. props[isRTL ? 'marginLeft' : 'marginRight'] = 10 * 2; // 10 is a guesstimate of the icon's width
  13686. }
  13687. return props;
  13688. };
  13689. return TimeGridEventRenderer;
  13690. }(EventRenderer_1.default));
  13691. exports.default = TimeGridEventRenderer;
  13692. // Builds an array of segments "levels". The first level will be the leftmost tier of segments if the calendar is
  13693. // left-to-right, or the rightmost if the calendar is right-to-left. Assumes the segments are already ordered by date.
  13694. function buildSlotSegLevels(segs) {
  13695. var levels = [];
  13696. var i;
  13697. var seg;
  13698. var j;
  13699. for (i = 0; i < segs.length; i++) {
  13700. seg = segs[i];
  13701. // go through all the levels and stop on the first level where there are no collisions
  13702. for (j = 0; j < levels.length; j++) {
  13703. if (!computeSlotSegCollisions(seg, levels[j]).length) {
  13704. break;
  13705. }
  13706. }
  13707. seg.level = j;
  13708. (levels[j] || (levels[j] = [])).push(seg);
  13709. }
  13710. return levels;
  13711. }
  13712. // For every segment, figure out the other segments that are in subsequent
  13713. // levels that also occupy the same vertical space. Accumulate in seg.forwardSegs
  13714. function computeForwardSlotSegs(levels) {
  13715. var i;
  13716. var level;
  13717. var j;
  13718. var seg;
  13719. var k;
  13720. for (i = 0; i < levels.length; i++) {
  13721. level = levels[i];
  13722. for (j = 0; j < level.length; j++) {
  13723. seg = level[j];
  13724. seg.forwardSegs = [];
  13725. for (k = i + 1; k < levels.length; k++) {
  13726. computeSlotSegCollisions(seg, levels[k], seg.forwardSegs);
  13727. }
  13728. }
  13729. }
  13730. }
  13731. // Figure out which path forward (via seg.forwardSegs) results in the longest path until
  13732. // the furthest edge is reached. The number of segments in this path will be seg.forwardPressure
  13733. function computeSlotSegPressures(seg) {
  13734. var forwardSegs = seg.forwardSegs;
  13735. var forwardPressure = 0;
  13736. var i;
  13737. var forwardSeg;
  13738. if (seg.forwardPressure === undefined) {
  13739. for (i = 0; i < forwardSegs.length; i++) {
  13740. forwardSeg = forwardSegs[i];
  13741. // figure out the child's maximum forward path
  13742. computeSlotSegPressures(forwardSeg);
  13743. // either use the existing maximum, or use the child's forward pressure
  13744. // plus one (for the forwardSeg itself)
  13745. forwardPressure = Math.max(forwardPressure, 1 + forwardSeg.forwardPressure);
  13746. }
  13747. seg.forwardPressure = forwardPressure;
  13748. }
  13749. }
  13750. // Find all the segments in `otherSegs` that vertically collide with `seg`.
  13751. // Append into an optionally-supplied `results` array and return.
  13752. function computeSlotSegCollisions(seg, otherSegs, results) {
  13753. if (results === void 0) { results = []; }
  13754. for (var i = 0; i < otherSegs.length; i++) {
  13755. if (isSlotSegCollision(seg, otherSegs[i])) {
  13756. results.push(otherSegs[i]);
  13757. }
  13758. }
  13759. return results;
  13760. }
  13761. // Do these segments occupy the same vertical space?
  13762. function isSlotSegCollision(seg1, seg2) {
  13763. return seg1.bottom > seg2.top && seg1.top < seg2.bottom;
  13764. }
  13765. /***/ }),
  13766. /* 243 */
  13767. /***/ (function(module, exports, __webpack_require__) {
  13768. Object.defineProperty(exports, "__esModule", { value: true });
  13769. var tslib_1 = __webpack_require__(2);
  13770. var $ = __webpack_require__(3);
  13771. var HelperRenderer_1 = __webpack_require__(58);
  13772. var TimeGridHelperRenderer = /** @class */ (function (_super) {
  13773. tslib_1.__extends(TimeGridHelperRenderer, _super);
  13774. function TimeGridHelperRenderer() {
  13775. return _super !== null && _super.apply(this, arguments) || this;
  13776. }
  13777. TimeGridHelperRenderer.prototype.renderSegs = function (segs, sourceSeg) {
  13778. var helperNodes = [];
  13779. var i;
  13780. var seg;
  13781. var sourceEl;
  13782. // TODO: not good to call eventRenderer this way
  13783. this.eventRenderer.renderFgSegsIntoContainers(segs, this.component.helperContainerEls);
  13784. // Try to make the segment that is in the same row as sourceSeg look the same
  13785. for (i = 0; i < segs.length; i++) {
  13786. seg = segs[i];
  13787. if (sourceSeg && sourceSeg.col === seg.col) {
  13788. sourceEl = sourceSeg.el;
  13789. seg.el.css({
  13790. left: sourceEl.css('left'),
  13791. right: sourceEl.css('right'),
  13792. 'margin-left': sourceEl.css('margin-left'),
  13793. 'margin-right': sourceEl.css('margin-right')
  13794. });
  13795. }
  13796. helperNodes.push(seg.el[0]);
  13797. }
  13798. return $(helperNodes); // must return the elements rendered
  13799. };
  13800. return TimeGridHelperRenderer;
  13801. }(HelperRenderer_1.default));
  13802. exports.default = TimeGridHelperRenderer;
  13803. /***/ }),
  13804. /* 244 */
  13805. /***/ (function(module, exports, __webpack_require__) {
  13806. Object.defineProperty(exports, "__esModule", { value: true });
  13807. var tslib_1 = __webpack_require__(2);
  13808. var FillRenderer_1 = __webpack_require__(57);
  13809. var TimeGridFillRenderer = /** @class */ (function (_super) {
  13810. tslib_1.__extends(TimeGridFillRenderer, _super);
  13811. function TimeGridFillRenderer() {
  13812. return _super !== null && _super.apply(this, arguments) || this;
  13813. }
  13814. TimeGridFillRenderer.prototype.attachSegEls = function (type, segs) {
  13815. var timeGrid = this.component;
  13816. var containerEls;
  13817. // TODO: more efficient lookup
  13818. if (type === 'bgEvent') {
  13819. containerEls = timeGrid.bgContainerEls;
  13820. }
  13821. else if (type === 'businessHours') {
  13822. containerEls = timeGrid.businessContainerEls;
  13823. }
  13824. else if (type === 'highlight') {
  13825. containerEls = timeGrid.highlightContainerEls;
  13826. }
  13827. timeGrid.updateSegVerticals(segs);
  13828. timeGrid.attachSegsByCol(timeGrid.groupSegsByCol(segs), containerEls);
  13829. return segs.map(function (seg) {
  13830. return seg.el[0];
  13831. });
  13832. };
  13833. return TimeGridFillRenderer;
  13834. }(FillRenderer_1.default));
  13835. exports.default = TimeGridFillRenderer;
  13836. /***/ }),
  13837. /* 245 */
  13838. /***/ (function(module, exports, __webpack_require__) {
  13839. /* A rectangular panel that is absolutely positioned over other content
  13840. ------------------------------------------------------------------------------------------------------------------------
  13841. Options:
  13842. - className (string)
  13843. - content (HTML string or jQuery element set)
  13844. - parentEl
  13845. - top
  13846. - left
  13847. - right (the x coord of where the right edge should be. not a "CSS" right)
  13848. - autoHide (boolean)
  13849. - show (callback)
  13850. - hide (callback)
  13851. */
  13852. Object.defineProperty(exports, "__esModule", { value: true });
  13853. var $ = __webpack_require__(3);
  13854. var util_1 = __webpack_require__(4);
  13855. var ListenerMixin_1 = __webpack_require__(7);
  13856. var Popover = /** @class */ (function () {
  13857. function Popover(options) {
  13858. this.isHidden = true;
  13859. this.margin = 10; // the space required between the popover and the edges of the scroll container
  13860. this.options = options || {};
  13861. }
  13862. // Shows the popover on the specified position. Renders it if not already
  13863. Popover.prototype.show = function () {
  13864. if (this.isHidden) {
  13865. if (!this.el) {
  13866. this.render();
  13867. }
  13868. this.el.show();
  13869. this.position();
  13870. this.isHidden = false;
  13871. this.trigger('show');
  13872. }
  13873. };
  13874. // Hides the popover, through CSS, but does not remove it from the DOM
  13875. Popover.prototype.hide = function () {
  13876. if (!this.isHidden) {
  13877. this.el.hide();
  13878. this.isHidden = true;
  13879. this.trigger('hide');
  13880. }
  13881. };
  13882. // Creates `this.el` and renders content inside of it
  13883. Popover.prototype.render = function () {
  13884. var _this = this;
  13885. var options = this.options;
  13886. this.el = $('<div class="fc-popover"/>')
  13887. .addClass(options.className || '')
  13888. .css({
  13889. // position initially to the top left to avoid creating scrollbars
  13890. top: 0,
  13891. left: 0
  13892. })
  13893. .append(options.content)
  13894. .appendTo(options.parentEl);
  13895. // when a click happens on anything inside with a 'fc-close' className, hide the popover
  13896. this.el.on('click', '.fc-close', function () {
  13897. _this.hide();
  13898. });
  13899. if (options.autoHide) {
  13900. this.listenTo($(document), 'mousedown', this.documentMousedown);
  13901. }
  13902. };
  13903. // Triggered when the user clicks *anywhere* in the document, for the autoHide feature
  13904. Popover.prototype.documentMousedown = function (ev) {
  13905. // only hide the popover if the click happened outside the popover
  13906. if (this.el && !$(ev.target).closest(this.el).length) {
  13907. this.hide();
  13908. }
  13909. };
  13910. // Hides and unregisters any handlers
  13911. Popover.prototype.removeElement = function () {
  13912. this.hide();
  13913. if (this.el) {
  13914. this.el.remove();
  13915. this.el = null;
  13916. }
  13917. this.stopListeningTo($(document), 'mousedown');
  13918. };
  13919. // Positions the popover optimally, using the top/left/right options
  13920. Popover.prototype.position = function () {
  13921. var options = this.options;
  13922. var origin = this.el.offsetParent().offset();
  13923. var width = this.el.outerWidth();
  13924. var height = this.el.outerHeight();
  13925. var windowEl = $(window);
  13926. var viewportEl = util_1.getScrollParent(this.el);
  13927. var viewportTop;
  13928. var viewportLeft;
  13929. var viewportOffset;
  13930. var top; // the "position" (not "offset") values for the popover
  13931. var left; //
  13932. // compute top and left
  13933. top = options.top || 0;
  13934. if (options.left !== undefined) {
  13935. left = options.left;
  13936. }
  13937. else if (options.right !== undefined) {
  13938. left = options.right - width; // derive the left value from the right value
  13939. }
  13940. else {
  13941. left = 0;
  13942. }
  13943. if (viewportEl.is(window) || viewportEl.is(document)) {
  13944. viewportEl = windowEl;
  13945. viewportTop = 0; // the window is always at the top left
  13946. viewportLeft = 0; // (and .offset() won't work if called here)
  13947. }
  13948. else {
  13949. viewportOffset = viewportEl.offset();
  13950. viewportTop = viewportOffset.top;
  13951. viewportLeft = viewportOffset.left;
  13952. }
  13953. // if the window is scrolled, it causes the visible area to be further down
  13954. viewportTop += windowEl.scrollTop();
  13955. viewportLeft += windowEl.scrollLeft();
  13956. // constrain to the view port. if constrained by two edges, give precedence to top/left
  13957. if (options.viewportConstrain !== false) {
  13958. top = Math.min(top, viewportTop + viewportEl.outerHeight() - height - this.margin);
  13959. top = Math.max(top, viewportTop + this.margin);
  13960. left = Math.min(left, viewportLeft + viewportEl.outerWidth() - width - this.margin);
  13961. left = Math.max(left, viewportLeft + this.margin);
  13962. }
  13963. this.el.css({
  13964. top: top - origin.top,
  13965. left: left - origin.left
  13966. });
  13967. };
  13968. // Triggers a callback. Calls a function in the option hash of the same name.
  13969. // Arguments beyond the first `name` are forwarded on.
  13970. // TODO: better code reuse for this. Repeat code
  13971. Popover.prototype.trigger = function (name) {
  13972. if (this.options[name]) {
  13973. this.options[name].apply(this, Array.prototype.slice.call(arguments, 1));
  13974. }
  13975. };
  13976. return Popover;
  13977. }());
  13978. exports.default = Popover;
  13979. ListenerMixin_1.default.mixInto(Popover);
  13980. /***/ }),
  13981. /* 246 */
  13982. /***/ (function(module, exports, __webpack_require__) {
  13983. Object.defineProperty(exports, "__esModule", { value: true });
  13984. var tslib_1 = __webpack_require__(2);
  13985. var $ = __webpack_require__(3);
  13986. var util_1 = __webpack_require__(4);
  13987. var EventRenderer_1 = __webpack_require__(42);
  13988. /* Event-rendering methods for the DayGrid class
  13989. ----------------------------------------------------------------------------------------------------------------------*/
  13990. var DayGridEventRenderer = /** @class */ (function (_super) {
  13991. tslib_1.__extends(DayGridEventRenderer, _super);
  13992. function DayGridEventRenderer(dayGrid, fillRenderer) {
  13993. var _this = _super.call(this, dayGrid, fillRenderer) || this;
  13994. _this.dayGrid = dayGrid;
  13995. return _this;
  13996. }
  13997. DayGridEventRenderer.prototype.renderBgRanges = function (eventRanges) {
  13998. // don't render timed background events
  13999. eventRanges = $.grep(eventRanges, function (eventRange) {
  14000. return eventRange.eventDef.isAllDay();
  14001. });
  14002. _super.prototype.renderBgRanges.call(this, eventRanges);
  14003. };
  14004. // Renders the given foreground event segments onto the grid
  14005. DayGridEventRenderer.prototype.renderFgSegs = function (segs) {
  14006. var rowStructs = this.rowStructs = this.renderSegRows(segs);
  14007. // append to each row's content skeleton
  14008. this.dayGrid.rowEls.each(function (i, rowNode) {
  14009. $(rowNode).find('.fc-content-skeleton > table').append(rowStructs[i].tbodyEl);
  14010. });
  14011. };
  14012. // Unrenders all currently rendered foreground event segments
  14013. DayGridEventRenderer.prototype.unrenderFgSegs = function () {
  14014. var rowStructs = this.rowStructs || [];
  14015. var rowStruct;
  14016. while ((rowStruct = rowStructs.pop())) {
  14017. rowStruct.tbodyEl.remove();
  14018. }
  14019. this.rowStructs = null;
  14020. };
  14021. // Uses the given events array to generate <tbody> elements that should be appended to each row's content skeleton.
  14022. // Returns an array of rowStruct objects (see the bottom of `renderSegRow`).
  14023. // PRECONDITION: each segment shoud already have a rendered and assigned `.el`
  14024. DayGridEventRenderer.prototype.renderSegRows = function (segs) {
  14025. var rowStructs = [];
  14026. var segRows;
  14027. var row;
  14028. segRows = this.groupSegRows(segs); // group into nested arrays
  14029. // iterate each row of segment groupings
  14030. for (row = 0; row < segRows.length; row++) {
  14031. rowStructs.push(this.renderSegRow(row, segRows[row]));
  14032. }
  14033. return rowStructs;
  14034. };
  14035. // Given a row # and an array of segments all in the same row, render a <tbody> element, a skeleton that contains
  14036. // the segments. Returns object with a bunch of internal data about how the render was calculated.
  14037. // NOTE: modifies rowSegs
  14038. DayGridEventRenderer.prototype.renderSegRow = function (row, rowSegs) {
  14039. var colCnt = this.dayGrid.colCnt;
  14040. var segLevels = this.buildSegLevels(rowSegs); // group into sub-arrays of levels
  14041. var levelCnt = Math.max(1, segLevels.length); // ensure at least one level
  14042. var tbody = $('<tbody/>');
  14043. var segMatrix = []; // lookup for which segments are rendered into which level+col cells
  14044. var cellMatrix = []; // lookup for all <td> elements of the level+col matrix
  14045. var loneCellMatrix = []; // lookup for <td> elements that only take up a single column
  14046. var i;
  14047. var levelSegs;
  14048. var col;
  14049. var tr;
  14050. var j;
  14051. var seg;
  14052. var td;
  14053. // populates empty cells from the current column (`col`) to `endCol`
  14054. function emptyCellsUntil(endCol) {
  14055. while (col < endCol) {
  14056. // try to grab a cell from the level above and extend its rowspan. otherwise, create a fresh cell
  14057. td = (loneCellMatrix[i - 1] || [])[col];
  14058. if (td) {
  14059. td.attr('rowspan', parseInt(td.attr('rowspan') || 1, 10) + 1);
  14060. }
  14061. else {
  14062. td = $('<td/>');
  14063. tr.append(td);
  14064. }
  14065. cellMatrix[i][col] = td;
  14066. loneCellMatrix[i][col] = td;
  14067. col++;
  14068. }
  14069. }
  14070. for (i = 0; i < levelCnt; i++) {
  14071. levelSegs = segLevels[i];
  14072. col = 0;
  14073. tr = $('<tr/>');
  14074. segMatrix.push([]);
  14075. cellMatrix.push([]);
  14076. loneCellMatrix.push([]);
  14077. // levelCnt might be 1 even though there are no actual levels. protect against this.
  14078. // this single empty row is useful for styling.
  14079. if (levelSegs) {
  14080. for (j = 0; j < levelSegs.length; j++) {
  14081. seg = levelSegs[j];
  14082. emptyCellsUntil(seg.leftCol);
  14083. // create a container that occupies or more columns. append the event element.
  14084. td = $('<td class="fc-event-container"/>').append(seg.el);
  14085. if (seg.leftCol !== seg.rightCol) {
  14086. td.attr('colspan', seg.rightCol - seg.leftCol + 1);
  14087. }
  14088. else {
  14089. loneCellMatrix[i][col] = td;
  14090. }
  14091. while (col <= seg.rightCol) {
  14092. cellMatrix[i][col] = td;
  14093. segMatrix[i][col] = seg;
  14094. col++;
  14095. }
  14096. tr.append(td);
  14097. }
  14098. }
  14099. emptyCellsUntil(colCnt); // finish off the row
  14100. this.dayGrid.bookendCells(tr);
  14101. tbody.append(tr);
  14102. }
  14103. return {
  14104. row: row,
  14105. tbodyEl: tbody,
  14106. cellMatrix: cellMatrix,
  14107. segMatrix: segMatrix,
  14108. segLevels: segLevels,
  14109. segs: rowSegs
  14110. };
  14111. };
  14112. // Stacks a flat array of segments, which are all assumed to be in the same row, into subarrays of vertical levels.
  14113. // NOTE: modifies segs
  14114. DayGridEventRenderer.prototype.buildSegLevels = function (segs) {
  14115. var levels = [];
  14116. var i;
  14117. var seg;
  14118. var j;
  14119. // Give preference to elements with certain criteria, so they have
  14120. // a chance to be closer to the top.
  14121. this.sortEventSegs(segs);
  14122. for (i = 0; i < segs.length; i++) {
  14123. seg = segs[i];
  14124. // loop through levels, starting with the topmost, until the segment doesn't collide with other segments
  14125. for (j = 0; j < levels.length; j++) {
  14126. if (!isDaySegCollision(seg, levels[j])) {
  14127. break;
  14128. }
  14129. }
  14130. // `j` now holds the desired subrow index
  14131. seg.level = j;
  14132. // create new level array if needed and append segment
  14133. (levels[j] || (levels[j] = [])).push(seg);
  14134. }
  14135. // order segments left-to-right. very important if calendar is RTL
  14136. for (j = 0; j < levels.length; j++) {
  14137. levels[j].sort(compareDaySegCols);
  14138. }
  14139. return levels;
  14140. };
  14141. // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's row
  14142. DayGridEventRenderer.prototype.groupSegRows = function (segs) {
  14143. var segRows = [];
  14144. var i;
  14145. for (i = 0; i < this.dayGrid.rowCnt; i++) {
  14146. segRows.push([]);
  14147. }
  14148. for (i = 0; i < segs.length; i++) {
  14149. segRows[segs[i].row].push(segs[i]);
  14150. }
  14151. return segRows;
  14152. };
  14153. // Computes a default event time formatting string if `timeFormat` is not explicitly defined
  14154. DayGridEventRenderer.prototype.computeEventTimeFormat = function () {
  14155. return this.opt('extraSmallTimeFormat'); // like "6p" or "6:30p"
  14156. };
  14157. // Computes a default `displayEventEnd` value if one is not expliclty defined
  14158. DayGridEventRenderer.prototype.computeDisplayEventEnd = function () {
  14159. return this.dayGrid.colCnt === 1; // we'll likely have space if there's only one day
  14160. };
  14161. // Builds the HTML to be used for the default element for an individual segment
  14162. DayGridEventRenderer.prototype.fgSegHtml = function (seg, disableResizing) {
  14163. var view = this.view;
  14164. var eventDef = seg.footprint.eventDef;
  14165. var isAllDay = seg.footprint.componentFootprint.isAllDay;
  14166. var isDraggable = view.isEventDefDraggable(eventDef);
  14167. var isResizableFromStart = !disableResizing && isAllDay &&
  14168. seg.isStart && view.isEventDefResizableFromStart(eventDef);
  14169. var isResizableFromEnd = !disableResizing && isAllDay &&
  14170. seg.isEnd && view.isEventDefResizableFromEnd(eventDef);
  14171. var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd);
  14172. var skinCss = util_1.cssToStr(this.getSkinCss(eventDef));
  14173. var timeHtml = '';
  14174. var timeText;
  14175. var titleHtml;
  14176. classes.unshift('fc-day-grid-event', 'fc-h-event');
  14177. // Only display a timed events time if it is the starting segment
  14178. if (seg.isStart) {
  14179. timeText = this.getTimeText(seg.footprint);
  14180. if (timeText) {
  14181. timeHtml = '<span class="fc-time">' + util_1.htmlEscape(timeText) + '</span>';
  14182. }
  14183. }
  14184. titleHtml =
  14185. '<span class="fc-title">' +
  14186. (util_1.htmlEscape(eventDef.title || '') || '&nbsp;') + // we always want one line of height
  14187. '</span>';
  14188. return '<a class="' + classes.join(' ') + '"' +
  14189. (eventDef.url ?
  14190. ' href="' + util_1.htmlEscape(eventDef.url) + '"' :
  14191. '') +
  14192. (skinCss ?
  14193. ' style="' + skinCss + '"' :
  14194. '') +
  14195. '>' +
  14196. '<div class="fc-content">' +
  14197. (this.dayGrid.isRTL ?
  14198. titleHtml + ' ' + timeHtml : // put a natural space in between
  14199. timeHtml + ' ' + titleHtml //
  14200. ) +
  14201. '</div>' +
  14202. (isResizableFromStart ?
  14203. '<div class="fc-resizer fc-start-resizer" />' :
  14204. '') +
  14205. (isResizableFromEnd ?
  14206. '<div class="fc-resizer fc-end-resizer" />' :
  14207. '') +
  14208. '</a>';
  14209. };
  14210. return DayGridEventRenderer;
  14211. }(EventRenderer_1.default));
  14212. exports.default = DayGridEventRenderer;
  14213. // Computes whether two segments' columns collide. They are assumed to be in the same row.
  14214. function isDaySegCollision(seg, otherSegs) {
  14215. var i;
  14216. var otherSeg;
  14217. for (i = 0; i < otherSegs.length; i++) {
  14218. otherSeg = otherSegs[i];
  14219. if (otherSeg.leftCol <= seg.rightCol &&
  14220. otherSeg.rightCol >= seg.leftCol) {
  14221. return true;
  14222. }
  14223. }
  14224. return false;
  14225. }
  14226. // A cmp function for determining the leftmost event
  14227. function compareDaySegCols(a, b) {
  14228. return a.leftCol - b.leftCol;
  14229. }
  14230. /***/ }),
  14231. /* 247 */
  14232. /***/ (function(module, exports, __webpack_require__) {
  14233. Object.defineProperty(exports, "__esModule", { value: true });
  14234. var tslib_1 = __webpack_require__(2);
  14235. var $ = __webpack_require__(3);
  14236. var HelperRenderer_1 = __webpack_require__(58);
  14237. var DayGridHelperRenderer = /** @class */ (function (_super) {
  14238. tslib_1.__extends(DayGridHelperRenderer, _super);
  14239. function DayGridHelperRenderer() {
  14240. return _super !== null && _super.apply(this, arguments) || this;
  14241. }
  14242. // Renders a mock "helper" event. `sourceSeg` is the associated internal segment object. It can be null.
  14243. DayGridHelperRenderer.prototype.renderSegs = function (segs, sourceSeg) {
  14244. var helperNodes = [];
  14245. var rowStructs;
  14246. // TODO: not good to call eventRenderer this way
  14247. rowStructs = this.eventRenderer.renderSegRows(segs);
  14248. // inject each new event skeleton into each associated row
  14249. this.component.rowEls.each(function (row, rowNode) {
  14250. var rowEl = $(rowNode); // the .fc-row
  14251. var skeletonEl = $('<div class="fc-helper-skeleton"><table/></div>'); // will be absolutely positioned
  14252. var skeletonTopEl;
  14253. var skeletonTop;
  14254. // If there is an original segment, match the top position. Otherwise, put it at the row's top level
  14255. if (sourceSeg && sourceSeg.row === row) {
  14256. skeletonTop = sourceSeg.el.position().top;
  14257. }
  14258. else {
  14259. skeletonTopEl = rowEl.find('.fc-content-skeleton tbody');
  14260. if (!skeletonTopEl.length) {
  14261. skeletonTopEl = rowEl.find('.fc-content-skeleton table');
  14262. }
  14263. skeletonTop = skeletonTopEl.position().top;
  14264. }
  14265. skeletonEl.css('top', skeletonTop)
  14266. .find('table')
  14267. .append(rowStructs[row].tbodyEl);
  14268. rowEl.append(skeletonEl);
  14269. helperNodes.push(skeletonEl[0]);
  14270. });
  14271. return $(helperNodes); // must return the elements rendered
  14272. };
  14273. return DayGridHelperRenderer;
  14274. }(HelperRenderer_1.default));
  14275. exports.default = DayGridHelperRenderer;
  14276. /***/ }),
  14277. /* 248 */
  14278. /***/ (function(module, exports, __webpack_require__) {
  14279. Object.defineProperty(exports, "__esModule", { value: true });
  14280. var tslib_1 = __webpack_require__(2);
  14281. var $ = __webpack_require__(3);
  14282. var FillRenderer_1 = __webpack_require__(57);
  14283. var DayGridFillRenderer = /** @class */ (function (_super) {
  14284. tslib_1.__extends(DayGridFillRenderer, _super);
  14285. function DayGridFillRenderer() {
  14286. var _this = _super !== null && _super.apply(this, arguments) || this;
  14287. _this.fillSegTag = 'td'; // override the default tag name
  14288. return _this;
  14289. }
  14290. DayGridFillRenderer.prototype.attachSegEls = function (type, segs) {
  14291. var nodes = [];
  14292. var i;
  14293. var seg;
  14294. var skeletonEl;
  14295. for (i = 0; i < segs.length; i++) {
  14296. seg = segs[i];
  14297. skeletonEl = this.renderFillRow(type, seg);
  14298. this.component.rowEls.eq(seg.row).append(skeletonEl);
  14299. nodes.push(skeletonEl[0]);
  14300. }
  14301. return nodes;
  14302. };
  14303. // Generates the HTML needed for one row of a fill. Requires the seg's el to be rendered.
  14304. DayGridFillRenderer.prototype.renderFillRow = function (type, seg) {
  14305. var colCnt = this.component.colCnt;
  14306. var startCol = seg.leftCol;
  14307. var endCol = seg.rightCol + 1;
  14308. var className;
  14309. var skeletonEl;
  14310. var trEl;
  14311. if (type === 'businessHours') {
  14312. className = 'bgevent';
  14313. }
  14314. else {
  14315. className = type.toLowerCase();
  14316. }
  14317. skeletonEl = $('<div class="fc-' + className + '-skeleton">' +
  14318. '<table><tr/></table>' +
  14319. '</div>');
  14320. trEl = skeletonEl.find('tr');
  14321. if (startCol > 0) {
  14322. trEl.append('<td colspan="' + startCol + '"/>');
  14323. }
  14324. trEl.append(seg.el.attr('colspan', endCol - startCol));
  14325. if (endCol < colCnt) {
  14326. trEl.append('<td colspan="' + (colCnt - endCol) + '"/>');
  14327. }
  14328. this.component.bookendCells(trEl);
  14329. return skeletonEl;
  14330. };
  14331. return DayGridFillRenderer;
  14332. }(FillRenderer_1.default));
  14333. exports.default = DayGridFillRenderer;
  14334. /***/ }),
  14335. /* 249 */
  14336. /***/ (function(module, exports, __webpack_require__) {
  14337. Object.defineProperty(exports, "__esModule", { value: true });
  14338. var tslib_1 = __webpack_require__(2);
  14339. var BasicViewDateProfileGenerator_1 = __webpack_require__(224);
  14340. var UnzonedRange_1 = __webpack_require__(5);
  14341. var MonthViewDateProfileGenerator = /** @class */ (function (_super) {
  14342. tslib_1.__extends(MonthViewDateProfileGenerator, _super);
  14343. function MonthViewDateProfileGenerator() {
  14344. return _super !== null && _super.apply(this, arguments) || this;
  14345. }
  14346. // Computes the date range that will be rendered.
  14347. MonthViewDateProfileGenerator.prototype.buildRenderRange = function (currentUnzonedRange, currentRangeUnit, isRangeAllDay) {
  14348. var renderUnzonedRange = _super.prototype.buildRenderRange.call(this, currentUnzonedRange, currentRangeUnit, isRangeAllDay);
  14349. var start = this.msToUtcMoment(renderUnzonedRange.startMs, isRangeAllDay);
  14350. var end = this.msToUtcMoment(renderUnzonedRange.endMs, isRangeAllDay);
  14351. var rowCnt;
  14352. // ensure 6 weeks
  14353. if (this.opt('fixedWeekCount')) {
  14354. rowCnt = Math.ceil(// could be partial weeks due to hiddenDays
  14355. end.diff(start, 'weeks', true) // dontRound=true
  14356. );
  14357. end.add(6 - rowCnt, 'weeks');
  14358. }
  14359. return new UnzonedRange_1.default(start, end);
  14360. };
  14361. return MonthViewDateProfileGenerator;
  14362. }(BasicViewDateProfileGenerator_1.default));
  14363. exports.default = MonthViewDateProfileGenerator;
  14364. /***/ }),
  14365. /* 250 */
  14366. /***/ (function(module, exports, __webpack_require__) {
  14367. Object.defineProperty(exports, "__esModule", { value: true });
  14368. var tslib_1 = __webpack_require__(2);
  14369. var util_1 = __webpack_require__(4);
  14370. var EventRenderer_1 = __webpack_require__(42);
  14371. var ListEventRenderer = /** @class */ (function (_super) {
  14372. tslib_1.__extends(ListEventRenderer, _super);
  14373. function ListEventRenderer() {
  14374. return _super !== null && _super.apply(this, arguments) || this;
  14375. }
  14376. ListEventRenderer.prototype.renderFgSegs = function (segs) {
  14377. if (!segs.length) {
  14378. this.component.renderEmptyMessage();
  14379. }
  14380. else {
  14381. this.component.renderSegList(segs);
  14382. }
  14383. };
  14384. // generates the HTML for a single event row
  14385. ListEventRenderer.prototype.fgSegHtml = function (seg) {
  14386. var view = this.view;
  14387. var calendar = view.calendar;
  14388. var theme = calendar.theme;
  14389. var eventFootprint = seg.footprint;
  14390. var eventDef = eventFootprint.eventDef;
  14391. var componentFootprint = eventFootprint.componentFootprint;
  14392. var url = eventDef.url;
  14393. var classes = ['fc-list-item'].concat(this.getClasses(eventDef));
  14394. var bgColor = this.getBgColor(eventDef);
  14395. var timeHtml;
  14396. if (componentFootprint.isAllDay) {
  14397. timeHtml = view.getAllDayHtml();
  14398. }
  14399. else if (view.isMultiDayRange(componentFootprint.unzonedRange)) {
  14400. if (seg.isStart || seg.isEnd) {
  14401. timeHtml = util_1.htmlEscape(this._getTimeText(calendar.msToMoment(seg.startMs), calendar.msToMoment(seg.endMs), componentFootprint.isAllDay));
  14402. }
  14403. else {
  14404. timeHtml = view.getAllDayHtml();
  14405. }
  14406. }
  14407. else {
  14408. // Display the normal time text for the *event's* times
  14409. timeHtml = util_1.htmlEscape(this.getTimeText(eventFootprint));
  14410. }
  14411. if (url) {
  14412. classes.push('fc-has-url');
  14413. }
  14414. return '<tr class="' + classes.join(' ') + '">' +
  14415. (this.displayEventTime ?
  14416. '<td class="fc-list-item-time ' + theme.getClass('widgetContent') + '">' +
  14417. (timeHtml || '') +
  14418. '</td>' :
  14419. '') +
  14420. '<td class="fc-list-item-marker ' + theme.getClass('widgetContent') + '">' +
  14421. '<span class="fc-event-dot"' +
  14422. (bgColor ?
  14423. ' style="background-color:' + bgColor + '"' :
  14424. '') +
  14425. '></span>' +
  14426. '</td>' +
  14427. '<td class="fc-list-item-title ' + theme.getClass('widgetContent') + '">' +
  14428. '<a' + (url ? ' href="' + util_1.htmlEscape(url) + '"' : '') + '>' +
  14429. util_1.htmlEscape(eventDef.title || '') +
  14430. '</a>' +
  14431. '</td>' +
  14432. '</tr>';
  14433. };
  14434. // like "4:00am"
  14435. ListEventRenderer.prototype.computeEventTimeFormat = function () {
  14436. return this.opt('mediumTimeFormat');
  14437. };
  14438. return ListEventRenderer;
  14439. }(EventRenderer_1.default));
  14440. exports.default = ListEventRenderer;
  14441. /***/ }),
  14442. /* 251 */
  14443. /***/ (function(module, exports, __webpack_require__) {
  14444. Object.defineProperty(exports, "__esModule", { value: true });
  14445. var tslib_1 = __webpack_require__(2);
  14446. var $ = __webpack_require__(3);
  14447. var EventPointing_1 = __webpack_require__(59);
  14448. var ListEventPointing = /** @class */ (function (_super) {
  14449. tslib_1.__extends(ListEventPointing, _super);
  14450. function ListEventPointing() {
  14451. return _super !== null && _super.apply(this, arguments) || this;
  14452. }
  14453. // for events with a url, the whole <tr> should be clickable,
  14454. // but it's impossible to wrap with an <a> tag. simulate this.
  14455. ListEventPointing.prototype.handleClick = function (seg, ev) {
  14456. var url;
  14457. _super.prototype.handleClick.call(this, seg, ev); // might prevent the default action
  14458. // not clicking on or within an <a> with an href
  14459. if (!$(ev.target).closest('a[href]').length) {
  14460. url = seg.footprint.eventDef.url;
  14461. if (url && !ev.isDefaultPrevented()) {
  14462. window.location.href = url; // simulate link click
  14463. }
  14464. }
  14465. };
  14466. return ListEventPointing;
  14467. }(EventPointing_1.default));
  14468. exports.default = ListEventPointing;
  14469. /***/ }),
  14470. /* 252 */
  14471. /***/ (function(module, exports, __webpack_require__) {
  14472. Object.defineProperty(exports, "__esModule", { value: true });
  14473. var EventSourceParser_1 = __webpack_require__(37);
  14474. var ArrayEventSource_1 = __webpack_require__(52);
  14475. var FuncEventSource_1 = __webpack_require__(211);
  14476. var JsonFeedEventSource_1 = __webpack_require__(212);
  14477. EventSourceParser_1.default.registerClass(ArrayEventSource_1.default);
  14478. EventSourceParser_1.default.registerClass(FuncEventSource_1.default);
  14479. EventSourceParser_1.default.registerClass(JsonFeedEventSource_1.default);
  14480. /***/ }),
  14481. /* 253 */
  14482. /***/ (function(module, exports, __webpack_require__) {
  14483. Object.defineProperty(exports, "__esModule", { value: true });
  14484. var ThemeRegistry_1 = __webpack_require__(51);
  14485. var StandardTheme_1 = __webpack_require__(209);
  14486. var JqueryUiTheme_1 = __webpack_require__(210);
  14487. var BootstrapTheme_1 = __webpack_require__(254);
  14488. ThemeRegistry_1.defineThemeSystem('standard', StandardTheme_1.default);
  14489. ThemeRegistry_1.defineThemeSystem('jquery-ui', JqueryUiTheme_1.default);
  14490. ThemeRegistry_1.defineThemeSystem('bootstrap3', BootstrapTheme_1.default);
  14491. /***/ }),
  14492. /* 254 */
  14493. /***/ (function(module, exports, __webpack_require__) {
  14494. Object.defineProperty(exports, "__esModule", { value: true });
  14495. var tslib_1 = __webpack_require__(2);
  14496. var Theme_1 = __webpack_require__(38);
  14497. var BootstrapTheme = /** @class */ (function (_super) {
  14498. tslib_1.__extends(BootstrapTheme, _super);
  14499. function BootstrapTheme() {
  14500. return _super !== null && _super.apply(this, arguments) || this;
  14501. }
  14502. return BootstrapTheme;
  14503. }(Theme_1.default));
  14504. exports.default = BootstrapTheme;
  14505. BootstrapTheme.prototype.classes = {
  14506. widget: 'fc-bootstrap3',
  14507. tableGrid: 'table-bordered',
  14508. tableList: 'table table-striped',
  14509. buttonGroup: 'btn-group',
  14510. button: 'btn btn-default',
  14511. stateActive: 'active',
  14512. stateDisabled: 'disabled',
  14513. today: 'alert alert-info',
  14514. popover: 'panel panel-default',
  14515. popoverHeader: 'panel-heading',
  14516. popoverContent: 'panel-body',
  14517. // day grid
  14518. headerRow: 'panel-default',
  14519. dayRow: 'panel-default',
  14520. // list view
  14521. listView: 'panel panel-default'
  14522. };
  14523. BootstrapTheme.prototype.baseIconClass = 'glyphicon';
  14524. BootstrapTheme.prototype.iconClasses = {
  14525. close: 'glyphicon-remove',
  14526. prev: 'glyphicon-chevron-left',
  14527. next: 'glyphicon-chevron-right',
  14528. prevYear: 'glyphicon-backward',
  14529. nextYear: 'glyphicon-forward'
  14530. };
  14531. BootstrapTheme.prototype.iconOverrideOption = 'bootstrapGlyphicons';
  14532. BootstrapTheme.prototype.iconOverrideCustomButtonOption = 'bootstrapGlyphicon';
  14533. BootstrapTheme.prototype.iconOverridePrefix = 'glyphicon-';
  14534. /***/ }),
  14535. /* 255 */
  14536. /***/ (function(module, exports, __webpack_require__) {
  14537. Object.defineProperty(exports, "__esModule", { value: true });
  14538. var ViewRegistry_1 = __webpack_require__(21);
  14539. var BasicView_1 = __webpack_require__(62);
  14540. var MonthView_1 = __webpack_require__(225);
  14541. ViewRegistry_1.defineView('basic', {
  14542. 'class': BasicView_1.default
  14543. });
  14544. ViewRegistry_1.defineView('basicDay', {
  14545. type: 'basic',
  14546. duration: { days: 1 }
  14547. });
  14548. ViewRegistry_1.defineView('basicWeek', {
  14549. type: 'basic',
  14550. duration: { weeks: 1 }
  14551. });
  14552. ViewRegistry_1.defineView('month', {
  14553. 'class': MonthView_1.default,
  14554. duration: { months: 1 },
  14555. defaults: {
  14556. fixedWeekCount: true
  14557. }
  14558. });
  14559. /***/ }),
  14560. /* 256 */
  14561. /***/ (function(module, exports, __webpack_require__) {
  14562. Object.defineProperty(exports, "__esModule", { value: true });
  14563. var ViewRegistry_1 = __webpack_require__(21);
  14564. var AgendaView_1 = __webpack_require__(222);
  14565. ViewRegistry_1.defineView('agenda', {
  14566. 'class': AgendaView_1.default,
  14567. defaults: {
  14568. allDaySlot: true,
  14569. slotDuration: '00:30:00',
  14570. slotEventOverlap: true // a bad name. confused with overlap/constraint system
  14571. }
  14572. });
  14573. ViewRegistry_1.defineView('agendaDay', {
  14574. type: 'agenda',
  14575. duration: { days: 1 }
  14576. });
  14577. ViewRegistry_1.defineView('agendaWeek', {
  14578. type: 'agenda',
  14579. duration: { weeks: 1 }
  14580. });
  14581. /***/ }),
  14582. /* 257 */
  14583. /***/ (function(module, exports, __webpack_require__) {
  14584. Object.defineProperty(exports, "__esModule", { value: true });
  14585. var ViewRegistry_1 = __webpack_require__(21);
  14586. var ListView_1 = __webpack_require__(226);
  14587. ViewRegistry_1.defineView('list', {
  14588. 'class': ListView_1.default,
  14589. buttonTextKey: 'list',
  14590. defaults: {
  14591. buttonText: 'list',
  14592. listDayFormat: 'LL',
  14593. noEventsMessage: 'No events to display'
  14594. }
  14595. });
  14596. ViewRegistry_1.defineView('listDay', {
  14597. type: 'list',
  14598. duration: { days: 1 },
  14599. defaults: {
  14600. listDayFormat: 'dddd' // day-of-week is all we need. full date is probably in header
  14601. }
  14602. });
  14603. ViewRegistry_1.defineView('listWeek', {
  14604. type: 'list',
  14605. duration: { weeks: 1 },
  14606. defaults: {
  14607. listDayFormat: 'dddd',
  14608. listDayAltFormat: 'LL'
  14609. }
  14610. });
  14611. ViewRegistry_1.defineView('listMonth', {
  14612. type: 'list',
  14613. duration: { month: 1 },
  14614. defaults: {
  14615. listDayAltFormat: 'dddd' // day-of-week is nice-to-have
  14616. }
  14617. });
  14618. ViewRegistry_1.defineView('listYear', {
  14619. type: 'list',
  14620. duration: { year: 1 },
  14621. defaults: {
  14622. listDayAltFormat: 'dddd' // day-of-week is nice-to-have
  14623. }
  14624. });
  14625. /***/ }),
  14626. /* 258 */
  14627. /***/ (function(module, exports) {
  14628. Object.defineProperty(exports, "__esModule", { value: true });
  14629. /***/ })
  14630. /******/ ]);
  14631. });