0
0

fullcalendar.js 606 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148
  1. /*!
  2. * FullCalendar v3.10.2
  3. * Docs & License: https://fullcalendar.io/
  4. * (c) 2019 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 = 256);
  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) { // we check this again because redistribution might have changed things
  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') { // is the scrollbar on the left side?
  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></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, obj1fallback, obj2fallback) {
  471. var i;
  472. var cmp;
  473. for (i = 0; i < fieldSpecs.length; i++) {
  474. cmp = compareByFieldSpec(obj1, obj2, fieldSpecs[i], obj1fallback, obj2fallback);
  475. if (cmp) {
  476. return cmp;
  477. }
  478. }
  479. return 0;
  480. }
  481. exports.compareByFieldSpecs = compareByFieldSpecs;
  482. function compareByFieldSpec(obj1, obj2, fieldSpec, obj1fallback, obj2fallback) {
  483. if (fieldSpec.func) {
  484. return fieldSpec.func(obj1, obj2);
  485. }
  486. var val1 = obj1[fieldSpec.field];
  487. var val2 = obj2[fieldSpec.field];
  488. if (val1 == null && obj1fallback) {
  489. val1 = obj1fallback[fieldSpec.field];
  490. }
  491. if (val2 == null && obj2fallback) {
  492. val2 = obj2fallback[fieldSpec.field];
  493. }
  494. return flexibleCompare(val1, val2) * (fieldSpec.order || 1);
  495. }
  496. exports.compareByFieldSpec = compareByFieldSpec;
  497. function flexibleCompare(a, b) {
  498. if (!a && !b) {
  499. return 0;
  500. }
  501. if (b == null) {
  502. return -1;
  503. }
  504. if (a == null) {
  505. return 1;
  506. }
  507. if ($.type(a) === 'string' || $.type(b) === 'string') {
  508. return String(a).localeCompare(String(b));
  509. }
  510. return a - b;
  511. }
  512. exports.flexibleCompare = flexibleCompare;
  513. /* Date Utilities
  514. ----------------------------------------------------------------------------------------------------------------------*/
  515. exports.dayIDs = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
  516. exports.unitsDesc = ['year', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond']; // descending
  517. // Diffs the two moments into a Duration where full-days are recorded first, then the remaining time.
  518. // Moments will have their timezones normalized.
  519. function diffDayTime(a, b) {
  520. return moment.duration({
  521. days: a.clone().stripTime().diff(b.clone().stripTime(), 'days'),
  522. ms: a.time() - b.time() // time-of-day from day start. disregards timezone
  523. });
  524. }
  525. exports.diffDayTime = diffDayTime;
  526. // Diffs the two moments via their start-of-day (regardless of timezone). Produces whole-day durations.
  527. function diffDay(a, b) {
  528. return moment.duration({
  529. days: a.clone().stripTime().diff(b.clone().stripTime(), 'days')
  530. });
  531. }
  532. exports.diffDay = diffDay;
  533. // Diffs two moments, producing a duration, made of a whole-unit-increment of the given unit. Uses rounding.
  534. function diffByUnit(a, b, unit) {
  535. return moment.duration(Math.round(a.diff(b, unit, true)), // returnFloat=true
  536. unit);
  537. }
  538. exports.diffByUnit = diffByUnit;
  539. // Computes the unit name of the largest whole-unit period of time.
  540. // For example, 48 hours will be "days" whereas 49 hours will be "hours".
  541. // Accepts start/end, a range object, or an original duration object.
  542. function computeGreatestUnit(start, end) {
  543. var i;
  544. var unit;
  545. var val;
  546. for (i = 0; i < exports.unitsDesc.length; i++) {
  547. unit = exports.unitsDesc[i];
  548. val = computeRangeAs(unit, start, end);
  549. if (val >= 1 && isInt(val)) {
  550. break;
  551. }
  552. }
  553. return unit; // will be "milliseconds" if nothing else matches
  554. }
  555. exports.computeGreatestUnit = computeGreatestUnit;
  556. // like computeGreatestUnit, but has special abilities to interpret the source input for clues
  557. function computeDurationGreatestUnit(duration, durationInput) {
  558. var unit = computeGreatestUnit(duration);
  559. // prevent days:7 from being interpreted as a week
  560. if (unit === 'week' && typeof durationInput === 'object' && durationInput.days) {
  561. unit = 'day';
  562. }
  563. return unit;
  564. }
  565. exports.computeDurationGreatestUnit = computeDurationGreatestUnit;
  566. // Computes the number of units (like "hours") in the given range.
  567. // Range can be a {start,end} object, separate start/end args, or a Duration.
  568. // Results are based on Moment's .as() and .diff() methods, so results can depend on internal handling
  569. // of month-diffing logic (which tends to vary from version to version).
  570. function computeRangeAs(unit, start, end) {
  571. if (end != null) { // given start, end
  572. return end.diff(start, unit, true);
  573. }
  574. else if (moment.isDuration(start)) { // given duration
  575. return start.as(unit);
  576. }
  577. else { // given { start, end } range object
  578. return start.end.diff(start.start, unit, true);
  579. }
  580. }
  581. // Intelligently divides a range (specified by a start/end params) by a duration
  582. function divideRangeByDuration(start, end, dur) {
  583. var months;
  584. if (durationHasTime(dur)) {
  585. return (end - start) / dur;
  586. }
  587. months = dur.asMonths();
  588. if (Math.abs(months) >= 1 && isInt(months)) {
  589. return end.diff(start, 'months', true) / months;
  590. }
  591. return end.diff(start, 'days', true) / dur.asDays();
  592. }
  593. exports.divideRangeByDuration = divideRangeByDuration;
  594. // Intelligently divides one duration by another
  595. function divideDurationByDuration(dur1, dur2) {
  596. var months1;
  597. var months2;
  598. if (durationHasTime(dur1) || durationHasTime(dur2)) {
  599. return dur1 / dur2;
  600. }
  601. months1 = dur1.asMonths();
  602. months2 = dur2.asMonths();
  603. if (Math.abs(months1) >= 1 && isInt(months1) &&
  604. Math.abs(months2) >= 1 && isInt(months2)) {
  605. return months1 / months2;
  606. }
  607. return dur1.asDays() / dur2.asDays();
  608. }
  609. exports.divideDurationByDuration = divideDurationByDuration;
  610. // Intelligently multiplies a duration by a number
  611. function multiplyDuration(dur, n) {
  612. var months;
  613. if (durationHasTime(dur)) {
  614. return moment.duration(dur * n);
  615. }
  616. months = dur.asMonths();
  617. if (Math.abs(months) >= 1 && isInt(months)) {
  618. return moment.duration({ months: months * n });
  619. }
  620. return moment.duration({ days: dur.asDays() * n });
  621. }
  622. exports.multiplyDuration = multiplyDuration;
  623. // Returns a boolean about whether the given duration has any time parts (hours/minutes/seconds/ms)
  624. function durationHasTime(dur) {
  625. return Boolean(dur.hours() || dur.minutes() || dur.seconds() || dur.milliseconds());
  626. }
  627. exports.durationHasTime = durationHasTime;
  628. function isNativeDate(input) {
  629. return Object.prototype.toString.call(input) === '[object Date]' || input instanceof Date;
  630. }
  631. exports.isNativeDate = isNativeDate;
  632. // Returns a boolean about whether the given input is a time string, like "06:40:00" or "06:00"
  633. function isTimeString(str) {
  634. return typeof str === 'string' &&
  635. /^\d+\:\d+(?:\:\d+\.?(?:\d{3})?)?$/.test(str);
  636. }
  637. exports.isTimeString = isTimeString;
  638. /* Logging and Debug
  639. ----------------------------------------------------------------------------------------------------------------------*/
  640. function log() {
  641. var args = [];
  642. for (var _i = 0; _i < arguments.length; _i++) {
  643. args[_i] = arguments[_i];
  644. }
  645. var console = window.console;
  646. if (console && console.log) {
  647. return console.log.apply(console, args);
  648. }
  649. }
  650. exports.log = log;
  651. function warn() {
  652. var args = [];
  653. for (var _i = 0; _i < arguments.length; _i++) {
  654. args[_i] = arguments[_i];
  655. }
  656. var console = window.console;
  657. if (console && console.warn) {
  658. return console.warn.apply(console, args);
  659. }
  660. else {
  661. return log.apply(null, args);
  662. }
  663. }
  664. exports.warn = warn;
  665. /* General Utilities
  666. ----------------------------------------------------------------------------------------------------------------------*/
  667. var hasOwnPropMethod = {}.hasOwnProperty;
  668. // Merges an array of objects into a single object.
  669. // The second argument allows for an array of property names who's object values will be merged together.
  670. function mergeProps(propObjs, complexProps) {
  671. var dest = {};
  672. var i;
  673. var name;
  674. var complexObjs;
  675. var j;
  676. var val;
  677. var props;
  678. if (complexProps) {
  679. for (i = 0; i < complexProps.length; i++) {
  680. name = complexProps[i];
  681. complexObjs = [];
  682. // collect the trailing object values, stopping when a non-object is discovered
  683. for (j = propObjs.length - 1; j >= 0; j--) {
  684. val = propObjs[j][name];
  685. if (typeof val === 'object') {
  686. complexObjs.unshift(val);
  687. }
  688. else if (val !== undefined) {
  689. dest[name] = val; // if there were no objects, this value will be used
  690. break;
  691. }
  692. }
  693. // if the trailing values were objects, use the merged value
  694. if (complexObjs.length) {
  695. dest[name] = mergeProps(complexObjs);
  696. }
  697. }
  698. }
  699. // copy values into the destination, going from last to first
  700. for (i = propObjs.length - 1; i >= 0; i--) {
  701. props = propObjs[i];
  702. for (name in props) {
  703. if (!(name in dest)) { // if already assigned by previous props or complex props, don't reassign
  704. dest[name] = props[name];
  705. }
  706. }
  707. }
  708. return dest;
  709. }
  710. exports.mergeProps = mergeProps;
  711. function copyOwnProps(src, dest) {
  712. for (var name_1 in src) {
  713. if (hasOwnProp(src, name_1)) {
  714. dest[name_1] = src[name_1];
  715. }
  716. }
  717. }
  718. exports.copyOwnProps = copyOwnProps;
  719. function hasOwnProp(obj, name) {
  720. return hasOwnPropMethod.call(obj, name);
  721. }
  722. exports.hasOwnProp = hasOwnProp;
  723. function applyAll(functions, thisObj, args) {
  724. if ($.isFunction(functions)) {
  725. functions = [functions];
  726. }
  727. if (functions) {
  728. var i = void 0;
  729. var ret = void 0;
  730. for (i = 0; i < functions.length; i++) {
  731. ret = functions[i].apply(thisObj, args) || ret;
  732. }
  733. return ret;
  734. }
  735. }
  736. exports.applyAll = applyAll;
  737. function removeMatching(array, testFunc) {
  738. var removeCnt = 0;
  739. var i = 0;
  740. while (i < array.length) {
  741. if (testFunc(array[i])) { // truthy value means *remove*
  742. array.splice(i, 1);
  743. removeCnt++;
  744. }
  745. else {
  746. i++;
  747. }
  748. }
  749. return removeCnt;
  750. }
  751. exports.removeMatching = removeMatching;
  752. function removeExact(array, exactVal) {
  753. var removeCnt = 0;
  754. var i = 0;
  755. while (i < array.length) {
  756. if (array[i] === exactVal) {
  757. array.splice(i, 1);
  758. removeCnt++;
  759. }
  760. else {
  761. i++;
  762. }
  763. }
  764. return removeCnt;
  765. }
  766. exports.removeExact = removeExact;
  767. function isArraysEqual(a0, a1) {
  768. var len = a0.length;
  769. var i;
  770. if (len == null || len !== a1.length) { // not array? or not same length?
  771. return false;
  772. }
  773. for (i = 0; i < len; i++) {
  774. if (a0[i] !== a1[i]) {
  775. return false;
  776. }
  777. }
  778. return true;
  779. }
  780. exports.isArraysEqual = isArraysEqual;
  781. function firstDefined() {
  782. var args = [];
  783. for (var _i = 0; _i < arguments.length; _i++) {
  784. args[_i] = arguments[_i];
  785. }
  786. for (var i = 0; i < args.length; i++) {
  787. if (args[i] !== undefined) {
  788. return args[i];
  789. }
  790. }
  791. }
  792. exports.firstDefined = firstDefined;
  793. function htmlEscape(s) {
  794. return (s + '').replace(/&/g, '&amp;')
  795. .replace(/</g, '&lt;')
  796. .replace(/>/g, '&gt;')
  797. .replace(/'/g, '&#039;')
  798. .replace(/"/g, '&quot;')
  799. .replace(/\n/g, '<br>');
  800. }
  801. exports.htmlEscape = htmlEscape;
  802. function stripHtmlEntities(text) {
  803. return text.replace(/&.*?;/g, '');
  804. }
  805. exports.stripHtmlEntities = stripHtmlEntities;
  806. // Given a hash of CSS properties, returns a string of CSS.
  807. // Uses property names as-is (no camel-case conversion). Will not make statements for null/undefined values.
  808. function cssToStr(cssProps) {
  809. var statements = [];
  810. $.each(cssProps, function (name, val) {
  811. if (val != null) {
  812. statements.push(name + ':' + val);
  813. }
  814. });
  815. return statements.join(';');
  816. }
  817. exports.cssToStr = cssToStr;
  818. // Given an object hash of HTML attribute names to values,
  819. // generates a string that can be injected between < > in HTML
  820. function attrsToStr(attrs) {
  821. var parts = [];
  822. $.each(attrs, function (name, val) {
  823. if (val != null) {
  824. parts.push(name + '="' + htmlEscape(val) + '"');
  825. }
  826. });
  827. return parts.join(' ');
  828. }
  829. exports.attrsToStr = attrsToStr;
  830. function capitaliseFirstLetter(str) {
  831. return str.charAt(0).toUpperCase() + str.slice(1);
  832. }
  833. exports.capitaliseFirstLetter = capitaliseFirstLetter;
  834. function compareNumbers(a, b) {
  835. return a - b;
  836. }
  837. exports.compareNumbers = compareNumbers;
  838. function isInt(n) {
  839. return n % 1 === 0;
  840. }
  841. exports.isInt = isInt;
  842. // Returns a method bound to the given object context.
  843. // Just like one of the jQuery.proxy signatures, but without the undesired behavior of treating the same method with
  844. // different contexts as identical when binding/unbinding events.
  845. function proxy(obj, methodName) {
  846. var method = obj[methodName];
  847. return function () {
  848. return method.apply(obj, arguments);
  849. };
  850. }
  851. exports.proxy = proxy;
  852. // Returns a function, that, as long as it continues to be invoked, will not
  853. // be triggered. The function will be called after it stops being called for
  854. // N milliseconds. If `immediate` is passed, trigger the function on the
  855. // leading edge, instead of the trailing.
  856. // https://github.com/jashkenas/underscore/blob/1.6.0/underscore.js#L714
  857. function debounce(func, wait, immediate) {
  858. if (immediate === void 0) { immediate = false; }
  859. var timeout;
  860. var args;
  861. var context;
  862. var timestamp;
  863. var result;
  864. var later = function () {
  865. var last = +new Date() - timestamp;
  866. if (last < wait) {
  867. timeout = setTimeout(later, wait - last);
  868. }
  869. else {
  870. timeout = null;
  871. if (!immediate) {
  872. result = func.apply(context, args);
  873. context = args = null;
  874. }
  875. }
  876. };
  877. return function () {
  878. context = this;
  879. args = arguments;
  880. timestamp = +new Date();
  881. var callNow = immediate && !timeout;
  882. if (!timeout) {
  883. timeout = setTimeout(later, wait);
  884. }
  885. if (callNow) {
  886. result = func.apply(context, args);
  887. context = args = null;
  888. }
  889. return result;
  890. };
  891. }
  892. exports.debounce = debounce;
  893. /***/ }),
  894. /* 5 */
  895. /***/ (function(module, exports, __webpack_require__) {
  896. Object.defineProperty(exports, "__esModule", { value: true });
  897. var moment = __webpack_require__(0);
  898. var moment_ext_1 = __webpack_require__(11);
  899. var UnzonedRange = /** @class */ (function () {
  900. function UnzonedRange(startInput, endInput) {
  901. // TODO: move these into footprint.
  902. // Especially, doesn't make sense for null startMs/endMs.
  903. this.isStart = true;
  904. this.isEnd = true;
  905. if (moment.isMoment(startInput)) {
  906. startInput = startInput.clone().stripZone();
  907. }
  908. if (moment.isMoment(endInput)) {
  909. endInput = endInput.clone().stripZone();
  910. }
  911. if (startInput) {
  912. this.startMs = startInput.valueOf();
  913. }
  914. if (endInput) {
  915. this.endMs = endInput.valueOf();
  916. }
  917. }
  918. /*
  919. SIDEEFFECT: will mutate eventRanges.
  920. Will return a new array result.
  921. Only works for non-open-ended ranges.
  922. */
  923. UnzonedRange.invertRanges = function (ranges, constraintRange) {
  924. var invertedRanges = [];
  925. var startMs = constraintRange.startMs; // the end of the previous range. the start of the new range
  926. var i;
  927. var dateRange;
  928. // ranges need to be in order. required for our date-walking algorithm
  929. ranges.sort(compareUnzonedRanges);
  930. for (i = 0; i < ranges.length; i++) {
  931. dateRange = ranges[i];
  932. // add the span of time before the event (if there is any)
  933. if (dateRange.startMs > startMs) { // compare millisecond time (skip any ambig logic)
  934. invertedRanges.push(new UnzonedRange(startMs, dateRange.startMs));
  935. }
  936. if (dateRange.endMs > startMs) {
  937. startMs = dateRange.endMs;
  938. }
  939. }
  940. // add the span of time after the last event (if there is any)
  941. if (startMs < constraintRange.endMs) { // compare millisecond time (skip any ambig logic)
  942. invertedRanges.push(new UnzonedRange(startMs, constraintRange.endMs));
  943. }
  944. return invertedRanges;
  945. };
  946. UnzonedRange.prototype.intersect = function (otherRange) {
  947. var startMs = this.startMs;
  948. var endMs = this.endMs;
  949. var newRange = null;
  950. if (otherRange.startMs != null) {
  951. if (startMs == null) {
  952. startMs = otherRange.startMs;
  953. }
  954. else {
  955. startMs = Math.max(startMs, otherRange.startMs);
  956. }
  957. }
  958. if (otherRange.endMs != null) {
  959. if (endMs == null) {
  960. endMs = otherRange.endMs;
  961. }
  962. else {
  963. endMs = Math.min(endMs, otherRange.endMs);
  964. }
  965. }
  966. if (startMs == null || endMs == null || startMs < endMs) {
  967. newRange = new UnzonedRange(startMs, endMs);
  968. newRange.isStart = this.isStart && startMs === this.startMs;
  969. newRange.isEnd = this.isEnd && endMs === this.endMs;
  970. }
  971. return newRange;
  972. };
  973. UnzonedRange.prototype.intersectsWith = function (otherRange) {
  974. return (this.endMs == null || otherRange.startMs == null || this.endMs > otherRange.startMs) &&
  975. (this.startMs == null || otherRange.endMs == null || this.startMs < otherRange.endMs);
  976. };
  977. UnzonedRange.prototype.containsRange = function (innerRange) {
  978. return (this.startMs == null || (innerRange.startMs != null && innerRange.startMs >= this.startMs)) &&
  979. (this.endMs == null || (innerRange.endMs != null && innerRange.endMs <= this.endMs));
  980. };
  981. // `date` can be a moment, a Date, or a millisecond time.
  982. UnzonedRange.prototype.containsDate = function (date) {
  983. var ms = date.valueOf();
  984. return (this.startMs == null || ms >= this.startMs) &&
  985. (this.endMs == null || ms < this.endMs);
  986. };
  987. // If the given date is not within the given range, move it inside.
  988. // (If it's past the end, make it one millisecond before the end).
  989. // `date` can be a moment, a Date, or a millisecond time.
  990. // Returns a MS-time.
  991. UnzonedRange.prototype.constrainDate = function (date) {
  992. var ms = date.valueOf();
  993. if (this.startMs != null && ms < this.startMs) {
  994. ms = this.startMs;
  995. }
  996. if (this.endMs != null && ms >= this.endMs) {
  997. ms = this.endMs - 1;
  998. }
  999. return ms;
  1000. };
  1001. UnzonedRange.prototype.equals = function (otherRange) {
  1002. return this.startMs === otherRange.startMs && this.endMs === otherRange.endMs;
  1003. };
  1004. UnzonedRange.prototype.clone = function () {
  1005. var range = new UnzonedRange(this.startMs, this.endMs);
  1006. range.isStart = this.isStart;
  1007. range.isEnd = this.isEnd;
  1008. return range;
  1009. };
  1010. // Returns an ambig-zoned moment from startMs.
  1011. // BEWARE: returned moment is not localized.
  1012. // Formatting and start-of-week will be default.
  1013. UnzonedRange.prototype.getStart = function () {
  1014. if (this.startMs != null) {
  1015. return moment_ext_1.default.utc(this.startMs).stripZone();
  1016. }
  1017. return null;
  1018. };
  1019. // Returns an ambig-zoned moment from startMs.
  1020. // BEWARE: returned moment is not localized.
  1021. // Formatting and start-of-week will be default.
  1022. UnzonedRange.prototype.getEnd = function () {
  1023. if (this.endMs != null) {
  1024. return moment_ext_1.default.utc(this.endMs).stripZone();
  1025. }
  1026. return null;
  1027. };
  1028. UnzonedRange.prototype.as = function (unit) {
  1029. return moment.utc(this.endMs).diff(moment.utc(this.startMs), unit, true);
  1030. };
  1031. return UnzonedRange;
  1032. }());
  1033. exports.default = UnzonedRange;
  1034. /*
  1035. Only works for non-open-ended ranges.
  1036. */
  1037. function compareUnzonedRanges(range1, range2) {
  1038. return range1.startMs - range2.startMs; // earlier ranges go first
  1039. }
  1040. /***/ }),
  1041. /* 6 */
  1042. /***/ (function(module, exports, __webpack_require__) {
  1043. Object.defineProperty(exports, "__esModule", { value: true });
  1044. var tslib_1 = __webpack_require__(2);
  1045. var $ = __webpack_require__(3);
  1046. var ParsableModelMixin_1 = __webpack_require__(52);
  1047. var Class_1 = __webpack_require__(35);
  1048. var EventDefParser_1 = __webpack_require__(36);
  1049. var EventSource = /** @class */ (function (_super) {
  1050. tslib_1.__extends(EventSource, _super);
  1051. // can we do away with calendar? at least for the abstract?
  1052. // useful for buildEventDef
  1053. function EventSource(calendar) {
  1054. var _this = _super.call(this) || this;
  1055. _this.calendar = calendar;
  1056. _this.className = [];
  1057. _this.uid = String(EventSource.uuid++);
  1058. return _this;
  1059. }
  1060. /*
  1061. rawInput can be any data type!
  1062. */
  1063. EventSource.parse = function (rawInput, calendar) {
  1064. var source = new this(calendar);
  1065. if (typeof rawInput === 'object') {
  1066. if (source.applyProps(rawInput)) {
  1067. return source;
  1068. }
  1069. }
  1070. return false;
  1071. };
  1072. EventSource.normalizeId = function (id) {
  1073. if (id) {
  1074. return String(id);
  1075. }
  1076. return null;
  1077. };
  1078. EventSource.prototype.fetch = function (start, end, timezone) {
  1079. // subclasses must implement. must return a promise.
  1080. };
  1081. EventSource.prototype.removeEventDefsById = function (eventDefId) {
  1082. // optional for subclasses to implement
  1083. };
  1084. EventSource.prototype.removeAllEventDefs = function () {
  1085. // optional for subclasses to implement
  1086. };
  1087. /*
  1088. For compairing/matching
  1089. */
  1090. EventSource.prototype.getPrimitive = function (otherSource) {
  1091. // subclasses must implement
  1092. };
  1093. EventSource.prototype.parseEventDefs = function (rawEventDefs) {
  1094. var i;
  1095. var eventDef;
  1096. var eventDefs = [];
  1097. for (i = 0; i < rawEventDefs.length; i++) {
  1098. eventDef = this.parseEventDef(rawEventDefs[i]);
  1099. if (eventDef) {
  1100. eventDefs.push(eventDef);
  1101. }
  1102. }
  1103. return eventDefs;
  1104. };
  1105. EventSource.prototype.parseEventDef = function (rawInput) {
  1106. var calendarTransform = this.calendar.opt('eventDataTransform');
  1107. var sourceTransform = this.eventDataTransform;
  1108. if (calendarTransform) {
  1109. rawInput = calendarTransform(rawInput, this.calendar);
  1110. }
  1111. if (sourceTransform) {
  1112. rawInput = sourceTransform(rawInput, this.calendar);
  1113. }
  1114. return EventDefParser_1.default.parse(rawInput, this);
  1115. };
  1116. EventSource.prototype.applyManualStandardProps = function (rawProps) {
  1117. if (rawProps.id != null) {
  1118. this.id = EventSource.normalizeId(rawProps.id);
  1119. }
  1120. // TODO: converge with EventDef
  1121. if ($.isArray(rawProps.className)) {
  1122. this.className = rawProps.className;
  1123. }
  1124. else if (typeof rawProps.className === 'string') {
  1125. this.className = rawProps.className.split(/\s+/);
  1126. }
  1127. return true;
  1128. };
  1129. EventSource.uuid = 0;
  1130. EventSource.defineStandardProps = ParsableModelMixin_1.default.defineStandardProps;
  1131. EventSource.copyVerbatimStandardProps = ParsableModelMixin_1.default.copyVerbatimStandardProps;
  1132. return EventSource;
  1133. }(Class_1.default));
  1134. exports.default = EventSource;
  1135. ParsableModelMixin_1.default.mixInto(EventSource);
  1136. // Parsing
  1137. // ---------------------------------------------------------------------------------------------------------------------
  1138. EventSource.defineStandardProps({
  1139. // manually process...
  1140. id: false,
  1141. className: false,
  1142. // automatically transfer...
  1143. color: true,
  1144. backgroundColor: true,
  1145. borderColor: true,
  1146. textColor: true,
  1147. editable: true,
  1148. startEditable: true,
  1149. durationEditable: true,
  1150. rendering: true,
  1151. overlap: true,
  1152. constraint: true,
  1153. allDayDefault: true,
  1154. eventDataTransform: true
  1155. });
  1156. /***/ }),
  1157. /* 7 */
  1158. /***/ (function(module, exports, __webpack_require__) {
  1159. /*
  1160. Utility methods for easily listening to events on another object,
  1161. and more importantly, easily unlistening from them.
  1162. USAGE:
  1163. import { default as ListenerMixin, ListenerInterface } from './ListenerMixin'
  1164. in class:
  1165. listenTo: ListenerInterface['listenTo']
  1166. stopListeningTo: ListenerInterface['stopListeningTo']
  1167. after class:
  1168. ListenerMixin.mixInto(TheClass)
  1169. */
  1170. Object.defineProperty(exports, "__esModule", { value: true });
  1171. var tslib_1 = __webpack_require__(2);
  1172. var $ = __webpack_require__(3);
  1173. var Mixin_1 = __webpack_require__(15);
  1174. var guid = 0;
  1175. var ListenerMixin = /** @class */ (function (_super) {
  1176. tslib_1.__extends(ListenerMixin, _super);
  1177. function ListenerMixin() {
  1178. return _super !== null && _super.apply(this, arguments) || this;
  1179. }
  1180. /*
  1181. Given an `other` object that has on/off methods, bind the given `callback` to an event by the given name.
  1182. The `callback` will be called with the `this` context of the object that .listenTo is being called on.
  1183. Can be called:
  1184. .listenTo(other, eventName, callback)
  1185. OR
  1186. .listenTo(other, {
  1187. eventName1: callback1,
  1188. eventName2: callback2
  1189. })
  1190. */
  1191. ListenerMixin.prototype.listenTo = function (other, arg, callback) {
  1192. if (typeof arg === 'object') { // given dictionary of callbacks
  1193. for (var eventName in arg) {
  1194. if (arg.hasOwnProperty(eventName)) {
  1195. this.listenTo(other, eventName, arg[eventName]);
  1196. }
  1197. }
  1198. }
  1199. else if (typeof arg === 'string') {
  1200. other.on(arg + '.' + this.getListenerNamespace(), // use event namespacing to identify this object
  1201. $.proxy(callback, this) // always use `this` context
  1202. // the usually-undesired jQuery guid behavior doesn't matter,
  1203. // because we always unbind via namespace
  1204. );
  1205. }
  1206. };
  1207. /*
  1208. Causes the current object to stop listening to events on the `other` object.
  1209. `eventName` is optional. If omitted, will stop listening to ALL events on `other`.
  1210. */
  1211. ListenerMixin.prototype.stopListeningTo = function (other, eventName) {
  1212. other.off((eventName || '') + '.' + this.getListenerNamespace());
  1213. };
  1214. /*
  1215. Returns a string, unique to this object, to be used for event namespacing
  1216. */
  1217. ListenerMixin.prototype.getListenerNamespace = function () {
  1218. if (this.listenerId == null) {
  1219. this.listenerId = guid++;
  1220. }
  1221. return '_listener' + this.listenerId;
  1222. };
  1223. return ListenerMixin;
  1224. }(Mixin_1.default));
  1225. exports.default = ListenerMixin;
  1226. /***/ }),
  1227. /* 8 */,
  1228. /* 9 */
  1229. /***/ (function(module, exports, __webpack_require__) {
  1230. Object.defineProperty(exports, "__esModule", { value: true });
  1231. var tslib_1 = __webpack_require__(2);
  1232. var EventDef_1 = __webpack_require__(37);
  1233. var EventInstance_1 = __webpack_require__(53);
  1234. var EventDateProfile_1 = __webpack_require__(16);
  1235. var SingleEventDef = /** @class */ (function (_super) {
  1236. tslib_1.__extends(SingleEventDef, _super);
  1237. function SingleEventDef() {
  1238. return _super !== null && _super.apply(this, arguments) || this;
  1239. }
  1240. /*
  1241. Will receive start/end params, but will be ignored.
  1242. */
  1243. SingleEventDef.prototype.buildInstances = function () {
  1244. return [this.buildInstance()];
  1245. };
  1246. SingleEventDef.prototype.buildInstance = function () {
  1247. return new EventInstance_1.default(this, // definition
  1248. this.dateProfile);
  1249. };
  1250. SingleEventDef.prototype.isAllDay = function () {
  1251. return this.dateProfile.isAllDay();
  1252. };
  1253. SingleEventDef.prototype.clone = function () {
  1254. var def = _super.prototype.clone.call(this);
  1255. def.dateProfile = this.dateProfile;
  1256. return def;
  1257. };
  1258. SingleEventDef.prototype.rezone = function () {
  1259. var calendar = this.source.calendar;
  1260. var dateProfile = this.dateProfile;
  1261. this.dateProfile = new EventDateProfile_1.default(calendar.moment(dateProfile.start), dateProfile.end ? calendar.moment(dateProfile.end) : null, calendar);
  1262. };
  1263. /*
  1264. NOTE: if super-method fails, should still attempt to apply
  1265. */
  1266. SingleEventDef.prototype.applyManualStandardProps = function (rawProps) {
  1267. var superSuccess = _super.prototype.applyManualStandardProps.call(this, rawProps);
  1268. var dateProfile = EventDateProfile_1.default.parse(rawProps, this.source); // returns null on failure
  1269. if (dateProfile) {
  1270. this.dateProfile = dateProfile;
  1271. // make sure `date` shows up in the legacy event objects as-is
  1272. if (rawProps.date != null) {
  1273. this.miscProps.date = rawProps.date;
  1274. }
  1275. return superSuccess;
  1276. }
  1277. else {
  1278. return false;
  1279. }
  1280. };
  1281. return SingleEventDef;
  1282. }(EventDef_1.default));
  1283. exports.default = SingleEventDef;
  1284. // Parsing
  1285. // ---------------------------------------------------------------------------------------------------------------------
  1286. SingleEventDef.defineStandardProps({
  1287. start: false,
  1288. date: false,
  1289. end: false,
  1290. allDay: false
  1291. });
  1292. /***/ }),
  1293. /* 10 */,
  1294. /* 11 */
  1295. /***/ (function(module, exports, __webpack_require__) {
  1296. Object.defineProperty(exports, "__esModule", { value: true });
  1297. var moment = __webpack_require__(0);
  1298. var $ = __webpack_require__(3);
  1299. var util_1 = __webpack_require__(4);
  1300. var ambigDateOfMonthRegex = /^\s*\d{4}-\d\d$/;
  1301. 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+)?)?)?)?)?$/;
  1302. var newMomentProto = moment.fn; // where we will attach our new methods
  1303. exports.newMomentProto = newMomentProto;
  1304. var oldMomentProto = $.extend({}, newMomentProto); // copy of original moment methods
  1305. exports.oldMomentProto = oldMomentProto;
  1306. // tell momentjs to transfer these properties upon clone
  1307. var momentProperties = moment.momentProperties;
  1308. momentProperties.push('_fullCalendar');
  1309. momentProperties.push('_ambigTime');
  1310. momentProperties.push('_ambigZone');
  1311. /*
  1312. Call this if you want Moment's original format method to be used
  1313. */
  1314. function oldMomentFormat(mom, formatStr) {
  1315. return oldMomentProto.format.call(mom, formatStr); // oldMomentProto defined in moment-ext.js
  1316. }
  1317. exports.oldMomentFormat = oldMomentFormat;
  1318. // Creating
  1319. // -------------------------------------------------------------------------------------------------
  1320. // Creates a new moment, similar to the vanilla moment(...) constructor, but with
  1321. // extra features (ambiguous time, enhanced formatting). When given an existing moment,
  1322. // it will function as a clone (and retain the zone of the moment). Anything else will
  1323. // result in a moment in the local zone.
  1324. var momentExt = function () {
  1325. return makeMoment(arguments);
  1326. };
  1327. exports.default = momentExt;
  1328. // Sames as momentExt, but forces the resulting moment to be in the UTC timezone.
  1329. momentExt.utc = function () {
  1330. var mom = makeMoment(arguments, true);
  1331. // Force it into UTC because makeMoment doesn't guarantee it
  1332. // (if given a pre-existing moment for example)
  1333. if (mom.hasTime()) { // don't give ambiguously-timed moments a UTC zone
  1334. mom.utc();
  1335. }
  1336. return mom;
  1337. };
  1338. // Same as momentExt, but when given an ISO8601 string, the timezone offset is preserved.
  1339. // ISO8601 strings with no timezone offset will become ambiguously zoned.
  1340. momentExt.parseZone = function () {
  1341. return makeMoment(arguments, true, true);
  1342. };
  1343. // Builds an enhanced moment from args. When given an existing moment, it clones. When given a
  1344. // native Date, or called with no arguments (the current time), the resulting moment will be local.
  1345. // Anything else needs to be "parsed" (a string or an array), and will be affected by:
  1346. // parseAsUTC - if there is no zone information, should we parse the input in UTC?
  1347. // parseZone - if there is zone information, should we force the zone of the moment?
  1348. function makeMoment(args, parseAsUTC, parseZone) {
  1349. if (parseAsUTC === void 0) { parseAsUTC = false; }
  1350. if (parseZone === void 0) { parseZone = false; }
  1351. var input = args[0];
  1352. var isSingleString = args.length === 1 && typeof input === 'string';
  1353. var isAmbigTime;
  1354. var isAmbigZone;
  1355. var ambigMatch;
  1356. var mom;
  1357. if (moment.isMoment(input) || util_1.isNativeDate(input) || input === undefined) {
  1358. mom = moment.apply(null, args);
  1359. }
  1360. else { // "parsing" is required
  1361. isAmbigTime = false;
  1362. isAmbigZone = false;
  1363. if (isSingleString) {
  1364. if (ambigDateOfMonthRegex.test(input)) {
  1365. // accept strings like '2014-05', but convert to the first of the month
  1366. input += '-01';
  1367. args = [input]; // for when we pass it on to moment's constructor
  1368. isAmbigTime = true;
  1369. isAmbigZone = true;
  1370. }
  1371. else if ((ambigMatch = ambigTimeOrZoneRegex.exec(input))) {
  1372. isAmbigTime = !ambigMatch[5]; // no time part?
  1373. isAmbigZone = true;
  1374. }
  1375. }
  1376. else if ($.isArray(input)) {
  1377. // arrays have no timezone information, so assume ambiguous zone
  1378. isAmbigZone = true;
  1379. }
  1380. // otherwise, probably a string with a format
  1381. if (parseAsUTC || isAmbigTime) {
  1382. mom = moment.utc.apply(moment, args);
  1383. }
  1384. else {
  1385. mom = moment.apply(null, args);
  1386. }
  1387. if (isAmbigTime) {
  1388. mom._ambigTime = true;
  1389. mom._ambigZone = true; // ambiguous time always means ambiguous zone
  1390. }
  1391. else if (parseZone) { // let's record the inputted zone somehow
  1392. if (isAmbigZone) {
  1393. mom._ambigZone = true;
  1394. }
  1395. else if (isSingleString) {
  1396. mom.utcOffset(input); // if not a valid zone, will assign UTC
  1397. }
  1398. }
  1399. }
  1400. mom._fullCalendar = true; // flag for extended functionality
  1401. return mom;
  1402. }
  1403. // Week Number
  1404. // -------------------------------------------------------------------------------------------------
  1405. // Returns the week number, considering the locale's custom week number calcuation
  1406. // `weeks` is an alias for `week`
  1407. newMomentProto.week = newMomentProto.weeks = function (input) {
  1408. var weekCalc = this._locale._fullCalendar_weekCalc;
  1409. if (input == null && typeof weekCalc === 'function') { // custom function only works for getter
  1410. return weekCalc(this);
  1411. }
  1412. else if (weekCalc === 'ISO') {
  1413. return oldMomentProto.isoWeek.apply(this, arguments); // ISO getter/setter
  1414. }
  1415. return oldMomentProto.week.apply(this, arguments); // local getter/setter
  1416. };
  1417. // Time-of-day
  1418. // -------------------------------------------------------------------------------------------------
  1419. // GETTER
  1420. // Returns a Duration with the hours/minutes/seconds/ms values of the moment.
  1421. // If the moment has an ambiguous time, a duration of 00:00 will be returned.
  1422. //
  1423. // SETTER
  1424. // You can supply a Duration, a Moment, or a Duration-like argument.
  1425. // When setting the time, and the moment has an ambiguous time, it then becomes unambiguous.
  1426. newMomentProto.time = function (time) {
  1427. // Fallback to the original method (if there is one) if this moment wasn't created via FullCalendar.
  1428. // `time` is a generic enough method name where this precaution is necessary to avoid collisions w/ other plugins.
  1429. if (!this._fullCalendar) {
  1430. return oldMomentProto.time.apply(this, arguments);
  1431. }
  1432. if (time == null) { // getter
  1433. return moment.duration({
  1434. hours: this.hours(),
  1435. minutes: this.minutes(),
  1436. seconds: this.seconds(),
  1437. milliseconds: this.milliseconds()
  1438. });
  1439. }
  1440. else { // setter
  1441. this._ambigTime = false; // mark that the moment now has a time
  1442. if (!moment.isDuration(time) && !moment.isMoment(time)) {
  1443. time = moment.duration(time);
  1444. }
  1445. // The day value should cause overflow (so 24 hours becomes 00:00:00 of next day).
  1446. // Only for Duration times, not Moment times.
  1447. var dayHours = 0;
  1448. if (moment.isDuration(time)) {
  1449. dayHours = Math.floor(time.asDays()) * 24;
  1450. }
  1451. // We need to set the individual fields.
  1452. // Can't use startOf('day') then add duration. In case of DST at start of day.
  1453. return this.hours(dayHours + time.hours())
  1454. .minutes(time.minutes())
  1455. .seconds(time.seconds())
  1456. .milliseconds(time.milliseconds());
  1457. }
  1458. };
  1459. // Converts the moment to UTC, stripping out its time-of-day and timezone offset,
  1460. // but preserving its YMD. A moment with a stripped time will display no time
  1461. // nor timezone offset when .format() is called.
  1462. newMomentProto.stripTime = function () {
  1463. if (!this._ambigTime) {
  1464. this.utc(true); // keepLocalTime=true (for keeping *date* value)
  1465. // set time to zero
  1466. this.set({
  1467. hours: 0,
  1468. minutes: 0,
  1469. seconds: 0,
  1470. ms: 0
  1471. });
  1472. // Mark the time as ambiguous. This needs to happen after the .utc() call, which might call .utcOffset(),
  1473. // which clears all ambig flags.
  1474. this._ambigTime = true;
  1475. this._ambigZone = true; // if ambiguous time, also ambiguous timezone offset
  1476. }
  1477. return this; // for chaining
  1478. };
  1479. // Returns if the moment has a non-ambiguous time (boolean)
  1480. newMomentProto.hasTime = function () {
  1481. return !this._ambigTime;
  1482. };
  1483. // Timezone
  1484. // -------------------------------------------------------------------------------------------------
  1485. // Converts the moment to UTC, stripping out its timezone offset, but preserving its
  1486. // YMD and time-of-day. A moment with a stripped timezone offset will display no
  1487. // timezone offset when .format() is called.
  1488. newMomentProto.stripZone = function () {
  1489. var wasAmbigTime;
  1490. if (!this._ambigZone) {
  1491. wasAmbigTime = this._ambigTime;
  1492. this.utc(true); // keepLocalTime=true (for keeping date and time values)
  1493. // the above call to .utc()/.utcOffset() unfortunately might clear the ambig flags, so restore
  1494. this._ambigTime = wasAmbigTime || false;
  1495. // Mark the zone as ambiguous. This needs to happen after the .utc() call, which might call .utcOffset(),
  1496. // which clears the ambig flags.
  1497. this._ambigZone = true;
  1498. }
  1499. return this; // for chaining
  1500. };
  1501. // Returns of the moment has a non-ambiguous timezone offset (boolean)
  1502. newMomentProto.hasZone = function () {
  1503. return !this._ambigZone;
  1504. };
  1505. // implicitly marks a zone
  1506. newMomentProto.local = function (keepLocalTime) {
  1507. // for when converting from ambiguously-zoned to local,
  1508. // keep the time values when converting from UTC -> local
  1509. oldMomentProto.local.call(this, this._ambigZone || keepLocalTime);
  1510. // ensure non-ambiguous
  1511. // this probably already happened via local() -> utcOffset(), but don't rely on Moment's internals
  1512. this._ambigTime = false;
  1513. this._ambigZone = false;
  1514. return this; // for chaining
  1515. };
  1516. // implicitly marks a zone
  1517. newMomentProto.utc = function (keepLocalTime) {
  1518. oldMomentProto.utc.call(this, keepLocalTime);
  1519. // ensure non-ambiguous
  1520. // this probably already happened via utc() -> utcOffset(), but don't rely on Moment's internals
  1521. this._ambigTime = false;
  1522. this._ambigZone = false;
  1523. return this;
  1524. };
  1525. // implicitly marks a zone (will probably get called upon .utc() and .local())
  1526. newMomentProto.utcOffset = function (tzo) {
  1527. if (tzo != null) { // setter
  1528. // these assignments needs to happen before the original zone method is called.
  1529. // I forget why, something to do with a browser crash.
  1530. this._ambigTime = false;
  1531. this._ambigZone = false;
  1532. }
  1533. return oldMomentProto.utcOffset.apply(this, arguments);
  1534. };
  1535. /***/ }),
  1536. /* 12 */
  1537. /***/ (function(module, exports) {
  1538. Object.defineProperty(exports, "__esModule", { value: true });
  1539. /*
  1540. Meant to be immutable
  1541. */
  1542. var ComponentFootprint = /** @class */ (function () {
  1543. function ComponentFootprint(unzonedRange, isAllDay) {
  1544. this.isAllDay = false; // component can choose to ignore this
  1545. this.unzonedRange = unzonedRange;
  1546. this.isAllDay = isAllDay;
  1547. }
  1548. /*
  1549. Only works for non-open-ended ranges.
  1550. */
  1551. ComponentFootprint.prototype.toLegacy = function (calendar) {
  1552. return {
  1553. start: calendar.msToMoment(this.unzonedRange.startMs, this.isAllDay),
  1554. end: calendar.msToMoment(this.unzonedRange.endMs, this.isAllDay)
  1555. };
  1556. };
  1557. return ComponentFootprint;
  1558. }());
  1559. exports.default = ComponentFootprint;
  1560. /***/ }),
  1561. /* 13 */
  1562. /***/ (function(module, exports, __webpack_require__) {
  1563. /*
  1564. USAGE:
  1565. import { default as EmitterMixin, EmitterInterface } from './EmitterMixin'
  1566. in class:
  1567. on: EmitterInterface['on']
  1568. one: EmitterInterface['one']
  1569. off: EmitterInterface['off']
  1570. trigger: EmitterInterface['trigger']
  1571. triggerWith: EmitterInterface['triggerWith']
  1572. hasHandlers: EmitterInterface['hasHandlers']
  1573. after class:
  1574. EmitterMixin.mixInto(TheClass)
  1575. */
  1576. Object.defineProperty(exports, "__esModule", { value: true });
  1577. var tslib_1 = __webpack_require__(2);
  1578. var $ = __webpack_require__(3);
  1579. var Mixin_1 = __webpack_require__(15);
  1580. var EmitterMixin = /** @class */ (function (_super) {
  1581. tslib_1.__extends(EmitterMixin, _super);
  1582. function EmitterMixin() {
  1583. return _super !== null && _super.apply(this, arguments) || this;
  1584. }
  1585. // jQuery-ification via $(this) allows a non-DOM object to have
  1586. // the same event handling capabilities (including namespaces).
  1587. EmitterMixin.prototype.on = function (types, handler) {
  1588. $(this).on(types, this._prepareIntercept(handler));
  1589. return this; // for chaining
  1590. };
  1591. EmitterMixin.prototype.one = function (types, handler) {
  1592. $(this).one(types, this._prepareIntercept(handler));
  1593. return this; // for chaining
  1594. };
  1595. EmitterMixin.prototype._prepareIntercept = function (handler) {
  1596. // handlers are always called with an "event" object as their first param.
  1597. // sneak the `this` context and arguments into the extra parameter object
  1598. // and forward them on to the original handler.
  1599. var intercept = function (ev, extra) {
  1600. return handler.apply(extra.context || this, extra.args || []);
  1601. };
  1602. // mimick jQuery's internal "proxy" system (risky, I know)
  1603. // causing all functions with the same .guid to appear to be the same.
  1604. // https://github.com/jquery/jquery/blob/2.2.4/src/core.js#L448
  1605. // this is needed for calling .off with the original non-intercept handler.
  1606. if (!handler.guid) {
  1607. handler.guid = $.guid++;
  1608. }
  1609. intercept.guid = handler.guid;
  1610. return intercept;
  1611. };
  1612. EmitterMixin.prototype.off = function (types, handler) {
  1613. $(this).off(types, handler);
  1614. return this; // for chaining
  1615. };
  1616. EmitterMixin.prototype.trigger = function (types) {
  1617. var args = [];
  1618. for (var _i = 1; _i < arguments.length; _i++) {
  1619. args[_i - 1] = arguments[_i];
  1620. }
  1621. // pass in "extra" info to the intercept
  1622. $(this).triggerHandler(types, { args: args });
  1623. return this; // for chaining
  1624. };
  1625. EmitterMixin.prototype.triggerWith = function (types, context, args) {
  1626. // `triggerHandler` is less reliant on the DOM compared to `trigger`.
  1627. // pass in "extra" info to the intercept.
  1628. $(this).triggerHandler(types, { context: context, args: args });
  1629. return this; // for chaining
  1630. };
  1631. EmitterMixin.prototype.hasHandlers = function (type) {
  1632. var hash = $._data(this, 'events'); // http://blog.jquery.com/2012/08/09/jquery-1-8-released/
  1633. return hash && hash[type] && hash[type].length > 0;
  1634. };
  1635. return EmitterMixin;
  1636. }(Mixin_1.default));
  1637. exports.default = EmitterMixin;
  1638. /***/ }),
  1639. /* 14 */
  1640. /***/ (function(module, exports) {
  1641. Object.defineProperty(exports, "__esModule", { value: true });
  1642. var Interaction = /** @class */ (function () {
  1643. function Interaction(component) {
  1644. this.view = component._getView();
  1645. this.component = component;
  1646. }
  1647. Interaction.prototype.opt = function (name) {
  1648. return this.view.opt(name);
  1649. };
  1650. Interaction.prototype.end = function () {
  1651. // subclasses can implement
  1652. };
  1653. return Interaction;
  1654. }());
  1655. exports.default = Interaction;
  1656. /***/ }),
  1657. /* 15 */
  1658. /***/ (function(module, exports) {
  1659. Object.defineProperty(exports, "__esModule", { value: true });
  1660. var Mixin = /** @class */ (function () {
  1661. function Mixin() {
  1662. }
  1663. Mixin.mixInto = function (destClass) {
  1664. var _this = this;
  1665. Object.getOwnPropertyNames(this.prototype).forEach(function (name) {
  1666. if (!destClass.prototype[name]) { // if destination class doesn't already define it
  1667. destClass.prototype[name] = _this.prototype[name];
  1668. }
  1669. });
  1670. };
  1671. /*
  1672. will override existing methods
  1673. TODO: remove! not used anymore
  1674. */
  1675. Mixin.mixOver = function (destClass) {
  1676. var _this = this;
  1677. Object.getOwnPropertyNames(this.prototype).forEach(function (name) {
  1678. destClass.prototype[name] = _this.prototype[name];
  1679. });
  1680. };
  1681. return Mixin;
  1682. }());
  1683. exports.default = Mixin;
  1684. /***/ }),
  1685. /* 16 */
  1686. /***/ (function(module, exports, __webpack_require__) {
  1687. Object.defineProperty(exports, "__esModule", { value: true });
  1688. var UnzonedRange_1 = __webpack_require__(5);
  1689. /*
  1690. Meant to be immutable
  1691. */
  1692. var EventDateProfile = /** @class */ (function () {
  1693. function EventDateProfile(start, end, calendar) {
  1694. this.start = start;
  1695. this.end = end || null;
  1696. this.unzonedRange = this.buildUnzonedRange(calendar);
  1697. }
  1698. /*
  1699. Needs an EventSource object
  1700. */
  1701. EventDateProfile.parse = function (rawProps, source) {
  1702. var startInput = rawProps.start || rawProps.date;
  1703. var endInput = rawProps.end;
  1704. if (!startInput) {
  1705. return false;
  1706. }
  1707. var calendar = source.calendar;
  1708. var start = calendar.moment(startInput);
  1709. var end = endInput ? calendar.moment(endInput) : null;
  1710. var forcedAllDay = rawProps.allDay;
  1711. var forceEventDuration = calendar.opt('forceEventDuration');
  1712. if (!start.isValid()) {
  1713. return false;
  1714. }
  1715. if (forcedAllDay == null) {
  1716. forcedAllDay = source.allDayDefault;
  1717. if (forcedAllDay == null) {
  1718. forcedAllDay = calendar.opt('allDayDefault');
  1719. }
  1720. }
  1721. if (forcedAllDay === true) {
  1722. start.stripTime();
  1723. if (end) {
  1724. end.stripTime();
  1725. }
  1726. }
  1727. else if (forcedAllDay === false) {
  1728. if (!start.hasTime()) {
  1729. start.time(0);
  1730. }
  1731. if (end && !end.hasTime()) {
  1732. end.time(0);
  1733. }
  1734. }
  1735. if (end && (!end.isValid() || !end.isAfter(start))) {
  1736. end = null;
  1737. }
  1738. if (!end && forceEventDuration) {
  1739. end = calendar.getDefaultEventEnd(!start.hasTime(), start);
  1740. }
  1741. return new EventDateProfile(start, end, calendar);
  1742. };
  1743. EventDateProfile.isStandardProp = function (propName) {
  1744. return propName === 'start' || propName === 'date' || propName === 'end' || propName === 'allDay';
  1745. };
  1746. EventDateProfile.prototype.isAllDay = function () {
  1747. return !(this.start.hasTime() || (this.end && this.end.hasTime()));
  1748. };
  1749. /*
  1750. Needs a Calendar object
  1751. */
  1752. EventDateProfile.prototype.buildUnzonedRange = function (calendar) {
  1753. var startMs = this.start.clone().stripZone().valueOf();
  1754. var endMs = this.getEnd(calendar).stripZone().valueOf();
  1755. return new UnzonedRange_1.default(startMs, endMs);
  1756. };
  1757. /*
  1758. Needs a Calendar object
  1759. */
  1760. EventDateProfile.prototype.getEnd = function (calendar) {
  1761. return this.end ?
  1762. this.end.clone() :
  1763. // derive the end from the start and allDay. compute allDay if necessary
  1764. calendar.getDefaultEventEnd(this.isAllDay(), this.start);
  1765. };
  1766. return EventDateProfile;
  1767. }());
  1768. exports.default = EventDateProfile;
  1769. /***/ }),
  1770. /* 17 */
  1771. /***/ (function(module, exports, __webpack_require__) {
  1772. Object.defineProperty(exports, "__esModule", { value: true });
  1773. var tslib_1 = __webpack_require__(2);
  1774. var util_1 = __webpack_require__(4);
  1775. var DragListener_1 = __webpack_require__(59);
  1776. /* Tracks mouse movements over a component and raises events about which hit the mouse is over.
  1777. ------------------------------------------------------------------------------------------------------------------------
  1778. options:
  1779. - subjectEl
  1780. - subjectCenter
  1781. */
  1782. var HitDragListener = /** @class */ (function (_super) {
  1783. tslib_1.__extends(HitDragListener, _super);
  1784. function HitDragListener(component, options) {
  1785. var _this = _super.call(this, options) || this;
  1786. _this.component = component;
  1787. return _this;
  1788. }
  1789. // Called when drag listening starts (but a real drag has not necessarily began).
  1790. // ev might be undefined if dragging was started manually.
  1791. HitDragListener.prototype.handleInteractionStart = function (ev) {
  1792. var subjectEl = this.subjectEl;
  1793. var subjectRect;
  1794. var origPoint;
  1795. var point;
  1796. this.component.hitsNeeded();
  1797. this.computeScrollBounds(); // for autoscroll
  1798. if (ev) {
  1799. origPoint = { left: util_1.getEvX(ev), top: util_1.getEvY(ev) };
  1800. point = origPoint;
  1801. // constrain the point to bounds of the element being dragged
  1802. if (subjectEl) {
  1803. subjectRect = util_1.getOuterRect(subjectEl); // used for centering as well
  1804. point = util_1.constrainPoint(point, subjectRect);
  1805. }
  1806. this.origHit = this.queryHit(point.left, point.top);
  1807. // treat the center of the subject as the collision point?
  1808. if (subjectEl && this.options.subjectCenter) {
  1809. // only consider the area the subject overlaps the hit. best for large subjects.
  1810. // TODO: skip this if hit didn't supply left/right/top/bottom
  1811. if (this.origHit) {
  1812. subjectRect = util_1.intersectRects(this.origHit, subjectRect) ||
  1813. subjectRect; // in case there is no intersection
  1814. }
  1815. point = util_1.getRectCenter(subjectRect);
  1816. }
  1817. this.coordAdjust = util_1.diffPoints(point, origPoint); // point - origPoint
  1818. }
  1819. else {
  1820. this.origHit = null;
  1821. this.coordAdjust = null;
  1822. }
  1823. // call the super-method. do it after origHit has been computed
  1824. _super.prototype.handleInteractionStart.call(this, ev);
  1825. };
  1826. // Called when the actual drag has started
  1827. HitDragListener.prototype.handleDragStart = function (ev) {
  1828. var hit;
  1829. _super.prototype.handleDragStart.call(this, ev);
  1830. // might be different from this.origHit if the min-distance is large
  1831. hit = this.queryHit(util_1.getEvX(ev), util_1.getEvY(ev));
  1832. // report the initial hit the mouse is over
  1833. // especially important if no min-distance and drag starts immediately
  1834. if (hit) {
  1835. this.handleHitOver(hit);
  1836. }
  1837. };
  1838. // Called when the drag moves
  1839. HitDragListener.prototype.handleDrag = function (dx, dy, ev) {
  1840. var hit;
  1841. _super.prototype.handleDrag.call(this, dx, dy, ev);
  1842. hit = this.queryHit(util_1.getEvX(ev), util_1.getEvY(ev));
  1843. if (!isHitsEqual(hit, this.hit)) { // a different hit than before?
  1844. if (this.hit) {
  1845. this.handleHitOut();
  1846. }
  1847. if (hit) {
  1848. this.handleHitOver(hit);
  1849. }
  1850. }
  1851. };
  1852. // Called when dragging has been stopped
  1853. HitDragListener.prototype.handleDragEnd = function (ev) {
  1854. this.handleHitDone();
  1855. _super.prototype.handleDragEnd.call(this, ev);
  1856. };
  1857. // Called when a the mouse has just moved over a new hit
  1858. HitDragListener.prototype.handleHitOver = function (hit) {
  1859. var isOrig = isHitsEqual(hit, this.origHit);
  1860. this.hit = hit;
  1861. this.trigger('hitOver', this.hit, isOrig, this.origHit);
  1862. };
  1863. // Called when the mouse has just moved out of a hit
  1864. HitDragListener.prototype.handleHitOut = function () {
  1865. if (this.hit) {
  1866. this.trigger('hitOut', this.hit);
  1867. this.handleHitDone();
  1868. this.hit = null;
  1869. }
  1870. };
  1871. // Called after a hitOut. Also called before a dragStop
  1872. HitDragListener.prototype.handleHitDone = function () {
  1873. if (this.hit) {
  1874. this.trigger('hitDone', this.hit);
  1875. }
  1876. };
  1877. // Called when the interaction ends, whether there was a real drag or not
  1878. HitDragListener.prototype.handleInteractionEnd = function (ev, isCancelled) {
  1879. _super.prototype.handleInteractionEnd.call(this, ev, isCancelled);
  1880. this.origHit = null;
  1881. this.hit = null;
  1882. this.component.hitsNotNeeded();
  1883. };
  1884. // Called when scrolling has stopped, whether through auto scroll, or the user scrolling
  1885. HitDragListener.prototype.handleScrollEnd = function () {
  1886. _super.prototype.handleScrollEnd.call(this);
  1887. // hits' absolute positions will be in new places after a user's scroll.
  1888. // HACK for recomputing.
  1889. if (this.isDragging) {
  1890. this.component.releaseHits();
  1891. this.component.prepareHits();
  1892. }
  1893. };
  1894. // Gets the hit underneath the coordinates for the given mouse event
  1895. HitDragListener.prototype.queryHit = function (left, top) {
  1896. if (this.coordAdjust) {
  1897. left += this.coordAdjust.left;
  1898. top += this.coordAdjust.top;
  1899. }
  1900. return this.component.queryHit(left, top);
  1901. };
  1902. return HitDragListener;
  1903. }(DragListener_1.default));
  1904. exports.default = HitDragListener;
  1905. // Returns `true` if the hits are identically equal. `false` otherwise. Must be from the same component.
  1906. // Two null values will be considered equal, as two "out of the component" states are the same.
  1907. function isHitsEqual(hit0, hit1) {
  1908. if (!hit0 && !hit1) {
  1909. return true;
  1910. }
  1911. if (hit0 && hit1) {
  1912. return hit0.component === hit1.component &&
  1913. isHitPropsWithin(hit0, hit1) &&
  1914. isHitPropsWithin(hit1, hit0); // ensures all props are identical
  1915. }
  1916. return false;
  1917. }
  1918. // Returns true if all of subHit's non-standard properties are within superHit
  1919. function isHitPropsWithin(subHit, superHit) {
  1920. for (var propName in subHit) {
  1921. if (!/^(component|left|right|top|bottom)$/.test(propName)) {
  1922. if (subHit[propName] !== superHit[propName]) {
  1923. return false;
  1924. }
  1925. }
  1926. }
  1927. return true;
  1928. }
  1929. /***/ }),
  1930. /* 18 */
  1931. /***/ (function(module, exports, __webpack_require__) {
  1932. Object.defineProperty(exports, "__esModule", { value: true });
  1933. exports.version = '3.10.2';
  1934. // When introducing internal API incompatibilities (where fullcalendar plugins would break),
  1935. // the minor version of the calendar should be upped (ex: 2.7.2 -> 2.8.0)
  1936. // and the below integer should be incremented.
  1937. exports.internalApiVersion = 12;
  1938. var util_1 = __webpack_require__(4);
  1939. exports.applyAll = util_1.applyAll;
  1940. exports.debounce = util_1.debounce;
  1941. exports.isInt = util_1.isInt;
  1942. exports.htmlEscape = util_1.htmlEscape;
  1943. exports.cssToStr = util_1.cssToStr;
  1944. exports.proxy = util_1.proxy;
  1945. exports.capitaliseFirstLetter = util_1.capitaliseFirstLetter;
  1946. exports.getOuterRect = util_1.getOuterRect;
  1947. exports.getClientRect = util_1.getClientRect;
  1948. exports.getContentRect = util_1.getContentRect;
  1949. exports.getScrollbarWidths = util_1.getScrollbarWidths;
  1950. exports.preventDefault = util_1.preventDefault;
  1951. exports.parseFieldSpecs = util_1.parseFieldSpecs;
  1952. exports.compareByFieldSpecs = util_1.compareByFieldSpecs;
  1953. exports.compareByFieldSpec = util_1.compareByFieldSpec;
  1954. exports.flexibleCompare = util_1.flexibleCompare;
  1955. exports.computeGreatestUnit = util_1.computeGreatestUnit;
  1956. exports.divideRangeByDuration = util_1.divideRangeByDuration;
  1957. exports.divideDurationByDuration = util_1.divideDurationByDuration;
  1958. exports.multiplyDuration = util_1.multiplyDuration;
  1959. exports.durationHasTime = util_1.durationHasTime;
  1960. exports.log = util_1.log;
  1961. exports.warn = util_1.warn;
  1962. exports.removeExact = util_1.removeExact;
  1963. exports.intersectRects = util_1.intersectRects;
  1964. exports.allowSelection = util_1.allowSelection;
  1965. exports.attrsToStr = util_1.attrsToStr;
  1966. exports.compareNumbers = util_1.compareNumbers;
  1967. exports.compensateScroll = util_1.compensateScroll;
  1968. exports.computeDurationGreatestUnit = util_1.computeDurationGreatestUnit;
  1969. exports.constrainPoint = util_1.constrainPoint;
  1970. exports.copyOwnProps = util_1.copyOwnProps;
  1971. exports.diffByUnit = util_1.diffByUnit;
  1972. exports.diffDay = util_1.diffDay;
  1973. exports.diffDayTime = util_1.diffDayTime;
  1974. exports.diffPoints = util_1.diffPoints;
  1975. exports.disableCursor = util_1.disableCursor;
  1976. exports.distributeHeight = util_1.distributeHeight;
  1977. exports.enableCursor = util_1.enableCursor;
  1978. exports.firstDefined = util_1.firstDefined;
  1979. exports.getEvIsTouch = util_1.getEvIsTouch;
  1980. exports.getEvX = util_1.getEvX;
  1981. exports.getEvY = util_1.getEvY;
  1982. exports.getRectCenter = util_1.getRectCenter;
  1983. exports.getScrollParent = util_1.getScrollParent;
  1984. exports.hasOwnProp = util_1.hasOwnProp;
  1985. exports.isArraysEqual = util_1.isArraysEqual;
  1986. exports.isNativeDate = util_1.isNativeDate;
  1987. exports.isPrimaryMouseButton = util_1.isPrimaryMouseButton;
  1988. exports.isTimeString = util_1.isTimeString;
  1989. exports.matchCellWidths = util_1.matchCellWidths;
  1990. exports.mergeProps = util_1.mergeProps;
  1991. exports.preventSelection = util_1.preventSelection;
  1992. exports.removeMatching = util_1.removeMatching;
  1993. exports.stripHtmlEntities = util_1.stripHtmlEntities;
  1994. exports.subtractInnerElHeight = util_1.subtractInnerElHeight;
  1995. exports.uncompensateScroll = util_1.uncompensateScroll;
  1996. exports.undistributeHeight = util_1.undistributeHeight;
  1997. exports.dayIDs = util_1.dayIDs;
  1998. exports.unitsDesc = util_1.unitsDesc;
  1999. var date_formatting_1 = __webpack_require__(49);
  2000. exports.formatDate = date_formatting_1.formatDate;
  2001. exports.formatRange = date_formatting_1.formatRange;
  2002. exports.queryMostGranularFormatUnit = date_formatting_1.queryMostGranularFormatUnit;
  2003. var locale_1 = __webpack_require__(32);
  2004. exports.datepickerLocale = locale_1.datepickerLocale;
  2005. exports.locale = locale_1.locale;
  2006. exports.getMomentLocaleData = locale_1.getMomentLocaleData;
  2007. exports.populateInstanceComputableOptions = locale_1.populateInstanceComputableOptions;
  2008. var util_2 = __webpack_require__(19);
  2009. exports.eventDefsToEventInstances = util_2.eventDefsToEventInstances;
  2010. exports.eventFootprintToComponentFootprint = util_2.eventFootprintToComponentFootprint;
  2011. exports.eventInstanceToEventRange = util_2.eventInstanceToEventRange;
  2012. exports.eventInstanceToUnzonedRange = util_2.eventInstanceToUnzonedRange;
  2013. exports.eventRangeToEventFootprint = util_2.eventRangeToEventFootprint;
  2014. var moment_ext_1 = __webpack_require__(11);
  2015. exports.moment = moment_ext_1.default;
  2016. var EmitterMixin_1 = __webpack_require__(13);
  2017. exports.EmitterMixin = EmitterMixin_1.default;
  2018. var ListenerMixin_1 = __webpack_require__(7);
  2019. exports.ListenerMixin = ListenerMixin_1.default;
  2020. var Model_1 = __webpack_require__(51);
  2021. exports.Model = Model_1.default;
  2022. var Constraints_1 = __webpack_require__(217);
  2023. exports.Constraints = Constraints_1.default;
  2024. var DateProfileGenerator_1 = __webpack_require__(55);
  2025. exports.DateProfileGenerator = DateProfileGenerator_1.default;
  2026. var UnzonedRange_1 = __webpack_require__(5);
  2027. exports.UnzonedRange = UnzonedRange_1.default;
  2028. var ComponentFootprint_1 = __webpack_require__(12);
  2029. exports.ComponentFootprint = ComponentFootprint_1.default;
  2030. var BusinessHourGenerator_1 = __webpack_require__(218);
  2031. exports.BusinessHourGenerator = BusinessHourGenerator_1.default;
  2032. var EventPeriod_1 = __webpack_require__(219);
  2033. exports.EventPeriod = EventPeriod_1.default;
  2034. var EventManager_1 = __webpack_require__(220);
  2035. exports.EventManager = EventManager_1.default;
  2036. var EventDef_1 = __webpack_require__(37);
  2037. exports.EventDef = EventDef_1.default;
  2038. var EventDefMutation_1 = __webpack_require__(39);
  2039. exports.EventDefMutation = EventDefMutation_1.default;
  2040. var EventDefParser_1 = __webpack_require__(36);
  2041. exports.EventDefParser = EventDefParser_1.default;
  2042. var EventInstance_1 = __webpack_require__(53);
  2043. exports.EventInstance = EventInstance_1.default;
  2044. var EventRange_1 = __webpack_require__(50);
  2045. exports.EventRange = EventRange_1.default;
  2046. var RecurringEventDef_1 = __webpack_require__(54);
  2047. exports.RecurringEventDef = RecurringEventDef_1.default;
  2048. var SingleEventDef_1 = __webpack_require__(9);
  2049. exports.SingleEventDef = SingleEventDef_1.default;
  2050. var EventDefDateMutation_1 = __webpack_require__(40);
  2051. exports.EventDefDateMutation = EventDefDateMutation_1.default;
  2052. var EventDateProfile_1 = __webpack_require__(16);
  2053. exports.EventDateProfile = EventDateProfile_1.default;
  2054. var EventSourceParser_1 = __webpack_require__(38);
  2055. exports.EventSourceParser = EventSourceParser_1.default;
  2056. var EventSource_1 = __webpack_require__(6);
  2057. exports.EventSource = EventSource_1.default;
  2058. var ThemeRegistry_1 = __webpack_require__(57);
  2059. exports.defineThemeSystem = ThemeRegistry_1.defineThemeSystem;
  2060. exports.getThemeSystemClass = ThemeRegistry_1.getThemeSystemClass;
  2061. var EventInstanceGroup_1 = __webpack_require__(20);
  2062. exports.EventInstanceGroup = EventInstanceGroup_1.default;
  2063. var ArrayEventSource_1 = __webpack_require__(56);
  2064. exports.ArrayEventSource = ArrayEventSource_1.default;
  2065. var FuncEventSource_1 = __webpack_require__(223);
  2066. exports.FuncEventSource = FuncEventSource_1.default;
  2067. var JsonFeedEventSource_1 = __webpack_require__(224);
  2068. exports.JsonFeedEventSource = JsonFeedEventSource_1.default;
  2069. var EventFootprint_1 = __webpack_require__(34);
  2070. exports.EventFootprint = EventFootprint_1.default;
  2071. var Class_1 = __webpack_require__(35);
  2072. exports.Class = Class_1.default;
  2073. var Mixin_1 = __webpack_require__(15);
  2074. exports.Mixin = Mixin_1.default;
  2075. var CoordCache_1 = __webpack_require__(58);
  2076. exports.CoordCache = CoordCache_1.default;
  2077. var Iterator_1 = __webpack_require__(225);
  2078. exports.Iterator = Iterator_1.default;
  2079. var DragListener_1 = __webpack_require__(59);
  2080. exports.DragListener = DragListener_1.default;
  2081. var HitDragListener_1 = __webpack_require__(17);
  2082. exports.HitDragListener = HitDragListener_1.default;
  2083. var MouseFollower_1 = __webpack_require__(226);
  2084. exports.MouseFollower = MouseFollower_1.default;
  2085. var ParsableModelMixin_1 = __webpack_require__(52);
  2086. exports.ParsableModelMixin = ParsableModelMixin_1.default;
  2087. var Popover_1 = __webpack_require__(227);
  2088. exports.Popover = Popover_1.default;
  2089. var Promise_1 = __webpack_require__(21);
  2090. exports.Promise = Promise_1.default;
  2091. var TaskQueue_1 = __webpack_require__(228);
  2092. exports.TaskQueue = TaskQueue_1.default;
  2093. var RenderQueue_1 = __webpack_require__(229);
  2094. exports.RenderQueue = RenderQueue_1.default;
  2095. var Scroller_1 = __webpack_require__(41);
  2096. exports.Scroller = Scroller_1.default;
  2097. var Theme_1 = __webpack_require__(22);
  2098. exports.Theme = Theme_1.default;
  2099. var Component_1 = __webpack_require__(230);
  2100. exports.Component = Component_1.default;
  2101. var DateComponent_1 = __webpack_require__(231);
  2102. exports.DateComponent = DateComponent_1.default;
  2103. var InteractiveDateComponent_1 = __webpack_require__(42);
  2104. exports.InteractiveDateComponent = InteractiveDateComponent_1.default;
  2105. var Calendar_1 = __webpack_require__(232);
  2106. exports.Calendar = Calendar_1.default;
  2107. var View_1 = __webpack_require__(43);
  2108. exports.View = View_1.default;
  2109. var ViewRegistry_1 = __webpack_require__(24);
  2110. exports.defineView = ViewRegistry_1.defineView;
  2111. exports.getViewConfig = ViewRegistry_1.getViewConfig;
  2112. var DayTableMixin_1 = __webpack_require__(60);
  2113. exports.DayTableMixin = DayTableMixin_1.default;
  2114. var BusinessHourRenderer_1 = __webpack_require__(61);
  2115. exports.BusinessHourRenderer = BusinessHourRenderer_1.default;
  2116. var EventRenderer_1 = __webpack_require__(44);
  2117. exports.EventRenderer = EventRenderer_1.default;
  2118. var FillRenderer_1 = __webpack_require__(62);
  2119. exports.FillRenderer = FillRenderer_1.default;
  2120. var HelperRenderer_1 = __webpack_require__(63);
  2121. exports.HelperRenderer = HelperRenderer_1.default;
  2122. var ExternalDropping_1 = __webpack_require__(233);
  2123. exports.ExternalDropping = ExternalDropping_1.default;
  2124. var EventResizing_1 = __webpack_require__(234);
  2125. exports.EventResizing = EventResizing_1.default;
  2126. var EventPointing_1 = __webpack_require__(64);
  2127. exports.EventPointing = EventPointing_1.default;
  2128. var EventDragging_1 = __webpack_require__(235);
  2129. exports.EventDragging = EventDragging_1.default;
  2130. var DateSelecting_1 = __webpack_require__(236);
  2131. exports.DateSelecting = DateSelecting_1.default;
  2132. var DateClicking_1 = __webpack_require__(237);
  2133. exports.DateClicking = DateClicking_1.default;
  2134. var Interaction_1 = __webpack_require__(14);
  2135. exports.Interaction = Interaction_1.default;
  2136. var StandardInteractionsMixin_1 = __webpack_require__(65);
  2137. exports.StandardInteractionsMixin = StandardInteractionsMixin_1.default;
  2138. var AgendaView_1 = __webpack_require__(238);
  2139. exports.AgendaView = AgendaView_1.default;
  2140. var TimeGrid_1 = __webpack_require__(239);
  2141. exports.TimeGrid = TimeGrid_1.default;
  2142. var TimeGridEventRenderer_1 = __webpack_require__(240);
  2143. exports.TimeGridEventRenderer = TimeGridEventRenderer_1.default;
  2144. var TimeGridFillRenderer_1 = __webpack_require__(242);
  2145. exports.TimeGridFillRenderer = TimeGridFillRenderer_1.default;
  2146. var TimeGridHelperRenderer_1 = __webpack_require__(241);
  2147. exports.TimeGridHelperRenderer = TimeGridHelperRenderer_1.default;
  2148. var DayGrid_1 = __webpack_require__(66);
  2149. exports.DayGrid = DayGrid_1.default;
  2150. var DayGridEventRenderer_1 = __webpack_require__(243);
  2151. exports.DayGridEventRenderer = DayGridEventRenderer_1.default;
  2152. var DayGridFillRenderer_1 = __webpack_require__(245);
  2153. exports.DayGridFillRenderer = DayGridFillRenderer_1.default;
  2154. var DayGridHelperRenderer_1 = __webpack_require__(244);
  2155. exports.DayGridHelperRenderer = DayGridHelperRenderer_1.default;
  2156. var BasicView_1 = __webpack_require__(67);
  2157. exports.BasicView = BasicView_1.default;
  2158. var BasicViewDateProfileGenerator_1 = __webpack_require__(68);
  2159. exports.BasicViewDateProfileGenerator = BasicViewDateProfileGenerator_1.default;
  2160. var MonthView_1 = __webpack_require__(246);
  2161. exports.MonthView = MonthView_1.default;
  2162. var MonthViewDateProfileGenerator_1 = __webpack_require__(247);
  2163. exports.MonthViewDateProfileGenerator = MonthViewDateProfileGenerator_1.default;
  2164. var ListView_1 = __webpack_require__(248);
  2165. exports.ListView = ListView_1.default;
  2166. var ListEventPointing_1 = __webpack_require__(250);
  2167. exports.ListEventPointing = ListEventPointing_1.default;
  2168. var ListEventRenderer_1 = __webpack_require__(249);
  2169. exports.ListEventRenderer = ListEventRenderer_1.default;
  2170. /***/ }),
  2171. /* 19 */
  2172. /***/ (function(module, exports, __webpack_require__) {
  2173. Object.defineProperty(exports, "__esModule", { value: true });
  2174. var EventRange_1 = __webpack_require__(50);
  2175. var EventFootprint_1 = __webpack_require__(34);
  2176. var ComponentFootprint_1 = __webpack_require__(12);
  2177. function eventDefsToEventInstances(eventDefs, unzonedRange) {
  2178. var eventInstances = [];
  2179. var i;
  2180. for (i = 0; i < eventDefs.length; i++) {
  2181. eventInstances.push.apply(eventInstances, // append
  2182. eventDefs[i].buildInstances(unzonedRange));
  2183. }
  2184. return eventInstances;
  2185. }
  2186. exports.eventDefsToEventInstances = eventDefsToEventInstances;
  2187. function eventInstanceToEventRange(eventInstance) {
  2188. return new EventRange_1.default(eventInstance.dateProfile.unzonedRange, eventInstance.def, eventInstance);
  2189. }
  2190. exports.eventInstanceToEventRange = eventInstanceToEventRange;
  2191. function eventRangeToEventFootprint(eventRange) {
  2192. return new EventFootprint_1.default(new ComponentFootprint_1.default(eventRange.unzonedRange, eventRange.eventDef.isAllDay()), eventRange.eventDef, eventRange.eventInstance // might not exist
  2193. );
  2194. }
  2195. exports.eventRangeToEventFootprint = eventRangeToEventFootprint;
  2196. function eventInstanceToUnzonedRange(eventInstance) {
  2197. return eventInstance.dateProfile.unzonedRange;
  2198. }
  2199. exports.eventInstanceToUnzonedRange = eventInstanceToUnzonedRange;
  2200. function eventFootprintToComponentFootprint(eventFootprint) {
  2201. return eventFootprint.componentFootprint;
  2202. }
  2203. exports.eventFootprintToComponentFootprint = eventFootprintToComponentFootprint;
  2204. /***/ }),
  2205. /* 20 */
  2206. /***/ (function(module, exports, __webpack_require__) {
  2207. Object.defineProperty(exports, "__esModule", { value: true });
  2208. var UnzonedRange_1 = __webpack_require__(5);
  2209. var util_1 = __webpack_require__(19);
  2210. var EventRange_1 = __webpack_require__(50);
  2211. /*
  2212. It's expected that there will be at least one EventInstance,
  2213. OR that an explicitEventDef is assigned.
  2214. */
  2215. var EventInstanceGroup = /** @class */ (function () {
  2216. function EventInstanceGroup(eventInstances) {
  2217. this.eventInstances = eventInstances || [];
  2218. }
  2219. EventInstanceGroup.prototype.getAllEventRanges = function (constraintRange) {
  2220. if (constraintRange) {
  2221. return this.sliceNormalRenderRanges(constraintRange);
  2222. }
  2223. else {
  2224. return this.eventInstances.map(util_1.eventInstanceToEventRange);
  2225. }
  2226. };
  2227. EventInstanceGroup.prototype.sliceRenderRanges = function (constraintRange) {
  2228. if (this.isInverse()) {
  2229. return this.sliceInverseRenderRanges(constraintRange);
  2230. }
  2231. else {
  2232. return this.sliceNormalRenderRanges(constraintRange);
  2233. }
  2234. };
  2235. EventInstanceGroup.prototype.sliceNormalRenderRanges = function (constraintRange) {
  2236. var eventInstances = this.eventInstances;
  2237. var i;
  2238. var eventInstance;
  2239. var slicedRange;
  2240. var slicedEventRanges = [];
  2241. for (i = 0; i < eventInstances.length; i++) {
  2242. eventInstance = eventInstances[i];
  2243. slicedRange = eventInstance.dateProfile.unzonedRange.intersect(constraintRange);
  2244. if (slicedRange) {
  2245. slicedEventRanges.push(new EventRange_1.default(slicedRange, eventInstance.def, eventInstance));
  2246. }
  2247. }
  2248. return slicedEventRanges;
  2249. };
  2250. EventInstanceGroup.prototype.sliceInverseRenderRanges = function (constraintRange) {
  2251. var unzonedRanges = this.eventInstances.map(util_1.eventInstanceToUnzonedRange);
  2252. var ownerDef = this.getEventDef();
  2253. unzonedRanges = UnzonedRange_1.default.invertRanges(unzonedRanges, constraintRange);
  2254. return unzonedRanges.map(function (unzonedRange) {
  2255. return new EventRange_1.default(unzonedRange, ownerDef); // don't give an EventInstance
  2256. });
  2257. };
  2258. EventInstanceGroup.prototype.isInverse = function () {
  2259. return this.getEventDef().hasInverseRendering();
  2260. };
  2261. EventInstanceGroup.prototype.getEventDef = function () {
  2262. return this.explicitEventDef || this.eventInstances[0].def;
  2263. };
  2264. return EventInstanceGroup;
  2265. }());
  2266. exports.default = EventInstanceGroup;
  2267. /***/ }),
  2268. /* 21 */
  2269. /***/ (function(module, exports, __webpack_require__) {
  2270. Object.defineProperty(exports, "__esModule", { value: true });
  2271. var $ = __webpack_require__(3);
  2272. var PromiseStub = {
  2273. construct: function (executor) {
  2274. var deferred = $.Deferred();
  2275. var promise = deferred.promise();
  2276. if (typeof executor === 'function') {
  2277. executor(function (val) {
  2278. deferred.resolve(val);
  2279. attachImmediatelyResolvingThen(promise, val);
  2280. }, function () {
  2281. deferred.reject();
  2282. attachImmediatelyRejectingThen(promise);
  2283. });
  2284. }
  2285. return promise;
  2286. },
  2287. resolve: function (val) {
  2288. var deferred = $.Deferred().resolve(val);
  2289. var promise = deferred.promise();
  2290. attachImmediatelyResolvingThen(promise, val);
  2291. return promise;
  2292. },
  2293. reject: function () {
  2294. var deferred = $.Deferred().reject();
  2295. var promise = deferred.promise();
  2296. attachImmediatelyRejectingThen(promise);
  2297. return promise;
  2298. }
  2299. };
  2300. exports.default = PromiseStub;
  2301. function attachImmediatelyResolvingThen(promise, val) {
  2302. promise.then = function (onResolve) {
  2303. if (typeof onResolve === 'function') {
  2304. return PromiseStub.resolve(onResolve(val));
  2305. }
  2306. return promise;
  2307. };
  2308. }
  2309. function attachImmediatelyRejectingThen(promise) {
  2310. promise.then = function (onResolve, onReject) {
  2311. if (typeof onReject === 'function') {
  2312. onReject();
  2313. }
  2314. return promise;
  2315. };
  2316. }
  2317. /***/ }),
  2318. /* 22 */
  2319. /***/ (function(module, exports, __webpack_require__) {
  2320. Object.defineProperty(exports, "__esModule", { value: true });
  2321. var $ = __webpack_require__(3);
  2322. var Theme = /** @class */ (function () {
  2323. function Theme(optionsManager) {
  2324. this.optionsManager = optionsManager;
  2325. this.processIconOverride();
  2326. }
  2327. Theme.prototype.processIconOverride = function () {
  2328. if (this.iconOverrideOption) {
  2329. this.setIconOverride(this.optionsManager.get(this.iconOverrideOption));
  2330. }
  2331. };
  2332. Theme.prototype.setIconOverride = function (iconOverrideHash) {
  2333. var iconClassesCopy;
  2334. var buttonName;
  2335. if ($.isPlainObject(iconOverrideHash)) {
  2336. iconClassesCopy = $.extend({}, this.iconClasses);
  2337. for (buttonName in iconOverrideHash) {
  2338. iconClassesCopy[buttonName] = this.applyIconOverridePrefix(iconOverrideHash[buttonName]);
  2339. }
  2340. this.iconClasses = iconClassesCopy;
  2341. }
  2342. else if (iconOverrideHash === false) {
  2343. this.iconClasses = {};
  2344. }
  2345. };
  2346. Theme.prototype.applyIconOverridePrefix = function (className) {
  2347. var prefix = this.iconOverridePrefix;
  2348. if (prefix && className.indexOf(prefix) !== 0) { // if not already present
  2349. className = prefix + className;
  2350. }
  2351. return className;
  2352. };
  2353. Theme.prototype.getClass = function (key) {
  2354. return this.classes[key] || '';
  2355. };
  2356. Theme.prototype.getIconClass = function (buttonName) {
  2357. var className = this.iconClasses[buttonName];
  2358. if (className) {
  2359. return this.baseIconClass + ' ' + className;
  2360. }
  2361. return '';
  2362. };
  2363. Theme.prototype.getCustomButtonIconClass = function (customButtonProps) {
  2364. var className;
  2365. if (this.iconOverrideCustomButtonOption) {
  2366. className = customButtonProps[this.iconOverrideCustomButtonOption];
  2367. if (className) {
  2368. return this.baseIconClass + ' ' + this.applyIconOverridePrefix(className);
  2369. }
  2370. }
  2371. return '';
  2372. };
  2373. return Theme;
  2374. }());
  2375. exports.default = Theme;
  2376. Theme.prototype.classes = {};
  2377. Theme.prototype.iconClasses = {};
  2378. Theme.prototype.baseIconClass = '';
  2379. Theme.prototype.iconOverridePrefix = '';
  2380. /***/ }),
  2381. /* 23 */
  2382. /***/ (function(module, exports, __webpack_require__) {
  2383. Object.defineProperty(exports, "__esModule", { value: true });
  2384. var $ = __webpack_require__(3);
  2385. var exportHooks = __webpack_require__(18);
  2386. var EmitterMixin_1 = __webpack_require__(13);
  2387. var ListenerMixin_1 = __webpack_require__(7);
  2388. exportHooks.touchMouseIgnoreWait = 500;
  2389. var globalEmitter = null;
  2390. var neededCount = 0;
  2391. /*
  2392. Listens to document and window-level user-interaction events, like touch events and mouse events,
  2393. and fires these events as-is to whoever is observing a GlobalEmitter.
  2394. Best when used as a singleton via GlobalEmitter.get()
  2395. Normalizes mouse/touch events. For examples:
  2396. - ignores the the simulated mouse events that happen after a quick tap: mousemove+mousedown+mouseup+click
  2397. - compensates for various buggy scenarios where a touchend does not fire
  2398. */
  2399. var GlobalEmitter = /** @class */ (function () {
  2400. function GlobalEmitter() {
  2401. this.isTouching = false;
  2402. this.mouseIgnoreDepth = 0;
  2403. }
  2404. // gets the singleton
  2405. GlobalEmitter.get = function () {
  2406. if (!globalEmitter) {
  2407. globalEmitter = new GlobalEmitter();
  2408. globalEmitter.bind();
  2409. }
  2410. return globalEmitter;
  2411. };
  2412. // called when an object knows it will need a GlobalEmitter in the near future.
  2413. GlobalEmitter.needed = function () {
  2414. GlobalEmitter.get(); // ensures globalEmitter
  2415. neededCount++;
  2416. };
  2417. // called when the object that originally called needed() doesn't need a GlobalEmitter anymore.
  2418. GlobalEmitter.unneeded = function () {
  2419. neededCount--;
  2420. if (!neededCount) { // nobody else needs it
  2421. globalEmitter.unbind();
  2422. globalEmitter = null;
  2423. }
  2424. };
  2425. GlobalEmitter.prototype.bind = function () {
  2426. var _this = this;
  2427. this.listenTo($(document), {
  2428. touchstart: this.handleTouchStart,
  2429. touchcancel: this.handleTouchCancel,
  2430. touchend: this.handleTouchEnd,
  2431. mousedown: this.handleMouseDown,
  2432. mousemove: this.handleMouseMove,
  2433. mouseup: this.handleMouseUp,
  2434. click: this.handleClick,
  2435. selectstart: this.handleSelectStart,
  2436. contextmenu: this.handleContextMenu
  2437. });
  2438. // because we need to call preventDefault
  2439. // because https://www.chromestatus.com/features/5093566007214080
  2440. // TODO: investigate performance because this is a global handler
  2441. window.addEventListener('touchmove', this.handleTouchMoveProxy = function (ev) {
  2442. _this.handleTouchMove($.Event(ev));
  2443. }, { passive: false } // allows preventDefault()
  2444. );
  2445. // attach a handler to get called when ANY scroll action happens on the page.
  2446. // this was impossible to do with normal on/off because 'scroll' doesn't bubble.
  2447. // http://stackoverflow.com/a/32954565/96342
  2448. window.addEventListener('scroll', this.handleScrollProxy = function (ev) {
  2449. _this.handleScroll($.Event(ev));
  2450. }, true // useCapture
  2451. );
  2452. };
  2453. GlobalEmitter.prototype.unbind = function () {
  2454. this.stopListeningTo($(document));
  2455. window.removeEventListener('touchmove', this.handleTouchMoveProxy, { passive: false } // use same options as addEventListener
  2456. );
  2457. window.removeEventListener('scroll', this.handleScrollProxy, true // useCapture
  2458. );
  2459. };
  2460. // Touch Handlers
  2461. // -----------------------------------------------------------------------------------------------------------------
  2462. GlobalEmitter.prototype.handleTouchStart = function (ev) {
  2463. // if a previous touch interaction never ended with a touchend, then implicitly end it,
  2464. // but since a new touch interaction is about to begin, don't start the mouse ignore period.
  2465. this.stopTouch(ev, true); // skipMouseIgnore=true
  2466. this.isTouching = true;
  2467. this.trigger('touchstart', ev);
  2468. };
  2469. GlobalEmitter.prototype.handleTouchMove = function (ev) {
  2470. if (this.isTouching) {
  2471. this.trigger('touchmove', ev);
  2472. }
  2473. };
  2474. GlobalEmitter.prototype.handleTouchCancel = function (ev) {
  2475. if (this.isTouching) {
  2476. this.trigger('touchcancel', ev);
  2477. // Have touchcancel fire an artificial touchend. That way, handlers won't need to listen to both.
  2478. // If touchend fires later, it won't have any effect b/c isTouching will be false.
  2479. this.stopTouch(ev);
  2480. }
  2481. };
  2482. GlobalEmitter.prototype.handleTouchEnd = function (ev) {
  2483. this.stopTouch(ev);
  2484. };
  2485. // Mouse Handlers
  2486. // -----------------------------------------------------------------------------------------------------------------
  2487. GlobalEmitter.prototype.handleMouseDown = function (ev) {
  2488. if (!this.shouldIgnoreMouse()) {
  2489. this.trigger('mousedown', ev);
  2490. }
  2491. };
  2492. GlobalEmitter.prototype.handleMouseMove = function (ev) {
  2493. if (!this.shouldIgnoreMouse()) {
  2494. this.trigger('mousemove', ev);
  2495. }
  2496. };
  2497. GlobalEmitter.prototype.handleMouseUp = function (ev) {
  2498. if (!this.shouldIgnoreMouse()) {
  2499. this.trigger('mouseup', ev);
  2500. }
  2501. };
  2502. GlobalEmitter.prototype.handleClick = function (ev) {
  2503. if (!this.shouldIgnoreMouse()) {
  2504. this.trigger('click', ev);
  2505. }
  2506. };
  2507. // Misc Handlers
  2508. // -----------------------------------------------------------------------------------------------------------------
  2509. GlobalEmitter.prototype.handleSelectStart = function (ev) {
  2510. this.trigger('selectstart', ev);
  2511. };
  2512. GlobalEmitter.prototype.handleContextMenu = function (ev) {
  2513. this.trigger('contextmenu', ev);
  2514. };
  2515. GlobalEmitter.prototype.handleScroll = function (ev) {
  2516. this.trigger('scroll', ev);
  2517. };
  2518. // Utils
  2519. // -----------------------------------------------------------------------------------------------------------------
  2520. GlobalEmitter.prototype.stopTouch = function (ev, skipMouseIgnore) {
  2521. if (skipMouseIgnore === void 0) { skipMouseIgnore = false; }
  2522. if (this.isTouching) {
  2523. this.isTouching = false;
  2524. this.trigger('touchend', ev);
  2525. if (!skipMouseIgnore) {
  2526. this.startTouchMouseIgnore();
  2527. }
  2528. }
  2529. };
  2530. GlobalEmitter.prototype.startTouchMouseIgnore = function () {
  2531. var _this = this;
  2532. var wait = exportHooks.touchMouseIgnoreWait;
  2533. if (wait) {
  2534. this.mouseIgnoreDepth++;
  2535. setTimeout(function () {
  2536. _this.mouseIgnoreDepth--;
  2537. }, wait);
  2538. }
  2539. };
  2540. GlobalEmitter.prototype.shouldIgnoreMouse = function () {
  2541. return this.isTouching || Boolean(this.mouseIgnoreDepth);
  2542. };
  2543. return GlobalEmitter;
  2544. }());
  2545. exports.default = GlobalEmitter;
  2546. ListenerMixin_1.default.mixInto(GlobalEmitter);
  2547. EmitterMixin_1.default.mixInto(GlobalEmitter);
  2548. /***/ }),
  2549. /* 24 */
  2550. /***/ (function(module, exports, __webpack_require__) {
  2551. Object.defineProperty(exports, "__esModule", { value: true });
  2552. var exportHooks = __webpack_require__(18);
  2553. exports.viewHash = {};
  2554. exportHooks.views = exports.viewHash;
  2555. function defineView(viewName, viewConfig) {
  2556. exports.viewHash[viewName] = viewConfig;
  2557. }
  2558. exports.defineView = defineView;
  2559. function getViewConfig(viewName) {
  2560. return exports.viewHash[viewName];
  2561. }
  2562. exports.getViewConfig = getViewConfig;
  2563. /***/ }),
  2564. /* 25 */,
  2565. /* 26 */,
  2566. /* 27 */,
  2567. /* 28 */,
  2568. /* 29 */,
  2569. /* 30 */,
  2570. /* 31 */,
  2571. /* 32 */
  2572. /***/ (function(module, exports, __webpack_require__) {
  2573. Object.defineProperty(exports, "__esModule", { value: true });
  2574. var $ = __webpack_require__(3);
  2575. var moment = __webpack_require__(0);
  2576. var exportHooks = __webpack_require__(18);
  2577. var options_1 = __webpack_require__(33);
  2578. var util_1 = __webpack_require__(4);
  2579. exports.localeOptionHash = {};
  2580. exportHooks.locales = exports.localeOptionHash;
  2581. // NOTE: can't guarantee any of these computations will run because not every locale has datepicker
  2582. // configs, so make sure there are English fallbacks for these in the defaults file.
  2583. var dpComputableOptions = {
  2584. buttonText: function (dpOptions) {
  2585. return {
  2586. // the translations sometimes wrongly contain HTML entities
  2587. prev: util_1.stripHtmlEntities(dpOptions.prevText),
  2588. next: util_1.stripHtmlEntities(dpOptions.nextText),
  2589. today: util_1.stripHtmlEntities(dpOptions.currentText)
  2590. };
  2591. },
  2592. // Produces format strings like "MMMM YYYY" -> "September 2014"
  2593. monthYearFormat: function (dpOptions) {
  2594. return dpOptions.showMonthAfterYear ?
  2595. 'YYYY[' + dpOptions.yearSuffix + '] MMMM' :
  2596. 'MMMM YYYY[' + dpOptions.yearSuffix + ']';
  2597. }
  2598. };
  2599. var momComputableOptions = {
  2600. // Produces format strings like "ddd M/D" -> "Fri 9/15"
  2601. dayOfMonthFormat: function (momOptions, fcOptions) {
  2602. var format = momOptions.longDateFormat('l'); // for the format like "M/D/YYYY"
  2603. // strip the year off the edge, as well as other misc non-whitespace chars
  2604. format = format.replace(/^Y+[^\w\s]*|[^\w\s]*Y+$/g, '');
  2605. if (fcOptions.isRTL) {
  2606. format += ' ddd'; // for RTL, add day-of-week to end
  2607. }
  2608. else {
  2609. format = 'ddd ' + format; // for LTR, add day-of-week to beginning
  2610. }
  2611. return format;
  2612. },
  2613. // Produces format strings like "h:mma" -> "6:00pm"
  2614. mediumTimeFormat: function (momOptions) {
  2615. return momOptions.longDateFormat('LT')
  2616. .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand
  2617. },
  2618. // Produces format strings like "h(:mm)a" -> "6pm" / "6:30pm"
  2619. smallTimeFormat: function (momOptions) {
  2620. return momOptions.longDateFormat('LT')
  2621. .replace(':mm', '(:mm)')
  2622. .replace(/(\Wmm)$/, '($1)') // like above, but for foreign locales
  2623. .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand
  2624. },
  2625. // Produces format strings like "h(:mm)t" -> "6p" / "6:30p"
  2626. extraSmallTimeFormat: function (momOptions) {
  2627. return momOptions.longDateFormat('LT')
  2628. .replace(':mm', '(:mm)')
  2629. .replace(/(\Wmm)$/, '($1)') // like above, but for foreign locales
  2630. .replace(/\s*a$/i, 't'); // convert to AM/PM/am/pm to lowercase one-letter. remove any spaces beforehand
  2631. },
  2632. // Produces format strings like "ha" / "H" -> "6pm" / "18"
  2633. hourFormat: function (momOptions) {
  2634. return momOptions.longDateFormat('LT')
  2635. .replace(':mm', '')
  2636. .replace(/(\Wmm)$/, '') // like above, but for foreign locales
  2637. .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand
  2638. },
  2639. // Produces format strings like "h:mm" -> "6:30" (with no AM/PM)
  2640. noMeridiemTimeFormat: function (momOptions) {
  2641. return momOptions.longDateFormat('LT')
  2642. .replace(/\s*a$/i, ''); // remove trailing AM/PM
  2643. }
  2644. };
  2645. // options that should be computed off live calendar options (considers override options)
  2646. // TODO: best place for this? related to locale?
  2647. // TODO: flipping text based on isRTL is a bad idea because the CSS `direction` might want to handle it
  2648. var instanceComputableOptions = {
  2649. // Produces format strings for results like "Mo 16"
  2650. smallDayDateFormat: function (options) {
  2651. return options.isRTL ?
  2652. 'D dd' :
  2653. 'dd D';
  2654. },
  2655. // Produces format strings for results like "Wk 5"
  2656. weekFormat: function (options) {
  2657. return options.isRTL ?
  2658. 'w[ ' + options.weekNumberTitle + ']' :
  2659. '[' + options.weekNumberTitle + ' ]w';
  2660. },
  2661. // Produces format strings for results like "Wk5"
  2662. smallWeekFormat: function (options) {
  2663. return options.isRTL ?
  2664. 'w[' + options.weekNumberTitle + ']' :
  2665. '[' + options.weekNumberTitle + ']w';
  2666. }
  2667. };
  2668. // TODO: make these computable properties in optionsManager
  2669. function populateInstanceComputableOptions(options) {
  2670. $.each(instanceComputableOptions, function (name, func) {
  2671. if (options[name] == null) {
  2672. options[name] = func(options);
  2673. }
  2674. });
  2675. }
  2676. exports.populateInstanceComputableOptions = populateInstanceComputableOptions;
  2677. // Initialize jQuery UI datepicker translations while using some of the translations
  2678. // Will set this as the default locales for datepicker.
  2679. function datepickerLocale(localeCode, dpLocaleCode, dpOptions) {
  2680. // get the FullCalendar internal option hash for this locale. create if necessary
  2681. var fcOptions = exports.localeOptionHash[localeCode] || (exports.localeOptionHash[localeCode] = {});
  2682. // transfer some simple options from datepicker to fc
  2683. fcOptions.isRTL = dpOptions.isRTL;
  2684. fcOptions.weekNumberTitle = dpOptions.weekHeader;
  2685. // compute some more complex options from datepicker
  2686. $.each(dpComputableOptions, function (name, func) {
  2687. fcOptions[name] = func(dpOptions);
  2688. });
  2689. var jqDatePicker = $.datepicker;
  2690. // is jQuery UI Datepicker is on the page?
  2691. if (jqDatePicker) {
  2692. // Register the locale data.
  2693. // FullCalendar and MomentJS use locale codes like "pt-br" but Datepicker
  2694. // does it like "pt-BR" or if it doesn't have the locale, maybe just "pt".
  2695. // Make an alias so the locale can be referenced either way.
  2696. jqDatePicker.regional[dpLocaleCode] =
  2697. jqDatePicker.regional[localeCode] = // alias
  2698. dpOptions;
  2699. // Alias 'en' to the default locale data. Do this every time.
  2700. jqDatePicker.regional.en = jqDatePicker.regional[''];
  2701. // Set as Datepicker's global defaults.
  2702. jqDatePicker.setDefaults(dpOptions);
  2703. }
  2704. }
  2705. exports.datepickerLocale = datepickerLocale;
  2706. // Sets FullCalendar-specific translations. Will set the locales as the global default.
  2707. function locale(localeCode, newFcOptions) {
  2708. var fcOptions;
  2709. var momOptions;
  2710. // get the FullCalendar internal option hash for this locale. create if necessary
  2711. fcOptions = exports.localeOptionHash[localeCode] || (exports.localeOptionHash[localeCode] = {});
  2712. // provided new options for this locales? merge them in
  2713. if (newFcOptions) {
  2714. fcOptions = exports.localeOptionHash[localeCode] = options_1.mergeOptions([fcOptions, newFcOptions]);
  2715. }
  2716. // compute locale options that weren't defined.
  2717. // always do this. newFcOptions can be undefined when initializing from i18n file,
  2718. // so no way to tell if this is an initialization or a default-setting.
  2719. momOptions = getMomentLocaleData(localeCode); // will fall back to en
  2720. $.each(momComputableOptions, function (name, func) {
  2721. if (fcOptions[name] == null) {
  2722. fcOptions[name] = (func)(momOptions, fcOptions);
  2723. }
  2724. });
  2725. // set it as the default locale for FullCalendar
  2726. options_1.globalDefaults.locale = localeCode;
  2727. }
  2728. exports.locale = locale;
  2729. // Returns moment's internal locale data. If doesn't exist, returns English.
  2730. function getMomentLocaleData(localeCode) {
  2731. return moment.localeData(localeCode) || moment.localeData('en');
  2732. }
  2733. exports.getMomentLocaleData = getMomentLocaleData;
  2734. // Initialize English by forcing computation of moment-derived options.
  2735. // Also, sets it as the default.
  2736. locale('en', options_1.englishDefaults);
  2737. /***/ }),
  2738. /* 33 */
  2739. /***/ (function(module, exports, __webpack_require__) {
  2740. Object.defineProperty(exports, "__esModule", { value: true });
  2741. var util_1 = __webpack_require__(4);
  2742. exports.globalDefaults = {
  2743. titleRangeSeparator: ' \u2013 ',
  2744. monthYearFormat: 'MMMM YYYY',
  2745. defaultTimedEventDuration: '02:00:00',
  2746. defaultAllDayEventDuration: { days: 1 },
  2747. forceEventDuration: false,
  2748. nextDayThreshold: '09:00:00',
  2749. // display
  2750. columnHeader: true,
  2751. defaultView: 'month',
  2752. aspectRatio: 1.35,
  2753. header: {
  2754. left: 'title',
  2755. center: '',
  2756. right: 'today prev,next'
  2757. },
  2758. weekends: true,
  2759. weekNumbers: false,
  2760. weekNumberTitle: 'W',
  2761. weekNumberCalculation: 'local',
  2762. // editable: false,
  2763. // nowIndicator: false,
  2764. scrollTime: '06:00:00',
  2765. minTime: '00:00:00',
  2766. maxTime: '24:00:00',
  2767. showNonCurrentDates: true,
  2768. // event ajax
  2769. lazyFetching: true,
  2770. startParam: 'start',
  2771. endParam: 'end',
  2772. timezoneParam: 'timezone',
  2773. timezone: false,
  2774. // allDayDefault: undefined,
  2775. // locale
  2776. locale: null,
  2777. isRTL: false,
  2778. buttonText: {
  2779. prev: 'prev',
  2780. next: 'next',
  2781. prevYear: 'prev year',
  2782. nextYear: 'next year',
  2783. year: 'year',
  2784. today: 'today',
  2785. month: 'month',
  2786. week: 'week',
  2787. day: 'day'
  2788. },
  2789. // buttonIcons: null,
  2790. allDayText: 'all-day',
  2791. // allows setting a min-height to the event segment to prevent short events overlapping each other
  2792. agendaEventMinHeight: 0,
  2793. // jquery-ui theming
  2794. theme: false,
  2795. // themeButtonIcons: null,
  2796. // eventResizableFromStart: false,
  2797. dragOpacity: .75,
  2798. dragRevertDuration: 500,
  2799. dragScroll: true,
  2800. // selectable: false,
  2801. unselectAuto: true,
  2802. // selectMinDistance: 0,
  2803. dropAccept: '*',
  2804. eventOrder: 'title',
  2805. // eventRenderWait: null,
  2806. eventLimit: false,
  2807. eventLimitText: 'more',
  2808. eventLimitClick: 'popover',
  2809. dayPopoverFormat: 'LL',
  2810. handleWindowResize: true,
  2811. windowResizeDelay: 100,
  2812. longPressDelay: 1000
  2813. };
  2814. exports.englishDefaults = {
  2815. dayPopoverFormat: 'dddd, MMMM D'
  2816. };
  2817. exports.rtlDefaults = {
  2818. header: {
  2819. left: 'next,prev today',
  2820. center: '',
  2821. right: 'title'
  2822. },
  2823. buttonIcons: {
  2824. prev: 'right-single-arrow',
  2825. next: 'left-single-arrow',
  2826. prevYear: 'right-double-arrow',
  2827. nextYear: 'left-double-arrow'
  2828. },
  2829. themeButtonIcons: {
  2830. prev: 'circle-triangle-e',
  2831. next: 'circle-triangle-w',
  2832. nextYear: 'seek-prev',
  2833. prevYear: 'seek-next'
  2834. }
  2835. };
  2836. var complexOptions = [
  2837. 'header',
  2838. 'footer',
  2839. 'buttonText',
  2840. 'buttonIcons',
  2841. 'themeButtonIcons'
  2842. ];
  2843. // Merges an array of option objects into a single object
  2844. function mergeOptions(optionObjs) {
  2845. return util_1.mergeProps(optionObjs, complexOptions);
  2846. }
  2847. exports.mergeOptions = mergeOptions;
  2848. /***/ }),
  2849. /* 34 */
  2850. /***/ (function(module, exports) {
  2851. Object.defineProperty(exports, "__esModule", { value: true });
  2852. var EventFootprint = /** @class */ (function () {
  2853. function EventFootprint(componentFootprint, eventDef, eventInstance) {
  2854. this.componentFootprint = componentFootprint;
  2855. this.eventDef = eventDef;
  2856. if (eventInstance) {
  2857. this.eventInstance = eventInstance;
  2858. }
  2859. }
  2860. EventFootprint.prototype.getEventLegacy = function () {
  2861. return (this.eventInstance || this.eventDef).toLegacy();
  2862. };
  2863. return EventFootprint;
  2864. }());
  2865. exports.default = EventFootprint;
  2866. /***/ }),
  2867. /* 35 */
  2868. /***/ (function(module, exports, __webpack_require__) {
  2869. Object.defineProperty(exports, "__esModule", { value: true });
  2870. var tslib_1 = __webpack_require__(2);
  2871. var util_1 = __webpack_require__(4);
  2872. // Class that all other classes will inherit from
  2873. var Class = /** @class */ (function () {
  2874. function Class() {
  2875. }
  2876. // Called on a class to create a subclass.
  2877. // LIMITATION: cannot provide a constructor!
  2878. Class.extend = function (members) {
  2879. var SubClass = /** @class */ (function (_super) {
  2880. tslib_1.__extends(SubClass, _super);
  2881. function SubClass() {
  2882. return _super !== null && _super.apply(this, arguments) || this;
  2883. }
  2884. return SubClass;
  2885. }(this));
  2886. util_1.copyOwnProps(members, SubClass.prototype);
  2887. return SubClass;
  2888. };
  2889. // Adds new member variables/methods to the class's prototype.
  2890. // Can be called with another class, or a plain object hash containing new members.
  2891. Class.mixin = function (members) {
  2892. util_1.copyOwnProps(members, this.prototype);
  2893. };
  2894. return Class;
  2895. }());
  2896. exports.default = Class;
  2897. /***/ }),
  2898. /* 36 */
  2899. /***/ (function(module, exports, __webpack_require__) {
  2900. Object.defineProperty(exports, "__esModule", { value: true });
  2901. var moment = __webpack_require__(0);
  2902. var util_1 = __webpack_require__(4);
  2903. var SingleEventDef_1 = __webpack_require__(9);
  2904. var RecurringEventDef_1 = __webpack_require__(54);
  2905. exports.default = {
  2906. parse: function (eventInput, source) {
  2907. if (util_1.isTimeString(eventInput.start) || moment.isDuration(eventInput.start) ||
  2908. util_1.isTimeString(eventInput.end) || moment.isDuration(eventInput.end)) {
  2909. return RecurringEventDef_1.default.parse(eventInput, source);
  2910. }
  2911. else {
  2912. return SingleEventDef_1.default.parse(eventInput, source);
  2913. }
  2914. }
  2915. };
  2916. /***/ }),
  2917. /* 37 */
  2918. /***/ (function(module, exports, __webpack_require__) {
  2919. Object.defineProperty(exports, "__esModule", { value: true });
  2920. var $ = __webpack_require__(3);
  2921. var ParsableModelMixin_1 = __webpack_require__(52);
  2922. var EventDef = /** @class */ (function () {
  2923. function EventDef(source) {
  2924. this.source = source;
  2925. this.className = [];
  2926. this.miscProps = {};
  2927. }
  2928. EventDef.parse = function (rawInput, source) {
  2929. var def = new this(source);
  2930. if (def.applyProps(rawInput)) {
  2931. return def;
  2932. }
  2933. return false;
  2934. };
  2935. EventDef.normalizeId = function (id) {
  2936. return String(id);
  2937. };
  2938. EventDef.generateId = function () {
  2939. return '_fc' + (EventDef.uuid++);
  2940. };
  2941. EventDef.prototype.clone = function () {
  2942. var copy = new this.constructor(this.source);
  2943. copy.id = this.id;
  2944. copy.rawId = this.rawId;
  2945. copy.uid = this.uid; // not really unique anymore :(
  2946. EventDef.copyVerbatimStandardProps(this, copy);
  2947. copy.className = this.className.slice(); // copy
  2948. copy.miscProps = $.extend({}, this.miscProps);
  2949. return copy;
  2950. };
  2951. EventDef.prototype.hasInverseRendering = function () {
  2952. return this.getRendering() === 'inverse-background';
  2953. };
  2954. EventDef.prototype.hasBgRendering = function () {
  2955. var rendering = this.getRendering();
  2956. return rendering === 'inverse-background' || rendering === 'background';
  2957. };
  2958. EventDef.prototype.getRendering = function () {
  2959. if (this.rendering != null) {
  2960. return this.rendering;
  2961. }
  2962. return this.source.rendering;
  2963. };
  2964. EventDef.prototype.getConstraint = function () {
  2965. if (this.constraint != null) {
  2966. return this.constraint;
  2967. }
  2968. if (this.source.constraint != null) {
  2969. return this.source.constraint;
  2970. }
  2971. return this.source.calendar.opt('eventConstraint'); // what about View option?
  2972. };
  2973. EventDef.prototype.getOverlap = function () {
  2974. if (this.overlap != null) {
  2975. return this.overlap;
  2976. }
  2977. if (this.source.overlap != null) {
  2978. return this.source.overlap;
  2979. }
  2980. return this.source.calendar.opt('eventOverlap'); // what about View option?
  2981. };
  2982. EventDef.prototype.isStartExplicitlyEditable = function () {
  2983. if (this.startEditable != null) {
  2984. return this.startEditable;
  2985. }
  2986. return this.source.startEditable;
  2987. };
  2988. EventDef.prototype.isDurationExplicitlyEditable = function () {
  2989. if (this.durationEditable != null) {
  2990. return this.durationEditable;
  2991. }
  2992. return this.source.durationEditable;
  2993. };
  2994. EventDef.prototype.isExplicitlyEditable = function () {
  2995. if (this.editable != null) {
  2996. return this.editable;
  2997. }
  2998. return this.source.editable;
  2999. };
  3000. EventDef.prototype.toLegacy = function () {
  3001. var obj = $.extend({}, this.miscProps);
  3002. obj._id = this.uid;
  3003. obj.source = this.source;
  3004. obj.className = this.className.slice(); // copy
  3005. obj.allDay = this.isAllDay();
  3006. if (this.rawId != null) {
  3007. obj.id = this.rawId;
  3008. }
  3009. EventDef.copyVerbatimStandardProps(this, obj);
  3010. return obj;
  3011. };
  3012. EventDef.prototype.applyManualStandardProps = function (rawProps) {
  3013. if (rawProps.id != null) {
  3014. this.id = EventDef.normalizeId((this.rawId = rawProps.id));
  3015. }
  3016. else {
  3017. this.id = EventDef.generateId();
  3018. }
  3019. if (rawProps._id != null) { // accept this prop, even tho somewhat internal
  3020. this.uid = String(rawProps._id);
  3021. }
  3022. else {
  3023. this.uid = EventDef.generateId();
  3024. }
  3025. // TODO: converge with EventSource
  3026. if ($.isArray(rawProps.className)) {
  3027. this.className = rawProps.className;
  3028. }
  3029. if (typeof rawProps.className === 'string') {
  3030. this.className = rawProps.className.split(/\s+/);
  3031. }
  3032. return true;
  3033. };
  3034. EventDef.prototype.applyMiscProps = function (rawProps) {
  3035. $.extend(this.miscProps, rawProps);
  3036. };
  3037. EventDef.uuid = 0;
  3038. EventDef.defineStandardProps = ParsableModelMixin_1.default.defineStandardProps;
  3039. EventDef.copyVerbatimStandardProps = ParsableModelMixin_1.default.copyVerbatimStandardProps;
  3040. return EventDef;
  3041. }());
  3042. exports.default = EventDef;
  3043. ParsableModelMixin_1.default.mixInto(EventDef);
  3044. EventDef.defineStandardProps({
  3045. // not automatically assigned (`false`)
  3046. _id: false,
  3047. id: false,
  3048. className: false,
  3049. source: false,
  3050. // automatically assigned (`true`)
  3051. title: true,
  3052. url: true,
  3053. rendering: true,
  3054. constraint: true,
  3055. overlap: true,
  3056. editable: true,
  3057. startEditable: true,
  3058. durationEditable: true,
  3059. color: true,
  3060. backgroundColor: true,
  3061. borderColor: true,
  3062. textColor: true
  3063. });
  3064. /***/ }),
  3065. /* 38 */
  3066. /***/ (function(module, exports) {
  3067. Object.defineProperty(exports, "__esModule", { value: true });
  3068. exports.default = {
  3069. sourceClasses: [],
  3070. registerClass: function (EventSourceClass) {
  3071. this.sourceClasses.unshift(EventSourceClass); // give highest priority
  3072. },
  3073. parse: function (rawInput, calendar) {
  3074. var sourceClasses = this.sourceClasses;
  3075. var i;
  3076. var eventSource;
  3077. for (i = 0; i < sourceClasses.length; i++) {
  3078. eventSource = sourceClasses[i].parse(rawInput, calendar);
  3079. if (eventSource) {
  3080. return eventSource;
  3081. }
  3082. }
  3083. }
  3084. };
  3085. /***/ }),
  3086. /* 39 */
  3087. /***/ (function(module, exports, __webpack_require__) {
  3088. Object.defineProperty(exports, "__esModule", { value: true });
  3089. var util_1 = __webpack_require__(4);
  3090. var EventDateProfile_1 = __webpack_require__(16);
  3091. var EventDef_1 = __webpack_require__(37);
  3092. var EventDefDateMutation_1 = __webpack_require__(40);
  3093. var SingleEventDef_1 = __webpack_require__(9);
  3094. var EventDefMutation = /** @class */ (function () {
  3095. function EventDefMutation() {
  3096. }
  3097. EventDefMutation.createFromRawProps = function (eventInstance, rawProps, largeUnit) {
  3098. var eventDef = eventInstance.def;
  3099. var dateProps = {};
  3100. var standardProps = {};
  3101. var miscProps = {};
  3102. var verbatimStandardProps = {};
  3103. var eventDefId = null;
  3104. var className = null;
  3105. var propName;
  3106. var dateProfile;
  3107. var dateMutation;
  3108. var defMutation;
  3109. for (propName in rawProps) {
  3110. if (EventDateProfile_1.default.isStandardProp(propName)) {
  3111. dateProps[propName] = rawProps[propName];
  3112. }
  3113. else if (eventDef.isStandardProp(propName)) {
  3114. standardProps[propName] = rawProps[propName];
  3115. }
  3116. else if (eventDef.miscProps[propName] !== rawProps[propName]) { // only if changed
  3117. miscProps[propName] = rawProps[propName];
  3118. }
  3119. }
  3120. dateProfile = EventDateProfile_1.default.parse(dateProps, eventDef.source);
  3121. if (dateProfile) { // no failure?
  3122. dateMutation = EventDefDateMutation_1.default.createFromDiff(eventInstance.dateProfile, dateProfile, largeUnit);
  3123. }
  3124. if (standardProps.id !== eventDef.id) {
  3125. eventDefId = standardProps.id; // only apply if there's a change
  3126. }
  3127. if (!util_1.isArraysEqual(standardProps.className, eventDef.className)) {
  3128. className = standardProps.className; // only apply if there's a change
  3129. }
  3130. EventDef_1.default.copyVerbatimStandardProps(standardProps, // src
  3131. verbatimStandardProps // dest
  3132. );
  3133. defMutation = new EventDefMutation();
  3134. defMutation.eventDefId = eventDefId;
  3135. defMutation.className = className;
  3136. defMutation.verbatimStandardProps = verbatimStandardProps;
  3137. defMutation.miscProps = miscProps;
  3138. if (dateMutation) {
  3139. defMutation.dateMutation = dateMutation;
  3140. }
  3141. return defMutation;
  3142. };
  3143. /*
  3144. eventDef assumed to be a SingleEventDef.
  3145. returns an undo function.
  3146. */
  3147. EventDefMutation.prototype.mutateSingle = function (eventDef) {
  3148. var origDateProfile;
  3149. if (this.dateMutation) {
  3150. origDateProfile = eventDef.dateProfile;
  3151. eventDef.dateProfile = this.dateMutation.buildNewDateProfile(origDateProfile, eventDef.source.calendar);
  3152. }
  3153. // can't undo
  3154. // TODO: more DRY with EventDef::applyManualStandardProps
  3155. if (this.eventDefId != null) {
  3156. eventDef.id = EventDef_1.default.normalizeId((eventDef.rawId = this.eventDefId));
  3157. }
  3158. // can't undo
  3159. // TODO: more DRY with EventDef::applyManualStandardProps
  3160. if (this.className) {
  3161. eventDef.className = this.className;
  3162. }
  3163. // can't undo
  3164. if (this.verbatimStandardProps) {
  3165. SingleEventDef_1.default.copyVerbatimStandardProps(this.verbatimStandardProps, // src
  3166. eventDef // dest
  3167. );
  3168. }
  3169. // can't undo
  3170. if (this.miscProps) {
  3171. eventDef.applyMiscProps(this.miscProps);
  3172. }
  3173. if (origDateProfile) {
  3174. return function () {
  3175. eventDef.dateProfile = origDateProfile;
  3176. };
  3177. }
  3178. else {
  3179. return function () { };
  3180. }
  3181. };
  3182. EventDefMutation.prototype.setDateMutation = function (dateMutation) {
  3183. if (dateMutation && !dateMutation.isEmpty()) {
  3184. this.dateMutation = dateMutation;
  3185. }
  3186. else {
  3187. this.dateMutation = null;
  3188. }
  3189. };
  3190. EventDefMutation.prototype.isEmpty = function () {
  3191. return !this.dateMutation;
  3192. };
  3193. return EventDefMutation;
  3194. }());
  3195. exports.default = EventDefMutation;
  3196. /***/ }),
  3197. /* 40 */
  3198. /***/ (function(module, exports, __webpack_require__) {
  3199. Object.defineProperty(exports, "__esModule", { value: true });
  3200. var util_1 = __webpack_require__(4);
  3201. var EventDateProfile_1 = __webpack_require__(16);
  3202. var EventDefDateMutation = /** @class */ (function () {
  3203. function EventDefDateMutation() {
  3204. this.clearEnd = false;
  3205. this.forceTimed = false;
  3206. this.forceAllDay = false;
  3207. }
  3208. EventDefDateMutation.createFromDiff = function (dateProfile0, dateProfile1, largeUnit) {
  3209. var clearEnd = dateProfile0.end && !dateProfile1.end;
  3210. var forceTimed = dateProfile0.isAllDay() && !dateProfile1.isAllDay();
  3211. var forceAllDay = !dateProfile0.isAllDay() && dateProfile1.isAllDay();
  3212. var dateDelta;
  3213. var endDiff;
  3214. var endDelta;
  3215. var mutation;
  3216. // subtracts the dates in the appropriate way, returning a duration
  3217. function subtractDates(date1, date0) {
  3218. if (largeUnit) {
  3219. return util_1.diffByUnit(date1, date0, largeUnit); // poorly named
  3220. }
  3221. else if (dateProfile1.isAllDay()) {
  3222. return util_1.diffDay(date1, date0); // poorly named
  3223. }
  3224. else {
  3225. return util_1.diffDayTime(date1, date0); // poorly named
  3226. }
  3227. }
  3228. dateDelta = subtractDates(dateProfile1.start, dateProfile0.start);
  3229. if (dateProfile1.end) {
  3230. // use unzonedRanges because dateProfile0.end might be null
  3231. endDiff = subtractDates(dateProfile1.unzonedRange.getEnd(), dateProfile0.unzonedRange.getEnd());
  3232. endDelta = endDiff.subtract(dateDelta);
  3233. }
  3234. mutation = new EventDefDateMutation();
  3235. mutation.clearEnd = clearEnd;
  3236. mutation.forceTimed = forceTimed;
  3237. mutation.forceAllDay = forceAllDay;
  3238. mutation.setDateDelta(dateDelta);
  3239. mutation.setEndDelta(endDelta);
  3240. return mutation;
  3241. };
  3242. /*
  3243. returns an undo function.
  3244. */
  3245. EventDefDateMutation.prototype.buildNewDateProfile = function (eventDateProfile, calendar) {
  3246. var start = eventDateProfile.start.clone();
  3247. var end = null;
  3248. var shouldRezone = false;
  3249. if (eventDateProfile.end && !this.clearEnd) {
  3250. end = eventDateProfile.end.clone();
  3251. }
  3252. else if (this.endDelta && !end) {
  3253. end = calendar.getDefaultEventEnd(eventDateProfile.isAllDay(), start);
  3254. }
  3255. if (this.forceTimed) {
  3256. shouldRezone = true;
  3257. if (!start.hasTime()) {
  3258. start.time(0);
  3259. }
  3260. if (end && !end.hasTime()) {
  3261. end.time(0);
  3262. }
  3263. }
  3264. else if (this.forceAllDay) {
  3265. if (start.hasTime()) {
  3266. start.stripTime();
  3267. }
  3268. if (end && end.hasTime()) {
  3269. end.stripTime();
  3270. }
  3271. }
  3272. if (this.dateDelta) {
  3273. shouldRezone = true;
  3274. start.add(this.dateDelta);
  3275. if (end) {
  3276. end.add(this.dateDelta);
  3277. }
  3278. }
  3279. // do this before adding startDelta to start, so we can work off of start
  3280. if (this.endDelta) {
  3281. shouldRezone = true;
  3282. end.add(this.endDelta);
  3283. }
  3284. if (this.startDelta) {
  3285. shouldRezone = true;
  3286. start.add(this.startDelta);
  3287. }
  3288. if (shouldRezone) {
  3289. start = calendar.applyTimezone(start);
  3290. if (end) {
  3291. end = calendar.applyTimezone(end);
  3292. }
  3293. }
  3294. // TODO: okay to access calendar option?
  3295. if (!end && calendar.opt('forceEventDuration')) {
  3296. end = calendar.getDefaultEventEnd(eventDateProfile.isAllDay(), start);
  3297. }
  3298. return new EventDateProfile_1.default(start, end, calendar);
  3299. };
  3300. EventDefDateMutation.prototype.setDateDelta = function (dateDelta) {
  3301. if (dateDelta && dateDelta.valueOf()) {
  3302. this.dateDelta = dateDelta;
  3303. }
  3304. else {
  3305. this.dateDelta = null;
  3306. }
  3307. };
  3308. EventDefDateMutation.prototype.setStartDelta = function (startDelta) {
  3309. if (startDelta && startDelta.valueOf()) {
  3310. this.startDelta = startDelta;
  3311. }
  3312. else {
  3313. this.startDelta = null;
  3314. }
  3315. };
  3316. EventDefDateMutation.prototype.setEndDelta = function (endDelta) {
  3317. if (endDelta && endDelta.valueOf()) {
  3318. this.endDelta = endDelta;
  3319. }
  3320. else {
  3321. this.endDelta = null;
  3322. }
  3323. };
  3324. EventDefDateMutation.prototype.isEmpty = function () {
  3325. return !this.clearEnd && !this.forceTimed && !this.forceAllDay &&
  3326. !this.dateDelta && !this.startDelta && !this.endDelta;
  3327. };
  3328. return EventDefDateMutation;
  3329. }());
  3330. exports.default = EventDefDateMutation;
  3331. /***/ }),
  3332. /* 41 */
  3333. /***/ (function(module, exports, __webpack_require__) {
  3334. Object.defineProperty(exports, "__esModule", { value: true });
  3335. var tslib_1 = __webpack_require__(2);
  3336. var $ = __webpack_require__(3);
  3337. var util_1 = __webpack_require__(4);
  3338. var Class_1 = __webpack_require__(35);
  3339. /*
  3340. Embodies a div that has potential scrollbars
  3341. */
  3342. var Scroller = /** @class */ (function (_super) {
  3343. tslib_1.__extends(Scroller, _super);
  3344. function Scroller(options) {
  3345. var _this = _super.call(this) || this;
  3346. options = options || {};
  3347. _this.overflowX = options.overflowX || options.overflow || 'auto';
  3348. _this.overflowY = options.overflowY || options.overflow || 'auto';
  3349. return _this;
  3350. }
  3351. Scroller.prototype.render = function () {
  3352. this.el = this.renderEl();
  3353. this.applyOverflow();
  3354. };
  3355. Scroller.prototype.renderEl = function () {
  3356. return (this.scrollEl = $('<div class="fc-scroller"></div>'));
  3357. };
  3358. // sets to natural height, unlocks overflow
  3359. Scroller.prototype.clear = function () {
  3360. this.setHeight('auto');
  3361. this.applyOverflow();
  3362. };
  3363. Scroller.prototype.destroy = function () {
  3364. this.el.remove();
  3365. };
  3366. // Overflow
  3367. // -----------------------------------------------------------------------------------------------------------------
  3368. Scroller.prototype.applyOverflow = function () {
  3369. this.scrollEl.css({
  3370. 'overflow-x': this.overflowX,
  3371. 'overflow-y': this.overflowY
  3372. });
  3373. };
  3374. // Causes any 'auto' overflow values to resolves to 'scroll' or 'hidden'.
  3375. // Useful for preserving scrollbar widths regardless of future resizes.
  3376. // Can pass in scrollbarWidths for optimization.
  3377. Scroller.prototype.lockOverflow = function (scrollbarWidths) {
  3378. var overflowX = this.overflowX;
  3379. var overflowY = this.overflowY;
  3380. scrollbarWidths = scrollbarWidths || this.getScrollbarWidths();
  3381. if (overflowX === 'auto') {
  3382. overflowX = (scrollbarWidths.top || scrollbarWidths.bottom || // horizontal scrollbars?
  3383. // OR scrolling pane with massless scrollbars?
  3384. this.scrollEl[0].scrollWidth - 1 > this.scrollEl[0].clientWidth
  3385. // subtract 1 because of IE off-by-one issue
  3386. ) ? 'scroll' : 'hidden';
  3387. }
  3388. if (overflowY === 'auto') {
  3389. overflowY = (scrollbarWidths.left || scrollbarWidths.right || // vertical scrollbars?
  3390. // OR scrolling pane with massless scrollbars?
  3391. this.scrollEl[0].scrollHeight - 1 > this.scrollEl[0].clientHeight
  3392. // subtract 1 because of IE off-by-one issue
  3393. ) ? 'scroll' : 'hidden';
  3394. }
  3395. this.scrollEl.css({ 'overflow-x': overflowX, 'overflow-y': overflowY });
  3396. };
  3397. // Getters / Setters
  3398. // -----------------------------------------------------------------------------------------------------------------
  3399. Scroller.prototype.setHeight = function (height) {
  3400. this.scrollEl.height(height);
  3401. };
  3402. Scroller.prototype.getScrollTop = function () {
  3403. return this.scrollEl.scrollTop();
  3404. };
  3405. Scroller.prototype.setScrollTop = function (top) {
  3406. this.scrollEl.scrollTop(top);
  3407. };
  3408. Scroller.prototype.getClientWidth = function () {
  3409. return this.scrollEl[0].clientWidth;
  3410. };
  3411. Scroller.prototype.getClientHeight = function () {
  3412. return this.scrollEl[0].clientHeight;
  3413. };
  3414. Scroller.prototype.getScrollbarWidths = function () {
  3415. return util_1.getScrollbarWidths(this.scrollEl);
  3416. };
  3417. return Scroller;
  3418. }(Class_1.default));
  3419. exports.default = Scroller;
  3420. /***/ }),
  3421. /* 42 */
  3422. /***/ (function(module, exports, __webpack_require__) {
  3423. Object.defineProperty(exports, "__esModule", { value: true });
  3424. var tslib_1 = __webpack_require__(2);
  3425. var $ = __webpack_require__(3);
  3426. var util_1 = __webpack_require__(4);
  3427. var DateComponent_1 = __webpack_require__(231);
  3428. var GlobalEmitter_1 = __webpack_require__(23);
  3429. var InteractiveDateComponent = /** @class */ (function (_super) {
  3430. tslib_1.__extends(InteractiveDateComponent, _super);
  3431. function InteractiveDateComponent(_view, _options) {
  3432. var _this = _super.call(this, _view, _options) || this;
  3433. // self-config, overridable by subclasses
  3434. _this.segSelector = '.fc-event-container > *'; // what constitutes an event element?
  3435. if (_this.dateSelectingClass) {
  3436. _this.dateClicking = new _this.dateClickingClass(_this);
  3437. }
  3438. if (_this.dateSelectingClass) {
  3439. _this.dateSelecting = new _this.dateSelectingClass(_this);
  3440. }
  3441. if (_this.eventPointingClass) {
  3442. _this.eventPointing = new _this.eventPointingClass(_this);
  3443. }
  3444. if (_this.eventDraggingClass && _this.eventPointing) {
  3445. _this.eventDragging = new _this.eventDraggingClass(_this, _this.eventPointing);
  3446. }
  3447. if (_this.eventResizingClass && _this.eventPointing) {
  3448. _this.eventResizing = new _this.eventResizingClass(_this, _this.eventPointing);
  3449. }
  3450. if (_this.externalDroppingClass) {
  3451. _this.externalDropping = new _this.externalDroppingClass(_this);
  3452. }
  3453. return _this;
  3454. }
  3455. // Sets the container element that the view should render inside of, does global DOM-related initializations,
  3456. // and renders all the non-date-related content inside.
  3457. InteractiveDateComponent.prototype.setElement = function (el) {
  3458. _super.prototype.setElement.call(this, el);
  3459. if (this.dateClicking) {
  3460. this.dateClicking.bindToEl(el);
  3461. }
  3462. if (this.dateSelecting) {
  3463. this.dateSelecting.bindToEl(el);
  3464. }
  3465. this.bindAllSegHandlersToEl(el);
  3466. };
  3467. InteractiveDateComponent.prototype.removeElement = function () {
  3468. this.endInteractions();
  3469. _super.prototype.removeElement.call(this);
  3470. };
  3471. InteractiveDateComponent.prototype.executeEventUnrender = function () {
  3472. this.endInteractions();
  3473. _super.prototype.executeEventUnrender.call(this);
  3474. };
  3475. InteractiveDateComponent.prototype.bindGlobalHandlers = function () {
  3476. _super.prototype.bindGlobalHandlers.call(this);
  3477. if (this.externalDropping) {
  3478. this.externalDropping.bindToDocument();
  3479. }
  3480. };
  3481. InteractiveDateComponent.prototype.unbindGlobalHandlers = function () {
  3482. _super.prototype.unbindGlobalHandlers.call(this);
  3483. if (this.externalDropping) {
  3484. this.externalDropping.unbindFromDocument();
  3485. }
  3486. };
  3487. InteractiveDateComponent.prototype.bindDateHandlerToEl = function (el, name, handler) {
  3488. var _this = this;
  3489. // attach a handler to the grid's root element.
  3490. // jQuery will take care of unregistering them when removeElement gets called.
  3491. this.el.on(name, function (ev) {
  3492. if (!$(ev.target).is(_this.segSelector + ':not(.fc-helper),' + // directly on an event element
  3493. _this.segSelector + ':not(.fc-helper) *,' + // within an event element
  3494. '.fc-more,' + // a "more.." link
  3495. 'a[data-goto]' // a clickable nav link
  3496. )) {
  3497. return handler.call(_this, ev);
  3498. }
  3499. });
  3500. };
  3501. InteractiveDateComponent.prototype.bindAllSegHandlersToEl = function (el) {
  3502. [
  3503. this.eventPointing,
  3504. this.eventDragging,
  3505. this.eventResizing
  3506. ].forEach(function (eventInteraction) {
  3507. if (eventInteraction) {
  3508. eventInteraction.bindToEl(el);
  3509. }
  3510. });
  3511. };
  3512. InteractiveDateComponent.prototype.bindSegHandlerToEl = function (el, name, handler) {
  3513. var _this = this;
  3514. el.on(name, this.segSelector, function (ev) {
  3515. var segEl = $(ev.currentTarget);
  3516. if (!segEl.is('.fc-helper')) {
  3517. var seg = segEl.data('fc-seg'); // grab segment data. put there by View::renderEventsPayload
  3518. if (seg && !_this.shouldIgnoreEventPointing()) {
  3519. return handler.call(_this, seg, ev); // context will be the Grid
  3520. }
  3521. }
  3522. });
  3523. };
  3524. InteractiveDateComponent.prototype.shouldIgnoreMouse = function () {
  3525. // HACK
  3526. // This will still work even though bindDateHandlerToEl doesn't use GlobalEmitter.
  3527. return GlobalEmitter_1.default.get().shouldIgnoreMouse();
  3528. };
  3529. InteractiveDateComponent.prototype.shouldIgnoreTouch = function () {
  3530. var view = this._getView();
  3531. // On iOS (and Android?) when a new selection is initiated overtop another selection,
  3532. // the touchend never fires because the elements gets removed mid-touch-interaction (my theory).
  3533. // HACK: simply don't allow this to happen.
  3534. // ALSO: prevent selection when an *event* is already raised.
  3535. return view.isSelected || view.selectedEvent;
  3536. };
  3537. InteractiveDateComponent.prototype.shouldIgnoreEventPointing = function () {
  3538. // only call the handlers if there is not a drag/resize in progress
  3539. return (this.eventDragging && this.eventDragging.isDragging) ||
  3540. (this.eventResizing && this.eventResizing.isResizing);
  3541. };
  3542. InteractiveDateComponent.prototype.canStartSelection = function (seg, ev) {
  3543. return util_1.getEvIsTouch(ev) &&
  3544. !this.canStartResize(seg, ev) &&
  3545. (this.isEventDefDraggable(seg.footprint.eventDef) ||
  3546. this.isEventDefResizable(seg.footprint.eventDef));
  3547. };
  3548. InteractiveDateComponent.prototype.canStartDrag = function (seg, ev) {
  3549. return !this.canStartResize(seg, ev) &&
  3550. this.isEventDefDraggable(seg.footprint.eventDef);
  3551. };
  3552. InteractiveDateComponent.prototype.canStartResize = function (seg, ev) {
  3553. var view = this._getView();
  3554. var eventDef = seg.footprint.eventDef;
  3555. return (!util_1.getEvIsTouch(ev) || view.isEventDefSelected(eventDef)) &&
  3556. this.isEventDefResizable(eventDef) &&
  3557. $(ev.target).is('.fc-resizer');
  3558. };
  3559. // Kills all in-progress dragging.
  3560. // Useful for when public API methods that result in re-rendering are invoked during a drag.
  3561. // Also useful for when touch devices misbehave and don't fire their touchend.
  3562. InteractiveDateComponent.prototype.endInteractions = function () {
  3563. [
  3564. this.dateClicking,
  3565. this.dateSelecting,
  3566. this.eventPointing,
  3567. this.eventDragging,
  3568. this.eventResizing
  3569. ].forEach(function (interaction) {
  3570. if (interaction) {
  3571. interaction.end();
  3572. }
  3573. });
  3574. };
  3575. // Event Drag-n-Drop
  3576. // ---------------------------------------------------------------------------------------------------------------
  3577. // Computes if the given event is allowed to be dragged by the user
  3578. InteractiveDateComponent.prototype.isEventDefDraggable = function (eventDef) {
  3579. return this.isEventDefStartEditable(eventDef);
  3580. };
  3581. InteractiveDateComponent.prototype.isEventDefStartEditable = function (eventDef) {
  3582. var isEditable = eventDef.isStartExplicitlyEditable();
  3583. if (isEditable == null) {
  3584. isEditable = this.opt('eventStartEditable');
  3585. if (isEditable == null) {
  3586. isEditable = this.isEventDefGenerallyEditable(eventDef);
  3587. }
  3588. }
  3589. return isEditable;
  3590. };
  3591. InteractiveDateComponent.prototype.isEventDefGenerallyEditable = function (eventDef) {
  3592. var isEditable = eventDef.isExplicitlyEditable();
  3593. if (isEditable == null) {
  3594. isEditable = this.opt('editable');
  3595. }
  3596. return isEditable;
  3597. };
  3598. // Event Resizing
  3599. // ---------------------------------------------------------------------------------------------------------------
  3600. // Computes if the given event is allowed to be resized from its starting edge
  3601. InteractiveDateComponent.prototype.isEventDefResizableFromStart = function (eventDef) {
  3602. return this.opt('eventResizableFromStart') && this.isEventDefResizable(eventDef);
  3603. };
  3604. // Computes if the given event is allowed to be resized from its ending edge
  3605. InteractiveDateComponent.prototype.isEventDefResizableFromEnd = function (eventDef) {
  3606. return this.isEventDefResizable(eventDef);
  3607. };
  3608. // Computes if the given event is allowed to be resized by the user at all
  3609. InteractiveDateComponent.prototype.isEventDefResizable = function (eventDef) {
  3610. var isResizable = eventDef.isDurationExplicitlyEditable();
  3611. if (isResizable == null) {
  3612. isResizable = this.opt('eventDurationEditable');
  3613. if (isResizable == null) {
  3614. isResizable = this.isEventDefGenerallyEditable(eventDef);
  3615. }
  3616. }
  3617. return isResizable;
  3618. };
  3619. // Event Mutation / Constraints
  3620. // ---------------------------------------------------------------------------------------------------------------
  3621. // Diffs the two dates, returning a duration, based on granularity of the grid
  3622. // TODO: port isTimeScale into this system?
  3623. InteractiveDateComponent.prototype.diffDates = function (a, b) {
  3624. if (this.largeUnit) {
  3625. return util_1.diffByUnit(a, b, this.largeUnit);
  3626. }
  3627. else {
  3628. return util_1.diffDayTime(a, b);
  3629. }
  3630. };
  3631. // is it allowed, in relation to the view's validRange?
  3632. // NOTE: very similar to isExternalInstanceGroupAllowed
  3633. InteractiveDateComponent.prototype.isEventInstanceGroupAllowed = function (eventInstanceGroup) {
  3634. var view = this._getView();
  3635. var dateProfile = this.dateProfile;
  3636. var eventFootprints = this.eventRangesToEventFootprints(eventInstanceGroup.getAllEventRanges());
  3637. var i;
  3638. for (i = 0; i < eventFootprints.length; i++) {
  3639. // TODO: just use getAllEventRanges directly
  3640. if (!dateProfile.validUnzonedRange.containsRange(eventFootprints[i].componentFootprint.unzonedRange)) {
  3641. return false;
  3642. }
  3643. }
  3644. return view.calendar.constraints.isEventInstanceGroupAllowed(eventInstanceGroup);
  3645. };
  3646. // NOTE: very similar to isEventInstanceGroupAllowed
  3647. // when it's a completely anonymous external drag, no event.
  3648. InteractiveDateComponent.prototype.isExternalInstanceGroupAllowed = function (eventInstanceGroup) {
  3649. var view = this._getView();
  3650. var dateProfile = this.dateProfile;
  3651. var eventFootprints = this.eventRangesToEventFootprints(eventInstanceGroup.getAllEventRanges());
  3652. var i;
  3653. for (i = 0; i < eventFootprints.length; i++) {
  3654. if (!dateProfile.validUnzonedRange.containsRange(eventFootprints[i].componentFootprint.unzonedRange)) {
  3655. return false;
  3656. }
  3657. }
  3658. for (i = 0; i < eventFootprints.length; i++) {
  3659. // treat it as a selection
  3660. // TODO: pass in eventInstanceGroup instead
  3661. // because we don't want calendar's constraint system to depend on a component's
  3662. // determination of footprints.
  3663. if (!view.calendar.constraints.isSelectionFootprintAllowed(eventFootprints[i].componentFootprint)) {
  3664. return false;
  3665. }
  3666. }
  3667. return true;
  3668. };
  3669. return InteractiveDateComponent;
  3670. }(DateComponent_1.default));
  3671. exports.default = InteractiveDateComponent;
  3672. /***/ }),
  3673. /* 43 */
  3674. /***/ (function(module, exports, __webpack_require__) {
  3675. Object.defineProperty(exports, "__esModule", { value: true });
  3676. var tslib_1 = __webpack_require__(2);
  3677. var $ = __webpack_require__(3);
  3678. var moment = __webpack_require__(0);
  3679. var util_1 = __webpack_require__(4);
  3680. var RenderQueue_1 = __webpack_require__(229);
  3681. var DateProfileGenerator_1 = __webpack_require__(55);
  3682. var InteractiveDateComponent_1 = __webpack_require__(42);
  3683. var GlobalEmitter_1 = __webpack_require__(23);
  3684. var UnzonedRange_1 = __webpack_require__(5);
  3685. /* An abstract class from which other views inherit from
  3686. ----------------------------------------------------------------------------------------------------------------------*/
  3687. var View = /** @class */ (function (_super) {
  3688. tslib_1.__extends(View, _super);
  3689. function View(calendar, viewSpec) {
  3690. var _this = _super.call(this, null, viewSpec.options) || this;
  3691. _this.batchRenderDepth = 0;
  3692. _this.isSelected = false; // boolean whether a range of time is user-selected or not
  3693. _this.calendar = calendar;
  3694. _this.viewSpec = viewSpec;
  3695. // shortcuts
  3696. _this.type = viewSpec.type;
  3697. // .name is deprecated
  3698. _this.name = _this.type;
  3699. _this.initRenderQueue();
  3700. _this.initHiddenDays();
  3701. _this.dateProfileGenerator = new _this.dateProfileGeneratorClass(_this);
  3702. _this.bindBaseRenderHandlers();
  3703. _this.eventOrderSpecs = util_1.parseFieldSpecs(_this.opt('eventOrder'));
  3704. // legacy
  3705. if (_this['initialize']) {
  3706. _this['initialize']();
  3707. }
  3708. return _this;
  3709. }
  3710. View.prototype._getView = function () {
  3711. return this;
  3712. };
  3713. // Retrieves an option with the given name
  3714. View.prototype.opt = function (name) {
  3715. return this.options[name];
  3716. };
  3717. /* Render Queue
  3718. ------------------------------------------------------------------------------------------------------------------*/
  3719. View.prototype.initRenderQueue = function () {
  3720. this.renderQueue = new RenderQueue_1.default({
  3721. event: this.opt('eventRenderWait')
  3722. });
  3723. this.renderQueue.on('start', this.onRenderQueueStart.bind(this));
  3724. this.renderQueue.on('stop', this.onRenderQueueStop.bind(this));
  3725. this.on('before:change', this.startBatchRender);
  3726. this.on('change', this.stopBatchRender);
  3727. };
  3728. View.prototype.onRenderQueueStart = function () {
  3729. this.calendar.freezeContentHeight();
  3730. this.addScroll(this.queryScroll());
  3731. };
  3732. View.prototype.onRenderQueueStop = function () {
  3733. if (this.calendar.updateViewSize()) { // success?
  3734. this.popScroll();
  3735. }
  3736. this.calendar.thawContentHeight();
  3737. };
  3738. View.prototype.startBatchRender = function () {
  3739. if (!(this.batchRenderDepth++)) {
  3740. this.renderQueue.pause();
  3741. }
  3742. };
  3743. View.prototype.stopBatchRender = function () {
  3744. if (!(--this.batchRenderDepth)) {
  3745. this.renderQueue.resume();
  3746. }
  3747. };
  3748. View.prototype.requestRender = function (func, namespace, actionType) {
  3749. this.renderQueue.queue(func, namespace, actionType);
  3750. };
  3751. // given func will auto-bind to `this`
  3752. View.prototype.whenSizeUpdated = function (func) {
  3753. if (this.renderQueue.isRunning) {
  3754. this.renderQueue.one('stop', func.bind(this));
  3755. }
  3756. else {
  3757. func.call(this);
  3758. }
  3759. };
  3760. /* Title and Date Formatting
  3761. ------------------------------------------------------------------------------------------------------------------*/
  3762. // Computes what the title at the top of the calendar should be for this view
  3763. View.prototype.computeTitle = function (dateProfile) {
  3764. var unzonedRange;
  3765. // for views that span a large unit of time, show the proper interval, ignoring stray days before and after
  3766. if (/^(year|month)$/.test(dateProfile.currentRangeUnit)) {
  3767. unzonedRange = dateProfile.currentUnzonedRange;
  3768. }
  3769. else { // for day units or smaller, use the actual day range
  3770. unzonedRange = dateProfile.activeUnzonedRange;
  3771. }
  3772. return this.formatRange({
  3773. start: this.calendar.msToMoment(unzonedRange.startMs, dateProfile.isRangeAllDay),
  3774. end: this.calendar.msToMoment(unzonedRange.endMs, dateProfile.isRangeAllDay)
  3775. }, dateProfile.isRangeAllDay, this.opt('titleFormat') || this.computeTitleFormat(dateProfile), this.opt('titleRangeSeparator'));
  3776. };
  3777. // Generates the format string that should be used to generate the title for the current date range.
  3778. // Attempts to compute the most appropriate format if not explicitly specified with `titleFormat`.
  3779. View.prototype.computeTitleFormat = function (dateProfile) {
  3780. var currentRangeUnit = dateProfile.currentRangeUnit;
  3781. if (currentRangeUnit === 'year') {
  3782. return 'YYYY';
  3783. }
  3784. else if (currentRangeUnit === 'month') {
  3785. return this.opt('monthYearFormat'); // like "September 2014"
  3786. }
  3787. else if (dateProfile.currentUnzonedRange.as('days') > 1) {
  3788. return 'll'; // multi-day range. shorter, like "Sep 9 - 10 2014"
  3789. }
  3790. else {
  3791. return 'LL'; // one day. longer, like "September 9 2014"
  3792. }
  3793. };
  3794. // Date Setting/Unsetting
  3795. // -----------------------------------------------------------------------------------------------------------------
  3796. View.prototype.setDate = function (date) {
  3797. var currentDateProfile = this.get('dateProfile');
  3798. var newDateProfile = this.dateProfileGenerator.build(date, undefined, true); // forceToValid=true
  3799. if (!currentDateProfile ||
  3800. !currentDateProfile.activeUnzonedRange.equals(newDateProfile.activeUnzonedRange)) {
  3801. this.set('dateProfile', newDateProfile);
  3802. }
  3803. };
  3804. View.prototype.unsetDate = function () {
  3805. this.unset('dateProfile');
  3806. };
  3807. // Event Data
  3808. // -----------------------------------------------------------------------------------------------------------------
  3809. View.prototype.fetchInitialEvents = function (dateProfile) {
  3810. var calendar = this.calendar;
  3811. var forceAllDay = dateProfile.isRangeAllDay && !this.usesMinMaxTime;
  3812. return calendar.requestEvents(calendar.msToMoment(dateProfile.activeUnzonedRange.startMs, forceAllDay), calendar.msToMoment(dateProfile.activeUnzonedRange.endMs, forceAllDay));
  3813. };
  3814. View.prototype.bindEventChanges = function () {
  3815. this.listenTo(this.calendar, 'eventsReset', this.resetEvents); // TODO: make this a real event
  3816. };
  3817. View.prototype.unbindEventChanges = function () {
  3818. this.stopListeningTo(this.calendar, 'eventsReset');
  3819. };
  3820. View.prototype.setEvents = function (eventsPayload) {
  3821. this.set('currentEvents', eventsPayload);
  3822. this.set('hasEvents', true);
  3823. };
  3824. View.prototype.unsetEvents = function () {
  3825. this.unset('currentEvents');
  3826. this.unset('hasEvents');
  3827. };
  3828. View.prototype.resetEvents = function (eventsPayload) {
  3829. this.startBatchRender();
  3830. this.unsetEvents();
  3831. this.setEvents(eventsPayload);
  3832. this.stopBatchRender();
  3833. };
  3834. // Date High-level Rendering
  3835. // -----------------------------------------------------------------------------------------------------------------
  3836. View.prototype.requestDateRender = function (dateProfile) {
  3837. var _this = this;
  3838. this.requestRender(function () {
  3839. _this.executeDateRender(dateProfile);
  3840. }, 'date', 'init');
  3841. };
  3842. View.prototype.requestDateUnrender = function () {
  3843. var _this = this;
  3844. this.requestRender(function () {
  3845. _this.executeDateUnrender();
  3846. }, 'date', 'destroy');
  3847. };
  3848. // if dateProfile not specified, uses current
  3849. View.prototype.executeDateRender = function (dateProfile) {
  3850. _super.prototype.executeDateRender.call(this, dateProfile);
  3851. if (this['render']) {
  3852. this['render'](); // TODO: deprecate
  3853. }
  3854. this.trigger('datesRendered');
  3855. this.addScroll({ isDateInit: true });
  3856. this.startNowIndicator(); // shouldn't render yet because updateSize will be called soon
  3857. };
  3858. View.prototype.executeDateUnrender = function () {
  3859. this.unselect();
  3860. this.stopNowIndicator();
  3861. this.trigger('before:datesUnrendered');
  3862. if (this['destroy']) {
  3863. this['destroy'](); // TODO: deprecate
  3864. }
  3865. _super.prototype.executeDateUnrender.call(this);
  3866. };
  3867. // "Base" rendering
  3868. // -----------------------------------------------------------------------------------------------------------------
  3869. View.prototype.bindBaseRenderHandlers = function () {
  3870. var _this = this;
  3871. this.on('datesRendered', function () {
  3872. _this.whenSizeUpdated(_this.triggerViewRender);
  3873. });
  3874. this.on('before:datesUnrendered', function () {
  3875. _this.triggerViewDestroy();
  3876. });
  3877. };
  3878. View.prototype.triggerViewRender = function () {
  3879. this.publiclyTrigger('viewRender', {
  3880. context: this,
  3881. args: [this, this.el]
  3882. });
  3883. };
  3884. View.prototype.triggerViewDestroy = function () {
  3885. this.publiclyTrigger('viewDestroy', {
  3886. context: this,
  3887. args: [this, this.el]
  3888. });
  3889. };
  3890. // Event High-level Rendering
  3891. // -----------------------------------------------------------------------------------------------------------------
  3892. View.prototype.requestEventsRender = function (eventsPayload) {
  3893. var _this = this;
  3894. this.requestRender(function () {
  3895. _this.executeEventRender(eventsPayload);
  3896. _this.whenSizeUpdated(_this.triggerAfterEventsRendered);
  3897. }, 'event', 'init');
  3898. };
  3899. View.prototype.requestEventsUnrender = function () {
  3900. var _this = this;
  3901. this.requestRender(function () {
  3902. _this.triggerBeforeEventsDestroyed();
  3903. _this.executeEventUnrender();
  3904. }, 'event', 'destroy');
  3905. };
  3906. // Business Hour High-level Rendering
  3907. // -----------------------------------------------------------------------------------------------------------------
  3908. View.prototype.requestBusinessHoursRender = function (businessHourGenerator) {
  3909. var _this = this;
  3910. this.requestRender(function () {
  3911. _this.renderBusinessHours(businessHourGenerator);
  3912. }, 'businessHours', 'init');
  3913. };
  3914. View.prototype.requestBusinessHoursUnrender = function () {
  3915. var _this = this;
  3916. this.requestRender(function () {
  3917. _this.unrenderBusinessHours();
  3918. }, 'businessHours', 'destroy');
  3919. };
  3920. // Misc view rendering utils
  3921. // -----------------------------------------------------------------------------------------------------------------
  3922. // Binds DOM handlers to elements that reside outside the view container, such as the document
  3923. View.prototype.bindGlobalHandlers = function () {
  3924. _super.prototype.bindGlobalHandlers.call(this);
  3925. this.listenTo(GlobalEmitter_1.default.get(), {
  3926. touchstart: this.processUnselect,
  3927. mousedown: this.handleDocumentMousedown
  3928. });
  3929. };
  3930. // Unbinds DOM handlers from elements that reside outside the view container
  3931. View.prototype.unbindGlobalHandlers = function () {
  3932. _super.prototype.unbindGlobalHandlers.call(this);
  3933. this.stopListeningTo(GlobalEmitter_1.default.get());
  3934. };
  3935. /* Now Indicator
  3936. ------------------------------------------------------------------------------------------------------------------*/
  3937. // Immediately render the current time indicator and begins re-rendering it at an interval,
  3938. // which is defined by this.getNowIndicatorUnit().
  3939. // TODO: somehow do this for the current whole day's background too
  3940. View.prototype.startNowIndicator = function () {
  3941. var _this = this;
  3942. var unit;
  3943. var update;
  3944. var delay; // ms wait value
  3945. if (this.opt('nowIndicator')) {
  3946. unit = this.getNowIndicatorUnit();
  3947. if (unit) {
  3948. update = util_1.proxy(this, 'updateNowIndicator'); // bind to `this`
  3949. this.initialNowDate = this.calendar.getNow();
  3950. this.initialNowQueriedMs = new Date().valueOf();
  3951. // wait until the beginning of the next interval
  3952. delay = this.initialNowDate.clone().startOf(unit).add(1, unit).valueOf() - this.initialNowDate.valueOf();
  3953. this.nowIndicatorTimeoutID = setTimeout(function () {
  3954. _this.nowIndicatorTimeoutID = null;
  3955. update();
  3956. delay = +moment.duration(1, unit);
  3957. delay = Math.max(100, delay); // prevent too frequent
  3958. _this.nowIndicatorIntervalID = setInterval(update, delay); // update every interval
  3959. }, delay);
  3960. }
  3961. // rendering will be initiated in updateSize
  3962. }
  3963. };
  3964. // rerenders the now indicator, computing the new current time from the amount of time that has passed
  3965. // since the initial getNow call.
  3966. View.prototype.updateNowIndicator = function () {
  3967. if (this.isDatesRendered &&
  3968. this.initialNowDate // activated before?
  3969. ) {
  3970. this.unrenderNowIndicator(); // won't unrender if unnecessary
  3971. this.renderNowIndicator(this.initialNowDate.clone().add(new Date().valueOf() - this.initialNowQueriedMs) // add ms
  3972. );
  3973. this.isNowIndicatorRendered = true;
  3974. }
  3975. };
  3976. // Immediately unrenders the view's current time indicator and stops any re-rendering timers.
  3977. // Won't cause side effects if indicator isn't rendered.
  3978. View.prototype.stopNowIndicator = function () {
  3979. if (this.isNowIndicatorRendered) {
  3980. if (this.nowIndicatorTimeoutID) {
  3981. clearTimeout(this.nowIndicatorTimeoutID);
  3982. this.nowIndicatorTimeoutID = null;
  3983. }
  3984. if (this.nowIndicatorIntervalID) {
  3985. clearInterval(this.nowIndicatorIntervalID);
  3986. this.nowIndicatorIntervalID = null;
  3987. }
  3988. this.unrenderNowIndicator();
  3989. this.isNowIndicatorRendered = false;
  3990. }
  3991. };
  3992. /* Dimensions
  3993. ------------------------------------------------------------------------------------------------------------------*/
  3994. View.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  3995. if (this['setHeight']) { // for legacy API
  3996. this['setHeight'](totalHeight, isAuto);
  3997. }
  3998. else {
  3999. _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
  4000. }
  4001. this.updateNowIndicator();
  4002. };
  4003. /* Scroller
  4004. ------------------------------------------------------------------------------------------------------------------*/
  4005. View.prototype.addScroll = function (scroll) {
  4006. var queuedScroll = this.queuedScroll || (this.queuedScroll = {});
  4007. $.extend(queuedScroll, scroll);
  4008. };
  4009. View.prototype.popScroll = function () {
  4010. this.applyQueuedScroll();
  4011. this.queuedScroll = null;
  4012. };
  4013. View.prototype.applyQueuedScroll = function () {
  4014. if (this.queuedScroll) {
  4015. this.applyScroll(this.queuedScroll);
  4016. }
  4017. };
  4018. View.prototype.queryScroll = function () {
  4019. var scroll = {};
  4020. if (this.isDatesRendered) {
  4021. $.extend(scroll, this.queryDateScroll());
  4022. }
  4023. return scroll;
  4024. };
  4025. View.prototype.applyScroll = function (scroll) {
  4026. if (scroll.isDateInit && this.isDatesRendered) {
  4027. $.extend(scroll, this.computeInitialDateScroll());
  4028. }
  4029. if (this.isDatesRendered) {
  4030. this.applyDateScroll(scroll);
  4031. }
  4032. };
  4033. View.prototype.computeInitialDateScroll = function () {
  4034. return {}; // subclasses must implement
  4035. };
  4036. View.prototype.queryDateScroll = function () {
  4037. return {}; // subclasses must implement
  4038. };
  4039. View.prototype.applyDateScroll = function (scroll) {
  4040. // subclasses must implement
  4041. };
  4042. /* Event Drag-n-Drop
  4043. ------------------------------------------------------------------------------------------------------------------*/
  4044. View.prototype.reportEventDrop = function (eventInstance, eventMutation, el, ev) {
  4045. var eventManager = this.calendar.eventManager;
  4046. var undoFunc = eventManager.mutateEventsWithId(eventInstance.def.id, eventMutation);
  4047. var dateMutation = eventMutation.dateMutation;
  4048. // update the EventInstance, for handlers
  4049. if (dateMutation) {
  4050. eventInstance.dateProfile = dateMutation.buildNewDateProfile(eventInstance.dateProfile, this.calendar);
  4051. }
  4052. this.triggerEventDrop(eventInstance,
  4053. // a drop doesn't necessarily mean a date mutation (ex: resource change)
  4054. (dateMutation && dateMutation.dateDelta) || moment.duration(), undoFunc, el, ev);
  4055. };
  4056. // Triggers event-drop handlers that have subscribed via the API
  4057. View.prototype.triggerEventDrop = function (eventInstance, dateDelta, undoFunc, el, ev) {
  4058. this.publiclyTrigger('eventDrop', {
  4059. context: el[0],
  4060. args: [
  4061. eventInstance.toLegacy(),
  4062. dateDelta,
  4063. undoFunc,
  4064. ev,
  4065. {},
  4066. this
  4067. ]
  4068. });
  4069. };
  4070. /* External Element Drag-n-Drop
  4071. ------------------------------------------------------------------------------------------------------------------*/
  4072. // Must be called when an external element, via jQuery UI, has been dropped onto the calendar.
  4073. // `meta` is the parsed data that has been embedded into the dragging event.
  4074. // `dropLocation` is an object that contains the new zoned start/end/allDay values for the event.
  4075. View.prototype.reportExternalDrop = function (singleEventDef, isEvent, isSticky, el, ev, ui) {
  4076. if (isEvent) {
  4077. this.calendar.eventManager.addEventDef(singleEventDef, isSticky);
  4078. }
  4079. this.triggerExternalDrop(singleEventDef, isEvent, el, ev, ui);
  4080. };
  4081. // Triggers external-drop handlers that have subscribed via the API
  4082. View.prototype.triggerExternalDrop = function (singleEventDef, isEvent, el, ev, ui) {
  4083. // trigger 'drop' regardless of whether element represents an event
  4084. this.publiclyTrigger('drop', {
  4085. context: el[0],
  4086. args: [
  4087. singleEventDef.dateProfile.start.clone(),
  4088. ev,
  4089. ui,
  4090. this
  4091. ]
  4092. });
  4093. if (isEvent) {
  4094. // signal an external event landed
  4095. this.publiclyTrigger('eventReceive', {
  4096. context: this,
  4097. args: [
  4098. singleEventDef.buildInstance().toLegacy(),
  4099. this
  4100. ]
  4101. });
  4102. }
  4103. };
  4104. /* Event Resizing
  4105. ------------------------------------------------------------------------------------------------------------------*/
  4106. // Must be called when an event in the view has been resized to a new length
  4107. View.prototype.reportEventResize = function (eventInstance, eventMutation, el, ev) {
  4108. var eventManager = this.calendar.eventManager;
  4109. var undoFunc = eventManager.mutateEventsWithId(eventInstance.def.id, eventMutation);
  4110. // update the EventInstance, for handlers
  4111. eventInstance.dateProfile = eventMutation.dateMutation.buildNewDateProfile(eventInstance.dateProfile, this.calendar);
  4112. var resizeDelta = eventMutation.dateMutation.endDelta || eventMutation.dateMutation.startDelta;
  4113. this.triggerEventResize(eventInstance, resizeDelta, undoFunc, el, ev);
  4114. };
  4115. // Triggers event-resize handlers that have subscribed via the API
  4116. View.prototype.triggerEventResize = function (eventInstance, resizeDelta, undoFunc, el, ev) {
  4117. this.publiclyTrigger('eventResize', {
  4118. context: el[0],
  4119. args: [
  4120. eventInstance.toLegacy(),
  4121. resizeDelta,
  4122. undoFunc,
  4123. ev,
  4124. {},
  4125. this
  4126. ]
  4127. });
  4128. };
  4129. /* Selection (time range)
  4130. ------------------------------------------------------------------------------------------------------------------*/
  4131. // Selects a date span on the view. `start` and `end` are both Moments.
  4132. // `ev` is the native mouse event that begin the interaction.
  4133. View.prototype.select = function (footprint, ev) {
  4134. this.unselect(ev);
  4135. this.renderSelectionFootprint(footprint);
  4136. this.reportSelection(footprint, ev);
  4137. };
  4138. View.prototype.renderSelectionFootprint = function (footprint) {
  4139. if (this['renderSelection']) { // legacy method in custom view classes
  4140. this['renderSelection'](footprint.toLegacy(this.calendar));
  4141. }
  4142. else {
  4143. _super.prototype.renderSelectionFootprint.call(this, footprint);
  4144. }
  4145. };
  4146. // Called when a new selection is made. Updates internal state and triggers handlers.
  4147. View.prototype.reportSelection = function (footprint, ev) {
  4148. this.isSelected = true;
  4149. this.triggerSelect(footprint, ev);
  4150. };
  4151. // Triggers handlers to 'select'
  4152. View.prototype.triggerSelect = function (footprint, ev) {
  4153. var dateProfile = this.calendar.footprintToDateProfile(footprint); // abuse of "Event"DateProfile?
  4154. this.publiclyTrigger('select', {
  4155. context: this,
  4156. args: [
  4157. dateProfile.start,
  4158. dateProfile.end,
  4159. ev,
  4160. this
  4161. ]
  4162. });
  4163. };
  4164. // Undoes a selection. updates in the internal state and triggers handlers.
  4165. // `ev` is the native mouse event that began the interaction.
  4166. View.prototype.unselect = function (ev) {
  4167. if (this.isSelected) {
  4168. this.isSelected = false;
  4169. if (this['destroySelection']) {
  4170. this['destroySelection'](); // TODO: deprecate
  4171. }
  4172. this.unrenderSelection();
  4173. this.publiclyTrigger('unselect', {
  4174. context: this,
  4175. args: [ev, this]
  4176. });
  4177. }
  4178. };
  4179. /* Event Selection
  4180. ------------------------------------------------------------------------------------------------------------------*/
  4181. View.prototype.selectEventInstance = function (eventInstance) {
  4182. if (!this.selectedEventInstance ||
  4183. this.selectedEventInstance !== eventInstance) {
  4184. this.unselectEventInstance();
  4185. this.getEventSegs().forEach(function (seg) {
  4186. if (seg.footprint.eventInstance === eventInstance &&
  4187. seg.el // necessary?
  4188. ) {
  4189. seg.el.addClass('fc-selected');
  4190. }
  4191. });
  4192. this.selectedEventInstance = eventInstance;
  4193. }
  4194. };
  4195. View.prototype.unselectEventInstance = function () {
  4196. if (this.selectedEventInstance) {
  4197. this.getEventSegs().forEach(function (seg) {
  4198. if (seg.el) { // necessary?
  4199. seg.el.removeClass('fc-selected');
  4200. }
  4201. });
  4202. this.selectedEventInstance = null;
  4203. }
  4204. };
  4205. View.prototype.isEventDefSelected = function (eventDef) {
  4206. // event references might change on refetchEvents(), while selectedEventInstance doesn't,
  4207. // so compare IDs
  4208. return this.selectedEventInstance && this.selectedEventInstance.def.id === eventDef.id;
  4209. };
  4210. /* Mouse / Touch Unselecting (time range & event unselection)
  4211. ------------------------------------------------------------------------------------------------------------------*/
  4212. // TODO: move consistently to down/start or up/end?
  4213. // TODO: don't kill previous selection if touch scrolling
  4214. View.prototype.handleDocumentMousedown = function (ev) {
  4215. if (util_1.isPrimaryMouseButton(ev)) {
  4216. this.processUnselect(ev);
  4217. }
  4218. };
  4219. View.prototype.processUnselect = function (ev) {
  4220. this.processRangeUnselect(ev);
  4221. this.processEventUnselect(ev);
  4222. };
  4223. View.prototype.processRangeUnselect = function (ev) {
  4224. var ignore;
  4225. // is there a time-range selection?
  4226. if (this.isSelected && this.opt('unselectAuto')) {
  4227. // only unselect if the clicked element is not identical to or inside of an 'unselectCancel' element
  4228. ignore = this.opt('unselectCancel');
  4229. if (!ignore || !$(ev.target).closest(ignore).length) {
  4230. this.unselect(ev);
  4231. }
  4232. }
  4233. };
  4234. View.prototype.processEventUnselect = function (ev) {
  4235. if (this.selectedEventInstance) {
  4236. if (!$(ev.target).closest('.fc-selected').length) {
  4237. this.unselectEventInstance();
  4238. }
  4239. }
  4240. };
  4241. /* Triggers
  4242. ------------------------------------------------------------------------------------------------------------------*/
  4243. View.prototype.triggerBaseRendered = function () {
  4244. this.publiclyTrigger('viewRender', {
  4245. context: this,
  4246. args: [this, this.el]
  4247. });
  4248. };
  4249. View.prototype.triggerBaseUnrendered = function () {
  4250. this.publiclyTrigger('viewDestroy', {
  4251. context: this,
  4252. args: [this, this.el]
  4253. });
  4254. };
  4255. // Triggers handlers to 'dayClick'
  4256. // Span has start/end of the clicked area. Only the start is useful.
  4257. View.prototype.triggerDayClick = function (footprint, dayEl, ev) {
  4258. var dateProfile = this.calendar.footprintToDateProfile(footprint); // abuse of "Event"DateProfile?
  4259. this.publiclyTrigger('dayClick', {
  4260. context: dayEl,
  4261. args: [dateProfile.start, ev, this]
  4262. });
  4263. };
  4264. /* Date Utils
  4265. ------------------------------------------------------------------------------------------------------------------*/
  4266. // For DateComponent::getDayClasses
  4267. View.prototype.isDateInOtherMonth = function (date, dateProfile) {
  4268. return false;
  4269. };
  4270. // Arguments after name will be forwarded to a hypothetical function value
  4271. // WARNING: passed-in arguments will be given to generator functions as-is and can cause side-effects.
  4272. // Always clone your objects if you fear mutation.
  4273. View.prototype.getUnzonedRangeOption = function (name) {
  4274. var val = this.opt(name);
  4275. if (typeof val === 'function') {
  4276. val = val.apply(null, Array.prototype.slice.call(arguments, 1));
  4277. }
  4278. if (val) {
  4279. return this.calendar.parseUnzonedRange(val);
  4280. }
  4281. };
  4282. /* Hidden Days
  4283. ------------------------------------------------------------------------------------------------------------------*/
  4284. // Initializes internal variables related to calculating hidden days-of-week
  4285. View.prototype.initHiddenDays = function () {
  4286. var hiddenDays = this.opt('hiddenDays') || []; // array of day-of-week indices that are hidden
  4287. var isHiddenDayHash = []; // is the day-of-week hidden? (hash with day-of-week-index -> bool)
  4288. var dayCnt = 0;
  4289. var i;
  4290. if (this.opt('weekends') === false) {
  4291. hiddenDays.push(0, 6); // 0=sunday, 6=saturday
  4292. }
  4293. for (i = 0; i < 7; i++) {
  4294. if (!(isHiddenDayHash[i] = $.inArray(i, hiddenDays) !== -1)) {
  4295. dayCnt++;
  4296. }
  4297. }
  4298. if (!dayCnt) {
  4299. throw new Error('invalid hiddenDays'); // all days were hidden? bad.
  4300. }
  4301. this.isHiddenDayHash = isHiddenDayHash;
  4302. };
  4303. // Remove days from the beginning and end of the range that are computed as hidden.
  4304. // If the whole range is trimmed off, returns null
  4305. View.prototype.trimHiddenDays = function (inputUnzonedRange) {
  4306. var start = inputUnzonedRange.getStart();
  4307. var end = inputUnzonedRange.getEnd();
  4308. if (start) {
  4309. start = this.skipHiddenDays(start);
  4310. }
  4311. if (end) {
  4312. end = this.skipHiddenDays(end, -1, true);
  4313. }
  4314. if (start === null || end === null || start < end) {
  4315. return new UnzonedRange_1.default(start, end);
  4316. }
  4317. return null;
  4318. };
  4319. // Is the current day hidden?
  4320. // `day` is a day-of-week index (0-6), or a Moment
  4321. View.prototype.isHiddenDay = function (day) {
  4322. if (moment.isMoment(day)) {
  4323. day = day.day();
  4324. }
  4325. return this.isHiddenDayHash[day];
  4326. };
  4327. // Incrementing the current day until it is no longer a hidden day, returning a copy.
  4328. // DOES NOT CONSIDER validUnzonedRange!
  4329. // If the initial value of `date` is not a hidden day, don't do anything.
  4330. // Pass `isExclusive` as `true` if you are dealing with an end date.
  4331. // `inc` defaults to `1` (increment one day forward each time)
  4332. View.prototype.skipHiddenDays = function (date, inc, isExclusive) {
  4333. if (inc === void 0) { inc = 1; }
  4334. if (isExclusive === void 0) { isExclusive = false; }
  4335. var out = date.clone();
  4336. while (this.isHiddenDayHash[(out.day() + (isExclusive ? inc : 0) + 7) % 7]) {
  4337. out.add(inc, 'days');
  4338. }
  4339. return out;
  4340. };
  4341. return View;
  4342. }(InteractiveDateComponent_1.default));
  4343. exports.default = View;
  4344. View.prototype.usesMinMaxTime = false;
  4345. View.prototype.dateProfileGeneratorClass = DateProfileGenerator_1.default;
  4346. View.watch('displayingDates', ['isInDom', 'dateProfile'], function (deps) {
  4347. this.requestDateRender(deps.dateProfile);
  4348. }, function () {
  4349. this.requestDateUnrender();
  4350. });
  4351. View.watch('displayingBusinessHours', ['displayingDates', 'businessHourGenerator'], function (deps) {
  4352. this.requestBusinessHoursRender(deps.businessHourGenerator);
  4353. }, function () {
  4354. this.requestBusinessHoursUnrender();
  4355. });
  4356. View.watch('initialEvents', ['dateProfile'], function (deps) {
  4357. return this.fetchInitialEvents(deps.dateProfile);
  4358. });
  4359. View.watch('bindingEvents', ['initialEvents'], function (deps) {
  4360. this.setEvents(deps.initialEvents);
  4361. this.bindEventChanges();
  4362. }, function () {
  4363. this.unbindEventChanges();
  4364. this.unsetEvents();
  4365. });
  4366. View.watch('displayingEvents', ['displayingDates', 'hasEvents'], function () {
  4367. this.requestEventsRender(this.get('currentEvents'));
  4368. }, function () {
  4369. this.requestEventsUnrender();
  4370. });
  4371. View.watch('title', ['dateProfile'], function (deps) {
  4372. return (this.title = this.computeTitle(deps.dateProfile)); // assign to View for legacy reasons
  4373. });
  4374. View.watch('legacyDateProps', ['dateProfile'], function (deps) {
  4375. var calendar = this.calendar;
  4376. var dateProfile = deps.dateProfile;
  4377. // DEPRECATED, but we need to keep it updated...
  4378. this.start = calendar.msToMoment(dateProfile.activeUnzonedRange.startMs, dateProfile.isRangeAllDay);
  4379. this.end = calendar.msToMoment(dateProfile.activeUnzonedRange.endMs, dateProfile.isRangeAllDay);
  4380. this.intervalStart = calendar.msToMoment(dateProfile.currentUnzonedRange.startMs, dateProfile.isRangeAllDay);
  4381. this.intervalEnd = calendar.msToMoment(dateProfile.currentUnzonedRange.endMs, dateProfile.isRangeAllDay);
  4382. });
  4383. /***/ }),
  4384. /* 44 */
  4385. /***/ (function(module, exports, __webpack_require__) {
  4386. Object.defineProperty(exports, "__esModule", { value: true });
  4387. var $ = __webpack_require__(3);
  4388. var util_1 = __webpack_require__(4);
  4389. var EventRenderer = /** @class */ (function () {
  4390. function EventRenderer(component, fillRenderer) {
  4391. this.view = component._getView();
  4392. this.component = component;
  4393. this.fillRenderer = fillRenderer;
  4394. }
  4395. EventRenderer.prototype.opt = function (name) {
  4396. return this.view.opt(name);
  4397. };
  4398. // Updates values that rely on options and also relate to range
  4399. EventRenderer.prototype.rangeUpdated = function () {
  4400. var displayEventTime;
  4401. var displayEventEnd;
  4402. this.eventTimeFormat =
  4403. this.opt('eventTimeFormat') ||
  4404. this.opt('timeFormat') || // deprecated
  4405. this.computeEventTimeFormat();
  4406. displayEventTime = this.opt('displayEventTime');
  4407. if (displayEventTime == null) {
  4408. displayEventTime = this.computeDisplayEventTime(); // might be based off of range
  4409. }
  4410. displayEventEnd = this.opt('displayEventEnd');
  4411. if (displayEventEnd == null) {
  4412. displayEventEnd = this.computeDisplayEventEnd(); // might be based off of range
  4413. }
  4414. this.displayEventTime = displayEventTime;
  4415. this.displayEventEnd = displayEventEnd;
  4416. };
  4417. EventRenderer.prototype.render = function (eventsPayload) {
  4418. var dateProfile = this.component._getDateProfile();
  4419. var eventDefId;
  4420. var instanceGroup;
  4421. var eventRanges;
  4422. var bgRanges = [];
  4423. var fgRanges = [];
  4424. for (eventDefId in eventsPayload) {
  4425. instanceGroup = eventsPayload[eventDefId];
  4426. eventRanges = instanceGroup.sliceRenderRanges(dateProfile.activeUnzonedRange);
  4427. if (instanceGroup.getEventDef().hasBgRendering()) {
  4428. bgRanges.push.apply(bgRanges, eventRanges);
  4429. }
  4430. else {
  4431. fgRanges.push.apply(fgRanges, eventRanges);
  4432. }
  4433. }
  4434. this.renderBgRanges(bgRanges);
  4435. this.renderFgRanges(fgRanges);
  4436. };
  4437. EventRenderer.prototype.unrender = function () {
  4438. this.unrenderBgRanges();
  4439. this.unrenderFgRanges();
  4440. };
  4441. EventRenderer.prototype.renderFgRanges = function (eventRanges) {
  4442. var eventFootprints = this.component.eventRangesToEventFootprints(eventRanges);
  4443. var segs = this.component.eventFootprintsToSegs(eventFootprints);
  4444. // render an `.el` on each seg
  4445. // returns a subset of the segs. segs that were actually rendered
  4446. segs = this.renderFgSegEls(segs);
  4447. if (this.renderFgSegs(segs) !== false) { // no failure?
  4448. this.fgSegs = segs;
  4449. }
  4450. };
  4451. EventRenderer.prototype.unrenderFgRanges = function () {
  4452. this.unrenderFgSegs(this.fgSegs || []);
  4453. this.fgSegs = null;
  4454. };
  4455. EventRenderer.prototype.renderBgRanges = function (eventRanges) {
  4456. var eventFootprints = this.component.eventRangesToEventFootprints(eventRanges);
  4457. var segs = this.component.eventFootprintsToSegs(eventFootprints);
  4458. if (this.renderBgSegs(segs) !== false) { // no failure?
  4459. this.bgSegs = segs;
  4460. }
  4461. };
  4462. EventRenderer.prototype.unrenderBgRanges = function () {
  4463. this.unrenderBgSegs();
  4464. this.bgSegs = null;
  4465. };
  4466. EventRenderer.prototype.getSegs = function () {
  4467. return (this.bgSegs || []).concat(this.fgSegs || []);
  4468. };
  4469. // Renders foreground event segments onto the grid
  4470. EventRenderer.prototype.renderFgSegs = function (segs) {
  4471. // subclasses must implement
  4472. // segs already has rendered els, and has been filtered.
  4473. return false; // signal failure if not implemented
  4474. };
  4475. // Unrenders all currently rendered foreground segments
  4476. EventRenderer.prototype.unrenderFgSegs = function (segs) {
  4477. // subclasses must implement
  4478. };
  4479. EventRenderer.prototype.renderBgSegs = function (segs) {
  4480. var _this = this;
  4481. if (this.fillRenderer) {
  4482. this.fillRenderer.renderSegs('bgEvent', segs, {
  4483. getClasses: function (seg) {
  4484. return _this.getBgClasses(seg.footprint.eventDef);
  4485. },
  4486. getCss: function (seg) {
  4487. return {
  4488. 'background-color': _this.getBgColor(seg.footprint.eventDef)
  4489. };
  4490. },
  4491. filterEl: function (seg, el) {
  4492. return _this.filterEventRenderEl(seg.footprint, el);
  4493. }
  4494. });
  4495. }
  4496. else {
  4497. return false; // signal failure if no fillRenderer
  4498. }
  4499. };
  4500. EventRenderer.prototype.unrenderBgSegs = function () {
  4501. if (this.fillRenderer) {
  4502. this.fillRenderer.unrender('bgEvent');
  4503. }
  4504. };
  4505. // Renders and assigns an `el` property for each foreground event segment.
  4506. // Only returns segments that successfully rendered.
  4507. EventRenderer.prototype.renderFgSegEls = function (segs, disableResizing) {
  4508. var _this = this;
  4509. if (disableResizing === void 0) { disableResizing = false; }
  4510. var hasEventRenderHandlers = this.view.hasPublicHandlers('eventRender');
  4511. var html = '';
  4512. var renderedSegs = [];
  4513. var i;
  4514. if (segs.length) { // don't build an empty html string
  4515. // build a large concatenation of event segment HTML
  4516. for (i = 0; i < segs.length; i++) {
  4517. this.beforeFgSegHtml(segs[i]);
  4518. html += this.fgSegHtml(segs[i], disableResizing);
  4519. }
  4520. // Grab individual elements from the combined HTML string. Use each as the default rendering.
  4521. // Then, compute the 'el' for each segment. An el might be null if the eventRender callback returned false.
  4522. $(html).each(function (i, node) {
  4523. var seg = segs[i];
  4524. var el = $(node);
  4525. if (hasEventRenderHandlers) { // optimization
  4526. el = _this.filterEventRenderEl(seg.footprint, el);
  4527. }
  4528. if (el) {
  4529. el.data('fc-seg', seg); // used by handlers
  4530. seg.el = el;
  4531. renderedSegs.push(seg);
  4532. }
  4533. });
  4534. }
  4535. return renderedSegs;
  4536. };
  4537. EventRenderer.prototype.beforeFgSegHtml = function (seg) {
  4538. };
  4539. // Generates the HTML for the default rendering of a foreground event segment. Used by renderFgSegEls()
  4540. EventRenderer.prototype.fgSegHtml = function (seg, disableResizing) {
  4541. // subclasses should implement
  4542. };
  4543. // Generic utility for generating the HTML classNames for an event segment's element
  4544. EventRenderer.prototype.getSegClasses = function (seg, isDraggable, isResizable) {
  4545. var classes = [
  4546. 'fc-event',
  4547. seg.isStart ? 'fc-start' : 'fc-not-start',
  4548. seg.isEnd ? 'fc-end' : 'fc-not-end'
  4549. ].concat(this.getClasses(seg.footprint.eventDef));
  4550. if (isDraggable) {
  4551. classes.push('fc-draggable');
  4552. }
  4553. if (isResizable) {
  4554. classes.push('fc-resizable');
  4555. }
  4556. // event is currently selected? attach a className.
  4557. if (this.view.isEventDefSelected(seg.footprint.eventDef)) {
  4558. classes.push('fc-selected');
  4559. }
  4560. return classes;
  4561. };
  4562. // Given an event and the default element used for rendering, returns the element that should actually be used.
  4563. // Basically runs events and elements through the eventRender hook.
  4564. EventRenderer.prototype.filterEventRenderEl = function (eventFootprint, el) {
  4565. var legacy = eventFootprint.getEventLegacy();
  4566. var custom = this.view.publiclyTrigger('eventRender', {
  4567. context: legacy,
  4568. args: [legacy, el, this.view]
  4569. });
  4570. if (custom === false) { // means don't render at all
  4571. el = null;
  4572. }
  4573. else if (custom && custom !== true) {
  4574. el = $(custom);
  4575. }
  4576. return el;
  4577. };
  4578. // Compute the text that should be displayed on an event's element.
  4579. // `range` can be the Event object itself, or something range-like, with at least a `start`.
  4580. // If event times are disabled, or the event has no time, will return a blank string.
  4581. // If not specified, formatStr will default to the eventTimeFormat setting,
  4582. // and displayEnd will default to the displayEventEnd setting.
  4583. EventRenderer.prototype.getTimeText = function (eventFootprint, formatStr, displayEnd) {
  4584. return this._getTimeText(eventFootprint.eventInstance.dateProfile.start, eventFootprint.eventInstance.dateProfile.end, eventFootprint.componentFootprint.isAllDay, formatStr, displayEnd);
  4585. };
  4586. EventRenderer.prototype._getTimeText = function (start, end, isAllDay, formatStr, displayEnd) {
  4587. if (formatStr == null) {
  4588. formatStr = this.eventTimeFormat;
  4589. }
  4590. if (displayEnd == null) {
  4591. displayEnd = this.displayEventEnd;
  4592. }
  4593. if (this.displayEventTime && !isAllDay) {
  4594. if (displayEnd && end) {
  4595. return this.view.formatRange({ start: start, end: end }, false, // allDay
  4596. formatStr);
  4597. }
  4598. else {
  4599. return start.format(formatStr);
  4600. }
  4601. }
  4602. return '';
  4603. };
  4604. EventRenderer.prototype.computeEventTimeFormat = function () {
  4605. return this.opt('smallTimeFormat');
  4606. };
  4607. EventRenderer.prototype.computeDisplayEventTime = function () {
  4608. return true;
  4609. };
  4610. EventRenderer.prototype.computeDisplayEventEnd = function () {
  4611. return true;
  4612. };
  4613. EventRenderer.prototype.getBgClasses = function (eventDef) {
  4614. var classNames = this.getClasses(eventDef);
  4615. classNames.push('fc-bgevent');
  4616. return classNames;
  4617. };
  4618. EventRenderer.prototype.getClasses = function (eventDef) {
  4619. var objs = this.getStylingObjs(eventDef);
  4620. var i;
  4621. var classNames = [];
  4622. for (i = 0; i < objs.length; i++) {
  4623. classNames.push.apply(// append
  4624. classNames, objs[i].eventClassName || objs[i].className || []);
  4625. }
  4626. return classNames;
  4627. };
  4628. // Utility for generating event skin-related CSS properties
  4629. EventRenderer.prototype.getSkinCss = function (eventDef) {
  4630. return {
  4631. 'background-color': this.getBgColor(eventDef),
  4632. 'border-color': this.getBorderColor(eventDef),
  4633. color: this.getTextColor(eventDef)
  4634. };
  4635. };
  4636. // Queries for caller-specified color, then falls back to default
  4637. EventRenderer.prototype.getBgColor = function (eventDef) {
  4638. var objs = this.getStylingObjs(eventDef);
  4639. var i;
  4640. var val;
  4641. for (i = 0; i < objs.length && !val; i++) {
  4642. val = objs[i].eventBackgroundColor || objs[i].eventColor ||
  4643. objs[i].backgroundColor || objs[i].color;
  4644. }
  4645. if (!val) {
  4646. val = this.opt('eventBackgroundColor') || this.opt('eventColor');
  4647. }
  4648. return val;
  4649. };
  4650. // Queries for caller-specified color, then falls back to default
  4651. EventRenderer.prototype.getBorderColor = function (eventDef) {
  4652. var objs = this.getStylingObjs(eventDef);
  4653. var i;
  4654. var val;
  4655. for (i = 0; i < objs.length && !val; i++) {
  4656. val = objs[i].eventBorderColor || objs[i].eventColor ||
  4657. objs[i].borderColor || objs[i].color;
  4658. }
  4659. if (!val) {
  4660. val = this.opt('eventBorderColor') || this.opt('eventColor');
  4661. }
  4662. return val;
  4663. };
  4664. // Queries for caller-specified color, then falls back to default
  4665. EventRenderer.prototype.getTextColor = function (eventDef) {
  4666. var objs = this.getStylingObjs(eventDef);
  4667. var i;
  4668. var val;
  4669. for (i = 0; i < objs.length && !val; i++) {
  4670. val = objs[i].eventTextColor ||
  4671. objs[i].textColor;
  4672. }
  4673. if (!val) {
  4674. val = this.opt('eventTextColor');
  4675. }
  4676. return val;
  4677. };
  4678. EventRenderer.prototype.getStylingObjs = function (eventDef) {
  4679. var objs = this.getFallbackStylingObjs(eventDef);
  4680. objs.unshift(eventDef);
  4681. return objs;
  4682. };
  4683. EventRenderer.prototype.getFallbackStylingObjs = function (eventDef) {
  4684. return [eventDef.source];
  4685. };
  4686. EventRenderer.prototype.sortEventSegs = function (segs) {
  4687. segs.sort(util_1.proxy(this, 'compareEventSegs'));
  4688. };
  4689. // A cmp function for determining which segments should take visual priority
  4690. EventRenderer.prototype.compareEventSegs = function (seg1, seg2) {
  4691. var f1 = seg1.footprint;
  4692. var f2 = seg2.footprint;
  4693. var cf1 = f1.componentFootprint;
  4694. var cf2 = f2.componentFootprint;
  4695. var r1 = cf1.unzonedRange;
  4696. var r2 = cf2.unzonedRange;
  4697. return r1.startMs - r2.startMs || // earlier events go first
  4698. (r2.endMs - r2.startMs) - (r1.endMs - r1.startMs) || // tie? longer events go first
  4699. cf2.isAllDay - cf1.isAllDay || // tie? put all-day events first (booleans cast to 0/1)
  4700. util_1.compareByFieldSpecs(f1.eventDef, f2.eventDef, this.view.eventOrderSpecs, f1.eventDef.miscProps, f2.eventDef.miscProps);
  4701. };
  4702. return EventRenderer;
  4703. }());
  4704. exports.default = EventRenderer;
  4705. /***/ }),
  4706. /* 45 */,
  4707. /* 46 */,
  4708. /* 47 */,
  4709. /* 48 */,
  4710. /* 49 */
  4711. /***/ (function(module, exports, __webpack_require__) {
  4712. Object.defineProperty(exports, "__esModule", { value: true });
  4713. var moment_ext_1 = __webpack_require__(11);
  4714. // Plugin
  4715. // -------------------------------------------------------------------------------------------------
  4716. moment_ext_1.newMomentProto.format = function () {
  4717. if (this._fullCalendar && arguments[0]) { // an enhanced moment? and a format string provided?
  4718. return formatDate(this, arguments[0]); // our extended formatting
  4719. }
  4720. if (this._ambigTime) {
  4721. return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD');
  4722. }
  4723. if (this._ambigZone) {
  4724. return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD[T]HH:mm:ss');
  4725. }
  4726. if (this._fullCalendar) { // enhanced non-ambig moment?
  4727. // moment.format() doesn't ensure english, but we want to.
  4728. return moment_ext_1.oldMomentFormat(englishMoment(this));
  4729. }
  4730. return moment_ext_1.oldMomentProto.format.apply(this, arguments);
  4731. };
  4732. moment_ext_1.newMomentProto.toISOString = function () {
  4733. if (this._ambigTime) {
  4734. return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD');
  4735. }
  4736. if (this._ambigZone) {
  4737. return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD[T]HH:mm:ss');
  4738. }
  4739. if (this._fullCalendar) { // enhanced non-ambig moment?
  4740. // depending on browser, moment might not output english. ensure english.
  4741. // https://github.com/moment/moment/blob/2.18.1/src/lib/moment/format.js#L22
  4742. return moment_ext_1.oldMomentProto.toISOString.apply(englishMoment(this), arguments);
  4743. }
  4744. return moment_ext_1.oldMomentProto.toISOString.apply(this, arguments);
  4745. };
  4746. function englishMoment(mom) {
  4747. if (mom.locale() !== 'en') {
  4748. return mom.clone().locale('en');
  4749. }
  4750. return mom;
  4751. }
  4752. // Config
  4753. // ---------------------------------------------------------------------------------------------------------------------
  4754. /*
  4755. Inserted between chunks in the fake ("intermediate") formatting string.
  4756. Important that it passes as whitespace (\s) because moment often identifies non-standalone months
  4757. via a regexp with an \s.
  4758. */
  4759. var PART_SEPARATOR = '\u000b'; // vertical tab
  4760. /*
  4761. Inserted as the first character of a literal-text chunk to indicate that the literal text is not actually literal text,
  4762. but rather, a "special" token that has custom rendering (see specialTokens map).
  4763. */
  4764. var SPECIAL_TOKEN_MARKER = '\u001f'; // information separator 1
  4765. /*
  4766. Inserted at the beginning and end of a span of text that must have non-zero numeric characters.
  4767. Handling of these markers is done in a post-processing step at the very end of text rendering.
  4768. */
  4769. var MAYBE_MARKER = '\u001e'; // information separator 2
  4770. var MAYBE_REGEXP = new RegExp(MAYBE_MARKER + '([^' + MAYBE_MARKER + ']*)' + MAYBE_MARKER, 'g'); // must be global
  4771. /*
  4772. Addition formatting tokens we want recognized
  4773. */
  4774. var specialTokens = {
  4775. t: function (date) {
  4776. return moment_ext_1.oldMomentFormat(date, 'a').charAt(0);
  4777. },
  4778. T: function (date) {
  4779. return moment_ext_1.oldMomentFormat(date, 'A').charAt(0);
  4780. }
  4781. };
  4782. /*
  4783. The first characters of formatting tokens for units that are 1 day or larger.
  4784. `value` is for ranking relative size (lower means bigger).
  4785. `unit` is a normalized unit, used for comparing moments.
  4786. */
  4787. var largeTokenMap = {
  4788. Y: { value: 1, unit: 'year' },
  4789. M: { value: 2, unit: 'month' },
  4790. W: { value: 3, unit: 'week' },
  4791. w: { value: 3, unit: 'week' },
  4792. D: { value: 4, unit: 'day' },
  4793. d: { value: 4, unit: 'day' } // day of week
  4794. };
  4795. // Single Date Formatting
  4796. // ---------------------------------------------------------------------------------------------------------------------
  4797. /*
  4798. Formats `date` with a Moment formatting string, but allow our non-zero areas and special token
  4799. */
  4800. function formatDate(date, formatStr) {
  4801. return renderFakeFormatString(getParsedFormatString(formatStr).fakeFormatString, date);
  4802. }
  4803. exports.formatDate = formatDate;
  4804. // Date Range Formatting
  4805. // -------------------------------------------------------------------------------------------------
  4806. // TODO: make it work with timezone offset
  4807. /*
  4808. Using a formatting string meant for a single date, generate a range string, like
  4809. "Sep 2 - 9 2013", that intelligently inserts a separator where the dates differ.
  4810. If the dates are the same as far as the format string is concerned, just return a single
  4811. rendering of one date, without any separator.
  4812. */
  4813. function formatRange(date1, date2, formatStr, separator, isRTL) {
  4814. var localeData;
  4815. date1 = moment_ext_1.default.parseZone(date1);
  4816. date2 = moment_ext_1.default.parseZone(date2);
  4817. localeData = date1.localeData();
  4818. // Expand localized format strings, like "LL" -> "MMMM D YYYY".
  4819. // BTW, this is not important for `formatDate` because it is impossible to put custom tokens
  4820. // or non-zero areas in Moment's localized format strings.
  4821. formatStr = localeData.longDateFormat(formatStr) || formatStr;
  4822. return renderParsedFormat(getParsedFormatString(formatStr), date1, date2, separator || ' - ', isRTL);
  4823. }
  4824. exports.formatRange = formatRange;
  4825. /*
  4826. Renders a range with an already-parsed format string.
  4827. */
  4828. function renderParsedFormat(parsedFormat, date1, date2, separator, isRTL) {
  4829. var sameUnits = parsedFormat.sameUnits;
  4830. var unzonedDate1 = date1.clone().stripZone(); // for same-unit comparisons
  4831. var unzonedDate2 = date2.clone().stripZone(); // "
  4832. var renderedParts1 = renderFakeFormatStringParts(parsedFormat.fakeFormatString, date1);
  4833. var renderedParts2 = renderFakeFormatStringParts(parsedFormat.fakeFormatString, date2);
  4834. var leftI;
  4835. var leftStr = '';
  4836. var rightI;
  4837. var rightStr = '';
  4838. var middleI;
  4839. var middleStr1 = '';
  4840. var middleStr2 = '';
  4841. var middleStr = '';
  4842. // Start at the leftmost side of the formatting string and continue until you hit a token
  4843. // that is not the same between dates.
  4844. for (leftI = 0; leftI < sameUnits.length && (!sameUnits[leftI] || unzonedDate1.isSame(unzonedDate2, sameUnits[leftI])); leftI++) {
  4845. leftStr += renderedParts1[leftI];
  4846. }
  4847. // Similarly, start at the rightmost side of the formatting string and move left
  4848. for (rightI = sameUnits.length - 1; rightI > leftI && (!sameUnits[rightI] || unzonedDate1.isSame(unzonedDate2, sameUnits[rightI])); rightI--) {
  4849. // If current chunk is on the boundary of unique date-content, and is a special-case
  4850. // date-formatting postfix character, then don't consume it. Consider it unique date-content.
  4851. // TODO: make configurable
  4852. if (rightI - 1 === leftI && renderedParts1[rightI] === '.') {
  4853. break;
  4854. }
  4855. rightStr = renderedParts1[rightI] + rightStr;
  4856. }
  4857. // The area in the middle is different for both of the dates.
  4858. // Collect them distinctly so we can jam them together later.
  4859. for (middleI = leftI; middleI <= rightI; middleI++) {
  4860. middleStr1 += renderedParts1[middleI];
  4861. middleStr2 += renderedParts2[middleI];
  4862. }
  4863. if (middleStr1 || middleStr2) {
  4864. if (isRTL) {
  4865. middleStr = middleStr2 + separator + middleStr1;
  4866. }
  4867. else {
  4868. middleStr = middleStr1 + separator + middleStr2;
  4869. }
  4870. }
  4871. return processMaybeMarkers(leftStr + middleStr + rightStr);
  4872. }
  4873. // Format String Parsing
  4874. // ---------------------------------------------------------------------------------------------------------------------
  4875. var parsedFormatStrCache = {};
  4876. /*
  4877. Returns a parsed format string, leveraging a cache.
  4878. */
  4879. function getParsedFormatString(formatStr) {
  4880. return parsedFormatStrCache[formatStr] ||
  4881. (parsedFormatStrCache[formatStr] = parseFormatString(formatStr));
  4882. }
  4883. /*
  4884. Parses a format string into the following:
  4885. - fakeFormatString: a momentJS formatting string, littered with special control characters that get post-processed.
  4886. - sameUnits: for every part in fakeFormatString, if the part is a token, the value will be a unit string (like "day"),
  4887. that indicates how similar a range's start & end must be in order to share the same formatted text.
  4888. If not a token, then the value is null.
  4889. Always a flat array (not nested liked "chunks").
  4890. */
  4891. function parseFormatString(formatStr) {
  4892. var chunks = chunkFormatString(formatStr);
  4893. return {
  4894. fakeFormatString: buildFakeFormatString(chunks),
  4895. sameUnits: buildSameUnits(chunks)
  4896. };
  4897. }
  4898. /*
  4899. Break the formatting string into an array of chunks.
  4900. A 'maybe' chunk will have nested chunks.
  4901. */
  4902. function chunkFormatString(formatStr) {
  4903. var chunks = [];
  4904. var match;
  4905. // TODO: more descrimination
  4906. // \4 is a backreference to the first character of a multi-character set.
  4907. var chunker = /\[([^\]]*)\]|\(([^\)]*)\)|(LTS|LT|(\w)\4*o?)|([^\w\[\(]+)/g;
  4908. while ((match = chunker.exec(formatStr))) {
  4909. if (match[1]) { // a literal string inside [ ... ]
  4910. chunks.push.apply(chunks, // append
  4911. splitStringLiteral(match[1]));
  4912. }
  4913. else if (match[2]) { // non-zero formatting inside ( ... )
  4914. chunks.push({ maybe: chunkFormatString(match[2]) });
  4915. }
  4916. else if (match[3]) { // a formatting token
  4917. chunks.push({ token: match[3] });
  4918. }
  4919. else if (match[5]) { // an unenclosed literal string
  4920. chunks.push.apply(chunks, // append
  4921. splitStringLiteral(match[5]));
  4922. }
  4923. }
  4924. return chunks;
  4925. }
  4926. /*
  4927. Potentially splits a literal-text string into multiple parts. For special cases.
  4928. */
  4929. function splitStringLiteral(s) {
  4930. if (s === '. ') {
  4931. return ['.', ' ']; // for locales with periods bound to the end of each year/month/date
  4932. }
  4933. else {
  4934. return [s];
  4935. }
  4936. }
  4937. /*
  4938. Given chunks parsed from a real format string, generate a fake (aka "intermediate") format string with special control
  4939. characters that will eventually be given to moment for formatting, and then post-processed.
  4940. */
  4941. function buildFakeFormatString(chunks) {
  4942. var parts = [];
  4943. var i;
  4944. var chunk;
  4945. for (i = 0; i < chunks.length; i++) {
  4946. chunk = chunks[i];
  4947. if (typeof chunk === 'string') {
  4948. parts.push('[' + chunk + ']');
  4949. }
  4950. else if (chunk.token) {
  4951. if (chunk.token in specialTokens) {
  4952. parts.push(SPECIAL_TOKEN_MARKER + // useful during post-processing
  4953. '[' + chunk.token + ']' // preserve as literal text
  4954. );
  4955. }
  4956. else {
  4957. parts.push(chunk.token); // unprotected text implies a format string
  4958. }
  4959. }
  4960. else if (chunk.maybe) {
  4961. parts.push(MAYBE_MARKER + // useful during post-processing
  4962. buildFakeFormatString(chunk.maybe) +
  4963. MAYBE_MARKER);
  4964. }
  4965. }
  4966. return parts.join(PART_SEPARATOR);
  4967. }
  4968. /*
  4969. Given parsed chunks from a real formatting string, generates an array of unit strings (like "day") that indicate
  4970. in which regard two dates must be similar in order to share range formatting text.
  4971. The `chunks` can be nested (because of "maybe" chunks), however, the returned array will be flat.
  4972. */
  4973. function buildSameUnits(chunks) {
  4974. var units = [];
  4975. var i;
  4976. var chunk;
  4977. var tokenInfo;
  4978. for (i = 0; i < chunks.length; i++) {
  4979. chunk = chunks[i];
  4980. if (chunk.token) {
  4981. tokenInfo = largeTokenMap[chunk.token.charAt(0)];
  4982. units.push(tokenInfo ? tokenInfo.unit : 'second'); // default to a very strict same-second
  4983. }
  4984. else if (chunk.maybe) {
  4985. units.push.apply(units, // append
  4986. buildSameUnits(chunk.maybe));
  4987. }
  4988. else {
  4989. units.push(null);
  4990. }
  4991. }
  4992. return units;
  4993. }
  4994. // Rendering to text
  4995. // ---------------------------------------------------------------------------------------------------------------------
  4996. /*
  4997. Formats a date with a fake format string, post-processes the control characters, then returns.
  4998. */
  4999. function renderFakeFormatString(fakeFormatString, date) {
  5000. return processMaybeMarkers(renderFakeFormatStringParts(fakeFormatString, date).join(''));
  5001. }
  5002. /*
  5003. Formats a date into parts that will have been post-processed, EXCEPT for the "maybe" markers.
  5004. */
  5005. function renderFakeFormatStringParts(fakeFormatString, date) {
  5006. var parts = [];
  5007. var fakeRender = moment_ext_1.oldMomentFormat(date, fakeFormatString);
  5008. var fakeParts = fakeRender.split(PART_SEPARATOR);
  5009. var i;
  5010. var fakePart;
  5011. for (i = 0; i < fakeParts.length; i++) {
  5012. fakePart = fakeParts[i];
  5013. if (fakePart.charAt(0) === SPECIAL_TOKEN_MARKER) {
  5014. parts.push(
  5015. // the literal string IS the token's name.
  5016. // call special token's registered function.
  5017. specialTokens[fakePart.substring(1)](date));
  5018. }
  5019. else {
  5020. parts.push(fakePart);
  5021. }
  5022. }
  5023. return parts;
  5024. }
  5025. /*
  5026. Accepts an almost-finally-formatted string and processes the "maybe" control characters, returning a new string.
  5027. */
  5028. function processMaybeMarkers(s) {
  5029. return s.replace(MAYBE_REGEXP, function (m0, m1) {
  5030. if (m1.match(/[1-9]/)) { // any non-zero numeric characters?
  5031. return m1;
  5032. }
  5033. else {
  5034. return '';
  5035. }
  5036. });
  5037. }
  5038. // Misc Utils
  5039. // -------------------------------------------------------------------------------------------------
  5040. /*
  5041. Returns a unit string, either 'year', 'month', 'day', or null for the most granular formatting token in the string.
  5042. */
  5043. function queryMostGranularFormatUnit(formatStr) {
  5044. var chunks = chunkFormatString(formatStr);
  5045. var i;
  5046. var chunk;
  5047. var candidate;
  5048. var best;
  5049. for (i = 0; i < chunks.length; i++) {
  5050. chunk = chunks[i];
  5051. if (chunk.token) {
  5052. candidate = largeTokenMap[chunk.token.charAt(0)];
  5053. if (candidate) {
  5054. if (!best || candidate.value > best.value) {
  5055. best = candidate;
  5056. }
  5057. }
  5058. }
  5059. }
  5060. if (best) {
  5061. return best.unit;
  5062. }
  5063. return null;
  5064. }
  5065. exports.queryMostGranularFormatUnit = queryMostGranularFormatUnit;
  5066. /***/ }),
  5067. /* 50 */
  5068. /***/ (function(module, exports) {
  5069. Object.defineProperty(exports, "__esModule", { value: true });
  5070. var EventRange = /** @class */ (function () {
  5071. function EventRange(unzonedRange, eventDef, eventInstance) {
  5072. this.unzonedRange = unzonedRange;
  5073. this.eventDef = eventDef;
  5074. if (eventInstance) {
  5075. this.eventInstance = eventInstance;
  5076. }
  5077. }
  5078. return EventRange;
  5079. }());
  5080. exports.default = EventRange;
  5081. /***/ }),
  5082. /* 51 */
  5083. /***/ (function(module, exports, __webpack_require__) {
  5084. Object.defineProperty(exports, "__esModule", { value: true });
  5085. var tslib_1 = __webpack_require__(2);
  5086. var Class_1 = __webpack_require__(35);
  5087. var EmitterMixin_1 = __webpack_require__(13);
  5088. var ListenerMixin_1 = __webpack_require__(7);
  5089. var Model = /** @class */ (function (_super) {
  5090. tslib_1.__extends(Model, _super);
  5091. function Model() {
  5092. var _this = _super.call(this) || this;
  5093. _this._watchers = {};
  5094. _this._props = {};
  5095. _this.applyGlobalWatchers();
  5096. _this.constructed();
  5097. return _this;
  5098. }
  5099. Model.watch = function (name) {
  5100. var args = [];
  5101. for (var _i = 1; _i < arguments.length; _i++) {
  5102. args[_i - 1] = arguments[_i];
  5103. }
  5104. // subclasses should make a masked-copy of the superclass's map
  5105. // TODO: write test
  5106. if (!this.prototype.hasOwnProperty('_globalWatchArgs')) {
  5107. this.prototype._globalWatchArgs = Object.create(this.prototype._globalWatchArgs);
  5108. }
  5109. this.prototype._globalWatchArgs[name] = args;
  5110. };
  5111. Model.prototype.constructed = function () {
  5112. // useful for monkeypatching. TODO: BaseClass?
  5113. };
  5114. Model.prototype.applyGlobalWatchers = function () {
  5115. var map = this._globalWatchArgs;
  5116. var name;
  5117. for (name in map) {
  5118. this.watch.apply(this, [name].concat(map[name]));
  5119. }
  5120. };
  5121. Model.prototype.has = function (name) {
  5122. return name in this._props;
  5123. };
  5124. Model.prototype.get = function (name) {
  5125. if (name === undefined) {
  5126. return this._props;
  5127. }
  5128. return this._props[name];
  5129. };
  5130. Model.prototype.set = function (name, val) {
  5131. var newProps;
  5132. if (typeof name === 'string') {
  5133. newProps = {};
  5134. newProps[name] = val === undefined ? null : val;
  5135. }
  5136. else {
  5137. newProps = name;
  5138. }
  5139. this.setProps(newProps);
  5140. };
  5141. Model.prototype.reset = function (newProps) {
  5142. var oldProps = this._props;
  5143. var changeset = {}; // will have undefined's to signal unsets
  5144. var name;
  5145. for (name in oldProps) {
  5146. changeset[name] = undefined;
  5147. }
  5148. for (name in newProps) {
  5149. changeset[name] = newProps[name];
  5150. }
  5151. this.setProps(changeset);
  5152. };
  5153. Model.prototype.unset = function (name) {
  5154. var newProps = {};
  5155. var names;
  5156. var i;
  5157. if (typeof name === 'string') {
  5158. names = [name];
  5159. }
  5160. else {
  5161. names = name;
  5162. }
  5163. for (i = 0; i < names.length; i++) {
  5164. newProps[names[i]] = undefined;
  5165. }
  5166. this.setProps(newProps);
  5167. };
  5168. Model.prototype.setProps = function (newProps) {
  5169. var changedProps = {};
  5170. var changedCnt = 0;
  5171. var name;
  5172. var val;
  5173. for (name in newProps) {
  5174. val = newProps[name];
  5175. // a change in value?
  5176. // if an object, don't check equality, because might have been mutated internally.
  5177. // TODO: eventually enforce immutability.
  5178. if (typeof val === 'object' ||
  5179. val !== this._props[name]) {
  5180. changedProps[name] = val;
  5181. changedCnt++;
  5182. }
  5183. }
  5184. if (changedCnt) {
  5185. this.trigger('before:batchChange', changedProps);
  5186. for (name in changedProps) {
  5187. val = changedProps[name];
  5188. this.trigger('before:change', name, val);
  5189. this.trigger('before:change:' + name, val);
  5190. }
  5191. for (name in changedProps) {
  5192. val = changedProps[name];
  5193. if (val === undefined) {
  5194. delete this._props[name];
  5195. }
  5196. else {
  5197. this._props[name] = val;
  5198. }
  5199. this.trigger('change:' + name, val);
  5200. this.trigger('change', name, val);
  5201. }
  5202. this.trigger('batchChange', changedProps);
  5203. }
  5204. };
  5205. Model.prototype.watch = function (name, depList, startFunc, stopFunc) {
  5206. var _this = this;
  5207. this.unwatch(name);
  5208. this._watchers[name] = this._watchDeps(depList, function (deps) {
  5209. var res = startFunc.call(_this, deps);
  5210. if (res && res.then) {
  5211. _this.unset(name); // put in an unset state while resolving
  5212. res.then(function (val) {
  5213. _this.set(name, val);
  5214. });
  5215. }
  5216. else {
  5217. _this.set(name, res);
  5218. }
  5219. }, function (deps) {
  5220. _this.unset(name);
  5221. if (stopFunc) {
  5222. stopFunc.call(_this, deps);
  5223. }
  5224. });
  5225. };
  5226. Model.prototype.unwatch = function (name) {
  5227. var watcher = this._watchers[name];
  5228. if (watcher) {
  5229. delete this._watchers[name];
  5230. watcher.teardown();
  5231. }
  5232. };
  5233. Model.prototype._watchDeps = function (depList, startFunc, stopFunc) {
  5234. var _this = this;
  5235. var queuedChangeCnt = 0;
  5236. var depCnt = depList.length;
  5237. var satisfyCnt = 0;
  5238. var values = {}; // what's passed as the `deps` arguments
  5239. var bindTuples = []; // array of [ eventName, handlerFunc ] arrays
  5240. var isCallingStop = false;
  5241. var onBeforeDepChange = function (depName, val, isOptional) {
  5242. queuedChangeCnt++;
  5243. if (queuedChangeCnt === 1) { // first change to cause a "stop" ?
  5244. if (satisfyCnt === depCnt) { // all deps previously satisfied?
  5245. isCallingStop = true;
  5246. stopFunc(values);
  5247. isCallingStop = false;
  5248. }
  5249. }
  5250. };
  5251. var onDepChange = function (depName, val, isOptional) {
  5252. if (val === undefined) { // unsetting a value?
  5253. // required dependency that was previously set?
  5254. if (!isOptional && values[depName] !== undefined) {
  5255. satisfyCnt--;
  5256. }
  5257. delete values[depName];
  5258. }
  5259. else { // setting a value?
  5260. // required dependency that was previously unset?
  5261. if (!isOptional && values[depName] === undefined) {
  5262. satisfyCnt++;
  5263. }
  5264. values[depName] = val;
  5265. }
  5266. queuedChangeCnt--;
  5267. if (!queuedChangeCnt) { // last change to cause a "start"?
  5268. // now finally satisfied or satisfied all along?
  5269. if (satisfyCnt === depCnt) {
  5270. // if the stopFunc initiated another value change, ignore it.
  5271. // it will be processed by another change event anyway.
  5272. if (!isCallingStop) {
  5273. startFunc(values);
  5274. }
  5275. }
  5276. }
  5277. };
  5278. // intercept for .on() that remembers handlers
  5279. var bind = function (eventName, handler) {
  5280. _this.on(eventName, handler);
  5281. bindTuples.push([eventName, handler]);
  5282. };
  5283. // listen to dependency changes
  5284. depList.forEach(function (depName) {
  5285. var isOptional = false;
  5286. if (depName.charAt(0) === '?') { // TODO: more DRY
  5287. depName = depName.substring(1);
  5288. isOptional = true;
  5289. }
  5290. bind('before:change:' + depName, function (val) {
  5291. onBeforeDepChange(depName, val, isOptional);
  5292. });
  5293. bind('change:' + depName, function (val) {
  5294. onDepChange(depName, val, isOptional);
  5295. });
  5296. });
  5297. // process current dependency values
  5298. depList.forEach(function (depName) {
  5299. var isOptional = false;
  5300. if (depName.charAt(0) === '?') { // TODO: more DRY
  5301. depName = depName.substring(1);
  5302. isOptional = true;
  5303. }
  5304. if (_this.has(depName)) {
  5305. values[depName] = _this.get(depName);
  5306. satisfyCnt++;
  5307. }
  5308. else if (isOptional) {
  5309. satisfyCnt++;
  5310. }
  5311. });
  5312. // initially satisfied
  5313. if (satisfyCnt === depCnt) {
  5314. startFunc(values);
  5315. }
  5316. return {
  5317. teardown: function () {
  5318. // remove all handlers
  5319. for (var i = 0; i < bindTuples.length; i++) {
  5320. _this.off(bindTuples[i][0], bindTuples[i][1]);
  5321. }
  5322. bindTuples = null;
  5323. // was satisfied, so call stopFunc
  5324. if (satisfyCnt === depCnt) {
  5325. stopFunc();
  5326. }
  5327. },
  5328. flash: function () {
  5329. if (satisfyCnt === depCnt) {
  5330. stopFunc();
  5331. startFunc(values);
  5332. }
  5333. }
  5334. };
  5335. };
  5336. Model.prototype.flash = function (name) {
  5337. var watcher = this._watchers[name];
  5338. if (watcher) {
  5339. watcher.flash();
  5340. }
  5341. };
  5342. return Model;
  5343. }(Class_1.default));
  5344. exports.default = Model;
  5345. Model.prototype._globalWatchArgs = {}; // mutation protection in Model.watch
  5346. EmitterMixin_1.default.mixInto(Model);
  5347. ListenerMixin_1.default.mixInto(Model);
  5348. /***/ }),
  5349. /* 52 */
  5350. /***/ (function(module, exports, __webpack_require__) {
  5351. /*
  5352. USAGE:
  5353. import { default as ParsableModelMixin, ParsableModelInterface } from './ParsableModelMixin'
  5354. in class:
  5355. applyProps: ParsableModelInterface['applyProps']
  5356. applyManualStandardProps: ParsableModelInterface['applyManualStandardProps']
  5357. applyMiscProps: ParsableModelInterface['applyMiscProps']
  5358. isStandardProp: ParsableModelInterface['isStandardProp']
  5359. static defineStandardProps = ParsableModelMixin.defineStandardProps
  5360. static copyVerbatimStandardProps = ParsableModelMixin.copyVerbatimStandardProps
  5361. after class:
  5362. ParsableModelMixin.mixInto(TheClass)
  5363. */
  5364. Object.defineProperty(exports, "__esModule", { value: true });
  5365. var tslib_1 = __webpack_require__(2);
  5366. var util_1 = __webpack_require__(4);
  5367. var Mixin_1 = __webpack_require__(15);
  5368. var ParsableModelMixin = /** @class */ (function (_super) {
  5369. tslib_1.__extends(ParsableModelMixin, _super);
  5370. function ParsableModelMixin() {
  5371. return _super !== null && _super.apply(this, arguments) || this;
  5372. }
  5373. ParsableModelMixin.defineStandardProps = function (propDefs) {
  5374. var proto = this.prototype;
  5375. if (!proto.hasOwnProperty('standardPropMap')) {
  5376. proto.standardPropMap = Object.create(proto.standardPropMap);
  5377. }
  5378. util_1.copyOwnProps(propDefs, proto.standardPropMap);
  5379. };
  5380. ParsableModelMixin.copyVerbatimStandardProps = function (src, dest) {
  5381. var map = this.prototype.standardPropMap;
  5382. var propName;
  5383. for (propName in map) {
  5384. if (src[propName] != null && // in the src object?
  5385. map[propName] === true // false means "copy verbatim"
  5386. ) {
  5387. dest[propName] = src[propName];
  5388. }
  5389. }
  5390. };
  5391. /*
  5392. Returns true/false for success.
  5393. Meant to be only called ONCE, at object creation.
  5394. */
  5395. ParsableModelMixin.prototype.applyProps = function (rawProps) {
  5396. var standardPropMap = this.standardPropMap;
  5397. var manualProps = {};
  5398. var miscProps = {};
  5399. var propName;
  5400. for (propName in rawProps) {
  5401. if (standardPropMap[propName] === true) { // copy verbatim
  5402. this[propName] = rawProps[propName];
  5403. }
  5404. else if (standardPropMap[propName] === false) {
  5405. manualProps[propName] = rawProps[propName];
  5406. }
  5407. else {
  5408. miscProps[propName] = rawProps[propName];
  5409. }
  5410. }
  5411. this.applyMiscProps(miscProps);
  5412. return this.applyManualStandardProps(manualProps);
  5413. };
  5414. /*
  5415. If subclasses override, they must call this supermethod and return the boolean response.
  5416. Meant to be only called ONCE, at object creation.
  5417. */
  5418. ParsableModelMixin.prototype.applyManualStandardProps = function (rawProps) {
  5419. return true;
  5420. };
  5421. /*
  5422. Can be called even after initial object creation.
  5423. */
  5424. ParsableModelMixin.prototype.applyMiscProps = function (rawProps) {
  5425. // subclasses can implement
  5426. };
  5427. /*
  5428. TODO: why is this a method when defineStandardProps is static
  5429. */
  5430. ParsableModelMixin.prototype.isStandardProp = function (propName) {
  5431. return propName in this.standardPropMap;
  5432. };
  5433. return ParsableModelMixin;
  5434. }(Mixin_1.default));
  5435. exports.default = ParsableModelMixin;
  5436. ParsableModelMixin.prototype.standardPropMap = {}; // will be cloned by defineStandardProps
  5437. /***/ }),
  5438. /* 53 */
  5439. /***/ (function(module, exports) {
  5440. Object.defineProperty(exports, "__esModule", { value: true });
  5441. var EventInstance = /** @class */ (function () {
  5442. function EventInstance(def, dateProfile) {
  5443. this.def = def;
  5444. this.dateProfile = dateProfile;
  5445. }
  5446. EventInstance.prototype.toLegacy = function () {
  5447. var dateProfile = this.dateProfile;
  5448. var obj = this.def.toLegacy();
  5449. obj.start = dateProfile.start.clone();
  5450. obj.end = dateProfile.end ? dateProfile.end.clone() : null;
  5451. return obj;
  5452. };
  5453. return EventInstance;
  5454. }());
  5455. exports.default = EventInstance;
  5456. /***/ }),
  5457. /* 54 */
  5458. /***/ (function(module, exports, __webpack_require__) {
  5459. Object.defineProperty(exports, "__esModule", { value: true });
  5460. var tslib_1 = __webpack_require__(2);
  5461. var $ = __webpack_require__(3);
  5462. var moment = __webpack_require__(0);
  5463. var EventDef_1 = __webpack_require__(37);
  5464. var EventInstance_1 = __webpack_require__(53);
  5465. var EventDateProfile_1 = __webpack_require__(16);
  5466. var RecurringEventDef = /** @class */ (function (_super) {
  5467. tslib_1.__extends(RecurringEventDef, _super);
  5468. function RecurringEventDef() {
  5469. return _super !== null && _super.apply(this, arguments) || this;
  5470. }
  5471. RecurringEventDef.prototype.isAllDay = function () {
  5472. return !this.startTime && !this.endTime;
  5473. };
  5474. RecurringEventDef.prototype.buildInstances = function (unzonedRange) {
  5475. var calendar = this.source.calendar;
  5476. var unzonedDate = unzonedRange.getStart();
  5477. var unzonedEnd = unzonedRange.getEnd();
  5478. var zonedDayStart;
  5479. var instanceStart;
  5480. var instanceEnd;
  5481. var instances = [];
  5482. while (unzonedDate.isBefore(unzonedEnd)) {
  5483. // if everyday, or this particular day-of-week
  5484. if (!this.dowHash || this.dowHash[unzonedDate.day()]) {
  5485. zonedDayStart = calendar.applyTimezone(unzonedDate);
  5486. instanceStart = zonedDayStart.clone();
  5487. instanceEnd = null;
  5488. if (this.startTime) {
  5489. instanceStart.time(this.startTime);
  5490. }
  5491. else {
  5492. instanceStart.stripTime();
  5493. }
  5494. if (this.endTime) {
  5495. instanceEnd = zonedDayStart.clone().time(this.endTime);
  5496. }
  5497. instances.push(new EventInstance_1.default(this, // definition
  5498. new EventDateProfile_1.default(instanceStart, instanceEnd, calendar)));
  5499. }
  5500. unzonedDate.add(1, 'days');
  5501. }
  5502. return instances;
  5503. };
  5504. RecurringEventDef.prototype.setDow = function (dowNumbers) {
  5505. if (!this.dowHash) {
  5506. this.dowHash = {};
  5507. }
  5508. for (var i = 0; i < dowNumbers.length; i++) {
  5509. this.dowHash[dowNumbers[i]] = true;
  5510. }
  5511. };
  5512. RecurringEventDef.prototype.clone = function () {
  5513. var def = _super.prototype.clone.call(this);
  5514. if (def.startTime) {
  5515. def.startTime = moment.duration(this.startTime);
  5516. }
  5517. if (def.endTime) {
  5518. def.endTime = moment.duration(this.endTime);
  5519. }
  5520. if (this.dowHash) {
  5521. def.dowHash = $.extend({}, this.dowHash);
  5522. }
  5523. return def;
  5524. };
  5525. return RecurringEventDef;
  5526. }(EventDef_1.default));
  5527. exports.default = RecurringEventDef;
  5528. /*
  5529. HACK to work with TypeScript mixins
  5530. NOTE: if super-method fails, should still attempt to apply
  5531. */
  5532. RecurringEventDef.prototype.applyProps = function (rawProps) {
  5533. var superSuccess = EventDef_1.default.prototype.applyProps.call(this, rawProps);
  5534. if (rawProps.start) {
  5535. this.startTime = moment.duration(rawProps.start);
  5536. }
  5537. if (rawProps.end) {
  5538. this.endTime = moment.duration(rawProps.end);
  5539. }
  5540. if (rawProps.dow) {
  5541. this.setDow(rawProps.dow);
  5542. }
  5543. return superSuccess;
  5544. };
  5545. // Parsing
  5546. // ---------------------------------------------------------------------------------------------------------------------
  5547. RecurringEventDef.defineStandardProps({
  5548. start: false,
  5549. end: false,
  5550. dow: false
  5551. });
  5552. /***/ }),
  5553. /* 55 */
  5554. /***/ (function(module, exports, __webpack_require__) {
  5555. Object.defineProperty(exports, "__esModule", { value: true });
  5556. var moment = __webpack_require__(0);
  5557. var util_1 = __webpack_require__(4);
  5558. var UnzonedRange_1 = __webpack_require__(5);
  5559. var DateProfileGenerator = /** @class */ (function () {
  5560. function DateProfileGenerator(_view) {
  5561. this._view = _view;
  5562. }
  5563. DateProfileGenerator.prototype.opt = function (name) {
  5564. return this._view.opt(name);
  5565. };
  5566. DateProfileGenerator.prototype.trimHiddenDays = function (unzonedRange) {
  5567. return this._view.trimHiddenDays(unzonedRange);
  5568. };
  5569. DateProfileGenerator.prototype.msToUtcMoment = function (ms, forceAllDay) {
  5570. return this._view.calendar.msToUtcMoment(ms, forceAllDay);
  5571. };
  5572. /* Date Range Computation
  5573. ------------------------------------------------------------------------------------------------------------------*/
  5574. // Builds a structure with info about what the dates/ranges will be for the "prev" view.
  5575. DateProfileGenerator.prototype.buildPrev = function (currentDateProfile) {
  5576. var prevDate = currentDateProfile.date.clone()
  5577. .startOf(currentDateProfile.currentRangeUnit)
  5578. .subtract(currentDateProfile.dateIncrement);
  5579. return this.build(prevDate, -1);
  5580. };
  5581. // Builds a structure with info about what the dates/ranges will be for the "next" view.
  5582. DateProfileGenerator.prototype.buildNext = function (currentDateProfile) {
  5583. var nextDate = currentDateProfile.date.clone()
  5584. .startOf(currentDateProfile.currentRangeUnit)
  5585. .add(currentDateProfile.dateIncrement);
  5586. return this.build(nextDate, 1);
  5587. };
  5588. // Builds a structure holding dates/ranges for rendering around the given date.
  5589. // Optional direction param indicates whether the date is being incremented/decremented
  5590. // from its previous value. decremented = -1, incremented = 1 (default).
  5591. DateProfileGenerator.prototype.build = function (date, direction, forceToValid) {
  5592. if (forceToValid === void 0) { forceToValid = false; }
  5593. var isDateAllDay = !date.hasTime();
  5594. var validUnzonedRange;
  5595. var minTime = null;
  5596. var maxTime = null;
  5597. var currentInfo;
  5598. var isRangeAllDay;
  5599. var renderUnzonedRange;
  5600. var activeUnzonedRange;
  5601. var isValid;
  5602. validUnzonedRange = this.buildValidRange();
  5603. validUnzonedRange = this.trimHiddenDays(validUnzonedRange);
  5604. if (forceToValid) {
  5605. date = this.msToUtcMoment(validUnzonedRange.constrainDate(date), // returns MS
  5606. isDateAllDay);
  5607. }
  5608. currentInfo = this.buildCurrentRangeInfo(date, direction);
  5609. isRangeAllDay = /^(year|month|week|day)$/.test(currentInfo.unit);
  5610. renderUnzonedRange = this.buildRenderRange(this.trimHiddenDays(currentInfo.unzonedRange), currentInfo.unit, isRangeAllDay);
  5611. renderUnzonedRange = this.trimHiddenDays(renderUnzonedRange);
  5612. activeUnzonedRange = renderUnzonedRange.clone();
  5613. if (!this.opt('showNonCurrentDates')) {
  5614. activeUnzonedRange = activeUnzonedRange.intersect(currentInfo.unzonedRange);
  5615. }
  5616. minTime = moment.duration(this.opt('minTime'));
  5617. maxTime = moment.duration(this.opt('maxTime'));
  5618. activeUnzonedRange = this.adjustActiveRange(activeUnzonedRange, minTime, maxTime);
  5619. activeUnzonedRange = activeUnzonedRange.intersect(validUnzonedRange); // might return null
  5620. if (activeUnzonedRange) {
  5621. date = this.msToUtcMoment(activeUnzonedRange.constrainDate(date), // returns MS
  5622. isDateAllDay);
  5623. }
  5624. // it's invalid if the originally requested date is not contained,
  5625. // or if the range is completely outside of the valid range.
  5626. isValid = currentInfo.unzonedRange.intersectsWith(validUnzonedRange);
  5627. return {
  5628. // constraint for where prev/next operations can go and where events can be dragged/resized to.
  5629. // an object with optional start and end properties.
  5630. validUnzonedRange: validUnzonedRange,
  5631. // range the view is formally responsible for.
  5632. // for example, a month view might have 1st-31st, excluding padded dates
  5633. currentUnzonedRange: currentInfo.unzonedRange,
  5634. // name of largest unit being displayed, like "month" or "week"
  5635. currentRangeUnit: currentInfo.unit,
  5636. isRangeAllDay: isRangeAllDay,
  5637. // dates that display events and accept drag-n-drop
  5638. // will be `null` if no dates accept events
  5639. activeUnzonedRange: activeUnzonedRange,
  5640. // date range with a rendered skeleton
  5641. // includes not-active days that need some sort of DOM
  5642. renderUnzonedRange: renderUnzonedRange,
  5643. // Duration object that denotes the first visible time of any given day
  5644. minTime: minTime,
  5645. // Duration object that denotes the exclusive visible end time of any given day
  5646. maxTime: maxTime,
  5647. isValid: isValid,
  5648. date: date,
  5649. // how far the current date will move for a prev/next operation
  5650. dateIncrement: this.buildDateIncrement(currentInfo.duration)
  5651. // pass a fallback (might be null) ^
  5652. };
  5653. };
  5654. // Builds an object with optional start/end properties.
  5655. // Indicates the minimum/maximum dates to display.
  5656. // not responsible for trimming hidden days.
  5657. DateProfileGenerator.prototype.buildValidRange = function () {
  5658. return this._view.getUnzonedRangeOption('validRange', this._view.calendar.getNow()) ||
  5659. new UnzonedRange_1.default(); // completely open-ended
  5660. };
  5661. // Builds a structure with info about the "current" range, the range that is
  5662. // highlighted as being the current month for example.
  5663. // See build() for a description of `direction`.
  5664. // Guaranteed to have `range` and `unit` properties. `duration` is optional.
  5665. // TODO: accept a MS-time instead of a moment `date`?
  5666. DateProfileGenerator.prototype.buildCurrentRangeInfo = function (date, direction) {
  5667. var viewSpec = this._view.viewSpec;
  5668. var duration = null;
  5669. var unit = null;
  5670. var unzonedRange = null;
  5671. var dayCount;
  5672. if (viewSpec.duration) {
  5673. duration = viewSpec.duration;
  5674. unit = viewSpec.durationUnit;
  5675. unzonedRange = this.buildRangeFromDuration(date, direction, duration, unit);
  5676. }
  5677. else if ((dayCount = this.opt('dayCount'))) {
  5678. unit = 'day';
  5679. unzonedRange = this.buildRangeFromDayCount(date, direction, dayCount);
  5680. }
  5681. else if ((unzonedRange = this.buildCustomVisibleRange(date))) {
  5682. unit = util_1.computeGreatestUnit(unzonedRange.getStart(), unzonedRange.getEnd());
  5683. }
  5684. else {
  5685. duration = this.getFallbackDuration();
  5686. unit = util_1.computeGreatestUnit(duration);
  5687. unzonedRange = this.buildRangeFromDuration(date, direction, duration, unit);
  5688. }
  5689. return { duration: duration, unit: unit, unzonedRange: unzonedRange };
  5690. };
  5691. DateProfileGenerator.prototype.getFallbackDuration = function () {
  5692. return moment.duration({ days: 1 });
  5693. };
  5694. // Returns a new activeUnzonedRange to have time values (un-ambiguate)
  5695. // minTime or maxTime causes the range to expand.
  5696. DateProfileGenerator.prototype.adjustActiveRange = function (unzonedRange, minTime, maxTime) {
  5697. var start = unzonedRange.getStart();
  5698. var end = unzonedRange.getEnd();
  5699. if (this._view.usesMinMaxTime) {
  5700. if (minTime < 0) {
  5701. start.time(0).add(minTime);
  5702. }
  5703. if (maxTime > 24 * 60 * 60 * 1000) { // beyond 24 hours?
  5704. end.time(maxTime - (24 * 60 * 60 * 1000));
  5705. }
  5706. }
  5707. return new UnzonedRange_1.default(start, end);
  5708. };
  5709. // Builds the "current" range when it is specified as an explicit duration.
  5710. // `unit` is the already-computed computeGreatestUnit value of duration.
  5711. // TODO: accept a MS-time instead of a moment `date`?
  5712. DateProfileGenerator.prototype.buildRangeFromDuration = function (date, direction, duration, unit) {
  5713. var alignment = this.opt('dateAlignment');
  5714. var dateIncrementInput;
  5715. var dateIncrementDuration;
  5716. var start;
  5717. var end;
  5718. var res;
  5719. // compute what the alignment should be
  5720. if (!alignment) {
  5721. dateIncrementInput = this.opt('dateIncrement');
  5722. if (dateIncrementInput) {
  5723. dateIncrementDuration = moment.duration(dateIncrementInput);
  5724. // use the smaller of the two units
  5725. if (dateIncrementDuration < duration) {
  5726. alignment = util_1.computeDurationGreatestUnit(dateIncrementDuration, dateIncrementInput);
  5727. }
  5728. else {
  5729. alignment = unit;
  5730. }
  5731. }
  5732. else {
  5733. alignment = unit;
  5734. }
  5735. }
  5736. // if the view displays a single day or smaller
  5737. if (duration.as('days') <= 1) {
  5738. if (this._view.isHiddenDay(start)) {
  5739. start = this._view.skipHiddenDays(start, direction);
  5740. start.startOf('day');
  5741. }
  5742. }
  5743. function computeRes() {
  5744. start = date.clone().startOf(alignment);
  5745. end = start.clone().add(duration);
  5746. res = new UnzonedRange_1.default(start, end);
  5747. }
  5748. computeRes();
  5749. // if range is completely enveloped by hidden days, go past the hidden days
  5750. if (!this.trimHiddenDays(res)) {
  5751. date = this._view.skipHiddenDays(date, direction);
  5752. computeRes();
  5753. }
  5754. return res;
  5755. };
  5756. // Builds the "current" range when a dayCount is specified.
  5757. // TODO: accept a MS-time instead of a moment `date`?
  5758. DateProfileGenerator.prototype.buildRangeFromDayCount = function (date, direction, dayCount) {
  5759. var customAlignment = this.opt('dateAlignment');
  5760. var runningCount = 0;
  5761. var start;
  5762. var end;
  5763. if (customAlignment || direction !== -1) {
  5764. start = date.clone();
  5765. if (customAlignment) {
  5766. start.startOf(customAlignment);
  5767. }
  5768. start.startOf('day');
  5769. start = this._view.skipHiddenDays(start);
  5770. end = start.clone();
  5771. do {
  5772. end.add(1, 'day');
  5773. if (!this._view.isHiddenDay(end)) {
  5774. runningCount++;
  5775. }
  5776. } while (runningCount < dayCount);
  5777. }
  5778. else {
  5779. end = date.clone().startOf('day').add(1, 'day');
  5780. end = this._view.skipHiddenDays(end, -1, true);
  5781. start = end.clone();
  5782. do {
  5783. start.add(-1, 'day');
  5784. if (!this._view.isHiddenDay(start)) {
  5785. runningCount++;
  5786. }
  5787. } while (runningCount < dayCount);
  5788. }
  5789. return new UnzonedRange_1.default(start, end);
  5790. };
  5791. // Builds a normalized range object for the "visible" range,
  5792. // which is a way to define the currentUnzonedRange and activeUnzonedRange at the same time.
  5793. // TODO: accept a MS-time instead of a moment `date`?
  5794. DateProfileGenerator.prototype.buildCustomVisibleRange = function (date) {
  5795. var visibleUnzonedRange = this._view.getUnzonedRangeOption('visibleRange', this._view.calendar.applyTimezone(date) // correct zone. also generates new obj that avoids mutations
  5796. );
  5797. if (visibleUnzonedRange && (visibleUnzonedRange.startMs == null || visibleUnzonedRange.endMs == null)) {
  5798. return null;
  5799. }
  5800. return visibleUnzonedRange;
  5801. };
  5802. // Computes the range that will represent the element/cells for *rendering*,
  5803. // but which may have voided days/times.
  5804. // not responsible for trimming hidden days.
  5805. DateProfileGenerator.prototype.buildRenderRange = function (currentUnzonedRange, currentRangeUnit, isRangeAllDay) {
  5806. return currentUnzonedRange.clone();
  5807. };
  5808. // Compute the duration value that should be added/substracted to the current date
  5809. // when a prev/next operation happens.
  5810. DateProfileGenerator.prototype.buildDateIncrement = function (fallback) {
  5811. var dateIncrementInput = this.opt('dateIncrement');
  5812. var customAlignment;
  5813. if (dateIncrementInput) {
  5814. return moment.duration(dateIncrementInput);
  5815. }
  5816. else if ((customAlignment = this.opt('dateAlignment'))) {
  5817. return moment.duration(1, customAlignment);
  5818. }
  5819. else if (fallback) {
  5820. return fallback;
  5821. }
  5822. else {
  5823. return moment.duration({ days: 1 });
  5824. }
  5825. };
  5826. return DateProfileGenerator;
  5827. }());
  5828. exports.default = DateProfileGenerator;
  5829. /***/ }),
  5830. /* 56 */
  5831. /***/ (function(module, exports, __webpack_require__) {
  5832. Object.defineProperty(exports, "__esModule", { value: true });
  5833. var tslib_1 = __webpack_require__(2);
  5834. var $ = __webpack_require__(3);
  5835. var util_1 = __webpack_require__(4);
  5836. var Promise_1 = __webpack_require__(21);
  5837. var EventSource_1 = __webpack_require__(6);
  5838. var SingleEventDef_1 = __webpack_require__(9);
  5839. var ArrayEventSource = /** @class */ (function (_super) {
  5840. tslib_1.__extends(ArrayEventSource, _super);
  5841. function ArrayEventSource(calendar) {
  5842. var _this = _super.call(this, calendar) || this;
  5843. _this.eventDefs = []; // for if setRawEventDefs is never called
  5844. return _this;
  5845. }
  5846. ArrayEventSource.parse = function (rawInput, calendar) {
  5847. var rawProps;
  5848. // normalize raw input
  5849. if ($.isArray(rawInput.events)) { // extended form
  5850. rawProps = rawInput;
  5851. }
  5852. else if ($.isArray(rawInput)) { // short form
  5853. rawProps = { events: rawInput };
  5854. }
  5855. if (rawProps) {
  5856. return EventSource_1.default.parse.call(this, rawProps, calendar);
  5857. }
  5858. return false;
  5859. };
  5860. ArrayEventSource.prototype.setRawEventDefs = function (rawEventDefs) {
  5861. this.rawEventDefs = rawEventDefs;
  5862. this.eventDefs = this.parseEventDefs(rawEventDefs);
  5863. };
  5864. ArrayEventSource.prototype.fetch = function (start, end, timezone) {
  5865. var eventDefs = this.eventDefs;
  5866. var i;
  5867. if (this.currentTimezone != null &&
  5868. this.currentTimezone !== timezone) {
  5869. for (i = 0; i < eventDefs.length; i++) {
  5870. if (eventDefs[i] instanceof SingleEventDef_1.default) {
  5871. eventDefs[i].rezone();
  5872. }
  5873. }
  5874. }
  5875. this.currentTimezone = timezone;
  5876. return Promise_1.default.resolve(eventDefs);
  5877. };
  5878. ArrayEventSource.prototype.addEventDef = function (eventDef) {
  5879. this.eventDefs.push(eventDef);
  5880. };
  5881. /*
  5882. eventDefId already normalized to a string
  5883. */
  5884. ArrayEventSource.prototype.removeEventDefsById = function (eventDefId) {
  5885. return util_1.removeMatching(this.eventDefs, function (eventDef) {
  5886. return eventDef.id === eventDefId;
  5887. });
  5888. };
  5889. ArrayEventSource.prototype.removeAllEventDefs = function () {
  5890. this.eventDefs = [];
  5891. };
  5892. ArrayEventSource.prototype.getPrimitive = function () {
  5893. return this.rawEventDefs;
  5894. };
  5895. ArrayEventSource.prototype.applyManualStandardProps = function (rawProps) {
  5896. var superSuccess = _super.prototype.applyManualStandardProps.call(this, rawProps);
  5897. this.setRawEventDefs(rawProps.events);
  5898. return superSuccess;
  5899. };
  5900. return ArrayEventSource;
  5901. }(EventSource_1.default));
  5902. exports.default = ArrayEventSource;
  5903. ArrayEventSource.defineStandardProps({
  5904. events: false // don't automatically transfer
  5905. });
  5906. /***/ }),
  5907. /* 57 */
  5908. /***/ (function(module, exports, __webpack_require__) {
  5909. Object.defineProperty(exports, "__esModule", { value: true });
  5910. var StandardTheme_1 = __webpack_require__(221);
  5911. var JqueryUiTheme_1 = __webpack_require__(222);
  5912. var themeClassHash = {};
  5913. function defineThemeSystem(themeName, themeClass) {
  5914. themeClassHash[themeName] = themeClass;
  5915. }
  5916. exports.defineThemeSystem = defineThemeSystem;
  5917. function getThemeSystemClass(themeSetting) {
  5918. if (!themeSetting) {
  5919. return StandardTheme_1.default;
  5920. }
  5921. else if (themeSetting === true) {
  5922. return JqueryUiTheme_1.default;
  5923. }
  5924. else {
  5925. return themeClassHash[themeSetting];
  5926. }
  5927. }
  5928. exports.getThemeSystemClass = getThemeSystemClass;
  5929. /***/ }),
  5930. /* 58 */
  5931. /***/ (function(module, exports, __webpack_require__) {
  5932. Object.defineProperty(exports, "__esModule", { value: true });
  5933. var $ = __webpack_require__(3);
  5934. var util_1 = __webpack_require__(4);
  5935. /*
  5936. A cache for the left/right/top/bottom/width/height values for one or more elements.
  5937. Works with both offset (from topleft document) and position (from offsetParent).
  5938. options:
  5939. - els
  5940. - isHorizontal
  5941. - isVertical
  5942. */
  5943. var CoordCache = /** @class */ (function () {
  5944. function CoordCache(options) {
  5945. this.isHorizontal = false; // whether to query for left/right/width
  5946. this.isVertical = false; // whether to query for top/bottom/height
  5947. this.els = $(options.els);
  5948. this.isHorizontal = options.isHorizontal;
  5949. this.isVertical = options.isVertical;
  5950. this.forcedOffsetParentEl = options.offsetParent ? $(options.offsetParent) : null;
  5951. }
  5952. // Queries the els for coordinates and stores them.
  5953. // Call this method before using and of the get* methods below.
  5954. CoordCache.prototype.build = function () {
  5955. var offsetParentEl = this.forcedOffsetParentEl;
  5956. if (!offsetParentEl && this.els.length > 0) {
  5957. offsetParentEl = this.els.eq(0).offsetParent();
  5958. }
  5959. this.origin = offsetParentEl ?
  5960. offsetParentEl.offset() :
  5961. null;
  5962. this.boundingRect = this.queryBoundingRect();
  5963. if (this.isHorizontal) {
  5964. this.buildElHorizontals();
  5965. }
  5966. if (this.isVertical) {
  5967. this.buildElVerticals();
  5968. }
  5969. };
  5970. // Destroys all internal data about coordinates, freeing memory
  5971. CoordCache.prototype.clear = function () {
  5972. this.origin = null;
  5973. this.boundingRect = null;
  5974. this.lefts = null;
  5975. this.rights = null;
  5976. this.tops = null;
  5977. this.bottoms = null;
  5978. };
  5979. // When called, if coord caches aren't built, builds them
  5980. CoordCache.prototype.ensureBuilt = function () {
  5981. if (!this.origin) {
  5982. this.build();
  5983. }
  5984. };
  5985. // Populates the left/right internal coordinate arrays
  5986. CoordCache.prototype.buildElHorizontals = function () {
  5987. var lefts = [];
  5988. var rights = [];
  5989. this.els.each(function (i, node) {
  5990. var el = $(node);
  5991. var left = el.offset().left;
  5992. var width = el.outerWidth();
  5993. lefts.push(left);
  5994. rights.push(left + width);
  5995. });
  5996. this.lefts = lefts;
  5997. this.rights = rights;
  5998. };
  5999. // Populates the top/bottom internal coordinate arrays
  6000. CoordCache.prototype.buildElVerticals = function () {
  6001. var tops = [];
  6002. var bottoms = [];
  6003. this.els.each(function (i, node) {
  6004. var el = $(node);
  6005. var top = el.offset().top;
  6006. var height = el.outerHeight();
  6007. tops.push(top);
  6008. bottoms.push(top + height);
  6009. });
  6010. this.tops = tops;
  6011. this.bottoms = bottoms;
  6012. };
  6013. // Given a left offset (from document left), returns the index of the el that it horizontally intersects.
  6014. // If no intersection is made, returns undefined.
  6015. CoordCache.prototype.getHorizontalIndex = function (leftOffset) {
  6016. this.ensureBuilt();
  6017. var lefts = this.lefts;
  6018. var rights = this.rights;
  6019. var len = lefts.length;
  6020. var i;
  6021. for (i = 0; i < len; i++) {
  6022. if (leftOffset >= lefts[i] && leftOffset < rights[i]) {
  6023. return i;
  6024. }
  6025. }
  6026. };
  6027. // Given a top offset (from document top), returns the index of the el that it vertically intersects.
  6028. // If no intersection is made, returns undefined.
  6029. CoordCache.prototype.getVerticalIndex = function (topOffset) {
  6030. this.ensureBuilt();
  6031. var tops = this.tops;
  6032. var bottoms = this.bottoms;
  6033. var len = tops.length;
  6034. var i;
  6035. for (i = 0; i < len; i++) {
  6036. if (topOffset >= tops[i] && topOffset < bottoms[i]) {
  6037. return i;
  6038. }
  6039. }
  6040. };
  6041. // Gets the left offset (from document left) of the element at the given index
  6042. CoordCache.prototype.getLeftOffset = function (leftIndex) {
  6043. this.ensureBuilt();
  6044. return this.lefts[leftIndex];
  6045. };
  6046. // Gets the left position (from offsetParent left) of the element at the given index
  6047. CoordCache.prototype.getLeftPosition = function (leftIndex) {
  6048. this.ensureBuilt();
  6049. return this.lefts[leftIndex] - this.origin.left;
  6050. };
  6051. // Gets the right offset (from document left) of the element at the given index.
  6052. // This value is NOT relative to the document's right edge, like the CSS concept of "right" would be.
  6053. CoordCache.prototype.getRightOffset = function (leftIndex) {
  6054. this.ensureBuilt();
  6055. return this.rights[leftIndex];
  6056. };
  6057. // Gets the right position (from offsetParent left) of the element at the given index.
  6058. // This value is NOT relative to the offsetParent's right edge, like the CSS concept of "right" would be.
  6059. CoordCache.prototype.getRightPosition = function (leftIndex) {
  6060. this.ensureBuilt();
  6061. return this.rights[leftIndex] - this.origin.left;
  6062. };
  6063. // Gets the width of the element at the given index
  6064. CoordCache.prototype.getWidth = function (leftIndex) {
  6065. this.ensureBuilt();
  6066. return this.rights[leftIndex] - this.lefts[leftIndex];
  6067. };
  6068. // Gets the top offset (from document top) of the element at the given index
  6069. CoordCache.prototype.getTopOffset = function (topIndex) {
  6070. this.ensureBuilt();
  6071. return this.tops[topIndex];
  6072. };
  6073. // Gets the top position (from offsetParent top) of the element at the given position
  6074. CoordCache.prototype.getTopPosition = function (topIndex) {
  6075. this.ensureBuilt();
  6076. return this.tops[topIndex] - this.origin.top;
  6077. };
  6078. // Gets the bottom offset (from the document top) of the element at the given index.
  6079. // This value is NOT relative to the offsetParent's bottom edge, like the CSS concept of "bottom" would be.
  6080. CoordCache.prototype.getBottomOffset = function (topIndex) {
  6081. this.ensureBuilt();
  6082. return this.bottoms[topIndex];
  6083. };
  6084. // Gets the bottom position (from the offsetParent top) of the element at the given index.
  6085. // This value is NOT relative to the offsetParent's bottom edge, like the CSS concept of "bottom" would be.
  6086. CoordCache.prototype.getBottomPosition = function (topIndex) {
  6087. this.ensureBuilt();
  6088. return this.bottoms[topIndex] - this.origin.top;
  6089. };
  6090. // Gets the height of the element at the given index
  6091. CoordCache.prototype.getHeight = function (topIndex) {
  6092. this.ensureBuilt();
  6093. return this.bottoms[topIndex] - this.tops[topIndex];
  6094. };
  6095. // Bounding Rect
  6096. // TODO: decouple this from CoordCache
  6097. // Compute and return what the elements' bounding rectangle is, from the user's perspective.
  6098. // Right now, only returns a rectangle if constrained by an overflow:scroll element.
  6099. // Returns null if there are no elements
  6100. CoordCache.prototype.queryBoundingRect = function () {
  6101. var scrollParentEl;
  6102. if (this.els.length > 0) {
  6103. scrollParentEl = util_1.getScrollParent(this.els.eq(0));
  6104. if (!scrollParentEl.is(document) &&
  6105. !scrollParentEl.is('html,body') // don't consider these bounding rects. solves issue 3615
  6106. ) {
  6107. return util_1.getClientRect(scrollParentEl);
  6108. }
  6109. }
  6110. return null;
  6111. };
  6112. CoordCache.prototype.isPointInBounds = function (leftOffset, topOffset) {
  6113. return this.isLeftInBounds(leftOffset) && this.isTopInBounds(topOffset);
  6114. };
  6115. CoordCache.prototype.isLeftInBounds = function (leftOffset) {
  6116. return !this.boundingRect || (leftOffset >= this.boundingRect.left && leftOffset < this.boundingRect.right);
  6117. };
  6118. CoordCache.prototype.isTopInBounds = function (topOffset) {
  6119. return !this.boundingRect || (topOffset >= this.boundingRect.top && topOffset < this.boundingRect.bottom);
  6120. };
  6121. return CoordCache;
  6122. }());
  6123. exports.default = CoordCache;
  6124. /***/ }),
  6125. /* 59 */
  6126. /***/ (function(module, exports, __webpack_require__) {
  6127. Object.defineProperty(exports, "__esModule", { value: true });
  6128. var $ = __webpack_require__(3);
  6129. var util_1 = __webpack_require__(4);
  6130. var ListenerMixin_1 = __webpack_require__(7);
  6131. var GlobalEmitter_1 = __webpack_require__(23);
  6132. /* Tracks a drag's mouse movement, firing various handlers
  6133. ----------------------------------------------------------------------------------------------------------------------*/
  6134. // TODO: use Emitter
  6135. var DragListener = /** @class */ (function () {
  6136. function DragListener(options) {
  6137. this.isInteracting = false;
  6138. this.isDistanceSurpassed = false;
  6139. this.isDelayEnded = false;
  6140. this.isDragging = false;
  6141. this.isTouch = false;
  6142. this.isGeneric = false; // initiated by 'dragstart' (jqui)
  6143. this.shouldCancelTouchScroll = true;
  6144. this.scrollAlwaysKills = false;
  6145. this.isAutoScroll = false;
  6146. // defaults
  6147. this.scrollSensitivity = 30; // pixels from edge for scrolling to start
  6148. this.scrollSpeed = 200; // pixels per second, at maximum speed
  6149. this.scrollIntervalMs = 50; // millisecond wait between scroll increment
  6150. this.options = options || {};
  6151. }
  6152. // Interaction (high-level)
  6153. // -----------------------------------------------------------------------------------------------------------------
  6154. DragListener.prototype.startInteraction = function (ev, extraOptions) {
  6155. if (extraOptions === void 0) { extraOptions = {}; }
  6156. if (ev.type === 'mousedown') {
  6157. if (GlobalEmitter_1.default.get().shouldIgnoreMouse()) {
  6158. return;
  6159. }
  6160. else if (!util_1.isPrimaryMouseButton(ev)) {
  6161. return;
  6162. }
  6163. else {
  6164. ev.preventDefault(); // prevents native selection in most browsers
  6165. }
  6166. }
  6167. if (!this.isInteracting) {
  6168. // process options
  6169. this.delay = util_1.firstDefined(extraOptions.delay, this.options.delay, 0);
  6170. this.minDistance = util_1.firstDefined(extraOptions.distance, this.options.distance, 0);
  6171. this.subjectEl = this.options.subjectEl;
  6172. util_1.preventSelection($('body'));
  6173. this.isInteracting = true;
  6174. this.isTouch = util_1.getEvIsTouch(ev);
  6175. this.isGeneric = ev.type === 'dragstart';
  6176. this.isDelayEnded = false;
  6177. this.isDistanceSurpassed = false;
  6178. this.originX = util_1.getEvX(ev);
  6179. this.originY = util_1.getEvY(ev);
  6180. this.scrollEl = util_1.getScrollParent($(ev.target));
  6181. this.bindHandlers();
  6182. this.initAutoScroll();
  6183. this.handleInteractionStart(ev);
  6184. this.startDelay(ev);
  6185. if (!this.minDistance) {
  6186. this.handleDistanceSurpassed(ev);
  6187. }
  6188. }
  6189. };
  6190. DragListener.prototype.handleInteractionStart = function (ev) {
  6191. this.trigger('interactionStart', ev);
  6192. };
  6193. DragListener.prototype.endInteraction = function (ev, isCancelled) {
  6194. if (this.isInteracting) {
  6195. this.endDrag(ev);
  6196. if (this.delayTimeoutId) {
  6197. clearTimeout(this.delayTimeoutId);
  6198. this.delayTimeoutId = null;
  6199. }
  6200. this.destroyAutoScroll();
  6201. this.unbindHandlers();
  6202. this.isInteracting = false;
  6203. this.handleInteractionEnd(ev, isCancelled);
  6204. util_1.allowSelection($('body'));
  6205. }
  6206. };
  6207. DragListener.prototype.handleInteractionEnd = function (ev, isCancelled) {
  6208. this.trigger('interactionEnd', ev, isCancelled || false);
  6209. };
  6210. // Binding To DOM
  6211. // -----------------------------------------------------------------------------------------------------------------
  6212. DragListener.prototype.bindHandlers = function () {
  6213. // some browsers (Safari in iOS 10) don't allow preventDefault on touch events that are bound after touchstart,
  6214. // so listen to the GlobalEmitter singleton, which is always bound, instead of the document directly.
  6215. var globalEmitter = GlobalEmitter_1.default.get();
  6216. if (this.isGeneric) {
  6217. this.listenTo($(document), {
  6218. drag: this.handleMove,
  6219. dragstop: this.endInteraction
  6220. });
  6221. }
  6222. else if (this.isTouch) {
  6223. this.listenTo(globalEmitter, {
  6224. touchmove: this.handleTouchMove,
  6225. touchend: this.endInteraction,
  6226. scroll: this.handleTouchScroll
  6227. });
  6228. }
  6229. else {
  6230. this.listenTo(globalEmitter, {
  6231. mousemove: this.handleMouseMove,
  6232. mouseup: this.endInteraction
  6233. });
  6234. }
  6235. this.listenTo(globalEmitter, {
  6236. selectstart: util_1.preventDefault,
  6237. contextmenu: util_1.preventDefault // long taps would open menu on Chrome dev tools
  6238. });
  6239. };
  6240. DragListener.prototype.unbindHandlers = function () {
  6241. this.stopListeningTo(GlobalEmitter_1.default.get());
  6242. this.stopListeningTo($(document)); // for isGeneric
  6243. };
  6244. // Drag (high-level)
  6245. // -----------------------------------------------------------------------------------------------------------------
  6246. // extraOptions ignored if drag already started
  6247. DragListener.prototype.startDrag = function (ev, extraOptions) {
  6248. this.startInteraction(ev, extraOptions); // ensure interaction began
  6249. if (!this.isDragging) {
  6250. this.isDragging = true;
  6251. this.handleDragStart(ev);
  6252. }
  6253. };
  6254. DragListener.prototype.handleDragStart = function (ev) {
  6255. this.trigger('dragStart', ev);
  6256. };
  6257. DragListener.prototype.handleMove = function (ev) {
  6258. var dx = util_1.getEvX(ev) - this.originX;
  6259. var dy = util_1.getEvY(ev) - this.originY;
  6260. var minDistance = this.minDistance;
  6261. var distanceSq; // current distance from the origin, squared
  6262. if (!this.isDistanceSurpassed) {
  6263. distanceSq = dx * dx + dy * dy;
  6264. if (distanceSq >= minDistance * minDistance) { // use pythagorean theorem
  6265. this.handleDistanceSurpassed(ev);
  6266. }
  6267. }
  6268. if (this.isDragging) {
  6269. this.handleDrag(dx, dy, ev);
  6270. }
  6271. };
  6272. // Called while the mouse is being moved and when we know a legitimate drag is taking place
  6273. DragListener.prototype.handleDrag = function (dx, dy, ev) {
  6274. this.trigger('drag', dx, dy, ev);
  6275. this.updateAutoScroll(ev); // will possibly cause scrolling
  6276. };
  6277. DragListener.prototype.endDrag = function (ev) {
  6278. if (this.isDragging) {
  6279. this.isDragging = false;
  6280. this.handleDragEnd(ev);
  6281. }
  6282. };
  6283. DragListener.prototype.handleDragEnd = function (ev) {
  6284. this.trigger('dragEnd', ev);
  6285. };
  6286. // Delay
  6287. // -----------------------------------------------------------------------------------------------------------------
  6288. DragListener.prototype.startDelay = function (initialEv) {
  6289. var _this = this;
  6290. if (this.delay) {
  6291. this.delayTimeoutId = setTimeout(function () {
  6292. _this.handleDelayEnd(initialEv);
  6293. }, this.delay);
  6294. }
  6295. else {
  6296. this.handleDelayEnd(initialEv);
  6297. }
  6298. };
  6299. DragListener.prototype.handleDelayEnd = function (initialEv) {
  6300. this.isDelayEnded = true;
  6301. if (this.isDistanceSurpassed) {
  6302. this.startDrag(initialEv);
  6303. }
  6304. };
  6305. // Distance
  6306. // -----------------------------------------------------------------------------------------------------------------
  6307. DragListener.prototype.handleDistanceSurpassed = function (ev) {
  6308. this.isDistanceSurpassed = true;
  6309. if (this.isDelayEnded) {
  6310. this.startDrag(ev);
  6311. }
  6312. };
  6313. // Mouse / Touch
  6314. // -----------------------------------------------------------------------------------------------------------------
  6315. DragListener.prototype.handleTouchMove = function (ev) {
  6316. // prevent inertia and touchmove-scrolling while dragging
  6317. if (this.isDragging && this.shouldCancelTouchScroll) {
  6318. ev.preventDefault();
  6319. }
  6320. this.handleMove(ev);
  6321. };
  6322. DragListener.prototype.handleMouseMove = function (ev) {
  6323. this.handleMove(ev);
  6324. };
  6325. // Scrolling (unrelated to auto-scroll)
  6326. // -----------------------------------------------------------------------------------------------------------------
  6327. DragListener.prototype.handleTouchScroll = function (ev) {
  6328. // if the drag is being initiated by touch, but a scroll happens before
  6329. // the drag-initiating delay is over, cancel the drag
  6330. if (!this.isDragging || this.scrollAlwaysKills) {
  6331. this.endInteraction(ev, true); // isCancelled=true
  6332. }
  6333. };
  6334. // Utils
  6335. // -----------------------------------------------------------------------------------------------------------------
  6336. // Triggers a callback. Calls a function in the option hash of the same name.
  6337. // Arguments beyond the first `name` are forwarded on.
  6338. DragListener.prototype.trigger = function (name) {
  6339. var args = [];
  6340. for (var _i = 1; _i < arguments.length; _i++) {
  6341. args[_i - 1] = arguments[_i];
  6342. }
  6343. if (this.options[name]) {
  6344. this.options[name].apply(this, args);
  6345. }
  6346. // makes _methods callable by event name. TODO: kill this
  6347. if (this['_' + name]) {
  6348. this['_' + name].apply(this, args);
  6349. }
  6350. };
  6351. // Auto-scroll
  6352. // -----------------------------------------------------------------------------------------------------------------
  6353. DragListener.prototype.initAutoScroll = function () {
  6354. var scrollEl = this.scrollEl;
  6355. this.isAutoScroll =
  6356. this.options.scroll &&
  6357. scrollEl &&
  6358. !scrollEl.is(window) &&
  6359. !scrollEl.is(document);
  6360. if (this.isAutoScroll) {
  6361. // debounce makes sure rapid calls don't happen
  6362. this.listenTo(scrollEl, 'scroll', util_1.debounce(this.handleDebouncedScroll, 100));
  6363. }
  6364. };
  6365. DragListener.prototype.destroyAutoScroll = function () {
  6366. this.endAutoScroll(); // kill any animation loop
  6367. // remove the scroll handler if there is a scrollEl
  6368. if (this.isAutoScroll) {
  6369. this.stopListeningTo(this.scrollEl, 'scroll'); // will probably get removed by unbindHandlers too :(
  6370. }
  6371. };
  6372. // Computes and stores the bounding rectangle of scrollEl
  6373. DragListener.prototype.computeScrollBounds = function () {
  6374. if (this.isAutoScroll) {
  6375. this.scrollBounds = util_1.getOuterRect(this.scrollEl);
  6376. // TODO: use getClientRect in future. but prevents auto scrolling when on top of scrollbars
  6377. }
  6378. };
  6379. // Called when the dragging is in progress and scrolling should be updated
  6380. DragListener.prototype.updateAutoScroll = function (ev) {
  6381. var sensitivity = this.scrollSensitivity;
  6382. var bounds = this.scrollBounds;
  6383. var topCloseness;
  6384. var bottomCloseness;
  6385. var leftCloseness;
  6386. var rightCloseness;
  6387. var topVel = 0;
  6388. var leftVel = 0;
  6389. if (bounds) { // only scroll if scrollEl exists
  6390. // compute closeness to edges. valid range is from 0.0 - 1.0
  6391. topCloseness = (sensitivity - (util_1.getEvY(ev) - bounds.top)) / sensitivity;
  6392. bottomCloseness = (sensitivity - (bounds.bottom - util_1.getEvY(ev))) / sensitivity;
  6393. leftCloseness = (sensitivity - (util_1.getEvX(ev) - bounds.left)) / sensitivity;
  6394. rightCloseness = (sensitivity - (bounds.right - util_1.getEvX(ev))) / sensitivity;
  6395. // translate vertical closeness into velocity.
  6396. // mouse must be completely in bounds for velocity to happen.
  6397. if (topCloseness >= 0 && topCloseness <= 1) {
  6398. topVel = topCloseness * this.scrollSpeed * -1; // negative. for scrolling up
  6399. }
  6400. else if (bottomCloseness >= 0 && bottomCloseness <= 1) {
  6401. topVel = bottomCloseness * this.scrollSpeed;
  6402. }
  6403. // translate horizontal closeness into velocity
  6404. if (leftCloseness >= 0 && leftCloseness <= 1) {
  6405. leftVel = leftCloseness * this.scrollSpeed * -1; // negative. for scrolling left
  6406. }
  6407. else if (rightCloseness >= 0 && rightCloseness <= 1) {
  6408. leftVel = rightCloseness * this.scrollSpeed;
  6409. }
  6410. }
  6411. this.setScrollVel(topVel, leftVel);
  6412. };
  6413. // Sets the speed-of-scrolling for the scrollEl
  6414. DragListener.prototype.setScrollVel = function (topVel, leftVel) {
  6415. this.scrollTopVel = topVel;
  6416. this.scrollLeftVel = leftVel;
  6417. this.constrainScrollVel(); // massages into realistic values
  6418. // if there is non-zero velocity, and an animation loop hasn't already started, then START
  6419. if ((this.scrollTopVel || this.scrollLeftVel) && !this.scrollIntervalId) {
  6420. this.scrollIntervalId = setInterval(util_1.proxy(this, 'scrollIntervalFunc'), // scope to `this`
  6421. this.scrollIntervalMs);
  6422. }
  6423. };
  6424. // Forces scrollTopVel and scrollLeftVel to be zero if scrolling has already gone all the way
  6425. DragListener.prototype.constrainScrollVel = function () {
  6426. var el = this.scrollEl;
  6427. if (this.scrollTopVel < 0) { // scrolling up?
  6428. if (el.scrollTop() <= 0) { // already scrolled all the way up?
  6429. this.scrollTopVel = 0;
  6430. }
  6431. }
  6432. else if (this.scrollTopVel > 0) { // scrolling down?
  6433. if (el.scrollTop() + el[0].clientHeight >= el[0].scrollHeight) { // already scrolled all the way down?
  6434. this.scrollTopVel = 0;
  6435. }
  6436. }
  6437. if (this.scrollLeftVel < 0) { // scrolling left?
  6438. if (el.scrollLeft() <= 0) { // already scrolled all the left?
  6439. this.scrollLeftVel = 0;
  6440. }
  6441. }
  6442. else if (this.scrollLeftVel > 0) { // scrolling right?
  6443. if (el.scrollLeft() + el[0].clientWidth >= el[0].scrollWidth) { // already scrolled all the way right?
  6444. this.scrollLeftVel = 0;
  6445. }
  6446. }
  6447. };
  6448. // This function gets called during every iteration of the scrolling animation loop
  6449. DragListener.prototype.scrollIntervalFunc = function () {
  6450. var el = this.scrollEl;
  6451. var frac = this.scrollIntervalMs / 1000; // considering animation frequency, what the vel should be mult'd by
  6452. // change the value of scrollEl's scroll
  6453. if (this.scrollTopVel) {
  6454. el.scrollTop(el.scrollTop() + this.scrollTopVel * frac);
  6455. }
  6456. if (this.scrollLeftVel) {
  6457. el.scrollLeft(el.scrollLeft() + this.scrollLeftVel * frac);
  6458. }
  6459. this.constrainScrollVel(); // since the scroll values changed, recompute the velocities
  6460. // if scrolled all the way, which causes the vels to be zero, stop the animation loop
  6461. if (!this.scrollTopVel && !this.scrollLeftVel) {
  6462. this.endAutoScroll();
  6463. }
  6464. };
  6465. // Kills any existing scrolling animation loop
  6466. DragListener.prototype.endAutoScroll = function () {
  6467. if (this.scrollIntervalId) {
  6468. clearInterval(this.scrollIntervalId);
  6469. this.scrollIntervalId = null;
  6470. this.handleScrollEnd();
  6471. }
  6472. };
  6473. // Get called when the scrollEl is scrolled (NOTE: this is delayed via debounce)
  6474. DragListener.prototype.handleDebouncedScroll = function () {
  6475. // recompute all coordinates, but *only* if this is *not* part of our scrolling animation
  6476. if (!this.scrollIntervalId) {
  6477. this.handleScrollEnd();
  6478. }
  6479. };
  6480. DragListener.prototype.handleScrollEnd = function () {
  6481. // Called when scrolling has stopped, whether through auto scroll, or the user scrolling
  6482. };
  6483. return DragListener;
  6484. }());
  6485. exports.default = DragListener;
  6486. ListenerMixin_1.default.mixInto(DragListener);
  6487. /***/ }),
  6488. /* 60 */
  6489. /***/ (function(module, exports, __webpack_require__) {
  6490. Object.defineProperty(exports, "__esModule", { value: true });
  6491. var tslib_1 = __webpack_require__(2);
  6492. var util_1 = __webpack_require__(4);
  6493. var Mixin_1 = __webpack_require__(15);
  6494. /*
  6495. A set of rendering and date-related methods for a visual component comprised of one or more rows of day columns.
  6496. Prerequisite: the object being mixed into needs to be a *Grid*
  6497. */
  6498. var DayTableMixin = /** @class */ (function (_super) {
  6499. tslib_1.__extends(DayTableMixin, _super);
  6500. function DayTableMixin() {
  6501. return _super !== null && _super.apply(this, arguments) || this;
  6502. }
  6503. // Populates internal variables used for date calculation and rendering
  6504. DayTableMixin.prototype.updateDayTable = function () {
  6505. var t = this;
  6506. var view = t.view;
  6507. var calendar = view.calendar;
  6508. var date = calendar.msToUtcMoment(t.dateProfile.renderUnzonedRange.startMs, true);
  6509. var end = calendar.msToUtcMoment(t.dateProfile.renderUnzonedRange.endMs, true);
  6510. var dayIndex = -1;
  6511. var dayIndices = [];
  6512. var dayDates = [];
  6513. var daysPerRow;
  6514. var firstDay;
  6515. var rowCnt;
  6516. while (date.isBefore(end)) { // loop each day from start to end
  6517. if (view.isHiddenDay(date)) {
  6518. dayIndices.push(dayIndex + 0.5); // mark that it's between indices
  6519. }
  6520. else {
  6521. dayIndex++;
  6522. dayIndices.push(dayIndex);
  6523. dayDates.push(date.clone());
  6524. }
  6525. date.add(1, 'days');
  6526. }
  6527. if (this.breakOnWeeks) {
  6528. // count columns until the day-of-week repeats
  6529. firstDay = dayDates[0].day();
  6530. for (daysPerRow = 1; daysPerRow < dayDates.length; daysPerRow++) {
  6531. if (dayDates[daysPerRow].day() === firstDay) {
  6532. break;
  6533. }
  6534. }
  6535. rowCnt = Math.ceil(dayDates.length / daysPerRow);
  6536. }
  6537. else {
  6538. rowCnt = 1;
  6539. daysPerRow = dayDates.length;
  6540. }
  6541. this.dayDates = dayDates;
  6542. this.dayIndices = dayIndices;
  6543. this.daysPerRow = daysPerRow;
  6544. this.rowCnt = rowCnt;
  6545. this.updateDayTableCols();
  6546. };
  6547. // Computes and assigned the colCnt property and updates any options that may be computed from it
  6548. DayTableMixin.prototype.updateDayTableCols = function () {
  6549. this.colCnt = this.computeColCnt();
  6550. this.colHeadFormat =
  6551. this.opt('columnHeaderFormat') ||
  6552. this.opt('columnFormat') || // deprecated
  6553. this.computeColHeadFormat();
  6554. };
  6555. // Determines how many columns there should be in the table
  6556. DayTableMixin.prototype.computeColCnt = function () {
  6557. return this.daysPerRow;
  6558. };
  6559. // Computes the ambiguously-timed moment for the given cell
  6560. DayTableMixin.prototype.getCellDate = function (row, col) {
  6561. return this.dayDates[this.getCellDayIndex(row, col)].clone();
  6562. };
  6563. // Computes the ambiguously-timed date range for the given cell
  6564. DayTableMixin.prototype.getCellRange = function (row, col) {
  6565. var start = this.getCellDate(row, col);
  6566. var end = start.clone().add(1, 'days');
  6567. return { start: start, end: end };
  6568. };
  6569. // Returns the number of day cells, chronologically, from the first of the grid (0-based)
  6570. DayTableMixin.prototype.getCellDayIndex = function (row, col) {
  6571. return row * this.daysPerRow + this.getColDayIndex(col);
  6572. };
  6573. // Returns the numner of day cells, chronologically, from the first cell in *any given row*
  6574. DayTableMixin.prototype.getColDayIndex = function (col) {
  6575. if (this.isRTL) {
  6576. return this.colCnt - 1 - col;
  6577. }
  6578. else {
  6579. return col;
  6580. }
  6581. };
  6582. // Given a date, returns its chronolocial cell-index from the first cell of the grid.
  6583. // If the date lies between cells (because of hiddenDays), returns a floating-point value between offsets.
  6584. // If before the first offset, returns a negative number.
  6585. // If after the last offset, returns an offset past the last cell offset.
  6586. // Only works for *start* dates of cells. Will not work for exclusive end dates for cells.
  6587. DayTableMixin.prototype.getDateDayIndex = function (date) {
  6588. var dayIndices = this.dayIndices;
  6589. var dayOffset = date.diff(this.dayDates[0], 'days');
  6590. if (dayOffset < 0) {
  6591. return dayIndices[0] - 1;
  6592. }
  6593. else if (dayOffset >= dayIndices.length) {
  6594. return dayIndices[dayIndices.length - 1] + 1;
  6595. }
  6596. else {
  6597. return dayIndices[dayOffset];
  6598. }
  6599. };
  6600. /* Options
  6601. ------------------------------------------------------------------------------------------------------------------*/
  6602. // Computes a default column header formatting string if `colFormat` is not explicitly defined
  6603. DayTableMixin.prototype.computeColHeadFormat = function () {
  6604. // if more than one week row, or if there are a lot of columns with not much space,
  6605. // put just the day numbers will be in each cell
  6606. if (this.rowCnt > 1 || this.colCnt > 10) {
  6607. return 'ddd'; // "Sat"
  6608. }
  6609. else if (this.colCnt > 1) {
  6610. return this.opt('dayOfMonthFormat'); // "Sat 12/10"
  6611. }
  6612. else {
  6613. return 'dddd'; // "Saturday"
  6614. }
  6615. };
  6616. /* Slicing
  6617. ------------------------------------------------------------------------------------------------------------------*/
  6618. // Slices up a date range into a segment for every week-row it intersects with
  6619. DayTableMixin.prototype.sliceRangeByRow = function (unzonedRange) {
  6620. var daysPerRow = this.daysPerRow;
  6621. var normalRange = this.view.computeDayRange(unzonedRange); // make whole-day range, considering nextDayThreshold
  6622. var rangeFirst = this.getDateDayIndex(normalRange.start); // inclusive first index
  6623. var rangeLast = this.getDateDayIndex(normalRange.end.clone().subtract(1, 'days')); // inclusive last index
  6624. var segs = [];
  6625. var row;
  6626. var rowFirst;
  6627. var rowLast; // inclusive day-index range for current row
  6628. var segFirst;
  6629. var segLast; // inclusive day-index range for segment
  6630. for (row = 0; row < this.rowCnt; row++) {
  6631. rowFirst = row * daysPerRow;
  6632. rowLast = rowFirst + daysPerRow - 1;
  6633. // intersect segment's offset range with the row's
  6634. segFirst = Math.max(rangeFirst, rowFirst);
  6635. segLast = Math.min(rangeLast, rowLast);
  6636. // deal with in-between indices
  6637. segFirst = Math.ceil(segFirst); // in-between starts round to next cell
  6638. segLast = Math.floor(segLast); // in-between ends round to prev cell
  6639. if (segFirst <= segLast) { // was there any intersection with the current row?
  6640. segs.push({
  6641. row: row,
  6642. // normalize to start of row
  6643. firstRowDayIndex: segFirst - rowFirst,
  6644. lastRowDayIndex: segLast - rowFirst,
  6645. // must be matching integers to be the segment's start/end
  6646. isStart: segFirst === rangeFirst,
  6647. isEnd: segLast === rangeLast
  6648. });
  6649. }
  6650. }
  6651. return segs;
  6652. };
  6653. // Slices up a date range into a segment for every day-cell it intersects with.
  6654. // TODO: make more DRY with sliceRangeByRow somehow.
  6655. DayTableMixin.prototype.sliceRangeByDay = function (unzonedRange) {
  6656. var daysPerRow = this.daysPerRow;
  6657. var normalRange = this.view.computeDayRange(unzonedRange); // make whole-day range, considering nextDayThreshold
  6658. var rangeFirst = this.getDateDayIndex(normalRange.start); // inclusive first index
  6659. var rangeLast = this.getDateDayIndex(normalRange.end.clone().subtract(1, 'days')); // inclusive last index
  6660. var segs = [];
  6661. var row;
  6662. var rowFirst;
  6663. var rowLast; // inclusive day-index range for current row
  6664. var i;
  6665. var segFirst;
  6666. var segLast; // inclusive day-index range for segment
  6667. for (row = 0; row < this.rowCnt; row++) {
  6668. rowFirst = row * daysPerRow;
  6669. rowLast = rowFirst + daysPerRow - 1;
  6670. for (i = rowFirst; i <= rowLast; i++) {
  6671. // intersect segment's offset range with the row's
  6672. segFirst = Math.max(rangeFirst, i);
  6673. segLast = Math.min(rangeLast, i);
  6674. // deal with in-between indices
  6675. segFirst = Math.ceil(segFirst); // in-between starts round to next cell
  6676. segLast = Math.floor(segLast); // in-between ends round to prev cell
  6677. if (segFirst <= segLast) { // was there any intersection with the current row?
  6678. segs.push({
  6679. row: row,
  6680. // normalize to start of row
  6681. firstRowDayIndex: segFirst - rowFirst,
  6682. lastRowDayIndex: segLast - rowFirst,
  6683. // must be matching integers to be the segment's start/end
  6684. isStart: segFirst === rangeFirst,
  6685. isEnd: segLast === rangeLast
  6686. });
  6687. }
  6688. }
  6689. }
  6690. return segs;
  6691. };
  6692. /* Header Rendering
  6693. ------------------------------------------------------------------------------------------------------------------*/
  6694. DayTableMixin.prototype.renderHeadHtml = function () {
  6695. var theme = this.view.calendar.theme;
  6696. return '' +
  6697. '<div class="fc-row ' + theme.getClass('headerRow') + '">' +
  6698. '<table class="' + theme.getClass('tableGrid') + '">' +
  6699. '<thead>' +
  6700. this.renderHeadTrHtml() +
  6701. '</thead>' +
  6702. '</table>' +
  6703. '</div>';
  6704. };
  6705. DayTableMixin.prototype.renderHeadIntroHtml = function () {
  6706. return this.renderIntroHtml(); // fall back to generic
  6707. };
  6708. DayTableMixin.prototype.renderHeadTrHtml = function () {
  6709. return '' +
  6710. '<tr>' +
  6711. (this.isRTL ? '' : this.renderHeadIntroHtml()) +
  6712. this.renderHeadDateCellsHtml() +
  6713. (this.isRTL ? this.renderHeadIntroHtml() : '') +
  6714. '</tr>';
  6715. };
  6716. DayTableMixin.prototype.renderHeadDateCellsHtml = function () {
  6717. var htmls = [];
  6718. var col;
  6719. var date;
  6720. for (col = 0; col < this.colCnt; col++) {
  6721. date = this.getCellDate(0, col);
  6722. htmls.push(this.renderHeadDateCellHtml(date));
  6723. }
  6724. return htmls.join('');
  6725. };
  6726. // TODO: when internalApiVersion, accept an object for HTML attributes
  6727. // (colspan should be no different)
  6728. DayTableMixin.prototype.renderHeadDateCellHtml = function (date, colspan, otherAttrs) {
  6729. var t = this;
  6730. var view = t.view;
  6731. var isDateValid = t.dateProfile.activeUnzonedRange.containsDate(date); // TODO: called too frequently. cache somehow.
  6732. var classNames = [
  6733. 'fc-day-header',
  6734. view.calendar.theme.getClass('widgetHeader')
  6735. ];
  6736. var innerHtml;
  6737. if (typeof t.opt('columnHeaderHtml') === 'function') {
  6738. innerHtml = t.opt('columnHeaderHtml')(date);
  6739. }
  6740. else if (typeof t.opt('columnHeaderText') === 'function') {
  6741. innerHtml = util_1.htmlEscape(t.opt('columnHeaderText')(date));
  6742. }
  6743. else {
  6744. innerHtml = util_1.htmlEscape(date.format(t.colHeadFormat));
  6745. }
  6746. // if only one row of days, the classNames on the header can represent the specific days beneath
  6747. if (t.rowCnt === 1) {
  6748. classNames = classNames.concat(
  6749. // includes the day-of-week class
  6750. // noThemeHighlight=true (don't highlight the header)
  6751. t.getDayClasses(date, true));
  6752. }
  6753. else {
  6754. classNames.push('fc-' + util_1.dayIDs[date.day()]); // only add the day-of-week class
  6755. }
  6756. return '' +
  6757. '<th class="' + classNames.join(' ') + '"' +
  6758. ((isDateValid && t.rowCnt) === 1 ?
  6759. ' data-date="' + date.format('YYYY-MM-DD') + '"' :
  6760. '') +
  6761. (colspan > 1 ?
  6762. ' colspan="' + colspan + '"' :
  6763. '') +
  6764. (otherAttrs ?
  6765. ' ' + otherAttrs :
  6766. '') +
  6767. '>' +
  6768. (isDateValid ?
  6769. // don't make a link if the heading could represent multiple days, or if there's only one day (forceOff)
  6770. view.buildGotoAnchorHtml({ date: date, forceOff: t.rowCnt > 1 || t.colCnt === 1 }, innerHtml) :
  6771. // if not valid, display text, but no link
  6772. innerHtml) +
  6773. '</th>';
  6774. };
  6775. /* Background Rendering
  6776. ------------------------------------------------------------------------------------------------------------------*/
  6777. DayTableMixin.prototype.renderBgTrHtml = function (row) {
  6778. return '' +
  6779. '<tr>' +
  6780. (this.isRTL ? '' : this.renderBgIntroHtml(row)) +
  6781. this.renderBgCellsHtml(row) +
  6782. (this.isRTL ? this.renderBgIntroHtml(row) : '') +
  6783. '</tr>';
  6784. };
  6785. DayTableMixin.prototype.renderBgIntroHtml = function (row) {
  6786. return this.renderIntroHtml(); // fall back to generic
  6787. };
  6788. DayTableMixin.prototype.renderBgCellsHtml = function (row) {
  6789. var htmls = [];
  6790. var col;
  6791. var date;
  6792. for (col = 0; col < this.colCnt; col++) {
  6793. date = this.getCellDate(row, col);
  6794. htmls.push(this.renderBgCellHtml(date));
  6795. }
  6796. return htmls.join('');
  6797. };
  6798. DayTableMixin.prototype.renderBgCellHtml = function (date, otherAttrs) {
  6799. var t = this;
  6800. var view = t.view;
  6801. var isDateValid = t.dateProfile.activeUnzonedRange.containsDate(date); // TODO: called too frequently. cache somehow.
  6802. var classes = t.getDayClasses(date);
  6803. classes.unshift('fc-day', view.calendar.theme.getClass('widgetContent'));
  6804. return '<td class="' + classes.join(' ') + '"' +
  6805. (isDateValid ?
  6806. ' data-date="' + date.format('YYYY-MM-DD') + '"' : // if date has a time, won't format it
  6807. '') +
  6808. (otherAttrs ?
  6809. ' ' + otherAttrs :
  6810. '') +
  6811. '></td>';
  6812. };
  6813. /* Generic
  6814. ------------------------------------------------------------------------------------------------------------------*/
  6815. DayTableMixin.prototype.renderIntroHtml = function () {
  6816. // Generates the default HTML intro for any row. User classes should override
  6817. };
  6818. // TODO: a generic method for dealing with <tr>, RTL, intro
  6819. // when increment internalApiVersion
  6820. // wrapTr (scheduler)
  6821. /* Utils
  6822. ------------------------------------------------------------------------------------------------------------------*/
  6823. // Applies the generic "intro" and "outro" HTML to the given cells.
  6824. // Intro means the leftmost cell when the calendar is LTR and the rightmost cell when RTL. Vice-versa for outro.
  6825. DayTableMixin.prototype.bookendCells = function (trEl) {
  6826. var introHtml = this.renderIntroHtml();
  6827. if (introHtml) {
  6828. if (this.isRTL) {
  6829. trEl.append(introHtml);
  6830. }
  6831. else {
  6832. trEl.prepend(introHtml);
  6833. }
  6834. }
  6835. };
  6836. return DayTableMixin;
  6837. }(Mixin_1.default));
  6838. exports.default = DayTableMixin;
  6839. /***/ }),
  6840. /* 61 */
  6841. /***/ (function(module, exports) {
  6842. Object.defineProperty(exports, "__esModule", { value: true });
  6843. var BusinessHourRenderer = /** @class */ (function () {
  6844. /*
  6845. component implements:
  6846. - eventRangesToEventFootprints
  6847. - eventFootprintsToSegs
  6848. */
  6849. function BusinessHourRenderer(component, fillRenderer) {
  6850. this.component = component;
  6851. this.fillRenderer = fillRenderer;
  6852. }
  6853. BusinessHourRenderer.prototype.render = function (businessHourGenerator) {
  6854. var component = this.component;
  6855. var unzonedRange = component._getDateProfile().activeUnzonedRange;
  6856. var eventInstanceGroup = businessHourGenerator.buildEventInstanceGroup(component.hasAllDayBusinessHours, unzonedRange);
  6857. var eventFootprints = eventInstanceGroup ?
  6858. component.eventRangesToEventFootprints(eventInstanceGroup.sliceRenderRanges(unzonedRange)) :
  6859. [];
  6860. this.renderEventFootprints(eventFootprints);
  6861. };
  6862. BusinessHourRenderer.prototype.renderEventFootprints = function (eventFootprints) {
  6863. var segs = this.component.eventFootprintsToSegs(eventFootprints);
  6864. this.renderSegs(segs);
  6865. this.segs = segs;
  6866. };
  6867. BusinessHourRenderer.prototype.renderSegs = function (segs) {
  6868. if (this.fillRenderer) {
  6869. this.fillRenderer.renderSegs('businessHours', segs, {
  6870. getClasses: function (seg) {
  6871. return ['fc-nonbusiness', 'fc-bgevent'];
  6872. }
  6873. });
  6874. }
  6875. };
  6876. BusinessHourRenderer.prototype.unrender = function () {
  6877. if (this.fillRenderer) {
  6878. this.fillRenderer.unrender('businessHours');
  6879. }
  6880. this.segs = null;
  6881. };
  6882. BusinessHourRenderer.prototype.getSegs = function () {
  6883. return this.segs || [];
  6884. };
  6885. return BusinessHourRenderer;
  6886. }());
  6887. exports.default = BusinessHourRenderer;
  6888. /***/ }),
  6889. /* 62 */
  6890. /***/ (function(module, exports, __webpack_require__) {
  6891. Object.defineProperty(exports, "__esModule", { value: true });
  6892. var $ = __webpack_require__(3);
  6893. var util_1 = __webpack_require__(4);
  6894. var FillRenderer = /** @class */ (function () {
  6895. function FillRenderer(component) {
  6896. this.fillSegTag = 'div';
  6897. this.component = component;
  6898. this.elsByFill = {};
  6899. }
  6900. FillRenderer.prototype.renderFootprint = function (type, componentFootprint, props) {
  6901. this.renderSegs(type, this.component.componentFootprintToSegs(componentFootprint), props);
  6902. };
  6903. FillRenderer.prototype.renderSegs = function (type, segs, props) {
  6904. var els;
  6905. segs = this.buildSegEls(type, segs, props); // assignes `.el` to each seg. returns successfully rendered segs
  6906. els = this.attachSegEls(type, segs);
  6907. if (els) {
  6908. this.reportEls(type, els);
  6909. }
  6910. return segs;
  6911. };
  6912. // Unrenders a specific type of fill that is currently rendered on the grid
  6913. FillRenderer.prototype.unrender = function (type) {
  6914. var el = this.elsByFill[type];
  6915. if (el) {
  6916. el.remove();
  6917. delete this.elsByFill[type];
  6918. }
  6919. };
  6920. // Renders and assigns an `el` property for each fill segment. Generic enough to work with different types.
  6921. // Only returns segments that successfully rendered.
  6922. FillRenderer.prototype.buildSegEls = function (type, segs, props) {
  6923. var _this = this;
  6924. var html = '';
  6925. var renderedSegs = [];
  6926. var i;
  6927. if (segs.length) {
  6928. // build a large concatenation of segment HTML
  6929. for (i = 0; i < segs.length; i++) {
  6930. html += this.buildSegHtml(type, segs[i], props);
  6931. }
  6932. // Grab individual elements from the combined HTML string. Use each as the default rendering.
  6933. // Then, compute the 'el' for each segment.
  6934. $(html).each(function (i, node) {
  6935. var seg = segs[i];
  6936. var el = $(node);
  6937. // allow custom filter methods per-type
  6938. if (props.filterEl) {
  6939. el = props.filterEl(seg, el);
  6940. }
  6941. if (el) { // custom filters did not cancel the render
  6942. el = $(el); // allow custom filter to return raw DOM node
  6943. // correct element type? (would be bad if a non-TD were inserted into a table for example)
  6944. if (el.is(_this.fillSegTag)) {
  6945. seg.el = el;
  6946. renderedSegs.push(seg);
  6947. }
  6948. }
  6949. });
  6950. }
  6951. return renderedSegs;
  6952. };
  6953. // Builds the HTML needed for one fill segment. Generic enough to work with different types.
  6954. FillRenderer.prototype.buildSegHtml = function (type, seg, props) {
  6955. // custom hooks per-type
  6956. var classes = props.getClasses ? props.getClasses(seg) : [];
  6957. var css = util_1.cssToStr(props.getCss ? props.getCss(seg) : {});
  6958. return '<' + this.fillSegTag +
  6959. (classes.length ? ' class="' + classes.join(' ') + '"' : '') +
  6960. (css ? ' style="' + css + '"' : '') +
  6961. '></' + this.fillSegTag + '>';
  6962. };
  6963. // Should return wrapping DOM structure
  6964. FillRenderer.prototype.attachSegEls = function (type, segs) {
  6965. // subclasses must implement
  6966. };
  6967. FillRenderer.prototype.reportEls = function (type, nodes) {
  6968. if (this.elsByFill[type]) {
  6969. this.elsByFill[type] = this.elsByFill[type].add(nodes);
  6970. }
  6971. else {
  6972. this.elsByFill[type] = $(nodes);
  6973. }
  6974. };
  6975. return FillRenderer;
  6976. }());
  6977. exports.default = FillRenderer;
  6978. /***/ }),
  6979. /* 63 */
  6980. /***/ (function(module, exports, __webpack_require__) {
  6981. Object.defineProperty(exports, "__esModule", { value: true });
  6982. var SingleEventDef_1 = __webpack_require__(9);
  6983. var EventFootprint_1 = __webpack_require__(34);
  6984. var EventSource_1 = __webpack_require__(6);
  6985. var HelperRenderer = /** @class */ (function () {
  6986. function HelperRenderer(component, eventRenderer) {
  6987. this.view = component._getView();
  6988. this.component = component;
  6989. this.eventRenderer = eventRenderer;
  6990. }
  6991. HelperRenderer.prototype.renderComponentFootprint = function (componentFootprint) {
  6992. this.renderEventFootprints([
  6993. this.fabricateEventFootprint(componentFootprint)
  6994. ]);
  6995. };
  6996. HelperRenderer.prototype.renderEventDraggingFootprints = function (eventFootprints, sourceSeg, isTouch) {
  6997. this.renderEventFootprints(eventFootprints, sourceSeg, 'fc-dragging', isTouch ? null : this.view.opt('dragOpacity'));
  6998. };
  6999. HelperRenderer.prototype.renderEventResizingFootprints = function (eventFootprints, sourceSeg, isTouch) {
  7000. this.renderEventFootprints(eventFootprints, sourceSeg, 'fc-resizing');
  7001. };
  7002. HelperRenderer.prototype.renderEventFootprints = function (eventFootprints, sourceSeg, extraClassNames, opacity) {
  7003. var segs = this.component.eventFootprintsToSegs(eventFootprints);
  7004. var classNames = 'fc-helper ' + (extraClassNames || '');
  7005. var i;
  7006. // assigns each seg's el and returns a subset of segs that were rendered
  7007. segs = this.eventRenderer.renderFgSegEls(segs);
  7008. for (i = 0; i < segs.length; i++) {
  7009. segs[i].el.addClass(classNames);
  7010. }
  7011. if (opacity != null) {
  7012. for (i = 0; i < segs.length; i++) {
  7013. segs[i].el.css('opacity', opacity);
  7014. }
  7015. }
  7016. this.helperEls = this.renderSegs(segs, sourceSeg);
  7017. };
  7018. /*
  7019. Must return all mock event elements
  7020. */
  7021. HelperRenderer.prototype.renderSegs = function (segs, sourceSeg) {
  7022. // Subclasses must implement
  7023. };
  7024. HelperRenderer.prototype.unrender = function () {
  7025. if (this.helperEls) {
  7026. this.helperEls.remove();
  7027. this.helperEls = null;
  7028. }
  7029. };
  7030. HelperRenderer.prototype.fabricateEventFootprint = function (componentFootprint) {
  7031. var calendar = this.view.calendar;
  7032. var eventDateProfile = calendar.footprintToDateProfile(componentFootprint);
  7033. var dummyEvent = new SingleEventDef_1.default(new EventSource_1.default(calendar));
  7034. var dummyInstance;
  7035. dummyEvent.dateProfile = eventDateProfile;
  7036. dummyInstance = dummyEvent.buildInstance();
  7037. return new EventFootprint_1.default(componentFootprint, dummyEvent, dummyInstance);
  7038. };
  7039. return HelperRenderer;
  7040. }());
  7041. exports.default = HelperRenderer;
  7042. /***/ }),
  7043. /* 64 */
  7044. /***/ (function(module, exports, __webpack_require__) {
  7045. Object.defineProperty(exports, "__esModule", { value: true });
  7046. var tslib_1 = __webpack_require__(2);
  7047. var GlobalEmitter_1 = __webpack_require__(23);
  7048. var Interaction_1 = __webpack_require__(14);
  7049. var EventPointing = /** @class */ (function (_super) {
  7050. tslib_1.__extends(EventPointing, _super);
  7051. function EventPointing() {
  7052. return _super !== null && _super.apply(this, arguments) || this;
  7053. }
  7054. /*
  7055. component must implement:
  7056. - publiclyTrigger
  7057. */
  7058. EventPointing.prototype.bindToEl = function (el) {
  7059. var component = this.component;
  7060. component.bindSegHandlerToEl(el, 'click', this.handleClick.bind(this));
  7061. component.bindSegHandlerToEl(el, 'mouseenter', this.handleMouseover.bind(this));
  7062. component.bindSegHandlerToEl(el, 'mouseleave', this.handleMouseout.bind(this));
  7063. };
  7064. EventPointing.prototype.handleClick = function (seg, ev) {
  7065. var res = this.component.publiclyTrigger('eventClick', {
  7066. context: seg.el[0],
  7067. args: [seg.footprint.getEventLegacy(), ev, this.view]
  7068. });
  7069. if (res === false) {
  7070. ev.preventDefault();
  7071. }
  7072. };
  7073. // Updates internal state and triggers handlers for when an event element is moused over
  7074. EventPointing.prototype.handleMouseover = function (seg, ev) {
  7075. if (!GlobalEmitter_1.default.get().shouldIgnoreMouse() &&
  7076. !this.mousedOverSeg) {
  7077. this.mousedOverSeg = seg;
  7078. // TODO: move to EventSelecting's responsibility
  7079. if (this.view.isEventDefResizable(seg.footprint.eventDef)) {
  7080. seg.el.addClass('fc-allow-mouse-resize');
  7081. }
  7082. this.component.publiclyTrigger('eventMouseover', {
  7083. context: seg.el[0],
  7084. args: [seg.footprint.getEventLegacy(), ev, this.view]
  7085. });
  7086. }
  7087. };
  7088. // Updates internal state and triggers handlers for when an event element is moused out.
  7089. // Can be given no arguments, in which case it will mouseout the segment that was previously moused over.
  7090. EventPointing.prototype.handleMouseout = function (seg, ev) {
  7091. if (this.mousedOverSeg) {
  7092. this.mousedOverSeg = null;
  7093. // TODO: move to EventSelecting's responsibility
  7094. if (this.view.isEventDefResizable(seg.footprint.eventDef)) {
  7095. seg.el.removeClass('fc-allow-mouse-resize');
  7096. }
  7097. this.component.publiclyTrigger('eventMouseout', {
  7098. context: seg.el[0],
  7099. args: [
  7100. seg.footprint.getEventLegacy(),
  7101. ev || {},
  7102. this.view
  7103. ]
  7104. });
  7105. }
  7106. };
  7107. EventPointing.prototype.end = function () {
  7108. if (this.mousedOverSeg) {
  7109. this.handleMouseout(this.mousedOverSeg);
  7110. }
  7111. };
  7112. return EventPointing;
  7113. }(Interaction_1.default));
  7114. exports.default = EventPointing;
  7115. /***/ }),
  7116. /* 65 */
  7117. /***/ (function(module, exports, __webpack_require__) {
  7118. Object.defineProperty(exports, "__esModule", { value: true });
  7119. var tslib_1 = __webpack_require__(2);
  7120. var Mixin_1 = __webpack_require__(15);
  7121. var DateClicking_1 = __webpack_require__(237);
  7122. var DateSelecting_1 = __webpack_require__(236);
  7123. var EventPointing_1 = __webpack_require__(64);
  7124. var EventDragging_1 = __webpack_require__(235);
  7125. var EventResizing_1 = __webpack_require__(234);
  7126. var ExternalDropping_1 = __webpack_require__(233);
  7127. var StandardInteractionsMixin = /** @class */ (function (_super) {
  7128. tslib_1.__extends(StandardInteractionsMixin, _super);
  7129. function StandardInteractionsMixin() {
  7130. return _super !== null && _super.apply(this, arguments) || this;
  7131. }
  7132. return StandardInteractionsMixin;
  7133. }(Mixin_1.default));
  7134. exports.default = StandardInteractionsMixin;
  7135. StandardInteractionsMixin.prototype.dateClickingClass = DateClicking_1.default;
  7136. StandardInteractionsMixin.prototype.dateSelectingClass = DateSelecting_1.default;
  7137. StandardInteractionsMixin.prototype.eventPointingClass = EventPointing_1.default;
  7138. StandardInteractionsMixin.prototype.eventDraggingClass = EventDragging_1.default;
  7139. StandardInteractionsMixin.prototype.eventResizingClass = EventResizing_1.default;
  7140. StandardInteractionsMixin.prototype.externalDroppingClass = ExternalDropping_1.default;
  7141. /***/ }),
  7142. /* 66 */
  7143. /***/ (function(module, exports, __webpack_require__) {
  7144. Object.defineProperty(exports, "__esModule", { value: true });
  7145. var tslib_1 = __webpack_require__(2);
  7146. var $ = __webpack_require__(3);
  7147. var util_1 = __webpack_require__(4);
  7148. var CoordCache_1 = __webpack_require__(58);
  7149. var Popover_1 = __webpack_require__(227);
  7150. var UnzonedRange_1 = __webpack_require__(5);
  7151. var ComponentFootprint_1 = __webpack_require__(12);
  7152. var EventFootprint_1 = __webpack_require__(34);
  7153. var BusinessHourRenderer_1 = __webpack_require__(61);
  7154. var StandardInteractionsMixin_1 = __webpack_require__(65);
  7155. var InteractiveDateComponent_1 = __webpack_require__(42);
  7156. var DayTableMixin_1 = __webpack_require__(60);
  7157. var DayGridEventRenderer_1 = __webpack_require__(243);
  7158. var DayGridHelperRenderer_1 = __webpack_require__(244);
  7159. var DayGridFillRenderer_1 = __webpack_require__(245);
  7160. /* A component that renders a grid of whole-days that runs horizontally. There can be multiple rows, one per week.
  7161. ----------------------------------------------------------------------------------------------------------------------*/
  7162. var DayGrid = /** @class */ (function (_super) {
  7163. tslib_1.__extends(DayGrid, _super);
  7164. function DayGrid(view) {
  7165. var _this = _super.call(this, view) || this;
  7166. _this.cellWeekNumbersVisible = false; // display week numbers in day cell?
  7167. _this.bottomCoordPadding = 0; // hack for extending the hit area for the last row of the coordinate grid
  7168. // isRigid determines whether the individual rows should ignore the contents and be a constant height.
  7169. // Relies on the view's colCnt and rowCnt. In the future, this component should probably be self-sufficient.
  7170. _this.isRigid = false;
  7171. _this.hasAllDayBusinessHours = true;
  7172. return _this;
  7173. }
  7174. // Slices up the given span (unzoned start/end with other misc data) into an array of segments
  7175. DayGrid.prototype.componentFootprintToSegs = function (componentFootprint) {
  7176. var segs = this.sliceRangeByRow(componentFootprint.unzonedRange);
  7177. var i;
  7178. var seg;
  7179. for (i = 0; i < segs.length; i++) {
  7180. seg = segs[i];
  7181. if (this.isRTL) {
  7182. seg.leftCol = this.daysPerRow - 1 - seg.lastRowDayIndex;
  7183. seg.rightCol = this.daysPerRow - 1 - seg.firstRowDayIndex;
  7184. }
  7185. else {
  7186. seg.leftCol = seg.firstRowDayIndex;
  7187. seg.rightCol = seg.lastRowDayIndex;
  7188. }
  7189. }
  7190. return segs;
  7191. };
  7192. /* Date Rendering
  7193. ------------------------------------------------------------------------------------------------------------------*/
  7194. DayGrid.prototype.renderDates = function (dateProfile) {
  7195. this.dateProfile = dateProfile;
  7196. this.updateDayTable();
  7197. this.renderGrid();
  7198. };
  7199. DayGrid.prototype.unrenderDates = function () {
  7200. this.removeSegPopover();
  7201. };
  7202. // Renders the rows and columns into the component's `this.el`, which should already be assigned.
  7203. DayGrid.prototype.renderGrid = function () {
  7204. var view = this.view;
  7205. var rowCnt = this.rowCnt;
  7206. var colCnt = this.colCnt;
  7207. var html = '';
  7208. var row;
  7209. var col;
  7210. if (this.headContainerEl) {
  7211. this.headContainerEl.html(this.renderHeadHtml());
  7212. }
  7213. for (row = 0; row < rowCnt; row++) {
  7214. html += this.renderDayRowHtml(row, this.isRigid);
  7215. }
  7216. this.el.html(html);
  7217. this.rowEls = this.el.find('.fc-row');
  7218. this.cellEls = this.el.find('.fc-day, .fc-disabled-day');
  7219. this.rowCoordCache = new CoordCache_1.default({
  7220. els: this.rowEls,
  7221. isVertical: true
  7222. });
  7223. this.colCoordCache = new CoordCache_1.default({
  7224. els: this.cellEls.slice(0, this.colCnt),
  7225. isHorizontal: true
  7226. });
  7227. // trigger dayRender with each cell's element
  7228. for (row = 0; row < rowCnt; row++) {
  7229. for (col = 0; col < colCnt; col++) {
  7230. this.publiclyTrigger('dayRender', {
  7231. context: view,
  7232. args: [
  7233. this.getCellDate(row, col),
  7234. this.getCellEl(row, col),
  7235. view
  7236. ]
  7237. });
  7238. }
  7239. }
  7240. };
  7241. // Generates the HTML for a single row, which is a div that wraps a table.
  7242. // `row` is the row number.
  7243. DayGrid.prototype.renderDayRowHtml = function (row, isRigid) {
  7244. var theme = this.view.calendar.theme;
  7245. var classes = ['fc-row', 'fc-week', theme.getClass('dayRow')];
  7246. if (isRigid) {
  7247. classes.push('fc-rigid');
  7248. }
  7249. return '' +
  7250. '<div class="' + classes.join(' ') + '">' +
  7251. '<div class="fc-bg">' +
  7252. '<table class="' + theme.getClass('tableGrid') + '">' +
  7253. this.renderBgTrHtml(row) +
  7254. '</table>' +
  7255. '</div>' +
  7256. '<div class="fc-content-skeleton">' +
  7257. '<table>' +
  7258. (this.getIsNumbersVisible() ?
  7259. '<thead>' +
  7260. this.renderNumberTrHtml(row) +
  7261. '</thead>' :
  7262. '') +
  7263. '</table>' +
  7264. '</div>' +
  7265. '</div>';
  7266. };
  7267. DayGrid.prototype.getIsNumbersVisible = function () {
  7268. return this.getIsDayNumbersVisible() || this.cellWeekNumbersVisible;
  7269. };
  7270. DayGrid.prototype.getIsDayNumbersVisible = function () {
  7271. return this.rowCnt > 1;
  7272. };
  7273. /* Grid Number Rendering
  7274. ------------------------------------------------------------------------------------------------------------------*/
  7275. DayGrid.prototype.renderNumberTrHtml = function (row) {
  7276. return '' +
  7277. '<tr>' +
  7278. (this.isRTL ? '' : this.renderNumberIntroHtml(row)) +
  7279. this.renderNumberCellsHtml(row) +
  7280. (this.isRTL ? this.renderNumberIntroHtml(row) : '') +
  7281. '</tr>';
  7282. };
  7283. DayGrid.prototype.renderNumberIntroHtml = function (row) {
  7284. return this.renderIntroHtml();
  7285. };
  7286. DayGrid.prototype.renderNumberCellsHtml = function (row) {
  7287. var htmls = [];
  7288. var col;
  7289. var date;
  7290. for (col = 0; col < this.colCnt; col++) {
  7291. date = this.getCellDate(row, col);
  7292. htmls.push(this.renderNumberCellHtml(date));
  7293. }
  7294. return htmls.join('');
  7295. };
  7296. // Generates the HTML for the <td>s of the "number" row in the DayGrid's content skeleton.
  7297. // The number row will only exist if either day numbers or week numbers are turned on.
  7298. DayGrid.prototype.renderNumberCellHtml = function (date) {
  7299. var view = this.view;
  7300. var html = '';
  7301. var isDateValid = this.dateProfile.activeUnzonedRange.containsDate(date); // TODO: called too frequently. cache somehow.
  7302. var isDayNumberVisible = this.getIsDayNumbersVisible() && isDateValid;
  7303. var classes;
  7304. var weekCalcFirstDoW;
  7305. if (!isDayNumberVisible && !this.cellWeekNumbersVisible) {
  7306. // no numbers in day cell (week number must be along the side)
  7307. return '<td></td>'; // will create an empty space above events :(
  7308. }
  7309. classes = this.getDayClasses(date);
  7310. classes.unshift('fc-day-top');
  7311. if (this.cellWeekNumbersVisible) {
  7312. // To determine the day of week number change under ISO, we cannot
  7313. // rely on moment.js methods such as firstDayOfWeek() or weekday(),
  7314. // because they rely on the locale's dow (possibly overridden by
  7315. // our firstDay option), which may not be Monday. We cannot change
  7316. // dow, because that would affect the calendar start day as well.
  7317. if (date._locale._fullCalendar_weekCalc === 'ISO') {
  7318. weekCalcFirstDoW = 1; // Monday by ISO 8601 definition
  7319. }
  7320. else {
  7321. weekCalcFirstDoW = date._locale.firstDayOfWeek();
  7322. }
  7323. }
  7324. html += '<td class="' + classes.join(' ') + '"' +
  7325. (isDateValid ?
  7326. ' data-date="' + date.format() + '"' :
  7327. '') +
  7328. '>';
  7329. if (this.cellWeekNumbersVisible && (date.day() === weekCalcFirstDoW)) {
  7330. html += view.buildGotoAnchorHtml({ date: date, type: 'week' }, { 'class': 'fc-week-number' }, date.format('w') // inner HTML
  7331. );
  7332. }
  7333. if (isDayNumberVisible) {
  7334. html += view.buildGotoAnchorHtml(date, { 'class': 'fc-day-number' }, date.format('D') // inner HTML
  7335. );
  7336. }
  7337. html += '</td>';
  7338. return html;
  7339. };
  7340. /* Hit System
  7341. ------------------------------------------------------------------------------------------------------------------*/
  7342. DayGrid.prototype.prepareHits = function () {
  7343. this.colCoordCache.build();
  7344. this.rowCoordCache.build();
  7345. this.rowCoordCache.bottoms[this.rowCnt - 1] += this.bottomCoordPadding; // hack
  7346. };
  7347. DayGrid.prototype.releaseHits = function () {
  7348. this.colCoordCache.clear();
  7349. this.rowCoordCache.clear();
  7350. };
  7351. DayGrid.prototype.queryHit = function (leftOffset, topOffset) {
  7352. if (this.colCoordCache.isLeftInBounds(leftOffset) && this.rowCoordCache.isTopInBounds(topOffset)) {
  7353. var col = this.colCoordCache.getHorizontalIndex(leftOffset);
  7354. var row = this.rowCoordCache.getVerticalIndex(topOffset);
  7355. if (row != null && col != null) {
  7356. return this.getCellHit(row, col);
  7357. }
  7358. }
  7359. };
  7360. DayGrid.prototype.getHitFootprint = function (hit) {
  7361. var range = this.getCellRange(hit.row, hit.col);
  7362. return new ComponentFootprint_1.default(new UnzonedRange_1.default(range.start, range.end), true // all-day?
  7363. );
  7364. };
  7365. DayGrid.prototype.getHitEl = function (hit) {
  7366. return this.getCellEl(hit.row, hit.col);
  7367. };
  7368. /* Cell System
  7369. ------------------------------------------------------------------------------------------------------------------*/
  7370. // FYI: the first column is the leftmost column, regardless of date
  7371. DayGrid.prototype.getCellHit = function (row, col) {
  7372. return {
  7373. row: row,
  7374. col: col,
  7375. component: this,
  7376. left: this.colCoordCache.getLeftOffset(col),
  7377. right: this.colCoordCache.getRightOffset(col),
  7378. top: this.rowCoordCache.getTopOffset(row),
  7379. bottom: this.rowCoordCache.getBottomOffset(row)
  7380. };
  7381. };
  7382. DayGrid.prototype.getCellEl = function (row, col) {
  7383. return this.cellEls.eq(row * this.colCnt + col);
  7384. };
  7385. /* Event Rendering
  7386. ------------------------------------------------------------------------------------------------------------------*/
  7387. // Unrenders all events currently rendered on the grid
  7388. DayGrid.prototype.executeEventUnrender = function () {
  7389. this.removeSegPopover(); // removes the "more.." events popover
  7390. _super.prototype.executeEventUnrender.call(this);
  7391. };
  7392. // Retrieves all rendered segment objects currently rendered on the grid
  7393. DayGrid.prototype.getOwnEventSegs = function () {
  7394. // append the segments from the "more..." popover
  7395. return _super.prototype.getOwnEventSegs.call(this).concat(this.popoverSegs || []);
  7396. };
  7397. /* Event Drag Visualization
  7398. ------------------------------------------------------------------------------------------------------------------*/
  7399. // Renders a visual indication of an event or external element being dragged.
  7400. // `eventLocation` has zoned start and end (optional)
  7401. DayGrid.prototype.renderDrag = function (eventFootprints, seg, isTouch) {
  7402. var i;
  7403. for (i = 0; i < eventFootprints.length; i++) {
  7404. this.renderHighlight(eventFootprints[i].componentFootprint);
  7405. }
  7406. // render drags from OTHER components as helpers
  7407. if (eventFootprints.length && seg && seg.component !== this) {
  7408. this.helperRenderer.renderEventDraggingFootprints(eventFootprints, seg, isTouch);
  7409. return true; // signal helpers rendered
  7410. }
  7411. };
  7412. // Unrenders any visual indication of a hovering event
  7413. DayGrid.prototype.unrenderDrag = function () {
  7414. this.unrenderHighlight();
  7415. this.helperRenderer.unrender();
  7416. };
  7417. /* Event Resize Visualization
  7418. ------------------------------------------------------------------------------------------------------------------*/
  7419. // Renders a visual indication of an event being resized
  7420. DayGrid.prototype.renderEventResize = function (eventFootprints, seg, isTouch) {
  7421. var i;
  7422. for (i = 0; i < eventFootprints.length; i++) {
  7423. this.renderHighlight(eventFootprints[i].componentFootprint);
  7424. }
  7425. this.helperRenderer.renderEventResizingFootprints(eventFootprints, seg, isTouch);
  7426. };
  7427. // Unrenders a visual indication of an event being resized
  7428. DayGrid.prototype.unrenderEventResize = function () {
  7429. this.unrenderHighlight();
  7430. this.helperRenderer.unrender();
  7431. };
  7432. /* More+ Link Popover
  7433. ------------------------------------------------------------------------------------------------------------------*/
  7434. DayGrid.prototype.removeSegPopover = function () {
  7435. if (this.segPopover) {
  7436. this.segPopover.hide(); // in handler, will call segPopover's removeElement
  7437. }
  7438. };
  7439. // Limits the number of "levels" (vertically stacking layers of events) for each row of the grid.
  7440. // `levelLimit` can be false (don't limit), a number, or true (should be computed).
  7441. DayGrid.prototype.limitRows = function (levelLimit) {
  7442. var rowStructs = this.eventRenderer.rowStructs || [];
  7443. var row; // row #
  7444. var rowLevelLimit;
  7445. for (row = 0; row < rowStructs.length; row++) {
  7446. this.unlimitRow(row);
  7447. if (!levelLimit) {
  7448. rowLevelLimit = false;
  7449. }
  7450. else if (typeof levelLimit === 'number') {
  7451. rowLevelLimit = levelLimit;
  7452. }
  7453. else {
  7454. rowLevelLimit = this.computeRowLevelLimit(row);
  7455. }
  7456. if (rowLevelLimit !== false) {
  7457. this.limitRow(row, rowLevelLimit);
  7458. }
  7459. }
  7460. };
  7461. // Computes the number of levels a row will accomodate without going outside its bounds.
  7462. // Assumes the row is "rigid" (maintains a constant height regardless of what is inside).
  7463. // `row` is the row number.
  7464. DayGrid.prototype.computeRowLevelLimit = function (row) {
  7465. var rowEl = this.rowEls.eq(row); // the containing "fake" row div
  7466. var rowHeight = rowEl.height(); // TODO: cache somehow?
  7467. var trEls = this.eventRenderer.rowStructs[row].tbodyEl.children();
  7468. var i;
  7469. var trEl;
  7470. var trHeight;
  7471. function iterInnerHeights(i, childNode) {
  7472. trHeight = Math.max(trHeight, $(childNode).outerHeight());
  7473. }
  7474. // Reveal one level <tr> at a time and stop when we find one out of bounds
  7475. for (i = 0; i < trEls.length; i++) {
  7476. trEl = trEls.eq(i).removeClass('fc-limited'); // reset to original state (reveal)
  7477. // with rowspans>1 and IE8, trEl.outerHeight() would return the height of the largest cell,
  7478. // so instead, find the tallest inner content element.
  7479. trHeight = 0;
  7480. trEl.find('> td > :first-child').each(iterInnerHeights);
  7481. if (trEl.position().top + trHeight > rowHeight) {
  7482. return i;
  7483. }
  7484. }
  7485. return false; // should not limit at all
  7486. };
  7487. // Limits the given grid row to the maximum number of levels and injects "more" links if necessary.
  7488. // `row` is the row number.
  7489. // `levelLimit` is a number for the maximum (inclusive) number of levels allowed.
  7490. DayGrid.prototype.limitRow = function (row, levelLimit) {
  7491. var _this = this;
  7492. var rowStruct = this.eventRenderer.rowStructs[row];
  7493. var moreNodes = []; // array of "more" <a> links and <td> DOM nodes
  7494. var col = 0; // col #, left-to-right (not chronologically)
  7495. var levelSegs; // array of segment objects in the last allowable level, ordered left-to-right
  7496. var cellMatrix; // a matrix (by level, then column) of all <td> jQuery elements in the row
  7497. var limitedNodes; // array of temporarily hidden level <tr> and segment <td> DOM nodes
  7498. var i;
  7499. var seg;
  7500. var segsBelow; // array of segment objects below `seg` in the current `col`
  7501. var totalSegsBelow; // total number of segments below `seg` in any of the columns `seg` occupies
  7502. var colSegsBelow; // array of segment arrays, below seg, one for each column (offset from segs's first column)
  7503. var td;
  7504. var rowspan;
  7505. var segMoreNodes; // array of "more" <td> cells that will stand-in for the current seg's cell
  7506. var j;
  7507. var moreTd;
  7508. var moreWrap;
  7509. var moreLink;
  7510. // Iterates through empty level cells and places "more" links inside if need be
  7511. var emptyCellsUntil = function (endCol) {
  7512. while (col < endCol) {
  7513. segsBelow = _this.getCellSegs(row, col, levelLimit);
  7514. if (segsBelow.length) {
  7515. td = cellMatrix[levelLimit - 1][col];
  7516. moreLink = _this.renderMoreLink(row, col, segsBelow);
  7517. moreWrap = $('<div>').append(moreLink);
  7518. td.append(moreWrap);
  7519. moreNodes.push(moreWrap[0]);
  7520. }
  7521. col++;
  7522. }
  7523. };
  7524. if (levelLimit && levelLimit < rowStruct.segLevels.length) { // is it actually over the limit?
  7525. levelSegs = rowStruct.segLevels[levelLimit - 1];
  7526. cellMatrix = rowStruct.cellMatrix;
  7527. limitedNodes = rowStruct.tbodyEl.children().slice(levelLimit) // get level <tr> elements past the limit
  7528. .addClass('fc-limited').get(); // hide elements and get a simple DOM-nodes array
  7529. // iterate though segments in the last allowable level
  7530. for (i = 0; i < levelSegs.length; i++) {
  7531. seg = levelSegs[i];
  7532. emptyCellsUntil(seg.leftCol); // process empty cells before the segment
  7533. // determine *all* segments below `seg` that occupy the same columns
  7534. colSegsBelow = [];
  7535. totalSegsBelow = 0;
  7536. while (col <= seg.rightCol) {
  7537. segsBelow = this.getCellSegs(row, col, levelLimit);
  7538. colSegsBelow.push(segsBelow);
  7539. totalSegsBelow += segsBelow.length;
  7540. col++;
  7541. }
  7542. if (totalSegsBelow) { // do we need to replace this segment with one or many "more" links?
  7543. td = cellMatrix[levelLimit - 1][seg.leftCol]; // the segment's parent cell
  7544. rowspan = td.attr('rowspan') || 1;
  7545. segMoreNodes = [];
  7546. // make a replacement <td> for each column the segment occupies. will be one for each colspan
  7547. for (j = 0; j < colSegsBelow.length; j++) {
  7548. moreTd = $('<td class="fc-more-cell">').attr('rowspan', rowspan);
  7549. segsBelow = colSegsBelow[j];
  7550. moreLink = this.renderMoreLink(row, seg.leftCol + j, [seg].concat(segsBelow) // count seg as hidden too
  7551. );
  7552. moreWrap = $('<div>').append(moreLink);
  7553. moreTd.append(moreWrap);
  7554. segMoreNodes.push(moreTd[0]);
  7555. moreNodes.push(moreTd[0]);
  7556. }
  7557. td.addClass('fc-limited').after($(segMoreNodes)); // hide original <td> and inject replacements
  7558. limitedNodes.push(td[0]);
  7559. }
  7560. }
  7561. emptyCellsUntil(this.colCnt); // finish off the level
  7562. rowStruct.moreEls = $(moreNodes); // for easy undoing later
  7563. rowStruct.limitedEls = $(limitedNodes); // for easy undoing later
  7564. }
  7565. };
  7566. // Reveals all levels and removes all "more"-related elements for a grid's row.
  7567. // `row` is a row number.
  7568. DayGrid.prototype.unlimitRow = function (row) {
  7569. var rowStruct = this.eventRenderer.rowStructs[row];
  7570. if (rowStruct.moreEls) {
  7571. rowStruct.moreEls.remove();
  7572. rowStruct.moreEls = null;
  7573. }
  7574. if (rowStruct.limitedEls) {
  7575. rowStruct.limitedEls.removeClass('fc-limited');
  7576. rowStruct.limitedEls = null;
  7577. }
  7578. };
  7579. // Renders an <a> element that represents hidden event element for a cell.
  7580. // Responsible for attaching click handler as well.
  7581. DayGrid.prototype.renderMoreLink = function (row, col, hiddenSegs) {
  7582. var _this = this;
  7583. var view = this.view;
  7584. return $('<a class="fc-more">')
  7585. .text(this.getMoreLinkText(hiddenSegs.length))
  7586. .on('click', function (ev) {
  7587. var clickOption = _this.opt('eventLimitClick');
  7588. var date = _this.getCellDate(row, col);
  7589. var moreEl = $(ev.currentTarget);
  7590. var dayEl = _this.getCellEl(row, col);
  7591. var allSegs = _this.getCellSegs(row, col);
  7592. // rescope the segments to be within the cell's date
  7593. var reslicedAllSegs = _this.resliceDaySegs(allSegs, date);
  7594. var reslicedHiddenSegs = _this.resliceDaySegs(hiddenSegs, date);
  7595. if (typeof clickOption === 'function') {
  7596. // the returned value can be an atomic option
  7597. clickOption = _this.publiclyTrigger('eventLimitClick', {
  7598. context: view,
  7599. args: [
  7600. {
  7601. date: date.clone(),
  7602. dayEl: dayEl,
  7603. moreEl: moreEl,
  7604. segs: reslicedAllSegs,
  7605. hiddenSegs: reslicedHiddenSegs
  7606. },
  7607. ev,
  7608. view
  7609. ]
  7610. });
  7611. }
  7612. if (clickOption === 'popover') {
  7613. _this.showSegPopover(row, col, moreEl, reslicedAllSegs);
  7614. }
  7615. else if (typeof clickOption === 'string') { // a view name
  7616. view.calendar.zoomTo(date, clickOption);
  7617. }
  7618. });
  7619. };
  7620. // Reveals the popover that displays all events within a cell
  7621. DayGrid.prototype.showSegPopover = function (row, col, moreLink, segs) {
  7622. var _this = this;
  7623. var view = this.view;
  7624. var moreWrap = moreLink.parent(); // the <div> wrapper around the <a>
  7625. var topEl; // the element we want to match the top coordinate of
  7626. var options;
  7627. if (this.rowCnt === 1) {
  7628. topEl = view.el; // will cause the popover to cover any sort of header
  7629. }
  7630. else {
  7631. topEl = this.rowEls.eq(row); // will align with top of row
  7632. }
  7633. options = {
  7634. className: 'fc-more-popover ' + view.calendar.theme.getClass('popover'),
  7635. content: this.renderSegPopoverContent(row, col, segs),
  7636. parentEl: view.el,
  7637. top: topEl.offset().top,
  7638. autoHide: true,
  7639. viewportConstrain: this.opt('popoverViewportConstrain'),
  7640. hide: function () {
  7641. // kill everything when the popover is hidden
  7642. // notify events to be removed
  7643. if (_this.popoverSegs) {
  7644. _this.triggerBeforeEventSegsDestroyed(_this.popoverSegs);
  7645. }
  7646. _this.segPopover.removeElement();
  7647. _this.segPopover = null;
  7648. _this.popoverSegs = null;
  7649. }
  7650. };
  7651. // Determine horizontal coordinate.
  7652. // We use the moreWrap instead of the <td> to avoid border confusion.
  7653. if (this.isRTL) {
  7654. options.right = moreWrap.offset().left + moreWrap.outerWidth() + 1; // +1 to be over cell border
  7655. }
  7656. else {
  7657. options.left = moreWrap.offset().left - 1; // -1 to be over cell border
  7658. }
  7659. this.segPopover = new Popover_1.default(options);
  7660. this.segPopover.show();
  7661. // the popover doesn't live within the grid's container element, and thus won't get the event
  7662. // delegated-handlers for free. attach event-related handlers to the popover.
  7663. this.bindAllSegHandlersToEl(this.segPopover.el);
  7664. this.triggerAfterEventSegsRendered(segs);
  7665. };
  7666. // Builds the inner DOM contents of the segment popover
  7667. DayGrid.prototype.renderSegPopoverContent = function (row, col, segs) {
  7668. var view = this.view;
  7669. var theme = view.calendar.theme;
  7670. var title = this.getCellDate(row, col).format(this.opt('dayPopoverFormat'));
  7671. var content = $('<div class="fc-header ' + theme.getClass('popoverHeader') + '">' +
  7672. '<span class="fc-close ' + theme.getIconClass('close') + '"></span>' +
  7673. '<span class="fc-title">' +
  7674. util_1.htmlEscape(title) +
  7675. '</span>' +
  7676. '<div class="fc-clear"></div>' +
  7677. '</div>' +
  7678. '<div class="fc-body ' + theme.getClass('popoverContent') + '">' +
  7679. '<div class="fc-event-container"></div>' +
  7680. '</div>');
  7681. var segContainer = content.find('.fc-event-container');
  7682. var i;
  7683. // render each seg's `el` and only return the visible segs
  7684. segs = this.eventRenderer.renderFgSegEls(segs, true); // disableResizing=true
  7685. this.popoverSegs = segs;
  7686. for (i = 0; i < segs.length; i++) {
  7687. // because segments in the popover are not part of a grid coordinate system, provide a hint to any
  7688. // grids that want to do drag-n-drop about which cell it came from
  7689. this.hitsNeeded();
  7690. segs[i].hit = this.getCellHit(row, col);
  7691. this.hitsNotNeeded();
  7692. segContainer.append(segs[i].el);
  7693. }
  7694. return content;
  7695. };
  7696. // Given the events within an array of segment objects, reslice them to be in a single day
  7697. DayGrid.prototype.resliceDaySegs = function (segs, dayDate) {
  7698. var dayStart = dayDate.clone();
  7699. var dayEnd = dayStart.clone().add(1, 'days');
  7700. var dayRange = new UnzonedRange_1.default(dayStart, dayEnd);
  7701. var newSegs = [];
  7702. var i;
  7703. var seg;
  7704. var slicedRange;
  7705. for (i = 0; i < segs.length; i++) {
  7706. seg = segs[i];
  7707. slicedRange = seg.footprint.componentFootprint.unzonedRange.intersect(dayRange);
  7708. if (slicedRange) {
  7709. newSegs.push($.extend({}, seg, {
  7710. footprint: new EventFootprint_1.default(new ComponentFootprint_1.default(slicedRange, seg.footprint.componentFootprint.isAllDay), seg.footprint.eventDef, seg.footprint.eventInstance),
  7711. isStart: seg.isStart && slicedRange.isStart,
  7712. isEnd: seg.isEnd && slicedRange.isEnd
  7713. }));
  7714. }
  7715. }
  7716. // force an order because eventsToSegs doesn't guarantee one
  7717. // TODO: research if still needed
  7718. this.eventRenderer.sortEventSegs(newSegs);
  7719. return newSegs;
  7720. };
  7721. // Generates the text that should be inside a "more" link, given the number of events it represents
  7722. DayGrid.prototype.getMoreLinkText = function (num) {
  7723. var opt = this.opt('eventLimitText');
  7724. if (typeof opt === 'function') {
  7725. return opt(num);
  7726. }
  7727. else {
  7728. return '+' + num + ' ' + opt;
  7729. }
  7730. };
  7731. // Returns segments within a given cell.
  7732. // If `startLevel` is specified, returns only events including and below that level. Otherwise returns all segs.
  7733. DayGrid.prototype.getCellSegs = function (row, col, startLevel) {
  7734. var segMatrix = this.eventRenderer.rowStructs[row].segMatrix;
  7735. var level = startLevel || 0;
  7736. var segs = [];
  7737. var seg;
  7738. while (level < segMatrix.length) {
  7739. seg = segMatrix[level][col];
  7740. if (seg) {
  7741. segs.push(seg);
  7742. }
  7743. level++;
  7744. }
  7745. return segs;
  7746. };
  7747. return DayGrid;
  7748. }(InteractiveDateComponent_1.default));
  7749. exports.default = DayGrid;
  7750. DayGrid.prototype.eventRendererClass = DayGridEventRenderer_1.default;
  7751. DayGrid.prototype.businessHourRendererClass = BusinessHourRenderer_1.default;
  7752. DayGrid.prototype.helperRendererClass = DayGridHelperRenderer_1.default;
  7753. DayGrid.prototype.fillRendererClass = DayGridFillRenderer_1.default;
  7754. StandardInteractionsMixin_1.default.mixInto(DayGrid);
  7755. DayTableMixin_1.default.mixInto(DayGrid);
  7756. /***/ }),
  7757. /* 67 */
  7758. /***/ (function(module, exports, __webpack_require__) {
  7759. Object.defineProperty(exports, "__esModule", { value: true });
  7760. var tslib_1 = __webpack_require__(2);
  7761. var $ = __webpack_require__(3);
  7762. var util_1 = __webpack_require__(4);
  7763. var Scroller_1 = __webpack_require__(41);
  7764. var View_1 = __webpack_require__(43);
  7765. var BasicViewDateProfileGenerator_1 = __webpack_require__(68);
  7766. var DayGrid_1 = __webpack_require__(66);
  7767. /* An abstract class for the "basic" views, as well as month view. Renders one or more rows of day cells.
  7768. ----------------------------------------------------------------------------------------------------------------------*/
  7769. // It is a manager for a DayGrid subcomponent, which does most of the heavy lifting.
  7770. // It is responsible for managing width/height.
  7771. var BasicView = /** @class */ (function (_super) {
  7772. tslib_1.__extends(BasicView, _super);
  7773. function BasicView(calendar, viewSpec) {
  7774. var _this = _super.call(this, calendar, viewSpec) || this;
  7775. _this.dayGrid = _this.instantiateDayGrid();
  7776. _this.dayGrid.isRigid = _this.hasRigidRows();
  7777. if (_this.opt('weekNumbers')) {
  7778. if (_this.opt('weekNumbersWithinDays')) {
  7779. _this.dayGrid.cellWeekNumbersVisible = true;
  7780. _this.dayGrid.colWeekNumbersVisible = false;
  7781. }
  7782. else {
  7783. _this.dayGrid.cellWeekNumbersVisible = false;
  7784. _this.dayGrid.colWeekNumbersVisible = true;
  7785. }
  7786. }
  7787. _this.addChild(_this.dayGrid);
  7788. _this.scroller = new Scroller_1.default({
  7789. overflowX: 'hidden',
  7790. overflowY: 'auto'
  7791. });
  7792. return _this;
  7793. }
  7794. // Generates the DayGrid object this view needs. Draws from this.dayGridClass
  7795. BasicView.prototype.instantiateDayGrid = function () {
  7796. // generate a subclass on the fly with BasicView-specific behavior
  7797. // TODO: cache this subclass
  7798. var subclass = makeDayGridSubclass(this.dayGridClass);
  7799. return new subclass(this);
  7800. };
  7801. BasicView.prototype.executeDateRender = function (dateProfile) {
  7802. this.dayGrid.breakOnWeeks = /year|month|week/.test(dateProfile.currentRangeUnit);
  7803. _super.prototype.executeDateRender.call(this, dateProfile);
  7804. };
  7805. BasicView.prototype.renderSkeleton = function () {
  7806. var dayGridContainerEl;
  7807. var dayGridEl;
  7808. this.el.addClass('fc-basic-view').html(this.renderSkeletonHtml());
  7809. this.scroller.render();
  7810. dayGridContainerEl = this.scroller.el.addClass('fc-day-grid-container');
  7811. dayGridEl = $('<div class="fc-day-grid">').appendTo(dayGridContainerEl);
  7812. this.el.find('.fc-body > tr > td').append(dayGridContainerEl);
  7813. this.dayGrid.headContainerEl = this.el.find('.fc-head-container');
  7814. this.dayGrid.setElement(dayGridEl);
  7815. };
  7816. BasicView.prototype.unrenderSkeleton = function () {
  7817. this.dayGrid.removeElement();
  7818. this.scroller.destroy();
  7819. };
  7820. // Builds the HTML skeleton for the view.
  7821. // The day-grid component will render inside of a container defined by this HTML.
  7822. BasicView.prototype.renderSkeletonHtml = function () {
  7823. var theme = this.calendar.theme;
  7824. return '' +
  7825. '<table class="' + theme.getClass('tableGrid') + '">' +
  7826. (this.opt('columnHeader') ?
  7827. '<thead class="fc-head">' +
  7828. '<tr>' +
  7829. '<td class="fc-head-container ' + theme.getClass('widgetHeader') + '">&nbsp;</td>' +
  7830. '</tr>' +
  7831. '</thead>' :
  7832. '') +
  7833. '<tbody class="fc-body">' +
  7834. '<tr>' +
  7835. '<td class="' + theme.getClass('widgetContent') + '"></td>' +
  7836. '</tr>' +
  7837. '</tbody>' +
  7838. '</table>';
  7839. };
  7840. // Generates an HTML attribute string for setting the width of the week number column, if it is known
  7841. BasicView.prototype.weekNumberStyleAttr = function () {
  7842. if (this.weekNumberWidth != null) {
  7843. return 'style="width:' + this.weekNumberWidth + 'px"';
  7844. }
  7845. return '';
  7846. };
  7847. // Determines whether each row should have a constant height
  7848. BasicView.prototype.hasRigidRows = function () {
  7849. var eventLimit = this.opt('eventLimit');
  7850. return eventLimit && typeof eventLimit !== 'number';
  7851. };
  7852. /* Dimensions
  7853. ------------------------------------------------------------------------------------------------------------------*/
  7854. // Refreshes the horizontal dimensions of the view
  7855. BasicView.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  7856. var eventLimit = this.opt('eventLimit');
  7857. var headRowEl = this.dayGrid.headContainerEl.find('.fc-row');
  7858. var scrollerHeight;
  7859. var scrollbarWidths;
  7860. // hack to give the view some height prior to dayGrid's columns being rendered
  7861. // TODO: separate setting height from scroller VS dayGrid.
  7862. if (!this.dayGrid.rowEls) {
  7863. if (!isAuto) {
  7864. scrollerHeight = this.computeScrollerHeight(totalHeight);
  7865. this.scroller.setHeight(scrollerHeight);
  7866. }
  7867. return;
  7868. }
  7869. _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
  7870. if (this.dayGrid.colWeekNumbersVisible) {
  7871. // Make sure all week number cells running down the side have the same width.
  7872. // Record the width for cells created later.
  7873. this.weekNumberWidth = util_1.matchCellWidths(this.el.find('.fc-week-number'));
  7874. }
  7875. // reset all heights to be natural
  7876. this.scroller.clear();
  7877. util_1.uncompensateScroll(headRowEl);
  7878. this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed
  7879. // is the event limit a constant level number?
  7880. if (eventLimit && typeof eventLimit === 'number') {
  7881. this.dayGrid.limitRows(eventLimit); // limit the levels first so the height can redistribute after
  7882. }
  7883. // distribute the height to the rows
  7884. // (totalHeight is a "recommended" value if isAuto)
  7885. scrollerHeight = this.computeScrollerHeight(totalHeight);
  7886. this.setGridHeight(scrollerHeight, isAuto);
  7887. // is the event limit dynamically calculated?
  7888. if (eventLimit && typeof eventLimit !== 'number') {
  7889. this.dayGrid.limitRows(eventLimit); // limit the levels after the grid's row heights have been set
  7890. }
  7891. if (!isAuto) { // should we force dimensions of the scroll container?
  7892. this.scroller.setHeight(scrollerHeight);
  7893. scrollbarWidths = this.scroller.getScrollbarWidths();
  7894. if (scrollbarWidths.left || scrollbarWidths.right) { // using scrollbars?
  7895. util_1.compensateScroll(headRowEl, scrollbarWidths);
  7896. // doing the scrollbar compensation might have created text overflow which created more height. redo
  7897. scrollerHeight = this.computeScrollerHeight(totalHeight);
  7898. this.scroller.setHeight(scrollerHeight);
  7899. }
  7900. // guarantees the same scrollbar widths
  7901. this.scroller.lockOverflow(scrollbarWidths);
  7902. }
  7903. };
  7904. // given a desired total height of the view, returns what the height of the scroller should be
  7905. BasicView.prototype.computeScrollerHeight = function (totalHeight) {
  7906. return totalHeight -
  7907. util_1.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
  7908. };
  7909. // Sets the height of just the DayGrid component in this view
  7910. BasicView.prototype.setGridHeight = function (height, isAuto) {
  7911. if (isAuto) {
  7912. util_1.undistributeHeight(this.dayGrid.rowEls); // let the rows be their natural height with no expanding
  7913. }
  7914. else {
  7915. util_1.distributeHeight(this.dayGrid.rowEls, height, true); // true = compensate for height-hogging rows
  7916. }
  7917. };
  7918. /* Scroll
  7919. ------------------------------------------------------------------------------------------------------------------*/
  7920. BasicView.prototype.computeInitialDateScroll = function () {
  7921. return { top: 0 };
  7922. };
  7923. BasicView.prototype.queryDateScroll = function () {
  7924. return { top: this.scroller.getScrollTop() };
  7925. };
  7926. BasicView.prototype.applyDateScroll = function (scroll) {
  7927. if (scroll.top !== undefined) {
  7928. this.scroller.setScrollTop(scroll.top);
  7929. }
  7930. };
  7931. return BasicView;
  7932. }(View_1.default));
  7933. exports.default = BasicView;
  7934. BasicView.prototype.dateProfileGeneratorClass = BasicViewDateProfileGenerator_1.default;
  7935. BasicView.prototype.dayGridClass = DayGrid_1.default;
  7936. // customize the rendering behavior of BasicView's dayGrid
  7937. function makeDayGridSubclass(SuperClass) {
  7938. return /** @class */ (function (_super) {
  7939. tslib_1.__extends(SubClass, _super);
  7940. function SubClass() {
  7941. var _this = _super !== null && _super.apply(this, arguments) || this;
  7942. _this.colWeekNumbersVisible = false; // display week numbers along the side?
  7943. return _this;
  7944. }
  7945. // Generates the HTML that will go before the day-of week header cells
  7946. SubClass.prototype.renderHeadIntroHtml = function () {
  7947. var view = this.view;
  7948. if (this.colWeekNumbersVisible) {
  7949. return '' +
  7950. '<th class="fc-week-number ' + view.calendar.theme.getClass('widgetHeader') + '" ' + view.weekNumberStyleAttr() + '>' +
  7951. '<span>' + // needed for matchCellWidths
  7952. util_1.htmlEscape(this.opt('weekNumberTitle')) +
  7953. '</span>' +
  7954. '</th>';
  7955. }
  7956. return '';
  7957. };
  7958. // Generates the HTML that will go before content-skeleton cells that display the day/week numbers
  7959. SubClass.prototype.renderNumberIntroHtml = function (row) {
  7960. var view = this.view;
  7961. var weekStart = this.getCellDate(row, 0);
  7962. if (this.colWeekNumbersVisible) {
  7963. return '' +
  7964. '<td class="fc-week-number" ' + view.weekNumberStyleAttr() + '>' +
  7965. view.buildGotoAnchorHtml(// aside from link, important for matchCellWidths
  7966. { date: weekStart, type: 'week', forceOff: this.colCnt === 1 }, weekStart.format('w') // inner HTML
  7967. ) +
  7968. '</td>';
  7969. }
  7970. return '';
  7971. };
  7972. // Generates the HTML that goes before the day bg cells for each day-row
  7973. SubClass.prototype.renderBgIntroHtml = function () {
  7974. var view = this.view;
  7975. if (this.colWeekNumbersVisible) {
  7976. return '<td class="fc-week-number ' + view.calendar.theme.getClass('widgetContent') + '" ' +
  7977. view.weekNumberStyleAttr() + '></td>';
  7978. }
  7979. return '';
  7980. };
  7981. // Generates the HTML that goes before every other type of row generated by DayGrid.
  7982. // Affects helper-skeleton and highlight-skeleton rows.
  7983. SubClass.prototype.renderIntroHtml = function () {
  7984. var view = this.view;
  7985. if (this.colWeekNumbersVisible) {
  7986. return '<td class="fc-week-number" ' + view.weekNumberStyleAttr() + '></td>';
  7987. }
  7988. return '';
  7989. };
  7990. SubClass.prototype.getIsNumbersVisible = function () {
  7991. return DayGrid_1.default.prototype.getIsNumbersVisible.apply(this, arguments) || this.colWeekNumbersVisible;
  7992. };
  7993. return SubClass;
  7994. }(SuperClass));
  7995. }
  7996. /***/ }),
  7997. /* 68 */
  7998. /***/ (function(module, exports, __webpack_require__) {
  7999. Object.defineProperty(exports, "__esModule", { value: true });
  8000. var tslib_1 = __webpack_require__(2);
  8001. var UnzonedRange_1 = __webpack_require__(5);
  8002. var DateProfileGenerator_1 = __webpack_require__(55);
  8003. var BasicViewDateProfileGenerator = /** @class */ (function (_super) {
  8004. tslib_1.__extends(BasicViewDateProfileGenerator, _super);
  8005. function BasicViewDateProfileGenerator() {
  8006. return _super !== null && _super.apply(this, arguments) || this;
  8007. }
  8008. // Computes the date range that will be rendered.
  8009. BasicViewDateProfileGenerator.prototype.buildRenderRange = function (currentUnzonedRange, currentRangeUnit, isRangeAllDay) {
  8010. var renderUnzonedRange = _super.prototype.buildRenderRange.call(this, currentUnzonedRange, currentRangeUnit, isRangeAllDay); // an UnzonedRange
  8011. var start = this.msToUtcMoment(renderUnzonedRange.startMs, isRangeAllDay);
  8012. var end = this.msToUtcMoment(renderUnzonedRange.endMs, isRangeAllDay);
  8013. // year and month views should be aligned with weeks. this is already done for week
  8014. if (/^(year|month)$/.test(currentRangeUnit)) {
  8015. start.startOf('week');
  8016. // make end-of-week if not already
  8017. if (end.weekday()) {
  8018. end.add(1, 'week').startOf('week'); // exclusively move backwards
  8019. }
  8020. }
  8021. return new UnzonedRange_1.default(start, end);
  8022. };
  8023. return BasicViewDateProfileGenerator;
  8024. }(DateProfileGenerator_1.default));
  8025. exports.default = BasicViewDateProfileGenerator;
  8026. /***/ }),
  8027. /* 69 */,
  8028. /* 70 */,
  8029. /* 71 */,
  8030. /* 72 */,
  8031. /* 73 */,
  8032. /* 74 */,
  8033. /* 75 */,
  8034. /* 76 */,
  8035. /* 77 */,
  8036. /* 78 */,
  8037. /* 79 */,
  8038. /* 80 */,
  8039. /* 81 */,
  8040. /* 82 */,
  8041. /* 83 */,
  8042. /* 84 */,
  8043. /* 85 */,
  8044. /* 86 */,
  8045. /* 87 */,
  8046. /* 88 */,
  8047. /* 89 */,
  8048. /* 90 */,
  8049. /* 91 */,
  8050. /* 92 */,
  8051. /* 93 */,
  8052. /* 94 */,
  8053. /* 95 */,
  8054. /* 96 */,
  8055. /* 97 */,
  8056. /* 98 */,
  8057. /* 99 */,
  8058. /* 100 */,
  8059. /* 101 */,
  8060. /* 102 */,
  8061. /* 103 */,
  8062. /* 104 */,
  8063. /* 105 */,
  8064. /* 106 */,
  8065. /* 107 */,
  8066. /* 108 */,
  8067. /* 109 */,
  8068. /* 110 */,
  8069. /* 111 */,
  8070. /* 112 */,
  8071. /* 113 */,
  8072. /* 114 */,
  8073. /* 115 */,
  8074. /* 116 */,
  8075. /* 117 */,
  8076. /* 118 */,
  8077. /* 119 */,
  8078. /* 120 */,
  8079. /* 121 */,
  8080. /* 122 */,
  8081. /* 123 */,
  8082. /* 124 */,
  8083. /* 125 */,
  8084. /* 126 */,
  8085. /* 127 */,
  8086. /* 128 */,
  8087. /* 129 */,
  8088. /* 130 */,
  8089. /* 131 */,
  8090. /* 132 */,
  8091. /* 133 */,
  8092. /* 134 */,
  8093. /* 135 */,
  8094. /* 136 */,
  8095. /* 137 */,
  8096. /* 138 */,
  8097. /* 139 */,
  8098. /* 140 */,
  8099. /* 141 */,
  8100. /* 142 */,
  8101. /* 143 */,
  8102. /* 144 */,
  8103. /* 145 */,
  8104. /* 146 */,
  8105. /* 147 */,
  8106. /* 148 */,
  8107. /* 149 */,
  8108. /* 150 */,
  8109. /* 151 */,
  8110. /* 152 */,
  8111. /* 153 */,
  8112. /* 154 */,
  8113. /* 155 */,
  8114. /* 156 */,
  8115. /* 157 */,
  8116. /* 158 */,
  8117. /* 159 */,
  8118. /* 160 */,
  8119. /* 161 */,
  8120. /* 162 */,
  8121. /* 163 */,
  8122. /* 164 */,
  8123. /* 165 */,
  8124. /* 166 */,
  8125. /* 167 */,
  8126. /* 168 */,
  8127. /* 169 */,
  8128. /* 170 */,
  8129. /* 171 */,
  8130. /* 172 */,
  8131. /* 173 */,
  8132. /* 174 */,
  8133. /* 175 */,
  8134. /* 176 */,
  8135. /* 177 */,
  8136. /* 178 */,
  8137. /* 179 */,
  8138. /* 180 */,
  8139. /* 181 */,
  8140. /* 182 */,
  8141. /* 183 */,
  8142. /* 184 */,
  8143. /* 185 */,
  8144. /* 186 */,
  8145. /* 187 */,
  8146. /* 188 */,
  8147. /* 189 */,
  8148. /* 190 */,
  8149. /* 191 */,
  8150. /* 192 */,
  8151. /* 193 */,
  8152. /* 194 */,
  8153. /* 195 */,
  8154. /* 196 */,
  8155. /* 197 */,
  8156. /* 198 */,
  8157. /* 199 */,
  8158. /* 200 */,
  8159. /* 201 */,
  8160. /* 202 */,
  8161. /* 203 */,
  8162. /* 204 */,
  8163. /* 205 */,
  8164. /* 206 */,
  8165. /* 207 */,
  8166. /* 208 */,
  8167. /* 209 */,
  8168. /* 210 */,
  8169. /* 211 */,
  8170. /* 212 */,
  8171. /* 213 */,
  8172. /* 214 */,
  8173. /* 215 */,
  8174. /* 216 */,
  8175. /* 217 */
  8176. /***/ (function(module, exports, __webpack_require__) {
  8177. Object.defineProperty(exports, "__esModule", { value: true });
  8178. var UnzonedRange_1 = __webpack_require__(5);
  8179. var ComponentFootprint_1 = __webpack_require__(12);
  8180. var EventDefParser_1 = __webpack_require__(36);
  8181. var EventSource_1 = __webpack_require__(6);
  8182. var util_1 = __webpack_require__(19);
  8183. var Constraints = /** @class */ (function () {
  8184. function Constraints(eventManager, _calendar) {
  8185. this.eventManager = eventManager;
  8186. this._calendar = _calendar;
  8187. }
  8188. Constraints.prototype.opt = function (name) {
  8189. return this._calendar.opt(name);
  8190. };
  8191. /*
  8192. determines if eventInstanceGroup is allowed,
  8193. in relation to other EVENTS and business hours.
  8194. */
  8195. Constraints.prototype.isEventInstanceGroupAllowed = function (eventInstanceGroup) {
  8196. var eventDef = eventInstanceGroup.getEventDef();
  8197. var eventFootprints = this.eventRangesToEventFootprints(eventInstanceGroup.getAllEventRanges());
  8198. var i;
  8199. var peerEventInstances = this.getPeerEventInstances(eventDef);
  8200. var peerEventRanges = peerEventInstances.map(util_1.eventInstanceToEventRange);
  8201. var peerEventFootprints = this.eventRangesToEventFootprints(peerEventRanges);
  8202. var constraintVal = eventDef.getConstraint();
  8203. var overlapVal = eventDef.getOverlap();
  8204. var eventAllowFunc = this.opt('eventAllow');
  8205. for (i = 0; i < eventFootprints.length; i++) {
  8206. if (!this.isFootprintAllowed(eventFootprints[i].componentFootprint, peerEventFootprints, constraintVal, overlapVal, eventFootprints[i].eventInstance)) {
  8207. return false;
  8208. }
  8209. }
  8210. if (eventAllowFunc) {
  8211. for (i = 0; i < eventFootprints.length; i++) {
  8212. if (eventAllowFunc(eventFootprints[i].componentFootprint.toLegacy(this._calendar), eventFootprints[i].getEventLegacy()) === false) {
  8213. return false;
  8214. }
  8215. }
  8216. }
  8217. return true;
  8218. };
  8219. Constraints.prototype.getPeerEventInstances = function (eventDef) {
  8220. return this.eventManager.getEventInstancesWithoutId(eventDef.id);
  8221. };
  8222. Constraints.prototype.isSelectionFootprintAllowed = function (componentFootprint) {
  8223. var peerEventInstances = this.eventManager.getEventInstances();
  8224. var peerEventRanges = peerEventInstances.map(util_1.eventInstanceToEventRange);
  8225. var peerEventFootprints = this.eventRangesToEventFootprints(peerEventRanges);
  8226. var selectAllowFunc;
  8227. if (this.isFootprintAllowed(componentFootprint, peerEventFootprints, this.opt('selectConstraint'), this.opt('selectOverlap'))) {
  8228. selectAllowFunc = this.opt('selectAllow');
  8229. if (selectAllowFunc) {
  8230. return selectAllowFunc(componentFootprint.toLegacy(this._calendar)) !== false;
  8231. }
  8232. else {
  8233. return true;
  8234. }
  8235. }
  8236. return false;
  8237. };
  8238. Constraints.prototype.isFootprintAllowed = function (componentFootprint, peerEventFootprints, constraintVal, overlapVal, subjectEventInstance // optional
  8239. ) {
  8240. var constraintFootprints; // ComponentFootprint[]
  8241. var overlapEventFootprints; // EventFootprint[]
  8242. if (constraintVal != null) {
  8243. constraintFootprints = this.constraintValToFootprints(constraintVal, componentFootprint.isAllDay);
  8244. if (!this.isFootprintWithinConstraints(componentFootprint, constraintFootprints)) {
  8245. return false;
  8246. }
  8247. }
  8248. overlapEventFootprints = this.collectOverlapEventFootprints(peerEventFootprints, componentFootprint);
  8249. if (overlapVal === false) {
  8250. if (overlapEventFootprints.length) {
  8251. return false;
  8252. }
  8253. }
  8254. else if (typeof overlapVal === 'function') {
  8255. if (!isOverlapsAllowedByFunc(overlapEventFootprints, overlapVal, subjectEventInstance)) {
  8256. return false;
  8257. }
  8258. }
  8259. if (subjectEventInstance) {
  8260. if (!isOverlapEventInstancesAllowed(overlapEventFootprints, subjectEventInstance)) {
  8261. return false;
  8262. }
  8263. }
  8264. return true;
  8265. };
  8266. // Constraint
  8267. // ------------------------------------------------------------------------------------------------
  8268. Constraints.prototype.isFootprintWithinConstraints = function (componentFootprint, constraintFootprints) {
  8269. var i;
  8270. for (i = 0; i < constraintFootprints.length; i++) {
  8271. if (this.footprintContainsFootprint(constraintFootprints[i], componentFootprint)) {
  8272. return true;
  8273. }
  8274. }
  8275. return false;
  8276. };
  8277. Constraints.prototype.constraintValToFootprints = function (constraintVal, isAllDay) {
  8278. var eventInstances;
  8279. if (constraintVal === 'businessHours') {
  8280. return this.buildCurrentBusinessFootprints(isAllDay);
  8281. }
  8282. else if (typeof constraintVal === 'object') {
  8283. eventInstances = this.parseEventDefToInstances(constraintVal); // handles recurring events
  8284. if (!eventInstances) { // invalid input. fallback to parsing footprint directly
  8285. return this.parseFootprints(constraintVal);
  8286. }
  8287. else {
  8288. return this.eventInstancesToFootprints(eventInstances);
  8289. }
  8290. }
  8291. else if (constraintVal != null) { // an ID
  8292. eventInstances = this.eventManager.getEventInstancesWithId(constraintVal);
  8293. return this.eventInstancesToFootprints(eventInstances);
  8294. }
  8295. };
  8296. // returns ComponentFootprint[]
  8297. // uses current view's range
  8298. Constraints.prototype.buildCurrentBusinessFootprints = function (isAllDay) {
  8299. var view = this._calendar.view;
  8300. var businessHourGenerator = view.get('businessHourGenerator');
  8301. var unzonedRange = view.dateProfile.activeUnzonedRange;
  8302. var eventInstanceGroup = businessHourGenerator.buildEventInstanceGroup(isAllDay, unzonedRange);
  8303. if (eventInstanceGroup) {
  8304. return this.eventInstancesToFootprints(eventInstanceGroup.eventInstances);
  8305. }
  8306. else {
  8307. return [];
  8308. }
  8309. };
  8310. // conversion util
  8311. Constraints.prototype.eventInstancesToFootprints = function (eventInstances) {
  8312. var eventRanges = eventInstances.map(util_1.eventInstanceToEventRange);
  8313. var eventFootprints = this.eventRangesToEventFootprints(eventRanges);
  8314. return eventFootprints.map(util_1.eventFootprintToComponentFootprint);
  8315. };
  8316. // Overlap
  8317. // ------------------------------------------------------------------------------------------------
  8318. Constraints.prototype.collectOverlapEventFootprints = function (peerEventFootprints, targetFootprint) {
  8319. var overlapEventFootprints = [];
  8320. var i;
  8321. for (i = 0; i < peerEventFootprints.length; i++) {
  8322. if (this.footprintsIntersect(targetFootprint, peerEventFootprints[i].componentFootprint)) {
  8323. overlapEventFootprints.push(peerEventFootprints[i]);
  8324. }
  8325. }
  8326. return overlapEventFootprints;
  8327. };
  8328. // Conversion: eventDefs -> eventInstances -> eventRanges -> eventFootprints -> componentFootprints
  8329. // ------------------------------------------------------------------------------------------------
  8330. // NOTE: this might seem like repetitive code with the Grid class, however, this code is related to
  8331. // constraints whereas the Grid code is related to rendering. Each approach might want to convert
  8332. // eventRanges -> eventFootprints in a different way. Regardless, there are opportunities to make
  8333. // this more DRY.
  8334. /*
  8335. Returns false on invalid input.
  8336. */
  8337. Constraints.prototype.parseEventDefToInstances = function (eventInput) {
  8338. var eventManager = this.eventManager;
  8339. var eventDef = EventDefParser_1.default.parse(eventInput, new EventSource_1.default(this._calendar));
  8340. if (!eventDef) { // invalid
  8341. return false;
  8342. }
  8343. return eventDef.buildInstances(eventManager.currentPeriod.unzonedRange);
  8344. };
  8345. Constraints.prototype.eventRangesToEventFootprints = function (eventRanges) {
  8346. var i;
  8347. var eventFootprints = [];
  8348. for (i = 0; i < eventRanges.length; i++) {
  8349. eventFootprints.push.apply(// footprints
  8350. eventFootprints, this.eventRangeToEventFootprints(eventRanges[i]));
  8351. }
  8352. return eventFootprints;
  8353. };
  8354. Constraints.prototype.eventRangeToEventFootprints = function (eventRange) {
  8355. return [util_1.eventRangeToEventFootprint(eventRange)];
  8356. };
  8357. /*
  8358. Parses footprints directly.
  8359. Very similar to EventDateProfile::parse :(
  8360. */
  8361. Constraints.prototype.parseFootprints = function (rawInput) {
  8362. var start;
  8363. var end;
  8364. if (rawInput.start) {
  8365. start = this._calendar.moment(rawInput.start);
  8366. if (!start.isValid()) {
  8367. start = null;
  8368. }
  8369. }
  8370. if (rawInput.end) {
  8371. end = this._calendar.moment(rawInput.end);
  8372. if (!end.isValid()) {
  8373. end = null;
  8374. }
  8375. }
  8376. return [
  8377. new ComponentFootprint_1.default(new UnzonedRange_1.default(start, end), (start && !start.hasTime()) || (end && !end.hasTime()) // isAllDay
  8378. )
  8379. ];
  8380. };
  8381. // Footprint Utils
  8382. // ----------------------------------------------------------------------------------------
  8383. Constraints.prototype.footprintContainsFootprint = function (outerFootprint, innerFootprint) {
  8384. return outerFootprint.unzonedRange.containsRange(innerFootprint.unzonedRange);
  8385. };
  8386. Constraints.prototype.footprintsIntersect = function (footprint0, footprint1) {
  8387. return footprint0.unzonedRange.intersectsWith(footprint1.unzonedRange);
  8388. };
  8389. return Constraints;
  8390. }());
  8391. exports.default = Constraints;
  8392. // optional subjectEventInstance
  8393. function isOverlapsAllowedByFunc(overlapEventFootprints, overlapFunc, subjectEventInstance) {
  8394. var i;
  8395. for (i = 0; i < overlapEventFootprints.length; i++) {
  8396. if (!overlapFunc(overlapEventFootprints[i].eventInstance.toLegacy(), subjectEventInstance ? subjectEventInstance.toLegacy() : null)) {
  8397. return false;
  8398. }
  8399. }
  8400. return true;
  8401. }
  8402. function isOverlapEventInstancesAllowed(overlapEventFootprints, subjectEventInstance) {
  8403. var subjectLegacyInstance = subjectEventInstance.toLegacy();
  8404. var i;
  8405. var overlapEventInstance;
  8406. var overlapEventDef;
  8407. var overlapVal;
  8408. for (i = 0; i < overlapEventFootprints.length; i++) {
  8409. overlapEventInstance = overlapEventFootprints[i].eventInstance;
  8410. overlapEventDef = overlapEventInstance.def;
  8411. // don't need to pass in calendar, because don't want to consider global eventOverlap property,
  8412. // because we already considered that earlier in the process.
  8413. overlapVal = overlapEventDef.getOverlap();
  8414. if (overlapVal === false) {
  8415. return false;
  8416. }
  8417. else if (typeof overlapVal === 'function') {
  8418. if (!overlapVal(overlapEventInstance.toLegacy(), subjectLegacyInstance)) {
  8419. return false;
  8420. }
  8421. }
  8422. }
  8423. return true;
  8424. }
  8425. /***/ }),
  8426. /* 218 */
  8427. /***/ (function(module, exports, __webpack_require__) {
  8428. Object.defineProperty(exports, "__esModule", { value: true });
  8429. var $ = __webpack_require__(3);
  8430. var util_1 = __webpack_require__(19);
  8431. var EventInstanceGroup_1 = __webpack_require__(20);
  8432. var RecurringEventDef_1 = __webpack_require__(54);
  8433. var EventSource_1 = __webpack_require__(6);
  8434. var BUSINESS_HOUR_EVENT_DEFAULTS = {
  8435. start: '09:00',
  8436. end: '17:00',
  8437. dow: [1, 2, 3, 4, 5],
  8438. rendering: 'inverse-background'
  8439. // classNames are defined in businessHoursSegClasses
  8440. };
  8441. var BusinessHourGenerator = /** @class */ (function () {
  8442. function BusinessHourGenerator(rawComplexDef, calendar) {
  8443. this.rawComplexDef = rawComplexDef;
  8444. this.calendar = calendar;
  8445. }
  8446. BusinessHourGenerator.prototype.buildEventInstanceGroup = function (isAllDay, unzonedRange) {
  8447. var eventDefs = this.buildEventDefs(isAllDay);
  8448. var eventInstanceGroup;
  8449. if (eventDefs.length) {
  8450. eventInstanceGroup = new EventInstanceGroup_1.default(util_1.eventDefsToEventInstances(eventDefs, unzonedRange));
  8451. // so that inverse-background rendering can happen even when no eventRanges in view
  8452. eventInstanceGroup.explicitEventDef = eventDefs[0];
  8453. return eventInstanceGroup;
  8454. }
  8455. };
  8456. BusinessHourGenerator.prototype.buildEventDefs = function (isAllDay) {
  8457. var rawComplexDef = this.rawComplexDef;
  8458. var rawDefs = [];
  8459. var requireDow = false;
  8460. var i;
  8461. var defs = [];
  8462. if (rawComplexDef === true) {
  8463. rawDefs = [{}]; // will get BUSINESS_HOUR_EVENT_DEFAULTS verbatim
  8464. }
  8465. else if ($.isPlainObject(rawComplexDef)) {
  8466. rawDefs = [rawComplexDef];
  8467. }
  8468. else if ($.isArray(rawComplexDef)) {
  8469. rawDefs = rawComplexDef;
  8470. requireDow = true; // every sub-definition NEEDS a day-of-week
  8471. }
  8472. for (i = 0; i < rawDefs.length; i++) {
  8473. if (!requireDow || rawDefs[i].dow) {
  8474. defs.push(this.buildEventDef(isAllDay, rawDefs[i]));
  8475. }
  8476. }
  8477. return defs;
  8478. };
  8479. BusinessHourGenerator.prototype.buildEventDef = function (isAllDay, rawDef) {
  8480. var fullRawDef = $.extend({}, BUSINESS_HOUR_EVENT_DEFAULTS, rawDef);
  8481. if (isAllDay) {
  8482. fullRawDef.start = null;
  8483. fullRawDef.end = null;
  8484. }
  8485. return RecurringEventDef_1.default.parse(fullRawDef, new EventSource_1.default(this.calendar) // dummy source
  8486. );
  8487. };
  8488. return BusinessHourGenerator;
  8489. }());
  8490. exports.default = BusinessHourGenerator;
  8491. /***/ }),
  8492. /* 219 */
  8493. /***/ (function(module, exports, __webpack_require__) {
  8494. Object.defineProperty(exports, "__esModule", { value: true });
  8495. var $ = __webpack_require__(3);
  8496. var util_1 = __webpack_require__(4);
  8497. var Promise_1 = __webpack_require__(21);
  8498. var EmitterMixin_1 = __webpack_require__(13);
  8499. var UnzonedRange_1 = __webpack_require__(5);
  8500. var EventInstanceGroup_1 = __webpack_require__(20);
  8501. var EventPeriod = /** @class */ (function () {
  8502. function EventPeriod(start, end, timezone) {
  8503. this.pendingCnt = 0;
  8504. this.freezeDepth = 0;
  8505. this.stuntedReleaseCnt = 0;
  8506. this.releaseCnt = 0;
  8507. this.start = start;
  8508. this.end = end;
  8509. this.timezone = timezone;
  8510. this.unzonedRange = new UnzonedRange_1.default(start.clone().stripZone(), end.clone().stripZone());
  8511. this.requestsByUid = {};
  8512. this.eventDefsByUid = {};
  8513. this.eventDefsById = {};
  8514. this.eventInstanceGroupsById = {};
  8515. }
  8516. EventPeriod.prototype.isWithinRange = function (start, end) {
  8517. // TODO: use a range util function?
  8518. return !start.isBefore(this.start) && !end.isAfter(this.end);
  8519. };
  8520. // Requesting and Purging
  8521. // -----------------------------------------------------------------------------------------------------------------
  8522. EventPeriod.prototype.requestSources = function (sources) {
  8523. this.freeze();
  8524. for (var i = 0; i < sources.length; i++) {
  8525. this.requestSource(sources[i]);
  8526. }
  8527. this.thaw();
  8528. };
  8529. EventPeriod.prototype.requestSource = function (source) {
  8530. var _this = this;
  8531. var request = { source: source, status: 'pending', eventDefs: null };
  8532. this.requestsByUid[source.uid] = request;
  8533. this.pendingCnt += 1;
  8534. source.fetch(this.start, this.end, this.timezone).then(function (eventDefs) {
  8535. if (request.status !== 'cancelled') {
  8536. request.status = 'completed';
  8537. request.eventDefs = eventDefs;
  8538. _this.addEventDefs(eventDefs);
  8539. _this.pendingCnt--;
  8540. _this.tryRelease();
  8541. }
  8542. }, function () {
  8543. if (request.status !== 'cancelled') {
  8544. request.status = 'failed';
  8545. _this.pendingCnt--;
  8546. _this.tryRelease();
  8547. }
  8548. });
  8549. };
  8550. EventPeriod.prototype.purgeSource = function (source) {
  8551. var request = this.requestsByUid[source.uid];
  8552. if (request) {
  8553. delete this.requestsByUid[source.uid];
  8554. if (request.status === 'pending') {
  8555. request.status = 'cancelled';
  8556. this.pendingCnt--;
  8557. this.tryRelease();
  8558. }
  8559. else if (request.status === 'completed') {
  8560. request.eventDefs.forEach(this.removeEventDef.bind(this));
  8561. }
  8562. }
  8563. };
  8564. EventPeriod.prototype.purgeAllSources = function () {
  8565. var requestsByUid = this.requestsByUid;
  8566. var uid;
  8567. var request;
  8568. var completedCnt = 0;
  8569. for (uid in requestsByUid) {
  8570. request = requestsByUid[uid];
  8571. if (request.status === 'pending') {
  8572. request.status = 'cancelled';
  8573. }
  8574. else if (request.status === 'completed') {
  8575. completedCnt++;
  8576. }
  8577. }
  8578. this.requestsByUid = {};
  8579. this.pendingCnt = 0;
  8580. if (completedCnt) {
  8581. this.removeAllEventDefs(); // might release
  8582. }
  8583. };
  8584. // Event Definitions
  8585. // -----------------------------------------------------------------------------------------------------------------
  8586. EventPeriod.prototype.getEventDefByUid = function (eventDefUid) {
  8587. return this.eventDefsByUid[eventDefUid];
  8588. };
  8589. EventPeriod.prototype.getEventDefsById = function (eventDefId) {
  8590. var a = this.eventDefsById[eventDefId];
  8591. if (a) {
  8592. return a.slice(); // clone
  8593. }
  8594. return [];
  8595. };
  8596. EventPeriod.prototype.addEventDefs = function (eventDefs) {
  8597. for (var i = 0; i < eventDefs.length; i++) {
  8598. this.addEventDef(eventDefs[i]);
  8599. }
  8600. };
  8601. EventPeriod.prototype.addEventDef = function (eventDef) {
  8602. var eventDefsById = this.eventDefsById;
  8603. var eventDefId = eventDef.id;
  8604. var eventDefs = eventDefsById[eventDefId] || (eventDefsById[eventDefId] = []);
  8605. var eventInstances = eventDef.buildInstances(this.unzonedRange);
  8606. var i;
  8607. eventDefs.push(eventDef);
  8608. this.eventDefsByUid[eventDef.uid] = eventDef;
  8609. for (i = 0; i < eventInstances.length; i++) {
  8610. this.addEventInstance(eventInstances[i], eventDefId);
  8611. }
  8612. };
  8613. EventPeriod.prototype.removeEventDefsById = function (eventDefId) {
  8614. var _this = this;
  8615. this.getEventDefsById(eventDefId).forEach(function (eventDef) {
  8616. _this.removeEventDef(eventDef);
  8617. });
  8618. };
  8619. EventPeriod.prototype.removeAllEventDefs = function () {
  8620. var isEmpty = $.isEmptyObject(this.eventDefsByUid);
  8621. this.eventDefsByUid = {};
  8622. this.eventDefsById = {};
  8623. this.eventInstanceGroupsById = {};
  8624. if (!isEmpty) {
  8625. this.tryRelease();
  8626. }
  8627. };
  8628. EventPeriod.prototype.removeEventDef = function (eventDef) {
  8629. var eventDefsById = this.eventDefsById;
  8630. var eventDefs = eventDefsById[eventDef.id];
  8631. delete this.eventDefsByUid[eventDef.uid];
  8632. if (eventDefs) {
  8633. util_1.removeExact(eventDefs, eventDef);
  8634. if (!eventDefs.length) {
  8635. delete eventDefsById[eventDef.id];
  8636. }
  8637. this.removeEventInstancesForDef(eventDef);
  8638. }
  8639. };
  8640. // Event Instances
  8641. // -----------------------------------------------------------------------------------------------------------------
  8642. EventPeriod.prototype.getEventInstances = function () {
  8643. var eventInstanceGroupsById = this.eventInstanceGroupsById;
  8644. var eventInstances = [];
  8645. var id;
  8646. for (id in eventInstanceGroupsById) {
  8647. eventInstances.push.apply(eventInstances, // append
  8648. eventInstanceGroupsById[id].eventInstances);
  8649. }
  8650. return eventInstances;
  8651. };
  8652. EventPeriod.prototype.getEventInstancesWithId = function (eventDefId) {
  8653. var eventInstanceGroup = this.eventInstanceGroupsById[eventDefId];
  8654. if (eventInstanceGroup) {
  8655. return eventInstanceGroup.eventInstances.slice(); // clone
  8656. }
  8657. return [];
  8658. };
  8659. EventPeriod.prototype.getEventInstancesWithoutId = function (eventDefId) {
  8660. var eventInstanceGroupsById = this.eventInstanceGroupsById;
  8661. var matchingInstances = [];
  8662. var id;
  8663. for (id in eventInstanceGroupsById) {
  8664. if (id !== eventDefId) {
  8665. matchingInstances.push.apply(matchingInstances, // append
  8666. eventInstanceGroupsById[id].eventInstances);
  8667. }
  8668. }
  8669. return matchingInstances;
  8670. };
  8671. EventPeriod.prototype.addEventInstance = function (eventInstance, eventDefId) {
  8672. var eventInstanceGroupsById = this.eventInstanceGroupsById;
  8673. var eventInstanceGroup = eventInstanceGroupsById[eventDefId] ||
  8674. (eventInstanceGroupsById[eventDefId] = new EventInstanceGroup_1.default());
  8675. eventInstanceGroup.eventInstances.push(eventInstance);
  8676. this.tryRelease();
  8677. };
  8678. EventPeriod.prototype.removeEventInstancesForDef = function (eventDef) {
  8679. var eventInstanceGroupsById = this.eventInstanceGroupsById;
  8680. var eventInstanceGroup = eventInstanceGroupsById[eventDef.id];
  8681. var removeCnt;
  8682. if (eventInstanceGroup) {
  8683. removeCnt = util_1.removeMatching(eventInstanceGroup.eventInstances, function (currentEventInstance) {
  8684. return currentEventInstance.def === eventDef;
  8685. });
  8686. if (!eventInstanceGroup.eventInstances.length) {
  8687. delete eventInstanceGroupsById[eventDef.id];
  8688. }
  8689. if (removeCnt) {
  8690. this.tryRelease();
  8691. }
  8692. }
  8693. };
  8694. // Releasing and Freezing
  8695. // -----------------------------------------------------------------------------------------------------------------
  8696. EventPeriod.prototype.tryRelease = function () {
  8697. if (!this.pendingCnt) {
  8698. if (!this.freezeDepth) {
  8699. this.release();
  8700. }
  8701. else {
  8702. this.stuntedReleaseCnt++;
  8703. }
  8704. }
  8705. };
  8706. EventPeriod.prototype.release = function () {
  8707. this.releaseCnt++;
  8708. this.trigger('release', this.eventInstanceGroupsById);
  8709. };
  8710. EventPeriod.prototype.whenReleased = function () {
  8711. var _this = this;
  8712. if (this.releaseCnt) {
  8713. return Promise_1.default.resolve(this.eventInstanceGroupsById);
  8714. }
  8715. else {
  8716. return Promise_1.default.construct(function (onResolve) {
  8717. _this.one('release', onResolve);
  8718. });
  8719. }
  8720. };
  8721. EventPeriod.prototype.freeze = function () {
  8722. if (!(this.freezeDepth++)) {
  8723. this.stuntedReleaseCnt = 0;
  8724. }
  8725. };
  8726. EventPeriod.prototype.thaw = function () {
  8727. if (!(--this.freezeDepth) && this.stuntedReleaseCnt && !this.pendingCnt) {
  8728. this.release();
  8729. }
  8730. };
  8731. return EventPeriod;
  8732. }());
  8733. exports.default = EventPeriod;
  8734. EmitterMixin_1.default.mixInto(EventPeriod);
  8735. /***/ }),
  8736. /* 220 */
  8737. /***/ (function(module, exports, __webpack_require__) {
  8738. Object.defineProperty(exports, "__esModule", { value: true });
  8739. var $ = __webpack_require__(3);
  8740. var util_1 = __webpack_require__(4);
  8741. var EventPeriod_1 = __webpack_require__(219);
  8742. var ArrayEventSource_1 = __webpack_require__(56);
  8743. var EventSource_1 = __webpack_require__(6);
  8744. var EventSourceParser_1 = __webpack_require__(38);
  8745. var SingleEventDef_1 = __webpack_require__(9);
  8746. var EventInstanceGroup_1 = __webpack_require__(20);
  8747. var EmitterMixin_1 = __webpack_require__(13);
  8748. var ListenerMixin_1 = __webpack_require__(7);
  8749. var EventManager = /** @class */ (function () {
  8750. function EventManager(calendar) {
  8751. this.calendar = calendar;
  8752. this.stickySource = new ArrayEventSource_1.default(calendar);
  8753. this.otherSources = [];
  8754. }
  8755. EventManager.prototype.requestEvents = function (start, end, timezone, force) {
  8756. if (force ||
  8757. !this.currentPeriod ||
  8758. !this.currentPeriod.isWithinRange(start, end) ||
  8759. timezone !== this.currentPeriod.timezone) {
  8760. this.setPeriod(// will change this.currentPeriod
  8761. new EventPeriod_1.default(start, end, timezone));
  8762. }
  8763. return this.currentPeriod.whenReleased();
  8764. };
  8765. // Source Adding/Removing
  8766. // -----------------------------------------------------------------------------------------------------------------
  8767. EventManager.prototype.addSource = function (eventSource) {
  8768. this.otherSources.push(eventSource);
  8769. if (this.currentPeriod) {
  8770. this.currentPeriod.requestSource(eventSource); // might release
  8771. }
  8772. };
  8773. EventManager.prototype.removeSource = function (doomedSource) {
  8774. util_1.removeExact(this.otherSources, doomedSource);
  8775. if (this.currentPeriod) {
  8776. this.currentPeriod.purgeSource(doomedSource); // might release
  8777. }
  8778. };
  8779. EventManager.prototype.removeAllSources = function () {
  8780. this.otherSources = [];
  8781. if (this.currentPeriod) {
  8782. this.currentPeriod.purgeAllSources(); // might release
  8783. }
  8784. };
  8785. // Source Refetching
  8786. // -----------------------------------------------------------------------------------------------------------------
  8787. EventManager.prototype.refetchSource = function (eventSource) {
  8788. var currentPeriod = this.currentPeriod;
  8789. if (currentPeriod) {
  8790. currentPeriod.freeze();
  8791. currentPeriod.purgeSource(eventSource);
  8792. currentPeriod.requestSource(eventSource);
  8793. currentPeriod.thaw();
  8794. }
  8795. };
  8796. EventManager.prototype.refetchAllSources = function () {
  8797. var currentPeriod = this.currentPeriod;
  8798. if (currentPeriod) {
  8799. currentPeriod.freeze();
  8800. currentPeriod.purgeAllSources();
  8801. currentPeriod.requestSources(this.getSources());
  8802. currentPeriod.thaw();
  8803. }
  8804. };
  8805. // Source Querying
  8806. // -----------------------------------------------------------------------------------------------------------------
  8807. EventManager.prototype.getSources = function () {
  8808. return [this.stickySource].concat(this.otherSources);
  8809. };
  8810. // like querySources, but accepts multple match criteria (like multiple IDs)
  8811. EventManager.prototype.multiQuerySources = function (matchInputs) {
  8812. // coerce into an array
  8813. if (!matchInputs) {
  8814. matchInputs = [];
  8815. }
  8816. else if (!$.isArray(matchInputs)) {
  8817. matchInputs = [matchInputs];
  8818. }
  8819. var matchingSources = [];
  8820. var i;
  8821. // resolve raw inputs to real event source objects
  8822. for (i = 0; i < matchInputs.length; i++) {
  8823. matchingSources.push.apply(// append
  8824. matchingSources, this.querySources(matchInputs[i]));
  8825. }
  8826. return matchingSources;
  8827. };
  8828. // matchInput can either by a real event source object, an ID, or the function/URL for the source.
  8829. // returns an array of matching source objects.
  8830. EventManager.prototype.querySources = function (matchInput) {
  8831. var sources = this.otherSources;
  8832. var i;
  8833. var source;
  8834. // given a proper event source object
  8835. for (i = 0; i < sources.length; i++) {
  8836. source = sources[i];
  8837. if (source === matchInput) {
  8838. return [source];
  8839. }
  8840. }
  8841. // an ID match
  8842. source = this.getSourceById(EventSource_1.default.normalizeId(matchInput));
  8843. if (source) {
  8844. return [source];
  8845. }
  8846. // parse as an event source
  8847. matchInput = EventSourceParser_1.default.parse(matchInput, this.calendar);
  8848. if (matchInput) {
  8849. return $.grep(sources, function (source) {
  8850. return isSourcesEquivalent(matchInput, source);
  8851. });
  8852. }
  8853. };
  8854. /*
  8855. ID assumed to already be normalized
  8856. */
  8857. EventManager.prototype.getSourceById = function (id) {
  8858. return $.grep(this.otherSources, function (source) {
  8859. return source.id && source.id === id;
  8860. })[0];
  8861. };
  8862. // Event-Period
  8863. // -----------------------------------------------------------------------------------------------------------------
  8864. EventManager.prototype.setPeriod = function (eventPeriod) {
  8865. if (this.currentPeriod) {
  8866. this.unbindPeriod(this.currentPeriod);
  8867. this.currentPeriod = null;
  8868. }
  8869. this.currentPeriod = eventPeriod;
  8870. this.bindPeriod(eventPeriod);
  8871. eventPeriod.requestSources(this.getSources());
  8872. };
  8873. EventManager.prototype.bindPeriod = function (eventPeriod) {
  8874. this.listenTo(eventPeriod, 'release', function (eventsPayload) {
  8875. this.trigger('release', eventsPayload);
  8876. });
  8877. };
  8878. EventManager.prototype.unbindPeriod = function (eventPeriod) {
  8879. this.stopListeningTo(eventPeriod);
  8880. };
  8881. // Event Getting/Adding/Removing
  8882. // -----------------------------------------------------------------------------------------------------------------
  8883. EventManager.prototype.getEventDefByUid = function (uid) {
  8884. if (this.currentPeriod) {
  8885. return this.currentPeriod.getEventDefByUid(uid);
  8886. }
  8887. };
  8888. EventManager.prototype.addEventDef = function (eventDef, isSticky) {
  8889. if (isSticky) {
  8890. this.stickySource.addEventDef(eventDef);
  8891. }
  8892. if (this.currentPeriod) {
  8893. this.currentPeriod.addEventDef(eventDef); // might release
  8894. }
  8895. };
  8896. EventManager.prototype.removeEventDefsById = function (eventId) {
  8897. this.getSources().forEach(function (eventSource) {
  8898. eventSource.removeEventDefsById(eventId);
  8899. });
  8900. if (this.currentPeriod) {
  8901. this.currentPeriod.removeEventDefsById(eventId); // might release
  8902. }
  8903. };
  8904. EventManager.prototype.removeAllEventDefs = function () {
  8905. this.getSources().forEach(function (eventSource) {
  8906. eventSource.removeAllEventDefs();
  8907. });
  8908. if (this.currentPeriod) {
  8909. this.currentPeriod.removeAllEventDefs();
  8910. }
  8911. };
  8912. // Event Mutating
  8913. // -----------------------------------------------------------------------------------------------------------------
  8914. /*
  8915. Returns an undo function.
  8916. */
  8917. EventManager.prototype.mutateEventsWithId = function (eventDefId, eventDefMutation) {
  8918. var currentPeriod = this.currentPeriod;
  8919. var eventDefs;
  8920. var undoFuncs = [];
  8921. if (currentPeriod) {
  8922. currentPeriod.freeze();
  8923. eventDefs = currentPeriod.getEventDefsById(eventDefId);
  8924. eventDefs.forEach(function (eventDef) {
  8925. // add/remove esp because id might change
  8926. currentPeriod.removeEventDef(eventDef);
  8927. undoFuncs.push(eventDefMutation.mutateSingle(eventDef));
  8928. currentPeriod.addEventDef(eventDef);
  8929. });
  8930. currentPeriod.thaw();
  8931. return function () {
  8932. currentPeriod.freeze();
  8933. for (var i = 0; i < eventDefs.length; i++) {
  8934. currentPeriod.removeEventDef(eventDefs[i]);
  8935. undoFuncs[i]();
  8936. currentPeriod.addEventDef(eventDefs[i]);
  8937. }
  8938. currentPeriod.thaw();
  8939. };
  8940. }
  8941. return function () { };
  8942. };
  8943. /*
  8944. copies and then mutates
  8945. */
  8946. EventManager.prototype.buildMutatedEventInstanceGroup = function (eventDefId, eventDefMutation) {
  8947. var eventDefs = this.getEventDefsById(eventDefId);
  8948. var i;
  8949. var defCopy;
  8950. var allInstances = [];
  8951. for (i = 0; i < eventDefs.length; i++) {
  8952. defCopy = eventDefs[i].clone();
  8953. if (defCopy instanceof SingleEventDef_1.default) {
  8954. eventDefMutation.mutateSingle(defCopy);
  8955. allInstances.push.apply(allInstances, // append
  8956. defCopy.buildInstances());
  8957. }
  8958. }
  8959. return new EventInstanceGroup_1.default(allInstances);
  8960. };
  8961. // Freezing
  8962. // -----------------------------------------------------------------------------------------------------------------
  8963. EventManager.prototype.freeze = function () {
  8964. if (this.currentPeriod) {
  8965. this.currentPeriod.freeze();
  8966. }
  8967. };
  8968. EventManager.prototype.thaw = function () {
  8969. if (this.currentPeriod) {
  8970. this.currentPeriod.thaw();
  8971. }
  8972. };
  8973. // methods that simply forward to EventPeriod
  8974. EventManager.prototype.getEventDefsById = function (eventDefId) {
  8975. return this.currentPeriod.getEventDefsById(eventDefId);
  8976. };
  8977. EventManager.prototype.getEventInstances = function () {
  8978. return this.currentPeriod.getEventInstances();
  8979. };
  8980. EventManager.prototype.getEventInstancesWithId = function (eventDefId) {
  8981. return this.currentPeriod.getEventInstancesWithId(eventDefId);
  8982. };
  8983. EventManager.prototype.getEventInstancesWithoutId = function (eventDefId) {
  8984. return this.currentPeriod.getEventInstancesWithoutId(eventDefId);
  8985. };
  8986. return EventManager;
  8987. }());
  8988. exports.default = EventManager;
  8989. EmitterMixin_1.default.mixInto(EventManager);
  8990. ListenerMixin_1.default.mixInto(EventManager);
  8991. function isSourcesEquivalent(source0, source1) {
  8992. return source0.getPrimitive() === source1.getPrimitive();
  8993. }
  8994. /***/ }),
  8995. /* 221 */
  8996. /***/ (function(module, exports, __webpack_require__) {
  8997. Object.defineProperty(exports, "__esModule", { value: true });
  8998. var tslib_1 = __webpack_require__(2);
  8999. var Theme_1 = __webpack_require__(22);
  9000. var StandardTheme = /** @class */ (function (_super) {
  9001. tslib_1.__extends(StandardTheme, _super);
  9002. function StandardTheme() {
  9003. return _super !== null && _super.apply(this, arguments) || this;
  9004. }
  9005. return StandardTheme;
  9006. }(Theme_1.default));
  9007. exports.default = StandardTheme;
  9008. StandardTheme.prototype.classes = {
  9009. widget: 'fc-unthemed',
  9010. widgetHeader: 'fc-widget-header',
  9011. widgetContent: 'fc-widget-content',
  9012. buttonGroup: 'fc-button-group',
  9013. button: 'fc-button',
  9014. cornerLeft: 'fc-corner-left',
  9015. cornerRight: 'fc-corner-right',
  9016. stateDefault: 'fc-state-default',
  9017. stateActive: 'fc-state-active',
  9018. stateDisabled: 'fc-state-disabled',
  9019. stateHover: 'fc-state-hover',
  9020. stateDown: 'fc-state-down',
  9021. popoverHeader: 'fc-widget-header',
  9022. popoverContent: 'fc-widget-content',
  9023. // day grid
  9024. headerRow: 'fc-widget-header',
  9025. dayRow: 'fc-widget-content',
  9026. // list view
  9027. listView: 'fc-widget-content'
  9028. };
  9029. StandardTheme.prototype.baseIconClass = 'fc-icon';
  9030. StandardTheme.prototype.iconClasses = {
  9031. close: 'fc-icon-x',
  9032. prev: 'fc-icon-left-single-arrow',
  9033. next: 'fc-icon-right-single-arrow',
  9034. prevYear: 'fc-icon-left-double-arrow',
  9035. nextYear: 'fc-icon-right-double-arrow'
  9036. };
  9037. StandardTheme.prototype.iconOverrideOption = 'buttonIcons';
  9038. StandardTheme.prototype.iconOverrideCustomButtonOption = 'icon';
  9039. StandardTheme.prototype.iconOverridePrefix = 'fc-icon-';
  9040. /***/ }),
  9041. /* 222 */
  9042. /***/ (function(module, exports, __webpack_require__) {
  9043. Object.defineProperty(exports, "__esModule", { value: true });
  9044. var tslib_1 = __webpack_require__(2);
  9045. var Theme_1 = __webpack_require__(22);
  9046. var JqueryUiTheme = /** @class */ (function (_super) {
  9047. tslib_1.__extends(JqueryUiTheme, _super);
  9048. function JqueryUiTheme() {
  9049. return _super !== null && _super.apply(this, arguments) || this;
  9050. }
  9051. return JqueryUiTheme;
  9052. }(Theme_1.default));
  9053. exports.default = JqueryUiTheme;
  9054. JqueryUiTheme.prototype.classes = {
  9055. widget: 'ui-widget',
  9056. widgetHeader: 'ui-widget-header',
  9057. widgetContent: 'ui-widget-content',
  9058. buttonGroup: 'fc-button-group',
  9059. button: 'ui-button',
  9060. cornerLeft: 'ui-corner-left',
  9061. cornerRight: 'ui-corner-right',
  9062. stateDefault: 'ui-state-default',
  9063. stateActive: 'ui-state-active',
  9064. stateDisabled: 'ui-state-disabled',
  9065. stateHover: 'ui-state-hover',
  9066. stateDown: 'ui-state-down',
  9067. today: 'ui-state-highlight',
  9068. popoverHeader: 'ui-widget-header',
  9069. popoverContent: 'ui-widget-content',
  9070. // day grid
  9071. headerRow: 'ui-widget-header',
  9072. dayRow: 'ui-widget-content',
  9073. // list view
  9074. listView: 'ui-widget-content'
  9075. };
  9076. JqueryUiTheme.prototype.baseIconClass = 'ui-icon';
  9077. JqueryUiTheme.prototype.iconClasses = {
  9078. close: 'ui-icon-closethick',
  9079. prev: 'ui-icon-circle-triangle-w',
  9080. next: 'ui-icon-circle-triangle-e',
  9081. prevYear: 'ui-icon-seek-prev',
  9082. nextYear: 'ui-icon-seek-next'
  9083. };
  9084. JqueryUiTheme.prototype.iconOverrideOption = 'themeButtonIcons';
  9085. JqueryUiTheme.prototype.iconOverrideCustomButtonOption = 'themeIcon';
  9086. JqueryUiTheme.prototype.iconOverridePrefix = 'ui-icon-';
  9087. /***/ }),
  9088. /* 223 */
  9089. /***/ (function(module, exports, __webpack_require__) {
  9090. Object.defineProperty(exports, "__esModule", { value: true });
  9091. var tslib_1 = __webpack_require__(2);
  9092. var $ = __webpack_require__(3);
  9093. var Promise_1 = __webpack_require__(21);
  9094. var EventSource_1 = __webpack_require__(6);
  9095. var FuncEventSource = /** @class */ (function (_super) {
  9096. tslib_1.__extends(FuncEventSource, _super);
  9097. function FuncEventSource() {
  9098. return _super !== null && _super.apply(this, arguments) || this;
  9099. }
  9100. FuncEventSource.parse = function (rawInput, calendar) {
  9101. var rawProps;
  9102. // normalize raw input
  9103. if ($.isFunction(rawInput.events)) { // extended form
  9104. rawProps = rawInput;
  9105. }
  9106. else if ($.isFunction(rawInput)) { // short form
  9107. rawProps = { events: rawInput };
  9108. }
  9109. if (rawProps) {
  9110. return EventSource_1.default.parse.call(this, rawProps, calendar);
  9111. }
  9112. return false;
  9113. };
  9114. FuncEventSource.prototype.fetch = function (start, end, timezone) {
  9115. var _this = this;
  9116. this.calendar.pushLoading();
  9117. return Promise_1.default.construct(function (onResolve) {
  9118. _this.func.call(_this.calendar, start.clone(), end.clone(), timezone, function (rawEventDefs) {
  9119. _this.calendar.popLoading();
  9120. onResolve(_this.parseEventDefs(rawEventDefs));
  9121. });
  9122. });
  9123. };
  9124. FuncEventSource.prototype.getPrimitive = function () {
  9125. return this.func;
  9126. };
  9127. FuncEventSource.prototype.applyManualStandardProps = function (rawProps) {
  9128. var superSuccess = _super.prototype.applyManualStandardProps.call(this, rawProps);
  9129. this.func = rawProps.events;
  9130. return superSuccess;
  9131. };
  9132. return FuncEventSource;
  9133. }(EventSource_1.default));
  9134. exports.default = FuncEventSource;
  9135. FuncEventSource.defineStandardProps({
  9136. events: false // don't automatically transfer
  9137. });
  9138. /***/ }),
  9139. /* 224 */
  9140. /***/ (function(module, exports, __webpack_require__) {
  9141. Object.defineProperty(exports, "__esModule", { value: true });
  9142. var tslib_1 = __webpack_require__(2);
  9143. var $ = __webpack_require__(3);
  9144. var util_1 = __webpack_require__(4);
  9145. var Promise_1 = __webpack_require__(21);
  9146. var EventSource_1 = __webpack_require__(6);
  9147. var JsonFeedEventSource = /** @class */ (function (_super) {
  9148. tslib_1.__extends(JsonFeedEventSource, _super);
  9149. function JsonFeedEventSource() {
  9150. return _super !== null && _super.apply(this, arguments) || this;
  9151. }
  9152. JsonFeedEventSource.parse = function (rawInput, calendar) {
  9153. var rawProps;
  9154. // normalize raw input
  9155. if (typeof rawInput.url === 'string') { // extended form
  9156. rawProps = rawInput;
  9157. }
  9158. else if (typeof rawInput === 'string') { // short form
  9159. rawProps = { url: rawInput };
  9160. }
  9161. if (rawProps) {
  9162. return EventSource_1.default.parse.call(this, rawProps, calendar);
  9163. }
  9164. return false;
  9165. };
  9166. JsonFeedEventSource.prototype.fetch = function (start, end, timezone) {
  9167. var _this = this;
  9168. var ajaxSettings = this.ajaxSettings;
  9169. var onSuccess = ajaxSettings.success;
  9170. var onError = ajaxSettings.error;
  9171. var requestParams = this.buildRequestParams(start, end, timezone);
  9172. // todo: eventually handle the promise's then,
  9173. // don't intercept success/error
  9174. // tho will be a breaking API change
  9175. this.calendar.pushLoading();
  9176. return Promise_1.default.construct(function (onResolve, onReject) {
  9177. $.ajax($.extend({}, // destination
  9178. JsonFeedEventSource.AJAX_DEFAULTS, ajaxSettings, {
  9179. url: _this.url,
  9180. data: requestParams,
  9181. success: function (rawEventDefs, status, xhr) {
  9182. var callbackRes;
  9183. _this.calendar.popLoading();
  9184. if (rawEventDefs) {
  9185. callbackRes = util_1.applyAll(onSuccess, _this, [rawEventDefs, status, xhr]); // redirect `this`
  9186. if ($.isArray(callbackRes)) {
  9187. rawEventDefs = callbackRes;
  9188. }
  9189. onResolve(_this.parseEventDefs(rawEventDefs));
  9190. }
  9191. else {
  9192. onReject();
  9193. }
  9194. },
  9195. error: function (xhr, statusText, errorThrown) {
  9196. _this.calendar.popLoading();
  9197. util_1.applyAll(onError, _this, [xhr, statusText, errorThrown]); // redirect `this`
  9198. onReject();
  9199. }
  9200. }));
  9201. });
  9202. };
  9203. JsonFeedEventSource.prototype.buildRequestParams = function (start, end, timezone) {
  9204. var calendar = this.calendar;
  9205. var ajaxSettings = this.ajaxSettings;
  9206. var startParam;
  9207. var endParam;
  9208. var timezoneParam;
  9209. var customRequestParams;
  9210. var params = {};
  9211. startParam = this.startParam;
  9212. if (startParam == null) {
  9213. startParam = calendar.opt('startParam');
  9214. }
  9215. endParam = this.endParam;
  9216. if (endParam == null) {
  9217. endParam = calendar.opt('endParam');
  9218. }
  9219. timezoneParam = this.timezoneParam;
  9220. if (timezoneParam == null) {
  9221. timezoneParam = calendar.opt('timezoneParam');
  9222. }
  9223. // retrieve any outbound GET/POST $.ajax data from the options
  9224. if ($.isFunction(ajaxSettings.data)) {
  9225. // supplied as a function that returns a key/value object
  9226. customRequestParams = ajaxSettings.data();
  9227. }
  9228. else {
  9229. // probably supplied as a straight key/value object
  9230. customRequestParams = ajaxSettings.data || {};
  9231. }
  9232. $.extend(params, customRequestParams);
  9233. params[startParam] = start.format();
  9234. params[endParam] = end.format();
  9235. if (timezone && timezone !== 'local') {
  9236. params[timezoneParam] = timezone;
  9237. }
  9238. return params;
  9239. };
  9240. JsonFeedEventSource.prototype.getPrimitive = function () {
  9241. return this.url;
  9242. };
  9243. JsonFeedEventSource.prototype.applyMiscProps = function (rawProps) {
  9244. this.ajaxSettings = rawProps;
  9245. };
  9246. JsonFeedEventSource.AJAX_DEFAULTS = {
  9247. dataType: 'json',
  9248. cache: false
  9249. };
  9250. return JsonFeedEventSource;
  9251. }(EventSource_1.default));
  9252. exports.default = JsonFeedEventSource;
  9253. JsonFeedEventSource.defineStandardProps({
  9254. // automatically transfer (true)...
  9255. url: true,
  9256. startParam: true,
  9257. endParam: true,
  9258. timezoneParam: true
  9259. });
  9260. /***/ }),
  9261. /* 225 */
  9262. /***/ (function(module, exports) {
  9263. Object.defineProperty(exports, "__esModule", { value: true });
  9264. var Iterator = /** @class */ (function () {
  9265. function Iterator(items) {
  9266. this.items = items || [];
  9267. }
  9268. /* Calls a method on every item passing the arguments through */
  9269. Iterator.prototype.proxyCall = function (methodName) {
  9270. var args = [];
  9271. for (var _i = 1; _i < arguments.length; _i++) {
  9272. args[_i - 1] = arguments[_i];
  9273. }
  9274. var results = [];
  9275. this.items.forEach(function (item) {
  9276. results.push(item[methodName].apply(item, args));
  9277. });
  9278. return results;
  9279. };
  9280. return Iterator;
  9281. }());
  9282. exports.default = Iterator;
  9283. /***/ }),
  9284. /* 226 */
  9285. /***/ (function(module, exports, __webpack_require__) {
  9286. Object.defineProperty(exports, "__esModule", { value: true });
  9287. var $ = __webpack_require__(3);
  9288. var util_1 = __webpack_require__(4);
  9289. var ListenerMixin_1 = __webpack_require__(7);
  9290. /* Creates a clone of an element and lets it track the mouse as it moves
  9291. ----------------------------------------------------------------------------------------------------------------------*/
  9292. var MouseFollower = /** @class */ (function () {
  9293. function MouseFollower(sourceEl, options) {
  9294. this.isFollowing = false;
  9295. this.isHidden = false;
  9296. this.isAnimating = false; // doing the revert animation?
  9297. this.options = options = options || {};
  9298. this.sourceEl = sourceEl;
  9299. this.parentEl = options.parentEl ? $(options.parentEl) : sourceEl.parent(); // default to sourceEl's parent
  9300. }
  9301. // Causes the element to start following the mouse
  9302. MouseFollower.prototype.start = function (ev) {
  9303. if (!this.isFollowing) {
  9304. this.isFollowing = true;
  9305. this.y0 = util_1.getEvY(ev);
  9306. this.x0 = util_1.getEvX(ev);
  9307. this.topDelta = 0;
  9308. this.leftDelta = 0;
  9309. if (!this.isHidden) {
  9310. this.updatePosition();
  9311. }
  9312. if (util_1.getEvIsTouch(ev)) {
  9313. this.listenTo($(document), 'touchmove', this.handleMove);
  9314. }
  9315. else {
  9316. this.listenTo($(document), 'mousemove', this.handleMove);
  9317. }
  9318. }
  9319. };
  9320. // Causes the element to stop following the mouse. If shouldRevert is true, will animate back to original position.
  9321. // `callback` gets invoked when the animation is complete. If no animation, it is invoked immediately.
  9322. MouseFollower.prototype.stop = function (shouldRevert, callback) {
  9323. var _this = this;
  9324. var revertDuration = this.options.revertDuration;
  9325. var complete = function () {
  9326. _this.isAnimating = false;
  9327. _this.removeElement();
  9328. _this.top0 = _this.left0 = null; // reset state for future updatePosition calls
  9329. if (callback) {
  9330. callback();
  9331. }
  9332. };
  9333. if (this.isFollowing && !this.isAnimating) { // disallow more than one stop animation at a time
  9334. this.isFollowing = false;
  9335. this.stopListeningTo($(document));
  9336. if (shouldRevert && revertDuration && !this.isHidden) { // do a revert animation?
  9337. this.isAnimating = true;
  9338. this.el.animate({
  9339. top: this.top0,
  9340. left: this.left0
  9341. }, {
  9342. duration: revertDuration,
  9343. complete: complete
  9344. });
  9345. }
  9346. else {
  9347. complete();
  9348. }
  9349. }
  9350. };
  9351. // Gets the tracking element. Create it if necessary
  9352. MouseFollower.prototype.getEl = function () {
  9353. var el = this.el;
  9354. if (!el) {
  9355. el = this.el = this.sourceEl.clone()
  9356. .addClass(this.options.additionalClass || '')
  9357. .css({
  9358. position: 'absolute',
  9359. visibility: '',
  9360. display: this.isHidden ? 'none' : '',
  9361. margin: 0,
  9362. right: 'auto',
  9363. bottom: 'auto',
  9364. width: this.sourceEl.width(),
  9365. height: this.sourceEl.height(),
  9366. opacity: this.options.opacity || '',
  9367. zIndex: this.options.zIndex
  9368. });
  9369. // we don't want long taps or any mouse interaction causing selection/menus.
  9370. // would use preventSelection(), but that prevents selectstart, causing problems.
  9371. el.addClass('fc-unselectable');
  9372. el.appendTo(this.parentEl);
  9373. }
  9374. return el;
  9375. };
  9376. // Removes the tracking element if it has already been created
  9377. MouseFollower.prototype.removeElement = function () {
  9378. if (this.el) {
  9379. this.el.remove();
  9380. this.el = null;
  9381. }
  9382. };
  9383. // Update the CSS position of the tracking element
  9384. MouseFollower.prototype.updatePosition = function () {
  9385. var sourceOffset;
  9386. var origin;
  9387. this.getEl(); // ensure this.el
  9388. // make sure origin info was computed
  9389. if (this.top0 == null) {
  9390. sourceOffset = this.sourceEl.offset();
  9391. origin = this.el.offsetParent().offset();
  9392. this.top0 = sourceOffset.top - origin.top;
  9393. this.left0 = sourceOffset.left - origin.left;
  9394. }
  9395. this.el.css({
  9396. top: this.top0 + this.topDelta,
  9397. left: this.left0 + this.leftDelta
  9398. });
  9399. };
  9400. // Gets called when the user moves the mouse
  9401. MouseFollower.prototype.handleMove = function (ev) {
  9402. this.topDelta = util_1.getEvY(ev) - this.y0;
  9403. this.leftDelta = util_1.getEvX(ev) - this.x0;
  9404. if (!this.isHidden) {
  9405. this.updatePosition();
  9406. }
  9407. };
  9408. // Temporarily makes the tracking element invisible. Can be called before following starts
  9409. MouseFollower.prototype.hide = function () {
  9410. if (!this.isHidden) {
  9411. this.isHidden = true;
  9412. if (this.el) {
  9413. this.el.hide();
  9414. }
  9415. }
  9416. };
  9417. // Show the tracking element after it has been temporarily hidden
  9418. MouseFollower.prototype.show = function () {
  9419. if (this.isHidden) {
  9420. this.isHidden = false;
  9421. this.updatePosition();
  9422. this.getEl().show();
  9423. }
  9424. };
  9425. return MouseFollower;
  9426. }());
  9427. exports.default = MouseFollower;
  9428. ListenerMixin_1.default.mixInto(MouseFollower);
  9429. /***/ }),
  9430. /* 227 */
  9431. /***/ (function(module, exports, __webpack_require__) {
  9432. /* A rectangular panel that is absolutely positioned over other content
  9433. ------------------------------------------------------------------------------------------------------------------------
  9434. Options:
  9435. - className (string)
  9436. - content (HTML string or jQuery element set)
  9437. - parentEl
  9438. - top
  9439. - left
  9440. - right (the x coord of where the right edge should be. not a "CSS" right)
  9441. - autoHide (boolean)
  9442. - show (callback)
  9443. - hide (callback)
  9444. */
  9445. Object.defineProperty(exports, "__esModule", { value: true });
  9446. var $ = __webpack_require__(3);
  9447. var util_1 = __webpack_require__(4);
  9448. var ListenerMixin_1 = __webpack_require__(7);
  9449. var Popover = /** @class */ (function () {
  9450. function Popover(options) {
  9451. this.isHidden = true;
  9452. this.margin = 10; // the space required between the popover and the edges of the scroll container
  9453. this.options = options || {};
  9454. }
  9455. // Shows the popover on the specified position. Renders it if not already
  9456. Popover.prototype.show = function () {
  9457. if (this.isHidden) {
  9458. if (!this.el) {
  9459. this.render();
  9460. }
  9461. this.el.show();
  9462. this.position();
  9463. this.isHidden = false;
  9464. this.trigger('show');
  9465. }
  9466. };
  9467. // Hides the popover, through CSS, but does not remove it from the DOM
  9468. Popover.prototype.hide = function () {
  9469. if (!this.isHidden) {
  9470. this.el.hide();
  9471. this.isHidden = true;
  9472. this.trigger('hide');
  9473. }
  9474. };
  9475. // Creates `this.el` and renders content inside of it
  9476. Popover.prototype.render = function () {
  9477. var _this = this;
  9478. var options = this.options;
  9479. this.el = $('<div class="fc-popover">')
  9480. .addClass(options.className || '')
  9481. .css({
  9482. // position initially to the top left to avoid creating scrollbars
  9483. top: 0,
  9484. left: 0
  9485. })
  9486. .append(options.content)
  9487. .appendTo(options.parentEl);
  9488. // when a click happens on anything inside with a 'fc-close' className, hide the popover
  9489. this.el.on('click', '.fc-close', function () {
  9490. _this.hide();
  9491. });
  9492. if (options.autoHide) {
  9493. this.listenTo($(document), 'mousedown', this.documentMousedown);
  9494. }
  9495. };
  9496. // Triggered when the user clicks *anywhere* in the document, for the autoHide feature
  9497. Popover.prototype.documentMousedown = function (ev) {
  9498. // only hide the popover if the click happened outside the popover
  9499. if (this.el && !$(ev.target).closest(this.el).length) {
  9500. this.hide();
  9501. }
  9502. };
  9503. // Hides and unregisters any handlers
  9504. Popover.prototype.removeElement = function () {
  9505. this.hide();
  9506. if (this.el) {
  9507. this.el.remove();
  9508. this.el = null;
  9509. }
  9510. this.stopListeningTo($(document), 'mousedown');
  9511. };
  9512. // Positions the popover optimally, using the top/left/right options
  9513. Popover.prototype.position = function () {
  9514. var options = this.options;
  9515. var origin = this.el.offsetParent().offset();
  9516. var width = this.el.outerWidth();
  9517. var height = this.el.outerHeight();
  9518. var windowEl = $(window);
  9519. var viewportEl = util_1.getScrollParent(this.el);
  9520. var viewportTop;
  9521. var viewportLeft;
  9522. var viewportOffset;
  9523. var top; // the "position" (not "offset") values for the popover
  9524. var left; //
  9525. // compute top and left
  9526. top = options.top || 0;
  9527. if (options.left !== undefined) {
  9528. left = options.left;
  9529. }
  9530. else if (options.right !== undefined) {
  9531. left = options.right - width; // derive the left value from the right value
  9532. }
  9533. else {
  9534. left = 0;
  9535. }
  9536. if (viewportEl.is(window) || viewportEl.is(document)) { // normalize getScrollParent's result
  9537. viewportEl = windowEl;
  9538. viewportTop = 0; // the window is always at the top left
  9539. viewportLeft = 0; // (and .offset() won't work if called here)
  9540. }
  9541. else {
  9542. viewportOffset = viewportEl.offset();
  9543. viewportTop = viewportOffset.top;
  9544. viewportLeft = viewportOffset.left;
  9545. }
  9546. // if the window is scrolled, it causes the visible area to be further down
  9547. viewportTop += windowEl.scrollTop();
  9548. viewportLeft += windowEl.scrollLeft();
  9549. // constrain to the view port. if constrained by two edges, give precedence to top/left
  9550. if (options.viewportConstrain !== false) {
  9551. top = Math.min(top, viewportTop + viewportEl.outerHeight() - height - this.margin);
  9552. top = Math.max(top, viewportTop + this.margin);
  9553. left = Math.min(left, viewportLeft + viewportEl.outerWidth() - width - this.margin);
  9554. left = Math.max(left, viewportLeft + this.margin);
  9555. }
  9556. this.el.css({
  9557. top: top - origin.top,
  9558. left: left - origin.left
  9559. });
  9560. };
  9561. // Triggers a callback. Calls a function in the option hash of the same name.
  9562. // Arguments beyond the first `name` are forwarded on.
  9563. // TODO: better code reuse for this. Repeat code
  9564. Popover.prototype.trigger = function (name) {
  9565. if (this.options[name]) {
  9566. this.options[name].apply(this, Array.prototype.slice.call(arguments, 1));
  9567. }
  9568. };
  9569. return Popover;
  9570. }());
  9571. exports.default = Popover;
  9572. ListenerMixin_1.default.mixInto(Popover);
  9573. /***/ }),
  9574. /* 228 */
  9575. /***/ (function(module, exports, __webpack_require__) {
  9576. Object.defineProperty(exports, "__esModule", { value: true });
  9577. var EmitterMixin_1 = __webpack_require__(13);
  9578. var TaskQueue = /** @class */ (function () {
  9579. function TaskQueue() {
  9580. this.q = [];
  9581. this.isPaused = false;
  9582. this.isRunning = false;
  9583. }
  9584. TaskQueue.prototype.queue = function () {
  9585. var args = [];
  9586. for (var _i = 0; _i < arguments.length; _i++) {
  9587. args[_i] = arguments[_i];
  9588. }
  9589. this.q.push.apply(this.q, args); // append
  9590. this.tryStart();
  9591. };
  9592. TaskQueue.prototype.pause = function () {
  9593. this.isPaused = true;
  9594. };
  9595. TaskQueue.prototype.resume = function () {
  9596. this.isPaused = false;
  9597. this.tryStart();
  9598. };
  9599. TaskQueue.prototype.getIsIdle = function () {
  9600. return !this.isRunning && !this.isPaused;
  9601. };
  9602. TaskQueue.prototype.tryStart = function () {
  9603. if (!this.isRunning && this.canRunNext()) {
  9604. this.isRunning = true;
  9605. this.trigger('start');
  9606. this.runRemaining();
  9607. }
  9608. };
  9609. TaskQueue.prototype.canRunNext = function () {
  9610. return !this.isPaused && this.q.length;
  9611. };
  9612. TaskQueue.prototype.runRemaining = function () {
  9613. var _this = this;
  9614. var task;
  9615. var res;
  9616. do {
  9617. task = this.q.shift(); // always freshly reference q. might have been reassigned.
  9618. res = this.runTask(task);
  9619. if (res && res.then) {
  9620. res.then(function () {
  9621. if (_this.canRunNext()) {
  9622. _this.runRemaining();
  9623. }
  9624. });
  9625. return; // prevent marking as stopped
  9626. }
  9627. } while (this.canRunNext());
  9628. this.trigger('stop'); // not really a 'stop' ... more of a 'drained'
  9629. this.isRunning = false;
  9630. // if 'stop' handler added more tasks.... TODO: write test for this
  9631. this.tryStart();
  9632. };
  9633. TaskQueue.prototype.runTask = function (task) {
  9634. return task(); // task *is* the function, but subclasses can change the format of a task
  9635. };
  9636. return TaskQueue;
  9637. }());
  9638. exports.default = TaskQueue;
  9639. EmitterMixin_1.default.mixInto(TaskQueue);
  9640. /***/ }),
  9641. /* 229 */
  9642. /***/ (function(module, exports, __webpack_require__) {
  9643. Object.defineProperty(exports, "__esModule", { value: true });
  9644. var tslib_1 = __webpack_require__(2);
  9645. var TaskQueue_1 = __webpack_require__(228);
  9646. var RenderQueue = /** @class */ (function (_super) {
  9647. tslib_1.__extends(RenderQueue, _super);
  9648. function RenderQueue(waitsByNamespace) {
  9649. var _this = _super.call(this) || this;
  9650. _this.waitsByNamespace = waitsByNamespace || {};
  9651. return _this;
  9652. }
  9653. RenderQueue.prototype.queue = function (taskFunc, namespace, type) {
  9654. var task = {
  9655. func: taskFunc,
  9656. namespace: namespace,
  9657. type: type
  9658. };
  9659. var waitMs;
  9660. if (namespace) {
  9661. waitMs = this.waitsByNamespace[namespace];
  9662. }
  9663. if (this.waitNamespace) {
  9664. if (namespace === this.waitNamespace && waitMs != null) {
  9665. this.delayWait(waitMs);
  9666. }
  9667. else {
  9668. this.clearWait();
  9669. this.tryStart();
  9670. }
  9671. }
  9672. if (this.compoundTask(task)) { // appended to queue?
  9673. if (!this.waitNamespace && waitMs != null) {
  9674. this.startWait(namespace, waitMs);
  9675. }
  9676. else {
  9677. this.tryStart();
  9678. }
  9679. }
  9680. };
  9681. RenderQueue.prototype.startWait = function (namespace, waitMs) {
  9682. this.waitNamespace = namespace;
  9683. this.spawnWait(waitMs);
  9684. };
  9685. RenderQueue.prototype.delayWait = function (waitMs) {
  9686. clearTimeout(this.waitId);
  9687. this.spawnWait(waitMs);
  9688. };
  9689. RenderQueue.prototype.spawnWait = function (waitMs) {
  9690. var _this = this;
  9691. this.waitId = setTimeout(function () {
  9692. _this.waitNamespace = null;
  9693. _this.tryStart();
  9694. }, waitMs);
  9695. };
  9696. RenderQueue.prototype.clearWait = function () {
  9697. if (this.waitNamespace) {
  9698. clearTimeout(this.waitId);
  9699. this.waitId = null;
  9700. this.waitNamespace = null;
  9701. }
  9702. };
  9703. RenderQueue.prototype.canRunNext = function () {
  9704. if (!_super.prototype.canRunNext.call(this)) {
  9705. return false;
  9706. }
  9707. // waiting for a certain namespace to stop receiving tasks?
  9708. if (this.waitNamespace) {
  9709. var q = this.q;
  9710. // if there was a different namespace task in the meantime,
  9711. // that forces all previously-waiting tasks to suddenly execute.
  9712. // TODO: find a way to do this in constant time.
  9713. for (var i = 0; i < q.length; i++) {
  9714. if (q[i].namespace !== this.waitNamespace) {
  9715. return true; // allow execution
  9716. }
  9717. }
  9718. return false;
  9719. }
  9720. return true;
  9721. };
  9722. RenderQueue.prototype.runTask = function (task) {
  9723. task.func();
  9724. };
  9725. RenderQueue.prototype.compoundTask = function (newTask) {
  9726. var q = this.q;
  9727. var shouldAppend = true;
  9728. var i;
  9729. var task;
  9730. if (newTask.namespace && newTask.type === 'destroy') {
  9731. // remove all init/add/remove ops with same namespace, regardless of order
  9732. for (i = q.length - 1; i >= 0; i--) {
  9733. task = q[i];
  9734. if (task.namespace === newTask.namespace) {
  9735. switch (task.type) {
  9736. case 'init':
  9737. shouldAppend = false;
  9738. // the latest destroy is cancelled out by not doing the init
  9739. /* falls through */
  9740. case 'add':
  9741. /* falls through */
  9742. case 'remove':
  9743. q.splice(i, 1); // remove task
  9744. }
  9745. }
  9746. }
  9747. }
  9748. if (shouldAppend) {
  9749. q.push(newTask);
  9750. }
  9751. return shouldAppend;
  9752. };
  9753. return RenderQueue;
  9754. }(TaskQueue_1.default));
  9755. exports.default = RenderQueue;
  9756. /***/ }),
  9757. /* 230 */
  9758. /***/ (function(module, exports, __webpack_require__) {
  9759. Object.defineProperty(exports, "__esModule", { value: true });
  9760. var tslib_1 = __webpack_require__(2);
  9761. var Model_1 = __webpack_require__(51);
  9762. var Component = /** @class */ (function (_super) {
  9763. tslib_1.__extends(Component, _super);
  9764. function Component() {
  9765. return _super !== null && _super.apply(this, arguments) || this;
  9766. }
  9767. Component.prototype.setElement = function (el) {
  9768. this.el = el;
  9769. this.bindGlobalHandlers();
  9770. this.renderSkeleton();
  9771. this.set('isInDom', true);
  9772. };
  9773. Component.prototype.removeElement = function () {
  9774. this.unset('isInDom');
  9775. this.unrenderSkeleton();
  9776. this.unbindGlobalHandlers();
  9777. this.el.remove();
  9778. // NOTE: don't null-out this.el in case the View was destroyed within an API callback.
  9779. // We don't null-out the View's other jQuery element references upon destroy,
  9780. // so we shouldn't kill this.el either.
  9781. };
  9782. Component.prototype.bindGlobalHandlers = function () {
  9783. // subclasses can override
  9784. };
  9785. Component.prototype.unbindGlobalHandlers = function () {
  9786. // subclasses can override
  9787. };
  9788. /*
  9789. NOTE: Can't have a `render` method. Read the deprecation notice in View::executeDateRender
  9790. */
  9791. // Renders the basic structure of the view before any content is rendered
  9792. Component.prototype.renderSkeleton = function () {
  9793. // subclasses should implement
  9794. };
  9795. // Unrenders the basic structure of the view
  9796. Component.prototype.unrenderSkeleton = function () {
  9797. // subclasses should implement
  9798. };
  9799. return Component;
  9800. }(Model_1.default));
  9801. exports.default = Component;
  9802. /***/ }),
  9803. /* 231 */
  9804. /***/ (function(module, exports, __webpack_require__) {
  9805. Object.defineProperty(exports, "__esModule", { value: true });
  9806. var tslib_1 = __webpack_require__(2);
  9807. var $ = __webpack_require__(3);
  9808. var moment = __webpack_require__(0);
  9809. var util_1 = __webpack_require__(4);
  9810. var moment_ext_1 = __webpack_require__(11);
  9811. var date_formatting_1 = __webpack_require__(49);
  9812. var Component_1 = __webpack_require__(230);
  9813. var util_2 = __webpack_require__(19);
  9814. var DateComponent = /** @class */ (function (_super) {
  9815. tslib_1.__extends(DateComponent, _super);
  9816. function DateComponent(_view, _options) {
  9817. var _this = _super.call(this) || this;
  9818. _this.isRTL = false; // frequently accessed options
  9819. _this.hitsNeededDepth = 0; // necessary because multiple callers might need the same hits
  9820. _this.hasAllDayBusinessHours = false; // TODO: unify with largeUnit and isTimeScale?
  9821. _this.isDatesRendered = false;
  9822. // hack to set options prior to the this.opt calls
  9823. if (_view) {
  9824. _this['view'] = _view;
  9825. }
  9826. if (_options) {
  9827. _this['options'] = _options;
  9828. }
  9829. _this.uid = String(DateComponent.guid++);
  9830. _this.childrenByUid = {};
  9831. _this.nextDayThreshold = moment.duration(_this.opt('nextDayThreshold'));
  9832. _this.isRTL = _this.opt('isRTL');
  9833. if (_this.fillRendererClass) {
  9834. _this.fillRenderer = new _this.fillRendererClass(_this);
  9835. }
  9836. if (_this.eventRendererClass) { // fillRenderer is optional -----v
  9837. _this.eventRenderer = new _this.eventRendererClass(_this, _this.fillRenderer);
  9838. }
  9839. if (_this.helperRendererClass && _this.eventRenderer) {
  9840. _this.helperRenderer = new _this.helperRendererClass(_this, _this.eventRenderer);
  9841. }
  9842. if (_this.businessHourRendererClass && _this.fillRenderer) {
  9843. _this.businessHourRenderer = new _this.businessHourRendererClass(_this, _this.fillRenderer);
  9844. }
  9845. return _this;
  9846. }
  9847. DateComponent.prototype.addChild = function (child) {
  9848. if (!this.childrenByUid[child.uid]) {
  9849. this.childrenByUid[child.uid] = child;
  9850. return true;
  9851. }
  9852. return false;
  9853. };
  9854. DateComponent.prototype.removeChild = function (child) {
  9855. if (this.childrenByUid[child.uid]) {
  9856. delete this.childrenByUid[child.uid];
  9857. return true;
  9858. }
  9859. return false;
  9860. };
  9861. // TODO: only do if isInDom?
  9862. // TODO: make part of Component, along with children/batch-render system?
  9863. DateComponent.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  9864. this.callChildren('updateSize', arguments);
  9865. };
  9866. // Options
  9867. // -----------------------------------------------------------------------------------------------------------------
  9868. DateComponent.prototype.opt = function (name) {
  9869. return this._getView().opt(name); // default implementation
  9870. };
  9871. DateComponent.prototype.publiclyTrigger = function () {
  9872. var args = [];
  9873. for (var _i = 0; _i < arguments.length; _i++) {
  9874. args[_i] = arguments[_i];
  9875. }
  9876. var calendar = this._getCalendar();
  9877. return calendar.publiclyTrigger.apply(calendar, args);
  9878. };
  9879. DateComponent.prototype.hasPublicHandlers = function () {
  9880. var args = [];
  9881. for (var _i = 0; _i < arguments.length; _i++) {
  9882. args[_i] = arguments[_i];
  9883. }
  9884. var calendar = this._getCalendar();
  9885. return calendar.hasPublicHandlers.apply(calendar, args);
  9886. };
  9887. // Date
  9888. // -----------------------------------------------------------------------------------------------------------------
  9889. DateComponent.prototype.executeDateRender = function (dateProfile) {
  9890. this.dateProfile = dateProfile; // for rendering
  9891. this.renderDates(dateProfile);
  9892. this.isDatesRendered = true;
  9893. this.callChildren('executeDateRender', arguments);
  9894. };
  9895. DateComponent.prototype.executeDateUnrender = function () {
  9896. this.callChildren('executeDateUnrender', arguments);
  9897. this.dateProfile = null;
  9898. this.unrenderDates();
  9899. this.isDatesRendered = false;
  9900. };
  9901. // date-cell content only
  9902. DateComponent.prototype.renderDates = function (dateProfile) {
  9903. // subclasses should implement
  9904. };
  9905. // date-cell content only
  9906. DateComponent.prototype.unrenderDates = function () {
  9907. // subclasses should override
  9908. };
  9909. // Now-Indicator
  9910. // -----------------------------------------------------------------------------------------------------------------
  9911. // Returns a string unit, like 'second' or 'minute' that defined how often the current time indicator
  9912. // should be refreshed. If something falsy is returned, no time indicator is rendered at all.
  9913. DateComponent.prototype.getNowIndicatorUnit = function () {
  9914. // subclasses should implement
  9915. };
  9916. // Renders a current time indicator at the given datetime
  9917. DateComponent.prototype.renderNowIndicator = function (date) {
  9918. this.callChildren('renderNowIndicator', arguments);
  9919. };
  9920. // Undoes the rendering actions from renderNowIndicator
  9921. DateComponent.prototype.unrenderNowIndicator = function () {
  9922. this.callChildren('unrenderNowIndicator', arguments);
  9923. };
  9924. // Business Hours
  9925. // ---------------------------------------------------------------------------------------------------------------
  9926. DateComponent.prototype.renderBusinessHours = function (businessHourGenerator) {
  9927. if (this.businessHourRenderer) {
  9928. this.businessHourRenderer.render(businessHourGenerator);
  9929. }
  9930. this.callChildren('renderBusinessHours', arguments);
  9931. };
  9932. // Unrenders previously-rendered business-hours
  9933. DateComponent.prototype.unrenderBusinessHours = function () {
  9934. this.callChildren('unrenderBusinessHours', arguments);
  9935. if (this.businessHourRenderer) {
  9936. this.businessHourRenderer.unrender();
  9937. }
  9938. };
  9939. // Event Displaying
  9940. // -----------------------------------------------------------------------------------------------------------------
  9941. DateComponent.prototype.executeEventRender = function (eventsPayload) {
  9942. if (this.eventRenderer) {
  9943. this.eventRenderer.rangeUpdated(); // poorly named now
  9944. this.eventRenderer.render(eventsPayload);
  9945. }
  9946. else if (this['renderEvents']) { // legacy
  9947. this['renderEvents'](convertEventsPayloadToLegacyArray(eventsPayload));
  9948. }
  9949. this.callChildren('executeEventRender', arguments);
  9950. };
  9951. DateComponent.prototype.executeEventUnrender = function () {
  9952. this.callChildren('executeEventUnrender', arguments);
  9953. if (this.eventRenderer) {
  9954. this.eventRenderer.unrender();
  9955. }
  9956. else if (this['destroyEvents']) { // legacy
  9957. this['destroyEvents']();
  9958. }
  9959. };
  9960. DateComponent.prototype.getBusinessHourSegs = function () {
  9961. var segs = this.getOwnBusinessHourSegs();
  9962. this.iterChildren(function (child) {
  9963. segs.push.apply(segs, child.getBusinessHourSegs());
  9964. });
  9965. return segs;
  9966. };
  9967. DateComponent.prototype.getOwnBusinessHourSegs = function () {
  9968. if (this.businessHourRenderer) {
  9969. return this.businessHourRenderer.getSegs();
  9970. }
  9971. return [];
  9972. };
  9973. DateComponent.prototype.getEventSegs = function () {
  9974. var segs = this.getOwnEventSegs();
  9975. this.iterChildren(function (child) {
  9976. segs.push.apply(segs, child.getEventSegs());
  9977. });
  9978. return segs;
  9979. };
  9980. DateComponent.prototype.getOwnEventSegs = function () {
  9981. if (this.eventRenderer) {
  9982. return this.eventRenderer.getSegs();
  9983. }
  9984. return [];
  9985. };
  9986. // Event Rendering Triggering
  9987. // -----------------------------------------------------------------------------------------------------------------
  9988. DateComponent.prototype.triggerAfterEventsRendered = function () {
  9989. this.triggerAfterEventSegsRendered(this.getEventSegs());
  9990. this.publiclyTrigger('eventAfterAllRender', {
  9991. context: this,
  9992. args: [this]
  9993. });
  9994. };
  9995. DateComponent.prototype.triggerAfterEventSegsRendered = function (segs) {
  9996. var _this = this;
  9997. // an optimization, because getEventLegacy is expensive
  9998. if (this.hasPublicHandlers('eventAfterRender')) {
  9999. segs.forEach(function (seg) {
  10000. var legacy;
  10001. if (seg.el) { // necessary?
  10002. legacy = seg.footprint.getEventLegacy();
  10003. _this.publiclyTrigger('eventAfterRender', {
  10004. context: legacy,
  10005. args: [legacy, seg.el, _this]
  10006. });
  10007. }
  10008. });
  10009. }
  10010. };
  10011. DateComponent.prototype.triggerBeforeEventsDestroyed = function () {
  10012. this.triggerBeforeEventSegsDestroyed(this.getEventSegs());
  10013. };
  10014. DateComponent.prototype.triggerBeforeEventSegsDestroyed = function (segs) {
  10015. var _this = this;
  10016. if (this.hasPublicHandlers('eventDestroy')) {
  10017. segs.forEach(function (seg) {
  10018. var legacy;
  10019. if (seg.el) { // necessary?
  10020. legacy = seg.footprint.getEventLegacy();
  10021. _this.publiclyTrigger('eventDestroy', {
  10022. context: legacy,
  10023. args: [legacy, seg.el, _this]
  10024. });
  10025. }
  10026. });
  10027. }
  10028. };
  10029. // Event Rendering Utils
  10030. // -----------------------------------------------------------------------------------------------------------------
  10031. // Hides all rendered event segments linked to the given event
  10032. // RECURSIVE with subcomponents
  10033. DateComponent.prototype.showEventsWithId = function (eventDefId) {
  10034. this.getEventSegs().forEach(function (seg) {
  10035. if (seg.footprint.eventDef.id === eventDefId &&
  10036. seg.el // necessary?
  10037. ) {
  10038. seg.el.css('visibility', '');
  10039. }
  10040. });
  10041. this.callChildren('showEventsWithId', arguments);
  10042. };
  10043. // Shows all rendered event segments linked to the given event
  10044. // RECURSIVE with subcomponents
  10045. DateComponent.prototype.hideEventsWithId = function (eventDefId) {
  10046. this.getEventSegs().forEach(function (seg) {
  10047. if (seg.footprint.eventDef.id === eventDefId &&
  10048. seg.el // necessary?
  10049. ) {
  10050. seg.el.css('visibility', 'hidden');
  10051. }
  10052. });
  10053. this.callChildren('hideEventsWithId', arguments);
  10054. };
  10055. // Drag-n-Drop Rendering (for both events and external elements)
  10056. // ---------------------------------------------------------------------------------------------------------------
  10057. // Renders a visual indication of a event or external-element drag over the given drop zone.
  10058. // If an external-element, seg will be `null`.
  10059. // Must return elements used for any mock events.
  10060. DateComponent.prototype.renderDrag = function (eventFootprints, seg, isTouch) {
  10061. var renderedHelper = false;
  10062. this.iterChildren(function (child) {
  10063. if (child.renderDrag(eventFootprints, seg, isTouch)) {
  10064. renderedHelper = true;
  10065. }
  10066. });
  10067. return renderedHelper;
  10068. };
  10069. // Unrenders a visual indication of an event or external-element being dragged.
  10070. DateComponent.prototype.unrenderDrag = function () {
  10071. this.callChildren('unrenderDrag', arguments);
  10072. };
  10073. // Event Resizing
  10074. // ---------------------------------------------------------------------------------------------------------------
  10075. // Renders a visual indication of an event being resized.
  10076. DateComponent.prototype.renderEventResize = function (eventFootprints, seg, isTouch) {
  10077. this.callChildren('renderEventResize', arguments);
  10078. };
  10079. // Unrenders a visual indication of an event being resized.
  10080. DateComponent.prototype.unrenderEventResize = function () {
  10081. this.callChildren('unrenderEventResize', arguments);
  10082. };
  10083. // Selection
  10084. // ---------------------------------------------------------------------------------------------------------------
  10085. // Renders a visual indication of the selection
  10086. // TODO: rename to `renderSelection` after legacy is gone
  10087. DateComponent.prototype.renderSelectionFootprint = function (componentFootprint) {
  10088. this.renderHighlight(componentFootprint);
  10089. this.callChildren('renderSelectionFootprint', arguments);
  10090. };
  10091. // Unrenders a visual indication of selection
  10092. DateComponent.prototype.unrenderSelection = function () {
  10093. this.unrenderHighlight();
  10094. this.callChildren('unrenderSelection', arguments);
  10095. };
  10096. // Highlight
  10097. // ---------------------------------------------------------------------------------------------------------------
  10098. // Renders an emphasis on the given date range. Given a span (unzoned start/end and other misc data)
  10099. DateComponent.prototype.renderHighlight = function (componentFootprint) {
  10100. if (this.fillRenderer) {
  10101. this.fillRenderer.renderFootprint('highlight', componentFootprint, {
  10102. getClasses: function () {
  10103. return ['fc-highlight'];
  10104. }
  10105. });
  10106. }
  10107. this.callChildren('renderHighlight', arguments);
  10108. };
  10109. // Unrenders the emphasis on a date range
  10110. DateComponent.prototype.unrenderHighlight = function () {
  10111. if (this.fillRenderer) {
  10112. this.fillRenderer.unrender('highlight');
  10113. }
  10114. this.callChildren('unrenderHighlight', arguments);
  10115. };
  10116. // Hit Areas
  10117. // ---------------------------------------------------------------------------------------------------------------
  10118. // just because all DateComponents support this interface
  10119. // doesn't mean they need to have their own internal coord system. they can defer to sub-components.
  10120. DateComponent.prototype.hitsNeeded = function () {
  10121. if (!(this.hitsNeededDepth++)) {
  10122. this.prepareHits();
  10123. }
  10124. this.callChildren('hitsNeeded', arguments);
  10125. };
  10126. DateComponent.prototype.hitsNotNeeded = function () {
  10127. if (this.hitsNeededDepth && !(--this.hitsNeededDepth)) {
  10128. this.releaseHits();
  10129. }
  10130. this.callChildren('hitsNotNeeded', arguments);
  10131. };
  10132. DateComponent.prototype.prepareHits = function () {
  10133. // subclasses can implement
  10134. };
  10135. DateComponent.prototype.releaseHits = function () {
  10136. // subclasses can implement
  10137. };
  10138. // Given coordinates from the topleft of the document, return data about the date-related area underneath.
  10139. // Can return an object with arbitrary properties (although top/right/left/bottom are encouraged).
  10140. // Must have a `grid` property, a reference to this current grid. TODO: avoid this
  10141. // The returned object will be processed by getHitFootprint and getHitEl.
  10142. DateComponent.prototype.queryHit = function (leftOffset, topOffset) {
  10143. var childrenByUid = this.childrenByUid;
  10144. var uid;
  10145. var hit;
  10146. for (uid in childrenByUid) {
  10147. hit = childrenByUid[uid].queryHit(leftOffset, topOffset);
  10148. if (hit) {
  10149. break;
  10150. }
  10151. }
  10152. return hit;
  10153. };
  10154. DateComponent.prototype.getSafeHitFootprint = function (hit) {
  10155. var footprint = this.getHitFootprint(hit);
  10156. if (!this.dateProfile.activeUnzonedRange.containsRange(footprint.unzonedRange)) {
  10157. return null;
  10158. }
  10159. return footprint;
  10160. };
  10161. DateComponent.prototype.getHitFootprint = function (hit) {
  10162. // what about being abstract!?
  10163. };
  10164. // Given position-level information about a date-related area within the grid,
  10165. // should return a jQuery element that best represents it. passed to dayClick callback.
  10166. DateComponent.prototype.getHitEl = function (hit) {
  10167. // what about being abstract!?
  10168. };
  10169. /* Converting eventRange -> eventFootprint
  10170. ------------------------------------------------------------------------------------------------------------------*/
  10171. DateComponent.prototype.eventRangesToEventFootprints = function (eventRanges) {
  10172. var eventFootprints = [];
  10173. var i;
  10174. for (i = 0; i < eventRanges.length; i++) {
  10175. eventFootprints.push.apply(// append
  10176. eventFootprints, this.eventRangeToEventFootprints(eventRanges[i]));
  10177. }
  10178. return eventFootprints;
  10179. };
  10180. DateComponent.prototype.eventRangeToEventFootprints = function (eventRange) {
  10181. return [util_2.eventRangeToEventFootprint(eventRange)];
  10182. };
  10183. /* Converting componentFootprint/eventFootprint -> segs
  10184. ------------------------------------------------------------------------------------------------------------------*/
  10185. DateComponent.prototype.eventFootprintsToSegs = function (eventFootprints) {
  10186. var segs = [];
  10187. var i;
  10188. for (i = 0; i < eventFootprints.length; i++) {
  10189. segs.push.apply(segs, this.eventFootprintToSegs(eventFootprints[i]));
  10190. }
  10191. return segs;
  10192. };
  10193. // Given an event's span (unzoned start/end and other misc data), and the event itself,
  10194. // slices into segments and attaches event-derived properties to them.
  10195. // eventSpan - { start, end, isStart, isEnd, otherthings... }
  10196. DateComponent.prototype.eventFootprintToSegs = function (eventFootprint) {
  10197. var unzonedRange = eventFootprint.componentFootprint.unzonedRange;
  10198. var segs;
  10199. var i;
  10200. var seg;
  10201. segs = this.componentFootprintToSegs(eventFootprint.componentFootprint);
  10202. for (i = 0; i < segs.length; i++) {
  10203. seg = segs[i];
  10204. if (!unzonedRange.isStart) {
  10205. seg.isStart = false;
  10206. }
  10207. if (!unzonedRange.isEnd) {
  10208. seg.isEnd = false;
  10209. }
  10210. seg.footprint = eventFootprint;
  10211. // TODO: rename to seg.eventFootprint
  10212. }
  10213. return segs;
  10214. };
  10215. DateComponent.prototype.componentFootprintToSegs = function (componentFootprint) {
  10216. return [];
  10217. };
  10218. // Utils
  10219. // ---------------------------------------------------------------------------------------------------------------
  10220. DateComponent.prototype.callChildren = function (methodName, args) {
  10221. this.iterChildren(function (child) {
  10222. child[methodName].apply(child, args);
  10223. });
  10224. };
  10225. DateComponent.prototype.iterChildren = function (func) {
  10226. var childrenByUid = this.childrenByUid;
  10227. var uid;
  10228. for (uid in childrenByUid) {
  10229. func(childrenByUid[uid]);
  10230. }
  10231. };
  10232. DateComponent.prototype._getCalendar = function () {
  10233. var t = this;
  10234. return t.calendar || t.view.calendar;
  10235. };
  10236. DateComponent.prototype._getView = function () {
  10237. return this.view;
  10238. };
  10239. DateComponent.prototype._getDateProfile = function () {
  10240. return this._getView().get('dateProfile');
  10241. };
  10242. // Generates HTML for an anchor to another view into the calendar.
  10243. // Will either generate an <a> tag or a non-clickable <span> tag, depending on enabled settings.
  10244. // `gotoOptions` can either be a moment input, or an object with the form:
  10245. // { date, type, forceOff }
  10246. // `type` is a view-type like "day" or "week". default value is "day".
  10247. // `attrs` and `innerHtml` are use to generate the rest of the HTML tag.
  10248. DateComponent.prototype.buildGotoAnchorHtml = function (gotoOptions, attrs, innerHtml) {
  10249. var date;
  10250. var type;
  10251. var forceOff;
  10252. var finalOptions;
  10253. if ($.isPlainObject(gotoOptions)) {
  10254. date = gotoOptions.date;
  10255. type = gotoOptions.type;
  10256. forceOff = gotoOptions.forceOff;
  10257. }
  10258. else {
  10259. date = gotoOptions; // a single moment input
  10260. }
  10261. date = moment_ext_1.default(date); // if a string, parse it
  10262. finalOptions = {
  10263. date: date.format('YYYY-MM-DD'),
  10264. type: type || 'day'
  10265. };
  10266. if (typeof attrs === 'string') {
  10267. innerHtml = attrs;
  10268. attrs = null;
  10269. }
  10270. attrs = attrs ? ' ' + util_1.attrsToStr(attrs) : ''; // will have a leading space
  10271. innerHtml = innerHtml || '';
  10272. if (!forceOff && this.opt('navLinks')) {
  10273. return '<a' + attrs +
  10274. ' data-goto="' + util_1.htmlEscape(JSON.stringify(finalOptions)) + '">' +
  10275. innerHtml +
  10276. '</a>';
  10277. }
  10278. else {
  10279. return '<span' + attrs + '>' +
  10280. innerHtml +
  10281. '</span>';
  10282. }
  10283. };
  10284. DateComponent.prototype.getAllDayHtml = function () {
  10285. return this.opt('allDayHtml') || util_1.htmlEscape(this.opt('allDayText'));
  10286. };
  10287. // Computes HTML classNames for a single-day element
  10288. DateComponent.prototype.getDayClasses = function (date, noThemeHighlight) {
  10289. var view = this._getView();
  10290. var classes = [];
  10291. var today;
  10292. if (!this.dateProfile.activeUnzonedRange.containsDate(date)) {
  10293. classes.push('fc-disabled-day'); // TODO: jQuery UI theme?
  10294. }
  10295. else {
  10296. classes.push('fc-' + util_1.dayIDs[date.day()]);
  10297. if (view.isDateInOtherMonth(date, this.dateProfile)) { // TODO: use DateComponent subclass somehow
  10298. classes.push('fc-other-month');
  10299. }
  10300. today = view.calendar.getNow();
  10301. if (date.isSame(today, 'day')) {
  10302. classes.push('fc-today');
  10303. if (noThemeHighlight !== true) {
  10304. classes.push(view.calendar.theme.getClass('today'));
  10305. }
  10306. }
  10307. else if (date < today) {
  10308. classes.push('fc-past');
  10309. }
  10310. else {
  10311. classes.push('fc-future');
  10312. }
  10313. }
  10314. return classes;
  10315. };
  10316. // Utility for formatting a range. Accepts a range object, formatting string, and optional separator.
  10317. // Displays all-day ranges naturally, with an inclusive end. Takes the current isRTL into account.
  10318. // The timezones of the dates within `range` will be respected.
  10319. DateComponent.prototype.formatRange = function (range, isAllDay, formatStr, separator) {
  10320. var end = range.end;
  10321. if (isAllDay) {
  10322. end = end.clone().subtract(1); // convert to inclusive. last ms of previous day
  10323. }
  10324. return date_formatting_1.formatRange(range.start, end, formatStr, separator, this.isRTL);
  10325. };
  10326. // Compute the number of the give units in the "current" range.
  10327. // Will return a floating-point number. Won't round.
  10328. DateComponent.prototype.currentRangeAs = function (unit) {
  10329. return this._getDateProfile().currentUnzonedRange.as(unit);
  10330. };
  10331. // Returns the date range of the full days the given range visually appears to occupy.
  10332. // Returns a plain object with start/end, NOT an UnzonedRange!
  10333. DateComponent.prototype.computeDayRange = function (unzonedRange) {
  10334. var calendar = this._getCalendar();
  10335. var startDay = calendar.msToUtcMoment(unzonedRange.startMs, true); // the beginning of the day the range starts
  10336. var end = calendar.msToUtcMoment(unzonedRange.endMs);
  10337. var endTimeMS = +end.time(); // # of milliseconds into `endDay`
  10338. var endDay = end.clone().stripTime(); // the beginning of the day the range exclusively ends
  10339. // If the end time is actually inclusively part of the next day and is equal to or
  10340. // beyond the next day threshold, adjust the end to be the exclusive end of `endDay`.
  10341. // Otherwise, leaving it as inclusive will cause it to exclude `endDay`.
  10342. if (endTimeMS && endTimeMS >= this.nextDayThreshold) {
  10343. endDay.add(1, 'days');
  10344. }
  10345. // If end is within `startDay` but not past nextDayThreshold, assign the default duration of one day.
  10346. if (endDay <= startDay) {
  10347. endDay = startDay.clone().add(1, 'days');
  10348. }
  10349. return { start: startDay, end: endDay };
  10350. };
  10351. // Does the given range visually appear to occupy more than one day?
  10352. DateComponent.prototype.isMultiDayRange = function (unzonedRange) {
  10353. var dayRange = this.computeDayRange(unzonedRange);
  10354. return dayRange.end.diff(dayRange.start, 'days') > 1;
  10355. };
  10356. DateComponent.guid = 0; // TODO: better system for this?
  10357. return DateComponent;
  10358. }(Component_1.default));
  10359. exports.default = DateComponent;
  10360. // legacy
  10361. function convertEventsPayloadToLegacyArray(eventsPayload) {
  10362. var eventDefId;
  10363. var eventInstances;
  10364. var legacyEvents = [];
  10365. var i;
  10366. for (eventDefId in eventsPayload) {
  10367. eventInstances = eventsPayload[eventDefId].eventInstances;
  10368. for (i = 0; i < eventInstances.length; i++) {
  10369. legacyEvents.push(eventInstances[i].toLegacy());
  10370. }
  10371. }
  10372. return legacyEvents;
  10373. }
  10374. /***/ }),
  10375. /* 232 */
  10376. /***/ (function(module, exports, __webpack_require__) {
  10377. Object.defineProperty(exports, "__esModule", { value: true });
  10378. var $ = __webpack_require__(3);
  10379. var moment = __webpack_require__(0);
  10380. var util_1 = __webpack_require__(4);
  10381. var options_1 = __webpack_require__(33);
  10382. var Iterator_1 = __webpack_require__(225);
  10383. var GlobalEmitter_1 = __webpack_require__(23);
  10384. var EmitterMixin_1 = __webpack_require__(13);
  10385. var ListenerMixin_1 = __webpack_require__(7);
  10386. var Toolbar_1 = __webpack_require__(257);
  10387. var OptionsManager_1 = __webpack_require__(258);
  10388. var ViewSpecManager_1 = __webpack_require__(259);
  10389. var Constraints_1 = __webpack_require__(217);
  10390. var locale_1 = __webpack_require__(32);
  10391. var moment_ext_1 = __webpack_require__(11);
  10392. var UnzonedRange_1 = __webpack_require__(5);
  10393. var ComponentFootprint_1 = __webpack_require__(12);
  10394. var EventDateProfile_1 = __webpack_require__(16);
  10395. var EventManager_1 = __webpack_require__(220);
  10396. var BusinessHourGenerator_1 = __webpack_require__(218);
  10397. var EventSourceParser_1 = __webpack_require__(38);
  10398. var EventDefParser_1 = __webpack_require__(36);
  10399. var SingleEventDef_1 = __webpack_require__(9);
  10400. var EventDefMutation_1 = __webpack_require__(39);
  10401. var EventSource_1 = __webpack_require__(6);
  10402. var ThemeRegistry_1 = __webpack_require__(57);
  10403. var Calendar = /** @class */ (function () {
  10404. function Calendar(el, overrides) {
  10405. this.loadingLevel = 0; // number of simultaneous loading tasks
  10406. this.ignoreUpdateViewSize = 0;
  10407. this.freezeContentHeightDepth = 0;
  10408. // declare the current calendar instance relies on GlobalEmitter. needed for garbage collection.
  10409. // unneeded() is called in destroy.
  10410. GlobalEmitter_1.default.needed();
  10411. this.el = el;
  10412. this.viewsByType = {};
  10413. this.optionsManager = new OptionsManager_1.default(this, overrides);
  10414. this.viewSpecManager = new ViewSpecManager_1.default(this.optionsManager, this);
  10415. this.initMomentInternals(); // needs to happen after options hash initialized
  10416. this.initCurrentDate();
  10417. this.initEventManager();
  10418. this.constraints = new Constraints_1.default(this.eventManager, this);
  10419. this.constructed();
  10420. }
  10421. Calendar.prototype.constructed = function () {
  10422. // useful for monkeypatching. used?
  10423. };
  10424. Calendar.prototype.getView = function () {
  10425. return this.view;
  10426. };
  10427. Calendar.prototype.publiclyTrigger = function (name, triggerInfo) {
  10428. var optHandler = this.opt(name);
  10429. var context;
  10430. var args;
  10431. if ($.isPlainObject(triggerInfo)) {
  10432. context = triggerInfo.context;
  10433. args = triggerInfo.args;
  10434. }
  10435. else if ($.isArray(triggerInfo)) {
  10436. args = triggerInfo;
  10437. }
  10438. if (context == null) {
  10439. context = this.el[0]; // fallback context
  10440. }
  10441. if (!args) {
  10442. args = [];
  10443. }
  10444. this.triggerWith(name, context, args); // Emitter's method
  10445. if (optHandler) {
  10446. return optHandler.apply(context, args);
  10447. }
  10448. };
  10449. Calendar.prototype.hasPublicHandlers = function (name) {
  10450. return this.hasHandlers(name) ||
  10451. this.opt(name); // handler specified in options
  10452. };
  10453. // Options Public API
  10454. // -----------------------------------------------------------------------------------------------------------------
  10455. // public getter/setter
  10456. Calendar.prototype.option = function (name, value) {
  10457. var newOptionHash;
  10458. if (typeof name === 'string') {
  10459. if (value === undefined) { // getter
  10460. return this.optionsManager.get(name);
  10461. }
  10462. else { // setter for individual option
  10463. newOptionHash = {};
  10464. newOptionHash[name] = value;
  10465. this.optionsManager.add(newOptionHash);
  10466. }
  10467. }
  10468. else if (typeof name === 'object') { // compound setter with object input
  10469. this.optionsManager.add(name);
  10470. }
  10471. };
  10472. // private getter
  10473. Calendar.prototype.opt = function (name) {
  10474. return this.optionsManager.get(name);
  10475. };
  10476. // View
  10477. // -----------------------------------------------------------------------------------------------------------------
  10478. // Given a view name for a custom view or a standard view, creates a ready-to-go View object
  10479. Calendar.prototype.instantiateView = function (viewType) {
  10480. var spec = this.viewSpecManager.getViewSpec(viewType);
  10481. if (!spec) {
  10482. throw new Error("View type \"" + viewType + "\" is not valid");
  10483. }
  10484. return new spec['class'](this, spec);
  10485. };
  10486. // Returns a boolean about whether the view is okay to instantiate at some point
  10487. Calendar.prototype.isValidViewType = function (viewType) {
  10488. return Boolean(this.viewSpecManager.getViewSpec(viewType));
  10489. };
  10490. Calendar.prototype.changeView = function (viewName, dateOrRange) {
  10491. if (dateOrRange) {
  10492. if (dateOrRange.start && dateOrRange.end) { // a range
  10493. this.optionsManager.recordOverrides({
  10494. visibleRange: dateOrRange
  10495. });
  10496. }
  10497. else { // a date
  10498. this.currentDate = this.moment(dateOrRange).stripZone(); // just like gotoDate
  10499. }
  10500. }
  10501. this.renderView(viewName);
  10502. };
  10503. // Forces navigation to a view for the given date.
  10504. // `viewType` can be a specific view name or a generic one like "week" or "day".
  10505. Calendar.prototype.zoomTo = function (newDate, viewType) {
  10506. var spec;
  10507. viewType = viewType || 'day'; // day is default zoom
  10508. spec = this.viewSpecManager.getViewSpec(viewType) ||
  10509. this.viewSpecManager.getUnitViewSpec(viewType);
  10510. this.currentDate = newDate.clone();
  10511. this.renderView(spec ? spec.type : null);
  10512. };
  10513. // Current Date
  10514. // -----------------------------------------------------------------------------------------------------------------
  10515. Calendar.prototype.initCurrentDate = function () {
  10516. var defaultDateInput = this.opt('defaultDate');
  10517. // compute the initial ambig-timezone date
  10518. if (defaultDateInput != null) {
  10519. this.currentDate = this.moment(defaultDateInput).stripZone();
  10520. }
  10521. else {
  10522. this.currentDate = this.getNow(); // getNow already returns unzoned
  10523. }
  10524. };
  10525. Calendar.prototype.prev = function () {
  10526. var view = this.view;
  10527. var prevInfo = view.dateProfileGenerator.buildPrev(view.get('dateProfile'));
  10528. if (prevInfo.isValid) {
  10529. this.currentDate = prevInfo.date;
  10530. this.renderView();
  10531. }
  10532. };
  10533. Calendar.prototype.next = function () {
  10534. var view = this.view;
  10535. var nextInfo = view.dateProfileGenerator.buildNext(view.get('dateProfile'));
  10536. if (nextInfo.isValid) {
  10537. this.currentDate = nextInfo.date;
  10538. this.renderView();
  10539. }
  10540. };
  10541. Calendar.prototype.prevYear = function () {
  10542. this.currentDate.add(-1, 'years');
  10543. this.renderView();
  10544. };
  10545. Calendar.prototype.nextYear = function () {
  10546. this.currentDate.add(1, 'years');
  10547. this.renderView();
  10548. };
  10549. Calendar.prototype.today = function () {
  10550. this.currentDate = this.getNow(); // should deny like prev/next?
  10551. this.renderView();
  10552. };
  10553. Calendar.prototype.gotoDate = function (zonedDateInput) {
  10554. this.currentDate = this.moment(zonedDateInput).stripZone();
  10555. this.renderView();
  10556. };
  10557. Calendar.prototype.incrementDate = function (delta) {
  10558. this.currentDate.add(moment.duration(delta));
  10559. this.renderView();
  10560. };
  10561. // for external API
  10562. Calendar.prototype.getDate = function () {
  10563. return this.applyTimezone(this.currentDate); // infuse the calendar's timezone
  10564. };
  10565. // Loading Triggering
  10566. // -----------------------------------------------------------------------------------------------------------------
  10567. // Should be called when any type of async data fetching begins
  10568. Calendar.prototype.pushLoading = function () {
  10569. if (!(this.loadingLevel++)) {
  10570. this.publiclyTrigger('loading', [true, this.view]);
  10571. }
  10572. };
  10573. // Should be called when any type of async data fetching completes
  10574. Calendar.prototype.popLoading = function () {
  10575. if (!(--this.loadingLevel)) {
  10576. this.publiclyTrigger('loading', [false, this.view]);
  10577. }
  10578. };
  10579. // High-level Rendering
  10580. // -----------------------------------------------------------------------------------
  10581. Calendar.prototype.render = function () {
  10582. if (!this.contentEl) {
  10583. this.initialRender();
  10584. }
  10585. else if (this.elementVisible()) {
  10586. // mainly for the public API
  10587. this.calcSize();
  10588. this.updateViewSize();
  10589. }
  10590. };
  10591. Calendar.prototype.initialRender = function () {
  10592. var _this = this;
  10593. var el = this.el;
  10594. el.addClass('fc');
  10595. // event delegation for nav links
  10596. el.on('click.fc', 'a[data-goto]', function (ev) {
  10597. var anchorEl = $(ev.currentTarget);
  10598. var gotoOptions = anchorEl.data('goto'); // will automatically parse JSON
  10599. var date = _this.moment(gotoOptions.date);
  10600. var viewType = gotoOptions.type;
  10601. // property like "navLinkDayClick". might be a string or a function
  10602. var customAction = _this.view.opt('navLink' + util_1.capitaliseFirstLetter(viewType) + 'Click');
  10603. if (typeof customAction === 'function') {
  10604. customAction(date, ev);
  10605. }
  10606. else {
  10607. if (typeof customAction === 'string') {
  10608. viewType = customAction;
  10609. }
  10610. _this.zoomTo(date, viewType);
  10611. }
  10612. });
  10613. // called immediately, and upon option change
  10614. this.optionsManager.watch('settingTheme', ['?theme', '?themeSystem'], function (opts) {
  10615. var themeClass = ThemeRegistry_1.getThemeSystemClass(opts.themeSystem || opts.theme);
  10616. var theme = new themeClass(_this.optionsManager);
  10617. var widgetClass = theme.getClass('widget');
  10618. _this.theme = theme;
  10619. if (widgetClass) {
  10620. el.addClass(widgetClass);
  10621. }
  10622. }, function () {
  10623. var widgetClass = _this.theme.getClass('widget');
  10624. _this.theme = null;
  10625. if (widgetClass) {
  10626. el.removeClass(widgetClass);
  10627. }
  10628. });
  10629. this.optionsManager.watch('settingBusinessHourGenerator', ['?businessHours'], function (deps) {
  10630. _this.businessHourGenerator = new BusinessHourGenerator_1.default(deps.businessHours, _this);
  10631. if (_this.view) {
  10632. _this.view.set('businessHourGenerator', _this.businessHourGenerator);
  10633. }
  10634. }, function () {
  10635. _this.businessHourGenerator = null;
  10636. });
  10637. // called immediately, and upon option change.
  10638. // HACK: locale often affects isRTL, so we explicitly listen to that too.
  10639. this.optionsManager.watch('applyingDirClasses', ['?isRTL', '?locale'], function (opts) {
  10640. el.toggleClass('fc-ltr', !opts.isRTL);
  10641. el.toggleClass('fc-rtl', opts.isRTL);
  10642. });
  10643. this.contentEl = $("<div class='fc-view-container'>").prependTo(el);
  10644. this.initToolbars();
  10645. this.renderHeader();
  10646. this.renderFooter();
  10647. this.renderView(this.opt('defaultView'));
  10648. if (this.opt('handleWindowResize')) {
  10649. $(window).resize(this.windowResizeProxy = util_1.debounce(// prevents rapid calls
  10650. this.windowResize.bind(this), this.opt('windowResizeDelay')));
  10651. }
  10652. };
  10653. Calendar.prototype.destroy = function () {
  10654. if (this.view) {
  10655. this.clearView();
  10656. }
  10657. this.toolbarsManager.proxyCall('removeElement');
  10658. this.contentEl.remove();
  10659. this.el.removeClass('fc fc-ltr fc-rtl');
  10660. // removes theme-related root className
  10661. this.optionsManager.unwatch('settingTheme');
  10662. this.optionsManager.unwatch('settingBusinessHourGenerator');
  10663. this.el.off('.fc'); // unbind nav link handlers
  10664. if (this.windowResizeProxy) {
  10665. $(window).unbind('resize', this.windowResizeProxy);
  10666. this.windowResizeProxy = null;
  10667. }
  10668. GlobalEmitter_1.default.unneeded();
  10669. };
  10670. Calendar.prototype.elementVisible = function () {
  10671. return this.el.is(':visible');
  10672. };
  10673. // Render Queue
  10674. // -----------------------------------------------------------------------------------------------------------------
  10675. Calendar.prototype.bindViewHandlers = function (view) {
  10676. var _this = this;
  10677. view.watch('titleForCalendar', ['title'], function (deps) {
  10678. if (view === _this.view) { // hack
  10679. _this.setToolbarsTitle(deps.title);
  10680. }
  10681. });
  10682. view.watch('dateProfileForCalendar', ['dateProfile'], function (deps) {
  10683. if (view === _this.view) { // hack
  10684. _this.currentDate = deps.dateProfile.date; // might have been constrained by view dates
  10685. _this.updateToolbarButtons(deps.dateProfile);
  10686. }
  10687. });
  10688. };
  10689. Calendar.prototype.unbindViewHandlers = function (view) {
  10690. view.unwatch('titleForCalendar');
  10691. view.unwatch('dateProfileForCalendar');
  10692. };
  10693. // View Rendering
  10694. // -----------------------------------------------------------------------------------
  10695. // Renders a view because of a date change, view-type change, or for the first time.
  10696. // If not given a viewType, keep the current view but render different dates.
  10697. // Accepts an optional scroll state to restore to.
  10698. Calendar.prototype.renderView = function (viewType) {
  10699. var oldView = this.view;
  10700. var newView;
  10701. this.freezeContentHeight();
  10702. if (oldView && viewType && oldView.type !== viewType) {
  10703. this.clearView();
  10704. }
  10705. // if viewType changed, or the view was never created, create a fresh view
  10706. if (!this.view && viewType) {
  10707. newView = this.view =
  10708. this.viewsByType[viewType] ||
  10709. (this.viewsByType[viewType] = this.instantiateView(viewType));
  10710. this.bindViewHandlers(newView);
  10711. newView.startBatchRender(); // so that setElement+setDate rendering are joined
  10712. newView.setElement($("<div class='fc-view fc-" + viewType + "-view'>").appendTo(this.contentEl));
  10713. this.toolbarsManager.proxyCall('activateButton', viewType);
  10714. }
  10715. if (this.view) {
  10716. // prevent unnecessary change firing
  10717. if (this.view.get('businessHourGenerator') !== this.businessHourGenerator) {
  10718. this.view.set('businessHourGenerator', this.businessHourGenerator);
  10719. }
  10720. this.view.setDate(this.currentDate);
  10721. if (newView) {
  10722. newView.stopBatchRender();
  10723. }
  10724. }
  10725. this.thawContentHeight();
  10726. };
  10727. // Unrenders the current view and reflects this change in the Header.
  10728. // Unregsiters the `view`, but does not remove from viewByType hash.
  10729. Calendar.prototype.clearView = function () {
  10730. var currentView = this.view;
  10731. this.toolbarsManager.proxyCall('deactivateButton', currentView.type);
  10732. this.unbindViewHandlers(currentView);
  10733. currentView.removeElement();
  10734. currentView.unsetDate(); // so bindViewHandlers doesn't fire with old values next time
  10735. this.view = null;
  10736. };
  10737. // Destroys the view, including the view object. Then, re-instantiates it and renders it.
  10738. // Maintains the same scroll state.
  10739. // TODO: maintain any other user-manipulated state.
  10740. Calendar.prototype.reinitView = function () {
  10741. var oldView = this.view;
  10742. var scroll = oldView.queryScroll(); // wouldn't be so complicated if Calendar owned the scroll
  10743. this.freezeContentHeight();
  10744. this.clearView();
  10745. this.calcSize();
  10746. this.renderView(oldView.type); // needs the type to freshly render
  10747. this.view.applyScroll(scroll);
  10748. this.thawContentHeight();
  10749. };
  10750. // Resizing
  10751. // -----------------------------------------------------------------------------------
  10752. Calendar.prototype.getSuggestedViewHeight = function () {
  10753. if (this.suggestedViewHeight == null) {
  10754. this.calcSize();
  10755. }
  10756. return this.suggestedViewHeight;
  10757. };
  10758. Calendar.prototype.isHeightAuto = function () {
  10759. return this.opt('contentHeight') === 'auto' || this.opt('height') === 'auto';
  10760. };
  10761. Calendar.prototype.updateViewSize = function (isResize) {
  10762. if (isResize === void 0) { isResize = false; }
  10763. var view = this.view;
  10764. var scroll;
  10765. if (!this.ignoreUpdateViewSize && view) {
  10766. if (isResize) {
  10767. this.calcSize();
  10768. scroll = view.queryScroll();
  10769. }
  10770. this.ignoreUpdateViewSize++;
  10771. view.updateSize(this.getSuggestedViewHeight(), this.isHeightAuto(), isResize);
  10772. this.ignoreUpdateViewSize--;
  10773. if (isResize) {
  10774. view.applyScroll(scroll);
  10775. }
  10776. return true; // signal success
  10777. }
  10778. };
  10779. Calendar.prototype.calcSize = function () {
  10780. if (this.elementVisible()) {
  10781. this._calcSize();
  10782. }
  10783. };
  10784. Calendar.prototype._calcSize = function () {
  10785. var contentHeightInput = this.opt('contentHeight');
  10786. var heightInput = this.opt('height');
  10787. if (typeof contentHeightInput === 'number') { // exists and not 'auto'
  10788. this.suggestedViewHeight = contentHeightInput;
  10789. }
  10790. else if (typeof contentHeightInput === 'function') { // exists and is a function
  10791. this.suggestedViewHeight = contentHeightInput();
  10792. }
  10793. else if (typeof heightInput === 'number') { // exists and not 'auto'
  10794. this.suggestedViewHeight = heightInput - this.queryToolbarsHeight();
  10795. }
  10796. else if (typeof heightInput === 'function') { // exists and is a function
  10797. this.suggestedViewHeight = heightInput() - this.queryToolbarsHeight();
  10798. }
  10799. else if (heightInput === 'parent') { // set to height of parent element
  10800. this.suggestedViewHeight = this.el.parent().height() - this.queryToolbarsHeight();
  10801. }
  10802. else {
  10803. this.suggestedViewHeight = Math.round(this.contentEl.width() /
  10804. Math.max(this.opt('aspectRatio'), .5));
  10805. }
  10806. };
  10807. Calendar.prototype.windowResize = function (ev) {
  10808. if (
  10809. // the purpose: so we don't process jqui "resize" events that have bubbled up
  10810. // cast to any because .target, which is Element, can't be compared to window for some reason.
  10811. ev.target === window &&
  10812. this.view &&
  10813. this.view.isDatesRendered) {
  10814. if (this.updateViewSize(true)) { // isResize=true, returns true on success
  10815. this.publiclyTrigger('windowResize', [this.view]);
  10816. }
  10817. }
  10818. };
  10819. /* Height "Freezing"
  10820. -----------------------------------------------------------------------------*/
  10821. Calendar.prototype.freezeContentHeight = function () {
  10822. if (!(this.freezeContentHeightDepth++)) {
  10823. this.forceFreezeContentHeight();
  10824. }
  10825. };
  10826. Calendar.prototype.forceFreezeContentHeight = function () {
  10827. this.contentEl.css({
  10828. width: '100%',
  10829. height: this.contentEl.height(),
  10830. overflow: 'hidden'
  10831. });
  10832. };
  10833. Calendar.prototype.thawContentHeight = function () {
  10834. this.freezeContentHeightDepth--;
  10835. // always bring back to natural height
  10836. this.contentEl.css({
  10837. width: '',
  10838. height: '',
  10839. overflow: ''
  10840. });
  10841. // but if there are future thaws, re-freeze
  10842. if (this.freezeContentHeightDepth) {
  10843. this.forceFreezeContentHeight();
  10844. }
  10845. };
  10846. // Toolbar
  10847. // -----------------------------------------------------------------------------------------------------------------
  10848. Calendar.prototype.initToolbars = function () {
  10849. this.header = new Toolbar_1.default(this, this.computeHeaderOptions());
  10850. this.footer = new Toolbar_1.default(this, this.computeFooterOptions());
  10851. this.toolbarsManager = new Iterator_1.default([this.header, this.footer]);
  10852. };
  10853. Calendar.prototype.computeHeaderOptions = function () {
  10854. return {
  10855. extraClasses: 'fc-header-toolbar',
  10856. layout: this.opt('header')
  10857. };
  10858. };
  10859. Calendar.prototype.computeFooterOptions = function () {
  10860. return {
  10861. extraClasses: 'fc-footer-toolbar',
  10862. layout: this.opt('footer')
  10863. };
  10864. };
  10865. // can be called repeatedly and Header will rerender
  10866. Calendar.prototype.renderHeader = function () {
  10867. var header = this.header;
  10868. header.setToolbarOptions(this.computeHeaderOptions());
  10869. header.render();
  10870. if (header.el) {
  10871. this.el.prepend(header.el);
  10872. }
  10873. };
  10874. // can be called repeatedly and Footer will rerender
  10875. Calendar.prototype.renderFooter = function () {
  10876. var footer = this.footer;
  10877. footer.setToolbarOptions(this.computeFooterOptions());
  10878. footer.render();
  10879. if (footer.el) {
  10880. this.el.append(footer.el);
  10881. }
  10882. };
  10883. Calendar.prototype.setToolbarsTitle = function (title) {
  10884. this.toolbarsManager.proxyCall('updateTitle', title);
  10885. };
  10886. Calendar.prototype.updateToolbarButtons = function (dateProfile) {
  10887. var now = this.getNow();
  10888. var view = this.view;
  10889. var todayInfo = view.dateProfileGenerator.build(now);
  10890. var prevInfo = view.dateProfileGenerator.buildPrev(view.get('dateProfile'));
  10891. var nextInfo = view.dateProfileGenerator.buildNext(view.get('dateProfile'));
  10892. this.toolbarsManager.proxyCall((todayInfo.isValid && !dateProfile.currentUnzonedRange.containsDate(now)) ?
  10893. 'enableButton' :
  10894. 'disableButton', 'today');
  10895. this.toolbarsManager.proxyCall(prevInfo.isValid ?
  10896. 'enableButton' :
  10897. 'disableButton', 'prev');
  10898. this.toolbarsManager.proxyCall(nextInfo.isValid ?
  10899. 'enableButton' :
  10900. 'disableButton', 'next');
  10901. };
  10902. Calendar.prototype.queryToolbarsHeight = function () {
  10903. return this.toolbarsManager.items.reduce(function (accumulator, toolbar) {
  10904. var toolbarHeight = toolbar.el ? toolbar.el.outerHeight(true) : 0; // includes margin
  10905. return accumulator + toolbarHeight;
  10906. }, 0);
  10907. };
  10908. // Selection
  10909. // -----------------------------------------------------------------------------------------------------------------
  10910. // this public method receives start/end dates in any format, with any timezone
  10911. Calendar.prototype.select = function (zonedStartInput, zonedEndInput) {
  10912. this.view.select(this.buildSelectFootprint.apply(this, arguments));
  10913. };
  10914. Calendar.prototype.unselect = function () {
  10915. if (this.view) {
  10916. this.view.unselect();
  10917. }
  10918. };
  10919. // Given arguments to the select method in the API, returns a span (unzoned start/end and other info)
  10920. Calendar.prototype.buildSelectFootprint = function (zonedStartInput, zonedEndInput) {
  10921. var start = this.moment(zonedStartInput).stripZone();
  10922. var end;
  10923. if (zonedEndInput) {
  10924. end = this.moment(zonedEndInput).stripZone();
  10925. }
  10926. else if (start.hasTime()) {
  10927. end = start.clone().add(this.defaultTimedEventDuration);
  10928. }
  10929. else {
  10930. end = start.clone().add(this.defaultAllDayEventDuration);
  10931. }
  10932. return new ComponentFootprint_1.default(new UnzonedRange_1.default(start, end), !start.hasTime());
  10933. };
  10934. // Date Utils
  10935. // -----------------------------------------------------------------------------------------------------------------
  10936. Calendar.prototype.initMomentInternals = function () {
  10937. var _this = this;
  10938. this.defaultAllDayEventDuration = moment.duration(this.opt('defaultAllDayEventDuration'));
  10939. this.defaultTimedEventDuration = moment.duration(this.opt('defaultTimedEventDuration'));
  10940. // Called immediately, and when any of the options change.
  10941. // Happens before any internal objects rebuild or rerender, because this is very core.
  10942. this.optionsManager.watch('buildingMomentLocale', [
  10943. '?locale', '?monthNames', '?monthNamesShort', '?dayNames', '?dayNamesShort',
  10944. '?firstDay', '?weekNumberCalculation'
  10945. ], function (opts) {
  10946. var weekNumberCalculation = opts.weekNumberCalculation;
  10947. var firstDay = opts.firstDay;
  10948. var _week;
  10949. // normalize
  10950. if (weekNumberCalculation === 'iso') {
  10951. weekNumberCalculation = 'ISO'; // normalize
  10952. }
  10953. var localeData = Object.create(// make a cheap copy
  10954. locale_1.getMomentLocaleData(opts.locale) // will fall back to en
  10955. );
  10956. if (opts.monthNames) {
  10957. localeData._months = opts.monthNames;
  10958. }
  10959. if (opts.monthNamesShort) {
  10960. localeData._monthsShort = opts.monthNamesShort;
  10961. }
  10962. if (opts.dayNames) {
  10963. localeData._weekdays = opts.dayNames;
  10964. }
  10965. if (opts.dayNamesShort) {
  10966. localeData._weekdaysShort = opts.dayNamesShort;
  10967. }
  10968. if (firstDay == null && weekNumberCalculation === 'ISO') {
  10969. firstDay = 1;
  10970. }
  10971. if (firstDay != null) {
  10972. _week = Object.create(localeData._week); // _week: { dow: # }
  10973. _week.dow = firstDay;
  10974. localeData._week = _week;
  10975. }
  10976. if ( // whitelist certain kinds of input
  10977. weekNumberCalculation === 'ISO' ||
  10978. weekNumberCalculation === 'local' ||
  10979. typeof weekNumberCalculation === 'function') {
  10980. localeData._fullCalendar_weekCalc = weekNumberCalculation; // moment-ext will know what to do with it
  10981. }
  10982. _this.localeData = localeData;
  10983. // If the internal current date object already exists, move to new locale.
  10984. // We do NOT need to do this technique for event dates, because this happens when converting to "segments".
  10985. if (_this.currentDate) {
  10986. _this.localizeMoment(_this.currentDate); // sets to localeData
  10987. }
  10988. });
  10989. };
  10990. // Builds a moment using the settings of the current calendar: timezone and locale.
  10991. // Accepts anything the vanilla moment() constructor accepts.
  10992. Calendar.prototype.moment = function () {
  10993. var args = [];
  10994. for (var _i = 0; _i < arguments.length; _i++) {
  10995. args[_i] = arguments[_i];
  10996. }
  10997. var mom;
  10998. if (this.opt('timezone') === 'local') {
  10999. mom = moment_ext_1.default.apply(null, args);
  11000. // Force the moment to be local, because momentExt doesn't guarantee it.
  11001. if (mom.hasTime()) { // don't give ambiguously-timed moments a local zone
  11002. mom.local();
  11003. }
  11004. }
  11005. else if (this.opt('timezone') === 'UTC') {
  11006. mom = moment_ext_1.default.utc.apply(null, args); // process as UTC
  11007. }
  11008. else {
  11009. mom = moment_ext_1.default.parseZone.apply(null, args); // let the input decide the zone
  11010. }
  11011. this.localizeMoment(mom); // TODO
  11012. return mom;
  11013. };
  11014. Calendar.prototype.msToMoment = function (ms, forceAllDay) {
  11015. var mom = moment_ext_1.default.utc(ms); // TODO: optimize by using Date.UTC
  11016. if (forceAllDay) {
  11017. mom.stripTime();
  11018. }
  11019. else {
  11020. mom = this.applyTimezone(mom); // may or may not apply locale
  11021. }
  11022. this.localizeMoment(mom);
  11023. return mom;
  11024. };
  11025. Calendar.prototype.msToUtcMoment = function (ms, forceAllDay) {
  11026. var mom = moment_ext_1.default.utc(ms); // TODO: optimize by using Date.UTC
  11027. if (forceAllDay) {
  11028. mom.stripTime();
  11029. }
  11030. this.localizeMoment(mom);
  11031. return mom;
  11032. };
  11033. // Updates the given moment's locale settings to the current calendar locale settings.
  11034. Calendar.prototype.localizeMoment = function (mom) {
  11035. mom._locale = this.localeData;
  11036. };
  11037. // Returns a boolean about whether or not the calendar knows how to calculate
  11038. // the timezone offset of arbitrary dates in the current timezone.
  11039. Calendar.prototype.getIsAmbigTimezone = function () {
  11040. return this.opt('timezone') !== 'local' && this.opt('timezone') !== 'UTC';
  11041. };
  11042. // Returns a copy of the given date in the current timezone. Has no effect on dates without times.
  11043. Calendar.prototype.applyTimezone = function (date) {
  11044. if (!date.hasTime()) {
  11045. return date.clone();
  11046. }
  11047. var zonedDate = this.moment(date.toArray());
  11048. var timeAdjust = date.time().asMilliseconds() - zonedDate.time().asMilliseconds();
  11049. var adjustedZonedDate;
  11050. // Safari sometimes has problems with this coersion when near DST. Adjust if necessary. (bug #2396)
  11051. if (timeAdjust) { // is the time result different than expected?
  11052. adjustedZonedDate = zonedDate.clone().add(timeAdjust); // add milliseconds
  11053. if (date.time().asMilliseconds() - adjustedZonedDate.time().asMilliseconds() === 0) { // does it match perfectly now?
  11054. zonedDate = adjustedZonedDate;
  11055. }
  11056. }
  11057. return zonedDate;
  11058. };
  11059. /*
  11060. Assumes the footprint is non-open-ended.
  11061. */
  11062. Calendar.prototype.footprintToDateProfile = function (componentFootprint, ignoreEnd) {
  11063. if (ignoreEnd === void 0) { ignoreEnd = false; }
  11064. var start = moment_ext_1.default.utc(componentFootprint.unzonedRange.startMs);
  11065. var end;
  11066. if (!ignoreEnd) {
  11067. end = moment_ext_1.default.utc(componentFootprint.unzonedRange.endMs);
  11068. }
  11069. if (componentFootprint.isAllDay) {
  11070. start.stripTime();
  11071. if (end) {
  11072. end.stripTime();
  11073. }
  11074. }
  11075. else {
  11076. start = this.applyTimezone(start);
  11077. if (end) {
  11078. end = this.applyTimezone(end);
  11079. }
  11080. }
  11081. this.localizeMoment(start);
  11082. if (end) {
  11083. this.localizeMoment(end);
  11084. }
  11085. return new EventDateProfile_1.default(start, end, this);
  11086. };
  11087. // Returns a moment for the current date, as defined by the client's computer or from the `now` option.
  11088. // Will return an moment with an ambiguous timezone.
  11089. Calendar.prototype.getNow = function () {
  11090. var now = this.opt('now');
  11091. if (typeof now === 'function') {
  11092. now = now();
  11093. }
  11094. return this.moment(now).stripZone();
  11095. };
  11096. // Produces a human-readable string for the given duration.
  11097. // Side-effect: changes the locale of the given duration.
  11098. Calendar.prototype.humanizeDuration = function (duration) {
  11099. return duration.locale(this.opt('locale')).humanize();
  11100. };
  11101. // will return `null` if invalid range
  11102. Calendar.prototype.parseUnzonedRange = function (rangeInput) {
  11103. var start = null;
  11104. var end = null;
  11105. if (rangeInput.start) {
  11106. start = this.moment(rangeInput.start).stripZone();
  11107. }
  11108. if (rangeInput.end) {
  11109. end = this.moment(rangeInput.end).stripZone();
  11110. }
  11111. if (!start && !end) {
  11112. return null;
  11113. }
  11114. if (start && end && end.isBefore(start)) {
  11115. return null;
  11116. }
  11117. return new UnzonedRange_1.default(start, end);
  11118. };
  11119. // Event-Date Utilities
  11120. // -----------------------------------------------------------------------------------------------------------------
  11121. Calendar.prototype.initEventManager = function () {
  11122. var _this = this;
  11123. var eventManager = new EventManager_1.default(this);
  11124. var rawSources = this.opt('eventSources') || [];
  11125. var singleRawSource = this.opt('events');
  11126. this.eventManager = eventManager;
  11127. if (singleRawSource) {
  11128. rawSources.unshift(singleRawSource);
  11129. }
  11130. eventManager.on('release', function (eventsPayload) {
  11131. _this.trigger('eventsReset', eventsPayload);
  11132. });
  11133. eventManager.freeze();
  11134. rawSources.forEach(function (rawSource) {
  11135. var source = EventSourceParser_1.default.parse(rawSource, _this);
  11136. if (source) {
  11137. eventManager.addSource(source);
  11138. }
  11139. });
  11140. eventManager.thaw();
  11141. };
  11142. Calendar.prototype.requestEvents = function (start, end) {
  11143. return this.eventManager.requestEvents(start, end, this.opt('timezone'), !this.opt('lazyFetching'));
  11144. };
  11145. // Get an event's normalized end date. If not present, calculate it from the defaults.
  11146. Calendar.prototype.getEventEnd = function (event) {
  11147. if (event.end) {
  11148. return event.end.clone();
  11149. }
  11150. else {
  11151. return this.getDefaultEventEnd(event.allDay, event.start);
  11152. }
  11153. };
  11154. // Given an event's allDay status and start date, return what its fallback end date should be.
  11155. // TODO: rename to computeDefaultEventEnd
  11156. Calendar.prototype.getDefaultEventEnd = function (allDay, zonedStart) {
  11157. var end = zonedStart.clone();
  11158. if (allDay) {
  11159. end.stripTime().add(this.defaultAllDayEventDuration);
  11160. }
  11161. else {
  11162. end.add(this.defaultTimedEventDuration);
  11163. }
  11164. if (this.getIsAmbigTimezone()) {
  11165. end.stripZone(); // we don't know what the tzo should be
  11166. }
  11167. return end;
  11168. };
  11169. // Public Events API
  11170. // -----------------------------------------------------------------------------------------------------------------
  11171. Calendar.prototype.rerenderEvents = function () {
  11172. this.view.flash('displayingEvents');
  11173. };
  11174. Calendar.prototype.refetchEvents = function () {
  11175. this.eventManager.refetchAllSources();
  11176. };
  11177. Calendar.prototype.renderEvents = function (eventInputs, isSticky) {
  11178. this.eventManager.freeze();
  11179. for (var i = 0; i < eventInputs.length; i++) {
  11180. this.renderEvent(eventInputs[i], isSticky);
  11181. }
  11182. this.eventManager.thaw();
  11183. };
  11184. Calendar.prototype.renderEvent = function (eventInput, isSticky) {
  11185. if (isSticky === void 0) { isSticky = false; }
  11186. var eventManager = this.eventManager;
  11187. var eventDef = EventDefParser_1.default.parse(eventInput, eventInput.source || eventManager.stickySource);
  11188. if (eventDef) {
  11189. eventManager.addEventDef(eventDef, isSticky);
  11190. }
  11191. };
  11192. // legacyQuery operates on legacy event instance objects
  11193. Calendar.prototype.removeEvents = function (legacyQuery) {
  11194. var eventManager = this.eventManager;
  11195. var legacyInstances = [];
  11196. var idMap = {};
  11197. var eventDef;
  11198. var i;
  11199. if (legacyQuery == null) { // shortcut for removing all
  11200. eventManager.removeAllEventDefs(); // persist=true
  11201. }
  11202. else {
  11203. eventManager.getEventInstances().forEach(function (eventInstance) {
  11204. legacyInstances.push(eventInstance.toLegacy());
  11205. });
  11206. legacyInstances = filterLegacyEventInstances(legacyInstances, legacyQuery);
  11207. // compute unique IDs
  11208. for (i = 0; i < legacyInstances.length; i++) {
  11209. eventDef = this.eventManager.getEventDefByUid(legacyInstances[i]._id);
  11210. idMap[eventDef.id] = true;
  11211. }
  11212. eventManager.freeze();
  11213. for (i in idMap) { // reuse `i` as an "id"
  11214. eventManager.removeEventDefsById(i); // persist=true
  11215. }
  11216. eventManager.thaw();
  11217. }
  11218. };
  11219. // legacyQuery operates on legacy event instance objects
  11220. Calendar.prototype.clientEvents = function (legacyQuery) {
  11221. var legacyEventInstances = [];
  11222. this.eventManager.getEventInstances().forEach(function (eventInstance) {
  11223. legacyEventInstances.push(eventInstance.toLegacy());
  11224. });
  11225. return filterLegacyEventInstances(legacyEventInstances, legacyQuery);
  11226. };
  11227. Calendar.prototype.updateEvents = function (eventPropsArray) {
  11228. this.eventManager.freeze();
  11229. for (var i = 0; i < eventPropsArray.length; i++) {
  11230. this.updateEvent(eventPropsArray[i]);
  11231. }
  11232. this.eventManager.thaw();
  11233. };
  11234. Calendar.prototype.updateEvent = function (eventProps) {
  11235. var eventDef = this.eventManager.getEventDefByUid(eventProps._id);
  11236. var eventInstance;
  11237. var eventDefMutation;
  11238. if (eventDef instanceof SingleEventDef_1.default) {
  11239. eventInstance = eventDef.buildInstance();
  11240. eventDefMutation = EventDefMutation_1.default.createFromRawProps(eventInstance, eventProps, // raw props
  11241. null // largeUnit -- who uses it?
  11242. );
  11243. this.eventManager.mutateEventsWithId(eventDef.id, eventDefMutation); // will release
  11244. }
  11245. };
  11246. // Public Event Sources API
  11247. // ------------------------------------------------------------------------------------
  11248. Calendar.prototype.getEventSources = function () {
  11249. return this.eventManager.otherSources.slice(); // clone
  11250. };
  11251. Calendar.prototype.getEventSourceById = function (id) {
  11252. return this.eventManager.getSourceById(EventSource_1.default.normalizeId(id));
  11253. };
  11254. Calendar.prototype.addEventSource = function (sourceInput) {
  11255. var source = EventSourceParser_1.default.parse(sourceInput, this);
  11256. if (source) {
  11257. this.eventManager.addSource(source);
  11258. }
  11259. };
  11260. Calendar.prototype.removeEventSources = function (sourceMultiQuery) {
  11261. var eventManager = this.eventManager;
  11262. var sources;
  11263. var i;
  11264. if (sourceMultiQuery == null) {
  11265. this.eventManager.removeAllSources();
  11266. }
  11267. else {
  11268. sources = eventManager.multiQuerySources(sourceMultiQuery);
  11269. eventManager.freeze();
  11270. for (i = 0; i < sources.length; i++) {
  11271. eventManager.removeSource(sources[i]);
  11272. }
  11273. eventManager.thaw();
  11274. }
  11275. };
  11276. Calendar.prototype.removeEventSource = function (sourceQuery) {
  11277. var eventManager = this.eventManager;
  11278. var sources = eventManager.querySources(sourceQuery);
  11279. var i;
  11280. eventManager.freeze();
  11281. for (i = 0; i < sources.length; i++) {
  11282. eventManager.removeSource(sources[i]);
  11283. }
  11284. eventManager.thaw();
  11285. };
  11286. Calendar.prototype.refetchEventSources = function (sourceMultiQuery) {
  11287. var eventManager = this.eventManager;
  11288. var sources = eventManager.multiQuerySources(sourceMultiQuery);
  11289. var i;
  11290. eventManager.freeze();
  11291. for (i = 0; i < sources.length; i++) {
  11292. eventManager.refetchSource(sources[i]);
  11293. }
  11294. eventManager.thaw();
  11295. };
  11296. // not for internal use. use options module directly instead.
  11297. Calendar.defaults = options_1.globalDefaults;
  11298. Calendar.englishDefaults = options_1.englishDefaults;
  11299. Calendar.rtlDefaults = options_1.rtlDefaults;
  11300. return Calendar;
  11301. }());
  11302. exports.default = Calendar;
  11303. EmitterMixin_1.default.mixInto(Calendar);
  11304. ListenerMixin_1.default.mixInto(Calendar);
  11305. function filterLegacyEventInstances(legacyEventInstances, legacyQuery) {
  11306. if (legacyQuery == null) {
  11307. return legacyEventInstances;
  11308. }
  11309. else if ($.isFunction(legacyQuery)) {
  11310. return legacyEventInstances.filter(legacyQuery);
  11311. }
  11312. else { // an event ID
  11313. legacyQuery += ''; // normalize to string
  11314. return legacyEventInstances.filter(function (legacyEventInstance) {
  11315. // soft comparison because id not be normalized to string
  11316. // tslint:disable-next-line
  11317. return legacyEventInstance.id == legacyQuery ||
  11318. legacyEventInstance._id === legacyQuery; // can specify internal id, but must exactly match
  11319. });
  11320. }
  11321. }
  11322. /***/ }),
  11323. /* 233 */
  11324. /***/ (function(module, exports, __webpack_require__) {
  11325. Object.defineProperty(exports, "__esModule", { value: true });
  11326. var tslib_1 = __webpack_require__(2);
  11327. var $ = __webpack_require__(3);
  11328. var moment = __webpack_require__(0);
  11329. var exportHooks = __webpack_require__(18);
  11330. var util_1 = __webpack_require__(4);
  11331. var moment_ext_1 = __webpack_require__(11);
  11332. var ListenerMixin_1 = __webpack_require__(7);
  11333. var HitDragListener_1 = __webpack_require__(17);
  11334. var SingleEventDef_1 = __webpack_require__(9);
  11335. var EventInstanceGroup_1 = __webpack_require__(20);
  11336. var EventSource_1 = __webpack_require__(6);
  11337. var Interaction_1 = __webpack_require__(14);
  11338. var ExternalDropping = /** @class */ (function (_super) {
  11339. tslib_1.__extends(ExternalDropping, _super);
  11340. function ExternalDropping() {
  11341. var _this = _super !== null && _super.apply(this, arguments) || this;
  11342. _this.isDragging = false; // jqui-dragging an external element? boolean
  11343. return _this;
  11344. }
  11345. /*
  11346. component impements:
  11347. - eventRangesToEventFootprints
  11348. - isEventInstanceGroupAllowed
  11349. - isExternalInstanceGroupAllowed
  11350. - renderDrag
  11351. - unrenderDrag
  11352. */
  11353. ExternalDropping.prototype.end = function () {
  11354. if (this.dragListener) {
  11355. this.dragListener.endInteraction();
  11356. }
  11357. };
  11358. ExternalDropping.prototype.bindToDocument = function () {
  11359. this.listenTo($(document), {
  11360. dragstart: this.handleDragStart,
  11361. sortstart: this.handleDragStart // jqui
  11362. });
  11363. };
  11364. ExternalDropping.prototype.unbindFromDocument = function () {
  11365. this.stopListeningTo($(document));
  11366. };
  11367. // Called when a jQuery UI drag is initiated anywhere in the DOM
  11368. ExternalDropping.prototype.handleDragStart = function (ev, ui) {
  11369. var el;
  11370. var accept;
  11371. if (this.opt('droppable')) { // only listen if this setting is on
  11372. el = $((ui ? ui.item : null) || ev.target);
  11373. // Test that the dragged element passes the dropAccept selector or filter function.
  11374. // FYI, the default is "*" (matches all)
  11375. accept = this.opt('dropAccept');
  11376. if ($.isFunction(accept) ? accept.call(el[0], el) : el.is(accept)) {
  11377. if (!this.isDragging) { // prevent double-listening if fired twice
  11378. this.listenToExternalDrag(el, ev, ui);
  11379. }
  11380. }
  11381. }
  11382. };
  11383. // Called when a jQuery UI drag starts and it needs to be monitored for dropping
  11384. ExternalDropping.prototype.listenToExternalDrag = function (el, ev, ui) {
  11385. var _this = this;
  11386. var component = this.component;
  11387. var view = this.view;
  11388. var meta = getDraggedElMeta(el); // extra data about event drop, including possible event to create
  11389. var singleEventDef; // a null value signals an unsuccessful drag
  11390. // listener that tracks mouse movement over date-associated pixel regions
  11391. var dragListener = this.dragListener = new HitDragListener_1.default(component, {
  11392. interactionStart: function () {
  11393. _this.isDragging = true;
  11394. },
  11395. hitOver: function (hit) {
  11396. var isAllowed = true;
  11397. var hitFootprint = hit.component.getSafeHitFootprint(hit); // hit might not belong to this grid
  11398. var mutatedEventInstanceGroup;
  11399. if (hitFootprint) {
  11400. singleEventDef = _this.computeExternalDrop(hitFootprint, meta);
  11401. if (singleEventDef) {
  11402. mutatedEventInstanceGroup = new EventInstanceGroup_1.default(singleEventDef.buildInstances());
  11403. isAllowed = meta.eventProps ? // isEvent?
  11404. component.isEventInstanceGroupAllowed(mutatedEventInstanceGroup) :
  11405. component.isExternalInstanceGroupAllowed(mutatedEventInstanceGroup);
  11406. }
  11407. else {
  11408. isAllowed = false;
  11409. }
  11410. }
  11411. else {
  11412. isAllowed = false;
  11413. }
  11414. if (!isAllowed) {
  11415. singleEventDef = null;
  11416. util_1.disableCursor();
  11417. }
  11418. if (singleEventDef) {
  11419. component.renderDrag(// called without a seg parameter
  11420. component.eventRangesToEventFootprints(mutatedEventInstanceGroup.sliceRenderRanges(component.dateProfile.renderUnzonedRange, view.calendar)));
  11421. }
  11422. },
  11423. hitOut: function () {
  11424. singleEventDef = null; // signal unsuccessful
  11425. },
  11426. hitDone: function () {
  11427. util_1.enableCursor();
  11428. component.unrenderDrag();
  11429. },
  11430. interactionEnd: function (ev) {
  11431. if (singleEventDef) { // element was dropped on a valid hit
  11432. view.reportExternalDrop(singleEventDef, Boolean(meta.eventProps), // isEvent
  11433. Boolean(meta.stick), // isSticky
  11434. el, ev, ui);
  11435. }
  11436. _this.isDragging = false;
  11437. _this.dragListener = null;
  11438. }
  11439. });
  11440. dragListener.startDrag(ev); // start listening immediately
  11441. };
  11442. // Given a hit to be dropped upon, and misc data associated with the jqui drag (guaranteed to be a plain object),
  11443. // returns the zoned start/end dates for the event that would result from the hypothetical drop. end might be null.
  11444. // Returning a null value signals an invalid drop hit.
  11445. // DOES NOT consider overlap/constraint.
  11446. // Assumes both footprints are non-open-ended.
  11447. ExternalDropping.prototype.computeExternalDrop = function (componentFootprint, meta) {
  11448. var calendar = this.view.calendar;
  11449. var start = moment_ext_1.default.utc(componentFootprint.unzonedRange.startMs).stripZone();
  11450. var end;
  11451. var eventDef;
  11452. if (componentFootprint.isAllDay) {
  11453. // if dropped on an all-day span, and element's metadata specified a time, set it
  11454. if (meta.startTime) {
  11455. start.time(meta.startTime);
  11456. }
  11457. else {
  11458. start.stripTime();
  11459. }
  11460. }
  11461. if (meta.duration) {
  11462. end = start.clone().add(meta.duration);
  11463. }
  11464. start = calendar.applyTimezone(start);
  11465. if (end) {
  11466. end = calendar.applyTimezone(end);
  11467. }
  11468. eventDef = SingleEventDef_1.default.parse($.extend({}, meta.eventProps, {
  11469. start: start,
  11470. end: end
  11471. }), new EventSource_1.default(calendar));
  11472. return eventDef;
  11473. };
  11474. return ExternalDropping;
  11475. }(Interaction_1.default));
  11476. exports.default = ExternalDropping;
  11477. ListenerMixin_1.default.mixInto(ExternalDropping);
  11478. /* External-Dragging-Element Data
  11479. ----------------------------------------------------------------------------------------------------------------------*/
  11480. // Require all HTML5 data-* attributes used by FullCalendar to have this prefix.
  11481. // A value of '' will query attributes like data-event. A value of 'fc' will query attributes like data-fc-event.
  11482. exportHooks.dataAttrPrefix = '';
  11483. // Given a jQuery element that might represent a dragged FullCalendar event, returns an intermediate data structure
  11484. // to be used for Event Object creation.
  11485. // A defined `.eventProps`, even when empty, indicates that an event should be created.
  11486. function getDraggedElMeta(el) {
  11487. var prefix = exportHooks.dataAttrPrefix;
  11488. var eventProps; // properties for creating the event, not related to date/time
  11489. var startTime; // a Duration
  11490. var duration;
  11491. var stick;
  11492. if (prefix) {
  11493. prefix += '-';
  11494. }
  11495. eventProps = el.data(prefix + 'event') || null;
  11496. if (eventProps) {
  11497. if (typeof eventProps === 'object') {
  11498. eventProps = $.extend({}, eventProps); // make a copy
  11499. }
  11500. else { // something like 1 or true. still signal event creation
  11501. eventProps = {};
  11502. }
  11503. // pluck special-cased date/time properties
  11504. startTime = eventProps.start;
  11505. if (startTime == null) {
  11506. startTime = eventProps.time;
  11507. } // accept 'time' as well
  11508. duration = eventProps.duration;
  11509. stick = eventProps.stick;
  11510. delete eventProps.start;
  11511. delete eventProps.time;
  11512. delete eventProps.duration;
  11513. delete eventProps.stick;
  11514. }
  11515. // fallback to standalone attribute values for each of the date/time properties
  11516. if (startTime == null) {
  11517. startTime = el.data(prefix + 'start');
  11518. }
  11519. if (startTime == null) {
  11520. startTime = el.data(prefix + 'time');
  11521. } // accept 'time' as well
  11522. if (duration == null) {
  11523. duration = el.data(prefix + 'duration');
  11524. }
  11525. if (stick == null) {
  11526. stick = el.data(prefix + 'stick');
  11527. }
  11528. // massage into correct data types
  11529. startTime = startTime != null ? moment.duration(startTime) : null;
  11530. duration = duration != null ? moment.duration(duration) : null;
  11531. stick = Boolean(stick);
  11532. return { eventProps: eventProps, startTime: startTime, duration: duration, stick: stick };
  11533. }
  11534. /***/ }),
  11535. /* 234 */
  11536. /***/ (function(module, exports, __webpack_require__) {
  11537. Object.defineProperty(exports, "__esModule", { value: true });
  11538. var tslib_1 = __webpack_require__(2);
  11539. var $ = __webpack_require__(3);
  11540. var util_1 = __webpack_require__(4);
  11541. var EventDefMutation_1 = __webpack_require__(39);
  11542. var EventDefDateMutation_1 = __webpack_require__(40);
  11543. var HitDragListener_1 = __webpack_require__(17);
  11544. var Interaction_1 = __webpack_require__(14);
  11545. var EventResizing = /** @class */ (function (_super) {
  11546. tslib_1.__extends(EventResizing, _super);
  11547. /*
  11548. component impements:
  11549. - bindSegHandlerToEl
  11550. - publiclyTrigger
  11551. - diffDates
  11552. - eventRangesToEventFootprints
  11553. - isEventInstanceGroupAllowed
  11554. - getSafeHitFootprint
  11555. */
  11556. function EventResizing(component, eventPointing) {
  11557. var _this = _super.call(this, component) || this;
  11558. _this.isResizing = false;
  11559. _this.eventPointing = eventPointing;
  11560. return _this;
  11561. }
  11562. EventResizing.prototype.end = function () {
  11563. if (this.dragListener) {
  11564. this.dragListener.endInteraction();
  11565. }
  11566. };
  11567. EventResizing.prototype.bindToEl = function (el) {
  11568. var component = this.component;
  11569. component.bindSegHandlerToEl(el, 'mousedown', this.handleMouseDown.bind(this));
  11570. component.bindSegHandlerToEl(el, 'touchstart', this.handleTouchStart.bind(this));
  11571. };
  11572. EventResizing.prototype.handleMouseDown = function (seg, ev) {
  11573. if (this.component.canStartResize(seg, ev)) {
  11574. this.buildDragListener(seg, $(ev.target).is('.fc-start-resizer'))
  11575. .startInteraction(ev, { distance: 5 });
  11576. }
  11577. };
  11578. EventResizing.prototype.handleTouchStart = function (seg, ev) {
  11579. if (this.component.canStartResize(seg, ev)) {
  11580. this.buildDragListener(seg, $(ev.target).is('.fc-start-resizer'))
  11581. .startInteraction(ev);
  11582. }
  11583. };
  11584. // Creates a listener that tracks the user as they resize an event segment.
  11585. // Generic enough to work with any type of Grid.
  11586. EventResizing.prototype.buildDragListener = function (seg, isStart) {
  11587. var _this = this;
  11588. var component = this.component;
  11589. var view = this.view;
  11590. var calendar = view.calendar;
  11591. var eventManager = calendar.eventManager;
  11592. var el = seg.el;
  11593. var eventDef = seg.footprint.eventDef;
  11594. var eventInstance = seg.footprint.eventInstance;
  11595. var isDragging;
  11596. var resizeMutation; // zoned event date properties. falsy if invalid resize
  11597. // Tracks mouse movement over the *grid's* coordinate map
  11598. var dragListener = this.dragListener = new HitDragListener_1.default(component, {
  11599. scroll: this.opt('dragScroll'),
  11600. subjectEl: el,
  11601. interactionStart: function () {
  11602. isDragging = false;
  11603. },
  11604. dragStart: function (ev) {
  11605. isDragging = true;
  11606. // ensure a mouseout on the manipulated event has been reported
  11607. _this.eventPointing.handleMouseout(seg, ev);
  11608. _this.segResizeStart(seg, ev);
  11609. },
  11610. hitOver: function (hit, isOrig, origHit) {
  11611. var isAllowed = true;
  11612. var origHitFootprint = component.getSafeHitFootprint(origHit);
  11613. var hitFootprint = component.getSafeHitFootprint(hit);
  11614. var mutatedEventInstanceGroup;
  11615. if (origHitFootprint && hitFootprint) {
  11616. resizeMutation = isStart ?
  11617. _this.computeEventStartResizeMutation(origHitFootprint, hitFootprint, seg.footprint) :
  11618. _this.computeEventEndResizeMutation(origHitFootprint, hitFootprint, seg.footprint);
  11619. if (resizeMutation) {
  11620. mutatedEventInstanceGroup = eventManager.buildMutatedEventInstanceGroup(eventDef.id, resizeMutation);
  11621. isAllowed = component.isEventInstanceGroupAllowed(mutatedEventInstanceGroup);
  11622. }
  11623. else {
  11624. isAllowed = false;
  11625. }
  11626. }
  11627. else {
  11628. isAllowed = false;
  11629. }
  11630. if (!isAllowed) {
  11631. resizeMutation = null;
  11632. util_1.disableCursor();
  11633. }
  11634. else if (resizeMutation.isEmpty()) {
  11635. // no change. (FYI, event dates might have zones)
  11636. resizeMutation = null;
  11637. }
  11638. if (resizeMutation) {
  11639. view.hideEventsWithId(seg.footprint.eventDef.id);
  11640. view.renderEventResize(component.eventRangesToEventFootprints(mutatedEventInstanceGroup.sliceRenderRanges(component.dateProfile.renderUnzonedRange, calendar)), seg);
  11641. }
  11642. },
  11643. hitOut: function () {
  11644. resizeMutation = null;
  11645. },
  11646. hitDone: function () {
  11647. view.unrenderEventResize(seg);
  11648. view.showEventsWithId(seg.footprint.eventDef.id);
  11649. util_1.enableCursor();
  11650. },
  11651. interactionEnd: function (ev) {
  11652. if (isDragging) {
  11653. _this.segResizeStop(seg, ev);
  11654. }
  11655. if (resizeMutation) { // valid date to resize to?
  11656. // no need to re-show original, will rerender all anyways. esp important if eventRenderWait
  11657. view.reportEventResize(eventInstance, resizeMutation, el, ev);
  11658. }
  11659. _this.dragListener = null;
  11660. }
  11661. });
  11662. return dragListener;
  11663. };
  11664. // Called before event segment resizing starts
  11665. EventResizing.prototype.segResizeStart = function (seg, ev) {
  11666. this.isResizing = true;
  11667. this.component.publiclyTrigger('eventResizeStart', {
  11668. context: seg.el[0],
  11669. args: [
  11670. seg.footprint.getEventLegacy(),
  11671. ev,
  11672. {},
  11673. this.view
  11674. ]
  11675. });
  11676. };
  11677. // Called after event segment resizing stops
  11678. EventResizing.prototype.segResizeStop = function (seg, ev) {
  11679. this.isResizing = false;
  11680. this.component.publiclyTrigger('eventResizeStop', {
  11681. context: seg.el[0],
  11682. args: [
  11683. seg.footprint.getEventLegacy(),
  11684. ev,
  11685. {},
  11686. this.view
  11687. ]
  11688. });
  11689. };
  11690. // Returns new date-information for an event segment being resized from its start
  11691. EventResizing.prototype.computeEventStartResizeMutation = function (startFootprint, endFootprint, origEventFootprint) {
  11692. var origRange = origEventFootprint.componentFootprint.unzonedRange;
  11693. var startDelta = this.component.diffDates(endFootprint.unzonedRange.getStart(), startFootprint.unzonedRange.getStart());
  11694. var dateMutation;
  11695. var eventDefMutation;
  11696. if (origRange.getStart().add(startDelta) < origRange.getEnd()) {
  11697. dateMutation = new EventDefDateMutation_1.default();
  11698. dateMutation.setStartDelta(startDelta);
  11699. eventDefMutation = new EventDefMutation_1.default();
  11700. eventDefMutation.setDateMutation(dateMutation);
  11701. return eventDefMutation;
  11702. }
  11703. return false;
  11704. };
  11705. // Returns new date-information for an event segment being resized from its end
  11706. EventResizing.prototype.computeEventEndResizeMutation = function (startFootprint, endFootprint, origEventFootprint) {
  11707. var origRange = origEventFootprint.componentFootprint.unzonedRange;
  11708. var endDelta = this.component.diffDates(endFootprint.unzonedRange.getEnd(), startFootprint.unzonedRange.getEnd());
  11709. var dateMutation;
  11710. var eventDefMutation;
  11711. if (origRange.getEnd().add(endDelta) > origRange.getStart()) {
  11712. dateMutation = new EventDefDateMutation_1.default();
  11713. dateMutation.setEndDelta(endDelta);
  11714. eventDefMutation = new EventDefMutation_1.default();
  11715. eventDefMutation.setDateMutation(dateMutation);
  11716. return eventDefMutation;
  11717. }
  11718. return false;
  11719. };
  11720. return EventResizing;
  11721. }(Interaction_1.default));
  11722. exports.default = EventResizing;
  11723. /***/ }),
  11724. /* 235 */
  11725. /***/ (function(module, exports, __webpack_require__) {
  11726. Object.defineProperty(exports, "__esModule", { value: true });
  11727. var tslib_1 = __webpack_require__(2);
  11728. var util_1 = __webpack_require__(4);
  11729. var EventDefMutation_1 = __webpack_require__(39);
  11730. var EventDefDateMutation_1 = __webpack_require__(40);
  11731. var DragListener_1 = __webpack_require__(59);
  11732. var HitDragListener_1 = __webpack_require__(17);
  11733. var MouseFollower_1 = __webpack_require__(226);
  11734. var Interaction_1 = __webpack_require__(14);
  11735. var EventDragging = /** @class */ (function (_super) {
  11736. tslib_1.__extends(EventDragging, _super);
  11737. /*
  11738. component implements:
  11739. - bindSegHandlerToEl
  11740. - publiclyTrigger
  11741. - diffDates
  11742. - eventRangesToEventFootprints
  11743. - isEventInstanceGroupAllowed
  11744. */
  11745. function EventDragging(component, eventPointing) {
  11746. var _this = _super.call(this, component) || this;
  11747. _this.isDragging = false;
  11748. _this.eventPointing = eventPointing;
  11749. return _this;
  11750. }
  11751. EventDragging.prototype.end = function () {
  11752. if (this.dragListener) {
  11753. this.dragListener.endInteraction();
  11754. }
  11755. };
  11756. EventDragging.prototype.getSelectionDelay = function () {
  11757. var delay = this.opt('eventLongPressDelay');
  11758. if (delay == null) {
  11759. delay = this.opt('longPressDelay'); // fallback
  11760. }
  11761. return delay;
  11762. };
  11763. EventDragging.prototype.bindToEl = function (el) {
  11764. var component = this.component;
  11765. component.bindSegHandlerToEl(el, 'mousedown', this.handleMousedown.bind(this));
  11766. component.bindSegHandlerToEl(el, 'touchstart', this.handleTouchStart.bind(this));
  11767. };
  11768. EventDragging.prototype.handleMousedown = function (seg, ev) {
  11769. if (!this.component.shouldIgnoreMouse() &&
  11770. this.component.canStartDrag(seg, ev)) {
  11771. this.buildDragListener(seg).startInteraction(ev, { distance: 5 });
  11772. }
  11773. };
  11774. EventDragging.prototype.handleTouchStart = function (seg, ev) {
  11775. var component = this.component;
  11776. var settings = {
  11777. delay: this.view.isEventDefSelected(seg.footprint.eventDef) ? // already selected?
  11778. 0 : this.getSelectionDelay()
  11779. };
  11780. if (component.canStartDrag(seg, ev)) {
  11781. this.buildDragListener(seg).startInteraction(ev, settings);
  11782. }
  11783. else if (component.canStartSelection(seg, ev)) {
  11784. this.buildSelectListener(seg).startInteraction(ev, settings);
  11785. }
  11786. };
  11787. // seg isn't draggable, but let's use a generic DragListener
  11788. // simply for the delay, so it can be selected.
  11789. // Has side effect of setting/unsetting `dragListener`
  11790. EventDragging.prototype.buildSelectListener = function (seg) {
  11791. var _this = this;
  11792. var view = this.view;
  11793. var eventDef = seg.footprint.eventDef;
  11794. var eventInstance = seg.footprint.eventInstance; // null for inverse-background events
  11795. if (this.dragListener) {
  11796. return this.dragListener;
  11797. }
  11798. var dragListener = this.dragListener = new DragListener_1.default({
  11799. dragStart: function (ev) {
  11800. if (dragListener.isTouch &&
  11801. !view.isEventDefSelected(eventDef) &&
  11802. eventInstance) {
  11803. // if not previously selected, will fire after a delay. then, select the event
  11804. view.selectEventInstance(eventInstance);
  11805. }
  11806. },
  11807. interactionEnd: function (ev) {
  11808. _this.dragListener = null;
  11809. }
  11810. });
  11811. return dragListener;
  11812. };
  11813. // Builds a listener that will track user-dragging on an event segment.
  11814. // Generic enough to work with any type of Grid.
  11815. // Has side effect of setting/unsetting `dragListener`
  11816. EventDragging.prototype.buildDragListener = function (seg) {
  11817. var _this = this;
  11818. var component = this.component;
  11819. var view = this.view;
  11820. var calendar = view.calendar;
  11821. var eventManager = calendar.eventManager;
  11822. var el = seg.el;
  11823. var eventDef = seg.footprint.eventDef;
  11824. var eventInstance = seg.footprint.eventInstance; // null for inverse-background events
  11825. var isDragging;
  11826. var mouseFollower; // A clone of the original element that will move with the mouse
  11827. var eventDefMutation;
  11828. if (this.dragListener) {
  11829. return this.dragListener;
  11830. }
  11831. // Tracks mouse movement over the *view's* coordinate map. Allows dragging and dropping between subcomponents
  11832. // of the view.
  11833. var dragListener = this.dragListener = new HitDragListener_1.default(view, {
  11834. scroll: this.opt('dragScroll'),
  11835. subjectEl: el,
  11836. subjectCenter: true,
  11837. interactionStart: function (ev) {
  11838. seg.component = component; // for renderDrag
  11839. isDragging = false;
  11840. mouseFollower = new MouseFollower_1.default(seg.el, {
  11841. additionalClass: 'fc-dragging',
  11842. parentEl: view.el,
  11843. opacity: dragListener.isTouch ? null : _this.opt('dragOpacity'),
  11844. revertDuration: _this.opt('dragRevertDuration'),
  11845. zIndex: 2 // one above the .fc-view
  11846. });
  11847. mouseFollower.hide(); // don't show until we know this is a real drag
  11848. mouseFollower.start(ev);
  11849. },
  11850. dragStart: function (ev) {
  11851. if (dragListener.isTouch &&
  11852. !view.isEventDefSelected(eventDef) &&
  11853. eventInstance) {
  11854. // if not previously selected, will fire after a delay. then, select the event
  11855. view.selectEventInstance(eventInstance);
  11856. }
  11857. isDragging = true;
  11858. // ensure a mouseout on the manipulated event has been reported
  11859. _this.eventPointing.handleMouseout(seg, ev);
  11860. _this.segDragStart(seg, ev);
  11861. view.hideEventsWithId(seg.footprint.eventDef.id);
  11862. },
  11863. hitOver: function (hit, isOrig, origHit) {
  11864. var isAllowed = true;
  11865. var origFootprint;
  11866. var footprint;
  11867. var mutatedEventInstanceGroup;
  11868. // starting hit could be forced (DayGrid.limit)
  11869. if (seg.hit) {
  11870. origHit = seg.hit;
  11871. }
  11872. // hit might not belong to this grid, so query origin grid
  11873. origFootprint = origHit.component.getSafeHitFootprint(origHit);
  11874. footprint = hit.component.getSafeHitFootprint(hit);
  11875. if (origFootprint && footprint) {
  11876. eventDefMutation = _this.computeEventDropMutation(origFootprint, footprint, eventDef);
  11877. if (eventDefMutation) {
  11878. mutatedEventInstanceGroup = eventManager.buildMutatedEventInstanceGroup(eventDef.id, eventDefMutation);
  11879. isAllowed = component.isEventInstanceGroupAllowed(mutatedEventInstanceGroup);
  11880. }
  11881. else {
  11882. isAllowed = false;
  11883. }
  11884. }
  11885. else {
  11886. isAllowed = false;
  11887. }
  11888. if (!isAllowed) {
  11889. eventDefMutation = null;
  11890. util_1.disableCursor();
  11891. }
  11892. // if a valid drop location, have the subclass render a visual indication
  11893. if (eventDefMutation &&
  11894. view.renderDrag(// truthy if rendered something
  11895. component.eventRangesToEventFootprints(mutatedEventInstanceGroup.sliceRenderRanges(component.dateProfile.renderUnzonedRange, calendar)), seg, dragListener.isTouch)) {
  11896. mouseFollower.hide(); // if the subclass is already using a mock event "helper", hide our own
  11897. }
  11898. else {
  11899. mouseFollower.show(); // otherwise, have the helper follow the mouse (no snapping)
  11900. }
  11901. if (isOrig) {
  11902. // needs to have moved hits to be a valid drop
  11903. eventDefMutation = null;
  11904. }
  11905. },
  11906. hitOut: function () {
  11907. view.unrenderDrag(seg); // unrender whatever was done in renderDrag
  11908. mouseFollower.show(); // show in case we are moving out of all hits
  11909. eventDefMutation = null;
  11910. },
  11911. hitDone: function () {
  11912. util_1.enableCursor();
  11913. },
  11914. interactionEnd: function (ev) {
  11915. delete seg.component; // prevent side effects
  11916. // do revert animation if hasn't changed. calls a callback when finished (whether animation or not)
  11917. mouseFollower.stop(!eventDefMutation, function () {
  11918. if (isDragging) {
  11919. view.unrenderDrag(seg);
  11920. _this.segDragStop(seg, ev);
  11921. }
  11922. view.showEventsWithId(seg.footprint.eventDef.id);
  11923. if (eventDefMutation) {
  11924. // no need to re-show original, will rerender all anyways. esp important if eventRenderWait
  11925. view.reportEventDrop(eventInstance, eventDefMutation, el, ev);
  11926. }
  11927. });
  11928. _this.dragListener = null;
  11929. }
  11930. });
  11931. return dragListener;
  11932. };
  11933. // Called before event segment dragging starts
  11934. EventDragging.prototype.segDragStart = function (seg, ev) {
  11935. this.isDragging = true;
  11936. this.component.publiclyTrigger('eventDragStart', {
  11937. context: seg.el[0],
  11938. args: [
  11939. seg.footprint.getEventLegacy(),
  11940. ev,
  11941. {},
  11942. this.view
  11943. ]
  11944. });
  11945. };
  11946. // Called after event segment dragging stops
  11947. EventDragging.prototype.segDragStop = function (seg, ev) {
  11948. this.isDragging = false;
  11949. this.component.publiclyTrigger('eventDragStop', {
  11950. context: seg.el[0],
  11951. args: [
  11952. seg.footprint.getEventLegacy(),
  11953. ev,
  11954. {},
  11955. this.view
  11956. ]
  11957. });
  11958. };
  11959. // DOES NOT consider overlap/constraint
  11960. EventDragging.prototype.computeEventDropMutation = function (startFootprint, endFootprint, eventDef) {
  11961. var eventDefMutation = new EventDefMutation_1.default();
  11962. eventDefMutation.setDateMutation(this.computeEventDateMutation(startFootprint, endFootprint));
  11963. return eventDefMutation;
  11964. };
  11965. EventDragging.prototype.computeEventDateMutation = function (startFootprint, endFootprint) {
  11966. var date0 = startFootprint.unzonedRange.getStart();
  11967. var date1 = endFootprint.unzonedRange.getStart();
  11968. var clearEnd = false;
  11969. var forceTimed = false;
  11970. var forceAllDay = false;
  11971. var dateDelta;
  11972. var dateMutation;
  11973. if (startFootprint.isAllDay !== endFootprint.isAllDay) {
  11974. clearEnd = true;
  11975. if (endFootprint.isAllDay) {
  11976. forceAllDay = true;
  11977. date0.stripTime();
  11978. }
  11979. else {
  11980. forceTimed = true;
  11981. }
  11982. }
  11983. dateDelta = this.component.diffDates(date1, date0);
  11984. dateMutation = new EventDefDateMutation_1.default();
  11985. dateMutation.clearEnd = clearEnd;
  11986. dateMutation.forceTimed = forceTimed;
  11987. dateMutation.forceAllDay = forceAllDay;
  11988. dateMutation.setDateDelta(dateDelta);
  11989. return dateMutation;
  11990. };
  11991. return EventDragging;
  11992. }(Interaction_1.default));
  11993. exports.default = EventDragging;
  11994. /***/ }),
  11995. /* 236 */
  11996. /***/ (function(module, exports, __webpack_require__) {
  11997. Object.defineProperty(exports, "__esModule", { value: true });
  11998. var tslib_1 = __webpack_require__(2);
  11999. var util_1 = __webpack_require__(4);
  12000. var HitDragListener_1 = __webpack_require__(17);
  12001. var ComponentFootprint_1 = __webpack_require__(12);
  12002. var UnzonedRange_1 = __webpack_require__(5);
  12003. var Interaction_1 = __webpack_require__(14);
  12004. var DateSelecting = /** @class */ (function (_super) {
  12005. tslib_1.__extends(DateSelecting, _super);
  12006. /*
  12007. component must implement:
  12008. - bindDateHandlerToEl
  12009. - getSafeHitFootprint
  12010. - renderHighlight
  12011. - unrenderHighlight
  12012. */
  12013. function DateSelecting(component) {
  12014. var _this = _super.call(this, component) || this;
  12015. _this.dragListener = _this.buildDragListener();
  12016. return _this;
  12017. }
  12018. DateSelecting.prototype.end = function () {
  12019. this.dragListener.endInteraction();
  12020. };
  12021. DateSelecting.prototype.getDelay = function () {
  12022. var delay = this.opt('selectLongPressDelay');
  12023. if (delay == null) {
  12024. delay = this.opt('longPressDelay'); // fallback
  12025. }
  12026. return delay;
  12027. };
  12028. DateSelecting.prototype.bindToEl = function (el) {
  12029. var _this = this;
  12030. var component = this.component;
  12031. var dragListener = this.dragListener;
  12032. component.bindDateHandlerToEl(el, 'mousedown', function (ev) {
  12033. if (_this.opt('selectable') && !component.shouldIgnoreMouse()) {
  12034. dragListener.startInteraction(ev, {
  12035. distance: _this.opt('selectMinDistance')
  12036. });
  12037. }
  12038. });
  12039. component.bindDateHandlerToEl(el, 'touchstart', function (ev) {
  12040. if (_this.opt('selectable') && !component.shouldIgnoreTouch()) {
  12041. dragListener.startInteraction(ev, {
  12042. delay: _this.getDelay()
  12043. });
  12044. }
  12045. });
  12046. util_1.preventSelection(el);
  12047. };
  12048. // Creates a listener that tracks the user's drag across day elements, for day selecting.
  12049. DateSelecting.prototype.buildDragListener = function () {
  12050. var _this = this;
  12051. var component = this.component;
  12052. var selectionFootprint; // null if invalid selection
  12053. var dragListener = new HitDragListener_1.default(component, {
  12054. scroll: this.opt('dragScroll'),
  12055. interactionStart: function () {
  12056. selectionFootprint = null;
  12057. },
  12058. dragStart: function (ev) {
  12059. _this.view.unselect(ev); // since we could be rendering a new selection, we want to clear any old one
  12060. },
  12061. hitOver: function (hit, isOrig, origHit) {
  12062. var origHitFootprint;
  12063. var hitFootprint;
  12064. if (origHit) { // click needs to have started on a hit
  12065. origHitFootprint = component.getSafeHitFootprint(origHit);
  12066. hitFootprint = component.getSafeHitFootprint(hit);
  12067. if (origHitFootprint && hitFootprint) {
  12068. selectionFootprint = _this.computeSelection(origHitFootprint, hitFootprint);
  12069. }
  12070. else {
  12071. selectionFootprint = null;
  12072. }
  12073. if (selectionFootprint) {
  12074. component.renderSelectionFootprint(selectionFootprint);
  12075. }
  12076. else if (selectionFootprint === false) {
  12077. util_1.disableCursor();
  12078. }
  12079. }
  12080. },
  12081. hitOut: function () {
  12082. selectionFootprint = null;
  12083. component.unrenderSelection();
  12084. },
  12085. hitDone: function () {
  12086. util_1.enableCursor();
  12087. },
  12088. interactionEnd: function (ev, isCancelled) {
  12089. if (!isCancelled && selectionFootprint) {
  12090. // the selection will already have been rendered. just report it
  12091. _this.view.reportSelection(selectionFootprint, ev);
  12092. }
  12093. }
  12094. });
  12095. return dragListener;
  12096. };
  12097. // Given the first and last date-spans of a selection, returns another date-span object.
  12098. // Subclasses can override and provide additional data in the span object. Will be passed to renderSelectionFootprint().
  12099. // Will return false if the selection is invalid and this should be indicated to the user.
  12100. // Will return null/undefined if a selection invalid but no error should be reported.
  12101. DateSelecting.prototype.computeSelection = function (footprint0, footprint1) {
  12102. var wholeFootprint = this.computeSelectionFootprint(footprint0, footprint1);
  12103. if (wholeFootprint && !this.isSelectionFootprintAllowed(wholeFootprint)) {
  12104. return false;
  12105. }
  12106. return wholeFootprint;
  12107. };
  12108. // Given two spans, must return the combination of the two.
  12109. // TODO: do this separation of concerns (combining VS validation) for event dnd/resize too.
  12110. // Assumes both footprints are non-open-ended.
  12111. DateSelecting.prototype.computeSelectionFootprint = function (footprint0, footprint1) {
  12112. var ms = [
  12113. footprint0.unzonedRange.startMs,
  12114. footprint0.unzonedRange.endMs,
  12115. footprint1.unzonedRange.startMs,
  12116. footprint1.unzonedRange.endMs
  12117. ];
  12118. ms.sort(util_1.compareNumbers);
  12119. return new ComponentFootprint_1.default(new UnzonedRange_1.default(ms[0], ms[3]), footprint0.isAllDay);
  12120. };
  12121. DateSelecting.prototype.isSelectionFootprintAllowed = function (componentFootprint) {
  12122. return this.component.dateProfile.validUnzonedRange.containsRange(componentFootprint.unzonedRange) &&
  12123. this.view.calendar.constraints.isSelectionFootprintAllowed(componentFootprint);
  12124. };
  12125. return DateSelecting;
  12126. }(Interaction_1.default));
  12127. exports.default = DateSelecting;
  12128. /***/ }),
  12129. /* 237 */
  12130. /***/ (function(module, exports, __webpack_require__) {
  12131. Object.defineProperty(exports, "__esModule", { value: true });
  12132. var tslib_1 = __webpack_require__(2);
  12133. var HitDragListener_1 = __webpack_require__(17);
  12134. var Interaction_1 = __webpack_require__(14);
  12135. var DateClicking = /** @class */ (function (_super) {
  12136. tslib_1.__extends(DateClicking, _super);
  12137. /*
  12138. component must implement:
  12139. - bindDateHandlerToEl
  12140. - getSafeHitFootprint
  12141. - getHitEl
  12142. */
  12143. function DateClicking(component) {
  12144. var _this = _super.call(this, component) || this;
  12145. _this.dragListener = _this.buildDragListener();
  12146. return _this;
  12147. }
  12148. DateClicking.prototype.end = function () {
  12149. this.dragListener.endInteraction();
  12150. };
  12151. DateClicking.prototype.bindToEl = function (el) {
  12152. var component = this.component;
  12153. var dragListener = this.dragListener;
  12154. component.bindDateHandlerToEl(el, 'mousedown', function (ev) {
  12155. if (!component.shouldIgnoreMouse()) {
  12156. dragListener.startInteraction(ev);
  12157. }
  12158. });
  12159. component.bindDateHandlerToEl(el, 'touchstart', function (ev) {
  12160. if (!component.shouldIgnoreTouch()) {
  12161. dragListener.startInteraction(ev);
  12162. }
  12163. });
  12164. };
  12165. // Creates a listener that tracks the user's drag across day elements, for day clicking.
  12166. DateClicking.prototype.buildDragListener = function () {
  12167. var _this = this;
  12168. var component = this.component;
  12169. var dayClickHit; // null if invalid dayClick
  12170. var dragListener = new HitDragListener_1.default(component, {
  12171. scroll: this.opt('dragScroll'),
  12172. interactionStart: function () {
  12173. dayClickHit = dragListener.origHit;
  12174. },
  12175. hitOver: function (hit, isOrig, origHit) {
  12176. // if user dragged to another cell at any point, it can no longer be a dayClick
  12177. if (!isOrig) {
  12178. dayClickHit = null;
  12179. }
  12180. },
  12181. hitOut: function () {
  12182. dayClickHit = null;
  12183. },
  12184. interactionEnd: function (ev, isCancelled) {
  12185. var componentFootprint;
  12186. if (!isCancelled && dayClickHit) {
  12187. componentFootprint = component.getSafeHitFootprint(dayClickHit);
  12188. if (componentFootprint) {
  12189. _this.view.triggerDayClick(componentFootprint, component.getHitEl(dayClickHit), ev);
  12190. }
  12191. }
  12192. }
  12193. });
  12194. // because dragListener won't be called with any time delay, "dragging" will begin immediately,
  12195. // which will kill any touchmoving/scrolling. Prevent this.
  12196. dragListener.shouldCancelTouchScroll = false;
  12197. dragListener.scrollAlwaysKills = true;
  12198. return dragListener;
  12199. };
  12200. return DateClicking;
  12201. }(Interaction_1.default));
  12202. exports.default = DateClicking;
  12203. /***/ }),
  12204. /* 238 */
  12205. /***/ (function(module, exports, __webpack_require__) {
  12206. Object.defineProperty(exports, "__esModule", { value: true });
  12207. var tslib_1 = __webpack_require__(2);
  12208. var moment = __webpack_require__(0);
  12209. var $ = __webpack_require__(3);
  12210. var util_1 = __webpack_require__(4);
  12211. var Scroller_1 = __webpack_require__(41);
  12212. var View_1 = __webpack_require__(43);
  12213. var TimeGrid_1 = __webpack_require__(239);
  12214. var DayGrid_1 = __webpack_require__(66);
  12215. var AGENDA_ALL_DAY_EVENT_LIMIT = 5;
  12216. var agendaTimeGridMethods;
  12217. var agendaDayGridMethods;
  12218. /* An abstract class for all agenda-related views. Displays one more columns with time slots running vertically.
  12219. ----------------------------------------------------------------------------------------------------------------------*/
  12220. // Is a manager for the TimeGrid subcomponent and possibly the DayGrid subcomponent (if allDaySlot is on).
  12221. // Responsible for managing width/height.
  12222. var AgendaView = /** @class */ (function (_super) {
  12223. tslib_1.__extends(AgendaView, _super);
  12224. function AgendaView(calendar, viewSpec) {
  12225. var _this = _super.call(this, calendar, viewSpec) || this;
  12226. _this.usesMinMaxTime = true; // indicates that minTime/maxTime affects rendering
  12227. _this.timeGrid = _this.instantiateTimeGrid();
  12228. _this.addChild(_this.timeGrid);
  12229. if (_this.opt('allDaySlot')) { // should we display the "all-day" area?
  12230. _this.dayGrid = _this.instantiateDayGrid(); // the all-day subcomponent of this view
  12231. _this.addChild(_this.dayGrid);
  12232. }
  12233. _this.scroller = new Scroller_1.default({
  12234. overflowX: 'hidden',
  12235. overflowY: 'auto'
  12236. });
  12237. return _this;
  12238. }
  12239. // Instantiates the TimeGrid object this view needs. Draws from this.timeGridClass
  12240. AgendaView.prototype.instantiateTimeGrid = function () {
  12241. var timeGrid = new this.timeGridClass(this);
  12242. util_1.copyOwnProps(agendaTimeGridMethods, timeGrid);
  12243. return timeGrid;
  12244. };
  12245. // Instantiates the DayGrid object this view might need. Draws from this.dayGridClass
  12246. AgendaView.prototype.instantiateDayGrid = function () {
  12247. var dayGrid = new this.dayGridClass(this);
  12248. util_1.copyOwnProps(agendaDayGridMethods, dayGrid);
  12249. return dayGrid;
  12250. };
  12251. /* Rendering
  12252. ------------------------------------------------------------------------------------------------------------------*/
  12253. AgendaView.prototype.renderSkeleton = function () {
  12254. var timeGridWrapEl;
  12255. var timeGridEl;
  12256. this.el.addClass('fc-agenda-view').html(this.renderSkeletonHtml());
  12257. this.scroller.render();
  12258. timeGridWrapEl = this.scroller.el.addClass('fc-time-grid-container');
  12259. timeGridEl = $('<div class="fc-time-grid">').appendTo(timeGridWrapEl);
  12260. this.el.find('.fc-body > tr > td').append(timeGridWrapEl);
  12261. this.timeGrid.headContainerEl = this.el.find('.fc-head-container');
  12262. this.timeGrid.setElement(timeGridEl);
  12263. if (this.dayGrid) {
  12264. this.dayGrid.setElement(this.el.find('.fc-day-grid'));
  12265. // have the day-grid extend it's coordinate area over the <hr> dividing the two grids
  12266. this.dayGrid.bottomCoordPadding = this.dayGrid.el.next('hr').outerHeight();
  12267. }
  12268. };
  12269. AgendaView.prototype.unrenderSkeleton = function () {
  12270. this.timeGrid.removeElement();
  12271. if (this.dayGrid) {
  12272. this.dayGrid.removeElement();
  12273. }
  12274. this.scroller.destroy();
  12275. };
  12276. // Builds the HTML skeleton for the view.
  12277. // The day-grid and time-grid components will render inside containers defined by this HTML.
  12278. AgendaView.prototype.renderSkeletonHtml = function () {
  12279. var theme = this.calendar.theme;
  12280. return '' +
  12281. '<table class="' + theme.getClass('tableGrid') + '">' +
  12282. (this.opt('columnHeader') ?
  12283. '<thead class="fc-head">' +
  12284. '<tr>' +
  12285. '<td class="fc-head-container ' + theme.getClass('widgetHeader') + '">&nbsp;</td>' +
  12286. '</tr>' +
  12287. '</thead>' :
  12288. '') +
  12289. '<tbody class="fc-body">' +
  12290. '<tr>' +
  12291. '<td class="' + theme.getClass('widgetContent') + '">' +
  12292. (this.dayGrid ?
  12293. '<div class="fc-day-grid"></div>' +
  12294. '<hr class="fc-divider ' + theme.getClass('widgetHeader') + '"></hr>' :
  12295. '') +
  12296. '</td>' +
  12297. '</tr>' +
  12298. '</tbody>' +
  12299. '</table>';
  12300. };
  12301. // Generates an HTML attribute string for setting the width of the axis, if it is known
  12302. AgendaView.prototype.axisStyleAttr = function () {
  12303. if (this.axisWidth != null) {
  12304. return 'style="width:' + this.axisWidth + 'px"';
  12305. }
  12306. return '';
  12307. };
  12308. /* Now Indicator
  12309. ------------------------------------------------------------------------------------------------------------------*/
  12310. AgendaView.prototype.getNowIndicatorUnit = function () {
  12311. return this.timeGrid.getNowIndicatorUnit();
  12312. };
  12313. /* Dimensions
  12314. ------------------------------------------------------------------------------------------------------------------*/
  12315. // Adjusts the vertical dimensions of the view to the specified values
  12316. AgendaView.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  12317. var eventLimit;
  12318. var scrollerHeight;
  12319. var scrollbarWidths;
  12320. _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
  12321. // make all axis cells line up, and record the width so newly created axis cells will have it
  12322. this.axisWidth = util_1.matchCellWidths(this.el.find('.fc-axis'));
  12323. // hack to give the view some height prior to timeGrid's columns being rendered
  12324. // TODO: separate setting height from scroller VS timeGrid.
  12325. if (!this.timeGrid.colEls) {
  12326. if (!isAuto) {
  12327. scrollerHeight = this.computeScrollerHeight(totalHeight);
  12328. this.scroller.setHeight(scrollerHeight);
  12329. }
  12330. return;
  12331. }
  12332. // set of fake row elements that must compensate when scroller has scrollbars
  12333. var noScrollRowEls = this.el.find('.fc-row:not(.fc-scroller *)');
  12334. // reset all dimensions back to the original state
  12335. this.timeGrid.bottomRuleEl.hide(); // .show() will be called later if this <hr> is necessary
  12336. this.scroller.clear(); // sets height to 'auto' and clears overflow
  12337. util_1.uncompensateScroll(noScrollRowEls);
  12338. // limit number of events in the all-day area
  12339. if (this.dayGrid) {
  12340. this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed
  12341. eventLimit = this.opt('eventLimit');
  12342. if (eventLimit && typeof eventLimit !== 'number') {
  12343. eventLimit = AGENDA_ALL_DAY_EVENT_LIMIT; // make sure "auto" goes to a real number
  12344. }
  12345. if (eventLimit) {
  12346. this.dayGrid.limitRows(eventLimit);
  12347. }
  12348. }
  12349. if (!isAuto) { // should we force dimensions of the scroll container?
  12350. scrollerHeight = this.computeScrollerHeight(totalHeight);
  12351. this.scroller.setHeight(scrollerHeight);
  12352. scrollbarWidths = this.scroller.getScrollbarWidths();
  12353. if (scrollbarWidths.left || scrollbarWidths.right) { // using scrollbars?
  12354. // make the all-day and header rows lines up
  12355. util_1.compensateScroll(noScrollRowEls, scrollbarWidths);
  12356. // the scrollbar compensation might have changed text flow, which might affect height, so recalculate
  12357. // and reapply the desired height to the scroller.
  12358. scrollerHeight = this.computeScrollerHeight(totalHeight);
  12359. this.scroller.setHeight(scrollerHeight);
  12360. }
  12361. // guarantees the same scrollbar widths
  12362. this.scroller.lockOverflow(scrollbarWidths);
  12363. // if there's any space below the slats, show the horizontal rule.
  12364. // this won't cause any new overflow, because lockOverflow already called.
  12365. if (this.timeGrid.getTotalSlatHeight() < scrollerHeight) {
  12366. this.timeGrid.bottomRuleEl.show();
  12367. }
  12368. }
  12369. };
  12370. // given a desired total height of the view, returns what the height of the scroller should be
  12371. AgendaView.prototype.computeScrollerHeight = function (totalHeight) {
  12372. return totalHeight -
  12373. util_1.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
  12374. };
  12375. /* Scroll
  12376. ------------------------------------------------------------------------------------------------------------------*/
  12377. // Computes the initial pre-configured scroll state prior to allowing the user to change it
  12378. AgendaView.prototype.computeInitialDateScroll = function () {
  12379. var scrollTime = moment.duration(this.opt('scrollTime'));
  12380. var top = this.timeGrid.computeTimeTop(scrollTime);
  12381. // zoom can give weird floating-point values. rather scroll a little bit further
  12382. top = Math.ceil(top);
  12383. if (top) {
  12384. top++; // to overcome top border that slots beyond the first have. looks better
  12385. }
  12386. return { top: top };
  12387. };
  12388. AgendaView.prototype.queryDateScroll = function () {
  12389. return { top: this.scroller.getScrollTop() };
  12390. };
  12391. AgendaView.prototype.applyDateScroll = function (scroll) {
  12392. if (scroll.top !== undefined) {
  12393. this.scroller.setScrollTop(scroll.top);
  12394. }
  12395. };
  12396. /* Hit Areas
  12397. ------------------------------------------------------------------------------------------------------------------*/
  12398. // forward all hit-related method calls to the grids (dayGrid might not be defined)
  12399. AgendaView.prototype.getHitFootprint = function (hit) {
  12400. // TODO: hit.component is set as a hack to identify where the hit came from
  12401. return hit.component.getHitFootprint(hit);
  12402. };
  12403. AgendaView.prototype.getHitEl = function (hit) {
  12404. // TODO: hit.component is set as a hack to identify where the hit came from
  12405. return hit.component.getHitEl(hit);
  12406. };
  12407. /* Event Rendering
  12408. ------------------------------------------------------------------------------------------------------------------*/
  12409. AgendaView.prototype.executeEventRender = function (eventsPayload) {
  12410. var dayEventsPayload = {};
  12411. var timedEventsPayload = {};
  12412. var id;
  12413. var eventInstanceGroup;
  12414. // separate the events into all-day and timed
  12415. for (id in eventsPayload) {
  12416. eventInstanceGroup = eventsPayload[id];
  12417. if (eventInstanceGroup.getEventDef().isAllDay()) {
  12418. dayEventsPayload[id] = eventInstanceGroup;
  12419. }
  12420. else {
  12421. timedEventsPayload[id] = eventInstanceGroup;
  12422. }
  12423. }
  12424. this.timeGrid.executeEventRender(timedEventsPayload);
  12425. if (this.dayGrid) {
  12426. this.dayGrid.executeEventRender(dayEventsPayload);
  12427. }
  12428. };
  12429. /* Dragging/Resizing Routing
  12430. ------------------------------------------------------------------------------------------------------------------*/
  12431. // A returned value of `true` signals that a mock "helper" event has been rendered.
  12432. AgendaView.prototype.renderDrag = function (eventFootprints, seg, isTouch) {
  12433. var groups = groupEventFootprintsByAllDay(eventFootprints);
  12434. var renderedHelper = false;
  12435. renderedHelper = this.timeGrid.renderDrag(groups.timed, seg, isTouch);
  12436. if (this.dayGrid) {
  12437. renderedHelper = this.dayGrid.renderDrag(groups.allDay, seg, isTouch) || renderedHelper;
  12438. }
  12439. return renderedHelper;
  12440. };
  12441. AgendaView.prototype.renderEventResize = function (eventFootprints, seg, isTouch) {
  12442. var groups = groupEventFootprintsByAllDay(eventFootprints);
  12443. this.timeGrid.renderEventResize(groups.timed, seg, isTouch);
  12444. if (this.dayGrid) {
  12445. this.dayGrid.renderEventResize(groups.allDay, seg, isTouch);
  12446. }
  12447. };
  12448. /* Selection
  12449. ------------------------------------------------------------------------------------------------------------------*/
  12450. // Renders a visual indication of a selection
  12451. AgendaView.prototype.renderSelectionFootprint = function (componentFootprint) {
  12452. if (!componentFootprint.isAllDay) {
  12453. this.timeGrid.renderSelectionFootprint(componentFootprint);
  12454. }
  12455. else if (this.dayGrid) {
  12456. this.dayGrid.renderSelectionFootprint(componentFootprint);
  12457. }
  12458. };
  12459. return AgendaView;
  12460. }(View_1.default));
  12461. exports.default = AgendaView;
  12462. AgendaView.prototype.timeGridClass = TimeGrid_1.default;
  12463. AgendaView.prototype.dayGridClass = DayGrid_1.default;
  12464. // Will customize the rendering behavior of the AgendaView's timeGrid
  12465. agendaTimeGridMethods = {
  12466. // Generates the HTML that will go before the day-of week header cells
  12467. renderHeadIntroHtml: function () {
  12468. var view = this.view;
  12469. var calendar = view.calendar;
  12470. var weekStart = calendar.msToUtcMoment(this.dateProfile.renderUnzonedRange.startMs, true);
  12471. var weekText;
  12472. if (this.opt('weekNumbers')) {
  12473. weekText = weekStart.format(this.opt('smallWeekFormat'));
  12474. return '' +
  12475. '<th class="fc-axis fc-week-number ' + calendar.theme.getClass('widgetHeader') + '" ' + view.axisStyleAttr() + '>' +
  12476. view.buildGotoAnchorHtml(// aside from link, important for matchCellWidths
  12477. { date: weekStart, type: 'week', forceOff: this.colCnt > 1 }, util_1.htmlEscape(weekText) // inner HTML
  12478. ) +
  12479. '</th>';
  12480. }
  12481. else {
  12482. return '<th class="fc-axis ' + calendar.theme.getClass('widgetHeader') + '" ' + view.axisStyleAttr() + '></th>';
  12483. }
  12484. },
  12485. // Generates the HTML that goes before the bg of the TimeGrid slot area. Long vertical column.
  12486. renderBgIntroHtml: function () {
  12487. var view = this.view;
  12488. return '<td class="fc-axis ' + view.calendar.theme.getClass('widgetContent') + '" ' + view.axisStyleAttr() + '></td>';
  12489. },
  12490. // Generates the HTML that goes before all other types of cells.
  12491. // Affects content-skeleton, helper-skeleton, highlight-skeleton for both the time-grid and day-grid.
  12492. renderIntroHtml: function () {
  12493. var view = this.view;
  12494. return '<td class="fc-axis" ' + view.axisStyleAttr() + '></td>';
  12495. }
  12496. };
  12497. // Will customize the rendering behavior of the AgendaView's dayGrid
  12498. agendaDayGridMethods = {
  12499. // Generates the HTML that goes before the all-day cells
  12500. renderBgIntroHtml: function () {
  12501. var view = this.view;
  12502. return '' +
  12503. '<td class="fc-axis ' + view.calendar.theme.getClass('widgetContent') + '" ' + view.axisStyleAttr() + '>' +
  12504. '<span>' + // needed for matchCellWidths
  12505. view.getAllDayHtml() +
  12506. '</span>' +
  12507. '</td>';
  12508. },
  12509. // Generates the HTML that goes before all other types of cells.
  12510. // Affects content-skeleton, helper-skeleton, highlight-skeleton for both the time-grid and day-grid.
  12511. renderIntroHtml: function () {
  12512. var view = this.view;
  12513. return '<td class="fc-axis" ' + view.axisStyleAttr() + '></td>';
  12514. }
  12515. };
  12516. function groupEventFootprintsByAllDay(eventFootprints) {
  12517. var allDay = [];
  12518. var timed = [];
  12519. var i;
  12520. for (i = 0; i < eventFootprints.length; i++) {
  12521. if (eventFootprints[i].componentFootprint.isAllDay) {
  12522. allDay.push(eventFootprints[i]);
  12523. }
  12524. else {
  12525. timed.push(eventFootprints[i]);
  12526. }
  12527. }
  12528. return { allDay: allDay, timed: timed };
  12529. }
  12530. /***/ }),
  12531. /* 239 */
  12532. /***/ (function(module, exports, __webpack_require__) {
  12533. Object.defineProperty(exports, "__esModule", { value: true });
  12534. var tslib_1 = __webpack_require__(2);
  12535. var $ = __webpack_require__(3);
  12536. var moment = __webpack_require__(0);
  12537. var util_1 = __webpack_require__(4);
  12538. var InteractiveDateComponent_1 = __webpack_require__(42);
  12539. var BusinessHourRenderer_1 = __webpack_require__(61);
  12540. var StandardInteractionsMixin_1 = __webpack_require__(65);
  12541. var DayTableMixin_1 = __webpack_require__(60);
  12542. var CoordCache_1 = __webpack_require__(58);
  12543. var UnzonedRange_1 = __webpack_require__(5);
  12544. var ComponentFootprint_1 = __webpack_require__(12);
  12545. var TimeGridEventRenderer_1 = __webpack_require__(240);
  12546. var TimeGridHelperRenderer_1 = __webpack_require__(241);
  12547. var TimeGridFillRenderer_1 = __webpack_require__(242);
  12548. /* A component that renders one or more columns of vertical time slots
  12549. ----------------------------------------------------------------------------------------------------------------------*/
  12550. // We mixin DayTable, even though there is only a single row of days
  12551. // potential nice values for the slot-duration and interval-duration
  12552. // from largest to smallest
  12553. var AGENDA_STOCK_SUB_DURATIONS = [
  12554. { hours: 1 },
  12555. { minutes: 30 },
  12556. { minutes: 15 },
  12557. { seconds: 30 },
  12558. { seconds: 15 }
  12559. ];
  12560. var TimeGrid = /** @class */ (function (_super) {
  12561. tslib_1.__extends(TimeGrid, _super);
  12562. function TimeGrid(view) {
  12563. var _this = _super.call(this, view) || this;
  12564. _this.processOptions();
  12565. return _this;
  12566. }
  12567. // Slices up the given span (unzoned start/end with other misc data) into an array of segments
  12568. TimeGrid.prototype.componentFootprintToSegs = function (componentFootprint) {
  12569. var segs = this.sliceRangeByTimes(componentFootprint.unzonedRange);
  12570. var i;
  12571. for (i = 0; i < segs.length; i++) {
  12572. if (this.isRTL) {
  12573. segs[i].col = this.daysPerRow - 1 - segs[i].dayIndex;
  12574. }
  12575. else {
  12576. segs[i].col = segs[i].dayIndex;
  12577. }
  12578. }
  12579. return segs;
  12580. };
  12581. /* Date Handling
  12582. ------------------------------------------------------------------------------------------------------------------*/
  12583. TimeGrid.prototype.sliceRangeByTimes = function (unzonedRange) {
  12584. var segs = [];
  12585. var segRange;
  12586. var dayIndex;
  12587. for (dayIndex = 0; dayIndex < this.daysPerRow; dayIndex++) {
  12588. segRange = unzonedRange.intersect(this.dayRanges[dayIndex]);
  12589. if (segRange) {
  12590. segs.push({
  12591. startMs: segRange.startMs,
  12592. endMs: segRange.endMs,
  12593. isStart: segRange.isStart,
  12594. isEnd: segRange.isEnd,
  12595. dayIndex: dayIndex
  12596. });
  12597. }
  12598. }
  12599. return segs;
  12600. };
  12601. /* Options
  12602. ------------------------------------------------------------------------------------------------------------------*/
  12603. // Parses various options into properties of this object
  12604. TimeGrid.prototype.processOptions = function () {
  12605. var slotDuration = this.opt('slotDuration');
  12606. var snapDuration = this.opt('snapDuration');
  12607. var input;
  12608. slotDuration = moment.duration(slotDuration);
  12609. snapDuration = snapDuration ? moment.duration(snapDuration) : slotDuration;
  12610. this.slotDuration = slotDuration;
  12611. this.snapDuration = snapDuration;
  12612. this.snapsPerSlot = slotDuration / snapDuration; // TODO: ensure an integer multiple?
  12613. // might be an array value (for TimelineView).
  12614. // if so, getting the most granular entry (the last one probably).
  12615. input = this.opt('slotLabelFormat');
  12616. if ($.isArray(input)) {
  12617. input = input[input.length - 1];
  12618. }
  12619. this.labelFormat = input ||
  12620. this.opt('smallTimeFormat'); // the computed default
  12621. input = this.opt('slotLabelInterval');
  12622. this.labelInterval = input ?
  12623. moment.duration(input) :
  12624. this.computeLabelInterval(slotDuration);
  12625. };
  12626. // Computes an automatic value for slotLabelInterval
  12627. TimeGrid.prototype.computeLabelInterval = function (slotDuration) {
  12628. var i;
  12629. var labelInterval;
  12630. var slotsPerLabel;
  12631. // find the smallest stock label interval that results in more than one slots-per-label
  12632. for (i = AGENDA_STOCK_SUB_DURATIONS.length - 1; i >= 0; i--) {
  12633. labelInterval = moment.duration(AGENDA_STOCK_SUB_DURATIONS[i]);
  12634. slotsPerLabel = util_1.divideDurationByDuration(labelInterval, slotDuration);
  12635. if (util_1.isInt(slotsPerLabel) && slotsPerLabel > 1) {
  12636. return labelInterval;
  12637. }
  12638. }
  12639. return moment.duration(slotDuration); // fall back. clone
  12640. };
  12641. /* Date Rendering
  12642. ------------------------------------------------------------------------------------------------------------------*/
  12643. TimeGrid.prototype.renderDates = function (dateProfile) {
  12644. this.dateProfile = dateProfile;
  12645. this.updateDayTable();
  12646. this.renderSlats();
  12647. this.renderColumns();
  12648. };
  12649. TimeGrid.prototype.unrenderDates = function () {
  12650. // this.unrenderSlats(); // don't need this because repeated .html() calls clear
  12651. this.unrenderColumns();
  12652. };
  12653. TimeGrid.prototype.renderSkeleton = function () {
  12654. var theme = this.view.calendar.theme;
  12655. this.el.html('<div class="fc-bg"></div>' +
  12656. '<div class="fc-slats"></div>' +
  12657. '<hr class="fc-divider ' + theme.getClass('widgetHeader') + '" style="display:none"></hr>');
  12658. this.bottomRuleEl = this.el.find('hr');
  12659. };
  12660. TimeGrid.prototype.renderSlats = function () {
  12661. var theme = this.view.calendar.theme;
  12662. this.slatContainerEl = this.el.find('> .fc-slats')
  12663. .html(// avoids needing ::unrenderSlats()
  12664. '<table class="' + theme.getClass('tableGrid') + '">' +
  12665. this.renderSlatRowHtml() +
  12666. '</table>');
  12667. this.slatEls = this.slatContainerEl.find('tr');
  12668. this.slatCoordCache = new CoordCache_1.default({
  12669. els: this.slatEls,
  12670. isVertical: true
  12671. });
  12672. };
  12673. // Generates the HTML for the horizontal "slats" that run width-wise. Has a time axis on a side. Depends on RTL.
  12674. TimeGrid.prototype.renderSlatRowHtml = function () {
  12675. var view = this.view;
  12676. var calendar = view.calendar;
  12677. var theme = calendar.theme;
  12678. var isRTL = this.isRTL;
  12679. var dateProfile = this.dateProfile;
  12680. var html = '';
  12681. var slotTime = moment.duration(+dateProfile.minTime); // wish there was .clone() for durations
  12682. var slotIterator = moment.duration(0);
  12683. var slotDate; // will be on the view's first day, but we only care about its time
  12684. var isLabeled;
  12685. var axisHtml;
  12686. // Calculate the time for each slot
  12687. while (slotTime < dateProfile.maxTime) {
  12688. slotDate = calendar.msToUtcMoment(dateProfile.renderUnzonedRange.startMs).time(slotTime);
  12689. isLabeled = util_1.isInt(util_1.divideDurationByDuration(slotIterator, this.labelInterval));
  12690. axisHtml =
  12691. '<td class="fc-axis fc-time ' + theme.getClass('widgetContent') + '" ' + view.axisStyleAttr() + '>' +
  12692. (isLabeled ?
  12693. '<span>' + // for matchCellWidths
  12694. util_1.htmlEscape(slotDate.format(this.labelFormat)) +
  12695. '</span>' :
  12696. '') +
  12697. '</td>';
  12698. html +=
  12699. '<tr data-time="' + slotDate.format('HH:mm:ss') + '"' +
  12700. (isLabeled ? '' : ' class="fc-minor"') +
  12701. '>' +
  12702. (!isRTL ? axisHtml : '') +
  12703. '<td class="' + theme.getClass('widgetContent') + '"></td>' +
  12704. (isRTL ? axisHtml : '') +
  12705. '</tr>';
  12706. slotTime.add(this.slotDuration);
  12707. slotIterator.add(this.slotDuration);
  12708. }
  12709. return html;
  12710. };
  12711. TimeGrid.prototype.renderColumns = function () {
  12712. var dateProfile = this.dateProfile;
  12713. var theme = this.view.calendar.theme;
  12714. this.dayRanges = this.dayDates.map(function (dayDate) {
  12715. return new UnzonedRange_1.default(dayDate.clone().add(dateProfile.minTime), dayDate.clone().add(dateProfile.maxTime));
  12716. });
  12717. if (this.headContainerEl) {
  12718. this.headContainerEl.html(this.renderHeadHtml());
  12719. }
  12720. this.el.find('> .fc-bg').html('<table class="' + theme.getClass('tableGrid') + '">' +
  12721. this.renderBgTrHtml(0) + // row=0
  12722. '</table>');
  12723. this.colEls = this.el.find('.fc-day, .fc-disabled-day');
  12724. this.colCoordCache = new CoordCache_1.default({
  12725. els: this.colEls,
  12726. isHorizontal: true
  12727. });
  12728. this.renderContentSkeleton();
  12729. };
  12730. TimeGrid.prototype.unrenderColumns = function () {
  12731. this.unrenderContentSkeleton();
  12732. };
  12733. /* Content Skeleton
  12734. ------------------------------------------------------------------------------------------------------------------*/
  12735. // Renders the DOM that the view's content will live in
  12736. TimeGrid.prototype.renderContentSkeleton = function () {
  12737. var cellHtml = '';
  12738. var i;
  12739. var skeletonEl;
  12740. for (i = 0; i < this.colCnt; i++) {
  12741. cellHtml +=
  12742. '<td>' +
  12743. '<div class="fc-content-col">' +
  12744. '<div class="fc-event-container fc-helper-container"></div>' +
  12745. '<div class="fc-event-container"></div>' +
  12746. '<div class="fc-highlight-container"></div>' +
  12747. '<div class="fc-bgevent-container"></div>' +
  12748. '<div class="fc-business-container"></div>' +
  12749. '</div>' +
  12750. '</td>';
  12751. }
  12752. skeletonEl = this.contentSkeletonEl = $('<div class="fc-content-skeleton">' +
  12753. '<table>' +
  12754. '<tr>' + cellHtml + '</tr>' +
  12755. '</table>' +
  12756. '</div>');
  12757. this.colContainerEls = skeletonEl.find('.fc-content-col');
  12758. this.helperContainerEls = skeletonEl.find('.fc-helper-container');
  12759. this.fgContainerEls = skeletonEl.find('.fc-event-container:not(.fc-helper-container)');
  12760. this.bgContainerEls = skeletonEl.find('.fc-bgevent-container');
  12761. this.highlightContainerEls = skeletonEl.find('.fc-highlight-container');
  12762. this.businessContainerEls = skeletonEl.find('.fc-business-container');
  12763. this.bookendCells(skeletonEl.find('tr')); // TODO: do this on string level
  12764. this.el.append(skeletonEl);
  12765. };
  12766. TimeGrid.prototype.unrenderContentSkeleton = function () {
  12767. if (this.contentSkeletonEl) { // defensive :(
  12768. this.contentSkeletonEl.remove();
  12769. this.contentSkeletonEl = null;
  12770. this.colContainerEls = null;
  12771. this.helperContainerEls = null;
  12772. this.fgContainerEls = null;
  12773. this.bgContainerEls = null;
  12774. this.highlightContainerEls = null;
  12775. this.businessContainerEls = null;
  12776. }
  12777. };
  12778. // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's col
  12779. TimeGrid.prototype.groupSegsByCol = function (segs) {
  12780. var segsByCol = [];
  12781. var i;
  12782. for (i = 0; i < this.colCnt; i++) {
  12783. segsByCol.push([]);
  12784. }
  12785. for (i = 0; i < segs.length; i++) {
  12786. segsByCol[segs[i].col].push(segs[i]);
  12787. }
  12788. return segsByCol;
  12789. };
  12790. // Given segments grouped by column, insert the segments' elements into a parallel array of container
  12791. // elements, each living within a column.
  12792. TimeGrid.prototype.attachSegsByCol = function (segsByCol, containerEls) {
  12793. var col;
  12794. var segs;
  12795. var i;
  12796. for (col = 0; col < this.colCnt; col++) { // iterate each column grouping
  12797. segs = segsByCol[col];
  12798. for (i = 0; i < segs.length; i++) {
  12799. containerEls.eq(col).append(segs[i].el);
  12800. }
  12801. }
  12802. };
  12803. /* Now Indicator
  12804. ------------------------------------------------------------------------------------------------------------------*/
  12805. TimeGrid.prototype.getNowIndicatorUnit = function () {
  12806. return 'minute'; // will refresh on the minute
  12807. };
  12808. TimeGrid.prototype.renderNowIndicator = function (date) {
  12809. // HACK: if date columns not ready for some reason (scheduler)
  12810. if (!this.colContainerEls) {
  12811. return;
  12812. }
  12813. // seg system might be overkill, but it handles scenario where line needs to be rendered
  12814. // more than once because of columns with the same date (resources columns for example)
  12815. var segs = this.componentFootprintToSegs(new ComponentFootprint_1.default(new UnzonedRange_1.default(date, date.valueOf() + 1), // protect against null range
  12816. false // all-day
  12817. ));
  12818. var top = this.computeDateTop(date, date);
  12819. var nodes = [];
  12820. var i;
  12821. // render lines within the columns
  12822. for (i = 0; i < segs.length; i++) {
  12823. nodes.push($('<div class="fc-now-indicator fc-now-indicator-line"></div>')
  12824. .css('top', top)
  12825. .appendTo(this.colContainerEls.eq(segs[i].col))[0]);
  12826. }
  12827. // render an arrow over the axis
  12828. if (segs.length > 0) { // is the current time in view?
  12829. nodes.push($('<div class="fc-now-indicator fc-now-indicator-arrow"></div>')
  12830. .css('top', top)
  12831. .appendTo(this.el.find('.fc-content-skeleton'))[0]);
  12832. }
  12833. this.nowIndicatorEls = $(nodes);
  12834. };
  12835. TimeGrid.prototype.unrenderNowIndicator = function () {
  12836. if (this.nowIndicatorEls) {
  12837. this.nowIndicatorEls.remove();
  12838. this.nowIndicatorEls = null;
  12839. }
  12840. };
  12841. /* Coordinates
  12842. ------------------------------------------------------------------------------------------------------------------*/
  12843. TimeGrid.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  12844. _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
  12845. this.slatCoordCache.build();
  12846. if (isResize) {
  12847. this.updateSegVerticals([].concat(this.eventRenderer.getSegs(), this.businessSegs || []));
  12848. }
  12849. };
  12850. TimeGrid.prototype.getTotalSlatHeight = function () {
  12851. return this.slatContainerEl.outerHeight();
  12852. };
  12853. // Computes the top coordinate, relative to the bounds of the grid, of the given date.
  12854. // `ms` can be a millisecond UTC time OR a UTC moment.
  12855. // A `startOfDayDate` must be given for avoiding ambiguity over how to treat midnight.
  12856. TimeGrid.prototype.computeDateTop = function (ms, startOfDayDate) {
  12857. return this.computeTimeTop(moment.duration(ms - startOfDayDate.clone().stripTime()));
  12858. };
  12859. // Computes the top coordinate, relative to the bounds of the grid, of the given time (a Duration).
  12860. TimeGrid.prototype.computeTimeTop = function (time) {
  12861. var len = this.slatEls.length;
  12862. var dateProfile = this.dateProfile;
  12863. var slatCoverage = (time - dateProfile.minTime) / this.slotDuration; // floating-point value of # of slots covered
  12864. var slatIndex;
  12865. var slatRemainder;
  12866. // compute a floating-point number for how many slats should be progressed through.
  12867. // from 0 to number of slats (inclusive)
  12868. // constrained because minTime/maxTime might be customized.
  12869. slatCoverage = Math.max(0, slatCoverage);
  12870. slatCoverage = Math.min(len, slatCoverage);
  12871. // an integer index of the furthest whole slat
  12872. // from 0 to number slats (*exclusive*, so len-1)
  12873. slatIndex = Math.floor(slatCoverage);
  12874. slatIndex = Math.min(slatIndex, len - 1);
  12875. // how much further through the slatIndex slat (from 0.0-1.0) must be covered in addition.
  12876. // could be 1.0 if slatCoverage is covering *all* the slots
  12877. slatRemainder = slatCoverage - slatIndex;
  12878. return this.slatCoordCache.getTopPosition(slatIndex) +
  12879. this.slatCoordCache.getHeight(slatIndex) * slatRemainder;
  12880. };
  12881. // Refreshes the CSS top/bottom coordinates for each segment element.
  12882. // Works when called after initial render, after a window resize/zoom for example.
  12883. TimeGrid.prototype.updateSegVerticals = function (segs) {
  12884. this.computeSegVerticals(segs);
  12885. this.assignSegVerticals(segs);
  12886. };
  12887. // For each segment in an array, computes and assigns its top and bottom properties
  12888. TimeGrid.prototype.computeSegVerticals = function (segs) {
  12889. var eventMinHeight = this.opt('agendaEventMinHeight');
  12890. var i;
  12891. var seg;
  12892. var dayDate;
  12893. for (i = 0; i < segs.length; i++) {
  12894. seg = segs[i];
  12895. dayDate = this.dayDates[seg.dayIndex];
  12896. seg.top = this.computeDateTop(seg.startMs, dayDate);
  12897. seg.bottom = Math.max(seg.top + eventMinHeight, this.computeDateTop(seg.endMs, dayDate));
  12898. }
  12899. };
  12900. // Given segments that already have their top/bottom properties computed, applies those values to
  12901. // the segments' elements.
  12902. TimeGrid.prototype.assignSegVerticals = function (segs) {
  12903. var i;
  12904. var seg;
  12905. for (i = 0; i < segs.length; i++) {
  12906. seg = segs[i];
  12907. seg.el.css(this.generateSegVerticalCss(seg));
  12908. }
  12909. };
  12910. // Generates an object with CSS properties for the top/bottom coordinates of a segment element
  12911. TimeGrid.prototype.generateSegVerticalCss = function (seg) {
  12912. return {
  12913. top: seg.top,
  12914. bottom: -seg.bottom // flipped because needs to be space beyond bottom edge of event container
  12915. };
  12916. };
  12917. /* Hit System
  12918. ------------------------------------------------------------------------------------------------------------------*/
  12919. TimeGrid.prototype.prepareHits = function () {
  12920. this.colCoordCache.build();
  12921. this.slatCoordCache.build();
  12922. };
  12923. TimeGrid.prototype.releaseHits = function () {
  12924. this.colCoordCache.clear();
  12925. // NOTE: don't clear slatCoordCache because we rely on it for computeTimeTop
  12926. };
  12927. TimeGrid.prototype.queryHit = function (leftOffset, topOffset) {
  12928. var snapsPerSlot = this.snapsPerSlot;
  12929. var colCoordCache = this.colCoordCache;
  12930. var slatCoordCache = this.slatCoordCache;
  12931. if (colCoordCache.isLeftInBounds(leftOffset) && slatCoordCache.isTopInBounds(topOffset)) {
  12932. var colIndex = colCoordCache.getHorizontalIndex(leftOffset);
  12933. var slatIndex = slatCoordCache.getVerticalIndex(topOffset);
  12934. if (colIndex != null && slatIndex != null) {
  12935. var slatTop = slatCoordCache.getTopOffset(slatIndex);
  12936. var slatHeight = slatCoordCache.getHeight(slatIndex);
  12937. var partial = (topOffset - slatTop) / slatHeight; // floating point number between 0 and 1
  12938. var localSnapIndex = Math.floor(partial * snapsPerSlot); // the snap # relative to start of slat
  12939. var snapIndex = slatIndex * snapsPerSlot + localSnapIndex;
  12940. var snapTop = slatTop + (localSnapIndex / snapsPerSlot) * slatHeight;
  12941. var snapBottom = slatTop + ((localSnapIndex + 1) / snapsPerSlot) * slatHeight;
  12942. return {
  12943. col: colIndex,
  12944. snap: snapIndex,
  12945. component: this,
  12946. left: colCoordCache.getLeftOffset(colIndex),
  12947. right: colCoordCache.getRightOffset(colIndex),
  12948. top: snapTop,
  12949. bottom: snapBottom
  12950. };
  12951. }
  12952. }
  12953. };
  12954. TimeGrid.prototype.getHitFootprint = function (hit) {
  12955. var start = this.getCellDate(0, hit.col); // row=0
  12956. var time = this.computeSnapTime(hit.snap); // pass in the snap-index
  12957. var end;
  12958. start.time(time);
  12959. end = start.clone().add(this.snapDuration);
  12960. return new ComponentFootprint_1.default(new UnzonedRange_1.default(start, end), false // all-day?
  12961. );
  12962. };
  12963. // Given a row number of the grid, representing a "snap", returns a time (Duration) from its start-of-day
  12964. TimeGrid.prototype.computeSnapTime = function (snapIndex) {
  12965. return moment.duration(this.dateProfile.minTime + this.snapDuration * snapIndex);
  12966. };
  12967. TimeGrid.prototype.getHitEl = function (hit) {
  12968. return this.colEls.eq(hit.col);
  12969. };
  12970. /* Event Drag Visualization
  12971. ------------------------------------------------------------------------------------------------------------------*/
  12972. // Renders a visual indication of an event being dragged over the specified date(s).
  12973. // A returned value of `true` signals that a mock "helper" event has been rendered.
  12974. TimeGrid.prototype.renderDrag = function (eventFootprints, seg, isTouch) {
  12975. var i;
  12976. if (seg) { // if there is event information for this drag, render a helper event
  12977. if (eventFootprints.length) {
  12978. this.helperRenderer.renderEventDraggingFootprints(eventFootprints, seg, isTouch);
  12979. // signal that a helper has been rendered
  12980. return true;
  12981. }
  12982. }
  12983. else { // otherwise, just render a highlight
  12984. for (i = 0; i < eventFootprints.length; i++) {
  12985. this.renderHighlight(eventFootprints[i].componentFootprint);
  12986. }
  12987. }
  12988. };
  12989. // Unrenders any visual indication of an event being dragged
  12990. TimeGrid.prototype.unrenderDrag = function () {
  12991. this.unrenderHighlight();
  12992. this.helperRenderer.unrender();
  12993. };
  12994. /* Event Resize Visualization
  12995. ------------------------------------------------------------------------------------------------------------------*/
  12996. // Renders a visual indication of an event being resized
  12997. TimeGrid.prototype.renderEventResize = function (eventFootprints, seg, isTouch) {
  12998. this.helperRenderer.renderEventResizingFootprints(eventFootprints, seg, isTouch);
  12999. };
  13000. // Unrenders any visual indication of an event being resized
  13001. TimeGrid.prototype.unrenderEventResize = function () {
  13002. this.helperRenderer.unrender();
  13003. };
  13004. /* Selection
  13005. ------------------------------------------------------------------------------------------------------------------*/
  13006. // Renders a visual indication of a selection. Overrides the default, which was to simply render a highlight.
  13007. TimeGrid.prototype.renderSelectionFootprint = function (componentFootprint) {
  13008. if (this.opt('selectHelper')) { // this setting signals that a mock helper event should be rendered
  13009. this.helperRenderer.renderComponentFootprint(componentFootprint);
  13010. }
  13011. else {
  13012. this.renderHighlight(componentFootprint);
  13013. }
  13014. };
  13015. // Unrenders any visual indication of a selection
  13016. TimeGrid.prototype.unrenderSelection = function () {
  13017. this.helperRenderer.unrender();
  13018. this.unrenderHighlight();
  13019. };
  13020. return TimeGrid;
  13021. }(InteractiveDateComponent_1.default));
  13022. exports.default = TimeGrid;
  13023. TimeGrid.prototype.eventRendererClass = TimeGridEventRenderer_1.default;
  13024. TimeGrid.prototype.businessHourRendererClass = BusinessHourRenderer_1.default;
  13025. TimeGrid.prototype.helperRendererClass = TimeGridHelperRenderer_1.default;
  13026. TimeGrid.prototype.fillRendererClass = TimeGridFillRenderer_1.default;
  13027. StandardInteractionsMixin_1.default.mixInto(TimeGrid);
  13028. DayTableMixin_1.default.mixInto(TimeGrid);
  13029. /***/ }),
  13030. /* 240 */
  13031. /***/ (function(module, exports, __webpack_require__) {
  13032. Object.defineProperty(exports, "__esModule", { value: true });
  13033. var tslib_1 = __webpack_require__(2);
  13034. var util_1 = __webpack_require__(4);
  13035. var EventRenderer_1 = __webpack_require__(44);
  13036. /*
  13037. Only handles foreground segs.
  13038. Does not own rendering. Use for low-level util methods by TimeGrid.
  13039. */
  13040. var TimeGridEventRenderer = /** @class */ (function (_super) {
  13041. tslib_1.__extends(TimeGridEventRenderer, _super);
  13042. function TimeGridEventRenderer(timeGrid, fillRenderer) {
  13043. var _this = _super.call(this, timeGrid, fillRenderer) || this;
  13044. _this.timeGrid = timeGrid;
  13045. return _this;
  13046. }
  13047. TimeGridEventRenderer.prototype.renderFgSegs = function (segs) {
  13048. this.renderFgSegsIntoContainers(segs, this.timeGrid.fgContainerEls);
  13049. };
  13050. // Given an array of foreground segments, render a DOM element for each, computes position,
  13051. // and attaches to the column inner-container elements.
  13052. TimeGridEventRenderer.prototype.renderFgSegsIntoContainers = function (segs, containerEls) {
  13053. var segsByCol;
  13054. var col;
  13055. segsByCol = this.timeGrid.groupSegsByCol(segs);
  13056. for (col = 0; col < this.timeGrid.colCnt; col++) {
  13057. this.updateFgSegCoords(segsByCol[col]);
  13058. }
  13059. this.timeGrid.attachSegsByCol(segsByCol, containerEls);
  13060. };
  13061. TimeGridEventRenderer.prototype.unrenderFgSegs = function () {
  13062. if (this.fgSegs) { // hack
  13063. this.fgSegs.forEach(function (seg) {
  13064. seg.el.remove();
  13065. });
  13066. }
  13067. };
  13068. // Computes a default event time formatting string if `timeFormat` is not explicitly defined
  13069. TimeGridEventRenderer.prototype.computeEventTimeFormat = function () {
  13070. return this.opt('noMeridiemTimeFormat'); // like "6:30" (no AM/PM)
  13071. };
  13072. // Computes a default `displayEventEnd` value if one is not expliclty defined
  13073. TimeGridEventRenderer.prototype.computeDisplayEventEnd = function () {
  13074. return true;
  13075. };
  13076. // Renders the HTML for a single event segment's default rendering
  13077. TimeGridEventRenderer.prototype.fgSegHtml = function (seg, disableResizing) {
  13078. var view = this.view;
  13079. var calendar = view.calendar;
  13080. var componentFootprint = seg.footprint.componentFootprint;
  13081. var isAllDay = componentFootprint.isAllDay;
  13082. var eventDef = seg.footprint.eventDef;
  13083. var isDraggable = view.isEventDefDraggable(eventDef);
  13084. var isResizableFromStart = !disableResizing && seg.isStart && view.isEventDefResizableFromStart(eventDef);
  13085. var isResizableFromEnd = !disableResizing && seg.isEnd && view.isEventDefResizableFromEnd(eventDef);
  13086. var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd);
  13087. var skinCss = util_1.cssToStr(this.getSkinCss(eventDef));
  13088. var timeText;
  13089. var fullTimeText; // more verbose time text. for the print stylesheet
  13090. var startTimeText; // just the start time text
  13091. classes.unshift('fc-time-grid-event', 'fc-v-event');
  13092. // if the event appears to span more than one day...
  13093. if (view.isMultiDayRange(componentFootprint.unzonedRange)) {
  13094. // Don't display time text on segments that run entirely through a day.
  13095. // That would appear as midnight-midnight and would look dumb.
  13096. // Otherwise, display the time text for the *segment's* times (like 6pm-midnight or midnight-10am)
  13097. if (seg.isStart || seg.isEnd) {
  13098. var zonedStart = calendar.msToMoment(seg.startMs);
  13099. var zonedEnd = calendar.msToMoment(seg.endMs);
  13100. timeText = this._getTimeText(zonedStart, zonedEnd, isAllDay);
  13101. fullTimeText = this._getTimeText(zonedStart, zonedEnd, isAllDay, 'LT');
  13102. startTimeText = this._getTimeText(zonedStart, zonedEnd, isAllDay, null, false); // displayEnd=false
  13103. }
  13104. }
  13105. else {
  13106. // Display the normal time text for the *event's* times
  13107. timeText = this.getTimeText(seg.footprint);
  13108. fullTimeText = this.getTimeText(seg.footprint, 'LT');
  13109. startTimeText = this.getTimeText(seg.footprint, null, false); // displayEnd=false
  13110. }
  13111. return '<a class="' + classes.join(' ') + '"' +
  13112. (eventDef.url ?
  13113. ' href="' + util_1.htmlEscape(eventDef.url) + '"' :
  13114. '') +
  13115. (skinCss ?
  13116. ' style="' + skinCss + '"' :
  13117. '') +
  13118. '>' +
  13119. '<div class="fc-content">' +
  13120. (timeText ?
  13121. '<div class="fc-time"' +
  13122. ' data-start="' + util_1.htmlEscape(startTimeText) + '"' +
  13123. ' data-full="' + util_1.htmlEscape(fullTimeText) + '"' +
  13124. '>' +
  13125. '<span>' + util_1.htmlEscape(timeText) + '</span>' +
  13126. '</div>' :
  13127. '') +
  13128. (eventDef.title ?
  13129. '<div class="fc-title">' +
  13130. util_1.htmlEscape(eventDef.title) +
  13131. '</div>' :
  13132. '') +
  13133. '</div>' +
  13134. '<div class="fc-bg"></div>' +
  13135. /* TODO: write CSS for this
  13136. (isResizableFromStart ?
  13137. '<div class="fc-resizer fc-start-resizer"></div>' :
  13138. ''
  13139. ) +
  13140. */
  13141. (isResizableFromEnd ?
  13142. '<div class="fc-resizer fc-end-resizer"></div>' :
  13143. '') +
  13144. '</a>';
  13145. };
  13146. // Given segments that are assumed to all live in the *same column*,
  13147. // compute their verical/horizontal coordinates and assign to their elements.
  13148. TimeGridEventRenderer.prototype.updateFgSegCoords = function (segs) {
  13149. this.timeGrid.computeSegVerticals(segs); // horizontals relies on this
  13150. this.computeFgSegHorizontals(segs); // compute horizontal coordinates, z-index's, and reorder the array
  13151. this.timeGrid.assignSegVerticals(segs);
  13152. this.assignFgSegHorizontals(segs);
  13153. };
  13154. // Given an array of segments that are all in the same column, sets the backwardCoord and forwardCoord on each.
  13155. // NOTE: Also reorders the given array by date!
  13156. TimeGridEventRenderer.prototype.computeFgSegHorizontals = function (segs) {
  13157. var levels;
  13158. var level0;
  13159. var i;
  13160. this.sortEventSegs(segs); // order by certain criteria
  13161. levels = buildSlotSegLevels(segs);
  13162. computeForwardSlotSegs(levels);
  13163. if ((level0 = levels[0])) {
  13164. for (i = 0; i < level0.length; i++) {
  13165. computeSlotSegPressures(level0[i]);
  13166. }
  13167. for (i = 0; i < level0.length; i++) {
  13168. this.computeFgSegForwardBack(level0[i], 0, 0);
  13169. }
  13170. }
  13171. };
  13172. // Calculate seg.forwardCoord and seg.backwardCoord for the segment, where both values range
  13173. // from 0 to 1. If the calendar is left-to-right, the seg.backwardCoord maps to "left" and
  13174. // seg.forwardCoord maps to "right" (via percentage). Vice-versa if the calendar is right-to-left.
  13175. //
  13176. // The segment might be part of a "series", which means consecutive segments with the same pressure
  13177. // who's width is unknown until an edge has been hit. `seriesBackwardPressure` is the number of
  13178. // segments behind this one in the current series, and `seriesBackwardCoord` is the starting
  13179. // coordinate of the first segment in the series.
  13180. TimeGridEventRenderer.prototype.computeFgSegForwardBack = function (seg, seriesBackwardPressure, seriesBackwardCoord) {
  13181. var forwardSegs = seg.forwardSegs;
  13182. var i;
  13183. if (seg.forwardCoord === undefined) { // not already computed
  13184. if (!forwardSegs.length) {
  13185. // if there are no forward segments, this segment should butt up against the edge
  13186. seg.forwardCoord = 1;
  13187. }
  13188. else {
  13189. // sort highest pressure first
  13190. this.sortForwardSegs(forwardSegs);
  13191. // this segment's forwardCoord will be calculated from the backwardCoord of the
  13192. // highest-pressure forward segment.
  13193. this.computeFgSegForwardBack(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord);
  13194. seg.forwardCoord = forwardSegs[0].backwardCoord;
  13195. }
  13196. // calculate the backwardCoord from the forwardCoord. consider the series
  13197. seg.backwardCoord = seg.forwardCoord -
  13198. (seg.forwardCoord - seriesBackwardCoord) / // available width for series
  13199. (seriesBackwardPressure + 1); // # of segments in the series
  13200. // use this segment's coordinates to computed the coordinates of the less-pressurized
  13201. // forward segments
  13202. for (i = 0; i < forwardSegs.length; i++) {
  13203. this.computeFgSegForwardBack(forwardSegs[i], 0, seg.forwardCoord);
  13204. }
  13205. }
  13206. };
  13207. TimeGridEventRenderer.prototype.sortForwardSegs = function (forwardSegs) {
  13208. forwardSegs.sort(util_1.proxy(this, 'compareForwardSegs'));
  13209. };
  13210. // A cmp function for determining which forward segment to rely on more when computing coordinates.
  13211. TimeGridEventRenderer.prototype.compareForwardSegs = function (seg1, seg2) {
  13212. // put higher-pressure first
  13213. return seg2.forwardPressure - seg1.forwardPressure ||
  13214. // put segments that are closer to initial edge first (and favor ones with no coords yet)
  13215. (seg1.backwardCoord || 0) - (seg2.backwardCoord || 0) ||
  13216. // do normal sorting...
  13217. this.compareEventSegs(seg1, seg2);
  13218. };
  13219. // Given foreground event segments that have already had their position coordinates computed,
  13220. // assigns position-related CSS values to their elements.
  13221. TimeGridEventRenderer.prototype.assignFgSegHorizontals = function (segs) {
  13222. var i;
  13223. var seg;
  13224. for (i = 0; i < segs.length; i++) {
  13225. seg = segs[i];
  13226. seg.el.css(this.generateFgSegHorizontalCss(seg));
  13227. // if the event is short that the title will be cut off,
  13228. // attach a className that condenses the title into the time area.
  13229. if (seg.footprint.eventDef.title && seg.bottom - seg.top < 30) {
  13230. seg.el.addClass('fc-short'); // TODO: "condensed" is a better name
  13231. }
  13232. }
  13233. };
  13234. // Generates an object with CSS properties/values that should be applied to an event segment element.
  13235. // Contains important positioning-related properties that should be applied to any event element, customized or not.
  13236. TimeGridEventRenderer.prototype.generateFgSegHorizontalCss = function (seg) {
  13237. var shouldOverlap = this.opt('slotEventOverlap');
  13238. var backwardCoord = seg.backwardCoord; // the left side if LTR. the right side if RTL. floating-point
  13239. var forwardCoord = seg.forwardCoord; // the right side if LTR. the left side if RTL. floating-point
  13240. var props = this.timeGrid.generateSegVerticalCss(seg); // get top/bottom first
  13241. var isRTL = this.timeGrid.isRTL;
  13242. var left; // amount of space from left edge, a fraction of the total width
  13243. var right; // amount of space from right edge, a fraction of the total width
  13244. if (shouldOverlap) {
  13245. // double the width, but don't go beyond the maximum forward coordinate (1.0)
  13246. forwardCoord = Math.min(1, backwardCoord + (forwardCoord - backwardCoord) * 2);
  13247. }
  13248. if (isRTL) {
  13249. left = 1 - forwardCoord;
  13250. right = backwardCoord;
  13251. }
  13252. else {
  13253. left = backwardCoord;
  13254. right = 1 - forwardCoord;
  13255. }
  13256. props.zIndex = seg.level + 1; // convert from 0-base to 1-based
  13257. props.left = left * 100 + '%';
  13258. props.right = right * 100 + '%';
  13259. if (shouldOverlap && seg.forwardPressure) {
  13260. // add padding to the edge so that forward stacked events don't cover the resizer's icon
  13261. props[isRTL ? 'marginLeft' : 'marginRight'] = 10 * 2; // 10 is a guesstimate of the icon's width
  13262. }
  13263. return props;
  13264. };
  13265. return TimeGridEventRenderer;
  13266. }(EventRenderer_1.default));
  13267. exports.default = TimeGridEventRenderer;
  13268. // Builds an array of segments "levels". The first level will be the leftmost tier of segments if the calendar is
  13269. // left-to-right, or the rightmost if the calendar is right-to-left. Assumes the segments are already ordered by date.
  13270. function buildSlotSegLevels(segs) {
  13271. var levels = [];
  13272. var i;
  13273. var seg;
  13274. var j;
  13275. for (i = 0; i < segs.length; i++) {
  13276. seg = segs[i];
  13277. // go through all the levels and stop on the first level where there are no collisions
  13278. for (j = 0; j < levels.length; j++) {
  13279. if (!computeSlotSegCollisions(seg, levels[j]).length) {
  13280. break;
  13281. }
  13282. }
  13283. seg.level = j;
  13284. (levels[j] || (levels[j] = [])).push(seg);
  13285. }
  13286. return levels;
  13287. }
  13288. // For every segment, figure out the other segments that are in subsequent
  13289. // levels that also occupy the same vertical space. Accumulate in seg.forwardSegs
  13290. function computeForwardSlotSegs(levels) {
  13291. var i;
  13292. var level;
  13293. var j;
  13294. var seg;
  13295. var k;
  13296. for (i = 0; i < levels.length; i++) {
  13297. level = levels[i];
  13298. for (j = 0; j < level.length; j++) {
  13299. seg = level[j];
  13300. seg.forwardSegs = [];
  13301. for (k = i + 1; k < levels.length; k++) {
  13302. computeSlotSegCollisions(seg, levels[k], seg.forwardSegs);
  13303. }
  13304. }
  13305. }
  13306. }
  13307. // Figure out which path forward (via seg.forwardSegs) results in the longest path until
  13308. // the furthest edge is reached. The number of segments in this path will be seg.forwardPressure
  13309. function computeSlotSegPressures(seg) {
  13310. var forwardSegs = seg.forwardSegs;
  13311. var forwardPressure = 0;
  13312. var i;
  13313. var forwardSeg;
  13314. if (seg.forwardPressure === undefined) { // not already computed
  13315. for (i = 0; i < forwardSegs.length; i++) {
  13316. forwardSeg = forwardSegs[i];
  13317. // figure out the child's maximum forward path
  13318. computeSlotSegPressures(forwardSeg);
  13319. // either use the existing maximum, or use the child's forward pressure
  13320. // plus one (for the forwardSeg itself)
  13321. forwardPressure = Math.max(forwardPressure, 1 + forwardSeg.forwardPressure);
  13322. }
  13323. seg.forwardPressure = forwardPressure;
  13324. }
  13325. }
  13326. // Find all the segments in `otherSegs` that vertically collide with `seg`.
  13327. // Append into an optionally-supplied `results` array and return.
  13328. function computeSlotSegCollisions(seg, otherSegs, results) {
  13329. if (results === void 0) { results = []; }
  13330. for (var i = 0; i < otherSegs.length; i++) {
  13331. if (isSlotSegCollision(seg, otherSegs[i])) {
  13332. results.push(otherSegs[i]);
  13333. }
  13334. }
  13335. return results;
  13336. }
  13337. // Do these segments occupy the same vertical space?
  13338. function isSlotSegCollision(seg1, seg2) {
  13339. return seg1.bottom > seg2.top && seg1.top < seg2.bottom;
  13340. }
  13341. /***/ }),
  13342. /* 241 */
  13343. /***/ (function(module, exports, __webpack_require__) {
  13344. Object.defineProperty(exports, "__esModule", { value: true });
  13345. var tslib_1 = __webpack_require__(2);
  13346. var $ = __webpack_require__(3);
  13347. var HelperRenderer_1 = __webpack_require__(63);
  13348. var TimeGridHelperRenderer = /** @class */ (function (_super) {
  13349. tslib_1.__extends(TimeGridHelperRenderer, _super);
  13350. function TimeGridHelperRenderer() {
  13351. return _super !== null && _super.apply(this, arguments) || this;
  13352. }
  13353. TimeGridHelperRenderer.prototype.renderSegs = function (segs, sourceSeg) {
  13354. var helperNodes = [];
  13355. var i;
  13356. var seg;
  13357. var sourceEl;
  13358. // TODO: not good to call eventRenderer this way
  13359. this.eventRenderer.renderFgSegsIntoContainers(segs, this.component.helperContainerEls);
  13360. // Try to make the segment that is in the same row as sourceSeg look the same
  13361. for (i = 0; i < segs.length; i++) {
  13362. seg = segs[i];
  13363. if (sourceSeg && sourceSeg.col === seg.col) {
  13364. sourceEl = sourceSeg.el;
  13365. seg.el.css({
  13366. left: sourceEl.css('left'),
  13367. right: sourceEl.css('right'),
  13368. 'margin-left': sourceEl.css('margin-left'),
  13369. 'margin-right': sourceEl.css('margin-right')
  13370. });
  13371. }
  13372. helperNodes.push(seg.el[0]);
  13373. }
  13374. return $(helperNodes); // must return the elements rendered
  13375. };
  13376. return TimeGridHelperRenderer;
  13377. }(HelperRenderer_1.default));
  13378. exports.default = TimeGridHelperRenderer;
  13379. /***/ }),
  13380. /* 242 */
  13381. /***/ (function(module, exports, __webpack_require__) {
  13382. Object.defineProperty(exports, "__esModule", { value: true });
  13383. var tslib_1 = __webpack_require__(2);
  13384. var FillRenderer_1 = __webpack_require__(62);
  13385. var TimeGridFillRenderer = /** @class */ (function (_super) {
  13386. tslib_1.__extends(TimeGridFillRenderer, _super);
  13387. function TimeGridFillRenderer() {
  13388. return _super !== null && _super.apply(this, arguments) || this;
  13389. }
  13390. TimeGridFillRenderer.prototype.attachSegEls = function (type, segs) {
  13391. var timeGrid = this.component;
  13392. var containerEls;
  13393. // TODO: more efficient lookup
  13394. if (type === 'bgEvent') {
  13395. containerEls = timeGrid.bgContainerEls;
  13396. }
  13397. else if (type === 'businessHours') {
  13398. containerEls = timeGrid.businessContainerEls;
  13399. }
  13400. else if (type === 'highlight') {
  13401. containerEls = timeGrid.highlightContainerEls;
  13402. }
  13403. timeGrid.updateSegVerticals(segs);
  13404. timeGrid.attachSegsByCol(timeGrid.groupSegsByCol(segs), containerEls);
  13405. return segs.map(function (seg) {
  13406. return seg.el[0];
  13407. });
  13408. };
  13409. return TimeGridFillRenderer;
  13410. }(FillRenderer_1.default));
  13411. exports.default = TimeGridFillRenderer;
  13412. /***/ }),
  13413. /* 243 */
  13414. /***/ (function(module, exports, __webpack_require__) {
  13415. Object.defineProperty(exports, "__esModule", { value: true });
  13416. var tslib_1 = __webpack_require__(2);
  13417. var $ = __webpack_require__(3);
  13418. var util_1 = __webpack_require__(4);
  13419. var EventRenderer_1 = __webpack_require__(44);
  13420. /* Event-rendering methods for the DayGrid class
  13421. ----------------------------------------------------------------------------------------------------------------------*/
  13422. var DayGridEventRenderer = /** @class */ (function (_super) {
  13423. tslib_1.__extends(DayGridEventRenderer, _super);
  13424. function DayGridEventRenderer(dayGrid, fillRenderer) {
  13425. var _this = _super.call(this, dayGrid, fillRenderer) || this;
  13426. _this.dayGrid = dayGrid;
  13427. return _this;
  13428. }
  13429. DayGridEventRenderer.prototype.renderBgRanges = function (eventRanges) {
  13430. // don't render timed background events
  13431. eventRanges = $.grep(eventRanges, function (eventRange) {
  13432. return eventRange.eventDef.isAllDay();
  13433. });
  13434. _super.prototype.renderBgRanges.call(this, eventRanges);
  13435. };
  13436. // Renders the given foreground event segments onto the grid
  13437. DayGridEventRenderer.prototype.renderFgSegs = function (segs) {
  13438. var rowStructs = this.rowStructs = this.renderSegRows(segs);
  13439. // append to each row's content skeleton
  13440. this.dayGrid.rowEls.each(function (i, rowNode) {
  13441. $(rowNode).find('.fc-content-skeleton > table').append(rowStructs[i].tbodyEl);
  13442. });
  13443. };
  13444. // Unrenders all currently rendered foreground event segments
  13445. DayGridEventRenderer.prototype.unrenderFgSegs = function () {
  13446. var rowStructs = this.rowStructs || [];
  13447. var rowStruct;
  13448. while ((rowStruct = rowStructs.pop())) {
  13449. rowStruct.tbodyEl.remove();
  13450. }
  13451. this.rowStructs = null;
  13452. };
  13453. // Uses the given events array to generate <tbody> elements that should be appended to each row's content skeleton.
  13454. // Returns an array of rowStruct objects (see the bottom of `renderSegRow`).
  13455. // PRECONDITION: each segment shoud already have a rendered and assigned `.el`
  13456. DayGridEventRenderer.prototype.renderSegRows = function (segs) {
  13457. var rowStructs = [];
  13458. var segRows;
  13459. var row;
  13460. segRows = this.groupSegRows(segs); // group into nested arrays
  13461. // iterate each row of segment groupings
  13462. for (row = 0; row < segRows.length; row++) {
  13463. rowStructs.push(this.renderSegRow(row, segRows[row]));
  13464. }
  13465. return rowStructs;
  13466. };
  13467. // Given a row # and an array of segments all in the same row, render a <tbody> element, a skeleton that contains
  13468. // the segments. Returns object with a bunch of internal data about how the render was calculated.
  13469. // NOTE: modifies rowSegs
  13470. DayGridEventRenderer.prototype.renderSegRow = function (row, rowSegs) {
  13471. var colCnt = this.dayGrid.colCnt;
  13472. var segLevels = this.buildSegLevels(rowSegs); // group into sub-arrays of levels
  13473. var levelCnt = Math.max(1, segLevels.length); // ensure at least one level
  13474. var tbody = $('<tbody>');
  13475. var segMatrix = []; // lookup for which segments are rendered into which level+col cells
  13476. var cellMatrix = []; // lookup for all <td> elements of the level+col matrix
  13477. var loneCellMatrix = []; // lookup for <td> elements that only take up a single column
  13478. var i;
  13479. var levelSegs;
  13480. var col;
  13481. var tr;
  13482. var j;
  13483. var seg;
  13484. var td;
  13485. // populates empty cells from the current column (`col`) to `endCol`
  13486. function emptyCellsUntil(endCol) {
  13487. while (col < endCol) {
  13488. // try to grab a cell from the level above and extend its rowspan. otherwise, create a fresh cell
  13489. td = (loneCellMatrix[i - 1] || [])[col];
  13490. if (td) {
  13491. td.attr('rowspan', parseInt(td.attr('rowspan') || 1, 10) + 1);
  13492. }
  13493. else {
  13494. td = $('<td>');
  13495. tr.append(td);
  13496. }
  13497. cellMatrix[i][col] = td;
  13498. loneCellMatrix[i][col] = td;
  13499. col++;
  13500. }
  13501. }
  13502. for (i = 0; i < levelCnt; i++) { // iterate through all levels
  13503. levelSegs = segLevels[i];
  13504. col = 0;
  13505. tr = $('<tr>');
  13506. segMatrix.push([]);
  13507. cellMatrix.push([]);
  13508. loneCellMatrix.push([]);
  13509. // levelCnt might be 1 even though there are no actual levels. protect against this.
  13510. // this single empty row is useful for styling.
  13511. if (levelSegs) {
  13512. for (j = 0; j < levelSegs.length; j++) { // iterate through segments in level
  13513. seg = levelSegs[j];
  13514. emptyCellsUntil(seg.leftCol);
  13515. // create a container that occupies or more columns. append the event element.
  13516. td = $('<td class="fc-event-container">').append(seg.el);
  13517. if (seg.leftCol !== seg.rightCol) {
  13518. td.attr('colspan', seg.rightCol - seg.leftCol + 1);
  13519. }
  13520. else { // a single-column segment
  13521. loneCellMatrix[i][col] = td;
  13522. }
  13523. while (col <= seg.rightCol) {
  13524. cellMatrix[i][col] = td;
  13525. segMatrix[i][col] = seg;
  13526. col++;
  13527. }
  13528. tr.append(td);
  13529. }
  13530. }
  13531. emptyCellsUntil(colCnt); // finish off the row
  13532. this.dayGrid.bookendCells(tr);
  13533. tbody.append(tr);
  13534. }
  13535. return {
  13536. row: row,
  13537. tbodyEl: tbody,
  13538. cellMatrix: cellMatrix,
  13539. segMatrix: segMatrix,
  13540. segLevels: segLevels,
  13541. segs: rowSegs
  13542. };
  13543. };
  13544. // Stacks a flat array of segments, which are all assumed to be in the same row, into subarrays of vertical levels.
  13545. // NOTE: modifies segs
  13546. DayGridEventRenderer.prototype.buildSegLevels = function (segs) {
  13547. var levels = [];
  13548. var i;
  13549. var seg;
  13550. var j;
  13551. // Give preference to elements with certain criteria, so they have
  13552. // a chance to be closer to the top.
  13553. this.sortEventSegs(segs);
  13554. for (i = 0; i < segs.length; i++) {
  13555. seg = segs[i];
  13556. // loop through levels, starting with the topmost, until the segment doesn't collide with other segments
  13557. for (j = 0; j < levels.length; j++) {
  13558. if (!isDaySegCollision(seg, levels[j])) {
  13559. break;
  13560. }
  13561. }
  13562. // `j` now holds the desired subrow index
  13563. seg.level = j;
  13564. // create new level array if needed and append segment
  13565. (levels[j] || (levels[j] = [])).push(seg);
  13566. }
  13567. // order segments left-to-right. very important if calendar is RTL
  13568. for (j = 0; j < levels.length; j++) {
  13569. levels[j].sort(compareDaySegCols);
  13570. }
  13571. return levels;
  13572. };
  13573. // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's row
  13574. DayGridEventRenderer.prototype.groupSegRows = function (segs) {
  13575. var segRows = [];
  13576. var i;
  13577. for (i = 0; i < this.dayGrid.rowCnt; i++) {
  13578. segRows.push([]);
  13579. }
  13580. for (i = 0; i < segs.length; i++) {
  13581. segRows[segs[i].row].push(segs[i]);
  13582. }
  13583. return segRows;
  13584. };
  13585. // Computes a default event time formatting string if `timeFormat` is not explicitly defined
  13586. DayGridEventRenderer.prototype.computeEventTimeFormat = function () {
  13587. return this.opt('extraSmallTimeFormat'); // like "6p" or "6:30p"
  13588. };
  13589. // Computes a default `displayEventEnd` value if one is not expliclty defined
  13590. DayGridEventRenderer.prototype.computeDisplayEventEnd = function () {
  13591. return this.dayGrid.colCnt === 1; // we'll likely have space if there's only one day
  13592. };
  13593. // Builds the HTML to be used for the default element for an individual segment
  13594. DayGridEventRenderer.prototype.fgSegHtml = function (seg, disableResizing) {
  13595. var view = this.view;
  13596. var eventDef = seg.footprint.eventDef;
  13597. var isAllDay = seg.footprint.componentFootprint.isAllDay;
  13598. var isDraggable = view.isEventDefDraggable(eventDef);
  13599. var isResizableFromStart = !disableResizing && isAllDay &&
  13600. seg.isStart && view.isEventDefResizableFromStart(eventDef);
  13601. var isResizableFromEnd = !disableResizing && isAllDay &&
  13602. seg.isEnd && view.isEventDefResizableFromEnd(eventDef);
  13603. var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd);
  13604. var skinCss = util_1.cssToStr(this.getSkinCss(eventDef));
  13605. var timeHtml = '';
  13606. var timeText;
  13607. var titleHtml;
  13608. classes.unshift('fc-day-grid-event', 'fc-h-event');
  13609. // Only display a timed events time if it is the starting segment
  13610. if (seg.isStart) {
  13611. timeText = this.getTimeText(seg.footprint);
  13612. if (timeText) {
  13613. timeHtml = '<span class="fc-time">' + util_1.htmlEscape(timeText) + '</span>';
  13614. }
  13615. }
  13616. titleHtml =
  13617. '<span class="fc-title">' +
  13618. (util_1.htmlEscape(eventDef.title || '') || '&nbsp;') + // we always want one line of height
  13619. '</span>';
  13620. return '<a class="' + classes.join(' ') + '"' +
  13621. (eventDef.url ?
  13622. ' href="' + util_1.htmlEscape(eventDef.url) + '"' :
  13623. '') +
  13624. (skinCss ?
  13625. ' style="' + skinCss + '"' :
  13626. '') +
  13627. '>' +
  13628. '<div class="fc-content">' +
  13629. (this.dayGrid.isRTL ?
  13630. titleHtml + ' ' + timeHtml : // put a natural space in between
  13631. timeHtml + ' ' + titleHtml //
  13632. ) +
  13633. '</div>' +
  13634. (isResizableFromStart ?
  13635. '<div class="fc-resizer fc-start-resizer"></div>' :
  13636. '') +
  13637. (isResizableFromEnd ?
  13638. '<div class="fc-resizer fc-end-resizer"></div>' :
  13639. '') +
  13640. '</a>';
  13641. };
  13642. return DayGridEventRenderer;
  13643. }(EventRenderer_1.default));
  13644. exports.default = DayGridEventRenderer;
  13645. // Computes whether two segments' columns collide. They are assumed to be in the same row.
  13646. function isDaySegCollision(seg, otherSegs) {
  13647. var i;
  13648. var otherSeg;
  13649. for (i = 0; i < otherSegs.length; i++) {
  13650. otherSeg = otherSegs[i];
  13651. if (otherSeg.leftCol <= seg.rightCol &&
  13652. otherSeg.rightCol >= seg.leftCol) {
  13653. return true;
  13654. }
  13655. }
  13656. return false;
  13657. }
  13658. // A cmp function for determining the leftmost event
  13659. function compareDaySegCols(a, b) {
  13660. return a.leftCol - b.leftCol;
  13661. }
  13662. /***/ }),
  13663. /* 244 */
  13664. /***/ (function(module, exports, __webpack_require__) {
  13665. Object.defineProperty(exports, "__esModule", { value: true });
  13666. var tslib_1 = __webpack_require__(2);
  13667. var $ = __webpack_require__(3);
  13668. var HelperRenderer_1 = __webpack_require__(63);
  13669. var DayGridHelperRenderer = /** @class */ (function (_super) {
  13670. tslib_1.__extends(DayGridHelperRenderer, _super);
  13671. function DayGridHelperRenderer() {
  13672. return _super !== null && _super.apply(this, arguments) || this;
  13673. }
  13674. // Renders a mock "helper" event. `sourceSeg` is the associated internal segment object. It can be null.
  13675. DayGridHelperRenderer.prototype.renderSegs = function (segs, sourceSeg) {
  13676. var helperNodes = [];
  13677. var rowStructs;
  13678. // TODO: not good to call eventRenderer this way
  13679. rowStructs = this.eventRenderer.renderSegRows(segs);
  13680. // inject each new event skeleton into each associated row
  13681. this.component.rowEls.each(function (row, rowNode) {
  13682. var rowEl = $(rowNode); // the .fc-row
  13683. var skeletonEl = $('<div class="fc-helper-skeleton"><table></table></div>'); // will be absolutely positioned
  13684. var skeletonTopEl;
  13685. var skeletonTop;
  13686. // If there is an original segment, match the top position. Otherwise, put it at the row's top level
  13687. if (sourceSeg && sourceSeg.row === row) {
  13688. skeletonTop = sourceSeg.el.position().top;
  13689. }
  13690. else {
  13691. skeletonTopEl = rowEl.find('.fc-content-skeleton tbody');
  13692. if (!skeletonTopEl.length) { // when no events
  13693. skeletonTopEl = rowEl.find('.fc-content-skeleton table');
  13694. }
  13695. skeletonTop = skeletonTopEl.position().top;
  13696. }
  13697. skeletonEl.css('top', skeletonTop)
  13698. .find('table')
  13699. .append(rowStructs[row].tbodyEl);
  13700. rowEl.append(skeletonEl);
  13701. helperNodes.push(skeletonEl[0]);
  13702. });
  13703. return $(helperNodes); // must return the elements rendered
  13704. };
  13705. return DayGridHelperRenderer;
  13706. }(HelperRenderer_1.default));
  13707. exports.default = DayGridHelperRenderer;
  13708. /***/ }),
  13709. /* 245 */
  13710. /***/ (function(module, exports, __webpack_require__) {
  13711. Object.defineProperty(exports, "__esModule", { value: true });
  13712. var tslib_1 = __webpack_require__(2);
  13713. var $ = __webpack_require__(3);
  13714. var FillRenderer_1 = __webpack_require__(62);
  13715. var DayGridFillRenderer = /** @class */ (function (_super) {
  13716. tslib_1.__extends(DayGridFillRenderer, _super);
  13717. function DayGridFillRenderer() {
  13718. var _this = _super !== null && _super.apply(this, arguments) || this;
  13719. _this.fillSegTag = 'td'; // override the default tag name
  13720. return _this;
  13721. }
  13722. DayGridFillRenderer.prototype.attachSegEls = function (type, segs) {
  13723. var nodes = [];
  13724. var i;
  13725. var seg;
  13726. var skeletonEl;
  13727. for (i = 0; i < segs.length; i++) {
  13728. seg = segs[i];
  13729. skeletonEl = this.renderFillRow(type, seg);
  13730. this.component.rowEls.eq(seg.row).append(skeletonEl);
  13731. nodes.push(skeletonEl[0]);
  13732. }
  13733. return nodes;
  13734. };
  13735. // Generates the HTML needed for one row of a fill. Requires the seg's el to be rendered.
  13736. DayGridFillRenderer.prototype.renderFillRow = function (type, seg) {
  13737. var colCnt = this.component.colCnt;
  13738. var startCol = seg.leftCol;
  13739. var endCol = seg.rightCol + 1;
  13740. var className;
  13741. var skeletonEl;
  13742. var trEl;
  13743. if (type === 'businessHours') {
  13744. className = 'bgevent';
  13745. }
  13746. else {
  13747. className = type.toLowerCase();
  13748. }
  13749. skeletonEl = $('<div class="fc-' + className + '-skeleton">' +
  13750. '<table><tr></tr></table>' +
  13751. '</div>');
  13752. trEl = skeletonEl.find('tr');
  13753. if (startCol > 0) {
  13754. trEl.append(
  13755. // will create (startCol + 1) td's
  13756. new Array(startCol + 1).join('<td></td>'));
  13757. }
  13758. trEl.append(seg.el.attr('colspan', endCol - startCol));
  13759. if (endCol < colCnt) {
  13760. trEl.append(
  13761. // will create (colCnt - endCol) td's
  13762. new Array(colCnt - endCol + 1).join('<td></td>'));
  13763. }
  13764. this.component.bookendCells(trEl);
  13765. return skeletonEl;
  13766. };
  13767. return DayGridFillRenderer;
  13768. }(FillRenderer_1.default));
  13769. exports.default = DayGridFillRenderer;
  13770. /***/ }),
  13771. /* 246 */
  13772. /***/ (function(module, exports, __webpack_require__) {
  13773. Object.defineProperty(exports, "__esModule", { value: true });
  13774. var tslib_1 = __webpack_require__(2);
  13775. var moment = __webpack_require__(0);
  13776. var util_1 = __webpack_require__(4);
  13777. var BasicView_1 = __webpack_require__(67);
  13778. var MonthViewDateProfileGenerator_1 = __webpack_require__(247);
  13779. /* A month view with day cells running in rows (one-per-week) and columns
  13780. ----------------------------------------------------------------------------------------------------------------------*/
  13781. var MonthView = /** @class */ (function (_super) {
  13782. tslib_1.__extends(MonthView, _super);
  13783. function MonthView() {
  13784. return _super !== null && _super.apply(this, arguments) || this;
  13785. }
  13786. // Overrides the default BasicView behavior to have special multi-week auto-height logic
  13787. MonthView.prototype.setGridHeight = function (height, isAuto) {
  13788. // if auto, make the height of each row the height that it would be if there were 6 weeks
  13789. if (isAuto) {
  13790. height *= this.dayGrid.rowCnt / 6;
  13791. }
  13792. util_1.distributeHeight(this.dayGrid.rowEls, height, !isAuto); // if auto, don't compensate for height-hogging rows
  13793. };
  13794. MonthView.prototype.isDateInOtherMonth = function (date, dateProfile) {
  13795. return date.month() !== moment.utc(dateProfile.currentUnzonedRange.startMs).month(); // TODO: optimize
  13796. };
  13797. return MonthView;
  13798. }(BasicView_1.default));
  13799. exports.default = MonthView;
  13800. MonthView.prototype.dateProfileGeneratorClass = MonthViewDateProfileGenerator_1.default;
  13801. /***/ }),
  13802. /* 247 */
  13803. /***/ (function(module, exports, __webpack_require__) {
  13804. Object.defineProperty(exports, "__esModule", { value: true });
  13805. var tslib_1 = __webpack_require__(2);
  13806. var BasicViewDateProfileGenerator_1 = __webpack_require__(68);
  13807. var UnzonedRange_1 = __webpack_require__(5);
  13808. var MonthViewDateProfileGenerator = /** @class */ (function (_super) {
  13809. tslib_1.__extends(MonthViewDateProfileGenerator, _super);
  13810. function MonthViewDateProfileGenerator() {
  13811. return _super !== null && _super.apply(this, arguments) || this;
  13812. }
  13813. // Computes the date range that will be rendered.
  13814. MonthViewDateProfileGenerator.prototype.buildRenderRange = function (currentUnzonedRange, currentRangeUnit, isRangeAllDay) {
  13815. var renderUnzonedRange = _super.prototype.buildRenderRange.call(this, currentUnzonedRange, currentRangeUnit, isRangeAllDay);
  13816. var start = this.msToUtcMoment(renderUnzonedRange.startMs, isRangeAllDay);
  13817. var end = this.msToUtcMoment(renderUnzonedRange.endMs, isRangeAllDay);
  13818. var rowCnt;
  13819. // ensure 6 weeks
  13820. if (this.opt('fixedWeekCount')) {
  13821. rowCnt = Math.ceil(// could be partial weeks due to hiddenDays
  13822. end.diff(start, 'weeks', true) // dontRound=true
  13823. );
  13824. end.add(6 - rowCnt, 'weeks');
  13825. }
  13826. return new UnzonedRange_1.default(start, end);
  13827. };
  13828. return MonthViewDateProfileGenerator;
  13829. }(BasicViewDateProfileGenerator_1.default));
  13830. exports.default = MonthViewDateProfileGenerator;
  13831. /***/ }),
  13832. /* 248 */
  13833. /***/ (function(module, exports, __webpack_require__) {
  13834. Object.defineProperty(exports, "__esModule", { value: true });
  13835. var tslib_1 = __webpack_require__(2);
  13836. var $ = __webpack_require__(3);
  13837. var util_1 = __webpack_require__(4);
  13838. var UnzonedRange_1 = __webpack_require__(5);
  13839. var View_1 = __webpack_require__(43);
  13840. var Scroller_1 = __webpack_require__(41);
  13841. var ListEventRenderer_1 = __webpack_require__(249);
  13842. var ListEventPointing_1 = __webpack_require__(250);
  13843. /*
  13844. Responsible for the scroller, and forwarding event-related actions into the "grid".
  13845. */
  13846. var ListView = /** @class */ (function (_super) {
  13847. tslib_1.__extends(ListView, _super);
  13848. function ListView(calendar, viewSpec) {
  13849. var _this = _super.call(this, calendar, viewSpec) || this;
  13850. _this.segSelector = '.fc-list-item'; // which elements accept event actions
  13851. _this.scroller = new Scroller_1.default({
  13852. overflowX: 'hidden',
  13853. overflowY: 'auto'
  13854. });
  13855. return _this;
  13856. }
  13857. ListView.prototype.renderSkeleton = function () {
  13858. this.el.addClass('fc-list-view ' +
  13859. this.calendar.theme.getClass('listView'));
  13860. this.scroller.render();
  13861. this.scroller.el.appendTo(this.el);
  13862. this.contentEl = this.scroller.scrollEl; // shortcut
  13863. };
  13864. ListView.prototype.unrenderSkeleton = function () {
  13865. this.scroller.destroy(); // will remove the Grid too
  13866. };
  13867. ListView.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  13868. _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
  13869. this.scroller.clear(); // sets height to 'auto' and clears overflow
  13870. if (!isAuto) {
  13871. this.scroller.setHeight(this.computeScrollerHeight(totalHeight));
  13872. }
  13873. };
  13874. ListView.prototype.computeScrollerHeight = function (totalHeight) {
  13875. return totalHeight -
  13876. util_1.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
  13877. };
  13878. ListView.prototype.renderDates = function (dateProfile) {
  13879. var calendar = this.calendar;
  13880. var dayStart = calendar.msToUtcMoment(dateProfile.renderUnzonedRange.startMs, true);
  13881. var viewEnd = calendar.msToUtcMoment(dateProfile.renderUnzonedRange.endMs, true);
  13882. var dayDates = [];
  13883. var dayRanges = [];
  13884. while (dayStart < viewEnd) {
  13885. dayDates.push(dayStart.clone());
  13886. dayRanges.push(new UnzonedRange_1.default(dayStart, dayStart.clone().add(1, 'day')));
  13887. dayStart.add(1, 'day');
  13888. }
  13889. this.dayDates = dayDates;
  13890. this.dayRanges = dayRanges;
  13891. // all real rendering happens in EventRenderer
  13892. };
  13893. // slices by day
  13894. ListView.prototype.componentFootprintToSegs = function (footprint) {
  13895. var dayRanges = this.dayRanges;
  13896. var dayIndex;
  13897. var segRange;
  13898. var seg;
  13899. var segs = [];
  13900. for (dayIndex = 0; dayIndex < dayRanges.length; dayIndex++) {
  13901. segRange = footprint.unzonedRange.intersect(dayRanges[dayIndex]);
  13902. if (segRange) {
  13903. seg = {
  13904. startMs: segRange.startMs,
  13905. endMs: segRange.endMs,
  13906. isStart: segRange.isStart,
  13907. isEnd: segRange.isEnd,
  13908. dayIndex: dayIndex
  13909. };
  13910. segs.push(seg);
  13911. // detect when footprint won't go fully into the next day,
  13912. // and mutate the latest seg to the be the end.
  13913. if (!seg.isEnd && !footprint.isAllDay &&
  13914. dayIndex + 1 < dayRanges.length &&
  13915. footprint.unzonedRange.endMs < dayRanges[dayIndex + 1].startMs + this.nextDayThreshold) {
  13916. seg.endMs = footprint.unzonedRange.endMs;
  13917. seg.isEnd = true;
  13918. break;
  13919. }
  13920. }
  13921. }
  13922. return segs;
  13923. };
  13924. ListView.prototype.renderEmptyMessage = function () {
  13925. this.contentEl.html('<div class="fc-list-empty-wrap2">' + // TODO: try less wraps
  13926. '<div class="fc-list-empty-wrap1">' +
  13927. '<div class="fc-list-empty">' +
  13928. util_1.htmlEscape(this.opt('noEventsMessage')) +
  13929. '</div>' +
  13930. '</div>' +
  13931. '</div>');
  13932. };
  13933. // render the event segments in the view
  13934. ListView.prototype.renderSegList = function (allSegs) {
  13935. var segsByDay = this.groupSegsByDay(allSegs); // sparse array
  13936. var dayIndex;
  13937. var daySegs;
  13938. var i;
  13939. var tableEl = $('<table class="fc-list-table ' + this.calendar.theme.getClass('tableList') + '"><tbody></tbody></table>');
  13940. var tbodyEl = tableEl.find('tbody');
  13941. for (dayIndex = 0; dayIndex < segsByDay.length; dayIndex++) {
  13942. daySegs = segsByDay[dayIndex];
  13943. if (daySegs) { // sparse array, so might be undefined
  13944. // append a day header
  13945. tbodyEl.append(this.dayHeaderHtml(this.dayDates[dayIndex]));
  13946. this.eventRenderer.sortEventSegs(daySegs);
  13947. for (i = 0; i < daySegs.length; i++) {
  13948. tbodyEl.append(daySegs[i].el); // append event row
  13949. }
  13950. }
  13951. }
  13952. this.contentEl.empty().append(tableEl);
  13953. };
  13954. // Returns a sparse array of arrays, segs grouped by their dayIndex
  13955. ListView.prototype.groupSegsByDay = function (segs) {
  13956. var segsByDay = []; // sparse array
  13957. var i;
  13958. var seg;
  13959. for (i = 0; i < segs.length; i++) {
  13960. seg = segs[i];
  13961. (segsByDay[seg.dayIndex] || (segsByDay[seg.dayIndex] = []))
  13962. .push(seg);
  13963. }
  13964. return segsByDay;
  13965. };
  13966. // generates the HTML for the day headers that live amongst the event rows
  13967. ListView.prototype.dayHeaderHtml = function (dayDate) {
  13968. var mainFormat = this.opt('listDayFormat');
  13969. var altFormat = this.opt('listDayAltFormat');
  13970. return '<tr class="fc-list-heading" data-date="' + dayDate.format('YYYY-MM-DD') + '">' +
  13971. '<td class="' + (this.calendar.theme.getClass('tableListHeading') ||
  13972. this.calendar.theme.getClass('widgetHeader')) + '" colspan="3">' +
  13973. (mainFormat ?
  13974. this.buildGotoAnchorHtml(dayDate, { 'class': 'fc-list-heading-main' }, util_1.htmlEscape(dayDate.format(mainFormat)) // inner HTML
  13975. ) :
  13976. '') +
  13977. (altFormat ?
  13978. this.buildGotoAnchorHtml(dayDate, { 'class': 'fc-list-heading-alt' }, util_1.htmlEscape(dayDate.format(altFormat)) // inner HTML
  13979. ) :
  13980. '') +
  13981. '</td>' +
  13982. '</tr>';
  13983. };
  13984. return ListView;
  13985. }(View_1.default));
  13986. exports.default = ListView;
  13987. ListView.prototype.eventRendererClass = ListEventRenderer_1.default;
  13988. ListView.prototype.eventPointingClass = ListEventPointing_1.default;
  13989. /***/ }),
  13990. /* 249 */
  13991. /***/ (function(module, exports, __webpack_require__) {
  13992. Object.defineProperty(exports, "__esModule", { value: true });
  13993. var tslib_1 = __webpack_require__(2);
  13994. var util_1 = __webpack_require__(4);
  13995. var EventRenderer_1 = __webpack_require__(44);
  13996. var ListEventRenderer = /** @class */ (function (_super) {
  13997. tslib_1.__extends(ListEventRenderer, _super);
  13998. function ListEventRenderer() {
  13999. return _super !== null && _super.apply(this, arguments) || this;
  14000. }
  14001. ListEventRenderer.prototype.renderFgSegs = function (segs) {
  14002. if (!segs.length) {
  14003. this.component.renderEmptyMessage();
  14004. }
  14005. else {
  14006. this.component.renderSegList(segs);
  14007. }
  14008. };
  14009. // generates the HTML for a single event row
  14010. ListEventRenderer.prototype.fgSegHtml = function (seg) {
  14011. var view = this.view;
  14012. var calendar = view.calendar;
  14013. var theme = calendar.theme;
  14014. var eventFootprint = seg.footprint;
  14015. var eventDef = eventFootprint.eventDef;
  14016. var componentFootprint = eventFootprint.componentFootprint;
  14017. var url = eventDef.url;
  14018. var classes = ['fc-list-item'].concat(this.getClasses(eventDef));
  14019. var bgColor = this.getBgColor(eventDef);
  14020. var timeHtml;
  14021. if (componentFootprint.isAllDay) {
  14022. timeHtml = view.getAllDayHtml();
  14023. }
  14024. else if (view.isMultiDayRange(componentFootprint.unzonedRange)) {
  14025. if (seg.isStart || seg.isEnd) { // outer segment that probably lasts part of the day
  14026. timeHtml = util_1.htmlEscape(this._getTimeText(calendar.msToMoment(seg.startMs), calendar.msToMoment(seg.endMs), componentFootprint.isAllDay));
  14027. }
  14028. else { // inner segment that lasts the whole day
  14029. timeHtml = view.getAllDayHtml();
  14030. }
  14031. }
  14032. else {
  14033. // Display the normal time text for the *event's* times
  14034. timeHtml = util_1.htmlEscape(this.getTimeText(eventFootprint));
  14035. }
  14036. if (url) {
  14037. classes.push('fc-has-url');
  14038. }
  14039. return '<tr class="' + classes.join(' ') + '">' +
  14040. (this.displayEventTime ?
  14041. '<td class="fc-list-item-time ' + theme.getClass('widgetContent') + '">' +
  14042. (timeHtml || '') +
  14043. '</td>' :
  14044. '') +
  14045. '<td class="fc-list-item-marker ' + theme.getClass('widgetContent') + '">' +
  14046. '<span class="fc-event-dot"' +
  14047. (bgColor ?
  14048. ' style="background-color:' + bgColor + '"' :
  14049. '') +
  14050. '></span>' +
  14051. '</td>' +
  14052. '<td class="fc-list-item-title ' + theme.getClass('widgetContent') + '">' +
  14053. '<a' + (url ? ' href="' + util_1.htmlEscape(url) + '"' : '') + '>' +
  14054. util_1.htmlEscape(eventDef.title || '') +
  14055. '</a>' +
  14056. '</td>' +
  14057. '</tr>';
  14058. };
  14059. // like "4:00am"
  14060. ListEventRenderer.prototype.computeEventTimeFormat = function () {
  14061. return this.opt('mediumTimeFormat');
  14062. };
  14063. return ListEventRenderer;
  14064. }(EventRenderer_1.default));
  14065. exports.default = ListEventRenderer;
  14066. /***/ }),
  14067. /* 250 */
  14068. /***/ (function(module, exports, __webpack_require__) {
  14069. Object.defineProperty(exports, "__esModule", { value: true });
  14070. var tslib_1 = __webpack_require__(2);
  14071. var $ = __webpack_require__(3);
  14072. var EventPointing_1 = __webpack_require__(64);
  14073. var ListEventPointing = /** @class */ (function (_super) {
  14074. tslib_1.__extends(ListEventPointing, _super);
  14075. function ListEventPointing() {
  14076. return _super !== null && _super.apply(this, arguments) || this;
  14077. }
  14078. // for events with a url, the whole <tr> should be clickable,
  14079. // but it's impossible to wrap with an <a> tag. simulate this.
  14080. ListEventPointing.prototype.handleClick = function (seg, ev) {
  14081. var url;
  14082. _super.prototype.handleClick.call(this, seg, ev); // might prevent the default action
  14083. // not clicking on or within an <a> with an href
  14084. if (!$(ev.target).closest('a[href]').length) {
  14085. url = seg.footprint.eventDef.url;
  14086. if (url && !ev.isDefaultPrevented()) { // jsEvent not cancelled in handler
  14087. window.location.href = url; // simulate link click
  14088. }
  14089. }
  14090. };
  14091. return ListEventPointing;
  14092. }(EventPointing_1.default));
  14093. exports.default = ListEventPointing;
  14094. /***/ }),
  14095. /* 251 */,
  14096. /* 252 */,
  14097. /* 253 */,
  14098. /* 254 */,
  14099. /* 255 */,
  14100. /* 256 */
  14101. /***/ (function(module, exports, __webpack_require__) {
  14102. var $ = __webpack_require__(3);
  14103. var exportHooks = __webpack_require__(18);
  14104. var util_1 = __webpack_require__(4);
  14105. var Calendar_1 = __webpack_require__(232);
  14106. // for intentional side-effects
  14107. __webpack_require__(11);
  14108. __webpack_require__(49);
  14109. __webpack_require__(260);
  14110. __webpack_require__(261);
  14111. __webpack_require__(264);
  14112. __webpack_require__(265);
  14113. __webpack_require__(266);
  14114. __webpack_require__(267);
  14115. $.fullCalendar = exportHooks;
  14116. $.fn.fullCalendar = function (options) {
  14117. var args = Array.prototype.slice.call(arguments, 1); // for a possible method call
  14118. var res = this; // what this function will return (this jQuery object by default)
  14119. this.each(function (i, _element) {
  14120. var element = $(_element);
  14121. var calendar = element.data('fullCalendar'); // get the existing calendar object (if any)
  14122. var singleRes; // the returned value of this single method call
  14123. // a method call
  14124. if (typeof options === 'string') {
  14125. if (options === 'getCalendar') {
  14126. if (!i) { // first element only
  14127. res = calendar;
  14128. }
  14129. }
  14130. else if (options === 'destroy') { // don't warn if no calendar object
  14131. if (calendar) {
  14132. calendar.destroy();
  14133. element.removeData('fullCalendar');
  14134. }
  14135. }
  14136. else if (!calendar) {
  14137. util_1.warn('Attempting to call a FullCalendar method on an element with no calendar.');
  14138. }
  14139. else if ($.isFunction(calendar[options])) {
  14140. singleRes = calendar[options].apply(calendar, args);
  14141. if (!i) {
  14142. res = singleRes; // record the first method call result
  14143. }
  14144. if (options === 'destroy') { // for the destroy method, must remove Calendar object data
  14145. element.removeData('fullCalendar');
  14146. }
  14147. }
  14148. else {
  14149. util_1.warn("'" + options + "' is an unknown FullCalendar method.");
  14150. }
  14151. }
  14152. else if (!calendar) { // don't initialize twice
  14153. calendar = new Calendar_1.default(element, options);
  14154. element.data('fullCalendar', calendar);
  14155. calendar.render();
  14156. }
  14157. });
  14158. return res;
  14159. };
  14160. module.exports = exportHooks;
  14161. /***/ }),
  14162. /* 257 */
  14163. /***/ (function(module, exports, __webpack_require__) {
  14164. Object.defineProperty(exports, "__esModule", { value: true });
  14165. var $ = __webpack_require__(3);
  14166. var util_1 = __webpack_require__(4);
  14167. /* Toolbar with buttons and title
  14168. ----------------------------------------------------------------------------------------------------------------------*/
  14169. var Toolbar = /** @class */ (function () {
  14170. function Toolbar(calendar, toolbarOptions) {
  14171. this.el = null; // mirrors local `el`
  14172. this.viewsWithButtons = [];
  14173. this.calendar = calendar;
  14174. this.toolbarOptions = toolbarOptions;
  14175. }
  14176. // method to update toolbar-specific options, not calendar-wide options
  14177. Toolbar.prototype.setToolbarOptions = function (newToolbarOptions) {
  14178. this.toolbarOptions = newToolbarOptions;
  14179. };
  14180. // can be called repeatedly and will rerender
  14181. Toolbar.prototype.render = function () {
  14182. var sections = this.toolbarOptions.layout;
  14183. var el = this.el;
  14184. if (sections) {
  14185. if (!el) {
  14186. el = this.el = $("<div class='fc-toolbar " + this.toolbarOptions.extraClasses + "'>");
  14187. }
  14188. else {
  14189. el.empty();
  14190. }
  14191. el.append(this.renderSection('left'))
  14192. .append(this.renderSection('right'))
  14193. .append(this.renderSection('center'))
  14194. .append('<div class="fc-clear"></div>');
  14195. }
  14196. else {
  14197. this.removeElement();
  14198. }
  14199. };
  14200. Toolbar.prototype.removeElement = function () {
  14201. if (this.el) {
  14202. this.el.remove();
  14203. this.el = null;
  14204. }
  14205. };
  14206. Toolbar.prototype.renderSection = function (position) {
  14207. var _this = this;
  14208. var calendar = this.calendar;
  14209. var theme = calendar.theme;
  14210. var optionsManager = calendar.optionsManager;
  14211. var viewSpecManager = calendar.viewSpecManager;
  14212. var sectionEl = $('<div class="fc-' + position + '">');
  14213. var buttonStr = this.toolbarOptions.layout[position];
  14214. var calendarCustomButtons = optionsManager.get('customButtons') || {};
  14215. var calendarButtonTextOverrides = optionsManager.overrides.buttonText || {};
  14216. var calendarButtonText = optionsManager.get('buttonText') || {};
  14217. if (buttonStr) {
  14218. $.each(buttonStr.split(' '), function (i, buttonGroupStr) {
  14219. var groupChildren = $();
  14220. var isOnlyButtons = true;
  14221. var groupEl;
  14222. $.each(buttonGroupStr.split(','), function (j, buttonName) {
  14223. var customButtonProps;
  14224. var viewSpec;
  14225. var buttonClick;
  14226. var buttonIcon; // only one of these will be set
  14227. var buttonText; // "
  14228. var buttonInnerHtml;
  14229. var buttonClasses;
  14230. var buttonEl;
  14231. var buttonAriaAttr;
  14232. if (buttonName === 'title') {
  14233. groupChildren = groupChildren.add($('<h2>&nbsp;</h2>')); // we always want it to take up height
  14234. isOnlyButtons = false;
  14235. }
  14236. else {
  14237. if ((customButtonProps = calendarCustomButtons[buttonName])) {
  14238. buttonClick = function (ev) {
  14239. if (customButtonProps.click) {
  14240. customButtonProps.click.call(buttonEl[0], ev);
  14241. }
  14242. };
  14243. (buttonIcon = theme.getCustomButtonIconClass(customButtonProps)) ||
  14244. (buttonIcon = theme.getIconClass(buttonName)) ||
  14245. (buttonText = customButtonProps.text);
  14246. }
  14247. else if ((viewSpec = viewSpecManager.getViewSpec(buttonName))) {
  14248. _this.viewsWithButtons.push(buttonName);
  14249. buttonClick = function () {
  14250. calendar.changeView(buttonName);
  14251. };
  14252. (buttonText = viewSpec.buttonTextOverride) ||
  14253. (buttonIcon = theme.getIconClass(buttonName)) ||
  14254. (buttonText = viewSpec.buttonTextDefault);
  14255. }
  14256. else if (calendar[buttonName]) { // a calendar method
  14257. buttonClick = function () {
  14258. calendar[buttonName]();
  14259. };
  14260. (buttonText = calendarButtonTextOverrides[buttonName]) ||
  14261. (buttonIcon = theme.getIconClass(buttonName)) ||
  14262. (buttonText = calendarButtonText[buttonName]);
  14263. // ^ everything else is considered default
  14264. }
  14265. if (buttonClick) {
  14266. buttonClasses = [
  14267. 'fc-' + buttonName + '-button',
  14268. theme.getClass('button'),
  14269. theme.getClass('stateDefault')
  14270. ];
  14271. if (buttonText) {
  14272. buttonInnerHtml = util_1.htmlEscape(buttonText);
  14273. buttonAriaAttr = '';
  14274. }
  14275. else if (buttonIcon) {
  14276. buttonInnerHtml = "<span class='" + buttonIcon + "'></span>";
  14277. buttonAriaAttr = ' aria-label="' + buttonName + '"';
  14278. }
  14279. buttonEl = $(// type="button" so that it doesn't submit a form
  14280. '<button type="button" class="' + buttonClasses.join(' ') + '"' +
  14281. buttonAriaAttr +
  14282. '>' + buttonInnerHtml + '</button>')
  14283. .click(function (ev) {
  14284. // don't process clicks for disabled buttons
  14285. if (!buttonEl.hasClass(theme.getClass('stateDisabled'))) {
  14286. buttonClick(ev);
  14287. // after the click action, if the button becomes the "active" tab, or disabled,
  14288. // it should never have a hover class, so remove it now.
  14289. if (buttonEl.hasClass(theme.getClass('stateActive')) ||
  14290. buttonEl.hasClass(theme.getClass('stateDisabled'))) {
  14291. buttonEl.removeClass(theme.getClass('stateHover'));
  14292. }
  14293. }
  14294. })
  14295. .mousedown(function () {
  14296. // the *down* effect (mouse pressed in).
  14297. // only on buttons that are not the "active" tab, or disabled
  14298. buttonEl
  14299. .not('.' + theme.getClass('stateActive'))
  14300. .not('.' + theme.getClass('stateDisabled'))
  14301. .addClass(theme.getClass('stateDown'));
  14302. })
  14303. .mouseup(function () {
  14304. // undo the *down* effect
  14305. buttonEl.removeClass(theme.getClass('stateDown'));
  14306. })
  14307. .hover(function () {
  14308. // the *hover* effect.
  14309. // only on buttons that are not the "active" tab, or disabled
  14310. buttonEl
  14311. .not('.' + theme.getClass('stateActive'))
  14312. .not('.' + theme.getClass('stateDisabled'))
  14313. .addClass(theme.getClass('stateHover'));
  14314. }, function () {
  14315. // undo the *hover* effect
  14316. buttonEl
  14317. .removeClass(theme.getClass('stateHover'))
  14318. .removeClass(theme.getClass('stateDown')); // if mouseleave happens before mouseup
  14319. });
  14320. groupChildren = groupChildren.add(buttonEl);
  14321. }
  14322. }
  14323. });
  14324. if (isOnlyButtons) {
  14325. groupChildren
  14326. .first().addClass(theme.getClass('cornerLeft')).end()
  14327. .last().addClass(theme.getClass('cornerRight')).end();
  14328. }
  14329. if (groupChildren.length > 1) {
  14330. groupEl = $('<div>');
  14331. if (isOnlyButtons) {
  14332. groupEl.addClass(theme.getClass('buttonGroup'));
  14333. }
  14334. groupEl.append(groupChildren);
  14335. sectionEl.append(groupEl);
  14336. }
  14337. else {
  14338. sectionEl.append(groupChildren); // 1 or 0 children
  14339. }
  14340. });
  14341. }
  14342. return sectionEl;
  14343. };
  14344. Toolbar.prototype.updateTitle = function (text) {
  14345. if (this.el) {
  14346. this.el.find('h2').text(text);
  14347. }
  14348. };
  14349. Toolbar.prototype.activateButton = function (buttonName) {
  14350. if (this.el) {
  14351. this.el.find('.fc-' + buttonName + '-button')
  14352. .addClass(this.calendar.theme.getClass('stateActive'));
  14353. }
  14354. };
  14355. Toolbar.prototype.deactivateButton = function (buttonName) {
  14356. if (this.el) {
  14357. this.el.find('.fc-' + buttonName + '-button')
  14358. .removeClass(this.calendar.theme.getClass('stateActive'));
  14359. }
  14360. };
  14361. Toolbar.prototype.disableButton = function (buttonName) {
  14362. if (this.el) {
  14363. this.el.find('.fc-' + buttonName + '-button')
  14364. .prop('disabled', true)
  14365. .addClass(this.calendar.theme.getClass('stateDisabled'));
  14366. }
  14367. };
  14368. Toolbar.prototype.enableButton = function (buttonName) {
  14369. if (this.el) {
  14370. this.el.find('.fc-' + buttonName + '-button')
  14371. .prop('disabled', false)
  14372. .removeClass(this.calendar.theme.getClass('stateDisabled'));
  14373. }
  14374. };
  14375. Toolbar.prototype.getViewsWithButtons = function () {
  14376. return this.viewsWithButtons;
  14377. };
  14378. return Toolbar;
  14379. }());
  14380. exports.default = Toolbar;
  14381. /***/ }),
  14382. /* 258 */
  14383. /***/ (function(module, exports, __webpack_require__) {
  14384. Object.defineProperty(exports, "__esModule", { value: true });
  14385. var tslib_1 = __webpack_require__(2);
  14386. var $ = __webpack_require__(3);
  14387. var util_1 = __webpack_require__(4);
  14388. var options_1 = __webpack_require__(33);
  14389. var locale_1 = __webpack_require__(32);
  14390. var Model_1 = __webpack_require__(51);
  14391. var OptionsManager = /** @class */ (function (_super) {
  14392. tslib_1.__extends(OptionsManager, _super);
  14393. function OptionsManager(_calendar, overrides) {
  14394. var _this = _super.call(this) || this;
  14395. _this._calendar = _calendar;
  14396. _this.overrides = $.extend({}, overrides); // make a copy
  14397. _this.dynamicOverrides = {};
  14398. _this.compute();
  14399. return _this;
  14400. }
  14401. OptionsManager.prototype.add = function (newOptionHash) {
  14402. var optionCnt = 0;
  14403. var optionName;
  14404. this.recordOverrides(newOptionHash); // will trigger this model's watchers
  14405. for (optionName in newOptionHash) {
  14406. optionCnt++;
  14407. }
  14408. // special-case handling of single option change.
  14409. // if only one option change, `optionName` will be its name.
  14410. if (optionCnt === 1) {
  14411. if (optionName === 'height' || optionName === 'contentHeight' || optionName === 'aspectRatio') {
  14412. this._calendar.updateViewSize(true); // isResize=true
  14413. return;
  14414. }
  14415. else if (optionName === 'defaultDate') {
  14416. return; // can't change date this way. use gotoDate instead
  14417. }
  14418. else if (optionName === 'businessHours') {
  14419. return; // this model already reacts to this
  14420. }
  14421. else if (/^(event|select)(Overlap|Constraint|Allow)$/.test(optionName)) {
  14422. return; // doesn't affect rendering. only interactions.
  14423. }
  14424. else if (optionName === 'timezone') {
  14425. this._calendar.view.flash('initialEvents');
  14426. return;
  14427. }
  14428. }
  14429. // catch-all. rerender the header and footer and rebuild/rerender the current view
  14430. this._calendar.renderHeader();
  14431. this._calendar.renderFooter();
  14432. // even non-current views will be affected by this option change. do before rerender
  14433. // TODO: detangle
  14434. this._calendar.viewsByType = {};
  14435. this._calendar.reinitView();
  14436. };
  14437. // Computes the flattened options hash for the calendar and assigns to `this.options`.
  14438. // Assumes this.overrides and this.dynamicOverrides have already been initialized.
  14439. OptionsManager.prototype.compute = function () {
  14440. var locale;
  14441. var localeDefaults;
  14442. var isRTL;
  14443. var dirDefaults;
  14444. var rawOptions;
  14445. locale = util_1.firstDefined(// explicit locale option given?
  14446. this.dynamicOverrides.locale, this.overrides.locale);
  14447. localeDefaults = locale_1.localeOptionHash[locale];
  14448. if (!localeDefaults) { // explicit locale option not given or invalid?
  14449. locale = options_1.globalDefaults.locale;
  14450. localeDefaults = locale_1.localeOptionHash[locale] || {};
  14451. }
  14452. isRTL = util_1.firstDefined(// based on options computed so far, is direction RTL?
  14453. this.dynamicOverrides.isRTL, this.overrides.isRTL, localeDefaults.isRTL, options_1.globalDefaults.isRTL);
  14454. dirDefaults = isRTL ? options_1.rtlDefaults : {};
  14455. this.dirDefaults = dirDefaults;
  14456. this.localeDefaults = localeDefaults;
  14457. rawOptions = options_1.mergeOptions([
  14458. options_1.globalDefaults,
  14459. dirDefaults,
  14460. localeDefaults,
  14461. this.overrides,
  14462. this.dynamicOverrides
  14463. ]);
  14464. locale_1.populateInstanceComputableOptions(rawOptions); // fill in gaps with computed options
  14465. this.reset(rawOptions);
  14466. };
  14467. // stores the new options internally, but does not rerender anything.
  14468. OptionsManager.prototype.recordOverrides = function (newOptionHash) {
  14469. var optionName;
  14470. for (optionName in newOptionHash) {
  14471. this.dynamicOverrides[optionName] = newOptionHash[optionName];
  14472. }
  14473. this._calendar.viewSpecManager.clearCache(); // the dynamic override invalidates the options in this cache, so just clear it
  14474. this.compute(); // this.options needs to be recomputed after the dynamic override
  14475. };
  14476. return OptionsManager;
  14477. }(Model_1.default));
  14478. exports.default = OptionsManager;
  14479. /***/ }),
  14480. /* 259 */
  14481. /***/ (function(module, exports, __webpack_require__) {
  14482. Object.defineProperty(exports, "__esModule", { value: true });
  14483. var moment = __webpack_require__(0);
  14484. var $ = __webpack_require__(3);
  14485. var ViewRegistry_1 = __webpack_require__(24);
  14486. var util_1 = __webpack_require__(4);
  14487. var options_1 = __webpack_require__(33);
  14488. var locale_1 = __webpack_require__(32);
  14489. var ViewSpecManager = /** @class */ (function () {
  14490. function ViewSpecManager(optionsManager, _calendar) {
  14491. this.optionsManager = optionsManager;
  14492. this._calendar = _calendar;
  14493. this.clearCache();
  14494. }
  14495. ViewSpecManager.prototype.clearCache = function () {
  14496. this.viewSpecCache = {};
  14497. };
  14498. // Gets information about how to create a view. Will use a cache.
  14499. ViewSpecManager.prototype.getViewSpec = function (viewType) {
  14500. var cache = this.viewSpecCache;
  14501. return cache[viewType] || (cache[viewType] = this.buildViewSpec(viewType));
  14502. };
  14503. // Given a duration singular unit, like "week" or "day", finds a matching view spec.
  14504. // Preference is given to views that have corresponding buttons.
  14505. ViewSpecManager.prototype.getUnitViewSpec = function (unit) {
  14506. var viewTypes;
  14507. var i;
  14508. var spec;
  14509. if ($.inArray(unit, util_1.unitsDesc) !== -1) {
  14510. // put views that have buttons first. there will be duplicates, but oh well
  14511. viewTypes = this._calendar.header.getViewsWithButtons(); // TODO: include footer as well?
  14512. $.each(ViewRegistry_1.viewHash, function (viewType) {
  14513. viewTypes.push(viewType);
  14514. });
  14515. for (i = 0; i < viewTypes.length; i++) {
  14516. spec = this.getViewSpec(viewTypes[i]);
  14517. if (spec) {
  14518. if (spec.singleUnit === unit) {
  14519. return spec;
  14520. }
  14521. }
  14522. }
  14523. }
  14524. };
  14525. // Builds an object with information on how to create a given view
  14526. ViewSpecManager.prototype.buildViewSpec = function (requestedViewType) {
  14527. var viewOverrides = this.optionsManager.overrides.views || {};
  14528. var specChain = []; // for the view. lowest to highest priority
  14529. var defaultsChain = []; // for the view. lowest to highest priority
  14530. var overridesChain = []; // for the view. lowest to highest priority
  14531. var viewType = requestedViewType;
  14532. var spec; // for the view
  14533. var overrides; // for the view
  14534. var durationInput;
  14535. var duration;
  14536. var unit;
  14537. // iterate from the specific view definition to a more general one until we hit an actual View class
  14538. while (viewType) {
  14539. spec = ViewRegistry_1.viewHash[viewType];
  14540. overrides = viewOverrides[viewType];
  14541. viewType = null; // clear. might repopulate for another iteration
  14542. if (typeof spec === 'function') { // TODO: deprecate
  14543. spec = { 'class': spec };
  14544. }
  14545. if (spec) {
  14546. specChain.unshift(spec);
  14547. defaultsChain.unshift(spec.defaults || {});
  14548. durationInput = durationInput || spec.duration;
  14549. viewType = viewType || spec.type;
  14550. }
  14551. if (overrides) {
  14552. overridesChain.unshift(overrides); // view-specific option hashes have options at zero-level
  14553. durationInput = durationInput || overrides.duration;
  14554. viewType = viewType || overrides.type;
  14555. }
  14556. }
  14557. spec = util_1.mergeProps(specChain);
  14558. spec.type = requestedViewType;
  14559. if (!spec['class']) {
  14560. return false;
  14561. }
  14562. // fall back to top-level `duration` option
  14563. durationInput = durationInput ||
  14564. this.optionsManager.dynamicOverrides.duration ||
  14565. this.optionsManager.overrides.duration;
  14566. if (durationInput) {
  14567. duration = moment.duration(durationInput);
  14568. if (duration.valueOf()) { // valid?
  14569. unit = util_1.computeDurationGreatestUnit(duration, durationInput);
  14570. spec.duration = duration;
  14571. spec.durationUnit = unit;
  14572. // view is a single-unit duration, like "week" or "day"
  14573. // incorporate options for this. lowest priority
  14574. if (duration.as(unit) === 1) {
  14575. spec.singleUnit = unit;
  14576. overridesChain.unshift(viewOverrides[unit] || {});
  14577. }
  14578. }
  14579. }
  14580. spec.defaults = options_1.mergeOptions(defaultsChain);
  14581. spec.overrides = options_1.mergeOptions(overridesChain);
  14582. this.buildViewSpecOptions(spec);
  14583. this.buildViewSpecButtonText(spec, requestedViewType);
  14584. return spec;
  14585. };
  14586. // Builds and assigns a view spec's options object from its already-assigned defaults and overrides
  14587. ViewSpecManager.prototype.buildViewSpecOptions = function (spec) {
  14588. var optionsManager = this.optionsManager;
  14589. spec.options = options_1.mergeOptions([
  14590. options_1.globalDefaults,
  14591. spec.defaults,
  14592. optionsManager.dirDefaults,
  14593. optionsManager.localeDefaults,
  14594. optionsManager.overrides,
  14595. spec.overrides,
  14596. optionsManager.dynamicOverrides // dynamically set via setter. highest precedence
  14597. ]);
  14598. locale_1.populateInstanceComputableOptions(spec.options);
  14599. };
  14600. // Computes and assigns a view spec's buttonText-related options
  14601. ViewSpecManager.prototype.buildViewSpecButtonText = function (spec, requestedViewType) {
  14602. var optionsManager = this.optionsManager;
  14603. // given an options object with a possible `buttonText` hash, lookup the buttonText for the
  14604. // requested view, falling back to a generic unit entry like "week" or "day"
  14605. function queryButtonText(options) {
  14606. var buttonText = options.buttonText || {};
  14607. return buttonText[requestedViewType] ||
  14608. // view can decide to look up a certain key
  14609. (spec.buttonTextKey ? buttonText[spec.buttonTextKey] : null) ||
  14610. // a key like "month"
  14611. (spec.singleUnit ? buttonText[spec.singleUnit] : null);
  14612. }
  14613. // highest to lowest priority
  14614. spec.buttonTextOverride =
  14615. queryButtonText(optionsManager.dynamicOverrides) ||
  14616. queryButtonText(optionsManager.overrides) || // constructor-specified buttonText lookup hash takes precedence
  14617. spec.overrides.buttonText; // `buttonText` for view-specific options is a string
  14618. // highest to lowest priority. mirrors buildViewSpecOptions
  14619. spec.buttonTextDefault =
  14620. queryButtonText(optionsManager.localeDefaults) ||
  14621. queryButtonText(optionsManager.dirDefaults) ||
  14622. spec.defaults.buttonText || // a single string. from ViewSubclass.defaults
  14623. queryButtonText(options_1.globalDefaults) ||
  14624. (spec.duration ? this._calendar.humanizeDuration(spec.duration) : null) || // like "3 days"
  14625. requestedViewType; // fall back to given view name
  14626. };
  14627. return ViewSpecManager;
  14628. }());
  14629. exports.default = ViewSpecManager;
  14630. /***/ }),
  14631. /* 260 */
  14632. /***/ (function(module, exports, __webpack_require__) {
  14633. Object.defineProperty(exports, "__esModule", { value: true });
  14634. var EventSourceParser_1 = __webpack_require__(38);
  14635. var ArrayEventSource_1 = __webpack_require__(56);
  14636. var FuncEventSource_1 = __webpack_require__(223);
  14637. var JsonFeedEventSource_1 = __webpack_require__(224);
  14638. EventSourceParser_1.default.registerClass(ArrayEventSource_1.default);
  14639. EventSourceParser_1.default.registerClass(FuncEventSource_1.default);
  14640. EventSourceParser_1.default.registerClass(JsonFeedEventSource_1.default);
  14641. /***/ }),
  14642. /* 261 */
  14643. /***/ (function(module, exports, __webpack_require__) {
  14644. Object.defineProperty(exports, "__esModule", { value: true });
  14645. var ThemeRegistry_1 = __webpack_require__(57);
  14646. var StandardTheme_1 = __webpack_require__(221);
  14647. var JqueryUiTheme_1 = __webpack_require__(222);
  14648. var Bootstrap3Theme_1 = __webpack_require__(262);
  14649. var Bootstrap4Theme_1 = __webpack_require__(263);
  14650. ThemeRegistry_1.defineThemeSystem('standard', StandardTheme_1.default);
  14651. ThemeRegistry_1.defineThemeSystem('jquery-ui', JqueryUiTheme_1.default);
  14652. ThemeRegistry_1.defineThemeSystem('bootstrap3', Bootstrap3Theme_1.default);
  14653. ThemeRegistry_1.defineThemeSystem('bootstrap4', Bootstrap4Theme_1.default);
  14654. /***/ }),
  14655. /* 262 */
  14656. /***/ (function(module, exports, __webpack_require__) {
  14657. Object.defineProperty(exports, "__esModule", { value: true });
  14658. var tslib_1 = __webpack_require__(2);
  14659. var Theme_1 = __webpack_require__(22);
  14660. var Bootstrap3Theme = /** @class */ (function (_super) {
  14661. tslib_1.__extends(Bootstrap3Theme, _super);
  14662. function Bootstrap3Theme() {
  14663. return _super !== null && _super.apply(this, arguments) || this;
  14664. }
  14665. return Bootstrap3Theme;
  14666. }(Theme_1.default));
  14667. exports.default = Bootstrap3Theme;
  14668. Bootstrap3Theme.prototype.classes = {
  14669. widget: 'fc-bootstrap3',
  14670. tableGrid: 'table-bordered',
  14671. tableList: 'table',
  14672. tableListHeading: 'active',
  14673. buttonGroup: 'btn-group',
  14674. button: 'btn btn-default',
  14675. stateActive: 'active',
  14676. stateDisabled: 'disabled',
  14677. today: 'alert alert-info',
  14678. popover: 'panel panel-default',
  14679. popoverHeader: 'panel-heading',
  14680. popoverContent: 'panel-body',
  14681. // day grid
  14682. // for left/right border color when border is inset from edges (all-day in agenda view)
  14683. // avoid `panel` class b/c don't want margins/radius. only border color.
  14684. headerRow: 'panel-default',
  14685. dayRow: 'panel-default',
  14686. // list view
  14687. listView: 'panel panel-default'
  14688. };
  14689. Bootstrap3Theme.prototype.baseIconClass = 'glyphicon';
  14690. Bootstrap3Theme.prototype.iconClasses = {
  14691. close: 'glyphicon-remove',
  14692. prev: 'glyphicon-chevron-left',
  14693. next: 'glyphicon-chevron-right',
  14694. prevYear: 'glyphicon-backward',
  14695. nextYear: 'glyphicon-forward'
  14696. };
  14697. Bootstrap3Theme.prototype.iconOverrideOption = 'bootstrapGlyphicons';
  14698. Bootstrap3Theme.prototype.iconOverrideCustomButtonOption = 'bootstrapGlyphicon';
  14699. Bootstrap3Theme.prototype.iconOverridePrefix = 'glyphicon-';
  14700. /***/ }),
  14701. /* 263 */
  14702. /***/ (function(module, exports, __webpack_require__) {
  14703. Object.defineProperty(exports, "__esModule", { value: true });
  14704. var tslib_1 = __webpack_require__(2);
  14705. var Theme_1 = __webpack_require__(22);
  14706. var Bootstrap4Theme = /** @class */ (function (_super) {
  14707. tslib_1.__extends(Bootstrap4Theme, _super);
  14708. function Bootstrap4Theme() {
  14709. return _super !== null && _super.apply(this, arguments) || this;
  14710. }
  14711. return Bootstrap4Theme;
  14712. }(Theme_1.default));
  14713. exports.default = Bootstrap4Theme;
  14714. Bootstrap4Theme.prototype.classes = {
  14715. widget: 'fc-bootstrap4',
  14716. tableGrid: 'table-bordered',
  14717. tableList: 'table',
  14718. tableListHeading: 'table-active',
  14719. buttonGroup: 'btn-group',
  14720. button: 'btn btn-primary',
  14721. stateActive: 'active',
  14722. stateDisabled: 'disabled',
  14723. today: 'alert alert-info',
  14724. popover: 'card card-primary',
  14725. popoverHeader: 'card-header',
  14726. popoverContent: 'card-body',
  14727. // day grid
  14728. // for left/right border color when border is inset from edges (all-day in agenda view)
  14729. // avoid `table` class b/c don't want margins/padding/structure. only border color.
  14730. headerRow: 'table-bordered',
  14731. dayRow: 'table-bordered',
  14732. // list view
  14733. listView: 'card card-primary'
  14734. };
  14735. Bootstrap4Theme.prototype.baseIconClass = 'fa';
  14736. Bootstrap4Theme.prototype.iconClasses = {
  14737. close: 'fa-times',
  14738. prev: 'fa-chevron-left',
  14739. next: 'fa-chevron-right',
  14740. prevYear: 'fa-angle-double-left',
  14741. nextYear: 'fa-angle-double-right'
  14742. };
  14743. Bootstrap4Theme.prototype.iconOverrideOption = 'bootstrapFontAwesome';
  14744. Bootstrap4Theme.prototype.iconOverrideCustomButtonOption = 'bootstrapFontAwesome';
  14745. Bootstrap4Theme.prototype.iconOverridePrefix = 'fa-';
  14746. /***/ }),
  14747. /* 264 */
  14748. /***/ (function(module, exports, __webpack_require__) {
  14749. Object.defineProperty(exports, "__esModule", { value: true });
  14750. var ViewRegistry_1 = __webpack_require__(24);
  14751. var BasicView_1 = __webpack_require__(67);
  14752. var MonthView_1 = __webpack_require__(246);
  14753. ViewRegistry_1.defineView('basic', {
  14754. 'class': BasicView_1.default
  14755. });
  14756. ViewRegistry_1.defineView('basicDay', {
  14757. type: 'basic',
  14758. duration: { days: 1 }
  14759. });
  14760. ViewRegistry_1.defineView('basicWeek', {
  14761. type: 'basic',
  14762. duration: { weeks: 1 }
  14763. });
  14764. ViewRegistry_1.defineView('month', {
  14765. 'class': MonthView_1.default,
  14766. duration: { months: 1 },
  14767. defaults: {
  14768. fixedWeekCount: true
  14769. }
  14770. });
  14771. /***/ }),
  14772. /* 265 */
  14773. /***/ (function(module, exports, __webpack_require__) {
  14774. Object.defineProperty(exports, "__esModule", { value: true });
  14775. var ViewRegistry_1 = __webpack_require__(24);
  14776. var AgendaView_1 = __webpack_require__(238);
  14777. ViewRegistry_1.defineView('agenda', {
  14778. 'class': AgendaView_1.default,
  14779. defaults: {
  14780. allDaySlot: true,
  14781. slotDuration: '00:30:00',
  14782. slotEventOverlap: true // a bad name. confused with overlap/constraint system
  14783. }
  14784. });
  14785. ViewRegistry_1.defineView('agendaDay', {
  14786. type: 'agenda',
  14787. duration: { days: 1 }
  14788. });
  14789. ViewRegistry_1.defineView('agendaWeek', {
  14790. type: 'agenda',
  14791. duration: { weeks: 1 }
  14792. });
  14793. /***/ }),
  14794. /* 266 */
  14795. /***/ (function(module, exports, __webpack_require__) {
  14796. Object.defineProperty(exports, "__esModule", { value: true });
  14797. var ViewRegistry_1 = __webpack_require__(24);
  14798. var ListView_1 = __webpack_require__(248);
  14799. ViewRegistry_1.defineView('list', {
  14800. 'class': ListView_1.default,
  14801. buttonTextKey: 'list',
  14802. defaults: {
  14803. buttonText: 'list',
  14804. listDayFormat: 'LL',
  14805. noEventsMessage: 'No events to display'
  14806. }
  14807. });
  14808. ViewRegistry_1.defineView('listDay', {
  14809. type: 'list',
  14810. duration: { days: 1 },
  14811. defaults: {
  14812. listDayFormat: 'dddd' // day-of-week is all we need. full date is probably in header
  14813. }
  14814. });
  14815. ViewRegistry_1.defineView('listWeek', {
  14816. type: 'list',
  14817. duration: { weeks: 1 },
  14818. defaults: {
  14819. listDayFormat: 'dddd',
  14820. listDayAltFormat: 'LL'
  14821. }
  14822. });
  14823. ViewRegistry_1.defineView('listMonth', {
  14824. type: 'list',
  14825. duration: { month: 1 },
  14826. defaults: {
  14827. listDayAltFormat: 'dddd' // day-of-week is nice-to-have
  14828. }
  14829. });
  14830. ViewRegistry_1.defineView('listYear', {
  14831. type: 'list',
  14832. duration: { year: 1 },
  14833. defaults: {
  14834. listDayAltFormat: 'dddd' // day-of-week is nice-to-have
  14835. }
  14836. });
  14837. /***/ }),
  14838. /* 267 */
  14839. /***/ (function(module, exports) {
  14840. Object.defineProperty(exports, "__esModule", { value: true });
  14841. /***/ })
  14842. /******/ ]);
  14843. });