fullcalendar.js 596 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010
  1. /*!
  2. * FullCalendar v3.9.0
  3. * Docs & License: https://fullcalendar.io/
  4. * (c) 2018 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 = 236);
  79. /******/ })
  80. /************************************************************************/
  81. /******/ ([
  82. /* 0 */
  83. /***/ (function(module, exports) {
  84. module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
  85. /***/ }),
  86. /* 1 */,
  87. /* 2 */
  88. /***/ (function(module, exports) {
  89. /*
  90. derived from:
  91. https://github.com/Microsoft/tslib/blob/v1.6.0/tslib.js
  92. only include the helpers we need, to keep down filesize
  93. */
  94. var extendStatics = Object.setPrototypeOf ||
  95. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  96. function (d, b) { for (var p in b)
  97. if (b.hasOwnProperty(p))
  98. d[p] = b[p]; };
  99. exports.__extends = function (d, b) {
  100. extendStatics(d, b);
  101. function __() { this.constructor = d; }
  102. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  103. };
  104. /***/ }),
  105. /* 3 */
  106. /***/ (function(module, exports) {
  107. module.exports = __WEBPACK_EXTERNAL_MODULE_3__;
  108. /***/ }),
  109. /* 4 */
  110. /***/ (function(module, exports, __webpack_require__) {
  111. Object.defineProperty(exports, "__esModule", { value: true });
  112. var moment = __webpack_require__(0);
  113. var $ = __webpack_require__(3);
  114. /* FullCalendar-specific DOM Utilities
  115. ----------------------------------------------------------------------------------------------------------------------*/
  116. // Given the scrollbar widths of some other container, create borders/margins on rowEls in order to match the left
  117. // and right space that was offset by the scrollbars. A 1-pixel border first, then margin beyond that.
  118. function compensateScroll(rowEls, scrollbarWidths) {
  119. if (scrollbarWidths.left) {
  120. rowEls.css({
  121. 'border-left-width': 1,
  122. 'margin-left': scrollbarWidths.left - 1
  123. });
  124. }
  125. if (scrollbarWidths.right) {
  126. rowEls.css({
  127. 'border-right-width': 1,
  128. 'margin-right': scrollbarWidths.right - 1
  129. });
  130. }
  131. }
  132. exports.compensateScroll = compensateScroll;
  133. // Undoes compensateScroll and restores all borders/margins
  134. function uncompensateScroll(rowEls) {
  135. rowEls.css({
  136. 'margin-left': '',
  137. 'margin-right': '',
  138. 'border-left-width': '',
  139. 'border-right-width': ''
  140. });
  141. }
  142. exports.uncompensateScroll = uncompensateScroll;
  143. // Make the mouse cursor express that an event is not allowed in the current area
  144. function disableCursor() {
  145. $('body').addClass('fc-not-allowed');
  146. }
  147. exports.disableCursor = disableCursor;
  148. // Returns the mouse cursor to its original look
  149. function enableCursor() {
  150. $('body').removeClass('fc-not-allowed');
  151. }
  152. exports.enableCursor = enableCursor;
  153. // Given a total available height to fill, have `els` (essentially child rows) expand to accomodate.
  154. // By default, all elements that are shorter than the recommended height are expanded uniformly, not considering
  155. // any other els that are already too tall. if `shouldRedistribute` is on, it considers these tall rows and
  156. // reduces the available height.
  157. function distributeHeight(els, availableHeight, shouldRedistribute) {
  158. // *FLOORING NOTE*: we floor in certain places because zoom can give inaccurate floating-point dimensions,
  159. // and it is better to be shorter than taller, to avoid creating unnecessary scrollbars.
  160. var minOffset1 = Math.floor(availableHeight / els.length); // for non-last element
  161. var minOffset2 = Math.floor(availableHeight - minOffset1 * (els.length - 1)); // for last element *FLOORING NOTE*
  162. var flexEls = []; // elements that are allowed to expand. array of DOM nodes
  163. var flexOffsets = []; // amount of vertical space it takes up
  164. var flexHeights = []; // actual css height
  165. var usedHeight = 0;
  166. undistributeHeight(els); // give all elements their natural height
  167. // find elements that are below the recommended height (expandable).
  168. // important to query for heights in a single first pass (to avoid reflow oscillation).
  169. els.each(function (i, el) {
  170. var minOffset = i === els.length - 1 ? minOffset2 : minOffset1;
  171. var naturalOffset = $(el).outerHeight(true);
  172. if (naturalOffset < minOffset) {
  173. flexEls.push(el);
  174. flexOffsets.push(naturalOffset);
  175. flexHeights.push($(el).height());
  176. }
  177. else {
  178. // this element stretches past recommended height (non-expandable). mark the space as occupied.
  179. usedHeight += naturalOffset;
  180. }
  181. });
  182. // readjust the recommended height to only consider the height available to non-maxed-out rows.
  183. if (shouldRedistribute) {
  184. availableHeight -= usedHeight;
  185. minOffset1 = Math.floor(availableHeight / flexEls.length);
  186. minOffset2 = Math.floor(availableHeight - minOffset1 * (flexEls.length - 1)); // *FLOORING NOTE*
  187. }
  188. // assign heights to all expandable elements
  189. $(flexEls).each(function (i, el) {
  190. var minOffset = i === flexEls.length - 1 ? minOffset2 : minOffset1;
  191. var naturalOffset = flexOffsets[i];
  192. var naturalHeight = flexHeights[i];
  193. var newHeight = minOffset - (naturalOffset - naturalHeight); // subtract the margin/padding
  194. if (naturalOffset < minOffset) {
  195. $(el).height(newHeight);
  196. }
  197. });
  198. }
  199. exports.distributeHeight = distributeHeight;
  200. // Undoes distrubuteHeight, restoring all els to their natural height
  201. function undistributeHeight(els) {
  202. els.height('');
  203. }
  204. exports.undistributeHeight = undistributeHeight;
  205. // Given `els`, a jQuery set of <td> cells, find the cell with the largest natural width and set the widths of all the
  206. // cells to be that width.
  207. // PREREQUISITE: if you want a cell to take up width, it needs to have a single inner element w/ display:inline
  208. function matchCellWidths(els) {
  209. var maxInnerWidth = 0;
  210. els.find('> *').each(function (i, innerEl) {
  211. var innerWidth = $(innerEl).outerWidth();
  212. if (innerWidth > maxInnerWidth) {
  213. maxInnerWidth = innerWidth;
  214. }
  215. });
  216. maxInnerWidth++; // sometimes not accurate of width the text needs to stay on one line. insurance
  217. els.width(maxInnerWidth);
  218. return maxInnerWidth;
  219. }
  220. exports.matchCellWidths = matchCellWidths;
  221. // Given one element that resides inside another,
  222. // Subtracts the height of the inner element from the outer element.
  223. function subtractInnerElHeight(outerEl, innerEl) {
  224. var both = outerEl.add(innerEl);
  225. var diff;
  226. // effin' IE8/9/10/11 sometimes returns 0 for dimensions. this weird hack was the only thing that worked
  227. both.css({
  228. position: 'relative',
  229. left: -1 // ensure reflow in case the el was already relative. negative is less likely to cause new scroll
  230. });
  231. diff = outerEl.outerHeight() - innerEl.outerHeight(); // grab the dimensions
  232. both.css({ position: '', left: '' }); // undo hack
  233. return diff;
  234. }
  235. exports.subtractInnerElHeight = subtractInnerElHeight;
  236. /* Element Geom Utilities
  237. ----------------------------------------------------------------------------------------------------------------------*/
  238. // borrowed from https://github.com/jquery/jquery-ui/blob/1.11.0/ui/core.js#L51
  239. function getScrollParent(el) {
  240. var position = el.css('position');
  241. var scrollParent = el.parents().filter(function () {
  242. var parent = $(this);
  243. return (/(auto|scroll)/).test(parent.css('overflow') + parent.css('overflow-y') + parent.css('overflow-x'));
  244. }).eq(0);
  245. return position === 'fixed' || !scrollParent.length ? $(el[0].ownerDocument || document) : scrollParent;
  246. }
  247. exports.getScrollParent = getScrollParent;
  248. // Queries the outer bounding area of a jQuery element.
  249. // Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive).
  250. // Origin is optional.
  251. function getOuterRect(el, origin) {
  252. var offset = el.offset();
  253. var left = offset.left - (origin ? origin.left : 0);
  254. var top = offset.top - (origin ? origin.top : 0);
  255. return {
  256. left: left,
  257. right: left + el.outerWidth(),
  258. top: top,
  259. bottom: top + el.outerHeight()
  260. };
  261. }
  262. exports.getOuterRect = getOuterRect;
  263. // Queries the area within the margin/border/scrollbars of a jQuery element. Does not go within the padding.
  264. // Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive).
  265. // Origin is optional.
  266. // WARNING: given element can't have borders
  267. // NOTE: should use clientLeft/clientTop, but very unreliable cross-browser.
  268. function getClientRect(el, origin) {
  269. var offset = el.offset();
  270. var scrollbarWidths = getScrollbarWidths(el);
  271. var left = offset.left + getCssFloat(el, 'border-left-width') + scrollbarWidths.left - (origin ? origin.left : 0);
  272. var top = offset.top + getCssFloat(el, 'border-top-width') + scrollbarWidths.top - (origin ? origin.top : 0);
  273. return {
  274. left: left,
  275. right: left + el[0].clientWidth,
  276. top: top,
  277. bottom: top + el[0].clientHeight // clientHeight includes padding but NOT scrollbars
  278. };
  279. }
  280. exports.getClientRect = getClientRect;
  281. // Queries the area within the margin/border/padding of a jQuery element. Assumed not to have scrollbars.
  282. // Returns a rectangle with absolute coordinates: left, right (exclusive), top, bottom (exclusive).
  283. // Origin is optional.
  284. function getContentRect(el, origin) {
  285. var offset = el.offset(); // just outside of border, margin not included
  286. var left = offset.left + getCssFloat(el, 'border-left-width') + getCssFloat(el, 'padding-left') -
  287. (origin ? origin.left : 0);
  288. var top = offset.top + getCssFloat(el, 'border-top-width') + getCssFloat(el, 'padding-top') -
  289. (origin ? origin.top : 0);
  290. return {
  291. left: left,
  292. right: left + el.width(),
  293. top: top,
  294. bottom: top + el.height()
  295. };
  296. }
  297. exports.getContentRect = getContentRect;
  298. // Returns the computed left/right/top/bottom scrollbar widths for the given jQuery element.
  299. // WARNING: given element can't have borders (which will cause offsetWidth/offsetHeight to be larger).
  300. // NOTE: should use clientLeft/clientTop, but very unreliable cross-browser.
  301. function getScrollbarWidths(el) {
  302. var leftRightWidth = el[0].offsetWidth - el[0].clientWidth;
  303. var bottomWidth = el[0].offsetHeight - el[0].clientHeight;
  304. var widths;
  305. leftRightWidth = sanitizeScrollbarWidth(leftRightWidth);
  306. bottomWidth = sanitizeScrollbarWidth(bottomWidth);
  307. widths = { left: 0, right: 0, top: 0, bottom: bottomWidth };
  308. if (getIsLeftRtlScrollbars() && el.css('direction') === 'rtl') {
  309. widths.left = leftRightWidth;
  310. }
  311. else {
  312. widths.right = leftRightWidth;
  313. }
  314. return widths;
  315. }
  316. exports.getScrollbarWidths = getScrollbarWidths;
  317. // The scrollbar width computations in getScrollbarWidths are sometimes flawed when it comes to
  318. // retina displays, rounding, and IE11. Massage them into a usable value.
  319. function sanitizeScrollbarWidth(width) {
  320. width = Math.max(0, width); // no negatives
  321. width = Math.round(width);
  322. return width;
  323. }
  324. // Logic for determining if, when the element is right-to-left, the scrollbar appears on the left side
  325. var _isLeftRtlScrollbars = null;
  326. function getIsLeftRtlScrollbars() {
  327. if (_isLeftRtlScrollbars === null) {
  328. _isLeftRtlScrollbars = computeIsLeftRtlScrollbars();
  329. }
  330. return _isLeftRtlScrollbars;
  331. }
  332. function computeIsLeftRtlScrollbars() {
  333. var el = $('<div><div/></div>')
  334. .css({
  335. position: 'absolute',
  336. top: -1000,
  337. left: 0,
  338. border: 0,
  339. padding: 0,
  340. overflow: 'scroll',
  341. direction: 'rtl'
  342. })
  343. .appendTo('body');
  344. var innerEl = el.children();
  345. var res = innerEl.offset().left > el.offset().left; // is the inner div shifted to accommodate a left scrollbar?
  346. el.remove();
  347. return res;
  348. }
  349. // Retrieves a jQuery element's computed CSS value as a floating-point number.
  350. // If the queried value is non-numeric (ex: IE can return "medium" for border width), will just return zero.
  351. function getCssFloat(el, prop) {
  352. return parseFloat(el.css(prop)) || 0;
  353. }
  354. /* Mouse / Touch Utilities
  355. ----------------------------------------------------------------------------------------------------------------------*/
  356. // Returns a boolean whether this was a left mouse click and no ctrl key (which means right click on Mac)
  357. function isPrimaryMouseButton(ev) {
  358. return ev.which === 1 && !ev.ctrlKey;
  359. }
  360. exports.isPrimaryMouseButton = isPrimaryMouseButton;
  361. function getEvX(ev) {
  362. var touches = ev.originalEvent.touches;
  363. // on mobile FF, pageX for touch events is present, but incorrect,
  364. // so, look at touch coordinates first.
  365. if (touches && touches.length) {
  366. return touches[0].pageX;
  367. }
  368. return ev.pageX;
  369. }
  370. exports.getEvX = getEvX;
  371. function getEvY(ev) {
  372. var touches = ev.originalEvent.touches;
  373. // on mobile FF, pageX for touch events is present, but incorrect,
  374. // so, look at touch coordinates first.
  375. if (touches && touches.length) {
  376. return touches[0].pageY;
  377. }
  378. return ev.pageY;
  379. }
  380. exports.getEvY = getEvY;
  381. function getEvIsTouch(ev) {
  382. return /^touch/.test(ev.type);
  383. }
  384. exports.getEvIsTouch = getEvIsTouch;
  385. function preventSelection(el) {
  386. el.addClass('fc-unselectable')
  387. .on('selectstart', preventDefault);
  388. }
  389. exports.preventSelection = preventSelection;
  390. function allowSelection(el) {
  391. el.removeClass('fc-unselectable')
  392. .off('selectstart', preventDefault);
  393. }
  394. exports.allowSelection = allowSelection;
  395. // Stops a mouse/touch event from doing it's native browser action
  396. function preventDefault(ev) {
  397. ev.preventDefault();
  398. }
  399. exports.preventDefault = preventDefault;
  400. /* General Geometry Utils
  401. ----------------------------------------------------------------------------------------------------------------------*/
  402. // Returns a new rectangle that is the intersection of the two rectangles. If they don't intersect, returns false
  403. function intersectRects(rect1, rect2) {
  404. var res = {
  405. left: Math.max(rect1.left, rect2.left),
  406. right: Math.min(rect1.right, rect2.right),
  407. top: Math.max(rect1.top, rect2.top),
  408. bottom: Math.min(rect1.bottom, rect2.bottom)
  409. };
  410. if (res.left < res.right && res.top < res.bottom) {
  411. return res;
  412. }
  413. return false;
  414. }
  415. exports.intersectRects = intersectRects;
  416. // Returns a new point that will have been moved to reside within the given rectangle
  417. function constrainPoint(point, rect) {
  418. return {
  419. left: Math.min(Math.max(point.left, rect.left), rect.right),
  420. top: Math.min(Math.max(point.top, rect.top), rect.bottom)
  421. };
  422. }
  423. exports.constrainPoint = constrainPoint;
  424. // Returns a point that is the center of the given rectangle
  425. function getRectCenter(rect) {
  426. return {
  427. left: (rect.left + rect.right) / 2,
  428. top: (rect.top + rect.bottom) / 2
  429. };
  430. }
  431. exports.getRectCenter = getRectCenter;
  432. // Subtracts point2's coordinates from point1's coordinates, returning a delta
  433. function diffPoints(point1, point2) {
  434. return {
  435. left: point1.left - point2.left,
  436. top: point1.top - point2.top
  437. };
  438. }
  439. exports.diffPoints = diffPoints;
  440. /* Object Ordering by Field
  441. ----------------------------------------------------------------------------------------------------------------------*/
  442. function parseFieldSpecs(input) {
  443. var specs = [];
  444. var tokens = [];
  445. var i;
  446. var token;
  447. if (typeof input === 'string') {
  448. tokens = input.split(/\s*,\s*/);
  449. }
  450. else if (typeof input === 'function') {
  451. tokens = [input];
  452. }
  453. else if ($.isArray(input)) {
  454. tokens = input;
  455. }
  456. for (i = 0; i < tokens.length; i++) {
  457. token = tokens[i];
  458. if (typeof token === 'string') {
  459. specs.push(token.charAt(0) === '-' ?
  460. { field: token.substring(1), order: -1 } :
  461. { field: token, order: 1 });
  462. }
  463. else if (typeof token === 'function') {
  464. specs.push({ func: token });
  465. }
  466. }
  467. return specs;
  468. }
  469. exports.parseFieldSpecs = parseFieldSpecs;
  470. function compareByFieldSpecs(obj1, obj2, fieldSpecs, 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) {
  572. return end.diff(start, unit, true);
  573. }
  574. else if (moment.isDuration(start)) {
  575. return start.as(unit);
  576. }
  577. else {
  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)) {
  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])) {
  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) {
  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__(10);
  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) {
  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) {
  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__(208);
  1047. var Class_1 = __webpack_require__(33);
  1048. var EventDefParser_1 = __webpack_require__(49);
  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__(14);
  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') {
  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. /* 10 */
  1230. /***/ (function(module, exports, __webpack_require__) {
  1231. Object.defineProperty(exports, "__esModule", { value: true });
  1232. var moment = __webpack_require__(0);
  1233. var $ = __webpack_require__(3);
  1234. var util_1 = __webpack_require__(4);
  1235. var ambigDateOfMonthRegex = /^\s*\d{4}-\d\d$/;
  1236. 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+)?)?)?)?)?$/;
  1237. var newMomentProto = moment.fn; // where we will attach our new methods
  1238. exports.newMomentProto = newMomentProto;
  1239. var oldMomentProto = $.extend({}, newMomentProto); // copy of original moment methods
  1240. exports.oldMomentProto = oldMomentProto;
  1241. // tell momentjs to transfer these properties upon clone
  1242. var momentProperties = moment.momentProperties;
  1243. momentProperties.push('_fullCalendar');
  1244. momentProperties.push('_ambigTime');
  1245. momentProperties.push('_ambigZone');
  1246. /*
  1247. Call this if you want Moment's original format method to be used
  1248. */
  1249. function oldMomentFormat(mom, formatStr) {
  1250. return oldMomentProto.format.call(mom, formatStr); // oldMomentProto defined in moment-ext.js
  1251. }
  1252. exports.oldMomentFormat = oldMomentFormat;
  1253. // Creating
  1254. // -------------------------------------------------------------------------------------------------
  1255. // Creates a new moment, similar to the vanilla moment(...) constructor, but with
  1256. // extra features (ambiguous time, enhanced formatting). When given an existing moment,
  1257. // it will function as a clone (and retain the zone of the moment). Anything else will
  1258. // result in a moment in the local zone.
  1259. var momentExt = function () {
  1260. return makeMoment(arguments);
  1261. };
  1262. exports.default = momentExt;
  1263. // Sames as momentExt, but forces the resulting moment to be in the UTC timezone.
  1264. momentExt.utc = function () {
  1265. var mom = makeMoment(arguments, true);
  1266. // Force it into UTC because makeMoment doesn't guarantee it
  1267. // (if given a pre-existing moment for example)
  1268. if (mom.hasTime()) {
  1269. mom.utc();
  1270. }
  1271. return mom;
  1272. };
  1273. // Same as momentExt, but when given an ISO8601 string, the timezone offset is preserved.
  1274. // ISO8601 strings with no timezone offset will become ambiguously zoned.
  1275. momentExt.parseZone = function () {
  1276. return makeMoment(arguments, true, true);
  1277. };
  1278. // Builds an enhanced moment from args. When given an existing moment, it clones. When given a
  1279. // native Date, or called with no arguments (the current time), the resulting moment will be local.
  1280. // Anything else needs to be "parsed" (a string or an array), and will be affected by:
  1281. // parseAsUTC - if there is no zone information, should we parse the input in UTC?
  1282. // parseZone - if there is zone information, should we force the zone of the moment?
  1283. function makeMoment(args, parseAsUTC, parseZone) {
  1284. if (parseAsUTC === void 0) { parseAsUTC = false; }
  1285. if (parseZone === void 0) { parseZone = false; }
  1286. var input = args[0];
  1287. var isSingleString = args.length === 1 && typeof input === 'string';
  1288. var isAmbigTime;
  1289. var isAmbigZone;
  1290. var ambigMatch;
  1291. var mom;
  1292. if (moment.isMoment(input) || util_1.isNativeDate(input) || input === undefined) {
  1293. mom = moment.apply(null, args);
  1294. }
  1295. else {
  1296. isAmbigTime = false;
  1297. isAmbigZone = false;
  1298. if (isSingleString) {
  1299. if (ambigDateOfMonthRegex.test(input)) {
  1300. // accept strings like '2014-05', but convert to the first of the month
  1301. input += '-01';
  1302. args = [input]; // for when we pass it on to moment's constructor
  1303. isAmbigTime = true;
  1304. isAmbigZone = true;
  1305. }
  1306. else if ((ambigMatch = ambigTimeOrZoneRegex.exec(input))) {
  1307. isAmbigTime = !ambigMatch[5]; // no time part?
  1308. isAmbigZone = true;
  1309. }
  1310. }
  1311. else if ($.isArray(input)) {
  1312. // arrays have no timezone information, so assume ambiguous zone
  1313. isAmbigZone = true;
  1314. }
  1315. // otherwise, probably a string with a format
  1316. if (parseAsUTC || isAmbigTime) {
  1317. mom = moment.utc.apply(moment, args);
  1318. }
  1319. else {
  1320. mom = moment.apply(null, args);
  1321. }
  1322. if (isAmbigTime) {
  1323. mom._ambigTime = true;
  1324. mom._ambigZone = true; // ambiguous time always means ambiguous zone
  1325. }
  1326. else if (parseZone) {
  1327. if (isAmbigZone) {
  1328. mom._ambigZone = true;
  1329. }
  1330. else if (isSingleString) {
  1331. mom.utcOffset(input); // if not a valid zone, will assign UTC
  1332. }
  1333. }
  1334. }
  1335. mom._fullCalendar = true; // flag for extended functionality
  1336. return mom;
  1337. }
  1338. // Week Number
  1339. // -------------------------------------------------------------------------------------------------
  1340. // Returns the week number, considering the locale's custom week number calcuation
  1341. // `weeks` is an alias for `week`
  1342. newMomentProto.week = newMomentProto.weeks = function (input) {
  1343. var weekCalc = this._locale._fullCalendar_weekCalc;
  1344. if (input == null && typeof weekCalc === 'function') {
  1345. return weekCalc(this);
  1346. }
  1347. else if (weekCalc === 'ISO') {
  1348. return oldMomentProto.isoWeek.apply(this, arguments); // ISO getter/setter
  1349. }
  1350. return oldMomentProto.week.apply(this, arguments); // local getter/setter
  1351. };
  1352. // Time-of-day
  1353. // -------------------------------------------------------------------------------------------------
  1354. // GETTER
  1355. // Returns a Duration with the hours/minutes/seconds/ms values of the moment.
  1356. // If the moment has an ambiguous time, a duration of 00:00 will be returned.
  1357. //
  1358. // SETTER
  1359. // You can supply a Duration, a Moment, or a Duration-like argument.
  1360. // When setting the time, and the moment has an ambiguous time, it then becomes unambiguous.
  1361. newMomentProto.time = function (time) {
  1362. // Fallback to the original method (if there is one) if this moment wasn't created via FullCalendar.
  1363. // `time` is a generic enough method name where this precaution is necessary to avoid collisions w/ other plugins.
  1364. if (!this._fullCalendar) {
  1365. return oldMomentProto.time.apply(this, arguments);
  1366. }
  1367. if (time == null) {
  1368. return moment.duration({
  1369. hours: this.hours(),
  1370. minutes: this.minutes(),
  1371. seconds: this.seconds(),
  1372. milliseconds: this.milliseconds()
  1373. });
  1374. }
  1375. else {
  1376. this._ambigTime = false; // mark that the moment now has a time
  1377. if (!moment.isDuration(time) && !moment.isMoment(time)) {
  1378. time = moment.duration(time);
  1379. }
  1380. // The day value should cause overflow (so 24 hours becomes 00:00:00 of next day).
  1381. // Only for Duration times, not Moment times.
  1382. var dayHours = 0;
  1383. if (moment.isDuration(time)) {
  1384. dayHours = Math.floor(time.asDays()) * 24;
  1385. }
  1386. // We need to set the individual fields.
  1387. // Can't use startOf('day') then add duration. In case of DST at start of day.
  1388. return this.hours(dayHours + time.hours())
  1389. .minutes(time.minutes())
  1390. .seconds(time.seconds())
  1391. .milliseconds(time.milliseconds());
  1392. }
  1393. };
  1394. // Converts the moment to UTC, stripping out its time-of-day and timezone offset,
  1395. // but preserving its YMD. A moment with a stripped time will display no time
  1396. // nor timezone offset when .format() is called.
  1397. newMomentProto.stripTime = function () {
  1398. if (!this._ambigTime) {
  1399. this.utc(true); // keepLocalTime=true (for keeping *date* value)
  1400. // set time to zero
  1401. this.set({
  1402. hours: 0,
  1403. minutes: 0,
  1404. seconds: 0,
  1405. ms: 0
  1406. });
  1407. // Mark the time as ambiguous. This needs to happen after the .utc() call, which might call .utcOffset(),
  1408. // which clears all ambig flags.
  1409. this._ambigTime = true;
  1410. this._ambigZone = true; // if ambiguous time, also ambiguous timezone offset
  1411. }
  1412. return this; // for chaining
  1413. };
  1414. // Returns if the moment has a non-ambiguous time (boolean)
  1415. newMomentProto.hasTime = function () {
  1416. return !this._ambigTime;
  1417. };
  1418. // Timezone
  1419. // -------------------------------------------------------------------------------------------------
  1420. // Converts the moment to UTC, stripping out its timezone offset, but preserving its
  1421. // YMD and time-of-day. A moment with a stripped timezone offset will display no
  1422. // timezone offset when .format() is called.
  1423. newMomentProto.stripZone = function () {
  1424. var wasAmbigTime;
  1425. if (!this._ambigZone) {
  1426. wasAmbigTime = this._ambigTime;
  1427. this.utc(true); // keepLocalTime=true (for keeping date and time values)
  1428. // the above call to .utc()/.utcOffset() unfortunately might clear the ambig flags, so restore
  1429. this._ambigTime = wasAmbigTime || false;
  1430. // Mark the zone as ambiguous. This needs to happen after the .utc() call, which might call .utcOffset(),
  1431. // which clears the ambig flags.
  1432. this._ambigZone = true;
  1433. }
  1434. return this; // for chaining
  1435. };
  1436. // Returns of the moment has a non-ambiguous timezone offset (boolean)
  1437. newMomentProto.hasZone = function () {
  1438. return !this._ambigZone;
  1439. };
  1440. // implicitly marks a zone
  1441. newMomentProto.local = function (keepLocalTime) {
  1442. // for when converting from ambiguously-zoned to local,
  1443. // keep the time values when converting from UTC -> local
  1444. oldMomentProto.local.call(this, this._ambigZone || keepLocalTime);
  1445. // ensure non-ambiguous
  1446. // this probably already happened via local() -> utcOffset(), but don't rely on Moment's internals
  1447. this._ambigTime = false;
  1448. this._ambigZone = false;
  1449. return this; // for chaining
  1450. };
  1451. // implicitly marks a zone
  1452. newMomentProto.utc = function (keepLocalTime) {
  1453. oldMomentProto.utc.call(this, keepLocalTime);
  1454. // ensure non-ambiguous
  1455. // this probably already happened via utc() -> utcOffset(), but don't rely on Moment's internals
  1456. this._ambigTime = false;
  1457. this._ambigZone = false;
  1458. return this;
  1459. };
  1460. // implicitly marks a zone (will probably get called upon .utc() and .local())
  1461. newMomentProto.utcOffset = function (tzo) {
  1462. if (tzo != null) {
  1463. // these assignments needs to happen before the original zone method is called.
  1464. // I forget why, something to do with a browser crash.
  1465. this._ambigTime = false;
  1466. this._ambigZone = false;
  1467. }
  1468. return oldMomentProto.utcOffset.apply(this, arguments);
  1469. };
  1470. /***/ }),
  1471. /* 11 */
  1472. /***/ (function(module, exports, __webpack_require__) {
  1473. /*
  1474. USAGE:
  1475. import { default as EmitterMixin, EmitterInterface } from './EmitterMixin'
  1476. in class:
  1477. on: EmitterInterface['on']
  1478. one: EmitterInterface['one']
  1479. off: EmitterInterface['off']
  1480. trigger: EmitterInterface['trigger']
  1481. triggerWith: EmitterInterface['triggerWith']
  1482. hasHandlers: EmitterInterface['hasHandlers']
  1483. after class:
  1484. EmitterMixin.mixInto(TheClass)
  1485. */
  1486. Object.defineProperty(exports, "__esModule", { value: true });
  1487. var tslib_1 = __webpack_require__(2);
  1488. var $ = __webpack_require__(3);
  1489. var Mixin_1 = __webpack_require__(14);
  1490. var EmitterMixin = /** @class */ (function (_super) {
  1491. tslib_1.__extends(EmitterMixin, _super);
  1492. function EmitterMixin() {
  1493. return _super !== null && _super.apply(this, arguments) || this;
  1494. }
  1495. // jQuery-ification via $(this) allows a non-DOM object to have
  1496. // the same event handling capabilities (including namespaces).
  1497. EmitterMixin.prototype.on = function (types, handler) {
  1498. $(this).on(types, this._prepareIntercept(handler));
  1499. return this; // for chaining
  1500. };
  1501. EmitterMixin.prototype.one = function (types, handler) {
  1502. $(this).one(types, this._prepareIntercept(handler));
  1503. return this; // for chaining
  1504. };
  1505. EmitterMixin.prototype._prepareIntercept = function (handler) {
  1506. // handlers are always called with an "event" object as their first param.
  1507. // sneak the `this` context and arguments into the extra parameter object
  1508. // and forward them on to the original handler.
  1509. var intercept = function (ev, extra) {
  1510. return handler.apply(extra.context || this, extra.args || []);
  1511. };
  1512. // mimick jQuery's internal "proxy" system (risky, I know)
  1513. // causing all functions with the same .guid to appear to be the same.
  1514. // https://github.com/jquery/jquery/blob/2.2.4/src/core.js#L448
  1515. // this is needed for calling .off with the original non-intercept handler.
  1516. if (!handler.guid) {
  1517. handler.guid = $.guid++;
  1518. }
  1519. intercept.guid = handler.guid;
  1520. return intercept;
  1521. };
  1522. EmitterMixin.prototype.off = function (types, handler) {
  1523. $(this).off(types, handler);
  1524. return this; // for chaining
  1525. };
  1526. EmitterMixin.prototype.trigger = function (types) {
  1527. var args = [];
  1528. for (var _i = 1; _i < arguments.length; _i++) {
  1529. args[_i - 1] = arguments[_i];
  1530. }
  1531. // pass in "extra" info to the intercept
  1532. $(this).triggerHandler(types, { args: args });
  1533. return this; // for chaining
  1534. };
  1535. EmitterMixin.prototype.triggerWith = function (types, context, args) {
  1536. // `triggerHandler` is less reliant on the DOM compared to `trigger`.
  1537. // pass in "extra" info to the intercept.
  1538. $(this).triggerHandler(types, { context: context, args: args });
  1539. return this; // for chaining
  1540. };
  1541. EmitterMixin.prototype.hasHandlers = function (type) {
  1542. var hash = $._data(this, 'events'); // http://blog.jquery.com/2012/08/09/jquery-1-8-released/
  1543. return hash && hash[type] && hash[type].length > 0;
  1544. };
  1545. return EmitterMixin;
  1546. }(Mixin_1.default));
  1547. exports.default = EmitterMixin;
  1548. /***/ }),
  1549. /* 12 */
  1550. /***/ (function(module, exports) {
  1551. Object.defineProperty(exports, "__esModule", { value: true });
  1552. /*
  1553. Meant to be immutable
  1554. */
  1555. var ComponentFootprint = /** @class */ (function () {
  1556. function ComponentFootprint(unzonedRange, isAllDay) {
  1557. this.isAllDay = false; // component can choose to ignore this
  1558. this.unzonedRange = unzonedRange;
  1559. this.isAllDay = isAllDay;
  1560. }
  1561. /*
  1562. Only works for non-open-ended ranges.
  1563. */
  1564. ComponentFootprint.prototype.toLegacy = function (calendar) {
  1565. return {
  1566. start: calendar.msToMoment(this.unzonedRange.startMs, this.isAllDay),
  1567. end: calendar.msToMoment(this.unzonedRange.endMs, this.isAllDay)
  1568. };
  1569. };
  1570. return ComponentFootprint;
  1571. }());
  1572. exports.default = ComponentFootprint;
  1573. /***/ }),
  1574. /* 13 */
  1575. /***/ (function(module, exports, __webpack_require__) {
  1576. Object.defineProperty(exports, "__esModule", { value: true });
  1577. var tslib_1 = __webpack_require__(2);
  1578. var EventDef_1 = __webpack_require__(34);
  1579. var EventInstance_1 = __webpack_require__(209);
  1580. var EventDateProfile_1 = __webpack_require__(17);
  1581. var SingleEventDef = /** @class */ (function (_super) {
  1582. tslib_1.__extends(SingleEventDef, _super);
  1583. function SingleEventDef() {
  1584. return _super !== null && _super.apply(this, arguments) || this;
  1585. }
  1586. /*
  1587. Will receive start/end params, but will be ignored.
  1588. */
  1589. SingleEventDef.prototype.buildInstances = function () {
  1590. return [this.buildInstance()];
  1591. };
  1592. SingleEventDef.prototype.buildInstance = function () {
  1593. return new EventInstance_1.default(this, // definition
  1594. this.dateProfile);
  1595. };
  1596. SingleEventDef.prototype.isAllDay = function () {
  1597. return this.dateProfile.isAllDay();
  1598. };
  1599. SingleEventDef.prototype.clone = function () {
  1600. var def = _super.prototype.clone.call(this);
  1601. def.dateProfile = this.dateProfile;
  1602. return def;
  1603. };
  1604. SingleEventDef.prototype.rezone = function () {
  1605. var calendar = this.source.calendar;
  1606. var dateProfile = this.dateProfile;
  1607. this.dateProfile = new EventDateProfile_1.default(calendar.moment(dateProfile.start), dateProfile.end ? calendar.moment(dateProfile.end) : null, calendar);
  1608. };
  1609. /*
  1610. NOTE: if super-method fails, should still attempt to apply
  1611. */
  1612. SingleEventDef.prototype.applyManualStandardProps = function (rawProps) {
  1613. var superSuccess = _super.prototype.applyManualStandardProps.call(this, rawProps);
  1614. var dateProfile = EventDateProfile_1.default.parse(rawProps, this.source); // returns null on failure
  1615. if (dateProfile) {
  1616. this.dateProfile = dateProfile;
  1617. // make sure `date` shows up in the legacy event objects as-is
  1618. if (rawProps.date != null) {
  1619. this.miscProps.date = rawProps.date;
  1620. }
  1621. return superSuccess;
  1622. }
  1623. else {
  1624. return false;
  1625. }
  1626. };
  1627. return SingleEventDef;
  1628. }(EventDef_1.default));
  1629. exports.default = SingleEventDef;
  1630. // Parsing
  1631. // ---------------------------------------------------------------------------------------------------------------------
  1632. SingleEventDef.defineStandardProps({
  1633. start: false,
  1634. date: false,
  1635. end: false,
  1636. allDay: false
  1637. });
  1638. /***/ }),
  1639. /* 14 */
  1640. /***/ (function(module, exports) {
  1641. Object.defineProperty(exports, "__esModule", { value: true });
  1642. var Mixin = /** @class */ (function () {
  1643. function Mixin() {
  1644. }
  1645. Mixin.mixInto = function (destClass) {
  1646. var _this = this;
  1647. Object.getOwnPropertyNames(this.prototype).forEach(function (name) {
  1648. if (!destClass.prototype[name]) {
  1649. destClass.prototype[name] = _this.prototype[name];
  1650. }
  1651. });
  1652. };
  1653. /*
  1654. will override existing methods
  1655. TODO: remove! not used anymore
  1656. */
  1657. Mixin.mixOver = function (destClass) {
  1658. var _this = this;
  1659. Object.getOwnPropertyNames(this.prototype).forEach(function (name) {
  1660. destClass.prototype[name] = _this.prototype[name];
  1661. });
  1662. };
  1663. return Mixin;
  1664. }());
  1665. exports.default = Mixin;
  1666. /***/ }),
  1667. /* 15 */
  1668. /***/ (function(module, exports) {
  1669. Object.defineProperty(exports, "__esModule", { value: true });
  1670. var Interaction = /** @class */ (function () {
  1671. function Interaction(component) {
  1672. this.view = component._getView();
  1673. this.component = component;
  1674. }
  1675. Interaction.prototype.opt = function (name) {
  1676. return this.view.opt(name);
  1677. };
  1678. Interaction.prototype.end = function () {
  1679. // subclasses can implement
  1680. };
  1681. return Interaction;
  1682. }());
  1683. exports.default = Interaction;
  1684. /***/ }),
  1685. /* 16 */
  1686. /***/ (function(module, exports, __webpack_require__) {
  1687. Object.defineProperty(exports, "__esModule", { value: true });
  1688. exports.version = '3.9.0';
  1689. // When introducing internal API incompatibilities (where fullcalendar plugins would break),
  1690. // the minor version of the calendar should be upped (ex: 2.7.2 -> 2.8.0)
  1691. // and the below integer should be incremented.
  1692. exports.internalApiVersion = 12;
  1693. var util_1 = __webpack_require__(4);
  1694. exports.applyAll = util_1.applyAll;
  1695. exports.debounce = util_1.debounce;
  1696. exports.isInt = util_1.isInt;
  1697. exports.htmlEscape = util_1.htmlEscape;
  1698. exports.cssToStr = util_1.cssToStr;
  1699. exports.proxy = util_1.proxy;
  1700. exports.capitaliseFirstLetter = util_1.capitaliseFirstLetter;
  1701. exports.getOuterRect = util_1.getOuterRect;
  1702. exports.getClientRect = util_1.getClientRect;
  1703. exports.getContentRect = util_1.getContentRect;
  1704. exports.getScrollbarWidths = util_1.getScrollbarWidths;
  1705. exports.preventDefault = util_1.preventDefault;
  1706. exports.parseFieldSpecs = util_1.parseFieldSpecs;
  1707. exports.compareByFieldSpecs = util_1.compareByFieldSpecs;
  1708. exports.compareByFieldSpec = util_1.compareByFieldSpec;
  1709. exports.flexibleCompare = util_1.flexibleCompare;
  1710. exports.computeGreatestUnit = util_1.computeGreatestUnit;
  1711. exports.divideRangeByDuration = util_1.divideRangeByDuration;
  1712. exports.divideDurationByDuration = util_1.divideDurationByDuration;
  1713. exports.multiplyDuration = util_1.multiplyDuration;
  1714. exports.durationHasTime = util_1.durationHasTime;
  1715. exports.log = util_1.log;
  1716. exports.warn = util_1.warn;
  1717. exports.removeExact = util_1.removeExact;
  1718. exports.intersectRects = util_1.intersectRects;
  1719. var date_formatting_1 = __webpack_require__(47);
  1720. exports.formatDate = date_formatting_1.formatDate;
  1721. exports.formatRange = date_formatting_1.formatRange;
  1722. exports.queryMostGranularFormatUnit = date_formatting_1.queryMostGranularFormatUnit;
  1723. var locale_1 = __webpack_require__(31);
  1724. exports.datepickerLocale = locale_1.datepickerLocale;
  1725. exports.locale = locale_1.locale;
  1726. var moment_ext_1 = __webpack_require__(10);
  1727. exports.moment = moment_ext_1.default;
  1728. var EmitterMixin_1 = __webpack_require__(11);
  1729. exports.EmitterMixin = EmitterMixin_1.default;
  1730. var ListenerMixin_1 = __webpack_require__(7);
  1731. exports.ListenerMixin = ListenerMixin_1.default;
  1732. var Model_1 = __webpack_require__(48);
  1733. exports.Model = Model_1.default;
  1734. var Constraints_1 = __webpack_require__(207);
  1735. exports.Constraints = Constraints_1.default;
  1736. var UnzonedRange_1 = __webpack_require__(5);
  1737. exports.UnzonedRange = UnzonedRange_1.default;
  1738. var ComponentFootprint_1 = __webpack_require__(12);
  1739. exports.ComponentFootprint = ComponentFootprint_1.default;
  1740. var BusinessHourGenerator_1 = __webpack_require__(212);
  1741. exports.BusinessHourGenerator = BusinessHourGenerator_1.default;
  1742. var EventDef_1 = __webpack_require__(34);
  1743. exports.EventDef = EventDef_1.default;
  1744. var EventDefMutation_1 = __webpack_require__(37);
  1745. exports.EventDefMutation = EventDefMutation_1.default;
  1746. var EventSourceParser_1 = __webpack_require__(38);
  1747. exports.EventSourceParser = EventSourceParser_1.default;
  1748. var EventSource_1 = __webpack_require__(6);
  1749. exports.EventSource = EventSource_1.default;
  1750. var ThemeRegistry_1 = __webpack_require__(51);
  1751. exports.defineThemeSystem = ThemeRegistry_1.defineThemeSystem;
  1752. var EventInstanceGroup_1 = __webpack_require__(18);
  1753. exports.EventInstanceGroup = EventInstanceGroup_1.default;
  1754. var ArrayEventSource_1 = __webpack_require__(52);
  1755. exports.ArrayEventSource = ArrayEventSource_1.default;
  1756. var FuncEventSource_1 = __webpack_require__(215);
  1757. exports.FuncEventSource = FuncEventSource_1.default;
  1758. var JsonFeedEventSource_1 = __webpack_require__(216);
  1759. exports.JsonFeedEventSource = JsonFeedEventSource_1.default;
  1760. var EventFootprint_1 = __webpack_require__(36);
  1761. exports.EventFootprint = EventFootprint_1.default;
  1762. var Class_1 = __webpack_require__(33);
  1763. exports.Class = Class_1.default;
  1764. var Mixin_1 = __webpack_require__(14);
  1765. exports.Mixin = Mixin_1.default;
  1766. var CoordCache_1 = __webpack_require__(53);
  1767. exports.CoordCache = CoordCache_1.default;
  1768. var DragListener_1 = __webpack_require__(54);
  1769. exports.DragListener = DragListener_1.default;
  1770. var Promise_1 = __webpack_require__(20);
  1771. exports.Promise = Promise_1.default;
  1772. var TaskQueue_1 = __webpack_require__(217);
  1773. exports.TaskQueue = TaskQueue_1.default;
  1774. var RenderQueue_1 = __webpack_require__(218);
  1775. exports.RenderQueue = RenderQueue_1.default;
  1776. var Scroller_1 = __webpack_require__(39);
  1777. exports.Scroller = Scroller_1.default;
  1778. var Theme_1 = __webpack_require__(19);
  1779. exports.Theme = Theme_1.default;
  1780. var DateComponent_1 = __webpack_require__(219);
  1781. exports.DateComponent = DateComponent_1.default;
  1782. var InteractiveDateComponent_1 = __webpack_require__(40);
  1783. exports.InteractiveDateComponent = InteractiveDateComponent_1.default;
  1784. var Calendar_1 = __webpack_require__(220);
  1785. exports.Calendar = Calendar_1.default;
  1786. var View_1 = __webpack_require__(41);
  1787. exports.View = View_1.default;
  1788. var ViewRegistry_1 = __webpack_require__(22);
  1789. exports.defineView = ViewRegistry_1.defineView;
  1790. exports.getViewConfig = ViewRegistry_1.getViewConfig;
  1791. var DayTableMixin_1 = __webpack_require__(55);
  1792. exports.DayTableMixin = DayTableMixin_1.default;
  1793. var BusinessHourRenderer_1 = __webpack_require__(56);
  1794. exports.BusinessHourRenderer = BusinessHourRenderer_1.default;
  1795. var EventRenderer_1 = __webpack_require__(42);
  1796. exports.EventRenderer = EventRenderer_1.default;
  1797. var FillRenderer_1 = __webpack_require__(57);
  1798. exports.FillRenderer = FillRenderer_1.default;
  1799. var HelperRenderer_1 = __webpack_require__(58);
  1800. exports.HelperRenderer = HelperRenderer_1.default;
  1801. var ExternalDropping_1 = __webpack_require__(222);
  1802. exports.ExternalDropping = ExternalDropping_1.default;
  1803. var EventResizing_1 = __webpack_require__(223);
  1804. exports.EventResizing = EventResizing_1.default;
  1805. var EventPointing_1 = __webpack_require__(59);
  1806. exports.EventPointing = EventPointing_1.default;
  1807. var EventDragging_1 = __webpack_require__(224);
  1808. exports.EventDragging = EventDragging_1.default;
  1809. var DateSelecting_1 = __webpack_require__(225);
  1810. exports.DateSelecting = DateSelecting_1.default;
  1811. var StandardInteractionsMixin_1 = __webpack_require__(60);
  1812. exports.StandardInteractionsMixin = StandardInteractionsMixin_1.default;
  1813. var AgendaView_1 = __webpack_require__(226);
  1814. exports.AgendaView = AgendaView_1.default;
  1815. var TimeGrid_1 = __webpack_require__(227);
  1816. exports.TimeGrid = TimeGrid_1.default;
  1817. var DayGrid_1 = __webpack_require__(61);
  1818. exports.DayGrid = DayGrid_1.default;
  1819. var BasicView_1 = __webpack_require__(62);
  1820. exports.BasicView = BasicView_1.default;
  1821. var MonthView_1 = __webpack_require__(229);
  1822. exports.MonthView = MonthView_1.default;
  1823. var ListView_1 = __webpack_require__(230);
  1824. exports.ListView = ListView_1.default;
  1825. /***/ }),
  1826. /* 17 */
  1827. /***/ (function(module, exports, __webpack_require__) {
  1828. Object.defineProperty(exports, "__esModule", { value: true });
  1829. var UnzonedRange_1 = __webpack_require__(5);
  1830. /*
  1831. Meant to be immutable
  1832. */
  1833. var EventDateProfile = /** @class */ (function () {
  1834. function EventDateProfile(start, end, calendar) {
  1835. this.start = start;
  1836. this.end = end || null;
  1837. this.unzonedRange = this.buildUnzonedRange(calendar);
  1838. }
  1839. /*
  1840. Needs an EventSource object
  1841. */
  1842. EventDateProfile.parse = function (rawProps, source) {
  1843. var startInput = rawProps.start || rawProps.date;
  1844. var endInput = rawProps.end;
  1845. if (!startInput) {
  1846. return false;
  1847. }
  1848. var calendar = source.calendar;
  1849. var start = calendar.moment(startInput);
  1850. var end = endInput ? calendar.moment(endInput) : null;
  1851. var forcedAllDay = rawProps.allDay;
  1852. var forceEventDuration = calendar.opt('forceEventDuration');
  1853. if (!start.isValid()) {
  1854. return false;
  1855. }
  1856. if (end && (!end.isValid() || !end.isAfter(start))) {
  1857. end = null;
  1858. }
  1859. if (forcedAllDay == null) {
  1860. forcedAllDay = source.allDayDefault;
  1861. if (forcedAllDay == null) {
  1862. forcedAllDay = calendar.opt('allDayDefault');
  1863. }
  1864. }
  1865. if (forcedAllDay === true) {
  1866. start.stripTime();
  1867. if (end) {
  1868. end.stripTime();
  1869. }
  1870. }
  1871. else if (forcedAllDay === false) {
  1872. if (!start.hasTime()) {
  1873. start.time(0);
  1874. }
  1875. if (end && !end.hasTime()) {
  1876. end.time(0);
  1877. }
  1878. }
  1879. if (!end && forceEventDuration) {
  1880. end = calendar.getDefaultEventEnd(!start.hasTime(), start);
  1881. }
  1882. return new EventDateProfile(start, end, calendar);
  1883. };
  1884. EventDateProfile.isStandardProp = function (propName) {
  1885. return propName === 'start' || propName === 'date' || propName === 'end' || propName === 'allDay';
  1886. };
  1887. EventDateProfile.prototype.isAllDay = function () {
  1888. return !(this.start.hasTime() || (this.end && this.end.hasTime()));
  1889. };
  1890. /*
  1891. Needs a Calendar object
  1892. */
  1893. EventDateProfile.prototype.buildUnzonedRange = function (calendar) {
  1894. var startMs = this.start.clone().stripZone().valueOf();
  1895. var endMs = this.getEnd(calendar).stripZone().valueOf();
  1896. return new UnzonedRange_1.default(startMs, endMs);
  1897. };
  1898. /*
  1899. Needs a Calendar object
  1900. */
  1901. EventDateProfile.prototype.getEnd = function (calendar) {
  1902. return this.end ?
  1903. this.end.clone() :
  1904. // derive the end from the start and allDay. compute allDay if necessary
  1905. calendar.getDefaultEventEnd(this.isAllDay(), this.start);
  1906. };
  1907. return EventDateProfile;
  1908. }());
  1909. exports.default = EventDateProfile;
  1910. /***/ }),
  1911. /* 18 */
  1912. /***/ (function(module, exports, __webpack_require__) {
  1913. Object.defineProperty(exports, "__esModule", { value: true });
  1914. var UnzonedRange_1 = __webpack_require__(5);
  1915. var util_1 = __webpack_require__(35);
  1916. var EventRange_1 = __webpack_require__(211);
  1917. /*
  1918. It's expected that there will be at least one EventInstance,
  1919. OR that an explicitEventDef is assigned.
  1920. */
  1921. var EventInstanceGroup = /** @class */ (function () {
  1922. function EventInstanceGroup(eventInstances) {
  1923. this.eventInstances = eventInstances || [];
  1924. }
  1925. EventInstanceGroup.prototype.getAllEventRanges = function (constraintRange) {
  1926. if (constraintRange) {
  1927. return this.sliceNormalRenderRanges(constraintRange);
  1928. }
  1929. else {
  1930. return this.eventInstances.map(util_1.eventInstanceToEventRange);
  1931. }
  1932. };
  1933. EventInstanceGroup.prototype.sliceRenderRanges = function (constraintRange) {
  1934. if (this.isInverse()) {
  1935. return this.sliceInverseRenderRanges(constraintRange);
  1936. }
  1937. else {
  1938. return this.sliceNormalRenderRanges(constraintRange);
  1939. }
  1940. };
  1941. EventInstanceGroup.prototype.sliceNormalRenderRanges = function (constraintRange) {
  1942. var eventInstances = this.eventInstances;
  1943. var i;
  1944. var eventInstance;
  1945. var slicedRange;
  1946. var slicedEventRanges = [];
  1947. for (i = 0; i < eventInstances.length; i++) {
  1948. eventInstance = eventInstances[i];
  1949. slicedRange = eventInstance.dateProfile.unzonedRange.intersect(constraintRange);
  1950. if (slicedRange) {
  1951. slicedEventRanges.push(new EventRange_1.default(slicedRange, eventInstance.def, eventInstance));
  1952. }
  1953. }
  1954. return slicedEventRanges;
  1955. };
  1956. EventInstanceGroup.prototype.sliceInverseRenderRanges = function (constraintRange) {
  1957. var unzonedRanges = this.eventInstances.map(util_1.eventInstanceToUnzonedRange);
  1958. var ownerDef = this.getEventDef();
  1959. unzonedRanges = UnzonedRange_1.default.invertRanges(unzonedRanges, constraintRange);
  1960. return unzonedRanges.map(function (unzonedRange) {
  1961. return new EventRange_1.default(unzonedRange, ownerDef); // don't give an EventInstance
  1962. });
  1963. };
  1964. EventInstanceGroup.prototype.isInverse = function () {
  1965. return this.getEventDef().hasInverseRendering();
  1966. };
  1967. EventInstanceGroup.prototype.getEventDef = function () {
  1968. return this.explicitEventDef || this.eventInstances[0].def;
  1969. };
  1970. return EventInstanceGroup;
  1971. }());
  1972. exports.default = EventInstanceGroup;
  1973. /***/ }),
  1974. /* 19 */
  1975. /***/ (function(module, exports, __webpack_require__) {
  1976. Object.defineProperty(exports, "__esModule", { value: true });
  1977. var $ = __webpack_require__(3);
  1978. var Theme = /** @class */ (function () {
  1979. function Theme(optionsManager) {
  1980. this.optionsManager = optionsManager;
  1981. this.processIconOverride();
  1982. }
  1983. Theme.prototype.processIconOverride = function () {
  1984. if (this.iconOverrideOption) {
  1985. this.setIconOverride(this.optionsManager.get(this.iconOverrideOption));
  1986. }
  1987. };
  1988. Theme.prototype.setIconOverride = function (iconOverrideHash) {
  1989. var iconClassesCopy;
  1990. var buttonName;
  1991. if ($.isPlainObject(iconOverrideHash)) {
  1992. iconClassesCopy = $.extend({}, this.iconClasses);
  1993. for (buttonName in iconOverrideHash) {
  1994. iconClassesCopy[buttonName] = this.applyIconOverridePrefix(iconOverrideHash[buttonName]);
  1995. }
  1996. this.iconClasses = iconClassesCopy;
  1997. }
  1998. else if (iconOverrideHash === false) {
  1999. this.iconClasses = {};
  2000. }
  2001. };
  2002. Theme.prototype.applyIconOverridePrefix = function (className) {
  2003. var prefix = this.iconOverridePrefix;
  2004. if (prefix && className.indexOf(prefix) !== 0) {
  2005. className = prefix + className;
  2006. }
  2007. return className;
  2008. };
  2009. Theme.prototype.getClass = function (key) {
  2010. return this.classes[key] || '';
  2011. };
  2012. Theme.prototype.getIconClass = function (buttonName) {
  2013. var className = this.iconClasses[buttonName];
  2014. if (className) {
  2015. return this.baseIconClass + ' ' + className;
  2016. }
  2017. return '';
  2018. };
  2019. Theme.prototype.getCustomButtonIconClass = function (customButtonProps) {
  2020. var className;
  2021. if (this.iconOverrideCustomButtonOption) {
  2022. className = customButtonProps[this.iconOverrideCustomButtonOption];
  2023. if (className) {
  2024. return this.baseIconClass + ' ' + this.applyIconOverridePrefix(className);
  2025. }
  2026. }
  2027. return '';
  2028. };
  2029. return Theme;
  2030. }());
  2031. exports.default = Theme;
  2032. Theme.prototype.classes = {};
  2033. Theme.prototype.iconClasses = {};
  2034. Theme.prototype.baseIconClass = '';
  2035. Theme.prototype.iconOverridePrefix = '';
  2036. /***/ }),
  2037. /* 20 */
  2038. /***/ (function(module, exports, __webpack_require__) {
  2039. Object.defineProperty(exports, "__esModule", { value: true });
  2040. var $ = __webpack_require__(3);
  2041. var PromiseStub = {
  2042. construct: function (executor) {
  2043. var deferred = $.Deferred();
  2044. var promise = deferred.promise();
  2045. if (typeof executor === 'function') {
  2046. executor(function (val) {
  2047. deferred.resolve(val);
  2048. attachImmediatelyResolvingThen(promise, val);
  2049. }, function () {
  2050. deferred.reject();
  2051. attachImmediatelyRejectingThen(promise);
  2052. });
  2053. }
  2054. return promise;
  2055. },
  2056. resolve: function (val) {
  2057. var deferred = $.Deferred().resolve(val);
  2058. var promise = deferred.promise();
  2059. attachImmediatelyResolvingThen(promise, val);
  2060. return promise;
  2061. },
  2062. reject: function () {
  2063. var deferred = $.Deferred().reject();
  2064. var promise = deferred.promise();
  2065. attachImmediatelyRejectingThen(promise);
  2066. return promise;
  2067. }
  2068. };
  2069. exports.default = PromiseStub;
  2070. function attachImmediatelyResolvingThen(promise, val) {
  2071. promise.then = function (onResolve) {
  2072. if (typeof onResolve === 'function') {
  2073. return PromiseStub.resolve(onResolve(val));
  2074. }
  2075. return promise;
  2076. };
  2077. }
  2078. function attachImmediatelyRejectingThen(promise) {
  2079. promise.then = function (onResolve, onReject) {
  2080. if (typeof onReject === 'function') {
  2081. onReject();
  2082. }
  2083. return promise;
  2084. };
  2085. }
  2086. /***/ }),
  2087. /* 21 */
  2088. /***/ (function(module, exports, __webpack_require__) {
  2089. Object.defineProperty(exports, "__esModule", { value: true });
  2090. var $ = __webpack_require__(3);
  2091. var exportHooks = __webpack_require__(16);
  2092. var EmitterMixin_1 = __webpack_require__(11);
  2093. var ListenerMixin_1 = __webpack_require__(7);
  2094. exportHooks.touchMouseIgnoreWait = 500;
  2095. var globalEmitter = null;
  2096. var neededCount = 0;
  2097. /*
  2098. Listens to document and window-level user-interaction events, like touch events and mouse events,
  2099. and fires these events as-is to whoever is observing a GlobalEmitter.
  2100. Best when used as a singleton via GlobalEmitter.get()
  2101. Normalizes mouse/touch events. For examples:
  2102. - ignores the the simulated mouse events that happen after a quick tap: mousemove+mousedown+mouseup+click
  2103. - compensates for various buggy scenarios where a touchend does not fire
  2104. */
  2105. var GlobalEmitter = /** @class */ (function () {
  2106. function GlobalEmitter() {
  2107. this.isTouching = false;
  2108. this.mouseIgnoreDepth = 0;
  2109. }
  2110. // gets the singleton
  2111. GlobalEmitter.get = function () {
  2112. if (!globalEmitter) {
  2113. globalEmitter = new GlobalEmitter();
  2114. globalEmitter.bind();
  2115. }
  2116. return globalEmitter;
  2117. };
  2118. // called when an object knows it will need a GlobalEmitter in the near future.
  2119. GlobalEmitter.needed = function () {
  2120. GlobalEmitter.get(); // ensures globalEmitter
  2121. neededCount++;
  2122. };
  2123. // called when the object that originally called needed() doesn't need a GlobalEmitter anymore.
  2124. GlobalEmitter.unneeded = function () {
  2125. neededCount--;
  2126. if (!neededCount) {
  2127. globalEmitter.unbind();
  2128. globalEmitter = null;
  2129. }
  2130. };
  2131. GlobalEmitter.prototype.bind = function () {
  2132. var _this = this;
  2133. this.listenTo($(document), {
  2134. touchstart: this.handleTouchStart,
  2135. touchcancel: this.handleTouchCancel,
  2136. touchend: this.handleTouchEnd,
  2137. mousedown: this.handleMouseDown,
  2138. mousemove: this.handleMouseMove,
  2139. mouseup: this.handleMouseUp,
  2140. click: this.handleClick,
  2141. selectstart: this.handleSelectStart,
  2142. contextmenu: this.handleContextMenu
  2143. });
  2144. // because we need to call preventDefault
  2145. // because https://www.chromestatus.com/features/5093566007214080
  2146. // TODO: investigate performance because this is a global handler
  2147. window.addEventListener('touchmove', this.handleTouchMoveProxy = function (ev) {
  2148. _this.handleTouchMove($.Event(ev));
  2149. }, { passive: false } // allows preventDefault()
  2150. );
  2151. // attach a handler to get called when ANY scroll action happens on the page.
  2152. // this was impossible to do with normal on/off because 'scroll' doesn't bubble.
  2153. // http://stackoverflow.com/a/32954565/96342
  2154. window.addEventListener('scroll', this.handleScrollProxy = function (ev) {
  2155. _this.handleScroll($.Event(ev));
  2156. }, true // useCapture
  2157. );
  2158. };
  2159. GlobalEmitter.prototype.unbind = function () {
  2160. this.stopListeningTo($(document));
  2161. window.removeEventListener('touchmove', this.handleTouchMoveProxy);
  2162. window.removeEventListener('scroll', this.handleScrollProxy, true // useCapture
  2163. );
  2164. };
  2165. // Touch Handlers
  2166. // -----------------------------------------------------------------------------------------------------------------
  2167. GlobalEmitter.prototype.handleTouchStart = function (ev) {
  2168. // if a previous touch interaction never ended with a touchend, then implicitly end it,
  2169. // but since a new touch interaction is about to begin, don't start the mouse ignore period.
  2170. this.stopTouch(ev, true); // skipMouseIgnore=true
  2171. this.isTouching = true;
  2172. this.trigger('touchstart', ev);
  2173. };
  2174. GlobalEmitter.prototype.handleTouchMove = function (ev) {
  2175. if (this.isTouching) {
  2176. this.trigger('touchmove', ev);
  2177. }
  2178. };
  2179. GlobalEmitter.prototype.handleTouchCancel = function (ev) {
  2180. if (this.isTouching) {
  2181. this.trigger('touchcancel', ev);
  2182. // Have touchcancel fire an artificial touchend. That way, handlers won't need to listen to both.
  2183. // If touchend fires later, it won't have any effect b/c isTouching will be false.
  2184. this.stopTouch(ev);
  2185. }
  2186. };
  2187. GlobalEmitter.prototype.handleTouchEnd = function (ev) {
  2188. this.stopTouch(ev);
  2189. };
  2190. // Mouse Handlers
  2191. // -----------------------------------------------------------------------------------------------------------------
  2192. GlobalEmitter.prototype.handleMouseDown = function (ev) {
  2193. if (!this.shouldIgnoreMouse()) {
  2194. this.trigger('mousedown', ev);
  2195. }
  2196. };
  2197. GlobalEmitter.prototype.handleMouseMove = function (ev) {
  2198. if (!this.shouldIgnoreMouse()) {
  2199. this.trigger('mousemove', ev);
  2200. }
  2201. };
  2202. GlobalEmitter.prototype.handleMouseUp = function (ev) {
  2203. if (!this.shouldIgnoreMouse()) {
  2204. this.trigger('mouseup', ev);
  2205. }
  2206. };
  2207. GlobalEmitter.prototype.handleClick = function (ev) {
  2208. if (!this.shouldIgnoreMouse()) {
  2209. this.trigger('click', ev);
  2210. }
  2211. };
  2212. // Misc Handlers
  2213. // -----------------------------------------------------------------------------------------------------------------
  2214. GlobalEmitter.prototype.handleSelectStart = function (ev) {
  2215. this.trigger('selectstart', ev);
  2216. };
  2217. GlobalEmitter.prototype.handleContextMenu = function (ev) {
  2218. this.trigger('contextmenu', ev);
  2219. };
  2220. GlobalEmitter.prototype.handleScroll = function (ev) {
  2221. this.trigger('scroll', ev);
  2222. };
  2223. // Utils
  2224. // -----------------------------------------------------------------------------------------------------------------
  2225. GlobalEmitter.prototype.stopTouch = function (ev, skipMouseIgnore) {
  2226. if (skipMouseIgnore === void 0) { skipMouseIgnore = false; }
  2227. if (this.isTouching) {
  2228. this.isTouching = false;
  2229. this.trigger('touchend', ev);
  2230. if (!skipMouseIgnore) {
  2231. this.startTouchMouseIgnore();
  2232. }
  2233. }
  2234. };
  2235. GlobalEmitter.prototype.startTouchMouseIgnore = function () {
  2236. var _this = this;
  2237. var wait = exportHooks.touchMouseIgnoreWait;
  2238. if (wait) {
  2239. this.mouseIgnoreDepth++;
  2240. setTimeout(function () {
  2241. _this.mouseIgnoreDepth--;
  2242. }, wait);
  2243. }
  2244. };
  2245. GlobalEmitter.prototype.shouldIgnoreMouse = function () {
  2246. return this.isTouching || Boolean(this.mouseIgnoreDepth);
  2247. };
  2248. return GlobalEmitter;
  2249. }());
  2250. exports.default = GlobalEmitter;
  2251. ListenerMixin_1.default.mixInto(GlobalEmitter);
  2252. EmitterMixin_1.default.mixInto(GlobalEmitter);
  2253. /***/ }),
  2254. /* 22 */
  2255. /***/ (function(module, exports, __webpack_require__) {
  2256. Object.defineProperty(exports, "__esModule", { value: true });
  2257. var exportHooks = __webpack_require__(16);
  2258. exports.viewHash = {};
  2259. exportHooks.views = exports.viewHash;
  2260. function defineView(viewName, viewConfig) {
  2261. exports.viewHash[viewName] = viewConfig;
  2262. }
  2263. exports.defineView = defineView;
  2264. function getViewConfig(viewName) {
  2265. return exports.viewHash[viewName];
  2266. }
  2267. exports.getViewConfig = getViewConfig;
  2268. /***/ }),
  2269. /* 23 */
  2270. /***/ (function(module, exports, __webpack_require__) {
  2271. Object.defineProperty(exports, "__esModule", { value: true });
  2272. var tslib_1 = __webpack_require__(2);
  2273. var util_1 = __webpack_require__(4);
  2274. var DragListener_1 = __webpack_require__(54);
  2275. /* Tracks mouse movements over a component and raises events about which hit the mouse is over.
  2276. ------------------------------------------------------------------------------------------------------------------------
  2277. options:
  2278. - subjectEl
  2279. - subjectCenter
  2280. */
  2281. var HitDragListener = /** @class */ (function (_super) {
  2282. tslib_1.__extends(HitDragListener, _super);
  2283. function HitDragListener(component, options) {
  2284. var _this = _super.call(this, options) || this;
  2285. _this.component = component;
  2286. return _this;
  2287. }
  2288. // Called when drag listening starts (but a real drag has not necessarily began).
  2289. // ev might be undefined if dragging was started manually.
  2290. HitDragListener.prototype.handleInteractionStart = function (ev) {
  2291. var subjectEl = this.subjectEl;
  2292. var subjectRect;
  2293. var origPoint;
  2294. var point;
  2295. this.component.hitsNeeded();
  2296. this.computeScrollBounds(); // for autoscroll
  2297. if (ev) {
  2298. origPoint = { left: util_1.getEvX(ev), top: util_1.getEvY(ev) };
  2299. point = origPoint;
  2300. // constrain the point to bounds of the element being dragged
  2301. if (subjectEl) {
  2302. subjectRect = util_1.getOuterRect(subjectEl); // used for centering as well
  2303. point = util_1.constrainPoint(point, subjectRect);
  2304. }
  2305. this.origHit = this.queryHit(point.left, point.top);
  2306. // treat the center of the subject as the collision point?
  2307. if (subjectEl && this.options.subjectCenter) {
  2308. // only consider the area the subject overlaps the hit. best for large subjects.
  2309. // TODO: skip this if hit didn't supply left/right/top/bottom
  2310. if (this.origHit) {
  2311. subjectRect = util_1.intersectRects(this.origHit, subjectRect) ||
  2312. subjectRect; // in case there is no intersection
  2313. }
  2314. point = util_1.getRectCenter(subjectRect);
  2315. }
  2316. this.coordAdjust = util_1.diffPoints(point, origPoint); // point - origPoint
  2317. }
  2318. else {
  2319. this.origHit = null;
  2320. this.coordAdjust = null;
  2321. }
  2322. // call the super-method. do it after origHit has been computed
  2323. _super.prototype.handleInteractionStart.call(this, ev);
  2324. };
  2325. // Called when the actual drag has started
  2326. HitDragListener.prototype.handleDragStart = function (ev) {
  2327. var hit;
  2328. _super.prototype.handleDragStart.call(this, ev);
  2329. // might be different from this.origHit if the min-distance is large
  2330. hit = this.queryHit(util_1.getEvX(ev), util_1.getEvY(ev));
  2331. // report the initial hit the mouse is over
  2332. // especially important if no min-distance and drag starts immediately
  2333. if (hit) {
  2334. this.handleHitOver(hit);
  2335. }
  2336. };
  2337. // Called when the drag moves
  2338. HitDragListener.prototype.handleDrag = function (dx, dy, ev) {
  2339. var hit;
  2340. _super.prototype.handleDrag.call(this, dx, dy, ev);
  2341. hit = this.queryHit(util_1.getEvX(ev), util_1.getEvY(ev));
  2342. if (!isHitsEqual(hit, this.hit)) {
  2343. if (this.hit) {
  2344. this.handleHitOut();
  2345. }
  2346. if (hit) {
  2347. this.handleHitOver(hit);
  2348. }
  2349. }
  2350. };
  2351. // Called when dragging has been stopped
  2352. HitDragListener.prototype.handleDragEnd = function (ev) {
  2353. this.handleHitDone();
  2354. _super.prototype.handleDragEnd.call(this, ev);
  2355. };
  2356. // Called when a the mouse has just moved over a new hit
  2357. HitDragListener.prototype.handleHitOver = function (hit) {
  2358. var isOrig = isHitsEqual(hit, this.origHit);
  2359. this.hit = hit;
  2360. this.trigger('hitOver', this.hit, isOrig, this.origHit);
  2361. };
  2362. // Called when the mouse has just moved out of a hit
  2363. HitDragListener.prototype.handleHitOut = function () {
  2364. if (this.hit) {
  2365. this.trigger('hitOut', this.hit);
  2366. this.handleHitDone();
  2367. this.hit = null;
  2368. }
  2369. };
  2370. // Called after a hitOut. Also called before a dragStop
  2371. HitDragListener.prototype.handleHitDone = function () {
  2372. if (this.hit) {
  2373. this.trigger('hitDone', this.hit);
  2374. }
  2375. };
  2376. // Called when the interaction ends, whether there was a real drag or not
  2377. HitDragListener.prototype.handleInteractionEnd = function (ev, isCancelled) {
  2378. _super.prototype.handleInteractionEnd.call(this, ev, isCancelled);
  2379. this.origHit = null;
  2380. this.hit = null;
  2381. this.component.hitsNotNeeded();
  2382. };
  2383. // Called when scrolling has stopped, whether through auto scroll, or the user scrolling
  2384. HitDragListener.prototype.handleScrollEnd = function () {
  2385. _super.prototype.handleScrollEnd.call(this);
  2386. // hits' absolute positions will be in new places after a user's scroll.
  2387. // HACK for recomputing.
  2388. if (this.isDragging) {
  2389. this.component.releaseHits();
  2390. this.component.prepareHits();
  2391. }
  2392. };
  2393. // Gets the hit underneath the coordinates for the given mouse event
  2394. HitDragListener.prototype.queryHit = function (left, top) {
  2395. if (this.coordAdjust) {
  2396. left += this.coordAdjust.left;
  2397. top += this.coordAdjust.top;
  2398. }
  2399. return this.component.queryHit(left, top);
  2400. };
  2401. return HitDragListener;
  2402. }(DragListener_1.default));
  2403. exports.default = HitDragListener;
  2404. // Returns `true` if the hits are identically equal. `false` otherwise. Must be from the same component.
  2405. // Two null values will be considered equal, as two "out of the component" states are the same.
  2406. function isHitsEqual(hit0, hit1) {
  2407. if (!hit0 && !hit1) {
  2408. return true;
  2409. }
  2410. if (hit0 && hit1) {
  2411. return hit0.component === hit1.component &&
  2412. isHitPropsWithin(hit0, hit1) &&
  2413. isHitPropsWithin(hit1, hit0); // ensures all props are identical
  2414. }
  2415. return false;
  2416. }
  2417. // Returns true if all of subHit's non-standard properties are within superHit
  2418. function isHitPropsWithin(subHit, superHit) {
  2419. for (var propName in subHit) {
  2420. if (!/^(component|left|right|top|bottom)$/.test(propName)) {
  2421. if (subHit[propName] !== superHit[propName]) {
  2422. return false;
  2423. }
  2424. }
  2425. }
  2426. return true;
  2427. }
  2428. /***/ }),
  2429. /* 24 */,
  2430. /* 25 */,
  2431. /* 26 */,
  2432. /* 27 */,
  2433. /* 28 */,
  2434. /* 29 */,
  2435. /* 30 */,
  2436. /* 31 */
  2437. /***/ (function(module, exports, __webpack_require__) {
  2438. Object.defineProperty(exports, "__esModule", { value: true });
  2439. var $ = __webpack_require__(3);
  2440. var moment = __webpack_require__(0);
  2441. var exportHooks = __webpack_require__(16);
  2442. var options_1 = __webpack_require__(32);
  2443. var util_1 = __webpack_require__(4);
  2444. exports.localeOptionHash = {};
  2445. exportHooks.locales = exports.localeOptionHash;
  2446. // NOTE: can't guarantee any of these computations will run because not every locale has datepicker
  2447. // configs, so make sure there are English fallbacks for these in the defaults file.
  2448. var dpComputableOptions = {
  2449. buttonText: function (dpOptions) {
  2450. return {
  2451. // the translations sometimes wrongly contain HTML entities
  2452. prev: util_1.stripHtmlEntities(dpOptions.prevText),
  2453. next: util_1.stripHtmlEntities(dpOptions.nextText),
  2454. today: util_1.stripHtmlEntities(dpOptions.currentText)
  2455. };
  2456. },
  2457. // Produces format strings like "MMMM YYYY" -> "September 2014"
  2458. monthYearFormat: function (dpOptions) {
  2459. return dpOptions.showMonthAfterYear ?
  2460. 'YYYY[' + dpOptions.yearSuffix + '] MMMM' :
  2461. 'MMMM YYYY[' + dpOptions.yearSuffix + ']';
  2462. }
  2463. };
  2464. var momComputableOptions = {
  2465. // Produces format strings like "ddd M/D" -> "Fri 9/15"
  2466. dayOfMonthFormat: function (momOptions, fcOptions) {
  2467. var format = momOptions.longDateFormat('l'); // for the format like "M/D/YYYY"
  2468. // strip the year off the edge, as well as other misc non-whitespace chars
  2469. format = format.replace(/^Y+[^\w\s]*|[^\w\s]*Y+$/g, '');
  2470. if (fcOptions.isRTL) {
  2471. format += ' ddd'; // for RTL, add day-of-week to end
  2472. }
  2473. else {
  2474. format = 'ddd ' + format; // for LTR, add day-of-week to beginning
  2475. }
  2476. return format;
  2477. },
  2478. // Produces format strings like "h:mma" -> "6:00pm"
  2479. mediumTimeFormat: function (momOptions) {
  2480. return momOptions.longDateFormat('LT')
  2481. .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand
  2482. },
  2483. // Produces format strings like "h(:mm)a" -> "6pm" / "6:30pm"
  2484. smallTimeFormat: function (momOptions) {
  2485. return momOptions.longDateFormat('LT')
  2486. .replace(':mm', '(:mm)')
  2487. .replace(/(\Wmm)$/, '($1)') // like above, but for foreign locales
  2488. .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand
  2489. },
  2490. // Produces format strings like "h(:mm)t" -> "6p" / "6:30p"
  2491. extraSmallTimeFormat: function (momOptions) {
  2492. return momOptions.longDateFormat('LT')
  2493. .replace(':mm', '(:mm)')
  2494. .replace(/(\Wmm)$/, '($1)') // like above, but for foreign locales
  2495. .replace(/\s*a$/i, 't'); // convert to AM/PM/am/pm to lowercase one-letter. remove any spaces beforehand
  2496. },
  2497. // Produces format strings like "ha" / "H" -> "6pm" / "18"
  2498. hourFormat: function (momOptions) {
  2499. return momOptions.longDateFormat('LT')
  2500. .replace(':mm', '')
  2501. .replace(/(\Wmm)$/, '') // like above, but for foreign locales
  2502. .replace(/\s*a$/i, 'a'); // convert AM/PM/am/pm to lowercase. remove any spaces beforehand
  2503. },
  2504. // Produces format strings like "h:mm" -> "6:30" (with no AM/PM)
  2505. noMeridiemTimeFormat: function (momOptions) {
  2506. return momOptions.longDateFormat('LT')
  2507. .replace(/\s*a$/i, ''); // remove trailing AM/PM
  2508. }
  2509. };
  2510. // options that should be computed off live calendar options (considers override options)
  2511. // TODO: best place for this? related to locale?
  2512. // TODO: flipping text based on isRTL is a bad idea because the CSS `direction` might want to handle it
  2513. var instanceComputableOptions = {
  2514. // Produces format strings for results like "Mo 16"
  2515. smallDayDateFormat: function (options) {
  2516. return options.isRTL ?
  2517. 'D dd' :
  2518. 'dd D';
  2519. },
  2520. // Produces format strings for results like "Wk 5"
  2521. weekFormat: function (options) {
  2522. return options.isRTL ?
  2523. 'w[ ' + options.weekNumberTitle + ']' :
  2524. '[' + options.weekNumberTitle + ' ]w';
  2525. },
  2526. // Produces format strings for results like "Wk5"
  2527. smallWeekFormat: function (options) {
  2528. return options.isRTL ?
  2529. 'w[' + options.weekNumberTitle + ']' :
  2530. '[' + options.weekNumberTitle + ']w';
  2531. }
  2532. };
  2533. // TODO: make these computable properties in optionsManager
  2534. function populateInstanceComputableOptions(options) {
  2535. $.each(instanceComputableOptions, function (name, func) {
  2536. if (options[name] == null) {
  2537. options[name] = func(options);
  2538. }
  2539. });
  2540. }
  2541. exports.populateInstanceComputableOptions = populateInstanceComputableOptions;
  2542. // Initialize jQuery UI datepicker translations while using some of the translations
  2543. // Will set this as the default locales for datepicker.
  2544. function datepickerLocale(localeCode, dpLocaleCode, dpOptions) {
  2545. // get the FullCalendar internal option hash for this locale. create if necessary
  2546. var fcOptions = exports.localeOptionHash[localeCode] || (exports.localeOptionHash[localeCode] = {});
  2547. // transfer some simple options from datepicker to fc
  2548. fcOptions.isRTL = dpOptions.isRTL;
  2549. fcOptions.weekNumberTitle = dpOptions.weekHeader;
  2550. // compute some more complex options from datepicker
  2551. $.each(dpComputableOptions, function (name, func) {
  2552. fcOptions[name] = func(dpOptions);
  2553. });
  2554. var jqDatePicker = $.datepicker;
  2555. // is jQuery UI Datepicker is on the page?
  2556. if (jqDatePicker) {
  2557. // Register the locale data.
  2558. // FullCalendar and MomentJS use locale codes like "pt-br" but Datepicker
  2559. // does it like "pt-BR" or if it doesn't have the locale, maybe just "pt".
  2560. // Make an alias so the locale can be referenced either way.
  2561. jqDatePicker.regional[dpLocaleCode] =
  2562. jqDatePicker.regional[localeCode] = // alias
  2563. dpOptions;
  2564. // Alias 'en' to the default locale data. Do this every time.
  2565. jqDatePicker.regional.en = jqDatePicker.regional[''];
  2566. // Set as Datepicker's global defaults.
  2567. jqDatePicker.setDefaults(dpOptions);
  2568. }
  2569. }
  2570. exports.datepickerLocale = datepickerLocale;
  2571. // Sets FullCalendar-specific translations. Will set the locales as the global default.
  2572. function locale(localeCode, newFcOptions) {
  2573. var fcOptions;
  2574. var momOptions;
  2575. // get the FullCalendar internal option hash for this locale. create if necessary
  2576. fcOptions = exports.localeOptionHash[localeCode] || (exports.localeOptionHash[localeCode] = {});
  2577. // provided new options for this locales? merge them in
  2578. if (newFcOptions) {
  2579. fcOptions = exports.localeOptionHash[localeCode] = options_1.mergeOptions([fcOptions, newFcOptions]);
  2580. }
  2581. // compute locale options that weren't defined.
  2582. // always do this. newFcOptions can be undefined when initializing from i18n file,
  2583. // so no way to tell if this is an initialization or a default-setting.
  2584. momOptions = getMomentLocaleData(localeCode); // will fall back to en
  2585. $.each(momComputableOptions, function (name, func) {
  2586. if (fcOptions[name] == null) {
  2587. fcOptions[name] = (func)(momOptions, fcOptions);
  2588. }
  2589. });
  2590. // set it as the default locale for FullCalendar
  2591. options_1.globalDefaults.locale = localeCode;
  2592. }
  2593. exports.locale = locale;
  2594. // Returns moment's internal locale data. If doesn't exist, returns English.
  2595. function getMomentLocaleData(localeCode) {
  2596. return moment.localeData(localeCode) || moment.localeData('en');
  2597. }
  2598. exports.getMomentLocaleData = getMomentLocaleData;
  2599. // Initialize English by forcing computation of moment-derived options.
  2600. // Also, sets it as the default.
  2601. locale('en', options_1.englishDefaults);
  2602. /***/ }),
  2603. /* 32 */
  2604. /***/ (function(module, exports, __webpack_require__) {
  2605. Object.defineProperty(exports, "__esModule", { value: true });
  2606. var util_1 = __webpack_require__(4);
  2607. exports.globalDefaults = {
  2608. titleRangeSeparator: ' \u2013 ',
  2609. monthYearFormat: 'MMMM YYYY',
  2610. defaultTimedEventDuration: '02:00:00',
  2611. defaultAllDayEventDuration: { days: 1 },
  2612. forceEventDuration: false,
  2613. nextDayThreshold: '09:00:00',
  2614. // display
  2615. columnHeader: true,
  2616. defaultView: 'month',
  2617. aspectRatio: 1.35,
  2618. header: {
  2619. left: 'title',
  2620. center: '',
  2621. right: 'today prev,next'
  2622. },
  2623. weekends: true,
  2624. weekNumbers: false,
  2625. weekNumberTitle: 'W',
  2626. weekNumberCalculation: 'local',
  2627. // editable: false,
  2628. // nowIndicator: false,
  2629. scrollTime: '06:00:00',
  2630. minTime: '00:00:00',
  2631. maxTime: '24:00:00',
  2632. showNonCurrentDates: true,
  2633. // event ajax
  2634. lazyFetching: true,
  2635. startParam: 'start',
  2636. endParam: 'end',
  2637. timezoneParam: 'timezone',
  2638. timezone: false,
  2639. // allDayDefault: undefined,
  2640. // locale
  2641. locale: null,
  2642. isRTL: false,
  2643. buttonText: {
  2644. prev: 'prev',
  2645. next: 'next',
  2646. prevYear: 'prev year',
  2647. nextYear: 'next year',
  2648. year: 'year',
  2649. today: 'today',
  2650. month: 'month',
  2651. week: 'week',
  2652. day: 'day'
  2653. },
  2654. // buttonIcons: null,
  2655. allDayText: 'all-day',
  2656. // allows setting a min-height to the event segment to prevent short events overlapping each other
  2657. agendaEventMinHeight: 0,
  2658. // jquery-ui theming
  2659. theme: false,
  2660. // themeButtonIcons: null,
  2661. // eventResizableFromStart: false,
  2662. dragOpacity: .75,
  2663. dragRevertDuration: 500,
  2664. dragScroll: true,
  2665. // selectable: false,
  2666. unselectAuto: true,
  2667. // selectMinDistance: 0,
  2668. dropAccept: '*',
  2669. eventOrder: 'title',
  2670. // eventRenderWait: null,
  2671. eventLimit: false,
  2672. eventLimitText: 'more',
  2673. eventLimitClick: 'popover',
  2674. dayPopoverFormat: 'LL',
  2675. handleWindowResize: true,
  2676. windowResizeDelay: 100,
  2677. longPressDelay: 1000
  2678. };
  2679. exports.englishDefaults = {
  2680. dayPopoverFormat: 'dddd, MMMM D'
  2681. };
  2682. exports.rtlDefaults = {
  2683. header: {
  2684. left: 'next,prev today',
  2685. center: '',
  2686. right: 'title'
  2687. },
  2688. buttonIcons: {
  2689. prev: 'right-single-arrow',
  2690. next: 'left-single-arrow',
  2691. prevYear: 'right-double-arrow',
  2692. nextYear: 'left-double-arrow'
  2693. },
  2694. themeButtonIcons: {
  2695. prev: 'circle-triangle-e',
  2696. next: 'circle-triangle-w',
  2697. nextYear: 'seek-prev',
  2698. prevYear: 'seek-next'
  2699. }
  2700. };
  2701. var complexOptions = [
  2702. 'header',
  2703. 'footer',
  2704. 'buttonText',
  2705. 'buttonIcons',
  2706. 'themeButtonIcons'
  2707. ];
  2708. // Merges an array of option objects into a single object
  2709. function mergeOptions(optionObjs) {
  2710. return util_1.mergeProps(optionObjs, complexOptions);
  2711. }
  2712. exports.mergeOptions = mergeOptions;
  2713. /***/ }),
  2714. /* 33 */
  2715. /***/ (function(module, exports, __webpack_require__) {
  2716. Object.defineProperty(exports, "__esModule", { value: true });
  2717. var tslib_1 = __webpack_require__(2);
  2718. var util_1 = __webpack_require__(4);
  2719. // Class that all other classes will inherit from
  2720. var Class = /** @class */ (function () {
  2721. function Class() {
  2722. }
  2723. // Called on a class to create a subclass.
  2724. // LIMITATION: cannot provide a constructor!
  2725. Class.extend = function (members) {
  2726. var SubClass = /** @class */ (function (_super) {
  2727. tslib_1.__extends(SubClass, _super);
  2728. function SubClass() {
  2729. return _super !== null && _super.apply(this, arguments) || this;
  2730. }
  2731. return SubClass;
  2732. }(this));
  2733. util_1.copyOwnProps(members, SubClass.prototype);
  2734. return SubClass;
  2735. };
  2736. // Adds new member variables/methods to the class's prototype.
  2737. // Can be called with another class, or a plain object hash containing new members.
  2738. Class.mixin = function (members) {
  2739. util_1.copyOwnProps(members, this.prototype);
  2740. };
  2741. return Class;
  2742. }());
  2743. exports.default = Class;
  2744. /***/ }),
  2745. /* 34 */
  2746. /***/ (function(module, exports, __webpack_require__) {
  2747. Object.defineProperty(exports, "__esModule", { value: true });
  2748. var $ = __webpack_require__(3);
  2749. var ParsableModelMixin_1 = __webpack_require__(208);
  2750. var EventDef = /** @class */ (function () {
  2751. function EventDef(source) {
  2752. this.source = source;
  2753. this.className = [];
  2754. this.miscProps = {};
  2755. }
  2756. EventDef.parse = function (rawInput, source) {
  2757. var def = new this(source);
  2758. if (def.applyProps(rawInput)) {
  2759. return def;
  2760. }
  2761. return false;
  2762. };
  2763. EventDef.normalizeId = function (id) {
  2764. return String(id);
  2765. };
  2766. EventDef.generateId = function () {
  2767. return '_fc' + (EventDef.uuid++);
  2768. };
  2769. EventDef.prototype.clone = function () {
  2770. var copy = new this.constructor(this.source);
  2771. copy.id = this.id;
  2772. copy.rawId = this.rawId;
  2773. copy.uid = this.uid; // not really unique anymore :(
  2774. EventDef.copyVerbatimStandardProps(this, copy);
  2775. copy.className = this.className.slice(); // copy
  2776. copy.miscProps = $.extend({}, this.miscProps);
  2777. return copy;
  2778. };
  2779. EventDef.prototype.hasInverseRendering = function () {
  2780. return this.getRendering() === 'inverse-background';
  2781. };
  2782. EventDef.prototype.hasBgRendering = function () {
  2783. var rendering = this.getRendering();
  2784. return rendering === 'inverse-background' || rendering === 'background';
  2785. };
  2786. EventDef.prototype.getRendering = function () {
  2787. if (this.rendering != null) {
  2788. return this.rendering;
  2789. }
  2790. return this.source.rendering;
  2791. };
  2792. EventDef.prototype.getConstraint = function () {
  2793. if (this.constraint != null) {
  2794. return this.constraint;
  2795. }
  2796. if (this.source.constraint != null) {
  2797. return this.source.constraint;
  2798. }
  2799. return this.source.calendar.opt('eventConstraint'); // what about View option?
  2800. };
  2801. EventDef.prototype.getOverlap = function () {
  2802. if (this.overlap != null) {
  2803. return this.overlap;
  2804. }
  2805. if (this.source.overlap != null) {
  2806. return this.source.overlap;
  2807. }
  2808. return this.source.calendar.opt('eventOverlap'); // what about View option?
  2809. };
  2810. EventDef.prototype.isStartExplicitlyEditable = function () {
  2811. if (this.startEditable != null) {
  2812. return this.startEditable;
  2813. }
  2814. return this.source.startEditable;
  2815. };
  2816. EventDef.prototype.isDurationExplicitlyEditable = function () {
  2817. if (this.durationEditable != null) {
  2818. return this.durationEditable;
  2819. }
  2820. return this.source.durationEditable;
  2821. };
  2822. EventDef.prototype.isExplicitlyEditable = function () {
  2823. if (this.editable != null) {
  2824. return this.editable;
  2825. }
  2826. return this.source.editable;
  2827. };
  2828. EventDef.prototype.toLegacy = function () {
  2829. var obj = $.extend({}, this.miscProps);
  2830. obj._id = this.uid;
  2831. obj.source = this.source;
  2832. obj.className = this.className.slice(); // copy
  2833. obj.allDay = this.isAllDay();
  2834. if (this.rawId != null) {
  2835. obj.id = this.rawId;
  2836. }
  2837. EventDef.copyVerbatimStandardProps(this, obj);
  2838. return obj;
  2839. };
  2840. EventDef.prototype.applyManualStandardProps = function (rawProps) {
  2841. if (rawProps.id != null) {
  2842. this.id = EventDef.normalizeId((this.rawId = rawProps.id));
  2843. }
  2844. else {
  2845. this.id = EventDef.generateId();
  2846. }
  2847. if (rawProps._id != null) {
  2848. this.uid = String(rawProps._id);
  2849. }
  2850. else {
  2851. this.uid = EventDef.generateId();
  2852. }
  2853. // TODO: converge with EventSource
  2854. if ($.isArray(rawProps.className)) {
  2855. this.className = rawProps.className;
  2856. }
  2857. if (typeof rawProps.className === 'string') {
  2858. this.className = rawProps.className.split(/\s+/);
  2859. }
  2860. return true;
  2861. };
  2862. EventDef.prototype.applyMiscProps = function (rawProps) {
  2863. $.extend(this.miscProps, rawProps);
  2864. };
  2865. EventDef.uuid = 0;
  2866. EventDef.defineStandardProps = ParsableModelMixin_1.default.defineStandardProps;
  2867. EventDef.copyVerbatimStandardProps = ParsableModelMixin_1.default.copyVerbatimStandardProps;
  2868. return EventDef;
  2869. }());
  2870. exports.default = EventDef;
  2871. ParsableModelMixin_1.default.mixInto(EventDef);
  2872. EventDef.defineStandardProps({
  2873. // not automatically assigned (`false`)
  2874. _id: false,
  2875. id: false,
  2876. className: false,
  2877. source: false,
  2878. // automatically assigned (`true`)
  2879. title: true,
  2880. url: true,
  2881. rendering: true,
  2882. constraint: true,
  2883. overlap: true,
  2884. editable: true,
  2885. startEditable: true,
  2886. durationEditable: true,
  2887. color: true,
  2888. backgroundColor: true,
  2889. borderColor: true,
  2890. textColor: true
  2891. });
  2892. /***/ }),
  2893. /* 35 */
  2894. /***/ (function(module, exports, __webpack_require__) {
  2895. Object.defineProperty(exports, "__esModule", { value: true });
  2896. var EventRange_1 = __webpack_require__(211);
  2897. var EventFootprint_1 = __webpack_require__(36);
  2898. var ComponentFootprint_1 = __webpack_require__(12);
  2899. function eventDefsToEventInstances(eventDefs, unzonedRange) {
  2900. var eventInstances = [];
  2901. var i;
  2902. for (i = 0; i < eventDefs.length; i++) {
  2903. eventInstances.push.apply(eventInstances, // append
  2904. eventDefs[i].buildInstances(unzonedRange));
  2905. }
  2906. return eventInstances;
  2907. }
  2908. exports.eventDefsToEventInstances = eventDefsToEventInstances;
  2909. function eventInstanceToEventRange(eventInstance) {
  2910. return new EventRange_1.default(eventInstance.dateProfile.unzonedRange, eventInstance.def, eventInstance);
  2911. }
  2912. exports.eventInstanceToEventRange = eventInstanceToEventRange;
  2913. function eventRangeToEventFootprint(eventRange) {
  2914. return new EventFootprint_1.default(new ComponentFootprint_1.default(eventRange.unzonedRange, eventRange.eventDef.isAllDay()), eventRange.eventDef, eventRange.eventInstance // might not exist
  2915. );
  2916. }
  2917. exports.eventRangeToEventFootprint = eventRangeToEventFootprint;
  2918. function eventInstanceToUnzonedRange(eventInstance) {
  2919. return eventInstance.dateProfile.unzonedRange;
  2920. }
  2921. exports.eventInstanceToUnzonedRange = eventInstanceToUnzonedRange;
  2922. function eventFootprintToComponentFootprint(eventFootprint) {
  2923. return eventFootprint.componentFootprint;
  2924. }
  2925. exports.eventFootprintToComponentFootprint = eventFootprintToComponentFootprint;
  2926. /***/ }),
  2927. /* 36 */
  2928. /***/ (function(module, exports) {
  2929. Object.defineProperty(exports, "__esModule", { value: true });
  2930. var EventFootprint = /** @class */ (function () {
  2931. function EventFootprint(componentFootprint, eventDef, eventInstance) {
  2932. this.componentFootprint = componentFootprint;
  2933. this.eventDef = eventDef;
  2934. if (eventInstance) {
  2935. this.eventInstance = eventInstance;
  2936. }
  2937. }
  2938. EventFootprint.prototype.getEventLegacy = function () {
  2939. return (this.eventInstance || this.eventDef).toLegacy();
  2940. };
  2941. return EventFootprint;
  2942. }());
  2943. exports.default = EventFootprint;
  2944. /***/ }),
  2945. /* 37 */
  2946. /***/ (function(module, exports, __webpack_require__) {
  2947. Object.defineProperty(exports, "__esModule", { value: true });
  2948. var util_1 = __webpack_require__(4);
  2949. var EventDateProfile_1 = __webpack_require__(17);
  2950. var EventDef_1 = __webpack_require__(34);
  2951. var EventDefDateMutation_1 = __webpack_require__(50);
  2952. var SingleEventDef_1 = __webpack_require__(13);
  2953. var EventDefMutation = /** @class */ (function () {
  2954. function EventDefMutation() {
  2955. }
  2956. EventDefMutation.createFromRawProps = function (eventInstance, rawProps, largeUnit) {
  2957. var eventDef = eventInstance.def;
  2958. var dateProps = {};
  2959. var standardProps = {};
  2960. var miscProps = {};
  2961. var verbatimStandardProps = {};
  2962. var eventDefId = null;
  2963. var className = null;
  2964. var propName;
  2965. var dateProfile;
  2966. var dateMutation;
  2967. var defMutation;
  2968. for (propName in rawProps) {
  2969. if (EventDateProfile_1.default.isStandardProp(propName)) {
  2970. dateProps[propName] = rawProps[propName];
  2971. }
  2972. else if (eventDef.isStandardProp(propName)) {
  2973. standardProps[propName] = rawProps[propName];
  2974. }
  2975. else if (eventDef.miscProps[propName] !== rawProps[propName]) {
  2976. miscProps[propName] = rawProps[propName];
  2977. }
  2978. }
  2979. dateProfile = EventDateProfile_1.default.parse(dateProps, eventDef.source);
  2980. if (dateProfile) {
  2981. dateMutation = EventDefDateMutation_1.default.createFromDiff(eventInstance.dateProfile, dateProfile, largeUnit);
  2982. }
  2983. if (standardProps.id !== eventDef.id) {
  2984. eventDefId = standardProps.id; // only apply if there's a change
  2985. }
  2986. if (!util_1.isArraysEqual(standardProps.className, eventDef.className)) {
  2987. className = standardProps.className; // only apply if there's a change
  2988. }
  2989. EventDef_1.default.copyVerbatimStandardProps(standardProps, // src
  2990. verbatimStandardProps // dest
  2991. );
  2992. defMutation = new EventDefMutation();
  2993. defMutation.eventDefId = eventDefId;
  2994. defMutation.className = className;
  2995. defMutation.verbatimStandardProps = verbatimStandardProps;
  2996. defMutation.miscProps = miscProps;
  2997. if (dateMutation) {
  2998. defMutation.dateMutation = dateMutation;
  2999. }
  3000. return defMutation;
  3001. };
  3002. /*
  3003. eventDef assumed to be a SingleEventDef.
  3004. returns an undo function.
  3005. */
  3006. EventDefMutation.prototype.mutateSingle = function (eventDef) {
  3007. var origDateProfile;
  3008. if (this.dateMutation) {
  3009. origDateProfile = eventDef.dateProfile;
  3010. eventDef.dateProfile = this.dateMutation.buildNewDateProfile(origDateProfile, eventDef.source.calendar);
  3011. }
  3012. // can't undo
  3013. // TODO: more DRY with EventDef::applyManualStandardProps
  3014. if (this.eventDefId != null) {
  3015. eventDef.id = EventDef_1.default.normalizeId((eventDef.rawId = this.eventDefId));
  3016. }
  3017. // can't undo
  3018. // TODO: more DRY with EventDef::applyManualStandardProps
  3019. if (this.className) {
  3020. eventDef.className = this.className;
  3021. }
  3022. // can't undo
  3023. if (this.verbatimStandardProps) {
  3024. SingleEventDef_1.default.copyVerbatimStandardProps(this.verbatimStandardProps, // src
  3025. eventDef // dest
  3026. );
  3027. }
  3028. // can't undo
  3029. if (this.miscProps) {
  3030. eventDef.applyMiscProps(this.miscProps);
  3031. }
  3032. if (origDateProfile) {
  3033. return function () {
  3034. eventDef.dateProfile = origDateProfile;
  3035. };
  3036. }
  3037. else {
  3038. return function () { };
  3039. }
  3040. };
  3041. EventDefMutation.prototype.setDateMutation = function (dateMutation) {
  3042. if (dateMutation && !dateMutation.isEmpty()) {
  3043. this.dateMutation = dateMutation;
  3044. }
  3045. else {
  3046. this.dateMutation = null;
  3047. }
  3048. };
  3049. EventDefMutation.prototype.isEmpty = function () {
  3050. return !this.dateMutation;
  3051. };
  3052. return EventDefMutation;
  3053. }());
  3054. exports.default = EventDefMutation;
  3055. /***/ }),
  3056. /* 38 */
  3057. /***/ (function(module, exports) {
  3058. Object.defineProperty(exports, "__esModule", { value: true });
  3059. exports.default = {
  3060. sourceClasses: [],
  3061. registerClass: function (EventSourceClass) {
  3062. this.sourceClasses.unshift(EventSourceClass); // give highest priority
  3063. },
  3064. parse: function (rawInput, calendar) {
  3065. var sourceClasses = this.sourceClasses;
  3066. var i;
  3067. var eventSource;
  3068. for (i = 0; i < sourceClasses.length; i++) {
  3069. eventSource = sourceClasses[i].parse(rawInput, calendar);
  3070. if (eventSource) {
  3071. return eventSource;
  3072. }
  3073. }
  3074. }
  3075. };
  3076. /***/ }),
  3077. /* 39 */
  3078. /***/ (function(module, exports, __webpack_require__) {
  3079. Object.defineProperty(exports, "__esModule", { value: true });
  3080. var tslib_1 = __webpack_require__(2);
  3081. var $ = __webpack_require__(3);
  3082. var util_1 = __webpack_require__(4);
  3083. var Class_1 = __webpack_require__(33);
  3084. /*
  3085. Embodies a div that has potential scrollbars
  3086. */
  3087. var Scroller = /** @class */ (function (_super) {
  3088. tslib_1.__extends(Scroller, _super);
  3089. function Scroller(options) {
  3090. var _this = _super.call(this) || this;
  3091. options = options || {};
  3092. _this.overflowX = options.overflowX || options.overflow || 'auto';
  3093. _this.overflowY = options.overflowY || options.overflow || 'auto';
  3094. return _this;
  3095. }
  3096. Scroller.prototype.render = function () {
  3097. this.el = this.renderEl();
  3098. this.applyOverflow();
  3099. };
  3100. Scroller.prototype.renderEl = function () {
  3101. return (this.scrollEl = $('<div class="fc-scroller"></div>'));
  3102. };
  3103. // sets to natural height, unlocks overflow
  3104. Scroller.prototype.clear = function () {
  3105. this.setHeight('auto');
  3106. this.applyOverflow();
  3107. };
  3108. Scroller.prototype.destroy = function () {
  3109. this.el.remove();
  3110. };
  3111. // Overflow
  3112. // -----------------------------------------------------------------------------------------------------------------
  3113. Scroller.prototype.applyOverflow = function () {
  3114. this.scrollEl.css({
  3115. 'overflow-x': this.overflowX,
  3116. 'overflow-y': this.overflowY
  3117. });
  3118. };
  3119. // Causes any 'auto' overflow values to resolves to 'scroll' or 'hidden'.
  3120. // Useful for preserving scrollbar widths regardless of future resizes.
  3121. // Can pass in scrollbarWidths for optimization.
  3122. Scroller.prototype.lockOverflow = function (scrollbarWidths) {
  3123. var overflowX = this.overflowX;
  3124. var overflowY = this.overflowY;
  3125. scrollbarWidths = scrollbarWidths || this.getScrollbarWidths();
  3126. if (overflowX === 'auto') {
  3127. overflowX = (scrollbarWidths.top || scrollbarWidths.bottom || // horizontal scrollbars?
  3128. // OR scrolling pane with massless scrollbars?
  3129. this.scrollEl[0].scrollWidth - 1 > this.scrollEl[0].clientWidth) ? 'scroll' : 'hidden';
  3130. }
  3131. if (overflowY === 'auto') {
  3132. overflowY = (scrollbarWidths.left || scrollbarWidths.right || // vertical scrollbars?
  3133. // OR scrolling pane with massless scrollbars?
  3134. this.scrollEl[0].scrollHeight - 1 > this.scrollEl[0].clientHeight) ? 'scroll' : 'hidden';
  3135. }
  3136. this.scrollEl.css({ 'overflow-x': overflowX, 'overflow-y': overflowY });
  3137. };
  3138. // Getters / Setters
  3139. // -----------------------------------------------------------------------------------------------------------------
  3140. Scroller.prototype.setHeight = function (height) {
  3141. this.scrollEl.height(height);
  3142. };
  3143. Scroller.prototype.getScrollTop = function () {
  3144. return this.scrollEl.scrollTop();
  3145. };
  3146. Scroller.prototype.setScrollTop = function (top) {
  3147. this.scrollEl.scrollTop(top);
  3148. };
  3149. Scroller.prototype.getClientWidth = function () {
  3150. return this.scrollEl[0].clientWidth;
  3151. };
  3152. Scroller.prototype.getClientHeight = function () {
  3153. return this.scrollEl[0].clientHeight;
  3154. };
  3155. Scroller.prototype.getScrollbarWidths = function () {
  3156. return util_1.getScrollbarWidths(this.scrollEl);
  3157. };
  3158. return Scroller;
  3159. }(Class_1.default));
  3160. exports.default = Scroller;
  3161. /***/ }),
  3162. /* 40 */
  3163. /***/ (function(module, exports, __webpack_require__) {
  3164. Object.defineProperty(exports, "__esModule", { value: true });
  3165. var tslib_1 = __webpack_require__(2);
  3166. var $ = __webpack_require__(3);
  3167. var util_1 = __webpack_require__(4);
  3168. var DateComponent_1 = __webpack_require__(219);
  3169. var GlobalEmitter_1 = __webpack_require__(21);
  3170. var InteractiveDateComponent = /** @class */ (function (_super) {
  3171. tslib_1.__extends(InteractiveDateComponent, _super);
  3172. function InteractiveDateComponent(_view, _options) {
  3173. var _this = _super.call(this, _view, _options) || this;
  3174. // self-config, overridable by subclasses
  3175. _this.segSelector = '.fc-event-container > *'; // what constitutes an event element?
  3176. if (_this.dateSelectingClass) {
  3177. _this.dateClicking = new _this.dateClickingClass(_this);
  3178. }
  3179. if (_this.dateSelectingClass) {
  3180. _this.dateSelecting = new _this.dateSelectingClass(_this);
  3181. }
  3182. if (_this.eventPointingClass) {
  3183. _this.eventPointing = new _this.eventPointingClass(_this);
  3184. }
  3185. if (_this.eventDraggingClass && _this.eventPointing) {
  3186. _this.eventDragging = new _this.eventDraggingClass(_this, _this.eventPointing);
  3187. }
  3188. if (_this.eventResizingClass && _this.eventPointing) {
  3189. _this.eventResizing = new _this.eventResizingClass(_this, _this.eventPointing);
  3190. }
  3191. if (_this.externalDroppingClass) {
  3192. _this.externalDropping = new _this.externalDroppingClass(_this);
  3193. }
  3194. return _this;
  3195. }
  3196. // Sets the container element that the view should render inside of, does global DOM-related initializations,
  3197. // and renders all the non-date-related content inside.
  3198. InteractiveDateComponent.prototype.setElement = function (el) {
  3199. _super.prototype.setElement.call(this, el);
  3200. if (this.dateClicking) {
  3201. this.dateClicking.bindToEl(el);
  3202. }
  3203. if (this.dateSelecting) {
  3204. this.dateSelecting.bindToEl(el);
  3205. }
  3206. this.bindAllSegHandlersToEl(el);
  3207. };
  3208. InteractiveDateComponent.prototype.removeElement = function () {
  3209. this.endInteractions();
  3210. _super.prototype.removeElement.call(this);
  3211. };
  3212. InteractiveDateComponent.prototype.executeEventUnrender = function () {
  3213. this.endInteractions();
  3214. _super.prototype.executeEventUnrender.call(this);
  3215. };
  3216. InteractiveDateComponent.prototype.bindGlobalHandlers = function () {
  3217. _super.prototype.bindGlobalHandlers.call(this);
  3218. if (this.externalDropping) {
  3219. this.externalDropping.bindToDocument();
  3220. }
  3221. };
  3222. InteractiveDateComponent.prototype.unbindGlobalHandlers = function () {
  3223. _super.prototype.unbindGlobalHandlers.call(this);
  3224. if (this.externalDropping) {
  3225. this.externalDropping.unbindFromDocument();
  3226. }
  3227. };
  3228. InteractiveDateComponent.prototype.bindDateHandlerToEl = function (el, name, handler) {
  3229. var _this = this;
  3230. // attach a handler to the grid's root element.
  3231. // jQuery will take care of unregistering them when removeElement gets called.
  3232. this.el.on(name, function (ev) {
  3233. if (!$(ev.target).is(_this.segSelector + ':not(.fc-helper),' + // directly on an event element
  3234. _this.segSelector + ':not(.fc-helper) *,' + // within an event element
  3235. '.fc-more,' + // a "more.." link
  3236. 'a[data-goto]' // a clickable nav link
  3237. )) {
  3238. return handler.call(_this, ev);
  3239. }
  3240. });
  3241. };
  3242. InteractiveDateComponent.prototype.bindAllSegHandlersToEl = function (el) {
  3243. [
  3244. this.eventPointing,
  3245. this.eventDragging,
  3246. this.eventResizing
  3247. ].forEach(function (eventInteraction) {
  3248. if (eventInteraction) {
  3249. eventInteraction.bindToEl(el);
  3250. }
  3251. });
  3252. };
  3253. InteractiveDateComponent.prototype.bindSegHandlerToEl = function (el, name, handler) {
  3254. var _this = this;
  3255. el.on(name, this.segSelector, function (ev) {
  3256. var segEl = $(ev.currentTarget);
  3257. if (!segEl.is('.fc-helper')) {
  3258. var seg = segEl.data('fc-seg'); // grab segment data. put there by View::renderEventsPayload
  3259. if (seg && !_this.shouldIgnoreEventPointing()) {
  3260. return handler.call(_this, seg, ev); // context will be the Grid
  3261. }
  3262. }
  3263. });
  3264. };
  3265. InteractiveDateComponent.prototype.shouldIgnoreMouse = function () {
  3266. // HACK
  3267. // This will still work even though bindDateHandlerToEl doesn't use GlobalEmitter.
  3268. return GlobalEmitter_1.default.get().shouldIgnoreMouse();
  3269. };
  3270. InteractiveDateComponent.prototype.shouldIgnoreTouch = function () {
  3271. var view = this._getView();
  3272. // On iOS (and Android?) when a new selection is initiated overtop another selection,
  3273. // the touchend never fires because the elements gets removed mid-touch-interaction (my theory).
  3274. // HACK: simply don't allow this to happen.
  3275. // ALSO: prevent selection when an *event* is already raised.
  3276. return view.isSelected || view.selectedEvent;
  3277. };
  3278. InteractiveDateComponent.prototype.shouldIgnoreEventPointing = function () {
  3279. // only call the handlers if there is not a drag/resize in progress
  3280. return (this.eventDragging && this.eventDragging.isDragging) ||
  3281. (this.eventResizing && this.eventResizing.isResizing);
  3282. };
  3283. InteractiveDateComponent.prototype.canStartSelection = function (seg, ev) {
  3284. return util_1.getEvIsTouch(ev) &&
  3285. !this.canStartResize(seg, ev) &&
  3286. (this.isEventDefDraggable(seg.footprint.eventDef) ||
  3287. this.isEventDefResizable(seg.footprint.eventDef));
  3288. };
  3289. InteractiveDateComponent.prototype.canStartDrag = function (seg, ev) {
  3290. return !this.canStartResize(seg, ev) &&
  3291. this.isEventDefDraggable(seg.footprint.eventDef);
  3292. };
  3293. InteractiveDateComponent.prototype.canStartResize = function (seg, ev) {
  3294. var view = this._getView();
  3295. var eventDef = seg.footprint.eventDef;
  3296. return (!util_1.getEvIsTouch(ev) || view.isEventDefSelected(eventDef)) &&
  3297. this.isEventDefResizable(eventDef) &&
  3298. $(ev.target).is('.fc-resizer');
  3299. };
  3300. // Kills all in-progress dragging.
  3301. // Useful for when public API methods that result in re-rendering are invoked during a drag.
  3302. // Also useful for when touch devices misbehave and don't fire their touchend.
  3303. InteractiveDateComponent.prototype.endInteractions = function () {
  3304. [
  3305. this.dateClicking,
  3306. this.dateSelecting,
  3307. this.eventPointing,
  3308. this.eventDragging,
  3309. this.eventResizing
  3310. ].forEach(function (interaction) {
  3311. if (interaction) {
  3312. interaction.end();
  3313. }
  3314. });
  3315. };
  3316. // Event Drag-n-Drop
  3317. // ---------------------------------------------------------------------------------------------------------------
  3318. // Computes if the given event is allowed to be dragged by the user
  3319. InteractiveDateComponent.prototype.isEventDefDraggable = function (eventDef) {
  3320. return this.isEventDefStartEditable(eventDef);
  3321. };
  3322. InteractiveDateComponent.prototype.isEventDefStartEditable = function (eventDef) {
  3323. var isEditable = eventDef.isStartExplicitlyEditable();
  3324. if (isEditable == null) {
  3325. isEditable = this.opt('eventStartEditable');
  3326. if (isEditable == null) {
  3327. isEditable = this.isEventDefGenerallyEditable(eventDef);
  3328. }
  3329. }
  3330. return isEditable;
  3331. };
  3332. InteractiveDateComponent.prototype.isEventDefGenerallyEditable = function (eventDef) {
  3333. var isEditable = eventDef.isExplicitlyEditable();
  3334. if (isEditable == null) {
  3335. isEditable = this.opt('editable');
  3336. }
  3337. return isEditable;
  3338. };
  3339. // Event Resizing
  3340. // ---------------------------------------------------------------------------------------------------------------
  3341. // Computes if the given event is allowed to be resized from its starting edge
  3342. InteractiveDateComponent.prototype.isEventDefResizableFromStart = function (eventDef) {
  3343. return this.opt('eventResizableFromStart') && this.isEventDefResizable(eventDef);
  3344. };
  3345. // Computes if the given event is allowed to be resized from its ending edge
  3346. InteractiveDateComponent.prototype.isEventDefResizableFromEnd = function (eventDef) {
  3347. return this.isEventDefResizable(eventDef);
  3348. };
  3349. // Computes if the given event is allowed to be resized by the user at all
  3350. InteractiveDateComponent.prototype.isEventDefResizable = function (eventDef) {
  3351. var isResizable = eventDef.isDurationExplicitlyEditable();
  3352. if (isResizable == null) {
  3353. isResizable = this.opt('eventDurationEditable');
  3354. if (isResizable == null) {
  3355. isResizable = this.isEventDefGenerallyEditable(eventDef);
  3356. }
  3357. }
  3358. return isResizable;
  3359. };
  3360. // Event Mutation / Constraints
  3361. // ---------------------------------------------------------------------------------------------------------------
  3362. // Diffs the two dates, returning a duration, based on granularity of the grid
  3363. // TODO: port isTimeScale into this system?
  3364. InteractiveDateComponent.prototype.diffDates = function (a, b) {
  3365. if (this.largeUnit) {
  3366. return util_1.diffByUnit(a, b, this.largeUnit);
  3367. }
  3368. else {
  3369. return util_1.diffDayTime(a, b);
  3370. }
  3371. };
  3372. // is it allowed, in relation to the view's validRange?
  3373. // NOTE: very similar to isExternalInstanceGroupAllowed
  3374. InteractiveDateComponent.prototype.isEventInstanceGroupAllowed = function (eventInstanceGroup) {
  3375. var view = this._getView();
  3376. var dateProfile = this.dateProfile;
  3377. var eventFootprints = this.eventRangesToEventFootprints(eventInstanceGroup.getAllEventRanges());
  3378. var i;
  3379. for (i = 0; i < eventFootprints.length; i++) {
  3380. // TODO: just use getAllEventRanges directly
  3381. if (!dateProfile.validUnzonedRange.containsRange(eventFootprints[i].componentFootprint.unzonedRange)) {
  3382. return false;
  3383. }
  3384. }
  3385. return view.calendar.constraints.isEventInstanceGroupAllowed(eventInstanceGroup);
  3386. };
  3387. // NOTE: very similar to isEventInstanceGroupAllowed
  3388. // when it's a completely anonymous external drag, no event.
  3389. InteractiveDateComponent.prototype.isExternalInstanceGroupAllowed = function (eventInstanceGroup) {
  3390. var view = this._getView();
  3391. var dateProfile = this.dateProfile;
  3392. var eventFootprints = this.eventRangesToEventFootprints(eventInstanceGroup.getAllEventRanges());
  3393. var i;
  3394. for (i = 0; i < eventFootprints.length; i++) {
  3395. if (!dateProfile.validUnzonedRange.containsRange(eventFootprints[i].componentFootprint.unzonedRange)) {
  3396. return false;
  3397. }
  3398. }
  3399. for (i = 0; i < eventFootprints.length; i++) {
  3400. // treat it as a selection
  3401. // TODO: pass in eventInstanceGroup instead
  3402. // because we don't want calendar's constraint system to depend on a component's
  3403. // determination of footprints.
  3404. if (!view.calendar.constraints.isSelectionFootprintAllowed(eventFootprints[i].componentFootprint)) {
  3405. return false;
  3406. }
  3407. }
  3408. return true;
  3409. };
  3410. return InteractiveDateComponent;
  3411. }(DateComponent_1.default));
  3412. exports.default = InteractiveDateComponent;
  3413. /***/ }),
  3414. /* 41 */
  3415. /***/ (function(module, exports, __webpack_require__) {
  3416. Object.defineProperty(exports, "__esModule", { value: true });
  3417. var tslib_1 = __webpack_require__(2);
  3418. var $ = __webpack_require__(3);
  3419. var moment = __webpack_require__(0);
  3420. var util_1 = __webpack_require__(4);
  3421. var RenderQueue_1 = __webpack_require__(218);
  3422. var DateProfileGenerator_1 = __webpack_require__(221);
  3423. var InteractiveDateComponent_1 = __webpack_require__(40);
  3424. var GlobalEmitter_1 = __webpack_require__(21);
  3425. var UnzonedRange_1 = __webpack_require__(5);
  3426. /* An abstract class from which other views inherit from
  3427. ----------------------------------------------------------------------------------------------------------------------*/
  3428. var View = /** @class */ (function (_super) {
  3429. tslib_1.__extends(View, _super);
  3430. function View(calendar, viewSpec) {
  3431. var _this = _super.call(this, null, viewSpec.options) || this;
  3432. _this.batchRenderDepth = 0;
  3433. _this.isSelected = false; // boolean whether a range of time is user-selected or not
  3434. _this.calendar = calendar;
  3435. _this.viewSpec = viewSpec;
  3436. // shortcuts
  3437. _this.type = viewSpec.type;
  3438. // .name is deprecated
  3439. _this.name = _this.type;
  3440. _this.initRenderQueue();
  3441. _this.initHiddenDays();
  3442. _this.dateProfileGenerator = new _this.dateProfileGeneratorClass(_this);
  3443. _this.bindBaseRenderHandlers();
  3444. _this.eventOrderSpecs = util_1.parseFieldSpecs(_this.opt('eventOrder'));
  3445. // legacy
  3446. if (_this['initialize']) {
  3447. _this['initialize']();
  3448. }
  3449. return _this;
  3450. }
  3451. View.prototype._getView = function () {
  3452. return this;
  3453. };
  3454. // Retrieves an option with the given name
  3455. View.prototype.opt = function (name) {
  3456. return this.options[name];
  3457. };
  3458. /* Render Queue
  3459. ------------------------------------------------------------------------------------------------------------------*/
  3460. View.prototype.initRenderQueue = function () {
  3461. this.renderQueue = new RenderQueue_1.default({
  3462. event: this.opt('eventRenderWait')
  3463. });
  3464. this.renderQueue.on('start', this.onRenderQueueStart.bind(this));
  3465. this.renderQueue.on('stop', this.onRenderQueueStop.bind(this));
  3466. this.on('before:change', this.startBatchRender);
  3467. this.on('change', this.stopBatchRender);
  3468. };
  3469. View.prototype.onRenderQueueStart = function () {
  3470. this.calendar.freezeContentHeight();
  3471. this.addScroll(this.queryScroll());
  3472. };
  3473. View.prototype.onRenderQueueStop = function () {
  3474. if (this.calendar.updateViewSize()) {
  3475. this.popScroll();
  3476. }
  3477. this.calendar.thawContentHeight();
  3478. };
  3479. View.prototype.startBatchRender = function () {
  3480. if (!(this.batchRenderDepth++)) {
  3481. this.renderQueue.pause();
  3482. }
  3483. };
  3484. View.prototype.stopBatchRender = function () {
  3485. if (!(--this.batchRenderDepth)) {
  3486. this.renderQueue.resume();
  3487. }
  3488. };
  3489. View.prototype.requestRender = function (func, namespace, actionType) {
  3490. this.renderQueue.queue(func, namespace, actionType);
  3491. };
  3492. // given func will auto-bind to `this`
  3493. View.prototype.whenSizeUpdated = function (func) {
  3494. if (this.renderQueue.isRunning) {
  3495. this.renderQueue.one('stop', func.bind(this));
  3496. }
  3497. else {
  3498. func.call(this);
  3499. }
  3500. };
  3501. /* Title and Date Formatting
  3502. ------------------------------------------------------------------------------------------------------------------*/
  3503. // Computes what the title at the top of the calendar should be for this view
  3504. View.prototype.computeTitle = function (dateProfile) {
  3505. var unzonedRange;
  3506. // for views that span a large unit of time, show the proper interval, ignoring stray days before and after
  3507. if (/^(year|month)$/.test(dateProfile.currentRangeUnit)) {
  3508. unzonedRange = dateProfile.currentUnzonedRange;
  3509. }
  3510. else {
  3511. unzonedRange = dateProfile.activeUnzonedRange;
  3512. }
  3513. return this.formatRange({
  3514. start: this.calendar.msToMoment(unzonedRange.startMs, dateProfile.isRangeAllDay),
  3515. end: this.calendar.msToMoment(unzonedRange.endMs, dateProfile.isRangeAllDay)
  3516. }, dateProfile.isRangeAllDay, this.opt('titleFormat') || this.computeTitleFormat(dateProfile), this.opt('titleRangeSeparator'));
  3517. };
  3518. // Generates the format string that should be used to generate the title for the current date range.
  3519. // Attempts to compute the most appropriate format if not explicitly specified with `titleFormat`.
  3520. View.prototype.computeTitleFormat = function (dateProfile) {
  3521. var currentRangeUnit = dateProfile.currentRangeUnit;
  3522. if (currentRangeUnit === 'year') {
  3523. return 'YYYY';
  3524. }
  3525. else if (currentRangeUnit === 'month') {
  3526. return this.opt('monthYearFormat'); // like "September 2014"
  3527. }
  3528. else if (dateProfile.currentUnzonedRange.as('days') > 1) {
  3529. return 'll'; // multi-day range. shorter, like "Sep 9 - 10 2014"
  3530. }
  3531. else {
  3532. return 'LL'; // one day. longer, like "September 9 2014"
  3533. }
  3534. };
  3535. // Date Setting/Unsetting
  3536. // -----------------------------------------------------------------------------------------------------------------
  3537. View.prototype.setDate = function (date) {
  3538. var currentDateProfile = this.get('dateProfile');
  3539. var newDateProfile = this.dateProfileGenerator.build(date, undefined, true); // forceToValid=true
  3540. if (!currentDateProfile ||
  3541. !currentDateProfile.activeUnzonedRange.equals(newDateProfile.activeUnzonedRange)) {
  3542. this.set('dateProfile', newDateProfile);
  3543. }
  3544. };
  3545. View.prototype.unsetDate = function () {
  3546. this.unset('dateProfile');
  3547. };
  3548. // Event Data
  3549. // -----------------------------------------------------------------------------------------------------------------
  3550. View.prototype.fetchInitialEvents = function (dateProfile) {
  3551. var calendar = this.calendar;
  3552. var forceAllDay = dateProfile.isRangeAllDay && !this.usesMinMaxTime;
  3553. return calendar.requestEvents(calendar.msToMoment(dateProfile.activeUnzonedRange.startMs, forceAllDay), calendar.msToMoment(dateProfile.activeUnzonedRange.endMs, forceAllDay));
  3554. };
  3555. View.prototype.bindEventChanges = function () {
  3556. this.listenTo(this.calendar, 'eventsReset', this.resetEvents); // TODO: make this a real event
  3557. };
  3558. View.prototype.unbindEventChanges = function () {
  3559. this.stopListeningTo(this.calendar, 'eventsReset');
  3560. };
  3561. View.prototype.setEvents = function (eventsPayload) {
  3562. this.set('currentEvents', eventsPayload);
  3563. this.set('hasEvents', true);
  3564. };
  3565. View.prototype.unsetEvents = function () {
  3566. this.unset('currentEvents');
  3567. this.unset('hasEvents');
  3568. };
  3569. View.prototype.resetEvents = function (eventsPayload) {
  3570. this.startBatchRender();
  3571. this.unsetEvents();
  3572. this.setEvents(eventsPayload);
  3573. this.stopBatchRender();
  3574. };
  3575. // Date High-level Rendering
  3576. // -----------------------------------------------------------------------------------------------------------------
  3577. View.prototype.requestDateRender = function (dateProfile) {
  3578. var _this = this;
  3579. this.requestRender(function () {
  3580. _this.executeDateRender(dateProfile);
  3581. }, 'date', 'init');
  3582. };
  3583. View.prototype.requestDateUnrender = function () {
  3584. var _this = this;
  3585. this.requestRender(function () {
  3586. _this.executeDateUnrender();
  3587. }, 'date', 'destroy');
  3588. };
  3589. // if dateProfile not specified, uses current
  3590. View.prototype.executeDateRender = function (dateProfile) {
  3591. _super.prototype.executeDateRender.call(this, dateProfile);
  3592. if (this['render']) {
  3593. this['render'](); // TODO: deprecate
  3594. }
  3595. this.trigger('datesRendered');
  3596. this.addScroll({ isDateInit: true });
  3597. this.startNowIndicator(); // shouldn't render yet because updateSize will be called soon
  3598. };
  3599. View.prototype.executeDateUnrender = function () {
  3600. this.unselect();
  3601. this.stopNowIndicator();
  3602. this.trigger('before:datesUnrendered');
  3603. if (this['destroy']) {
  3604. this['destroy'](); // TODO: deprecate
  3605. }
  3606. _super.prototype.executeDateUnrender.call(this);
  3607. };
  3608. // "Base" rendering
  3609. // -----------------------------------------------------------------------------------------------------------------
  3610. View.prototype.bindBaseRenderHandlers = function () {
  3611. var _this = this;
  3612. this.on('datesRendered', function () {
  3613. _this.whenSizeUpdated(_this.triggerViewRender);
  3614. });
  3615. this.on('before:datesUnrendered', function () {
  3616. _this.triggerViewDestroy();
  3617. });
  3618. };
  3619. View.prototype.triggerViewRender = function () {
  3620. this.publiclyTrigger('viewRender', {
  3621. context: this,
  3622. args: [this, this.el]
  3623. });
  3624. };
  3625. View.prototype.triggerViewDestroy = function () {
  3626. this.publiclyTrigger('viewDestroy', {
  3627. context: this,
  3628. args: [this, this.el]
  3629. });
  3630. };
  3631. // Event High-level Rendering
  3632. // -----------------------------------------------------------------------------------------------------------------
  3633. View.prototype.requestEventsRender = function (eventsPayload) {
  3634. var _this = this;
  3635. this.requestRender(function () {
  3636. _this.executeEventRender(eventsPayload);
  3637. _this.whenSizeUpdated(_this.triggerAfterEventsRendered);
  3638. }, 'event', 'init');
  3639. };
  3640. View.prototype.requestEventsUnrender = function () {
  3641. var _this = this;
  3642. this.requestRender(function () {
  3643. _this.triggerBeforeEventsDestroyed();
  3644. _this.executeEventUnrender();
  3645. }, 'event', 'destroy');
  3646. };
  3647. // Business Hour High-level Rendering
  3648. // -----------------------------------------------------------------------------------------------------------------
  3649. View.prototype.requestBusinessHoursRender = function (businessHourGenerator) {
  3650. var _this = this;
  3651. this.requestRender(function () {
  3652. _this.renderBusinessHours(businessHourGenerator);
  3653. }, 'businessHours', 'init');
  3654. };
  3655. View.prototype.requestBusinessHoursUnrender = function () {
  3656. var _this = this;
  3657. this.requestRender(function () {
  3658. _this.unrenderBusinessHours();
  3659. }, 'businessHours', 'destroy');
  3660. };
  3661. // Misc view rendering utils
  3662. // -----------------------------------------------------------------------------------------------------------------
  3663. // Binds DOM handlers to elements that reside outside the view container, such as the document
  3664. View.prototype.bindGlobalHandlers = function () {
  3665. _super.prototype.bindGlobalHandlers.call(this);
  3666. this.listenTo(GlobalEmitter_1.default.get(), {
  3667. touchstart: this.processUnselect,
  3668. mousedown: this.handleDocumentMousedown
  3669. });
  3670. };
  3671. // Unbinds DOM handlers from elements that reside outside the view container
  3672. View.prototype.unbindGlobalHandlers = function () {
  3673. _super.prototype.unbindGlobalHandlers.call(this);
  3674. this.stopListeningTo(GlobalEmitter_1.default.get());
  3675. };
  3676. /* Now Indicator
  3677. ------------------------------------------------------------------------------------------------------------------*/
  3678. // Immediately render the current time indicator and begins re-rendering it at an interval,
  3679. // which is defined by this.getNowIndicatorUnit().
  3680. // TODO: somehow do this for the current whole day's background too
  3681. View.prototype.startNowIndicator = function () {
  3682. var _this = this;
  3683. var unit;
  3684. var update;
  3685. var delay; // ms wait value
  3686. if (this.opt('nowIndicator')) {
  3687. unit = this.getNowIndicatorUnit();
  3688. if (unit) {
  3689. update = util_1.proxy(this, 'updateNowIndicator'); // bind to `this`
  3690. this.initialNowDate = this.calendar.getNow();
  3691. this.initialNowQueriedMs = new Date().valueOf();
  3692. // wait until the beginning of the next interval
  3693. delay = this.initialNowDate.clone().startOf(unit).add(1, unit).valueOf() - this.initialNowDate.valueOf();
  3694. this.nowIndicatorTimeoutID = setTimeout(function () {
  3695. _this.nowIndicatorTimeoutID = null;
  3696. update();
  3697. delay = +moment.duration(1, unit);
  3698. delay = Math.max(100, delay); // prevent too frequent
  3699. _this.nowIndicatorIntervalID = setInterval(update, delay); // update every interval
  3700. }, delay);
  3701. }
  3702. // rendering will be initiated in updateSize
  3703. }
  3704. };
  3705. // rerenders the now indicator, computing the new current time from the amount of time that has passed
  3706. // since the initial getNow call.
  3707. View.prototype.updateNowIndicator = function () {
  3708. if (this.isDatesRendered &&
  3709. this.initialNowDate // activated before?
  3710. ) {
  3711. this.unrenderNowIndicator(); // won't unrender if unnecessary
  3712. this.renderNowIndicator(this.initialNowDate.clone().add(new Date().valueOf() - this.initialNowQueriedMs) // add ms
  3713. );
  3714. this.isNowIndicatorRendered = true;
  3715. }
  3716. };
  3717. // Immediately unrenders the view's current time indicator and stops any re-rendering timers.
  3718. // Won't cause side effects if indicator isn't rendered.
  3719. View.prototype.stopNowIndicator = function () {
  3720. if (this.isNowIndicatorRendered) {
  3721. if (this.nowIndicatorTimeoutID) {
  3722. clearTimeout(this.nowIndicatorTimeoutID);
  3723. this.nowIndicatorTimeoutID = null;
  3724. }
  3725. if (this.nowIndicatorIntervalID) {
  3726. clearInterval(this.nowIndicatorIntervalID);
  3727. this.nowIndicatorIntervalID = null;
  3728. }
  3729. this.unrenderNowIndicator();
  3730. this.isNowIndicatorRendered = false;
  3731. }
  3732. };
  3733. /* Dimensions
  3734. ------------------------------------------------------------------------------------------------------------------*/
  3735. View.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  3736. if (this['setHeight']) {
  3737. this['setHeight'](totalHeight, isAuto);
  3738. }
  3739. else {
  3740. _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
  3741. }
  3742. this.updateNowIndicator();
  3743. };
  3744. /* Scroller
  3745. ------------------------------------------------------------------------------------------------------------------*/
  3746. View.prototype.addScroll = function (scroll) {
  3747. var queuedScroll = this.queuedScroll || (this.queuedScroll = {});
  3748. $.extend(queuedScroll, scroll);
  3749. };
  3750. View.prototype.popScroll = function () {
  3751. this.applyQueuedScroll();
  3752. this.queuedScroll = null;
  3753. };
  3754. View.prototype.applyQueuedScroll = function () {
  3755. if (this.queuedScroll) {
  3756. this.applyScroll(this.queuedScroll);
  3757. }
  3758. };
  3759. View.prototype.queryScroll = function () {
  3760. var scroll = {};
  3761. if (this.isDatesRendered) {
  3762. $.extend(scroll, this.queryDateScroll());
  3763. }
  3764. return scroll;
  3765. };
  3766. View.prototype.applyScroll = function (scroll) {
  3767. if (scroll.isDateInit && this.isDatesRendered) {
  3768. $.extend(scroll, this.computeInitialDateScroll());
  3769. }
  3770. if (this.isDatesRendered) {
  3771. this.applyDateScroll(scroll);
  3772. }
  3773. };
  3774. View.prototype.computeInitialDateScroll = function () {
  3775. return {}; // subclasses must implement
  3776. };
  3777. View.prototype.queryDateScroll = function () {
  3778. return {}; // subclasses must implement
  3779. };
  3780. View.prototype.applyDateScroll = function (scroll) {
  3781. // subclasses must implement
  3782. };
  3783. /* Event Drag-n-Drop
  3784. ------------------------------------------------------------------------------------------------------------------*/
  3785. View.prototype.reportEventDrop = function (eventInstance, eventMutation, el, ev) {
  3786. var eventManager = this.calendar.eventManager;
  3787. var undoFunc = eventManager.mutateEventsWithId(eventInstance.def.id, eventMutation);
  3788. var dateMutation = eventMutation.dateMutation;
  3789. // update the EventInstance, for handlers
  3790. if (dateMutation) {
  3791. eventInstance.dateProfile = dateMutation.buildNewDateProfile(eventInstance.dateProfile, this.calendar);
  3792. }
  3793. this.triggerEventDrop(eventInstance,
  3794. // a drop doesn't necessarily mean a date mutation (ex: resource change)
  3795. (dateMutation && dateMutation.dateDelta) || moment.duration(), undoFunc, el, ev);
  3796. };
  3797. // Triggers event-drop handlers that have subscribed via the API
  3798. View.prototype.triggerEventDrop = function (eventInstance, dateDelta, undoFunc, el, ev) {
  3799. this.publiclyTrigger('eventDrop', {
  3800. context: el[0],
  3801. args: [
  3802. eventInstance.toLegacy(),
  3803. dateDelta,
  3804. undoFunc,
  3805. ev,
  3806. {},
  3807. this
  3808. ]
  3809. });
  3810. };
  3811. /* External Element Drag-n-Drop
  3812. ------------------------------------------------------------------------------------------------------------------*/
  3813. // Must be called when an external element, via jQuery UI, has been dropped onto the calendar.
  3814. // `meta` is the parsed data that has been embedded into the dragging event.
  3815. // `dropLocation` is an object that contains the new zoned start/end/allDay values for the event.
  3816. View.prototype.reportExternalDrop = function (singleEventDef, isEvent, isSticky, el, ev, ui) {
  3817. if (isEvent) {
  3818. this.calendar.eventManager.addEventDef(singleEventDef, isSticky);
  3819. }
  3820. this.triggerExternalDrop(singleEventDef, isEvent, el, ev, ui);
  3821. };
  3822. // Triggers external-drop handlers that have subscribed via the API
  3823. View.prototype.triggerExternalDrop = function (singleEventDef, isEvent, el, ev, ui) {
  3824. // trigger 'drop' regardless of whether element represents an event
  3825. this.publiclyTrigger('drop', {
  3826. context: el[0],
  3827. args: [
  3828. singleEventDef.dateProfile.start.clone(),
  3829. ev,
  3830. ui,
  3831. this
  3832. ]
  3833. });
  3834. if (isEvent) {
  3835. // signal an external event landed
  3836. this.publiclyTrigger('eventReceive', {
  3837. context: this,
  3838. args: [
  3839. singleEventDef.buildInstance().toLegacy(),
  3840. this
  3841. ]
  3842. });
  3843. }
  3844. };
  3845. /* Event Resizing
  3846. ------------------------------------------------------------------------------------------------------------------*/
  3847. // Must be called when an event in the view has been resized to a new length
  3848. View.prototype.reportEventResize = function (eventInstance, eventMutation, el, ev) {
  3849. var eventManager = this.calendar.eventManager;
  3850. var undoFunc = eventManager.mutateEventsWithId(eventInstance.def.id, eventMutation);
  3851. // update the EventInstance, for handlers
  3852. eventInstance.dateProfile = eventMutation.dateMutation.buildNewDateProfile(eventInstance.dateProfile, this.calendar);
  3853. this.triggerEventResize(eventInstance, eventMutation.dateMutation.endDelta, undoFunc, el, ev);
  3854. };
  3855. // Triggers event-resize handlers that have subscribed via the API
  3856. View.prototype.triggerEventResize = function (eventInstance, durationDelta, undoFunc, el, ev) {
  3857. this.publiclyTrigger('eventResize', {
  3858. context: el[0],
  3859. args: [
  3860. eventInstance.toLegacy(),
  3861. durationDelta,
  3862. undoFunc,
  3863. ev,
  3864. {},
  3865. this
  3866. ]
  3867. });
  3868. };
  3869. /* Selection (time range)
  3870. ------------------------------------------------------------------------------------------------------------------*/
  3871. // Selects a date span on the view. `start` and `end` are both Moments.
  3872. // `ev` is the native mouse event that begin the interaction.
  3873. View.prototype.select = function (footprint, ev) {
  3874. this.unselect(ev);
  3875. this.renderSelectionFootprint(footprint);
  3876. this.reportSelection(footprint, ev);
  3877. };
  3878. View.prototype.renderSelectionFootprint = function (footprint) {
  3879. if (this['renderSelection']) {
  3880. this['renderSelection'](footprint.toLegacy(this.calendar));
  3881. }
  3882. else {
  3883. _super.prototype.renderSelectionFootprint.call(this, footprint);
  3884. }
  3885. };
  3886. // Called when a new selection is made. Updates internal state and triggers handlers.
  3887. View.prototype.reportSelection = function (footprint, ev) {
  3888. this.isSelected = true;
  3889. this.triggerSelect(footprint, ev);
  3890. };
  3891. // Triggers handlers to 'select'
  3892. View.prototype.triggerSelect = function (footprint, ev) {
  3893. var dateProfile = this.calendar.footprintToDateProfile(footprint); // abuse of "Event"DateProfile?
  3894. this.publiclyTrigger('select', {
  3895. context: this,
  3896. args: [
  3897. dateProfile.start,
  3898. dateProfile.end,
  3899. ev,
  3900. this
  3901. ]
  3902. });
  3903. };
  3904. // Undoes a selection. updates in the internal state and triggers handlers.
  3905. // `ev` is the native mouse event that began the interaction.
  3906. View.prototype.unselect = function (ev) {
  3907. if (this.isSelected) {
  3908. this.isSelected = false;
  3909. if (this['destroySelection']) {
  3910. this['destroySelection'](); // TODO: deprecate
  3911. }
  3912. this.unrenderSelection();
  3913. this.publiclyTrigger('unselect', {
  3914. context: this,
  3915. args: [ev, this]
  3916. });
  3917. }
  3918. };
  3919. /* Event Selection
  3920. ------------------------------------------------------------------------------------------------------------------*/
  3921. View.prototype.selectEventInstance = function (eventInstance) {
  3922. if (!this.selectedEventInstance ||
  3923. this.selectedEventInstance !== eventInstance) {
  3924. this.unselectEventInstance();
  3925. this.getEventSegs().forEach(function (seg) {
  3926. if (seg.footprint.eventInstance === eventInstance &&
  3927. seg.el // necessary?
  3928. ) {
  3929. seg.el.addClass('fc-selected');
  3930. }
  3931. });
  3932. this.selectedEventInstance = eventInstance;
  3933. }
  3934. };
  3935. View.prototype.unselectEventInstance = function () {
  3936. if (this.selectedEventInstance) {
  3937. this.getEventSegs().forEach(function (seg) {
  3938. if (seg.el) {
  3939. seg.el.removeClass('fc-selected');
  3940. }
  3941. });
  3942. this.selectedEventInstance = null;
  3943. }
  3944. };
  3945. View.prototype.isEventDefSelected = function (eventDef) {
  3946. // event references might change on refetchEvents(), while selectedEventInstance doesn't,
  3947. // so compare IDs
  3948. return this.selectedEventInstance && this.selectedEventInstance.def.id === eventDef.id;
  3949. };
  3950. /* Mouse / Touch Unselecting (time range & event unselection)
  3951. ------------------------------------------------------------------------------------------------------------------*/
  3952. // TODO: move consistently to down/start or up/end?
  3953. // TODO: don't kill previous selection if touch scrolling
  3954. View.prototype.handleDocumentMousedown = function (ev) {
  3955. if (util_1.isPrimaryMouseButton(ev)) {
  3956. this.processUnselect(ev);
  3957. }
  3958. };
  3959. View.prototype.processUnselect = function (ev) {
  3960. this.processRangeUnselect(ev);
  3961. this.processEventUnselect(ev);
  3962. };
  3963. View.prototype.processRangeUnselect = function (ev) {
  3964. var ignore;
  3965. // is there a time-range selection?
  3966. if (this.isSelected && this.opt('unselectAuto')) {
  3967. // only unselect if the clicked element is not identical to or inside of an 'unselectCancel' element
  3968. ignore = this.opt('unselectCancel');
  3969. if (!ignore || !$(ev.target).closest(ignore).length) {
  3970. this.unselect(ev);
  3971. }
  3972. }
  3973. };
  3974. View.prototype.processEventUnselect = function (ev) {
  3975. if (this.selectedEventInstance) {
  3976. if (!$(ev.target).closest('.fc-selected').length) {
  3977. this.unselectEventInstance();
  3978. }
  3979. }
  3980. };
  3981. /* Triggers
  3982. ------------------------------------------------------------------------------------------------------------------*/
  3983. View.prototype.triggerBaseRendered = function () {
  3984. this.publiclyTrigger('viewRender', {
  3985. context: this,
  3986. args: [this, this.el]
  3987. });
  3988. };
  3989. View.prototype.triggerBaseUnrendered = function () {
  3990. this.publiclyTrigger('viewDestroy', {
  3991. context: this,
  3992. args: [this, this.el]
  3993. });
  3994. };
  3995. // Triggers handlers to 'dayClick'
  3996. // Span has start/end of the clicked area. Only the start is useful.
  3997. View.prototype.triggerDayClick = function (footprint, dayEl, ev) {
  3998. var dateProfile = this.calendar.footprintToDateProfile(footprint); // abuse of "Event"DateProfile?
  3999. this.publiclyTrigger('dayClick', {
  4000. context: dayEl,
  4001. args: [dateProfile.start, ev, this]
  4002. });
  4003. };
  4004. /* Date Utils
  4005. ------------------------------------------------------------------------------------------------------------------*/
  4006. // For DateComponent::getDayClasses
  4007. View.prototype.isDateInOtherMonth = function (date, dateProfile) {
  4008. return false;
  4009. };
  4010. // Arguments after name will be forwarded to a hypothetical function value
  4011. // WARNING: passed-in arguments will be given to generator functions as-is and can cause side-effects.
  4012. // Always clone your objects if you fear mutation.
  4013. View.prototype.getUnzonedRangeOption = function (name) {
  4014. var val = this.opt(name);
  4015. if (typeof val === 'function') {
  4016. val = val.apply(null, Array.prototype.slice.call(arguments, 1));
  4017. }
  4018. if (val) {
  4019. return this.calendar.parseUnzonedRange(val);
  4020. }
  4021. };
  4022. /* Hidden Days
  4023. ------------------------------------------------------------------------------------------------------------------*/
  4024. // Initializes internal variables related to calculating hidden days-of-week
  4025. View.prototype.initHiddenDays = function () {
  4026. var hiddenDays = this.opt('hiddenDays') || []; // array of day-of-week indices that are hidden
  4027. var isHiddenDayHash = []; // is the day-of-week hidden? (hash with day-of-week-index -> bool)
  4028. var dayCnt = 0;
  4029. var i;
  4030. if (this.opt('weekends') === false) {
  4031. hiddenDays.push(0, 6); // 0=sunday, 6=saturday
  4032. }
  4033. for (i = 0; i < 7; i++) {
  4034. if (!(isHiddenDayHash[i] = $.inArray(i, hiddenDays) !== -1)) {
  4035. dayCnt++;
  4036. }
  4037. }
  4038. if (!dayCnt) {
  4039. throw new Error('invalid hiddenDays'); // all days were hidden? bad.
  4040. }
  4041. this.isHiddenDayHash = isHiddenDayHash;
  4042. };
  4043. // Remove days from the beginning and end of the range that are computed as hidden.
  4044. // If the whole range is trimmed off, returns null
  4045. View.prototype.trimHiddenDays = function (inputUnzonedRange) {
  4046. var start = inputUnzonedRange.getStart();
  4047. var end = inputUnzonedRange.getEnd();
  4048. if (start) {
  4049. start = this.skipHiddenDays(start);
  4050. }
  4051. if (end) {
  4052. end = this.skipHiddenDays(end, -1, true);
  4053. }
  4054. if (start === null || end === null || start < end) {
  4055. return new UnzonedRange_1.default(start, end);
  4056. }
  4057. return null;
  4058. };
  4059. // Is the current day hidden?
  4060. // `day` is a day-of-week index (0-6), or a Moment
  4061. View.prototype.isHiddenDay = function (day) {
  4062. if (moment.isMoment(day)) {
  4063. day = day.day();
  4064. }
  4065. return this.isHiddenDayHash[day];
  4066. };
  4067. // Incrementing the current day until it is no longer a hidden day, returning a copy.
  4068. // DOES NOT CONSIDER validUnzonedRange!
  4069. // If the initial value of `date` is not a hidden day, don't do anything.
  4070. // Pass `isExclusive` as `true` if you are dealing with an end date.
  4071. // `inc` defaults to `1` (increment one day forward each time)
  4072. View.prototype.skipHiddenDays = function (date, inc, isExclusive) {
  4073. if (inc === void 0) { inc = 1; }
  4074. if (isExclusive === void 0) { isExclusive = false; }
  4075. var out = date.clone();
  4076. while (this.isHiddenDayHash[(out.day() + (isExclusive ? inc : 0) + 7) % 7]) {
  4077. out.add(inc, 'days');
  4078. }
  4079. return out;
  4080. };
  4081. return View;
  4082. }(InteractiveDateComponent_1.default));
  4083. exports.default = View;
  4084. View.prototype.usesMinMaxTime = false;
  4085. View.prototype.dateProfileGeneratorClass = DateProfileGenerator_1.default;
  4086. View.watch('displayingDates', ['isInDom', 'dateProfile'], function (deps) {
  4087. this.requestDateRender(deps.dateProfile);
  4088. }, function () {
  4089. this.requestDateUnrender();
  4090. });
  4091. View.watch('displayingBusinessHours', ['displayingDates', 'businessHourGenerator'], function (deps) {
  4092. this.requestBusinessHoursRender(deps.businessHourGenerator);
  4093. }, function () {
  4094. this.requestBusinessHoursUnrender();
  4095. });
  4096. View.watch('initialEvents', ['dateProfile'], function (deps) {
  4097. return this.fetchInitialEvents(deps.dateProfile);
  4098. });
  4099. View.watch('bindingEvents', ['initialEvents'], function (deps) {
  4100. this.setEvents(deps.initialEvents);
  4101. this.bindEventChanges();
  4102. }, function () {
  4103. this.unbindEventChanges();
  4104. this.unsetEvents();
  4105. });
  4106. View.watch('displayingEvents', ['displayingDates', 'hasEvents'], function () {
  4107. this.requestEventsRender(this.get('currentEvents'));
  4108. }, function () {
  4109. this.requestEventsUnrender();
  4110. });
  4111. View.watch('title', ['dateProfile'], function (deps) {
  4112. return (this.title = this.computeTitle(deps.dateProfile)); // assign to View for legacy reasons
  4113. });
  4114. View.watch('legacyDateProps', ['dateProfile'], function (deps) {
  4115. var calendar = this.calendar;
  4116. var dateProfile = deps.dateProfile;
  4117. // DEPRECATED, but we need to keep it updated...
  4118. this.start = calendar.msToMoment(dateProfile.activeUnzonedRange.startMs, dateProfile.isRangeAllDay);
  4119. this.end = calendar.msToMoment(dateProfile.activeUnzonedRange.endMs, dateProfile.isRangeAllDay);
  4120. this.intervalStart = calendar.msToMoment(dateProfile.currentUnzonedRange.startMs, dateProfile.isRangeAllDay);
  4121. this.intervalEnd = calendar.msToMoment(dateProfile.currentUnzonedRange.endMs, dateProfile.isRangeAllDay);
  4122. });
  4123. /***/ }),
  4124. /* 42 */
  4125. /***/ (function(module, exports, __webpack_require__) {
  4126. Object.defineProperty(exports, "__esModule", { value: true });
  4127. var $ = __webpack_require__(3);
  4128. var util_1 = __webpack_require__(4);
  4129. var EventRenderer = /** @class */ (function () {
  4130. function EventRenderer(component, fillRenderer) {
  4131. this.view = component._getView();
  4132. this.component = component;
  4133. this.fillRenderer = fillRenderer;
  4134. }
  4135. EventRenderer.prototype.opt = function (name) {
  4136. return this.view.opt(name);
  4137. };
  4138. // Updates values that rely on options and also relate to range
  4139. EventRenderer.prototype.rangeUpdated = function () {
  4140. var displayEventTime;
  4141. var displayEventEnd;
  4142. this.eventTimeFormat =
  4143. this.opt('eventTimeFormat') ||
  4144. this.opt('timeFormat') || // deprecated
  4145. this.computeEventTimeFormat();
  4146. displayEventTime = this.opt('displayEventTime');
  4147. if (displayEventTime == null) {
  4148. displayEventTime = this.computeDisplayEventTime(); // might be based off of range
  4149. }
  4150. displayEventEnd = this.opt('displayEventEnd');
  4151. if (displayEventEnd == null) {
  4152. displayEventEnd = this.computeDisplayEventEnd(); // might be based off of range
  4153. }
  4154. this.displayEventTime = displayEventTime;
  4155. this.displayEventEnd = displayEventEnd;
  4156. };
  4157. EventRenderer.prototype.render = function (eventsPayload) {
  4158. var dateProfile = this.component._getDateProfile();
  4159. var eventDefId;
  4160. var instanceGroup;
  4161. var eventRanges;
  4162. var bgRanges = [];
  4163. var fgRanges = [];
  4164. for (eventDefId in eventsPayload) {
  4165. instanceGroup = eventsPayload[eventDefId];
  4166. eventRanges = instanceGroup.sliceRenderRanges(dateProfile.activeUnzonedRange);
  4167. if (instanceGroup.getEventDef().hasBgRendering()) {
  4168. bgRanges.push.apply(bgRanges, eventRanges);
  4169. }
  4170. else {
  4171. fgRanges.push.apply(fgRanges, eventRanges);
  4172. }
  4173. }
  4174. this.renderBgRanges(bgRanges);
  4175. this.renderFgRanges(fgRanges);
  4176. };
  4177. EventRenderer.prototype.unrender = function () {
  4178. this.unrenderBgRanges();
  4179. this.unrenderFgRanges();
  4180. };
  4181. EventRenderer.prototype.renderFgRanges = function (eventRanges) {
  4182. var eventFootprints = this.component.eventRangesToEventFootprints(eventRanges);
  4183. var segs = this.component.eventFootprintsToSegs(eventFootprints);
  4184. // render an `.el` on each seg
  4185. // returns a subset of the segs. segs that were actually rendered
  4186. segs = this.renderFgSegEls(segs);
  4187. if (this.renderFgSegs(segs) !== false) {
  4188. this.fgSegs = segs;
  4189. }
  4190. };
  4191. EventRenderer.prototype.unrenderFgRanges = function () {
  4192. this.unrenderFgSegs(this.fgSegs || []);
  4193. this.fgSegs = null;
  4194. };
  4195. EventRenderer.prototype.renderBgRanges = function (eventRanges) {
  4196. var eventFootprints = this.component.eventRangesToEventFootprints(eventRanges);
  4197. var segs = this.component.eventFootprintsToSegs(eventFootprints);
  4198. if (this.renderBgSegs(segs) !== false) {
  4199. this.bgSegs = segs;
  4200. }
  4201. };
  4202. EventRenderer.prototype.unrenderBgRanges = function () {
  4203. this.unrenderBgSegs();
  4204. this.bgSegs = null;
  4205. };
  4206. EventRenderer.prototype.getSegs = function () {
  4207. return (this.bgSegs || []).concat(this.fgSegs || []);
  4208. };
  4209. // Renders foreground event segments onto the grid
  4210. EventRenderer.prototype.renderFgSegs = function (segs) {
  4211. // subclasses must implement
  4212. // segs already has rendered els, and has been filtered.
  4213. return false; // signal failure if not implemented
  4214. };
  4215. // Unrenders all currently rendered foreground segments
  4216. EventRenderer.prototype.unrenderFgSegs = function (segs) {
  4217. // subclasses must implement
  4218. };
  4219. EventRenderer.prototype.renderBgSegs = function (segs) {
  4220. var _this = this;
  4221. if (this.fillRenderer) {
  4222. this.fillRenderer.renderSegs('bgEvent', segs, {
  4223. getClasses: function (seg) {
  4224. return _this.getBgClasses(seg.footprint.eventDef);
  4225. },
  4226. getCss: function (seg) {
  4227. return {
  4228. 'background-color': _this.getBgColor(seg.footprint.eventDef)
  4229. };
  4230. },
  4231. filterEl: function (seg, el) {
  4232. return _this.filterEventRenderEl(seg.footprint, el);
  4233. }
  4234. });
  4235. }
  4236. else {
  4237. return false; // signal failure if no fillRenderer
  4238. }
  4239. };
  4240. EventRenderer.prototype.unrenderBgSegs = function () {
  4241. if (this.fillRenderer) {
  4242. this.fillRenderer.unrender('bgEvent');
  4243. }
  4244. };
  4245. // Renders and assigns an `el` property for each foreground event segment.
  4246. // Only returns segments that successfully rendered.
  4247. EventRenderer.prototype.renderFgSegEls = function (segs, disableResizing) {
  4248. var _this = this;
  4249. if (disableResizing === void 0) { disableResizing = false; }
  4250. var hasEventRenderHandlers = this.view.hasPublicHandlers('eventRender');
  4251. var html = '';
  4252. var renderedSegs = [];
  4253. var i;
  4254. if (segs.length) {
  4255. // build a large concatenation of event segment HTML
  4256. for (i = 0; i < segs.length; i++) {
  4257. this.beforeFgSegHtml(segs[i]);
  4258. html += this.fgSegHtml(segs[i], disableResizing);
  4259. }
  4260. // Grab individual elements from the combined HTML string. Use each as the default rendering.
  4261. // Then, compute the 'el' for each segment. An el might be null if the eventRender callback returned false.
  4262. $(html).each(function (i, node) {
  4263. var seg = segs[i];
  4264. var el = $(node);
  4265. if (hasEventRenderHandlers) {
  4266. el = _this.filterEventRenderEl(seg.footprint, el);
  4267. }
  4268. if (el) {
  4269. el.data('fc-seg', seg); // used by handlers
  4270. seg.el = el;
  4271. renderedSegs.push(seg);
  4272. }
  4273. });
  4274. }
  4275. return renderedSegs;
  4276. };
  4277. EventRenderer.prototype.beforeFgSegHtml = function (seg) {
  4278. };
  4279. // Generates the HTML for the default rendering of a foreground event segment. Used by renderFgSegEls()
  4280. EventRenderer.prototype.fgSegHtml = function (seg, disableResizing) {
  4281. // subclasses should implement
  4282. };
  4283. // Generic utility for generating the HTML classNames for an event segment's element
  4284. EventRenderer.prototype.getSegClasses = function (seg, isDraggable, isResizable) {
  4285. var classes = [
  4286. 'fc-event',
  4287. seg.isStart ? 'fc-start' : 'fc-not-start',
  4288. seg.isEnd ? 'fc-end' : 'fc-not-end'
  4289. ].concat(this.getClasses(seg.footprint.eventDef));
  4290. if (isDraggable) {
  4291. classes.push('fc-draggable');
  4292. }
  4293. if (isResizable) {
  4294. classes.push('fc-resizable');
  4295. }
  4296. // event is currently selected? attach a className.
  4297. if (this.view.isEventDefSelected(seg.footprint.eventDef)) {
  4298. classes.push('fc-selected');
  4299. }
  4300. return classes;
  4301. };
  4302. // Given an event and the default element used for rendering, returns the element that should actually be used.
  4303. // Basically runs events and elements through the eventRender hook.
  4304. EventRenderer.prototype.filterEventRenderEl = function (eventFootprint, el) {
  4305. var legacy = eventFootprint.getEventLegacy();
  4306. var custom = this.view.publiclyTrigger('eventRender', {
  4307. context: legacy,
  4308. args: [legacy, el, this.view]
  4309. });
  4310. if (custom === false) {
  4311. el = null;
  4312. }
  4313. else if (custom && custom !== true) {
  4314. el = $(custom);
  4315. }
  4316. return el;
  4317. };
  4318. // Compute the text that should be displayed on an event's element.
  4319. // `range` can be the Event object itself, or something range-like, with at least a `start`.
  4320. // If event times are disabled, or the event has no time, will return a blank string.
  4321. // If not specified, formatStr will default to the eventTimeFormat setting,
  4322. // and displayEnd will default to the displayEventEnd setting.
  4323. EventRenderer.prototype.getTimeText = function (eventFootprint, formatStr, displayEnd) {
  4324. return this._getTimeText(eventFootprint.eventInstance.dateProfile.start, eventFootprint.eventInstance.dateProfile.end, eventFootprint.componentFootprint.isAllDay, formatStr, displayEnd);
  4325. };
  4326. EventRenderer.prototype._getTimeText = function (start, end, isAllDay, formatStr, displayEnd) {
  4327. if (formatStr == null) {
  4328. formatStr = this.eventTimeFormat;
  4329. }
  4330. if (displayEnd == null) {
  4331. displayEnd = this.displayEventEnd;
  4332. }
  4333. if (this.displayEventTime && !isAllDay) {
  4334. if (displayEnd && end) {
  4335. return this.view.formatRange({ start: start, end: end }, false, // allDay
  4336. formatStr);
  4337. }
  4338. else {
  4339. return start.format(formatStr);
  4340. }
  4341. }
  4342. return '';
  4343. };
  4344. EventRenderer.prototype.computeEventTimeFormat = function () {
  4345. return this.opt('smallTimeFormat');
  4346. };
  4347. EventRenderer.prototype.computeDisplayEventTime = function () {
  4348. return true;
  4349. };
  4350. EventRenderer.prototype.computeDisplayEventEnd = function () {
  4351. return true;
  4352. };
  4353. EventRenderer.prototype.getBgClasses = function (eventDef) {
  4354. var classNames = this.getClasses(eventDef);
  4355. classNames.push('fc-bgevent');
  4356. return classNames;
  4357. };
  4358. EventRenderer.prototype.getClasses = function (eventDef) {
  4359. var objs = this.getStylingObjs(eventDef);
  4360. var i;
  4361. var classNames = [];
  4362. for (i = 0; i < objs.length; i++) {
  4363. classNames.push.apply(// append
  4364. classNames, objs[i].eventClassName || objs[i].className || []);
  4365. }
  4366. return classNames;
  4367. };
  4368. // Utility for generating event skin-related CSS properties
  4369. EventRenderer.prototype.getSkinCss = function (eventDef) {
  4370. return {
  4371. 'background-color': this.getBgColor(eventDef),
  4372. 'border-color': this.getBorderColor(eventDef),
  4373. color: this.getTextColor(eventDef)
  4374. };
  4375. };
  4376. // Queries for caller-specified color, then falls back to default
  4377. EventRenderer.prototype.getBgColor = function (eventDef) {
  4378. var objs = this.getStylingObjs(eventDef);
  4379. var i;
  4380. var val;
  4381. for (i = 0; i < objs.length && !val; i++) {
  4382. val = objs[i].eventBackgroundColor || objs[i].eventColor ||
  4383. objs[i].backgroundColor || objs[i].color;
  4384. }
  4385. if (!val) {
  4386. val = this.opt('eventBackgroundColor') || this.opt('eventColor');
  4387. }
  4388. return val;
  4389. };
  4390. // Queries for caller-specified color, then falls back to default
  4391. EventRenderer.prototype.getBorderColor = function (eventDef) {
  4392. var objs = this.getStylingObjs(eventDef);
  4393. var i;
  4394. var val;
  4395. for (i = 0; i < objs.length && !val; i++) {
  4396. val = objs[i].eventBorderColor || objs[i].eventColor ||
  4397. objs[i].borderColor || objs[i].color;
  4398. }
  4399. if (!val) {
  4400. val = this.opt('eventBorderColor') || this.opt('eventColor');
  4401. }
  4402. return val;
  4403. };
  4404. // Queries for caller-specified color, then falls back to default
  4405. EventRenderer.prototype.getTextColor = function (eventDef) {
  4406. var objs = this.getStylingObjs(eventDef);
  4407. var i;
  4408. var val;
  4409. for (i = 0; i < objs.length && !val; i++) {
  4410. val = objs[i].eventTextColor ||
  4411. objs[i].textColor;
  4412. }
  4413. if (!val) {
  4414. val = this.opt('eventTextColor');
  4415. }
  4416. return val;
  4417. };
  4418. EventRenderer.prototype.getStylingObjs = function (eventDef) {
  4419. var objs = this.getFallbackStylingObjs(eventDef);
  4420. objs.unshift(eventDef);
  4421. return objs;
  4422. };
  4423. EventRenderer.prototype.getFallbackStylingObjs = function (eventDef) {
  4424. return [eventDef.source];
  4425. };
  4426. EventRenderer.prototype.sortEventSegs = function (segs) {
  4427. segs.sort(util_1.proxy(this, 'compareEventSegs'));
  4428. };
  4429. // A cmp function for determining which segments should take visual priority
  4430. EventRenderer.prototype.compareEventSegs = function (seg1, seg2) {
  4431. var f1 = seg1.footprint;
  4432. var f2 = seg2.footprint;
  4433. var cf1 = f1.componentFootprint;
  4434. var cf2 = f2.componentFootprint;
  4435. var r1 = cf1.unzonedRange;
  4436. var r2 = cf2.unzonedRange;
  4437. return r1.startMs - r2.startMs || // earlier events go first
  4438. (r2.endMs - r2.startMs) - (r1.endMs - r1.startMs) || // tie? longer events go first
  4439. cf2.isAllDay - cf1.isAllDay || // tie? put all-day events first (booleans cast to 0/1)
  4440. util_1.compareByFieldSpecs(f1.eventDef, f2.eventDef, this.view.eventOrderSpecs, f1.eventDef.miscProps, f2.eventDef.miscProps);
  4441. };
  4442. return EventRenderer;
  4443. }());
  4444. exports.default = EventRenderer;
  4445. /***/ }),
  4446. /* 43 */,
  4447. /* 44 */,
  4448. /* 45 */,
  4449. /* 46 */,
  4450. /* 47 */
  4451. /***/ (function(module, exports, __webpack_require__) {
  4452. Object.defineProperty(exports, "__esModule", { value: true });
  4453. var moment_ext_1 = __webpack_require__(10);
  4454. // Plugin
  4455. // -------------------------------------------------------------------------------------------------
  4456. moment_ext_1.newMomentProto.format = function () {
  4457. if (this._fullCalendar && arguments[0]) {
  4458. return formatDate(this, arguments[0]); // our extended formatting
  4459. }
  4460. if (this._ambigTime) {
  4461. return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD');
  4462. }
  4463. if (this._ambigZone) {
  4464. return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD[T]HH:mm:ss');
  4465. }
  4466. if (this._fullCalendar) {
  4467. // moment.format() doesn't ensure english, but we want to.
  4468. return moment_ext_1.oldMomentFormat(englishMoment(this));
  4469. }
  4470. return moment_ext_1.oldMomentProto.format.apply(this, arguments);
  4471. };
  4472. moment_ext_1.newMomentProto.toISOString = function () {
  4473. if (this._ambigTime) {
  4474. return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD');
  4475. }
  4476. if (this._ambigZone) {
  4477. return moment_ext_1.oldMomentFormat(englishMoment(this), 'YYYY-MM-DD[T]HH:mm:ss');
  4478. }
  4479. if (this._fullCalendar) {
  4480. // depending on browser, moment might not output english. ensure english.
  4481. // https://github.com/moment/moment/blob/2.18.1/src/lib/moment/format.js#L22
  4482. return moment_ext_1.oldMomentProto.toISOString.apply(englishMoment(this), arguments);
  4483. }
  4484. return moment_ext_1.oldMomentProto.toISOString.apply(this, arguments);
  4485. };
  4486. function englishMoment(mom) {
  4487. if (mom.locale() !== 'en') {
  4488. return mom.clone().locale('en');
  4489. }
  4490. return mom;
  4491. }
  4492. // Config
  4493. // ---------------------------------------------------------------------------------------------------------------------
  4494. /*
  4495. Inserted between chunks in the fake ("intermediate") formatting string.
  4496. Important that it passes as whitespace (\s) because moment often identifies non-standalone months
  4497. via a regexp with an \s.
  4498. */
  4499. var PART_SEPARATOR = '\u000b'; // vertical tab
  4500. /*
  4501. Inserted as the first character of a literal-text chunk to indicate that the literal text is not actually literal text,
  4502. but rather, a "special" token that has custom rendering (see specialTokens map).
  4503. */
  4504. var SPECIAL_TOKEN_MARKER = '\u001f'; // information separator 1
  4505. /*
  4506. Inserted at the beginning and end of a span of text that must have non-zero numeric characters.
  4507. Handling of these markers is done in a post-processing step at the very end of text rendering.
  4508. */
  4509. var MAYBE_MARKER = '\u001e'; // information separator 2
  4510. var MAYBE_REGEXP = new RegExp(MAYBE_MARKER + '([^' + MAYBE_MARKER + ']*)' + MAYBE_MARKER, 'g'); // must be global
  4511. /*
  4512. Addition formatting tokens we want recognized
  4513. */
  4514. var specialTokens = {
  4515. t: function (date) {
  4516. return moment_ext_1.oldMomentFormat(date, 'a').charAt(0);
  4517. },
  4518. T: function (date) {
  4519. return moment_ext_1.oldMomentFormat(date, 'A').charAt(0);
  4520. }
  4521. };
  4522. /*
  4523. The first characters of formatting tokens for units that are 1 day or larger.
  4524. `value` is for ranking relative size (lower means bigger).
  4525. `unit` is a normalized unit, used for comparing moments.
  4526. */
  4527. var largeTokenMap = {
  4528. Y: { value: 1, unit: 'year' },
  4529. M: { value: 2, unit: 'month' },
  4530. W: { value: 3, unit: 'week' },
  4531. w: { value: 3, unit: 'week' },
  4532. D: { value: 4, unit: 'day' },
  4533. d: { value: 4, unit: 'day' } // day of week
  4534. };
  4535. // Single Date Formatting
  4536. // ---------------------------------------------------------------------------------------------------------------------
  4537. /*
  4538. Formats `date` with a Moment formatting string, but allow our non-zero areas and special token
  4539. */
  4540. function formatDate(date, formatStr) {
  4541. return renderFakeFormatString(getParsedFormatString(formatStr).fakeFormatString, date);
  4542. }
  4543. exports.formatDate = formatDate;
  4544. // Date Range Formatting
  4545. // -------------------------------------------------------------------------------------------------
  4546. // TODO: make it work with timezone offset
  4547. /*
  4548. Using a formatting string meant for a single date, generate a range string, like
  4549. "Sep 2 - 9 2013", that intelligently inserts a separator where the dates differ.
  4550. If the dates are the same as far as the format string is concerned, just return a single
  4551. rendering of one date, without any separator.
  4552. */
  4553. function formatRange(date1, date2, formatStr, separator, isRTL) {
  4554. var localeData;
  4555. date1 = moment_ext_1.default.parseZone(date1);
  4556. date2 = moment_ext_1.default.parseZone(date2);
  4557. localeData = date1.localeData();
  4558. // Expand localized format strings, like "LL" -> "MMMM D YYYY".
  4559. // BTW, this is not important for `formatDate` because it is impossible to put custom tokens
  4560. // or non-zero areas in Moment's localized format strings.
  4561. formatStr = localeData.longDateFormat(formatStr) || formatStr;
  4562. return renderParsedFormat(getParsedFormatString(formatStr), date1, date2, separator || ' - ', isRTL);
  4563. }
  4564. exports.formatRange = formatRange;
  4565. /*
  4566. Renders a range with an already-parsed format string.
  4567. */
  4568. function renderParsedFormat(parsedFormat, date1, date2, separator, isRTL) {
  4569. var sameUnits = parsedFormat.sameUnits;
  4570. var unzonedDate1 = date1.clone().stripZone(); // for same-unit comparisons
  4571. var unzonedDate2 = date2.clone().stripZone(); // "
  4572. var renderedParts1 = renderFakeFormatStringParts(parsedFormat.fakeFormatString, date1);
  4573. var renderedParts2 = renderFakeFormatStringParts(parsedFormat.fakeFormatString, date2);
  4574. var leftI;
  4575. var leftStr = '';
  4576. var rightI;
  4577. var rightStr = '';
  4578. var middleI;
  4579. var middleStr1 = '';
  4580. var middleStr2 = '';
  4581. var middleStr = '';
  4582. // Start at the leftmost side of the formatting string and continue until you hit a token
  4583. // that is not the same between dates.
  4584. for (leftI = 0; leftI < sameUnits.length && (!sameUnits[leftI] || unzonedDate1.isSame(unzonedDate2, sameUnits[leftI])); leftI++) {
  4585. leftStr += renderedParts1[leftI];
  4586. }
  4587. // Similarly, start at the rightmost side of the formatting string and move left
  4588. for (rightI = sameUnits.length - 1; rightI > leftI && (!sameUnits[rightI] || unzonedDate1.isSame(unzonedDate2, sameUnits[rightI])); rightI--) {
  4589. // If current chunk is on the boundary of unique date-content, and is a special-case
  4590. // date-formatting postfix character, then don't consume it. Consider it unique date-content.
  4591. // TODO: make configurable
  4592. if (rightI - 1 === leftI && renderedParts1[rightI] === '.') {
  4593. break;
  4594. }
  4595. rightStr = renderedParts1[rightI] + rightStr;
  4596. }
  4597. // The area in the middle is different for both of the dates.
  4598. // Collect them distinctly so we can jam them together later.
  4599. for (middleI = leftI; middleI <= rightI; middleI++) {
  4600. middleStr1 += renderedParts1[middleI];
  4601. middleStr2 += renderedParts2[middleI];
  4602. }
  4603. if (middleStr1 || middleStr2) {
  4604. if (isRTL) {
  4605. middleStr = middleStr2 + separator + middleStr1;
  4606. }
  4607. else {
  4608. middleStr = middleStr1 + separator + middleStr2;
  4609. }
  4610. }
  4611. return processMaybeMarkers(leftStr + middleStr + rightStr);
  4612. }
  4613. // Format String Parsing
  4614. // ---------------------------------------------------------------------------------------------------------------------
  4615. var parsedFormatStrCache = {};
  4616. /*
  4617. Returns a parsed format string, leveraging a cache.
  4618. */
  4619. function getParsedFormatString(formatStr) {
  4620. return parsedFormatStrCache[formatStr] ||
  4621. (parsedFormatStrCache[formatStr] = parseFormatString(formatStr));
  4622. }
  4623. /*
  4624. Parses a format string into the following:
  4625. - fakeFormatString: a momentJS formatting string, littered with special control characters that get post-processed.
  4626. - sameUnits: for every part in fakeFormatString, if the part is a token, the value will be a unit string (like "day"),
  4627. that indicates how similar a range's start & end must be in order to share the same formatted text.
  4628. If not a token, then the value is null.
  4629. Always a flat array (not nested liked "chunks").
  4630. */
  4631. function parseFormatString(formatStr) {
  4632. var chunks = chunkFormatString(formatStr);
  4633. return {
  4634. fakeFormatString: buildFakeFormatString(chunks),
  4635. sameUnits: buildSameUnits(chunks)
  4636. };
  4637. }
  4638. /*
  4639. Break the formatting string into an array of chunks.
  4640. A 'maybe' chunk will have nested chunks.
  4641. */
  4642. function chunkFormatString(formatStr) {
  4643. var chunks = [];
  4644. var match;
  4645. // TODO: more descrimination
  4646. // \4 is a backreference to the first character of a multi-character set.
  4647. var chunker = /\[([^\]]*)\]|\(([^\)]*)\)|(LTS|LT|(\w)\4*o?)|([^\w\[\(]+)/g;
  4648. while ((match = chunker.exec(formatStr))) {
  4649. if (match[1]) {
  4650. chunks.push.apply(chunks, // append
  4651. splitStringLiteral(match[1]));
  4652. }
  4653. else if (match[2]) {
  4654. chunks.push({ maybe: chunkFormatString(match[2]) });
  4655. }
  4656. else if (match[3]) {
  4657. chunks.push({ token: match[3] });
  4658. }
  4659. else if (match[5]) {
  4660. chunks.push.apply(chunks, // append
  4661. splitStringLiteral(match[5]));
  4662. }
  4663. }
  4664. return chunks;
  4665. }
  4666. /*
  4667. Potentially splits a literal-text string into multiple parts. For special cases.
  4668. */
  4669. function splitStringLiteral(s) {
  4670. if (s === '. ') {
  4671. return ['.', ' ']; // for locales with periods bound to the end of each year/month/date
  4672. }
  4673. else {
  4674. return [s];
  4675. }
  4676. }
  4677. /*
  4678. Given chunks parsed from a real format string, generate a fake (aka "intermediate") format string with special control
  4679. characters that will eventually be given to moment for formatting, and then post-processed.
  4680. */
  4681. function buildFakeFormatString(chunks) {
  4682. var parts = [];
  4683. var i;
  4684. var chunk;
  4685. for (i = 0; i < chunks.length; i++) {
  4686. chunk = chunks[i];
  4687. if (typeof chunk === 'string') {
  4688. parts.push('[' + chunk + ']');
  4689. }
  4690. else if (chunk.token) {
  4691. if (chunk.token in specialTokens) {
  4692. parts.push(SPECIAL_TOKEN_MARKER + // useful during post-processing
  4693. '[' + chunk.token + ']' // preserve as literal text
  4694. );
  4695. }
  4696. else {
  4697. parts.push(chunk.token); // unprotected text implies a format string
  4698. }
  4699. }
  4700. else if (chunk.maybe) {
  4701. parts.push(MAYBE_MARKER + // useful during post-processing
  4702. buildFakeFormatString(chunk.maybe) +
  4703. MAYBE_MARKER);
  4704. }
  4705. }
  4706. return parts.join(PART_SEPARATOR);
  4707. }
  4708. /*
  4709. Given parsed chunks from a real formatting string, generates an array of unit strings (like "day") that indicate
  4710. in which regard two dates must be similar in order to share range formatting text.
  4711. The `chunks` can be nested (because of "maybe" chunks), however, the returned array will be flat.
  4712. */
  4713. function buildSameUnits(chunks) {
  4714. var units = [];
  4715. var i;
  4716. var chunk;
  4717. var tokenInfo;
  4718. for (i = 0; i < chunks.length; i++) {
  4719. chunk = chunks[i];
  4720. if (chunk.token) {
  4721. tokenInfo = largeTokenMap[chunk.token.charAt(0)];
  4722. units.push(tokenInfo ? tokenInfo.unit : 'second'); // default to a very strict same-second
  4723. }
  4724. else if (chunk.maybe) {
  4725. units.push.apply(units, // append
  4726. buildSameUnits(chunk.maybe));
  4727. }
  4728. else {
  4729. units.push(null);
  4730. }
  4731. }
  4732. return units;
  4733. }
  4734. // Rendering to text
  4735. // ---------------------------------------------------------------------------------------------------------------------
  4736. /*
  4737. Formats a date with a fake format string, post-processes the control characters, then returns.
  4738. */
  4739. function renderFakeFormatString(fakeFormatString, date) {
  4740. return processMaybeMarkers(renderFakeFormatStringParts(fakeFormatString, date).join(''));
  4741. }
  4742. /*
  4743. Formats a date into parts that will have been post-processed, EXCEPT for the "maybe" markers.
  4744. */
  4745. function renderFakeFormatStringParts(fakeFormatString, date) {
  4746. var parts = [];
  4747. var fakeRender = moment_ext_1.oldMomentFormat(date, fakeFormatString);
  4748. var fakeParts = fakeRender.split(PART_SEPARATOR);
  4749. var i;
  4750. var fakePart;
  4751. for (i = 0; i < fakeParts.length; i++) {
  4752. fakePart = fakeParts[i];
  4753. if (fakePart.charAt(0) === SPECIAL_TOKEN_MARKER) {
  4754. parts.push(
  4755. // the literal string IS the token's name.
  4756. // call special token's registered function.
  4757. specialTokens[fakePart.substring(1)](date));
  4758. }
  4759. else {
  4760. parts.push(fakePart);
  4761. }
  4762. }
  4763. return parts;
  4764. }
  4765. /*
  4766. Accepts an almost-finally-formatted string and processes the "maybe" control characters, returning a new string.
  4767. */
  4768. function processMaybeMarkers(s) {
  4769. return s.replace(MAYBE_REGEXP, function (m0, m1) {
  4770. if (m1.match(/[1-9]/)) {
  4771. return m1;
  4772. }
  4773. else {
  4774. return '';
  4775. }
  4776. });
  4777. }
  4778. // Misc Utils
  4779. // -------------------------------------------------------------------------------------------------
  4780. /*
  4781. Returns a unit string, either 'year', 'month', 'day', or null for the most granular formatting token in the string.
  4782. */
  4783. function queryMostGranularFormatUnit(formatStr) {
  4784. var chunks = chunkFormatString(formatStr);
  4785. var i;
  4786. var chunk;
  4787. var candidate;
  4788. var best;
  4789. for (i = 0; i < chunks.length; i++) {
  4790. chunk = chunks[i];
  4791. if (chunk.token) {
  4792. candidate = largeTokenMap[chunk.token.charAt(0)];
  4793. if (candidate) {
  4794. if (!best || candidate.value > best.value) {
  4795. best = candidate;
  4796. }
  4797. }
  4798. }
  4799. }
  4800. if (best) {
  4801. return best.unit;
  4802. }
  4803. return null;
  4804. }
  4805. exports.queryMostGranularFormatUnit = queryMostGranularFormatUnit;
  4806. /***/ }),
  4807. /* 48 */
  4808. /***/ (function(module, exports, __webpack_require__) {
  4809. Object.defineProperty(exports, "__esModule", { value: true });
  4810. var tslib_1 = __webpack_require__(2);
  4811. var Class_1 = __webpack_require__(33);
  4812. var EmitterMixin_1 = __webpack_require__(11);
  4813. var ListenerMixin_1 = __webpack_require__(7);
  4814. var Model = /** @class */ (function (_super) {
  4815. tslib_1.__extends(Model, _super);
  4816. function Model() {
  4817. var _this = _super.call(this) || this;
  4818. _this._watchers = {};
  4819. _this._props = {};
  4820. _this.applyGlobalWatchers();
  4821. _this.constructed();
  4822. return _this;
  4823. }
  4824. Model.watch = function (name) {
  4825. var args = [];
  4826. for (var _i = 1; _i < arguments.length; _i++) {
  4827. args[_i - 1] = arguments[_i];
  4828. }
  4829. // subclasses should make a masked-copy of the superclass's map
  4830. // TODO: write test
  4831. if (!this.prototype.hasOwnProperty('_globalWatchArgs')) {
  4832. this.prototype._globalWatchArgs = Object.create(this.prototype._globalWatchArgs);
  4833. }
  4834. this.prototype._globalWatchArgs[name] = args;
  4835. };
  4836. Model.prototype.constructed = function () {
  4837. // useful for monkeypatching. TODO: BaseClass?
  4838. };
  4839. Model.prototype.applyGlobalWatchers = function () {
  4840. var map = this._globalWatchArgs;
  4841. var name;
  4842. for (name in map) {
  4843. this.watch.apply(this, [name].concat(map[name]));
  4844. }
  4845. };
  4846. Model.prototype.has = function (name) {
  4847. return name in this._props;
  4848. };
  4849. Model.prototype.get = function (name) {
  4850. if (name === undefined) {
  4851. return this._props;
  4852. }
  4853. return this._props[name];
  4854. };
  4855. Model.prototype.set = function (name, val) {
  4856. var newProps;
  4857. if (typeof name === 'string') {
  4858. newProps = {};
  4859. newProps[name] = val === undefined ? null : val;
  4860. }
  4861. else {
  4862. newProps = name;
  4863. }
  4864. this.setProps(newProps);
  4865. };
  4866. Model.prototype.reset = function (newProps) {
  4867. var oldProps = this._props;
  4868. var changeset = {}; // will have undefined's to signal unsets
  4869. var name;
  4870. for (name in oldProps) {
  4871. changeset[name] = undefined;
  4872. }
  4873. for (name in newProps) {
  4874. changeset[name] = newProps[name];
  4875. }
  4876. this.setProps(changeset);
  4877. };
  4878. Model.prototype.unset = function (name) {
  4879. var newProps = {};
  4880. var names;
  4881. var i;
  4882. if (typeof name === 'string') {
  4883. names = [name];
  4884. }
  4885. else {
  4886. names = name;
  4887. }
  4888. for (i = 0; i < names.length; i++) {
  4889. newProps[names[i]] = undefined;
  4890. }
  4891. this.setProps(newProps);
  4892. };
  4893. Model.prototype.setProps = function (newProps) {
  4894. var changedProps = {};
  4895. var changedCnt = 0;
  4896. var name;
  4897. var val;
  4898. for (name in newProps) {
  4899. val = newProps[name];
  4900. // a change in value?
  4901. // if an object, don't check equality, because might have been mutated internally.
  4902. // TODO: eventually enforce immutability.
  4903. if (typeof val === 'object' ||
  4904. val !== this._props[name]) {
  4905. changedProps[name] = val;
  4906. changedCnt++;
  4907. }
  4908. }
  4909. if (changedCnt) {
  4910. this.trigger('before:batchChange', changedProps);
  4911. for (name in changedProps) {
  4912. val = changedProps[name];
  4913. this.trigger('before:change', name, val);
  4914. this.trigger('before:change:' + name, val);
  4915. }
  4916. for (name in changedProps) {
  4917. val = changedProps[name];
  4918. if (val === undefined) {
  4919. delete this._props[name];
  4920. }
  4921. else {
  4922. this._props[name] = val;
  4923. }
  4924. this.trigger('change:' + name, val);
  4925. this.trigger('change', name, val);
  4926. }
  4927. this.trigger('batchChange', changedProps);
  4928. }
  4929. };
  4930. Model.prototype.watch = function (name, depList, startFunc, stopFunc) {
  4931. var _this = this;
  4932. this.unwatch(name);
  4933. this._watchers[name] = this._watchDeps(depList, function (deps) {
  4934. var res = startFunc.call(_this, deps);
  4935. if (res && res.then) {
  4936. _this.unset(name); // put in an unset state while resolving
  4937. res.then(function (val) {
  4938. _this.set(name, val);
  4939. });
  4940. }
  4941. else {
  4942. _this.set(name, res);
  4943. }
  4944. }, function (deps) {
  4945. _this.unset(name);
  4946. if (stopFunc) {
  4947. stopFunc.call(_this, deps);
  4948. }
  4949. });
  4950. };
  4951. Model.prototype.unwatch = function (name) {
  4952. var watcher = this._watchers[name];
  4953. if (watcher) {
  4954. delete this._watchers[name];
  4955. watcher.teardown();
  4956. }
  4957. };
  4958. Model.prototype._watchDeps = function (depList, startFunc, stopFunc) {
  4959. var _this = this;
  4960. var queuedChangeCnt = 0;
  4961. var depCnt = depList.length;
  4962. var satisfyCnt = 0;
  4963. var values = {}; // what's passed as the `deps` arguments
  4964. var bindTuples = []; // array of [ eventName, handlerFunc ] arrays
  4965. var isCallingStop = false;
  4966. var onBeforeDepChange = function (depName, val, isOptional) {
  4967. queuedChangeCnt++;
  4968. if (queuedChangeCnt === 1) {
  4969. if (satisfyCnt === depCnt) {
  4970. isCallingStop = true;
  4971. stopFunc(values);
  4972. isCallingStop = false;
  4973. }
  4974. }
  4975. };
  4976. var onDepChange = function (depName, val, isOptional) {
  4977. if (val === undefined) {
  4978. // required dependency that was previously set?
  4979. if (!isOptional && values[depName] !== undefined) {
  4980. satisfyCnt--;
  4981. }
  4982. delete values[depName];
  4983. }
  4984. else {
  4985. // required dependency that was previously unset?
  4986. if (!isOptional && values[depName] === undefined) {
  4987. satisfyCnt++;
  4988. }
  4989. values[depName] = val;
  4990. }
  4991. queuedChangeCnt--;
  4992. if (!queuedChangeCnt) {
  4993. // now finally satisfied or satisfied all along?
  4994. if (satisfyCnt === depCnt) {
  4995. // if the stopFunc initiated another value change, ignore it.
  4996. // it will be processed by another change event anyway.
  4997. if (!isCallingStop) {
  4998. startFunc(values);
  4999. }
  5000. }
  5001. }
  5002. };
  5003. // intercept for .on() that remembers handlers
  5004. var bind = function (eventName, handler) {
  5005. _this.on(eventName, handler);
  5006. bindTuples.push([eventName, handler]);
  5007. };
  5008. // listen to dependency changes
  5009. depList.forEach(function (depName) {
  5010. var isOptional = false;
  5011. if (depName.charAt(0) === '?') {
  5012. depName = depName.substring(1);
  5013. isOptional = true;
  5014. }
  5015. bind('before:change:' + depName, function (val) {
  5016. onBeforeDepChange(depName, val, isOptional);
  5017. });
  5018. bind('change:' + depName, function (val) {
  5019. onDepChange(depName, val, isOptional);
  5020. });
  5021. });
  5022. // process current dependency values
  5023. depList.forEach(function (depName) {
  5024. var isOptional = false;
  5025. if (depName.charAt(0) === '?') {
  5026. depName = depName.substring(1);
  5027. isOptional = true;
  5028. }
  5029. if (_this.has(depName)) {
  5030. values[depName] = _this.get(depName);
  5031. satisfyCnt++;
  5032. }
  5033. else if (isOptional) {
  5034. satisfyCnt++;
  5035. }
  5036. });
  5037. // initially satisfied
  5038. if (satisfyCnt === depCnt) {
  5039. startFunc(values);
  5040. }
  5041. return {
  5042. teardown: function () {
  5043. // remove all handlers
  5044. for (var i = 0; i < bindTuples.length; i++) {
  5045. _this.off(bindTuples[i][0], bindTuples[i][1]);
  5046. }
  5047. bindTuples = null;
  5048. // was satisfied, so call stopFunc
  5049. if (satisfyCnt === depCnt) {
  5050. stopFunc();
  5051. }
  5052. },
  5053. flash: function () {
  5054. if (satisfyCnt === depCnt) {
  5055. stopFunc();
  5056. startFunc(values);
  5057. }
  5058. }
  5059. };
  5060. };
  5061. Model.prototype.flash = function (name) {
  5062. var watcher = this._watchers[name];
  5063. if (watcher) {
  5064. watcher.flash();
  5065. }
  5066. };
  5067. return Model;
  5068. }(Class_1.default));
  5069. exports.default = Model;
  5070. Model.prototype._globalWatchArgs = {}; // mutation protection in Model.watch
  5071. EmitterMixin_1.default.mixInto(Model);
  5072. ListenerMixin_1.default.mixInto(Model);
  5073. /***/ }),
  5074. /* 49 */
  5075. /***/ (function(module, exports, __webpack_require__) {
  5076. Object.defineProperty(exports, "__esModule", { value: true });
  5077. var moment = __webpack_require__(0);
  5078. var util_1 = __webpack_require__(4);
  5079. var SingleEventDef_1 = __webpack_require__(13);
  5080. var RecurringEventDef_1 = __webpack_require__(210);
  5081. exports.default = {
  5082. parse: function (eventInput, source) {
  5083. if (util_1.isTimeString(eventInput.start) || moment.isDuration(eventInput.start) ||
  5084. util_1.isTimeString(eventInput.end) || moment.isDuration(eventInput.end)) {
  5085. return RecurringEventDef_1.default.parse(eventInput, source);
  5086. }
  5087. else {
  5088. return SingleEventDef_1.default.parse(eventInput, source);
  5089. }
  5090. }
  5091. };
  5092. /***/ }),
  5093. /* 50 */
  5094. /***/ (function(module, exports, __webpack_require__) {
  5095. Object.defineProperty(exports, "__esModule", { value: true });
  5096. var util_1 = __webpack_require__(4);
  5097. var EventDateProfile_1 = __webpack_require__(17);
  5098. var EventDefDateMutation = /** @class */ (function () {
  5099. function EventDefDateMutation() {
  5100. this.clearEnd = false;
  5101. this.forceTimed = false;
  5102. this.forceAllDay = false;
  5103. }
  5104. EventDefDateMutation.createFromDiff = function (dateProfile0, dateProfile1, largeUnit) {
  5105. var clearEnd = dateProfile0.end && !dateProfile1.end;
  5106. var forceTimed = dateProfile0.isAllDay() && !dateProfile1.isAllDay();
  5107. var forceAllDay = !dateProfile0.isAllDay() && dateProfile1.isAllDay();
  5108. var dateDelta;
  5109. var endDiff;
  5110. var endDelta;
  5111. var mutation;
  5112. // subtracts the dates in the appropriate way, returning a duration
  5113. function subtractDates(date1, date0) {
  5114. if (largeUnit) {
  5115. return util_1.diffByUnit(date1, date0, largeUnit); // poorly named
  5116. }
  5117. else if (dateProfile1.isAllDay()) {
  5118. return util_1.diffDay(date1, date0); // poorly named
  5119. }
  5120. else {
  5121. return util_1.diffDayTime(date1, date0); // poorly named
  5122. }
  5123. }
  5124. dateDelta = subtractDates(dateProfile1.start, dateProfile0.start);
  5125. if (dateProfile1.end) {
  5126. // use unzonedRanges because dateProfile0.end might be null
  5127. endDiff = subtractDates(dateProfile1.unzonedRange.getEnd(), dateProfile0.unzonedRange.getEnd());
  5128. endDelta = endDiff.subtract(dateDelta);
  5129. }
  5130. mutation = new EventDefDateMutation();
  5131. mutation.clearEnd = clearEnd;
  5132. mutation.forceTimed = forceTimed;
  5133. mutation.forceAllDay = forceAllDay;
  5134. mutation.setDateDelta(dateDelta);
  5135. mutation.setEndDelta(endDelta);
  5136. return mutation;
  5137. };
  5138. /*
  5139. returns an undo function.
  5140. */
  5141. EventDefDateMutation.prototype.buildNewDateProfile = function (eventDateProfile, calendar) {
  5142. var start = eventDateProfile.start.clone();
  5143. var end = null;
  5144. var shouldRezone = false;
  5145. if (eventDateProfile.end && !this.clearEnd) {
  5146. end = eventDateProfile.end.clone();
  5147. }
  5148. else if (this.endDelta && !end) {
  5149. end = calendar.getDefaultEventEnd(eventDateProfile.isAllDay(), start);
  5150. }
  5151. if (this.forceTimed) {
  5152. shouldRezone = true;
  5153. if (!start.hasTime()) {
  5154. start.time(0);
  5155. }
  5156. if (end && !end.hasTime()) {
  5157. end.time(0);
  5158. }
  5159. }
  5160. else if (this.forceAllDay) {
  5161. if (start.hasTime()) {
  5162. start.stripTime();
  5163. }
  5164. if (end && end.hasTime()) {
  5165. end.stripTime();
  5166. }
  5167. }
  5168. if (this.dateDelta) {
  5169. shouldRezone = true;
  5170. start.add(this.dateDelta);
  5171. if (end) {
  5172. end.add(this.dateDelta);
  5173. }
  5174. }
  5175. // do this before adding startDelta to start, so we can work off of start
  5176. if (this.endDelta) {
  5177. shouldRezone = true;
  5178. end.add(this.endDelta);
  5179. }
  5180. if (this.startDelta) {
  5181. shouldRezone = true;
  5182. start.add(this.startDelta);
  5183. }
  5184. if (shouldRezone) {
  5185. start = calendar.applyTimezone(start);
  5186. if (end) {
  5187. end = calendar.applyTimezone(end);
  5188. }
  5189. }
  5190. // TODO: okay to access calendar option?
  5191. if (!end && calendar.opt('forceEventDuration')) {
  5192. end = calendar.getDefaultEventEnd(eventDateProfile.isAllDay(), start);
  5193. }
  5194. return new EventDateProfile_1.default(start, end, calendar);
  5195. };
  5196. EventDefDateMutation.prototype.setDateDelta = function (dateDelta) {
  5197. if (dateDelta && dateDelta.valueOf()) {
  5198. this.dateDelta = dateDelta;
  5199. }
  5200. else {
  5201. this.dateDelta = null;
  5202. }
  5203. };
  5204. EventDefDateMutation.prototype.setStartDelta = function (startDelta) {
  5205. if (startDelta && startDelta.valueOf()) {
  5206. this.startDelta = startDelta;
  5207. }
  5208. else {
  5209. this.startDelta = null;
  5210. }
  5211. };
  5212. EventDefDateMutation.prototype.setEndDelta = function (endDelta) {
  5213. if (endDelta && endDelta.valueOf()) {
  5214. this.endDelta = endDelta;
  5215. }
  5216. else {
  5217. this.endDelta = null;
  5218. }
  5219. };
  5220. EventDefDateMutation.prototype.isEmpty = function () {
  5221. return !this.clearEnd && !this.forceTimed && !this.forceAllDay &&
  5222. !this.dateDelta && !this.startDelta && !this.endDelta;
  5223. };
  5224. return EventDefDateMutation;
  5225. }());
  5226. exports.default = EventDefDateMutation;
  5227. /***/ }),
  5228. /* 51 */
  5229. /***/ (function(module, exports, __webpack_require__) {
  5230. Object.defineProperty(exports, "__esModule", { value: true });
  5231. var StandardTheme_1 = __webpack_require__(213);
  5232. var JqueryUiTheme_1 = __webpack_require__(214);
  5233. var themeClassHash = {};
  5234. function defineThemeSystem(themeName, themeClass) {
  5235. themeClassHash[themeName] = themeClass;
  5236. }
  5237. exports.defineThemeSystem = defineThemeSystem;
  5238. function getThemeSystemClass(themeSetting) {
  5239. if (!themeSetting) {
  5240. return StandardTheme_1.default;
  5241. }
  5242. else if (themeSetting === true) {
  5243. return JqueryUiTheme_1.default;
  5244. }
  5245. else {
  5246. return themeClassHash[themeSetting];
  5247. }
  5248. }
  5249. exports.getThemeSystemClass = getThemeSystemClass;
  5250. /***/ }),
  5251. /* 52 */
  5252. /***/ (function(module, exports, __webpack_require__) {
  5253. Object.defineProperty(exports, "__esModule", { value: true });
  5254. var tslib_1 = __webpack_require__(2);
  5255. var $ = __webpack_require__(3);
  5256. var util_1 = __webpack_require__(4);
  5257. var Promise_1 = __webpack_require__(20);
  5258. var EventSource_1 = __webpack_require__(6);
  5259. var SingleEventDef_1 = __webpack_require__(13);
  5260. var ArrayEventSource = /** @class */ (function (_super) {
  5261. tslib_1.__extends(ArrayEventSource, _super);
  5262. function ArrayEventSource(calendar) {
  5263. var _this = _super.call(this, calendar) || this;
  5264. _this.eventDefs = []; // for if setRawEventDefs is never called
  5265. return _this;
  5266. }
  5267. ArrayEventSource.parse = function (rawInput, calendar) {
  5268. var rawProps;
  5269. // normalize raw input
  5270. if ($.isArray(rawInput.events)) {
  5271. rawProps = rawInput;
  5272. }
  5273. else if ($.isArray(rawInput)) {
  5274. rawProps = { events: rawInput };
  5275. }
  5276. if (rawProps) {
  5277. return EventSource_1.default.parse.call(this, rawProps, calendar);
  5278. }
  5279. return false;
  5280. };
  5281. ArrayEventSource.prototype.setRawEventDefs = function (rawEventDefs) {
  5282. this.rawEventDefs = rawEventDefs;
  5283. this.eventDefs = this.parseEventDefs(rawEventDefs);
  5284. };
  5285. ArrayEventSource.prototype.fetch = function (start, end, timezone) {
  5286. var eventDefs = this.eventDefs;
  5287. var i;
  5288. if (this.currentTimezone != null &&
  5289. this.currentTimezone !== timezone) {
  5290. for (i = 0; i < eventDefs.length; i++) {
  5291. if (eventDefs[i] instanceof SingleEventDef_1.default) {
  5292. eventDefs[i].rezone();
  5293. }
  5294. }
  5295. }
  5296. this.currentTimezone = timezone;
  5297. return Promise_1.default.resolve(eventDefs);
  5298. };
  5299. ArrayEventSource.prototype.addEventDef = function (eventDef) {
  5300. this.eventDefs.push(eventDef);
  5301. };
  5302. /*
  5303. eventDefId already normalized to a string
  5304. */
  5305. ArrayEventSource.prototype.removeEventDefsById = function (eventDefId) {
  5306. return util_1.removeMatching(this.eventDefs, function (eventDef) {
  5307. return eventDef.id === eventDefId;
  5308. });
  5309. };
  5310. ArrayEventSource.prototype.removeAllEventDefs = function () {
  5311. this.eventDefs = [];
  5312. };
  5313. ArrayEventSource.prototype.getPrimitive = function () {
  5314. return this.rawEventDefs;
  5315. };
  5316. ArrayEventSource.prototype.applyManualStandardProps = function (rawProps) {
  5317. var superSuccess = _super.prototype.applyManualStandardProps.call(this, rawProps);
  5318. this.setRawEventDefs(rawProps.events);
  5319. return superSuccess;
  5320. };
  5321. return ArrayEventSource;
  5322. }(EventSource_1.default));
  5323. exports.default = ArrayEventSource;
  5324. ArrayEventSource.defineStandardProps({
  5325. events: false // don't automatically transfer
  5326. });
  5327. /***/ }),
  5328. /* 53 */
  5329. /***/ (function(module, exports, __webpack_require__) {
  5330. Object.defineProperty(exports, "__esModule", { value: true });
  5331. var $ = __webpack_require__(3);
  5332. var util_1 = __webpack_require__(4);
  5333. /*
  5334. A cache for the left/right/top/bottom/width/height values for one or more elements.
  5335. Works with both offset (from topleft document) and position (from offsetParent).
  5336. options:
  5337. - els
  5338. - isHorizontal
  5339. - isVertical
  5340. */
  5341. var CoordCache = /** @class */ (function () {
  5342. function CoordCache(options) {
  5343. this.isHorizontal = false; // whether to query for left/right/width
  5344. this.isVertical = false; // whether to query for top/bottom/height
  5345. this.els = $(options.els);
  5346. this.isHorizontal = options.isHorizontal;
  5347. this.isVertical = options.isVertical;
  5348. this.forcedOffsetParentEl = options.offsetParent ? $(options.offsetParent) : null;
  5349. }
  5350. // Queries the els for coordinates and stores them.
  5351. // Call this method before using and of the get* methods below.
  5352. CoordCache.prototype.build = function () {
  5353. var offsetParentEl = this.forcedOffsetParentEl;
  5354. if (!offsetParentEl && this.els.length > 0) {
  5355. offsetParentEl = this.els.eq(0).offsetParent();
  5356. }
  5357. this.origin = offsetParentEl ?
  5358. offsetParentEl.offset() :
  5359. null;
  5360. this.boundingRect = this.queryBoundingRect();
  5361. if (this.isHorizontal) {
  5362. this.buildElHorizontals();
  5363. }
  5364. if (this.isVertical) {
  5365. this.buildElVerticals();
  5366. }
  5367. };
  5368. // Destroys all internal data about coordinates, freeing memory
  5369. CoordCache.prototype.clear = function () {
  5370. this.origin = null;
  5371. this.boundingRect = null;
  5372. this.lefts = null;
  5373. this.rights = null;
  5374. this.tops = null;
  5375. this.bottoms = null;
  5376. };
  5377. // When called, if coord caches aren't built, builds them
  5378. CoordCache.prototype.ensureBuilt = function () {
  5379. if (!this.origin) {
  5380. this.build();
  5381. }
  5382. };
  5383. // Populates the left/right internal coordinate arrays
  5384. CoordCache.prototype.buildElHorizontals = function () {
  5385. var lefts = [];
  5386. var rights = [];
  5387. this.els.each(function (i, node) {
  5388. var el = $(node);
  5389. var left = el.offset().left;
  5390. var width = el.outerWidth();
  5391. lefts.push(left);
  5392. rights.push(left + width);
  5393. });
  5394. this.lefts = lefts;
  5395. this.rights = rights;
  5396. };
  5397. // Populates the top/bottom internal coordinate arrays
  5398. CoordCache.prototype.buildElVerticals = function () {
  5399. var tops = [];
  5400. var bottoms = [];
  5401. this.els.each(function (i, node) {
  5402. var el = $(node);
  5403. var top = el.offset().top;
  5404. var height = el.outerHeight();
  5405. tops.push(top);
  5406. bottoms.push(top + height);
  5407. });
  5408. this.tops = tops;
  5409. this.bottoms = bottoms;
  5410. };
  5411. // Given a left offset (from document left), returns the index of the el that it horizontally intersects.
  5412. // If no intersection is made, returns undefined.
  5413. CoordCache.prototype.getHorizontalIndex = function (leftOffset) {
  5414. this.ensureBuilt();
  5415. var lefts = this.lefts;
  5416. var rights = this.rights;
  5417. var len = lefts.length;
  5418. var i;
  5419. for (i = 0; i < len; i++) {
  5420. if (leftOffset >= lefts[i] && leftOffset < rights[i]) {
  5421. return i;
  5422. }
  5423. }
  5424. };
  5425. // Given a top offset (from document top), returns the index of the el that it vertically intersects.
  5426. // If no intersection is made, returns undefined.
  5427. CoordCache.prototype.getVerticalIndex = function (topOffset) {
  5428. this.ensureBuilt();
  5429. var tops = this.tops;
  5430. var bottoms = this.bottoms;
  5431. var len = tops.length;
  5432. var i;
  5433. for (i = 0; i < len; i++) {
  5434. if (topOffset >= tops[i] && topOffset < bottoms[i]) {
  5435. return i;
  5436. }
  5437. }
  5438. };
  5439. // Gets the left offset (from document left) of the element at the given index
  5440. CoordCache.prototype.getLeftOffset = function (leftIndex) {
  5441. this.ensureBuilt();
  5442. return this.lefts[leftIndex];
  5443. };
  5444. // Gets the left position (from offsetParent left) of the element at the given index
  5445. CoordCache.prototype.getLeftPosition = function (leftIndex) {
  5446. this.ensureBuilt();
  5447. return this.lefts[leftIndex] - this.origin.left;
  5448. };
  5449. // Gets the right offset (from document left) of the element at the given index.
  5450. // This value is NOT relative to the document's right edge, like the CSS concept of "right" would be.
  5451. CoordCache.prototype.getRightOffset = function (leftIndex) {
  5452. this.ensureBuilt();
  5453. return this.rights[leftIndex];
  5454. };
  5455. // Gets the right position (from offsetParent left) of the element at the given index.
  5456. // This value is NOT relative to the offsetParent's right edge, like the CSS concept of "right" would be.
  5457. CoordCache.prototype.getRightPosition = function (leftIndex) {
  5458. this.ensureBuilt();
  5459. return this.rights[leftIndex] - this.origin.left;
  5460. };
  5461. // Gets the width of the element at the given index
  5462. CoordCache.prototype.getWidth = function (leftIndex) {
  5463. this.ensureBuilt();
  5464. return this.rights[leftIndex] - this.lefts[leftIndex];
  5465. };
  5466. // Gets the top offset (from document top) of the element at the given index
  5467. CoordCache.prototype.getTopOffset = function (topIndex) {
  5468. this.ensureBuilt();
  5469. return this.tops[topIndex];
  5470. };
  5471. // Gets the top position (from offsetParent top) of the element at the given position
  5472. CoordCache.prototype.getTopPosition = function (topIndex) {
  5473. this.ensureBuilt();
  5474. return this.tops[topIndex] - this.origin.top;
  5475. };
  5476. // Gets the bottom offset (from the document top) of the element at the given index.
  5477. // This value is NOT relative to the offsetParent's bottom edge, like the CSS concept of "bottom" would be.
  5478. CoordCache.prototype.getBottomOffset = function (topIndex) {
  5479. this.ensureBuilt();
  5480. return this.bottoms[topIndex];
  5481. };
  5482. // Gets the bottom position (from the offsetParent top) of the element at the given index.
  5483. // This value is NOT relative to the offsetParent's bottom edge, like the CSS concept of "bottom" would be.
  5484. CoordCache.prototype.getBottomPosition = function (topIndex) {
  5485. this.ensureBuilt();
  5486. return this.bottoms[topIndex] - this.origin.top;
  5487. };
  5488. // Gets the height of the element at the given index
  5489. CoordCache.prototype.getHeight = function (topIndex) {
  5490. this.ensureBuilt();
  5491. return this.bottoms[topIndex] - this.tops[topIndex];
  5492. };
  5493. // Bounding Rect
  5494. // TODO: decouple this from CoordCache
  5495. // Compute and return what the elements' bounding rectangle is, from the user's perspective.
  5496. // Right now, only returns a rectangle if constrained by an overflow:scroll element.
  5497. // Returns null if there are no elements
  5498. CoordCache.prototype.queryBoundingRect = function () {
  5499. var scrollParentEl;
  5500. if (this.els.length > 0) {
  5501. scrollParentEl = util_1.getScrollParent(this.els.eq(0));
  5502. if (!scrollParentEl.is(document)) {
  5503. return util_1.getClientRect(scrollParentEl);
  5504. }
  5505. }
  5506. return null;
  5507. };
  5508. CoordCache.prototype.isPointInBounds = function (leftOffset, topOffset) {
  5509. return this.isLeftInBounds(leftOffset) && this.isTopInBounds(topOffset);
  5510. };
  5511. CoordCache.prototype.isLeftInBounds = function (leftOffset) {
  5512. return !this.boundingRect || (leftOffset >= this.boundingRect.left && leftOffset < this.boundingRect.right);
  5513. };
  5514. CoordCache.prototype.isTopInBounds = function (topOffset) {
  5515. return !this.boundingRect || (topOffset >= this.boundingRect.top && topOffset < this.boundingRect.bottom);
  5516. };
  5517. return CoordCache;
  5518. }());
  5519. exports.default = CoordCache;
  5520. /***/ }),
  5521. /* 54 */
  5522. /***/ (function(module, exports, __webpack_require__) {
  5523. Object.defineProperty(exports, "__esModule", { value: true });
  5524. var $ = __webpack_require__(3);
  5525. var util_1 = __webpack_require__(4);
  5526. var ListenerMixin_1 = __webpack_require__(7);
  5527. var GlobalEmitter_1 = __webpack_require__(21);
  5528. /* Tracks a drag's mouse movement, firing various handlers
  5529. ----------------------------------------------------------------------------------------------------------------------*/
  5530. // TODO: use Emitter
  5531. var DragListener = /** @class */ (function () {
  5532. function DragListener(options) {
  5533. this.isInteracting = false;
  5534. this.isDistanceSurpassed = false;
  5535. this.isDelayEnded = false;
  5536. this.isDragging = false;
  5537. this.isTouch = false;
  5538. this.isGeneric = false; // initiated by 'dragstart' (jqui)
  5539. this.shouldCancelTouchScroll = true;
  5540. this.scrollAlwaysKills = false;
  5541. this.isAutoScroll = false;
  5542. // defaults
  5543. this.scrollSensitivity = 30; // pixels from edge for scrolling to start
  5544. this.scrollSpeed = 200; // pixels per second, at maximum speed
  5545. this.scrollIntervalMs = 50; // millisecond wait between scroll increment
  5546. this.options = options || {};
  5547. }
  5548. // Interaction (high-level)
  5549. // -----------------------------------------------------------------------------------------------------------------
  5550. DragListener.prototype.startInteraction = function (ev, extraOptions) {
  5551. if (extraOptions === void 0) { extraOptions = {}; }
  5552. if (ev.type === 'mousedown') {
  5553. if (GlobalEmitter_1.default.get().shouldIgnoreMouse()) {
  5554. return;
  5555. }
  5556. else if (!util_1.isPrimaryMouseButton(ev)) {
  5557. return;
  5558. }
  5559. else {
  5560. ev.preventDefault(); // prevents native selection in most browsers
  5561. }
  5562. }
  5563. if (!this.isInteracting) {
  5564. // process options
  5565. this.delay = util_1.firstDefined(extraOptions.delay, this.options.delay, 0);
  5566. this.minDistance = util_1.firstDefined(extraOptions.distance, this.options.distance, 0);
  5567. this.subjectEl = this.options.subjectEl;
  5568. util_1.preventSelection($('body'));
  5569. this.isInteracting = true;
  5570. this.isTouch = util_1.getEvIsTouch(ev);
  5571. this.isGeneric = ev.type === 'dragstart';
  5572. this.isDelayEnded = false;
  5573. this.isDistanceSurpassed = false;
  5574. this.originX = util_1.getEvX(ev);
  5575. this.originY = util_1.getEvY(ev);
  5576. this.scrollEl = util_1.getScrollParent($(ev.target));
  5577. this.bindHandlers();
  5578. this.initAutoScroll();
  5579. this.handleInteractionStart(ev);
  5580. this.startDelay(ev);
  5581. if (!this.minDistance) {
  5582. this.handleDistanceSurpassed(ev);
  5583. }
  5584. }
  5585. };
  5586. DragListener.prototype.handleInteractionStart = function (ev) {
  5587. this.trigger('interactionStart', ev);
  5588. };
  5589. DragListener.prototype.endInteraction = function (ev, isCancelled) {
  5590. if (this.isInteracting) {
  5591. this.endDrag(ev);
  5592. if (this.delayTimeoutId) {
  5593. clearTimeout(this.delayTimeoutId);
  5594. this.delayTimeoutId = null;
  5595. }
  5596. this.destroyAutoScroll();
  5597. this.unbindHandlers();
  5598. this.isInteracting = false;
  5599. this.handleInteractionEnd(ev, isCancelled);
  5600. util_1.allowSelection($('body'));
  5601. }
  5602. };
  5603. DragListener.prototype.handleInteractionEnd = function (ev, isCancelled) {
  5604. this.trigger('interactionEnd', ev, isCancelled || false);
  5605. };
  5606. // Binding To DOM
  5607. // -----------------------------------------------------------------------------------------------------------------
  5608. DragListener.prototype.bindHandlers = function () {
  5609. // some browsers (Safari in iOS 10) don't allow preventDefault on touch events that are bound after touchstart,
  5610. // so listen to the GlobalEmitter singleton, which is always bound, instead of the document directly.
  5611. var globalEmitter = GlobalEmitter_1.default.get();
  5612. if (this.isGeneric) {
  5613. this.listenTo($(document), {
  5614. drag: this.handleMove,
  5615. dragstop: this.endInteraction
  5616. });
  5617. }
  5618. else if (this.isTouch) {
  5619. this.listenTo(globalEmitter, {
  5620. touchmove: this.handleTouchMove,
  5621. touchend: this.endInteraction,
  5622. scroll: this.handleTouchScroll
  5623. });
  5624. }
  5625. else {
  5626. this.listenTo(globalEmitter, {
  5627. mousemove: this.handleMouseMove,
  5628. mouseup: this.endInteraction
  5629. });
  5630. }
  5631. this.listenTo(globalEmitter, {
  5632. selectstart: util_1.preventDefault,
  5633. contextmenu: util_1.preventDefault // long taps would open menu on Chrome dev tools
  5634. });
  5635. };
  5636. DragListener.prototype.unbindHandlers = function () {
  5637. this.stopListeningTo(GlobalEmitter_1.default.get());
  5638. this.stopListeningTo($(document)); // for isGeneric
  5639. };
  5640. // Drag (high-level)
  5641. // -----------------------------------------------------------------------------------------------------------------
  5642. // extraOptions ignored if drag already started
  5643. DragListener.prototype.startDrag = function (ev, extraOptions) {
  5644. this.startInteraction(ev, extraOptions); // ensure interaction began
  5645. if (!this.isDragging) {
  5646. this.isDragging = true;
  5647. this.handleDragStart(ev);
  5648. }
  5649. };
  5650. DragListener.prototype.handleDragStart = function (ev) {
  5651. this.trigger('dragStart', ev);
  5652. };
  5653. DragListener.prototype.handleMove = function (ev) {
  5654. var dx = util_1.getEvX(ev) - this.originX;
  5655. var dy = util_1.getEvY(ev) - this.originY;
  5656. var minDistance = this.minDistance;
  5657. var distanceSq; // current distance from the origin, squared
  5658. if (!this.isDistanceSurpassed) {
  5659. distanceSq = dx * dx + dy * dy;
  5660. if (distanceSq >= minDistance * minDistance) {
  5661. this.handleDistanceSurpassed(ev);
  5662. }
  5663. }
  5664. if (this.isDragging) {
  5665. this.handleDrag(dx, dy, ev);
  5666. }
  5667. };
  5668. // Called while the mouse is being moved and when we know a legitimate drag is taking place
  5669. DragListener.prototype.handleDrag = function (dx, dy, ev) {
  5670. this.trigger('drag', dx, dy, ev);
  5671. this.updateAutoScroll(ev); // will possibly cause scrolling
  5672. };
  5673. DragListener.prototype.endDrag = function (ev) {
  5674. if (this.isDragging) {
  5675. this.isDragging = false;
  5676. this.handleDragEnd(ev);
  5677. }
  5678. };
  5679. DragListener.prototype.handleDragEnd = function (ev) {
  5680. this.trigger('dragEnd', ev);
  5681. };
  5682. // Delay
  5683. // -----------------------------------------------------------------------------------------------------------------
  5684. DragListener.prototype.startDelay = function (initialEv) {
  5685. var _this = this;
  5686. if (this.delay) {
  5687. this.delayTimeoutId = setTimeout(function () {
  5688. _this.handleDelayEnd(initialEv);
  5689. }, this.delay);
  5690. }
  5691. else {
  5692. this.handleDelayEnd(initialEv);
  5693. }
  5694. };
  5695. DragListener.prototype.handleDelayEnd = function (initialEv) {
  5696. this.isDelayEnded = true;
  5697. if (this.isDistanceSurpassed) {
  5698. this.startDrag(initialEv);
  5699. }
  5700. };
  5701. // Distance
  5702. // -----------------------------------------------------------------------------------------------------------------
  5703. DragListener.prototype.handleDistanceSurpassed = function (ev) {
  5704. this.isDistanceSurpassed = true;
  5705. if (this.isDelayEnded) {
  5706. this.startDrag(ev);
  5707. }
  5708. };
  5709. // Mouse / Touch
  5710. // -----------------------------------------------------------------------------------------------------------------
  5711. DragListener.prototype.handleTouchMove = function (ev) {
  5712. // prevent inertia and touchmove-scrolling while dragging
  5713. if (this.isDragging && this.shouldCancelTouchScroll) {
  5714. ev.preventDefault();
  5715. }
  5716. this.handleMove(ev);
  5717. };
  5718. DragListener.prototype.handleMouseMove = function (ev) {
  5719. this.handleMove(ev);
  5720. };
  5721. // Scrolling (unrelated to auto-scroll)
  5722. // -----------------------------------------------------------------------------------------------------------------
  5723. DragListener.prototype.handleTouchScroll = function (ev) {
  5724. // if the drag is being initiated by touch, but a scroll happens before
  5725. // the drag-initiating delay is over, cancel the drag
  5726. if (!this.isDragging || this.scrollAlwaysKills) {
  5727. this.endInteraction(ev, true); // isCancelled=true
  5728. }
  5729. };
  5730. // Utils
  5731. // -----------------------------------------------------------------------------------------------------------------
  5732. // Triggers a callback. Calls a function in the option hash of the same name.
  5733. // Arguments beyond the first `name` are forwarded on.
  5734. DragListener.prototype.trigger = function (name) {
  5735. var args = [];
  5736. for (var _i = 1; _i < arguments.length; _i++) {
  5737. args[_i - 1] = arguments[_i];
  5738. }
  5739. if (this.options[name]) {
  5740. this.options[name].apply(this, args);
  5741. }
  5742. // makes _methods callable by event name. TODO: kill this
  5743. if (this['_' + name]) {
  5744. this['_' + name].apply(this, args);
  5745. }
  5746. };
  5747. // Auto-scroll
  5748. // -----------------------------------------------------------------------------------------------------------------
  5749. DragListener.prototype.initAutoScroll = function () {
  5750. var scrollEl = this.scrollEl;
  5751. this.isAutoScroll =
  5752. this.options.scroll &&
  5753. scrollEl &&
  5754. !scrollEl.is(window) &&
  5755. !scrollEl.is(document);
  5756. if (this.isAutoScroll) {
  5757. // debounce makes sure rapid calls don't happen
  5758. this.listenTo(scrollEl, 'scroll', util_1.debounce(this.handleDebouncedScroll, 100));
  5759. }
  5760. };
  5761. DragListener.prototype.destroyAutoScroll = function () {
  5762. this.endAutoScroll(); // kill any animation loop
  5763. // remove the scroll handler if there is a scrollEl
  5764. if (this.isAutoScroll) {
  5765. this.stopListeningTo(this.scrollEl, 'scroll'); // will probably get removed by unbindHandlers too :(
  5766. }
  5767. };
  5768. // Computes and stores the bounding rectangle of scrollEl
  5769. DragListener.prototype.computeScrollBounds = function () {
  5770. if (this.isAutoScroll) {
  5771. this.scrollBounds = util_1.getOuterRect(this.scrollEl);
  5772. // TODO: use getClientRect in future. but prevents auto scrolling when on top of scrollbars
  5773. }
  5774. };
  5775. // Called when the dragging is in progress and scrolling should be updated
  5776. DragListener.prototype.updateAutoScroll = function (ev) {
  5777. var sensitivity = this.scrollSensitivity;
  5778. var bounds = this.scrollBounds;
  5779. var topCloseness;
  5780. var bottomCloseness;
  5781. var leftCloseness;
  5782. var rightCloseness;
  5783. var topVel = 0;
  5784. var leftVel = 0;
  5785. if (bounds) {
  5786. // compute closeness to edges. valid range is from 0.0 - 1.0
  5787. topCloseness = (sensitivity - (util_1.getEvY(ev) - bounds.top)) / sensitivity;
  5788. bottomCloseness = (sensitivity - (bounds.bottom - util_1.getEvY(ev))) / sensitivity;
  5789. leftCloseness = (sensitivity - (util_1.getEvX(ev) - bounds.left)) / sensitivity;
  5790. rightCloseness = (sensitivity - (bounds.right - util_1.getEvX(ev))) / sensitivity;
  5791. // translate vertical closeness into velocity.
  5792. // mouse must be completely in bounds for velocity to happen.
  5793. if (topCloseness >= 0 && topCloseness <= 1) {
  5794. topVel = topCloseness * this.scrollSpeed * -1; // negative. for scrolling up
  5795. }
  5796. else if (bottomCloseness >= 0 && bottomCloseness <= 1) {
  5797. topVel = bottomCloseness * this.scrollSpeed;
  5798. }
  5799. // translate horizontal closeness into velocity
  5800. if (leftCloseness >= 0 && leftCloseness <= 1) {
  5801. leftVel = leftCloseness * this.scrollSpeed * -1; // negative. for scrolling left
  5802. }
  5803. else if (rightCloseness >= 0 && rightCloseness <= 1) {
  5804. leftVel = rightCloseness * this.scrollSpeed;
  5805. }
  5806. }
  5807. this.setScrollVel(topVel, leftVel);
  5808. };
  5809. // Sets the speed-of-scrolling for the scrollEl
  5810. DragListener.prototype.setScrollVel = function (topVel, leftVel) {
  5811. this.scrollTopVel = topVel;
  5812. this.scrollLeftVel = leftVel;
  5813. this.constrainScrollVel(); // massages into realistic values
  5814. // if there is non-zero velocity, and an animation loop hasn't already started, then START
  5815. if ((this.scrollTopVel || this.scrollLeftVel) && !this.scrollIntervalId) {
  5816. this.scrollIntervalId = setInterval(util_1.proxy(this, 'scrollIntervalFunc'), // scope to `this`
  5817. this.scrollIntervalMs);
  5818. }
  5819. };
  5820. // Forces scrollTopVel and scrollLeftVel to be zero if scrolling has already gone all the way
  5821. DragListener.prototype.constrainScrollVel = function () {
  5822. var el = this.scrollEl;
  5823. if (this.scrollTopVel < 0) {
  5824. if (el.scrollTop() <= 0) {
  5825. this.scrollTopVel = 0;
  5826. }
  5827. }
  5828. else if (this.scrollTopVel > 0) {
  5829. if (el.scrollTop() + el[0].clientHeight >= el[0].scrollHeight) {
  5830. this.scrollTopVel = 0;
  5831. }
  5832. }
  5833. if (this.scrollLeftVel < 0) {
  5834. if (el.scrollLeft() <= 0) {
  5835. this.scrollLeftVel = 0;
  5836. }
  5837. }
  5838. else if (this.scrollLeftVel > 0) {
  5839. if (el.scrollLeft() + el[0].clientWidth >= el[0].scrollWidth) {
  5840. this.scrollLeftVel = 0;
  5841. }
  5842. }
  5843. };
  5844. // This function gets called during every iteration of the scrolling animation loop
  5845. DragListener.prototype.scrollIntervalFunc = function () {
  5846. var el = this.scrollEl;
  5847. var frac = this.scrollIntervalMs / 1000; // considering animation frequency, what the vel should be mult'd by
  5848. // change the value of scrollEl's scroll
  5849. if (this.scrollTopVel) {
  5850. el.scrollTop(el.scrollTop() + this.scrollTopVel * frac);
  5851. }
  5852. if (this.scrollLeftVel) {
  5853. el.scrollLeft(el.scrollLeft() + this.scrollLeftVel * frac);
  5854. }
  5855. this.constrainScrollVel(); // since the scroll values changed, recompute the velocities
  5856. // if scrolled all the way, which causes the vels to be zero, stop the animation loop
  5857. if (!this.scrollTopVel && !this.scrollLeftVel) {
  5858. this.endAutoScroll();
  5859. }
  5860. };
  5861. // Kills any existing scrolling animation loop
  5862. DragListener.prototype.endAutoScroll = function () {
  5863. if (this.scrollIntervalId) {
  5864. clearInterval(this.scrollIntervalId);
  5865. this.scrollIntervalId = null;
  5866. this.handleScrollEnd();
  5867. }
  5868. };
  5869. // Get called when the scrollEl is scrolled (NOTE: this is delayed via debounce)
  5870. DragListener.prototype.handleDebouncedScroll = function () {
  5871. // recompute all coordinates, but *only* if this is *not* part of our scrolling animation
  5872. if (!this.scrollIntervalId) {
  5873. this.handleScrollEnd();
  5874. }
  5875. };
  5876. DragListener.prototype.handleScrollEnd = function () {
  5877. // Called when scrolling has stopped, whether through auto scroll, or the user scrolling
  5878. };
  5879. return DragListener;
  5880. }());
  5881. exports.default = DragListener;
  5882. ListenerMixin_1.default.mixInto(DragListener);
  5883. /***/ }),
  5884. /* 55 */
  5885. /***/ (function(module, exports, __webpack_require__) {
  5886. Object.defineProperty(exports, "__esModule", { value: true });
  5887. var tslib_1 = __webpack_require__(2);
  5888. var util_1 = __webpack_require__(4);
  5889. var Mixin_1 = __webpack_require__(14);
  5890. /*
  5891. A set of rendering and date-related methods for a visual component comprised of one or more rows of day columns.
  5892. Prerequisite: the object being mixed into needs to be a *Grid*
  5893. */
  5894. var DayTableMixin = /** @class */ (function (_super) {
  5895. tslib_1.__extends(DayTableMixin, _super);
  5896. function DayTableMixin() {
  5897. return _super !== null && _super.apply(this, arguments) || this;
  5898. }
  5899. // Populates internal variables used for date calculation and rendering
  5900. DayTableMixin.prototype.updateDayTable = function () {
  5901. var t = this;
  5902. var view = t.view;
  5903. var calendar = view.calendar;
  5904. var date = calendar.msToUtcMoment(t.dateProfile.renderUnzonedRange.startMs, true);
  5905. var end = calendar.msToUtcMoment(t.dateProfile.renderUnzonedRange.endMs, true);
  5906. var dayIndex = -1;
  5907. var dayIndices = [];
  5908. var dayDates = [];
  5909. var daysPerRow;
  5910. var firstDay;
  5911. var rowCnt;
  5912. while (date.isBefore(end)) {
  5913. if (view.isHiddenDay(date)) {
  5914. dayIndices.push(dayIndex + 0.5); // mark that it's between indices
  5915. }
  5916. else {
  5917. dayIndex++;
  5918. dayIndices.push(dayIndex);
  5919. dayDates.push(date.clone());
  5920. }
  5921. date.add(1, 'days');
  5922. }
  5923. if (this.breakOnWeeks) {
  5924. // count columns until the day-of-week repeats
  5925. firstDay = dayDates[0].day();
  5926. for (daysPerRow = 1; daysPerRow < dayDates.length; daysPerRow++) {
  5927. if (dayDates[daysPerRow].day() === firstDay) {
  5928. break;
  5929. }
  5930. }
  5931. rowCnt = Math.ceil(dayDates.length / daysPerRow);
  5932. }
  5933. else {
  5934. rowCnt = 1;
  5935. daysPerRow = dayDates.length;
  5936. }
  5937. this.dayDates = dayDates;
  5938. this.dayIndices = dayIndices;
  5939. this.daysPerRow = daysPerRow;
  5940. this.rowCnt = rowCnt;
  5941. this.updateDayTableCols();
  5942. };
  5943. // Computes and assigned the colCnt property and updates any options that may be computed from it
  5944. DayTableMixin.prototype.updateDayTableCols = function () {
  5945. this.colCnt = this.computeColCnt();
  5946. this.colHeadFormat =
  5947. this.opt('columnHeaderFormat') ||
  5948. this.opt('columnFormat') || // deprecated
  5949. this.computeColHeadFormat();
  5950. };
  5951. // Determines how many columns there should be in the table
  5952. DayTableMixin.prototype.computeColCnt = function () {
  5953. return this.daysPerRow;
  5954. };
  5955. // Computes the ambiguously-timed moment for the given cell
  5956. DayTableMixin.prototype.getCellDate = function (row, col) {
  5957. return this.dayDates[this.getCellDayIndex(row, col)].clone();
  5958. };
  5959. // Computes the ambiguously-timed date range for the given cell
  5960. DayTableMixin.prototype.getCellRange = function (row, col) {
  5961. var start = this.getCellDate(row, col);
  5962. var end = start.clone().add(1, 'days');
  5963. return { start: start, end: end };
  5964. };
  5965. // Returns the number of day cells, chronologically, from the first of the grid (0-based)
  5966. DayTableMixin.prototype.getCellDayIndex = function (row, col) {
  5967. return row * this.daysPerRow + this.getColDayIndex(col);
  5968. };
  5969. // Returns the numner of day cells, chronologically, from the first cell in *any given row*
  5970. DayTableMixin.prototype.getColDayIndex = function (col) {
  5971. if (this.isRTL) {
  5972. return this.colCnt - 1 - col;
  5973. }
  5974. else {
  5975. return col;
  5976. }
  5977. };
  5978. // Given a date, returns its chronolocial cell-index from the first cell of the grid.
  5979. // If the date lies between cells (because of hiddenDays), returns a floating-point value between offsets.
  5980. // If before the first offset, returns a negative number.
  5981. // If after the last offset, returns an offset past the last cell offset.
  5982. // Only works for *start* dates of cells. Will not work for exclusive end dates for cells.
  5983. DayTableMixin.prototype.getDateDayIndex = function (date) {
  5984. var dayIndices = this.dayIndices;
  5985. var dayOffset = date.diff(this.dayDates[0], 'days');
  5986. if (dayOffset < 0) {
  5987. return dayIndices[0] - 1;
  5988. }
  5989. else if (dayOffset >= dayIndices.length) {
  5990. return dayIndices[dayIndices.length - 1] + 1;
  5991. }
  5992. else {
  5993. return dayIndices[dayOffset];
  5994. }
  5995. };
  5996. /* Options
  5997. ------------------------------------------------------------------------------------------------------------------*/
  5998. // Computes a default column header formatting string if `colFormat` is not explicitly defined
  5999. DayTableMixin.prototype.computeColHeadFormat = function () {
  6000. // if more than one week row, or if there are a lot of columns with not much space,
  6001. // put just the day numbers will be in each cell
  6002. if (this.rowCnt > 1 || this.colCnt > 10) {
  6003. return 'ddd'; // "Sat"
  6004. }
  6005. else if (this.colCnt > 1) {
  6006. return this.opt('dayOfMonthFormat'); // "Sat 12/10"
  6007. }
  6008. else {
  6009. return 'dddd'; // "Saturday"
  6010. }
  6011. };
  6012. /* Slicing
  6013. ------------------------------------------------------------------------------------------------------------------*/
  6014. // Slices up a date range into a segment for every week-row it intersects with
  6015. DayTableMixin.prototype.sliceRangeByRow = function (unzonedRange) {
  6016. var daysPerRow = this.daysPerRow;
  6017. var normalRange = this.view.computeDayRange(unzonedRange); // make whole-day range, considering nextDayThreshold
  6018. var rangeFirst = this.getDateDayIndex(normalRange.start); // inclusive first index
  6019. var rangeLast = this.getDateDayIndex(normalRange.end.clone().subtract(1, 'days')); // inclusive last index
  6020. var segs = [];
  6021. var row;
  6022. var rowFirst;
  6023. var rowLast; // inclusive day-index range for current row
  6024. var segFirst;
  6025. var segLast; // inclusive day-index range for segment
  6026. for (row = 0; row < this.rowCnt; row++) {
  6027. rowFirst = row * daysPerRow;
  6028. rowLast = rowFirst + daysPerRow - 1;
  6029. // intersect segment's offset range with the row's
  6030. segFirst = Math.max(rangeFirst, rowFirst);
  6031. segLast = Math.min(rangeLast, rowLast);
  6032. // deal with in-between indices
  6033. segFirst = Math.ceil(segFirst); // in-between starts round to next cell
  6034. segLast = Math.floor(segLast); // in-between ends round to prev cell
  6035. if (segFirst <= segLast) {
  6036. segs.push({
  6037. row: row,
  6038. // normalize to start of row
  6039. firstRowDayIndex: segFirst - rowFirst,
  6040. lastRowDayIndex: segLast - rowFirst,
  6041. // must be matching integers to be the segment's start/end
  6042. isStart: segFirst === rangeFirst,
  6043. isEnd: segLast === rangeLast
  6044. });
  6045. }
  6046. }
  6047. return segs;
  6048. };
  6049. // Slices up a date range into a segment for every day-cell it intersects with.
  6050. // TODO: make more DRY with sliceRangeByRow somehow.
  6051. DayTableMixin.prototype.sliceRangeByDay = function (unzonedRange) {
  6052. var daysPerRow = this.daysPerRow;
  6053. var normalRange = this.view.computeDayRange(unzonedRange); // make whole-day range, considering nextDayThreshold
  6054. var rangeFirst = this.getDateDayIndex(normalRange.start); // inclusive first index
  6055. var rangeLast = this.getDateDayIndex(normalRange.end.clone().subtract(1, 'days')); // inclusive last index
  6056. var segs = [];
  6057. var row;
  6058. var rowFirst;
  6059. var rowLast; // inclusive day-index range for current row
  6060. var i;
  6061. var segFirst;
  6062. var segLast; // inclusive day-index range for segment
  6063. for (row = 0; row < this.rowCnt; row++) {
  6064. rowFirst = row * daysPerRow;
  6065. rowLast = rowFirst + daysPerRow - 1;
  6066. for (i = rowFirst; i <= rowLast; i++) {
  6067. // intersect segment's offset range with the row's
  6068. segFirst = Math.max(rangeFirst, i);
  6069. segLast = Math.min(rangeLast, i);
  6070. // deal with in-between indices
  6071. segFirst = Math.ceil(segFirst); // in-between starts round to next cell
  6072. segLast = Math.floor(segLast); // in-between ends round to prev cell
  6073. if (segFirst <= segLast) {
  6074. segs.push({
  6075. row: row,
  6076. // normalize to start of row
  6077. firstRowDayIndex: segFirst - rowFirst,
  6078. lastRowDayIndex: segLast - rowFirst,
  6079. // must be matching integers to be the segment's start/end
  6080. isStart: segFirst === rangeFirst,
  6081. isEnd: segLast === rangeLast
  6082. });
  6083. }
  6084. }
  6085. }
  6086. return segs;
  6087. };
  6088. /* Header Rendering
  6089. ------------------------------------------------------------------------------------------------------------------*/
  6090. DayTableMixin.prototype.renderHeadHtml = function () {
  6091. var theme = this.view.calendar.theme;
  6092. return '' +
  6093. '<div class="fc-row ' + theme.getClass('headerRow') + '">' +
  6094. '<table class="' + theme.getClass('tableGrid') + '">' +
  6095. '<thead>' +
  6096. this.renderHeadTrHtml() +
  6097. '</thead>' +
  6098. '</table>' +
  6099. '</div>';
  6100. };
  6101. DayTableMixin.prototype.renderHeadIntroHtml = function () {
  6102. return this.renderIntroHtml(); // fall back to generic
  6103. };
  6104. DayTableMixin.prototype.renderHeadTrHtml = function () {
  6105. return '' +
  6106. '<tr>' +
  6107. (this.isRTL ? '' : this.renderHeadIntroHtml()) +
  6108. this.renderHeadDateCellsHtml() +
  6109. (this.isRTL ? this.renderHeadIntroHtml() : '') +
  6110. '</tr>';
  6111. };
  6112. DayTableMixin.prototype.renderHeadDateCellsHtml = function () {
  6113. var htmls = [];
  6114. var col;
  6115. var date;
  6116. for (col = 0; col < this.colCnt; col++) {
  6117. date = this.getCellDate(0, col);
  6118. htmls.push(this.renderHeadDateCellHtml(date));
  6119. }
  6120. return htmls.join('');
  6121. };
  6122. // TODO: when internalApiVersion, accept an object for HTML attributes
  6123. // (colspan should be no different)
  6124. DayTableMixin.prototype.renderHeadDateCellHtml = function (date, colspan, otherAttrs) {
  6125. var t = this;
  6126. var view = t.view;
  6127. var isDateValid = t.dateProfile.activeUnzonedRange.containsDate(date); // TODO: called too frequently. cache somehow.
  6128. var classNames = [
  6129. 'fc-day-header',
  6130. view.calendar.theme.getClass('widgetHeader')
  6131. ];
  6132. var innerHtml;
  6133. if (typeof t.opt('columnHeaderHtml') === 'function') {
  6134. innerHtml = t.opt('columnHeaderHtml')(date);
  6135. }
  6136. else if (typeof t.opt('columnHeaderText') === 'function') {
  6137. innerHtml = util_1.htmlEscape(t.opt('columnHeaderText')(date));
  6138. }
  6139. else {
  6140. innerHtml = util_1.htmlEscape(date.format(t.colHeadFormat));
  6141. }
  6142. // if only one row of days, the classNames on the header can represent the specific days beneath
  6143. if (t.rowCnt === 1) {
  6144. classNames = classNames.concat(
  6145. // includes the day-of-week class
  6146. // noThemeHighlight=true (don't highlight the header)
  6147. t.getDayClasses(date, true));
  6148. }
  6149. else {
  6150. classNames.push('fc-' + util_1.dayIDs[date.day()]); // only add the day-of-week class
  6151. }
  6152. return '' +
  6153. '<th class="' + classNames.join(' ') + '"' +
  6154. ((isDateValid && t.rowCnt) === 1 ?
  6155. ' data-date="' + date.format('YYYY-MM-DD') + '"' :
  6156. '') +
  6157. (colspan > 1 ?
  6158. ' colspan="' + colspan + '"' :
  6159. '') +
  6160. (otherAttrs ?
  6161. ' ' + otherAttrs :
  6162. '') +
  6163. '>' +
  6164. (isDateValid ?
  6165. // don't make a link if the heading could represent multiple days, or if there's only one day (forceOff)
  6166. view.buildGotoAnchorHtml({ date: date, forceOff: t.rowCnt > 1 || t.colCnt === 1 }, innerHtml) :
  6167. // if not valid, display text, but no link
  6168. innerHtml) +
  6169. '</th>';
  6170. };
  6171. /* Background Rendering
  6172. ------------------------------------------------------------------------------------------------------------------*/
  6173. DayTableMixin.prototype.renderBgTrHtml = function (row) {
  6174. return '' +
  6175. '<tr>' +
  6176. (this.isRTL ? '' : this.renderBgIntroHtml(row)) +
  6177. this.renderBgCellsHtml(row) +
  6178. (this.isRTL ? this.renderBgIntroHtml(row) : '') +
  6179. '</tr>';
  6180. };
  6181. DayTableMixin.prototype.renderBgIntroHtml = function (row) {
  6182. return this.renderIntroHtml(); // fall back to generic
  6183. };
  6184. DayTableMixin.prototype.renderBgCellsHtml = function (row) {
  6185. var htmls = [];
  6186. var col;
  6187. var date;
  6188. for (col = 0; col < this.colCnt; col++) {
  6189. date = this.getCellDate(row, col);
  6190. htmls.push(this.renderBgCellHtml(date));
  6191. }
  6192. return htmls.join('');
  6193. };
  6194. DayTableMixin.prototype.renderBgCellHtml = function (date, otherAttrs) {
  6195. var t = this;
  6196. var view = t.view;
  6197. var isDateValid = t.dateProfile.activeUnzonedRange.containsDate(date); // TODO: called too frequently. cache somehow.
  6198. var classes = t.getDayClasses(date);
  6199. classes.unshift('fc-day', view.calendar.theme.getClass('widgetContent'));
  6200. return '<td class="' + classes.join(' ') + '"' +
  6201. (isDateValid ?
  6202. ' data-date="' + date.format('YYYY-MM-DD') + '"' : // if date has a time, won't format it
  6203. '') +
  6204. (otherAttrs ?
  6205. ' ' + otherAttrs :
  6206. '') +
  6207. '></td>';
  6208. };
  6209. /* Generic
  6210. ------------------------------------------------------------------------------------------------------------------*/
  6211. DayTableMixin.prototype.renderIntroHtml = function () {
  6212. // Generates the default HTML intro for any row. User classes should override
  6213. };
  6214. // TODO: a generic method for dealing with <tr>, RTL, intro
  6215. // when increment internalApiVersion
  6216. // wrapTr (scheduler)
  6217. /* Utils
  6218. ------------------------------------------------------------------------------------------------------------------*/
  6219. // Applies the generic "intro" and "outro" HTML to the given cells.
  6220. // Intro means the leftmost cell when the calendar is LTR and the rightmost cell when RTL. Vice-versa for outro.
  6221. DayTableMixin.prototype.bookendCells = function (trEl) {
  6222. var introHtml = this.renderIntroHtml();
  6223. if (introHtml) {
  6224. if (this.isRTL) {
  6225. trEl.append(introHtml);
  6226. }
  6227. else {
  6228. trEl.prepend(introHtml);
  6229. }
  6230. }
  6231. };
  6232. return DayTableMixin;
  6233. }(Mixin_1.default));
  6234. exports.default = DayTableMixin;
  6235. /***/ }),
  6236. /* 56 */
  6237. /***/ (function(module, exports) {
  6238. Object.defineProperty(exports, "__esModule", { value: true });
  6239. var BusinessHourRenderer = /** @class */ (function () {
  6240. /*
  6241. component implements:
  6242. - eventRangesToEventFootprints
  6243. - eventFootprintsToSegs
  6244. */
  6245. function BusinessHourRenderer(component, fillRenderer) {
  6246. this.component = component;
  6247. this.fillRenderer = fillRenderer;
  6248. }
  6249. BusinessHourRenderer.prototype.render = function (businessHourGenerator) {
  6250. var component = this.component;
  6251. var unzonedRange = component._getDateProfile().activeUnzonedRange;
  6252. var eventInstanceGroup = businessHourGenerator.buildEventInstanceGroup(component.hasAllDayBusinessHours, unzonedRange);
  6253. var eventFootprints = eventInstanceGroup ?
  6254. component.eventRangesToEventFootprints(eventInstanceGroup.sliceRenderRanges(unzonedRange)) :
  6255. [];
  6256. this.renderEventFootprints(eventFootprints);
  6257. };
  6258. BusinessHourRenderer.prototype.renderEventFootprints = function (eventFootprints) {
  6259. var segs = this.component.eventFootprintsToSegs(eventFootprints);
  6260. this.renderSegs(segs);
  6261. this.segs = segs;
  6262. };
  6263. BusinessHourRenderer.prototype.renderSegs = function (segs) {
  6264. if (this.fillRenderer) {
  6265. this.fillRenderer.renderSegs('businessHours', segs, {
  6266. getClasses: function (seg) {
  6267. return ['fc-nonbusiness', 'fc-bgevent'];
  6268. }
  6269. });
  6270. }
  6271. };
  6272. BusinessHourRenderer.prototype.unrender = function () {
  6273. if (this.fillRenderer) {
  6274. this.fillRenderer.unrender('businessHours');
  6275. }
  6276. this.segs = null;
  6277. };
  6278. BusinessHourRenderer.prototype.getSegs = function () {
  6279. return this.segs || [];
  6280. };
  6281. return BusinessHourRenderer;
  6282. }());
  6283. exports.default = BusinessHourRenderer;
  6284. /***/ }),
  6285. /* 57 */
  6286. /***/ (function(module, exports, __webpack_require__) {
  6287. Object.defineProperty(exports, "__esModule", { value: true });
  6288. var $ = __webpack_require__(3);
  6289. var util_1 = __webpack_require__(4);
  6290. var FillRenderer = /** @class */ (function () {
  6291. function FillRenderer(component) {
  6292. this.fillSegTag = 'div';
  6293. this.component = component;
  6294. this.elsByFill = {};
  6295. }
  6296. FillRenderer.prototype.renderFootprint = function (type, componentFootprint, props) {
  6297. this.renderSegs(type, this.component.componentFootprintToSegs(componentFootprint), props);
  6298. };
  6299. FillRenderer.prototype.renderSegs = function (type, segs, props) {
  6300. var els;
  6301. segs = this.buildSegEls(type, segs, props); // assignes `.el` to each seg. returns successfully rendered segs
  6302. els = this.attachSegEls(type, segs);
  6303. if (els) {
  6304. this.reportEls(type, els);
  6305. }
  6306. return segs;
  6307. };
  6308. // Unrenders a specific type of fill that is currently rendered on the grid
  6309. FillRenderer.prototype.unrender = function (type) {
  6310. var el = this.elsByFill[type];
  6311. if (el) {
  6312. el.remove();
  6313. delete this.elsByFill[type];
  6314. }
  6315. };
  6316. // Renders and assigns an `el` property for each fill segment. Generic enough to work with different types.
  6317. // Only returns segments that successfully rendered.
  6318. FillRenderer.prototype.buildSegEls = function (type, segs, props) {
  6319. var _this = this;
  6320. var html = '';
  6321. var renderedSegs = [];
  6322. var i;
  6323. if (segs.length) {
  6324. // build a large concatenation of segment HTML
  6325. for (i = 0; i < segs.length; i++) {
  6326. html += this.buildSegHtml(type, segs[i], props);
  6327. }
  6328. // Grab individual elements from the combined HTML string. Use each as the default rendering.
  6329. // Then, compute the 'el' for each segment.
  6330. $(html).each(function (i, node) {
  6331. var seg = segs[i];
  6332. var el = $(node);
  6333. // allow custom filter methods per-type
  6334. if (props.filterEl) {
  6335. el = props.filterEl(seg, el);
  6336. }
  6337. if (el) {
  6338. el = $(el); // allow custom filter to return raw DOM node
  6339. // correct element type? (would be bad if a non-TD were inserted into a table for example)
  6340. if (el.is(_this.fillSegTag)) {
  6341. seg.el = el;
  6342. renderedSegs.push(seg);
  6343. }
  6344. }
  6345. });
  6346. }
  6347. return renderedSegs;
  6348. };
  6349. // Builds the HTML needed for one fill segment. Generic enough to work with different types.
  6350. FillRenderer.prototype.buildSegHtml = function (type, seg, props) {
  6351. // custom hooks per-type
  6352. var classes = props.getClasses ? props.getClasses(seg) : [];
  6353. var css = util_1.cssToStr(props.getCss ? props.getCss(seg) : {});
  6354. return '<' + this.fillSegTag +
  6355. (classes.length ? ' class="' + classes.join(' ') + '"' : '') +
  6356. (css ? ' style="' + css + '"' : '') +
  6357. ' />';
  6358. };
  6359. // Should return wrapping DOM structure
  6360. FillRenderer.prototype.attachSegEls = function (type, segs) {
  6361. // subclasses must implement
  6362. };
  6363. FillRenderer.prototype.reportEls = function (type, nodes) {
  6364. if (this.elsByFill[type]) {
  6365. this.elsByFill[type] = this.elsByFill[type].add(nodes);
  6366. }
  6367. else {
  6368. this.elsByFill[type] = $(nodes);
  6369. }
  6370. };
  6371. return FillRenderer;
  6372. }());
  6373. exports.default = FillRenderer;
  6374. /***/ }),
  6375. /* 58 */
  6376. /***/ (function(module, exports, __webpack_require__) {
  6377. Object.defineProperty(exports, "__esModule", { value: true });
  6378. var SingleEventDef_1 = __webpack_require__(13);
  6379. var EventFootprint_1 = __webpack_require__(36);
  6380. var EventSource_1 = __webpack_require__(6);
  6381. var HelperRenderer = /** @class */ (function () {
  6382. function HelperRenderer(component, eventRenderer) {
  6383. this.view = component._getView();
  6384. this.component = component;
  6385. this.eventRenderer = eventRenderer;
  6386. }
  6387. HelperRenderer.prototype.renderComponentFootprint = function (componentFootprint) {
  6388. this.renderEventFootprints([
  6389. this.fabricateEventFootprint(componentFootprint)
  6390. ]);
  6391. };
  6392. HelperRenderer.prototype.renderEventDraggingFootprints = function (eventFootprints, sourceSeg, isTouch) {
  6393. this.renderEventFootprints(eventFootprints, sourceSeg, 'fc-dragging', isTouch ? null : this.view.opt('dragOpacity'));
  6394. };
  6395. HelperRenderer.prototype.renderEventResizingFootprints = function (eventFootprints, sourceSeg, isTouch) {
  6396. this.renderEventFootprints(eventFootprints, sourceSeg, 'fc-resizing');
  6397. };
  6398. HelperRenderer.prototype.renderEventFootprints = function (eventFootprints, sourceSeg, extraClassNames, opacity) {
  6399. var segs = this.component.eventFootprintsToSegs(eventFootprints);
  6400. var classNames = 'fc-helper ' + (extraClassNames || '');
  6401. var i;
  6402. // assigns each seg's el and returns a subset of segs that were rendered
  6403. segs = this.eventRenderer.renderFgSegEls(segs);
  6404. for (i = 0; i < segs.length; i++) {
  6405. segs[i].el.addClass(classNames);
  6406. }
  6407. if (opacity != null) {
  6408. for (i = 0; i < segs.length; i++) {
  6409. segs[i].el.css('opacity', opacity);
  6410. }
  6411. }
  6412. this.helperEls = this.renderSegs(segs, sourceSeg);
  6413. };
  6414. /*
  6415. Must return all mock event elements
  6416. */
  6417. HelperRenderer.prototype.renderSegs = function (segs, sourceSeg) {
  6418. // Subclasses must implement
  6419. };
  6420. HelperRenderer.prototype.unrender = function () {
  6421. if (this.helperEls) {
  6422. this.helperEls.remove();
  6423. this.helperEls = null;
  6424. }
  6425. };
  6426. HelperRenderer.prototype.fabricateEventFootprint = function (componentFootprint) {
  6427. var calendar = this.view.calendar;
  6428. var eventDateProfile = calendar.footprintToDateProfile(componentFootprint);
  6429. var dummyEvent = new SingleEventDef_1.default(new EventSource_1.default(calendar));
  6430. var dummyInstance;
  6431. dummyEvent.dateProfile = eventDateProfile;
  6432. dummyInstance = dummyEvent.buildInstance();
  6433. return new EventFootprint_1.default(componentFootprint, dummyEvent, dummyInstance);
  6434. };
  6435. return HelperRenderer;
  6436. }());
  6437. exports.default = HelperRenderer;
  6438. /***/ }),
  6439. /* 59 */
  6440. /***/ (function(module, exports, __webpack_require__) {
  6441. Object.defineProperty(exports, "__esModule", { value: true });
  6442. var tslib_1 = __webpack_require__(2);
  6443. var GlobalEmitter_1 = __webpack_require__(21);
  6444. var Interaction_1 = __webpack_require__(15);
  6445. var EventPointing = /** @class */ (function (_super) {
  6446. tslib_1.__extends(EventPointing, _super);
  6447. function EventPointing() {
  6448. return _super !== null && _super.apply(this, arguments) || this;
  6449. }
  6450. /*
  6451. component must implement:
  6452. - publiclyTrigger
  6453. */
  6454. EventPointing.prototype.bindToEl = function (el) {
  6455. var component = this.component;
  6456. component.bindSegHandlerToEl(el, 'click', this.handleClick.bind(this));
  6457. component.bindSegHandlerToEl(el, 'mouseenter', this.handleMouseover.bind(this));
  6458. component.bindSegHandlerToEl(el, 'mouseleave', this.handleMouseout.bind(this));
  6459. };
  6460. EventPointing.prototype.handleClick = function (seg, ev) {
  6461. var res = this.component.publiclyTrigger('eventClick', {
  6462. context: seg.el[0],
  6463. args: [seg.footprint.getEventLegacy(), ev, this.view]
  6464. });
  6465. if (res === false) {
  6466. ev.preventDefault();
  6467. }
  6468. };
  6469. // Updates internal state and triggers handlers for when an event element is moused over
  6470. EventPointing.prototype.handleMouseover = function (seg, ev) {
  6471. if (!GlobalEmitter_1.default.get().shouldIgnoreMouse() &&
  6472. !this.mousedOverSeg) {
  6473. this.mousedOverSeg = seg;
  6474. // TODO: move to EventSelecting's responsibility
  6475. if (this.view.isEventDefResizable(seg.footprint.eventDef)) {
  6476. seg.el.addClass('fc-allow-mouse-resize');
  6477. }
  6478. this.component.publiclyTrigger('eventMouseover', {
  6479. context: seg.el[0],
  6480. args: [seg.footprint.getEventLegacy(), ev, this.view]
  6481. });
  6482. }
  6483. };
  6484. // Updates internal state and triggers handlers for when an event element is moused out.
  6485. // Can be given no arguments, in which case it will mouseout the segment that was previously moused over.
  6486. EventPointing.prototype.handleMouseout = function (seg, ev) {
  6487. if (this.mousedOverSeg) {
  6488. this.mousedOverSeg = null;
  6489. // TODO: move to EventSelecting's responsibility
  6490. if (this.view.isEventDefResizable(seg.footprint.eventDef)) {
  6491. seg.el.removeClass('fc-allow-mouse-resize');
  6492. }
  6493. this.component.publiclyTrigger('eventMouseout', {
  6494. context: seg.el[0],
  6495. args: [
  6496. seg.footprint.getEventLegacy(),
  6497. ev || {},
  6498. this.view
  6499. ]
  6500. });
  6501. }
  6502. };
  6503. EventPointing.prototype.end = function () {
  6504. if (this.mousedOverSeg) {
  6505. this.handleMouseout(this.mousedOverSeg);
  6506. }
  6507. };
  6508. return EventPointing;
  6509. }(Interaction_1.default));
  6510. exports.default = EventPointing;
  6511. /***/ }),
  6512. /* 60 */
  6513. /***/ (function(module, exports, __webpack_require__) {
  6514. Object.defineProperty(exports, "__esModule", { value: true });
  6515. var tslib_1 = __webpack_require__(2);
  6516. var Mixin_1 = __webpack_require__(14);
  6517. var DateClicking_1 = __webpack_require__(245);
  6518. var DateSelecting_1 = __webpack_require__(225);
  6519. var EventPointing_1 = __webpack_require__(59);
  6520. var EventDragging_1 = __webpack_require__(224);
  6521. var EventResizing_1 = __webpack_require__(223);
  6522. var ExternalDropping_1 = __webpack_require__(222);
  6523. var StandardInteractionsMixin = /** @class */ (function (_super) {
  6524. tslib_1.__extends(StandardInteractionsMixin, _super);
  6525. function StandardInteractionsMixin() {
  6526. return _super !== null && _super.apply(this, arguments) || this;
  6527. }
  6528. return StandardInteractionsMixin;
  6529. }(Mixin_1.default));
  6530. exports.default = StandardInteractionsMixin;
  6531. StandardInteractionsMixin.prototype.dateClickingClass = DateClicking_1.default;
  6532. StandardInteractionsMixin.prototype.dateSelectingClass = DateSelecting_1.default;
  6533. StandardInteractionsMixin.prototype.eventPointingClass = EventPointing_1.default;
  6534. StandardInteractionsMixin.prototype.eventDraggingClass = EventDragging_1.default;
  6535. StandardInteractionsMixin.prototype.eventResizingClass = EventResizing_1.default;
  6536. StandardInteractionsMixin.prototype.externalDroppingClass = ExternalDropping_1.default;
  6537. /***/ }),
  6538. /* 61 */
  6539. /***/ (function(module, exports, __webpack_require__) {
  6540. Object.defineProperty(exports, "__esModule", { value: true });
  6541. var tslib_1 = __webpack_require__(2);
  6542. var $ = __webpack_require__(3);
  6543. var util_1 = __webpack_require__(4);
  6544. var CoordCache_1 = __webpack_require__(53);
  6545. var Popover_1 = __webpack_require__(249);
  6546. var UnzonedRange_1 = __webpack_require__(5);
  6547. var ComponentFootprint_1 = __webpack_require__(12);
  6548. var EventFootprint_1 = __webpack_require__(36);
  6549. var BusinessHourRenderer_1 = __webpack_require__(56);
  6550. var StandardInteractionsMixin_1 = __webpack_require__(60);
  6551. var InteractiveDateComponent_1 = __webpack_require__(40);
  6552. var DayTableMixin_1 = __webpack_require__(55);
  6553. var DayGridEventRenderer_1 = __webpack_require__(250);
  6554. var DayGridHelperRenderer_1 = __webpack_require__(251);
  6555. var DayGridFillRenderer_1 = __webpack_require__(252);
  6556. /* A component that renders a grid of whole-days that runs horizontally. There can be multiple rows, one per week.
  6557. ----------------------------------------------------------------------------------------------------------------------*/
  6558. var DayGrid = /** @class */ (function (_super) {
  6559. tslib_1.__extends(DayGrid, _super);
  6560. function DayGrid(view) {
  6561. var _this = _super.call(this, view) || this;
  6562. _this.cellWeekNumbersVisible = false; // display week numbers in day cell?
  6563. _this.bottomCoordPadding = 0; // hack for extending the hit area for the last row of the coordinate grid
  6564. // isRigid determines whether the individual rows should ignore the contents and be a constant height.
  6565. // Relies on the view's colCnt and rowCnt. In the future, this component should probably be self-sufficient.
  6566. _this.isRigid = false;
  6567. _this.hasAllDayBusinessHours = true;
  6568. return _this;
  6569. }
  6570. // Slices up the given span (unzoned start/end with other misc data) into an array of segments
  6571. DayGrid.prototype.componentFootprintToSegs = function (componentFootprint) {
  6572. var segs = this.sliceRangeByRow(componentFootprint.unzonedRange);
  6573. var i;
  6574. var seg;
  6575. for (i = 0; i < segs.length; i++) {
  6576. seg = segs[i];
  6577. if (this.isRTL) {
  6578. seg.leftCol = this.daysPerRow - 1 - seg.lastRowDayIndex;
  6579. seg.rightCol = this.daysPerRow - 1 - seg.firstRowDayIndex;
  6580. }
  6581. else {
  6582. seg.leftCol = seg.firstRowDayIndex;
  6583. seg.rightCol = seg.lastRowDayIndex;
  6584. }
  6585. }
  6586. return segs;
  6587. };
  6588. /* Date Rendering
  6589. ------------------------------------------------------------------------------------------------------------------*/
  6590. DayGrid.prototype.renderDates = function (dateProfile) {
  6591. this.dateProfile = dateProfile;
  6592. this.updateDayTable();
  6593. this.renderGrid();
  6594. };
  6595. DayGrid.prototype.unrenderDates = function () {
  6596. this.removeSegPopover();
  6597. };
  6598. // Renders the rows and columns into the component's `this.el`, which should already be assigned.
  6599. DayGrid.prototype.renderGrid = function () {
  6600. var view = this.view;
  6601. var rowCnt = this.rowCnt;
  6602. var colCnt = this.colCnt;
  6603. var html = '';
  6604. var row;
  6605. var col;
  6606. if (this.headContainerEl) {
  6607. this.headContainerEl.html(this.renderHeadHtml());
  6608. }
  6609. for (row = 0; row < rowCnt; row++) {
  6610. html += this.renderDayRowHtml(row, this.isRigid);
  6611. }
  6612. this.el.html(html);
  6613. this.rowEls = this.el.find('.fc-row');
  6614. this.cellEls = this.el.find('.fc-day, .fc-disabled-day');
  6615. this.rowCoordCache = new CoordCache_1.default({
  6616. els: this.rowEls,
  6617. isVertical: true
  6618. });
  6619. this.colCoordCache = new CoordCache_1.default({
  6620. els: this.cellEls.slice(0, this.colCnt),
  6621. isHorizontal: true
  6622. });
  6623. // trigger dayRender with each cell's element
  6624. for (row = 0; row < rowCnt; row++) {
  6625. for (col = 0; col < colCnt; col++) {
  6626. this.publiclyTrigger('dayRender', {
  6627. context: view,
  6628. args: [
  6629. this.getCellDate(row, col),
  6630. this.getCellEl(row, col),
  6631. view
  6632. ]
  6633. });
  6634. }
  6635. }
  6636. };
  6637. // Generates the HTML for a single row, which is a div that wraps a table.
  6638. // `row` is the row number.
  6639. DayGrid.prototype.renderDayRowHtml = function (row, isRigid) {
  6640. var theme = this.view.calendar.theme;
  6641. var classes = ['fc-row', 'fc-week', theme.getClass('dayRow')];
  6642. if (isRigid) {
  6643. classes.push('fc-rigid');
  6644. }
  6645. return '' +
  6646. '<div class="' + classes.join(' ') + '">' +
  6647. '<div class="fc-bg">' +
  6648. '<table class="' + theme.getClass('tableGrid') + '">' +
  6649. this.renderBgTrHtml(row) +
  6650. '</table>' +
  6651. '</div>' +
  6652. '<div class="fc-content-skeleton">' +
  6653. '<table>' +
  6654. (this.getIsNumbersVisible() ?
  6655. '<thead>' +
  6656. this.renderNumberTrHtml(row) +
  6657. '</thead>' :
  6658. '') +
  6659. '</table>' +
  6660. '</div>' +
  6661. '</div>';
  6662. };
  6663. DayGrid.prototype.getIsNumbersVisible = function () {
  6664. return this.getIsDayNumbersVisible() || this.cellWeekNumbersVisible;
  6665. };
  6666. DayGrid.prototype.getIsDayNumbersVisible = function () {
  6667. return this.rowCnt > 1;
  6668. };
  6669. /* Grid Number Rendering
  6670. ------------------------------------------------------------------------------------------------------------------*/
  6671. DayGrid.prototype.renderNumberTrHtml = function (row) {
  6672. return '' +
  6673. '<tr>' +
  6674. (this.isRTL ? '' : this.renderNumberIntroHtml(row)) +
  6675. this.renderNumberCellsHtml(row) +
  6676. (this.isRTL ? this.renderNumberIntroHtml(row) : '') +
  6677. '</tr>';
  6678. };
  6679. DayGrid.prototype.renderNumberIntroHtml = function (row) {
  6680. return this.renderIntroHtml();
  6681. };
  6682. DayGrid.prototype.renderNumberCellsHtml = function (row) {
  6683. var htmls = [];
  6684. var col;
  6685. var date;
  6686. for (col = 0; col < this.colCnt; col++) {
  6687. date = this.getCellDate(row, col);
  6688. htmls.push(this.renderNumberCellHtml(date));
  6689. }
  6690. return htmls.join('');
  6691. };
  6692. // Generates the HTML for the <td>s of the "number" row in the DayGrid's content skeleton.
  6693. // The number row will only exist if either day numbers or week numbers are turned on.
  6694. DayGrid.prototype.renderNumberCellHtml = function (date) {
  6695. var view = this.view;
  6696. var html = '';
  6697. var isDateValid = this.dateProfile.activeUnzonedRange.containsDate(date); // TODO: called too frequently. cache somehow.
  6698. var isDayNumberVisible = this.getIsDayNumbersVisible() && isDateValid;
  6699. var classes;
  6700. var weekCalcFirstDoW;
  6701. if (!isDayNumberVisible && !this.cellWeekNumbersVisible) {
  6702. // no numbers in day cell (week number must be along the side)
  6703. return '<td/>'; // will create an empty space above events :(
  6704. }
  6705. classes = this.getDayClasses(date);
  6706. classes.unshift('fc-day-top');
  6707. if (this.cellWeekNumbersVisible) {
  6708. // To determine the day of week number change under ISO, we cannot
  6709. // rely on moment.js methods such as firstDayOfWeek() or weekday(),
  6710. // because they rely on the locale's dow (possibly overridden by
  6711. // our firstDay option), which may not be Monday. We cannot change
  6712. // dow, because that would affect the calendar start day as well.
  6713. if (date._locale._fullCalendar_weekCalc === 'ISO') {
  6714. weekCalcFirstDoW = 1; // Monday by ISO 8601 definition
  6715. }
  6716. else {
  6717. weekCalcFirstDoW = date._locale.firstDayOfWeek();
  6718. }
  6719. }
  6720. html += '<td class="' + classes.join(' ') + '"' +
  6721. (isDateValid ?
  6722. ' data-date="' + date.format() + '"' :
  6723. '') +
  6724. '>';
  6725. if (this.cellWeekNumbersVisible && (date.day() === weekCalcFirstDoW)) {
  6726. html += view.buildGotoAnchorHtml({ date: date, type: 'week' }, { 'class': 'fc-week-number' }, date.format('w') // inner HTML
  6727. );
  6728. }
  6729. if (isDayNumberVisible) {
  6730. html += view.buildGotoAnchorHtml(date, { 'class': 'fc-day-number' }, date.format('D') // inner HTML
  6731. );
  6732. }
  6733. html += '</td>';
  6734. return html;
  6735. };
  6736. /* Hit System
  6737. ------------------------------------------------------------------------------------------------------------------*/
  6738. DayGrid.prototype.prepareHits = function () {
  6739. this.colCoordCache.build();
  6740. this.rowCoordCache.build();
  6741. this.rowCoordCache.bottoms[this.rowCnt - 1] += this.bottomCoordPadding; // hack
  6742. };
  6743. DayGrid.prototype.releaseHits = function () {
  6744. this.colCoordCache.clear();
  6745. this.rowCoordCache.clear();
  6746. };
  6747. DayGrid.prototype.queryHit = function (leftOffset, topOffset) {
  6748. if (this.colCoordCache.isLeftInBounds(leftOffset) && this.rowCoordCache.isTopInBounds(topOffset)) {
  6749. var col = this.colCoordCache.getHorizontalIndex(leftOffset);
  6750. var row = this.rowCoordCache.getVerticalIndex(topOffset);
  6751. if (row != null && col != null) {
  6752. return this.getCellHit(row, col);
  6753. }
  6754. }
  6755. };
  6756. DayGrid.prototype.getHitFootprint = function (hit) {
  6757. var range = this.getCellRange(hit.row, hit.col);
  6758. return new ComponentFootprint_1.default(new UnzonedRange_1.default(range.start, range.end), true // all-day?
  6759. );
  6760. };
  6761. DayGrid.prototype.getHitEl = function (hit) {
  6762. return this.getCellEl(hit.row, hit.col);
  6763. };
  6764. /* Cell System
  6765. ------------------------------------------------------------------------------------------------------------------*/
  6766. // FYI: the first column is the leftmost column, regardless of date
  6767. DayGrid.prototype.getCellHit = function (row, col) {
  6768. return {
  6769. row: row,
  6770. col: col,
  6771. component: this,
  6772. left: this.colCoordCache.getLeftOffset(col),
  6773. right: this.colCoordCache.getRightOffset(col),
  6774. top: this.rowCoordCache.getTopOffset(row),
  6775. bottom: this.rowCoordCache.getBottomOffset(row)
  6776. };
  6777. };
  6778. DayGrid.prototype.getCellEl = function (row, col) {
  6779. return this.cellEls.eq(row * this.colCnt + col);
  6780. };
  6781. /* Event Rendering
  6782. ------------------------------------------------------------------------------------------------------------------*/
  6783. // Unrenders all events currently rendered on the grid
  6784. DayGrid.prototype.executeEventUnrender = function () {
  6785. this.removeSegPopover(); // removes the "more.." events popover
  6786. _super.prototype.executeEventUnrender.call(this);
  6787. };
  6788. // Retrieves all rendered segment objects currently rendered on the grid
  6789. DayGrid.prototype.getOwnEventSegs = function () {
  6790. // append the segments from the "more..." popover
  6791. return _super.prototype.getOwnEventSegs.call(this).concat(this.popoverSegs || []);
  6792. };
  6793. /* Event Drag Visualization
  6794. ------------------------------------------------------------------------------------------------------------------*/
  6795. // Renders a visual indication of an event or external element being dragged.
  6796. // `eventLocation` has zoned start and end (optional)
  6797. DayGrid.prototype.renderDrag = function (eventFootprints, seg, isTouch) {
  6798. var i;
  6799. for (i = 0; i < eventFootprints.length; i++) {
  6800. this.renderHighlight(eventFootprints[i].componentFootprint);
  6801. }
  6802. // render drags from OTHER components as helpers
  6803. if (eventFootprints.length && seg && seg.component !== this) {
  6804. this.helperRenderer.renderEventDraggingFootprints(eventFootprints, seg, isTouch);
  6805. return true; // signal helpers rendered
  6806. }
  6807. };
  6808. // Unrenders any visual indication of a hovering event
  6809. DayGrid.prototype.unrenderDrag = function () {
  6810. this.unrenderHighlight();
  6811. this.helperRenderer.unrender();
  6812. };
  6813. /* Event Resize Visualization
  6814. ------------------------------------------------------------------------------------------------------------------*/
  6815. // Renders a visual indication of an event being resized
  6816. DayGrid.prototype.renderEventResize = function (eventFootprints, seg, isTouch) {
  6817. var i;
  6818. for (i = 0; i < eventFootprints.length; i++) {
  6819. this.renderHighlight(eventFootprints[i].componentFootprint);
  6820. }
  6821. this.helperRenderer.renderEventResizingFootprints(eventFootprints, seg, isTouch);
  6822. };
  6823. // Unrenders a visual indication of an event being resized
  6824. DayGrid.prototype.unrenderEventResize = function () {
  6825. this.unrenderHighlight();
  6826. this.helperRenderer.unrender();
  6827. };
  6828. /* More+ Link Popover
  6829. ------------------------------------------------------------------------------------------------------------------*/
  6830. DayGrid.prototype.removeSegPopover = function () {
  6831. if (this.segPopover) {
  6832. this.segPopover.hide(); // in handler, will call segPopover's removeElement
  6833. }
  6834. };
  6835. // Limits the number of "levels" (vertically stacking layers of events) for each row of the grid.
  6836. // `levelLimit` can be false (don't limit), a number, or true (should be computed).
  6837. DayGrid.prototype.limitRows = function (levelLimit) {
  6838. var rowStructs = this.eventRenderer.rowStructs || [];
  6839. var row; // row #
  6840. var rowLevelLimit;
  6841. for (row = 0; row < rowStructs.length; row++) {
  6842. this.unlimitRow(row);
  6843. if (!levelLimit) {
  6844. rowLevelLimit = false;
  6845. }
  6846. else if (typeof levelLimit === 'number') {
  6847. rowLevelLimit = levelLimit;
  6848. }
  6849. else {
  6850. rowLevelLimit = this.computeRowLevelLimit(row);
  6851. }
  6852. if (rowLevelLimit !== false) {
  6853. this.limitRow(row, rowLevelLimit);
  6854. }
  6855. }
  6856. };
  6857. // Computes the number of levels a row will accomodate without going outside its bounds.
  6858. // Assumes the row is "rigid" (maintains a constant height regardless of what is inside).
  6859. // `row` is the row number.
  6860. DayGrid.prototype.computeRowLevelLimit = function (row) {
  6861. var rowEl = this.rowEls.eq(row); // the containing "fake" row div
  6862. var rowHeight = rowEl.height(); // TODO: cache somehow?
  6863. var trEls = this.eventRenderer.rowStructs[row].tbodyEl.children();
  6864. var i;
  6865. var trEl;
  6866. var trHeight;
  6867. function iterInnerHeights(i, childNode) {
  6868. trHeight = Math.max(trHeight, $(childNode).outerHeight());
  6869. }
  6870. // Reveal one level <tr> at a time and stop when we find one out of bounds
  6871. for (i = 0; i < trEls.length; i++) {
  6872. trEl = trEls.eq(i).removeClass('fc-limited'); // reset to original state (reveal)
  6873. // with rowspans>1 and IE8, trEl.outerHeight() would return the height of the largest cell,
  6874. // so instead, find the tallest inner content element.
  6875. trHeight = 0;
  6876. trEl.find('> td > :first-child').each(iterInnerHeights);
  6877. if (trEl.position().top + trHeight > rowHeight) {
  6878. return i;
  6879. }
  6880. }
  6881. return false; // should not limit at all
  6882. };
  6883. // Limits the given grid row to the maximum number of levels and injects "more" links if necessary.
  6884. // `row` is the row number.
  6885. // `levelLimit` is a number for the maximum (inclusive) number of levels allowed.
  6886. DayGrid.prototype.limitRow = function (row, levelLimit) {
  6887. var _this = this;
  6888. var rowStruct = this.eventRenderer.rowStructs[row];
  6889. var moreNodes = []; // array of "more" <a> links and <td> DOM nodes
  6890. var col = 0; // col #, left-to-right (not chronologically)
  6891. var levelSegs; // array of segment objects in the last allowable level, ordered left-to-right
  6892. var cellMatrix; // a matrix (by level, then column) of all <td> jQuery elements in the row
  6893. var limitedNodes; // array of temporarily hidden level <tr> and segment <td> DOM nodes
  6894. var i;
  6895. var seg;
  6896. var segsBelow; // array of segment objects below `seg` in the current `col`
  6897. var totalSegsBelow; // total number of segments below `seg` in any of the columns `seg` occupies
  6898. var colSegsBelow; // array of segment arrays, below seg, one for each column (offset from segs's first column)
  6899. var td;
  6900. var rowspan;
  6901. var segMoreNodes; // array of "more" <td> cells that will stand-in for the current seg's cell
  6902. var j;
  6903. var moreTd;
  6904. var moreWrap;
  6905. var moreLink;
  6906. // Iterates through empty level cells and places "more" links inside if need be
  6907. var emptyCellsUntil = function (endCol) {
  6908. while (col < endCol) {
  6909. segsBelow = _this.getCellSegs(row, col, levelLimit);
  6910. if (segsBelow.length) {
  6911. td = cellMatrix[levelLimit - 1][col];
  6912. moreLink = _this.renderMoreLink(row, col, segsBelow);
  6913. moreWrap = $('<div/>').append(moreLink);
  6914. td.append(moreWrap);
  6915. moreNodes.push(moreWrap[0]);
  6916. }
  6917. col++;
  6918. }
  6919. };
  6920. if (levelLimit && levelLimit < rowStruct.segLevels.length) {
  6921. levelSegs = rowStruct.segLevels[levelLimit - 1];
  6922. cellMatrix = rowStruct.cellMatrix;
  6923. limitedNodes = rowStruct.tbodyEl.children().slice(levelLimit) // get level <tr> elements past the limit
  6924. .addClass('fc-limited').get(); // hide elements and get a simple DOM-nodes array
  6925. // iterate though segments in the last allowable level
  6926. for (i = 0; i < levelSegs.length; i++) {
  6927. seg = levelSegs[i];
  6928. emptyCellsUntil(seg.leftCol); // process empty cells before the segment
  6929. // determine *all* segments below `seg` that occupy the same columns
  6930. colSegsBelow = [];
  6931. totalSegsBelow = 0;
  6932. while (col <= seg.rightCol) {
  6933. segsBelow = this.getCellSegs(row, col, levelLimit);
  6934. colSegsBelow.push(segsBelow);
  6935. totalSegsBelow += segsBelow.length;
  6936. col++;
  6937. }
  6938. if (totalSegsBelow) {
  6939. td = cellMatrix[levelLimit - 1][seg.leftCol]; // the segment's parent cell
  6940. rowspan = td.attr('rowspan') || 1;
  6941. segMoreNodes = [];
  6942. // make a replacement <td> for each column the segment occupies. will be one for each colspan
  6943. for (j = 0; j < colSegsBelow.length; j++) {
  6944. moreTd = $('<td class="fc-more-cell"/>').attr('rowspan', rowspan);
  6945. segsBelow = colSegsBelow[j];
  6946. moreLink = this.renderMoreLink(row, seg.leftCol + j, [seg].concat(segsBelow) // count seg as hidden too
  6947. );
  6948. moreWrap = $('<div/>').append(moreLink);
  6949. moreTd.append(moreWrap);
  6950. segMoreNodes.push(moreTd[0]);
  6951. moreNodes.push(moreTd[0]);
  6952. }
  6953. td.addClass('fc-limited').after($(segMoreNodes)); // hide original <td> and inject replacements
  6954. limitedNodes.push(td[0]);
  6955. }
  6956. }
  6957. emptyCellsUntil(this.colCnt); // finish off the level
  6958. rowStruct.moreEls = $(moreNodes); // for easy undoing later
  6959. rowStruct.limitedEls = $(limitedNodes); // for easy undoing later
  6960. }
  6961. };
  6962. // Reveals all levels and removes all "more"-related elements for a grid's row.
  6963. // `row` is a row number.
  6964. DayGrid.prototype.unlimitRow = function (row) {
  6965. var rowStruct = this.eventRenderer.rowStructs[row];
  6966. if (rowStruct.moreEls) {
  6967. rowStruct.moreEls.remove();
  6968. rowStruct.moreEls = null;
  6969. }
  6970. if (rowStruct.limitedEls) {
  6971. rowStruct.limitedEls.removeClass('fc-limited');
  6972. rowStruct.limitedEls = null;
  6973. }
  6974. };
  6975. // Renders an <a> element that represents hidden event element for a cell.
  6976. // Responsible for attaching click handler as well.
  6977. DayGrid.prototype.renderMoreLink = function (row, col, hiddenSegs) {
  6978. var _this = this;
  6979. var view = this.view;
  6980. return $('<a class="fc-more"/>')
  6981. .text(this.getMoreLinkText(hiddenSegs.length))
  6982. .on('click', function (ev) {
  6983. var clickOption = _this.opt('eventLimitClick');
  6984. var date = _this.getCellDate(row, col);
  6985. var moreEl = $(ev.currentTarget);
  6986. var dayEl = _this.getCellEl(row, col);
  6987. var allSegs = _this.getCellSegs(row, col);
  6988. // rescope the segments to be within the cell's date
  6989. var reslicedAllSegs = _this.resliceDaySegs(allSegs, date);
  6990. var reslicedHiddenSegs = _this.resliceDaySegs(hiddenSegs, date);
  6991. if (typeof clickOption === 'function') {
  6992. // the returned value can be an atomic option
  6993. clickOption = _this.publiclyTrigger('eventLimitClick', {
  6994. context: view,
  6995. args: [
  6996. {
  6997. date: date.clone(),
  6998. dayEl: dayEl,
  6999. moreEl: moreEl,
  7000. segs: reslicedAllSegs,
  7001. hiddenSegs: reslicedHiddenSegs
  7002. },
  7003. ev,
  7004. view
  7005. ]
  7006. });
  7007. }
  7008. if (clickOption === 'popover') {
  7009. _this.showSegPopover(row, col, moreEl, reslicedAllSegs);
  7010. }
  7011. else if (typeof clickOption === 'string') {
  7012. view.calendar.zoomTo(date, clickOption);
  7013. }
  7014. });
  7015. };
  7016. // Reveals the popover that displays all events within a cell
  7017. DayGrid.prototype.showSegPopover = function (row, col, moreLink, segs) {
  7018. var _this = this;
  7019. var view = this.view;
  7020. var moreWrap = moreLink.parent(); // the <div> wrapper around the <a>
  7021. var topEl; // the element we want to match the top coordinate of
  7022. var options;
  7023. if (this.rowCnt === 1) {
  7024. topEl = view.el; // will cause the popover to cover any sort of header
  7025. }
  7026. else {
  7027. topEl = this.rowEls.eq(row); // will align with top of row
  7028. }
  7029. options = {
  7030. className: 'fc-more-popover ' + view.calendar.theme.getClass('popover'),
  7031. content: this.renderSegPopoverContent(row, col, segs),
  7032. parentEl: view.el,
  7033. top: topEl.offset().top,
  7034. autoHide: true,
  7035. viewportConstrain: this.opt('popoverViewportConstrain'),
  7036. hide: function () {
  7037. // kill everything when the popover is hidden
  7038. // notify events to be removed
  7039. if (_this.popoverSegs) {
  7040. _this.triggerBeforeEventSegsDestroyed(_this.popoverSegs);
  7041. }
  7042. _this.segPopover.removeElement();
  7043. _this.segPopover = null;
  7044. _this.popoverSegs = null;
  7045. }
  7046. };
  7047. // Determine horizontal coordinate.
  7048. // We use the moreWrap instead of the <td> to avoid border confusion.
  7049. if (this.isRTL) {
  7050. options.right = moreWrap.offset().left + moreWrap.outerWidth() + 1; // +1 to be over cell border
  7051. }
  7052. else {
  7053. options.left = moreWrap.offset().left - 1; // -1 to be over cell border
  7054. }
  7055. this.segPopover = new Popover_1.default(options);
  7056. this.segPopover.show();
  7057. // the popover doesn't live within the grid's container element, and thus won't get the event
  7058. // delegated-handlers for free. attach event-related handlers to the popover.
  7059. this.bindAllSegHandlersToEl(this.segPopover.el);
  7060. this.triggerAfterEventSegsRendered(segs);
  7061. };
  7062. // Builds the inner DOM contents of the segment popover
  7063. DayGrid.prototype.renderSegPopoverContent = function (row, col, segs) {
  7064. var view = this.view;
  7065. var theme = view.calendar.theme;
  7066. var title = this.getCellDate(row, col).format(this.opt('dayPopoverFormat'));
  7067. var content = $('<div class="fc-header ' + theme.getClass('popoverHeader') + '">' +
  7068. '<span class="fc-close ' + theme.getIconClass('close') + '"></span>' +
  7069. '<span class="fc-title">' +
  7070. util_1.htmlEscape(title) +
  7071. '</span>' +
  7072. '<div class="fc-clear"/>' +
  7073. '</div>' +
  7074. '<div class="fc-body ' + theme.getClass('popoverContent') + '">' +
  7075. '<div class="fc-event-container"></div>' +
  7076. '</div>');
  7077. var segContainer = content.find('.fc-event-container');
  7078. var i;
  7079. // render each seg's `el` and only return the visible segs
  7080. segs = this.eventRenderer.renderFgSegEls(segs, true); // disableResizing=true
  7081. this.popoverSegs = segs;
  7082. for (i = 0; i < segs.length; i++) {
  7083. // because segments in the popover are not part of a grid coordinate system, provide a hint to any
  7084. // grids that want to do drag-n-drop about which cell it came from
  7085. this.hitsNeeded();
  7086. segs[i].hit = this.getCellHit(row, col);
  7087. this.hitsNotNeeded();
  7088. segContainer.append(segs[i].el);
  7089. }
  7090. return content;
  7091. };
  7092. // Given the events within an array of segment objects, reslice them to be in a single day
  7093. DayGrid.prototype.resliceDaySegs = function (segs, dayDate) {
  7094. var dayStart = dayDate.clone();
  7095. var dayEnd = dayStart.clone().add(1, 'days');
  7096. var dayRange = new UnzonedRange_1.default(dayStart, dayEnd);
  7097. var newSegs = [];
  7098. var i;
  7099. var seg;
  7100. var slicedRange;
  7101. for (i = 0; i < segs.length; i++) {
  7102. seg = segs[i];
  7103. slicedRange = seg.footprint.componentFootprint.unzonedRange.intersect(dayRange);
  7104. if (slicedRange) {
  7105. newSegs.push($.extend({}, seg, {
  7106. footprint: new EventFootprint_1.default(new ComponentFootprint_1.default(slicedRange, seg.footprint.componentFootprint.isAllDay), seg.footprint.eventDef, seg.footprint.eventInstance),
  7107. isStart: seg.isStart && slicedRange.isStart,
  7108. isEnd: seg.isEnd && slicedRange.isEnd
  7109. }));
  7110. }
  7111. }
  7112. // force an order because eventsToSegs doesn't guarantee one
  7113. // TODO: research if still needed
  7114. this.eventRenderer.sortEventSegs(newSegs);
  7115. return newSegs;
  7116. };
  7117. // Generates the text that should be inside a "more" link, given the number of events it represents
  7118. DayGrid.prototype.getMoreLinkText = function (num) {
  7119. var opt = this.opt('eventLimitText');
  7120. if (typeof opt === 'function') {
  7121. return opt(num);
  7122. }
  7123. else {
  7124. return '+' + num + ' ' + opt;
  7125. }
  7126. };
  7127. // Returns segments within a given cell.
  7128. // If `startLevel` is specified, returns only events including and below that level. Otherwise returns all segs.
  7129. DayGrid.prototype.getCellSegs = function (row, col, startLevel) {
  7130. var segMatrix = this.eventRenderer.rowStructs[row].segMatrix;
  7131. var level = startLevel || 0;
  7132. var segs = [];
  7133. var seg;
  7134. while (level < segMatrix.length) {
  7135. seg = segMatrix[level][col];
  7136. if (seg) {
  7137. segs.push(seg);
  7138. }
  7139. level++;
  7140. }
  7141. return segs;
  7142. };
  7143. return DayGrid;
  7144. }(InteractiveDateComponent_1.default));
  7145. exports.default = DayGrid;
  7146. DayGrid.prototype.eventRendererClass = DayGridEventRenderer_1.default;
  7147. DayGrid.prototype.businessHourRendererClass = BusinessHourRenderer_1.default;
  7148. DayGrid.prototype.helperRendererClass = DayGridHelperRenderer_1.default;
  7149. DayGrid.prototype.fillRendererClass = DayGridFillRenderer_1.default;
  7150. StandardInteractionsMixin_1.default.mixInto(DayGrid);
  7151. DayTableMixin_1.default.mixInto(DayGrid);
  7152. /***/ }),
  7153. /* 62 */
  7154. /***/ (function(module, exports, __webpack_require__) {
  7155. Object.defineProperty(exports, "__esModule", { value: true });
  7156. var tslib_1 = __webpack_require__(2);
  7157. var $ = __webpack_require__(3);
  7158. var util_1 = __webpack_require__(4);
  7159. var Scroller_1 = __webpack_require__(39);
  7160. var View_1 = __webpack_require__(41);
  7161. var BasicViewDateProfileGenerator_1 = __webpack_require__(228);
  7162. var DayGrid_1 = __webpack_require__(61);
  7163. /* An abstract class for the "basic" views, as well as month view. Renders one or more rows of day cells.
  7164. ----------------------------------------------------------------------------------------------------------------------*/
  7165. // It is a manager for a DayGrid subcomponent, which does most of the heavy lifting.
  7166. // It is responsible for managing width/height.
  7167. var BasicView = /** @class */ (function (_super) {
  7168. tslib_1.__extends(BasicView, _super);
  7169. function BasicView(calendar, viewSpec) {
  7170. var _this = _super.call(this, calendar, viewSpec) || this;
  7171. _this.dayGrid = _this.instantiateDayGrid();
  7172. _this.dayGrid.isRigid = _this.hasRigidRows();
  7173. if (_this.opt('weekNumbers')) {
  7174. if (_this.opt('weekNumbersWithinDays')) {
  7175. _this.dayGrid.cellWeekNumbersVisible = true;
  7176. _this.dayGrid.colWeekNumbersVisible = false;
  7177. }
  7178. else {
  7179. _this.dayGrid.cellWeekNumbersVisible = false;
  7180. _this.dayGrid.colWeekNumbersVisible = true;
  7181. }
  7182. }
  7183. _this.addChild(_this.dayGrid);
  7184. _this.scroller = new Scroller_1.default({
  7185. overflowX: 'hidden',
  7186. overflowY: 'auto'
  7187. });
  7188. return _this;
  7189. }
  7190. // Generates the DayGrid object this view needs. Draws from this.dayGridClass
  7191. BasicView.prototype.instantiateDayGrid = function () {
  7192. // generate a subclass on the fly with BasicView-specific behavior
  7193. // TODO: cache this subclass
  7194. var subclass = makeDayGridSubclass(this.dayGridClass);
  7195. return new subclass(this);
  7196. };
  7197. BasicView.prototype.executeDateRender = function (dateProfile) {
  7198. this.dayGrid.breakOnWeeks = /year|month|week/.test(dateProfile.currentRangeUnit);
  7199. _super.prototype.executeDateRender.call(this, dateProfile);
  7200. };
  7201. BasicView.prototype.renderSkeleton = function () {
  7202. var dayGridContainerEl;
  7203. var dayGridEl;
  7204. this.el.addClass('fc-basic-view').html(this.renderSkeletonHtml());
  7205. this.scroller.render();
  7206. dayGridContainerEl = this.scroller.el.addClass('fc-day-grid-container');
  7207. dayGridEl = $('<div class="fc-day-grid" />').appendTo(dayGridContainerEl);
  7208. this.el.find('.fc-body > tr > td').append(dayGridContainerEl);
  7209. this.dayGrid.headContainerEl = this.el.find('.fc-head-container');
  7210. this.dayGrid.setElement(dayGridEl);
  7211. };
  7212. BasicView.prototype.unrenderSkeleton = function () {
  7213. this.dayGrid.removeElement();
  7214. this.scroller.destroy();
  7215. };
  7216. // Builds the HTML skeleton for the view.
  7217. // The day-grid component will render inside of a container defined by this HTML.
  7218. BasicView.prototype.renderSkeletonHtml = function () {
  7219. var theme = this.calendar.theme;
  7220. return '' +
  7221. '<table class="' + theme.getClass('tableGrid') + '">' +
  7222. (this.opt('columnHeader') ?
  7223. '<thead class="fc-head">' +
  7224. '<tr>' +
  7225. '<td class="fc-head-container ' + theme.getClass('widgetHeader') + '">&nbsp;</td>' +
  7226. '</tr>' +
  7227. '</thead>' :
  7228. '') +
  7229. '<tbody class="fc-body">' +
  7230. '<tr>' +
  7231. '<td class="' + theme.getClass('widgetContent') + '"></td>' +
  7232. '</tr>' +
  7233. '</tbody>' +
  7234. '</table>';
  7235. };
  7236. // Generates an HTML attribute string for setting the width of the week number column, if it is known
  7237. BasicView.prototype.weekNumberStyleAttr = function () {
  7238. if (this.weekNumberWidth != null) {
  7239. return 'style="width:' + this.weekNumberWidth + 'px"';
  7240. }
  7241. return '';
  7242. };
  7243. // Determines whether each row should have a constant height
  7244. BasicView.prototype.hasRigidRows = function () {
  7245. var eventLimit = this.opt('eventLimit');
  7246. return eventLimit && typeof eventLimit !== 'number';
  7247. };
  7248. /* Dimensions
  7249. ------------------------------------------------------------------------------------------------------------------*/
  7250. // Refreshes the horizontal dimensions of the view
  7251. BasicView.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  7252. var eventLimit = this.opt('eventLimit');
  7253. var headRowEl = this.dayGrid.headContainerEl.find('.fc-row');
  7254. var scrollerHeight;
  7255. var scrollbarWidths;
  7256. // hack to give the view some height prior to dayGrid's columns being rendered
  7257. // TODO: separate setting height from scroller VS dayGrid.
  7258. if (!this.dayGrid.rowEls) {
  7259. if (!isAuto) {
  7260. scrollerHeight = this.computeScrollerHeight(totalHeight);
  7261. this.scroller.setHeight(scrollerHeight);
  7262. }
  7263. return;
  7264. }
  7265. _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
  7266. if (this.dayGrid.colWeekNumbersVisible) {
  7267. // Make sure all week number cells running down the side have the same width.
  7268. // Record the width for cells created later.
  7269. this.weekNumberWidth = util_1.matchCellWidths(this.el.find('.fc-week-number'));
  7270. }
  7271. // reset all heights to be natural
  7272. this.scroller.clear();
  7273. util_1.uncompensateScroll(headRowEl);
  7274. this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed
  7275. // is the event limit a constant level number?
  7276. if (eventLimit && typeof eventLimit === 'number') {
  7277. this.dayGrid.limitRows(eventLimit); // limit the levels first so the height can redistribute after
  7278. }
  7279. // distribute the height to the rows
  7280. // (totalHeight is a "recommended" value if isAuto)
  7281. scrollerHeight = this.computeScrollerHeight(totalHeight);
  7282. this.setGridHeight(scrollerHeight, isAuto);
  7283. // is the event limit dynamically calculated?
  7284. if (eventLimit && typeof eventLimit !== 'number') {
  7285. this.dayGrid.limitRows(eventLimit); // limit the levels after the grid's row heights have been set
  7286. }
  7287. if (!isAuto) {
  7288. this.scroller.setHeight(scrollerHeight);
  7289. scrollbarWidths = this.scroller.getScrollbarWidths();
  7290. if (scrollbarWidths.left || scrollbarWidths.right) {
  7291. util_1.compensateScroll(headRowEl, scrollbarWidths);
  7292. // doing the scrollbar compensation might have created text overflow which created more height. redo
  7293. scrollerHeight = this.computeScrollerHeight(totalHeight);
  7294. this.scroller.setHeight(scrollerHeight);
  7295. }
  7296. // guarantees the same scrollbar widths
  7297. this.scroller.lockOverflow(scrollbarWidths);
  7298. }
  7299. };
  7300. // given a desired total height of the view, returns what the height of the scroller should be
  7301. BasicView.prototype.computeScrollerHeight = function (totalHeight) {
  7302. return totalHeight -
  7303. util_1.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
  7304. };
  7305. // Sets the height of just the DayGrid component in this view
  7306. BasicView.prototype.setGridHeight = function (height, isAuto) {
  7307. if (isAuto) {
  7308. util_1.undistributeHeight(this.dayGrid.rowEls); // let the rows be their natural height with no expanding
  7309. }
  7310. else {
  7311. util_1.distributeHeight(this.dayGrid.rowEls, height, true); // true = compensate for height-hogging rows
  7312. }
  7313. };
  7314. /* Scroll
  7315. ------------------------------------------------------------------------------------------------------------------*/
  7316. BasicView.prototype.computeInitialDateScroll = function () {
  7317. return { top: 0 };
  7318. };
  7319. BasicView.prototype.queryDateScroll = function () {
  7320. return { top: this.scroller.getScrollTop() };
  7321. };
  7322. BasicView.prototype.applyDateScroll = function (scroll) {
  7323. if (scroll.top !== undefined) {
  7324. this.scroller.setScrollTop(scroll.top);
  7325. }
  7326. };
  7327. return BasicView;
  7328. }(View_1.default));
  7329. exports.default = BasicView;
  7330. BasicView.prototype.dateProfileGeneratorClass = BasicViewDateProfileGenerator_1.default;
  7331. BasicView.prototype.dayGridClass = DayGrid_1.default;
  7332. // customize the rendering behavior of BasicView's dayGrid
  7333. function makeDayGridSubclass(SuperClass) {
  7334. return /** @class */ (function (_super) {
  7335. tslib_1.__extends(SubClass, _super);
  7336. function SubClass() {
  7337. var _this = _super !== null && _super.apply(this, arguments) || this;
  7338. _this.colWeekNumbersVisible = false; // display week numbers along the side?
  7339. return _this;
  7340. }
  7341. // Generates the HTML that will go before the day-of week header cells
  7342. SubClass.prototype.renderHeadIntroHtml = function () {
  7343. var view = this.view;
  7344. if (this.colWeekNumbersVisible) {
  7345. return '' +
  7346. '<th class="fc-week-number ' + view.calendar.theme.getClass('widgetHeader') + '" ' + view.weekNumberStyleAttr() + '>' +
  7347. '<span>' + // needed for matchCellWidths
  7348. util_1.htmlEscape(this.opt('weekNumberTitle')) +
  7349. '</span>' +
  7350. '</th>';
  7351. }
  7352. return '';
  7353. };
  7354. // Generates the HTML that will go before content-skeleton cells that display the day/week numbers
  7355. SubClass.prototype.renderNumberIntroHtml = function (row) {
  7356. var view = this.view;
  7357. var weekStart = this.getCellDate(row, 0);
  7358. if (this.colWeekNumbersVisible) {
  7359. return '' +
  7360. '<td class="fc-week-number" ' + view.weekNumberStyleAttr() + '>' +
  7361. view.buildGotoAnchorHtml(// aside from link, important for matchCellWidths
  7362. { date: weekStart, type: 'week', forceOff: this.colCnt === 1 }, weekStart.format('w') // inner HTML
  7363. ) +
  7364. '</td>';
  7365. }
  7366. return '';
  7367. };
  7368. // Generates the HTML that goes before the day bg cells for each day-row
  7369. SubClass.prototype.renderBgIntroHtml = function () {
  7370. var view = this.view;
  7371. if (this.colWeekNumbersVisible) {
  7372. return '<td class="fc-week-number ' + view.calendar.theme.getClass('widgetContent') + '" ' +
  7373. view.weekNumberStyleAttr() + '></td>';
  7374. }
  7375. return '';
  7376. };
  7377. // Generates the HTML that goes before every other type of row generated by DayGrid.
  7378. // Affects helper-skeleton and highlight-skeleton rows.
  7379. SubClass.prototype.renderIntroHtml = function () {
  7380. var view = this.view;
  7381. if (this.colWeekNumbersVisible) {
  7382. return '<td class="fc-week-number" ' + view.weekNumberStyleAttr() + '></td>';
  7383. }
  7384. return '';
  7385. };
  7386. SubClass.prototype.getIsNumbersVisible = function () {
  7387. return DayGrid_1.default.prototype.getIsNumbersVisible.apply(this, arguments) || this.colWeekNumbersVisible;
  7388. };
  7389. return SubClass;
  7390. }(SuperClass));
  7391. }
  7392. /***/ }),
  7393. /* 63 */,
  7394. /* 64 */,
  7395. /* 65 */,
  7396. /* 66 */,
  7397. /* 67 */,
  7398. /* 68 */,
  7399. /* 69 */,
  7400. /* 70 */,
  7401. /* 71 */,
  7402. /* 72 */,
  7403. /* 73 */,
  7404. /* 74 */,
  7405. /* 75 */,
  7406. /* 76 */,
  7407. /* 77 */,
  7408. /* 78 */,
  7409. /* 79 */,
  7410. /* 80 */,
  7411. /* 81 */,
  7412. /* 82 */,
  7413. /* 83 */,
  7414. /* 84 */,
  7415. /* 85 */,
  7416. /* 86 */,
  7417. /* 87 */,
  7418. /* 88 */,
  7419. /* 89 */,
  7420. /* 90 */,
  7421. /* 91 */,
  7422. /* 92 */,
  7423. /* 93 */,
  7424. /* 94 */,
  7425. /* 95 */,
  7426. /* 96 */,
  7427. /* 97 */,
  7428. /* 98 */,
  7429. /* 99 */,
  7430. /* 100 */,
  7431. /* 101 */,
  7432. /* 102 */,
  7433. /* 103 */,
  7434. /* 104 */,
  7435. /* 105 */,
  7436. /* 106 */,
  7437. /* 107 */,
  7438. /* 108 */,
  7439. /* 109 */,
  7440. /* 110 */,
  7441. /* 111 */,
  7442. /* 112 */,
  7443. /* 113 */,
  7444. /* 114 */,
  7445. /* 115 */,
  7446. /* 116 */,
  7447. /* 117 */,
  7448. /* 118 */,
  7449. /* 119 */,
  7450. /* 120 */,
  7451. /* 121 */,
  7452. /* 122 */,
  7453. /* 123 */,
  7454. /* 124 */,
  7455. /* 125 */,
  7456. /* 126 */,
  7457. /* 127 */,
  7458. /* 128 */,
  7459. /* 129 */,
  7460. /* 130 */,
  7461. /* 131 */,
  7462. /* 132 */,
  7463. /* 133 */,
  7464. /* 134 */,
  7465. /* 135 */,
  7466. /* 136 */,
  7467. /* 137 */,
  7468. /* 138 */,
  7469. /* 139 */,
  7470. /* 140 */,
  7471. /* 141 */,
  7472. /* 142 */,
  7473. /* 143 */,
  7474. /* 144 */,
  7475. /* 145 */,
  7476. /* 146 */,
  7477. /* 147 */,
  7478. /* 148 */,
  7479. /* 149 */,
  7480. /* 150 */,
  7481. /* 151 */,
  7482. /* 152 */,
  7483. /* 153 */,
  7484. /* 154 */,
  7485. /* 155 */,
  7486. /* 156 */,
  7487. /* 157 */,
  7488. /* 158 */,
  7489. /* 159 */,
  7490. /* 160 */,
  7491. /* 161 */,
  7492. /* 162 */,
  7493. /* 163 */,
  7494. /* 164 */,
  7495. /* 165 */,
  7496. /* 166 */,
  7497. /* 167 */,
  7498. /* 168 */,
  7499. /* 169 */,
  7500. /* 170 */,
  7501. /* 171 */,
  7502. /* 172 */,
  7503. /* 173 */,
  7504. /* 174 */,
  7505. /* 175 */,
  7506. /* 176 */,
  7507. /* 177 */,
  7508. /* 178 */,
  7509. /* 179 */,
  7510. /* 180 */,
  7511. /* 181 */,
  7512. /* 182 */,
  7513. /* 183 */,
  7514. /* 184 */,
  7515. /* 185 */,
  7516. /* 186 */,
  7517. /* 187 */,
  7518. /* 188 */,
  7519. /* 189 */,
  7520. /* 190 */,
  7521. /* 191 */,
  7522. /* 192 */,
  7523. /* 193 */,
  7524. /* 194 */,
  7525. /* 195 */,
  7526. /* 196 */,
  7527. /* 197 */,
  7528. /* 198 */,
  7529. /* 199 */,
  7530. /* 200 */,
  7531. /* 201 */,
  7532. /* 202 */,
  7533. /* 203 */,
  7534. /* 204 */,
  7535. /* 205 */,
  7536. /* 206 */,
  7537. /* 207 */
  7538. /***/ (function(module, exports, __webpack_require__) {
  7539. Object.defineProperty(exports, "__esModule", { value: true });
  7540. var UnzonedRange_1 = __webpack_require__(5);
  7541. var ComponentFootprint_1 = __webpack_require__(12);
  7542. var EventDefParser_1 = __webpack_require__(49);
  7543. var EventSource_1 = __webpack_require__(6);
  7544. var util_1 = __webpack_require__(35);
  7545. var Constraints = /** @class */ (function () {
  7546. function Constraints(eventManager, _calendar) {
  7547. this.eventManager = eventManager;
  7548. this._calendar = _calendar;
  7549. }
  7550. Constraints.prototype.opt = function (name) {
  7551. return this._calendar.opt(name);
  7552. };
  7553. /*
  7554. determines if eventInstanceGroup is allowed,
  7555. in relation to other EVENTS and business hours.
  7556. */
  7557. Constraints.prototype.isEventInstanceGroupAllowed = function (eventInstanceGroup) {
  7558. var eventDef = eventInstanceGroup.getEventDef();
  7559. var eventFootprints = this.eventRangesToEventFootprints(eventInstanceGroup.getAllEventRanges());
  7560. var i;
  7561. var peerEventInstances = this.getPeerEventInstances(eventDef);
  7562. var peerEventRanges = peerEventInstances.map(util_1.eventInstanceToEventRange);
  7563. var peerEventFootprints = this.eventRangesToEventFootprints(peerEventRanges);
  7564. var constraintVal = eventDef.getConstraint();
  7565. var overlapVal = eventDef.getOverlap();
  7566. var eventAllowFunc = this.opt('eventAllow');
  7567. for (i = 0; i < eventFootprints.length; i++) {
  7568. if (!this.isFootprintAllowed(eventFootprints[i].componentFootprint, peerEventFootprints, constraintVal, overlapVal, eventFootprints[i].eventInstance)) {
  7569. return false;
  7570. }
  7571. }
  7572. if (eventAllowFunc) {
  7573. for (i = 0; i < eventFootprints.length; i++) {
  7574. if (eventAllowFunc(eventFootprints[i].componentFootprint.toLegacy(this._calendar), eventFootprints[i].getEventLegacy()) === false) {
  7575. return false;
  7576. }
  7577. }
  7578. }
  7579. return true;
  7580. };
  7581. Constraints.prototype.getPeerEventInstances = function (eventDef) {
  7582. return this.eventManager.getEventInstancesWithoutId(eventDef.id);
  7583. };
  7584. Constraints.prototype.isSelectionFootprintAllowed = function (componentFootprint) {
  7585. var peerEventInstances = this.eventManager.getEventInstances();
  7586. var peerEventRanges = peerEventInstances.map(util_1.eventInstanceToEventRange);
  7587. var peerEventFootprints = this.eventRangesToEventFootprints(peerEventRanges);
  7588. var selectAllowFunc;
  7589. if (this.isFootprintAllowed(componentFootprint, peerEventFootprints, this.opt('selectConstraint'), this.opt('selectOverlap'))) {
  7590. selectAllowFunc = this.opt('selectAllow');
  7591. if (selectAllowFunc) {
  7592. return selectAllowFunc(componentFootprint.toLegacy(this._calendar)) !== false;
  7593. }
  7594. else {
  7595. return true;
  7596. }
  7597. }
  7598. return false;
  7599. };
  7600. Constraints.prototype.isFootprintAllowed = function (componentFootprint, peerEventFootprints, constraintVal, overlapVal, subjectEventInstance // optional
  7601. ) {
  7602. var constraintFootprints; // ComponentFootprint[]
  7603. var overlapEventFootprints; // EventFootprint[]
  7604. if (constraintVal != null) {
  7605. constraintFootprints = this.constraintValToFootprints(constraintVal, componentFootprint.isAllDay);
  7606. if (!this.isFootprintWithinConstraints(componentFootprint, constraintFootprints)) {
  7607. return false;
  7608. }
  7609. }
  7610. overlapEventFootprints = this.collectOverlapEventFootprints(peerEventFootprints, componentFootprint);
  7611. if (overlapVal === false) {
  7612. if (overlapEventFootprints.length) {
  7613. return false;
  7614. }
  7615. }
  7616. else if (typeof overlapVal === 'function') {
  7617. if (!isOverlapsAllowedByFunc(overlapEventFootprints, overlapVal, subjectEventInstance)) {
  7618. return false;
  7619. }
  7620. }
  7621. if (subjectEventInstance) {
  7622. if (!isOverlapEventInstancesAllowed(overlapEventFootprints, subjectEventInstance)) {
  7623. return false;
  7624. }
  7625. }
  7626. return true;
  7627. };
  7628. // Constraint
  7629. // ------------------------------------------------------------------------------------------------
  7630. Constraints.prototype.isFootprintWithinConstraints = function (componentFootprint, constraintFootprints) {
  7631. var i;
  7632. for (i = 0; i < constraintFootprints.length; i++) {
  7633. if (this.footprintContainsFootprint(constraintFootprints[i], componentFootprint)) {
  7634. return true;
  7635. }
  7636. }
  7637. return false;
  7638. };
  7639. Constraints.prototype.constraintValToFootprints = function (constraintVal, isAllDay) {
  7640. var eventInstances;
  7641. if (constraintVal === 'businessHours') {
  7642. return this.buildCurrentBusinessFootprints(isAllDay);
  7643. }
  7644. else if (typeof constraintVal === 'object') {
  7645. eventInstances = this.parseEventDefToInstances(constraintVal); // handles recurring events
  7646. if (!eventInstances) {
  7647. return this.parseFootprints(constraintVal);
  7648. }
  7649. else {
  7650. return this.eventInstancesToFootprints(eventInstances);
  7651. }
  7652. }
  7653. else if (constraintVal != null) {
  7654. eventInstances = this.eventManager.getEventInstancesWithId(constraintVal);
  7655. return this.eventInstancesToFootprints(eventInstances);
  7656. }
  7657. };
  7658. // returns ComponentFootprint[]
  7659. // uses current view's range
  7660. Constraints.prototype.buildCurrentBusinessFootprints = function (isAllDay) {
  7661. var view = this._calendar.view;
  7662. var businessHourGenerator = view.get('businessHourGenerator');
  7663. var unzonedRange = view.dateProfile.activeUnzonedRange;
  7664. var eventInstanceGroup = businessHourGenerator.buildEventInstanceGroup(isAllDay, unzonedRange);
  7665. if (eventInstanceGroup) {
  7666. return this.eventInstancesToFootprints(eventInstanceGroup.eventInstances);
  7667. }
  7668. else {
  7669. return [];
  7670. }
  7671. };
  7672. // conversion util
  7673. Constraints.prototype.eventInstancesToFootprints = function (eventInstances) {
  7674. var eventRanges = eventInstances.map(util_1.eventInstanceToEventRange);
  7675. var eventFootprints = this.eventRangesToEventFootprints(eventRanges);
  7676. return eventFootprints.map(util_1.eventFootprintToComponentFootprint);
  7677. };
  7678. // Overlap
  7679. // ------------------------------------------------------------------------------------------------
  7680. Constraints.prototype.collectOverlapEventFootprints = function (peerEventFootprints, targetFootprint) {
  7681. var overlapEventFootprints = [];
  7682. var i;
  7683. for (i = 0; i < peerEventFootprints.length; i++) {
  7684. if (this.footprintsIntersect(targetFootprint, peerEventFootprints[i].componentFootprint)) {
  7685. overlapEventFootprints.push(peerEventFootprints[i]);
  7686. }
  7687. }
  7688. return overlapEventFootprints;
  7689. };
  7690. // Conversion: eventDefs -> eventInstances -> eventRanges -> eventFootprints -> componentFootprints
  7691. // ------------------------------------------------------------------------------------------------
  7692. // NOTE: this might seem like repetitive code with the Grid class, however, this code is related to
  7693. // constraints whereas the Grid code is related to rendering. Each approach might want to convert
  7694. // eventRanges -> eventFootprints in a different way. Regardless, there are opportunities to make
  7695. // this more DRY.
  7696. /*
  7697. Returns false on invalid input.
  7698. */
  7699. Constraints.prototype.parseEventDefToInstances = function (eventInput) {
  7700. var eventManager = this.eventManager;
  7701. var eventDef = EventDefParser_1.default.parse(eventInput, new EventSource_1.default(this._calendar));
  7702. if (!eventDef) {
  7703. return false;
  7704. }
  7705. return eventDef.buildInstances(eventManager.currentPeriod.unzonedRange);
  7706. };
  7707. Constraints.prototype.eventRangesToEventFootprints = function (eventRanges) {
  7708. var i;
  7709. var eventFootprints = [];
  7710. for (i = 0; i < eventRanges.length; i++) {
  7711. eventFootprints.push.apply(// footprints
  7712. eventFootprints, this.eventRangeToEventFootprints(eventRanges[i]));
  7713. }
  7714. return eventFootprints;
  7715. };
  7716. Constraints.prototype.eventRangeToEventFootprints = function (eventRange) {
  7717. return [util_1.eventRangeToEventFootprint(eventRange)];
  7718. };
  7719. /*
  7720. Parses footprints directly.
  7721. Very similar to EventDateProfile::parse :(
  7722. */
  7723. Constraints.prototype.parseFootprints = function (rawInput) {
  7724. var start;
  7725. var end;
  7726. if (rawInput.start) {
  7727. start = this._calendar.moment(rawInput.start);
  7728. if (!start.isValid()) {
  7729. start = null;
  7730. }
  7731. }
  7732. if (rawInput.end) {
  7733. end = this._calendar.moment(rawInput.end);
  7734. if (!end.isValid()) {
  7735. end = null;
  7736. }
  7737. }
  7738. return [
  7739. new ComponentFootprint_1.default(new UnzonedRange_1.default(start, end), (start && !start.hasTime()) || (end && !end.hasTime()) // isAllDay
  7740. )
  7741. ];
  7742. };
  7743. // Footprint Utils
  7744. // ----------------------------------------------------------------------------------------
  7745. Constraints.prototype.footprintContainsFootprint = function (outerFootprint, innerFootprint) {
  7746. return outerFootprint.unzonedRange.containsRange(innerFootprint.unzonedRange);
  7747. };
  7748. Constraints.prototype.footprintsIntersect = function (footprint0, footprint1) {
  7749. return footprint0.unzonedRange.intersectsWith(footprint1.unzonedRange);
  7750. };
  7751. return Constraints;
  7752. }());
  7753. exports.default = Constraints;
  7754. // optional subjectEventInstance
  7755. function isOverlapsAllowedByFunc(overlapEventFootprints, overlapFunc, subjectEventInstance) {
  7756. var i;
  7757. for (i = 0; i < overlapEventFootprints.length; i++) {
  7758. if (!overlapFunc(overlapEventFootprints[i].eventInstance.toLegacy(), subjectEventInstance ? subjectEventInstance.toLegacy() : null)) {
  7759. return false;
  7760. }
  7761. }
  7762. return true;
  7763. }
  7764. function isOverlapEventInstancesAllowed(overlapEventFootprints, subjectEventInstance) {
  7765. var subjectLegacyInstance = subjectEventInstance.toLegacy();
  7766. var i;
  7767. var overlapEventInstance;
  7768. var overlapEventDef;
  7769. var overlapVal;
  7770. for (i = 0; i < overlapEventFootprints.length; i++) {
  7771. overlapEventInstance = overlapEventFootprints[i].eventInstance;
  7772. overlapEventDef = overlapEventInstance.def;
  7773. // don't need to pass in calendar, because don't want to consider global eventOverlap property,
  7774. // because we already considered that earlier in the process.
  7775. overlapVal = overlapEventDef.getOverlap();
  7776. if (overlapVal === false) {
  7777. return false;
  7778. }
  7779. else if (typeof overlapVal === 'function') {
  7780. if (!overlapVal(overlapEventInstance.toLegacy(), subjectLegacyInstance)) {
  7781. return false;
  7782. }
  7783. }
  7784. }
  7785. return true;
  7786. }
  7787. /***/ }),
  7788. /* 208 */
  7789. /***/ (function(module, exports, __webpack_require__) {
  7790. /*
  7791. USAGE:
  7792. import { default as ParsableModelMixin, ParsableModelInterface } from './ParsableModelMixin'
  7793. in class:
  7794. applyProps: ParsableModelInterface['applyProps']
  7795. applyManualStandardProps: ParsableModelInterface['applyManualStandardProps']
  7796. applyMiscProps: ParsableModelInterface['applyMiscProps']
  7797. isStandardProp: ParsableModelInterface['isStandardProp']
  7798. static defineStandardProps = ParsableModelMixin.defineStandardProps
  7799. static copyVerbatimStandardProps = ParsableModelMixin.copyVerbatimStandardProps
  7800. after class:
  7801. ParsableModelMixin.mixInto(TheClass)
  7802. */
  7803. Object.defineProperty(exports, "__esModule", { value: true });
  7804. var tslib_1 = __webpack_require__(2);
  7805. var util_1 = __webpack_require__(4);
  7806. var Mixin_1 = __webpack_require__(14);
  7807. var ParsableModelMixin = /** @class */ (function (_super) {
  7808. tslib_1.__extends(ParsableModelMixin, _super);
  7809. function ParsableModelMixin() {
  7810. return _super !== null && _super.apply(this, arguments) || this;
  7811. }
  7812. ParsableModelMixin.defineStandardProps = function (propDefs) {
  7813. var proto = this.prototype;
  7814. if (!proto.hasOwnProperty('standardPropMap')) {
  7815. proto.standardPropMap = Object.create(proto.standardPropMap);
  7816. }
  7817. util_1.copyOwnProps(propDefs, proto.standardPropMap);
  7818. };
  7819. ParsableModelMixin.copyVerbatimStandardProps = function (src, dest) {
  7820. var map = this.prototype.standardPropMap;
  7821. var propName;
  7822. for (propName in map) {
  7823. if (src[propName] != null && // in the src object?
  7824. map[propName] === true // false means "copy verbatim"
  7825. ) {
  7826. dest[propName] = src[propName];
  7827. }
  7828. }
  7829. };
  7830. /*
  7831. Returns true/false for success.
  7832. Meant to be only called ONCE, at object creation.
  7833. */
  7834. ParsableModelMixin.prototype.applyProps = function (rawProps) {
  7835. var standardPropMap = this.standardPropMap;
  7836. var manualProps = {};
  7837. var miscProps = {};
  7838. var propName;
  7839. for (propName in rawProps) {
  7840. if (standardPropMap[propName] === true) {
  7841. this[propName] = rawProps[propName];
  7842. }
  7843. else if (standardPropMap[propName] === false) {
  7844. manualProps[propName] = rawProps[propName];
  7845. }
  7846. else {
  7847. miscProps[propName] = rawProps[propName];
  7848. }
  7849. }
  7850. this.applyMiscProps(miscProps);
  7851. return this.applyManualStandardProps(manualProps);
  7852. };
  7853. /*
  7854. If subclasses override, they must call this supermethod and return the boolean response.
  7855. Meant to be only called ONCE, at object creation.
  7856. */
  7857. ParsableModelMixin.prototype.applyManualStandardProps = function (rawProps) {
  7858. return true;
  7859. };
  7860. /*
  7861. Can be called even after initial object creation.
  7862. */
  7863. ParsableModelMixin.prototype.applyMiscProps = function (rawProps) {
  7864. // subclasses can implement
  7865. };
  7866. /*
  7867. TODO: why is this a method when defineStandardProps is static
  7868. */
  7869. ParsableModelMixin.prototype.isStandardProp = function (propName) {
  7870. return propName in this.standardPropMap;
  7871. };
  7872. return ParsableModelMixin;
  7873. }(Mixin_1.default));
  7874. exports.default = ParsableModelMixin;
  7875. ParsableModelMixin.prototype.standardPropMap = {}; // will be cloned by defineStandardProps
  7876. /***/ }),
  7877. /* 209 */
  7878. /***/ (function(module, exports) {
  7879. Object.defineProperty(exports, "__esModule", { value: true });
  7880. var EventInstance = /** @class */ (function () {
  7881. function EventInstance(def, dateProfile) {
  7882. this.def = def;
  7883. this.dateProfile = dateProfile;
  7884. }
  7885. EventInstance.prototype.toLegacy = function () {
  7886. var dateProfile = this.dateProfile;
  7887. var obj = this.def.toLegacy();
  7888. obj.start = dateProfile.start.clone();
  7889. obj.end = dateProfile.end ? dateProfile.end.clone() : null;
  7890. return obj;
  7891. };
  7892. return EventInstance;
  7893. }());
  7894. exports.default = EventInstance;
  7895. /***/ }),
  7896. /* 210 */
  7897. /***/ (function(module, exports, __webpack_require__) {
  7898. Object.defineProperty(exports, "__esModule", { value: true });
  7899. var tslib_1 = __webpack_require__(2);
  7900. var $ = __webpack_require__(3);
  7901. var moment = __webpack_require__(0);
  7902. var EventDef_1 = __webpack_require__(34);
  7903. var EventInstance_1 = __webpack_require__(209);
  7904. var EventDateProfile_1 = __webpack_require__(17);
  7905. var RecurringEventDef = /** @class */ (function (_super) {
  7906. tslib_1.__extends(RecurringEventDef, _super);
  7907. function RecurringEventDef() {
  7908. return _super !== null && _super.apply(this, arguments) || this;
  7909. }
  7910. RecurringEventDef.prototype.isAllDay = function () {
  7911. return !this.startTime && !this.endTime;
  7912. };
  7913. RecurringEventDef.prototype.buildInstances = function (unzonedRange) {
  7914. var calendar = this.source.calendar;
  7915. var unzonedDate = unzonedRange.getStart();
  7916. var unzonedEnd = unzonedRange.getEnd();
  7917. var zonedDayStart;
  7918. var instanceStart;
  7919. var instanceEnd;
  7920. var instances = [];
  7921. while (unzonedDate.isBefore(unzonedEnd)) {
  7922. // if everyday, or this particular day-of-week
  7923. if (!this.dowHash || this.dowHash[unzonedDate.day()]) {
  7924. zonedDayStart = calendar.applyTimezone(unzonedDate);
  7925. instanceStart = zonedDayStart.clone();
  7926. instanceEnd = null;
  7927. if (this.startTime) {
  7928. instanceStart.time(this.startTime);
  7929. }
  7930. else {
  7931. instanceStart.stripTime();
  7932. }
  7933. if (this.endTime) {
  7934. instanceEnd = zonedDayStart.clone().time(this.endTime);
  7935. }
  7936. instances.push(new EventInstance_1.default(this, // definition
  7937. new EventDateProfile_1.default(instanceStart, instanceEnd, calendar)));
  7938. }
  7939. unzonedDate.add(1, 'days');
  7940. }
  7941. return instances;
  7942. };
  7943. RecurringEventDef.prototype.setDow = function (dowNumbers) {
  7944. if (!this.dowHash) {
  7945. this.dowHash = {};
  7946. }
  7947. for (var i = 0; i < dowNumbers.length; i++) {
  7948. this.dowHash[dowNumbers[i]] = true;
  7949. }
  7950. };
  7951. RecurringEventDef.prototype.clone = function () {
  7952. var def = _super.prototype.clone.call(this);
  7953. if (def.startTime) {
  7954. def.startTime = moment.duration(this.startTime);
  7955. }
  7956. if (def.endTime) {
  7957. def.endTime = moment.duration(this.endTime);
  7958. }
  7959. if (this.dowHash) {
  7960. def.dowHash = $.extend({}, this.dowHash);
  7961. }
  7962. return def;
  7963. };
  7964. return RecurringEventDef;
  7965. }(EventDef_1.default));
  7966. exports.default = RecurringEventDef;
  7967. /*
  7968. HACK to work with TypeScript mixins
  7969. NOTE: if super-method fails, should still attempt to apply
  7970. */
  7971. RecurringEventDef.prototype.applyProps = function (rawProps) {
  7972. var superSuccess = EventDef_1.default.prototype.applyProps.call(this, rawProps);
  7973. if (rawProps.start) {
  7974. this.startTime = moment.duration(rawProps.start);
  7975. }
  7976. if (rawProps.end) {
  7977. this.endTime = moment.duration(rawProps.end);
  7978. }
  7979. if (rawProps.dow) {
  7980. this.setDow(rawProps.dow);
  7981. }
  7982. return superSuccess;
  7983. };
  7984. // Parsing
  7985. // ---------------------------------------------------------------------------------------------------------------------
  7986. RecurringEventDef.defineStandardProps({
  7987. start: false,
  7988. end: false,
  7989. dow: false
  7990. });
  7991. /***/ }),
  7992. /* 211 */
  7993. /***/ (function(module, exports) {
  7994. Object.defineProperty(exports, "__esModule", { value: true });
  7995. var EventRange = /** @class */ (function () {
  7996. function EventRange(unzonedRange, eventDef, eventInstance) {
  7997. this.unzonedRange = unzonedRange;
  7998. this.eventDef = eventDef;
  7999. if (eventInstance) {
  8000. this.eventInstance = eventInstance;
  8001. }
  8002. }
  8003. return EventRange;
  8004. }());
  8005. exports.default = EventRange;
  8006. /***/ }),
  8007. /* 212 */
  8008. /***/ (function(module, exports, __webpack_require__) {
  8009. Object.defineProperty(exports, "__esModule", { value: true });
  8010. var $ = __webpack_require__(3);
  8011. var util_1 = __webpack_require__(35);
  8012. var EventInstanceGroup_1 = __webpack_require__(18);
  8013. var RecurringEventDef_1 = __webpack_require__(210);
  8014. var EventSource_1 = __webpack_require__(6);
  8015. var BUSINESS_HOUR_EVENT_DEFAULTS = {
  8016. start: '09:00',
  8017. end: '17:00',
  8018. dow: [1, 2, 3, 4, 5],
  8019. rendering: 'inverse-background'
  8020. // classNames are defined in businessHoursSegClasses
  8021. };
  8022. var BusinessHourGenerator = /** @class */ (function () {
  8023. function BusinessHourGenerator(rawComplexDef, calendar) {
  8024. this.rawComplexDef = rawComplexDef;
  8025. this.calendar = calendar;
  8026. }
  8027. BusinessHourGenerator.prototype.buildEventInstanceGroup = function (isAllDay, unzonedRange) {
  8028. var eventDefs = this.buildEventDefs(isAllDay);
  8029. var eventInstanceGroup;
  8030. if (eventDefs.length) {
  8031. eventInstanceGroup = new EventInstanceGroup_1.default(util_1.eventDefsToEventInstances(eventDefs, unzonedRange));
  8032. // so that inverse-background rendering can happen even when no eventRanges in view
  8033. eventInstanceGroup.explicitEventDef = eventDefs[0];
  8034. return eventInstanceGroup;
  8035. }
  8036. };
  8037. BusinessHourGenerator.prototype.buildEventDefs = function (isAllDay) {
  8038. var rawComplexDef = this.rawComplexDef;
  8039. var rawDefs = [];
  8040. var requireDow = false;
  8041. var i;
  8042. var defs = [];
  8043. if (rawComplexDef === true) {
  8044. rawDefs = [{}]; // will get BUSINESS_HOUR_EVENT_DEFAULTS verbatim
  8045. }
  8046. else if ($.isPlainObject(rawComplexDef)) {
  8047. rawDefs = [rawComplexDef];
  8048. }
  8049. else if ($.isArray(rawComplexDef)) {
  8050. rawDefs = rawComplexDef;
  8051. requireDow = true; // every sub-definition NEEDS a day-of-week
  8052. }
  8053. for (i = 0; i < rawDefs.length; i++) {
  8054. if (!requireDow || rawDefs[i].dow) {
  8055. defs.push(this.buildEventDef(isAllDay, rawDefs[i]));
  8056. }
  8057. }
  8058. return defs;
  8059. };
  8060. BusinessHourGenerator.prototype.buildEventDef = function (isAllDay, rawDef) {
  8061. var fullRawDef = $.extend({}, BUSINESS_HOUR_EVENT_DEFAULTS, rawDef);
  8062. if (isAllDay) {
  8063. fullRawDef.start = null;
  8064. fullRawDef.end = null;
  8065. }
  8066. return RecurringEventDef_1.default.parse(fullRawDef, new EventSource_1.default(this.calendar) // dummy source
  8067. );
  8068. };
  8069. return BusinessHourGenerator;
  8070. }());
  8071. exports.default = BusinessHourGenerator;
  8072. /***/ }),
  8073. /* 213 */
  8074. /***/ (function(module, exports, __webpack_require__) {
  8075. Object.defineProperty(exports, "__esModule", { value: true });
  8076. var tslib_1 = __webpack_require__(2);
  8077. var Theme_1 = __webpack_require__(19);
  8078. var StandardTheme = /** @class */ (function (_super) {
  8079. tslib_1.__extends(StandardTheme, _super);
  8080. function StandardTheme() {
  8081. return _super !== null && _super.apply(this, arguments) || this;
  8082. }
  8083. return StandardTheme;
  8084. }(Theme_1.default));
  8085. exports.default = StandardTheme;
  8086. StandardTheme.prototype.classes = {
  8087. widget: 'fc-unthemed',
  8088. widgetHeader: 'fc-widget-header',
  8089. widgetContent: 'fc-widget-content',
  8090. buttonGroup: 'btn-group',
  8091. button: 'btn',
  8092. cornerLeft: 'fc-corner-left',
  8093. cornerRight: 'fc-corner-right',
  8094. stateDefault: 'btn-primary',
  8095. stateActive: 'active',
  8096. stateDisabled: 'btn-primary-disabled',
  8097. stateHover: 'btn-primary-hover',
  8098. stateDown: 'fc-state-down',
  8099. popoverHeader: 'fc-widget-header',
  8100. popoverContent: 'fc-widget-content',
  8101. // day grid
  8102. headerRow: 'fc-widget-header',
  8103. dayRow: 'fc-widget-content',
  8104. // list view
  8105. listView: 'fc-widget-content'
  8106. };
  8107. StandardTheme.prototype.baseIconClass = 'fc-icon';
  8108. StandardTheme.prototype.iconClasses = {
  8109. close: 'fc-icon-x',
  8110. prev: 'fc-icon-left-single-arrow',
  8111. next: 'fc-icon-right-single-arrow',
  8112. prevYear: 'fc-icon-left-double-arrow',
  8113. nextYear: 'fc-icon-right-double-arrow'
  8114. };
  8115. StandardTheme.prototype.iconOverrideOption = 'buttonIcons';
  8116. StandardTheme.prototype.iconOverrideCustomButtonOption = 'icon';
  8117. StandardTheme.prototype.iconOverridePrefix = 'fc-icon-';
  8118. /***/ }),
  8119. /* 214 */
  8120. /***/ (function(module, exports, __webpack_require__) {
  8121. Object.defineProperty(exports, "__esModule", { value: true });
  8122. var tslib_1 = __webpack_require__(2);
  8123. var Theme_1 = __webpack_require__(19);
  8124. var JqueryUiTheme = /** @class */ (function (_super) {
  8125. tslib_1.__extends(JqueryUiTheme, _super);
  8126. function JqueryUiTheme() {
  8127. return _super !== null && _super.apply(this, arguments) || this;
  8128. }
  8129. return JqueryUiTheme;
  8130. }(Theme_1.default));
  8131. exports.default = JqueryUiTheme;
  8132. JqueryUiTheme.prototype.classes = {
  8133. widget: 'ui-widget',
  8134. widgetHeader: 'ui-widget-header',
  8135. widgetContent: 'ui-widget-content',
  8136. buttonGroup: 'btn-group',
  8137. button: 'ui-button',
  8138. cornerLeft: 'ui-corner-left',
  8139. cornerRight: 'ui-corner-right',
  8140. stateDefault: 'ui-state-default',
  8141. stateActive: 'ui-state-active',
  8142. stateDisabled: 'ui-state-disabled',
  8143. stateHover: 'ui-state-hover',
  8144. stateDown: 'ui-state-down',
  8145. today: 'ui-state-highlight',
  8146. popoverHeader: 'ui-widget-header',
  8147. popoverContent: 'ui-widget-content',
  8148. // day grid
  8149. headerRow: 'ui-widget-header',
  8150. dayRow: 'ui-widget-content',
  8151. // list view
  8152. listView: 'ui-widget-content'
  8153. };
  8154. JqueryUiTheme.prototype.baseIconClass = 'ui-icon';
  8155. JqueryUiTheme.prototype.iconClasses = {
  8156. close: 'ui-icon-closethick',
  8157. prev: 'ui-icon-circle-triangle-w',
  8158. next: 'ui-icon-circle-triangle-e',
  8159. prevYear: 'ui-icon-seek-prev',
  8160. nextYear: 'ui-icon-seek-next'
  8161. };
  8162. JqueryUiTheme.prototype.iconOverrideOption = 'themeButtonIcons';
  8163. JqueryUiTheme.prototype.iconOverrideCustomButtonOption = 'themeIcon';
  8164. JqueryUiTheme.prototype.iconOverridePrefix = 'ui-icon-';
  8165. /***/ }),
  8166. /* 215 */
  8167. /***/ (function(module, exports, __webpack_require__) {
  8168. Object.defineProperty(exports, "__esModule", { value: true });
  8169. var tslib_1 = __webpack_require__(2);
  8170. var $ = __webpack_require__(3);
  8171. var Promise_1 = __webpack_require__(20);
  8172. var EventSource_1 = __webpack_require__(6);
  8173. var FuncEventSource = /** @class */ (function (_super) {
  8174. tslib_1.__extends(FuncEventSource, _super);
  8175. function FuncEventSource() {
  8176. return _super !== null && _super.apply(this, arguments) || this;
  8177. }
  8178. FuncEventSource.parse = function (rawInput, calendar) {
  8179. var rawProps;
  8180. // normalize raw input
  8181. if ($.isFunction(rawInput.events)) {
  8182. rawProps = rawInput;
  8183. }
  8184. else if ($.isFunction(rawInput)) {
  8185. rawProps = { events: rawInput };
  8186. }
  8187. if (rawProps) {
  8188. return EventSource_1.default.parse.call(this, rawProps, calendar);
  8189. }
  8190. return false;
  8191. };
  8192. FuncEventSource.prototype.fetch = function (start, end, timezone) {
  8193. var _this = this;
  8194. this.calendar.pushLoading();
  8195. return Promise_1.default.construct(function (onResolve) {
  8196. _this.func.call(_this.calendar, start.clone(), end.clone(), timezone, function (rawEventDefs) {
  8197. _this.calendar.popLoading();
  8198. onResolve(_this.parseEventDefs(rawEventDefs));
  8199. });
  8200. });
  8201. };
  8202. FuncEventSource.prototype.getPrimitive = function () {
  8203. return this.func;
  8204. };
  8205. FuncEventSource.prototype.applyManualStandardProps = function (rawProps) {
  8206. var superSuccess = _super.prototype.applyManualStandardProps.call(this, rawProps);
  8207. this.func = rawProps.events;
  8208. return superSuccess;
  8209. };
  8210. return FuncEventSource;
  8211. }(EventSource_1.default));
  8212. exports.default = FuncEventSource;
  8213. FuncEventSource.defineStandardProps({
  8214. events: false // don't automatically transfer
  8215. });
  8216. /***/ }),
  8217. /* 216 */
  8218. /***/ (function(module, exports, __webpack_require__) {
  8219. Object.defineProperty(exports, "__esModule", { value: true });
  8220. var tslib_1 = __webpack_require__(2);
  8221. var $ = __webpack_require__(3);
  8222. var util_1 = __webpack_require__(4);
  8223. var Promise_1 = __webpack_require__(20);
  8224. var EventSource_1 = __webpack_require__(6);
  8225. var JsonFeedEventSource = /** @class */ (function (_super) {
  8226. tslib_1.__extends(JsonFeedEventSource, _super);
  8227. function JsonFeedEventSource() {
  8228. return _super !== null && _super.apply(this, arguments) || this;
  8229. }
  8230. JsonFeedEventSource.parse = function (rawInput, calendar) {
  8231. var rawProps;
  8232. // normalize raw input
  8233. if (typeof rawInput.url === 'string') {
  8234. rawProps = rawInput;
  8235. }
  8236. else if (typeof rawInput === 'string') {
  8237. rawProps = { url: rawInput };
  8238. }
  8239. if (rawProps) {
  8240. return EventSource_1.default.parse.call(this, rawProps, calendar);
  8241. }
  8242. return false;
  8243. };
  8244. JsonFeedEventSource.prototype.fetch = function (start, end, timezone) {
  8245. var _this = this;
  8246. var ajaxSettings = this.ajaxSettings;
  8247. var onSuccess = ajaxSettings.success;
  8248. var onError = ajaxSettings.error;
  8249. var requestParams = this.buildRequestParams(start, end, timezone);
  8250. // todo: eventually handle the promise's then,
  8251. // don't intercept success/error
  8252. // tho will be a breaking API change
  8253. this.calendar.pushLoading();
  8254. return Promise_1.default.construct(function (onResolve, onReject) {
  8255. $.ajax($.extend({}, // destination
  8256. JsonFeedEventSource.AJAX_DEFAULTS, ajaxSettings, {
  8257. url: _this.url,
  8258. data: requestParams,
  8259. success: function (rawEventDefs, status, xhr) {
  8260. var callbackRes;
  8261. _this.calendar.popLoading();
  8262. if (rawEventDefs) {
  8263. callbackRes = util_1.applyAll(onSuccess, _this, [rawEventDefs, status, xhr]); // redirect `this`
  8264. if ($.isArray(callbackRes)) {
  8265. rawEventDefs = callbackRes;
  8266. }
  8267. onResolve(_this.parseEventDefs(rawEventDefs));
  8268. }
  8269. else {
  8270. onReject();
  8271. }
  8272. },
  8273. error: function (xhr, statusText, errorThrown) {
  8274. _this.calendar.popLoading();
  8275. util_1.applyAll(onError, _this, [xhr, statusText, errorThrown]); // redirect `this`
  8276. onReject();
  8277. }
  8278. }));
  8279. });
  8280. };
  8281. JsonFeedEventSource.prototype.buildRequestParams = function (start, end, timezone) {
  8282. var calendar = this.calendar;
  8283. var ajaxSettings = this.ajaxSettings;
  8284. var startParam;
  8285. var endParam;
  8286. var timezoneParam;
  8287. var customRequestParams;
  8288. var params = {};
  8289. startParam = this.startParam;
  8290. if (startParam == null) {
  8291. startParam = calendar.opt('startParam');
  8292. }
  8293. endParam = this.endParam;
  8294. if (endParam == null) {
  8295. endParam = calendar.opt('endParam');
  8296. }
  8297. timezoneParam = this.timezoneParam;
  8298. if (timezoneParam == null) {
  8299. timezoneParam = calendar.opt('timezoneParam');
  8300. }
  8301. // retrieve any outbound GET/POST $.ajax data from the options
  8302. if ($.isFunction(ajaxSettings.data)) {
  8303. // supplied as a function that returns a key/value object
  8304. customRequestParams = ajaxSettings.data();
  8305. }
  8306. else {
  8307. // probably supplied as a straight key/value object
  8308. customRequestParams = ajaxSettings.data || {};
  8309. }
  8310. $.extend(params, customRequestParams);
  8311. params[startParam] = start.format();
  8312. params[endParam] = end.format();
  8313. if (timezone && timezone !== 'local') {
  8314. params[timezoneParam] = timezone;
  8315. }
  8316. return params;
  8317. };
  8318. JsonFeedEventSource.prototype.getPrimitive = function () {
  8319. return this.url;
  8320. };
  8321. JsonFeedEventSource.prototype.applyMiscProps = function (rawProps) {
  8322. this.ajaxSettings = rawProps;
  8323. };
  8324. JsonFeedEventSource.AJAX_DEFAULTS = {
  8325. dataType: 'json',
  8326. cache: false
  8327. };
  8328. return JsonFeedEventSource;
  8329. }(EventSource_1.default));
  8330. exports.default = JsonFeedEventSource;
  8331. JsonFeedEventSource.defineStandardProps({
  8332. // automatically transfer (true)...
  8333. url: true,
  8334. startParam: true,
  8335. endParam: true,
  8336. timezoneParam: true
  8337. });
  8338. /***/ }),
  8339. /* 217 */
  8340. /***/ (function(module, exports, __webpack_require__) {
  8341. Object.defineProperty(exports, "__esModule", { value: true });
  8342. var EmitterMixin_1 = __webpack_require__(11);
  8343. var TaskQueue = /** @class */ (function () {
  8344. function TaskQueue() {
  8345. this.q = [];
  8346. this.isPaused = false;
  8347. this.isRunning = false;
  8348. }
  8349. TaskQueue.prototype.queue = function () {
  8350. var args = [];
  8351. for (var _i = 0; _i < arguments.length; _i++) {
  8352. args[_i] = arguments[_i];
  8353. }
  8354. this.q.push.apply(this.q, args); // append
  8355. this.tryStart();
  8356. };
  8357. TaskQueue.prototype.pause = function () {
  8358. this.isPaused = true;
  8359. };
  8360. TaskQueue.prototype.resume = function () {
  8361. this.isPaused = false;
  8362. this.tryStart();
  8363. };
  8364. TaskQueue.prototype.getIsIdle = function () {
  8365. return !this.isRunning && !this.isPaused;
  8366. };
  8367. TaskQueue.prototype.tryStart = function () {
  8368. if (!this.isRunning && this.canRunNext()) {
  8369. this.isRunning = true;
  8370. this.trigger('start');
  8371. this.runRemaining();
  8372. }
  8373. };
  8374. TaskQueue.prototype.canRunNext = function () {
  8375. return !this.isPaused && this.q.length;
  8376. };
  8377. TaskQueue.prototype.runRemaining = function () {
  8378. var _this = this;
  8379. var task;
  8380. var res;
  8381. do {
  8382. task = this.q.shift(); // always freshly reference q. might have been reassigned.
  8383. res = this.runTask(task);
  8384. if (res && res.then) {
  8385. res.then(function () {
  8386. if (_this.canRunNext()) {
  8387. _this.runRemaining();
  8388. }
  8389. });
  8390. return; // prevent marking as stopped
  8391. }
  8392. } while (this.canRunNext());
  8393. this.trigger('stop'); // not really a 'stop' ... more of a 'drained'
  8394. this.isRunning = false;
  8395. // if 'stop' handler added more tasks.... TODO: write test for this
  8396. this.tryStart();
  8397. };
  8398. TaskQueue.prototype.runTask = function (task) {
  8399. return task(); // task *is* the function, but subclasses can change the format of a task
  8400. };
  8401. return TaskQueue;
  8402. }());
  8403. exports.default = TaskQueue;
  8404. EmitterMixin_1.default.mixInto(TaskQueue);
  8405. /***/ }),
  8406. /* 218 */
  8407. /***/ (function(module, exports, __webpack_require__) {
  8408. Object.defineProperty(exports, "__esModule", { value: true });
  8409. var tslib_1 = __webpack_require__(2);
  8410. var TaskQueue_1 = __webpack_require__(217);
  8411. var RenderQueue = /** @class */ (function (_super) {
  8412. tslib_1.__extends(RenderQueue, _super);
  8413. function RenderQueue(waitsByNamespace) {
  8414. var _this = _super.call(this) || this;
  8415. _this.waitsByNamespace = waitsByNamespace || {};
  8416. return _this;
  8417. }
  8418. RenderQueue.prototype.queue = function (taskFunc, namespace, type) {
  8419. var task = {
  8420. func: taskFunc,
  8421. namespace: namespace,
  8422. type: type
  8423. };
  8424. var waitMs;
  8425. if (namespace) {
  8426. waitMs = this.waitsByNamespace[namespace];
  8427. }
  8428. if (this.waitNamespace) {
  8429. if (namespace === this.waitNamespace && waitMs != null) {
  8430. this.delayWait(waitMs);
  8431. }
  8432. else {
  8433. this.clearWait();
  8434. this.tryStart();
  8435. }
  8436. }
  8437. if (this.compoundTask(task)) {
  8438. if (!this.waitNamespace && waitMs != null) {
  8439. this.startWait(namespace, waitMs);
  8440. }
  8441. else {
  8442. this.tryStart();
  8443. }
  8444. }
  8445. };
  8446. RenderQueue.prototype.startWait = function (namespace, waitMs) {
  8447. this.waitNamespace = namespace;
  8448. this.spawnWait(waitMs);
  8449. };
  8450. RenderQueue.prototype.delayWait = function (waitMs) {
  8451. clearTimeout(this.waitId);
  8452. this.spawnWait(waitMs);
  8453. };
  8454. RenderQueue.prototype.spawnWait = function (waitMs) {
  8455. var _this = this;
  8456. this.waitId = setTimeout(function () {
  8457. _this.waitNamespace = null;
  8458. _this.tryStart();
  8459. }, waitMs);
  8460. };
  8461. RenderQueue.prototype.clearWait = function () {
  8462. if (this.waitNamespace) {
  8463. clearTimeout(this.waitId);
  8464. this.waitId = null;
  8465. this.waitNamespace = null;
  8466. }
  8467. };
  8468. RenderQueue.prototype.canRunNext = function () {
  8469. if (!_super.prototype.canRunNext.call(this)) {
  8470. return false;
  8471. }
  8472. // waiting for a certain namespace to stop receiving tasks?
  8473. if (this.waitNamespace) {
  8474. var q = this.q;
  8475. // if there was a different namespace task in the meantime,
  8476. // that forces all previously-waiting tasks to suddenly execute.
  8477. // TODO: find a way to do this in constant time.
  8478. for (var i = 0; i < q.length; i++) {
  8479. if (q[i].namespace !== this.waitNamespace) {
  8480. return true; // allow execution
  8481. }
  8482. }
  8483. return false;
  8484. }
  8485. return true;
  8486. };
  8487. RenderQueue.prototype.runTask = function (task) {
  8488. task.func();
  8489. };
  8490. RenderQueue.prototype.compoundTask = function (newTask) {
  8491. var q = this.q;
  8492. var shouldAppend = true;
  8493. var i;
  8494. var task;
  8495. if (newTask.namespace && newTask.type === 'destroy') {
  8496. // remove all init/add/remove ops with same namespace, regardless of order
  8497. for (i = q.length - 1; i >= 0; i--) {
  8498. task = q[i];
  8499. switch (task.type) {
  8500. case 'init':
  8501. shouldAppend = false;
  8502. // the latest destroy is cancelled out by not doing the init
  8503. /* falls through */
  8504. case 'add':
  8505. /* falls through */
  8506. case 'remove':
  8507. q.splice(i, 1); // remove task
  8508. }
  8509. }
  8510. }
  8511. if (shouldAppend) {
  8512. q.push(newTask);
  8513. }
  8514. return shouldAppend;
  8515. };
  8516. return RenderQueue;
  8517. }(TaskQueue_1.default));
  8518. exports.default = RenderQueue;
  8519. /***/ }),
  8520. /* 219 */
  8521. /***/ (function(module, exports, __webpack_require__) {
  8522. Object.defineProperty(exports, "__esModule", { value: true });
  8523. var tslib_1 = __webpack_require__(2);
  8524. var $ = __webpack_require__(3);
  8525. var moment = __webpack_require__(0);
  8526. var util_1 = __webpack_require__(4);
  8527. var moment_ext_1 = __webpack_require__(10);
  8528. var date_formatting_1 = __webpack_require__(47);
  8529. var Component_1 = __webpack_require__(237);
  8530. var util_2 = __webpack_require__(35);
  8531. var DateComponent = /** @class */ (function (_super) {
  8532. tslib_1.__extends(DateComponent, _super);
  8533. function DateComponent(_view, _options) {
  8534. var _this = _super.call(this) || this;
  8535. _this.isRTL = false; // frequently accessed options
  8536. _this.hitsNeededDepth = 0; // necessary because multiple callers might need the same hits
  8537. _this.hasAllDayBusinessHours = false; // TODO: unify with largeUnit and isTimeScale?
  8538. _this.isDatesRendered = false;
  8539. // hack to set options prior to the this.opt calls
  8540. if (_view) {
  8541. _this['view'] = _view;
  8542. }
  8543. if (_options) {
  8544. _this['options'] = _options;
  8545. }
  8546. _this.uid = String(DateComponent.guid++);
  8547. _this.childrenByUid = {};
  8548. _this.nextDayThreshold = moment.duration(_this.opt('nextDayThreshold'));
  8549. _this.isRTL = _this.opt('isRTL');
  8550. if (_this.fillRendererClass) {
  8551. _this.fillRenderer = new _this.fillRendererClass(_this);
  8552. }
  8553. if (_this.eventRendererClass) {
  8554. _this.eventRenderer = new _this.eventRendererClass(_this, _this.fillRenderer);
  8555. }
  8556. if (_this.helperRendererClass && _this.eventRenderer) {
  8557. _this.helperRenderer = new _this.helperRendererClass(_this, _this.eventRenderer);
  8558. }
  8559. if (_this.businessHourRendererClass && _this.fillRenderer) {
  8560. _this.businessHourRenderer = new _this.businessHourRendererClass(_this, _this.fillRenderer);
  8561. }
  8562. return _this;
  8563. }
  8564. DateComponent.prototype.addChild = function (child) {
  8565. if (!this.childrenByUid[child.uid]) {
  8566. this.childrenByUid[child.uid] = child;
  8567. return true;
  8568. }
  8569. return false;
  8570. };
  8571. DateComponent.prototype.removeChild = function (child) {
  8572. if (this.childrenByUid[child.uid]) {
  8573. delete this.childrenByUid[child.uid];
  8574. return true;
  8575. }
  8576. return false;
  8577. };
  8578. // TODO: only do if isInDom?
  8579. // TODO: make part of Component, along with children/batch-render system?
  8580. DateComponent.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  8581. this.callChildren('updateSize', arguments);
  8582. };
  8583. // Options
  8584. // -----------------------------------------------------------------------------------------------------------------
  8585. DateComponent.prototype.opt = function (name) {
  8586. return this._getView().opt(name); // default implementation
  8587. };
  8588. DateComponent.prototype.publiclyTrigger = function () {
  8589. var args = [];
  8590. for (var _i = 0; _i < arguments.length; _i++) {
  8591. args[_i] = arguments[_i];
  8592. }
  8593. var calendar = this._getCalendar();
  8594. return calendar.publiclyTrigger.apply(calendar, args);
  8595. };
  8596. DateComponent.prototype.hasPublicHandlers = function () {
  8597. var args = [];
  8598. for (var _i = 0; _i < arguments.length; _i++) {
  8599. args[_i] = arguments[_i];
  8600. }
  8601. var calendar = this._getCalendar();
  8602. return calendar.hasPublicHandlers.apply(calendar, args);
  8603. };
  8604. // Date
  8605. // -----------------------------------------------------------------------------------------------------------------
  8606. DateComponent.prototype.executeDateRender = function (dateProfile) {
  8607. this.dateProfile = dateProfile; // for rendering
  8608. this.renderDates(dateProfile);
  8609. this.isDatesRendered = true;
  8610. this.callChildren('executeDateRender', arguments);
  8611. };
  8612. DateComponent.prototype.executeDateUnrender = function () {
  8613. this.callChildren('executeDateUnrender', arguments);
  8614. this.dateProfile = null;
  8615. this.unrenderDates();
  8616. this.isDatesRendered = false;
  8617. };
  8618. // date-cell content only
  8619. DateComponent.prototype.renderDates = function (dateProfile) {
  8620. // subclasses should implement
  8621. };
  8622. // date-cell content only
  8623. DateComponent.prototype.unrenderDates = function () {
  8624. // subclasses should override
  8625. };
  8626. // Now-Indicator
  8627. // -----------------------------------------------------------------------------------------------------------------
  8628. // Returns a string unit, like 'second' or 'minute' that defined how often the current time indicator
  8629. // should be refreshed. If something falsy is returned, no time indicator is rendered at all.
  8630. DateComponent.prototype.getNowIndicatorUnit = function () {
  8631. // subclasses should implement
  8632. };
  8633. // Renders a current time indicator at the given datetime
  8634. DateComponent.prototype.renderNowIndicator = function (date) {
  8635. this.callChildren('renderNowIndicator', arguments);
  8636. };
  8637. // Undoes the rendering actions from renderNowIndicator
  8638. DateComponent.prototype.unrenderNowIndicator = function () {
  8639. this.callChildren('unrenderNowIndicator', arguments);
  8640. };
  8641. // Business Hours
  8642. // ---------------------------------------------------------------------------------------------------------------
  8643. DateComponent.prototype.renderBusinessHours = function (businessHourGenerator) {
  8644. if (this.businessHourRenderer) {
  8645. this.businessHourRenderer.render(businessHourGenerator);
  8646. }
  8647. this.callChildren('renderBusinessHours', arguments);
  8648. };
  8649. // Unrenders previously-rendered business-hours
  8650. DateComponent.prototype.unrenderBusinessHours = function () {
  8651. this.callChildren('unrenderBusinessHours', arguments);
  8652. if (this.businessHourRenderer) {
  8653. this.businessHourRenderer.unrender();
  8654. }
  8655. };
  8656. // Event Displaying
  8657. // -----------------------------------------------------------------------------------------------------------------
  8658. DateComponent.prototype.executeEventRender = function (eventsPayload) {
  8659. if (this.eventRenderer) {
  8660. this.eventRenderer.rangeUpdated(); // poorly named now
  8661. this.eventRenderer.render(eventsPayload);
  8662. }
  8663. else if (this['renderEvents']) {
  8664. this['renderEvents'](convertEventsPayloadToLegacyArray(eventsPayload));
  8665. }
  8666. this.callChildren('executeEventRender', arguments);
  8667. };
  8668. DateComponent.prototype.executeEventUnrender = function () {
  8669. this.callChildren('executeEventUnrender', arguments);
  8670. if (this.eventRenderer) {
  8671. this.eventRenderer.unrender();
  8672. }
  8673. else if (this['destroyEvents']) {
  8674. this['destroyEvents']();
  8675. }
  8676. };
  8677. DateComponent.prototype.getBusinessHourSegs = function () {
  8678. var segs = this.getOwnBusinessHourSegs();
  8679. this.iterChildren(function (child) {
  8680. segs.push.apply(segs, child.getBusinessHourSegs());
  8681. });
  8682. return segs;
  8683. };
  8684. DateComponent.prototype.getOwnBusinessHourSegs = function () {
  8685. if (this.businessHourRenderer) {
  8686. return this.businessHourRenderer.getSegs();
  8687. }
  8688. return [];
  8689. };
  8690. DateComponent.prototype.getEventSegs = function () {
  8691. var segs = this.getOwnEventSegs();
  8692. this.iterChildren(function (child) {
  8693. segs.push.apply(segs, child.getEventSegs());
  8694. });
  8695. return segs;
  8696. };
  8697. DateComponent.prototype.getOwnEventSegs = function () {
  8698. if (this.eventRenderer) {
  8699. return this.eventRenderer.getSegs();
  8700. }
  8701. return [];
  8702. };
  8703. // Event Rendering Triggering
  8704. // -----------------------------------------------------------------------------------------------------------------
  8705. DateComponent.prototype.triggerAfterEventsRendered = function () {
  8706. this.triggerAfterEventSegsRendered(this.getEventSegs());
  8707. this.publiclyTrigger('eventAfterAllRender', {
  8708. context: this,
  8709. args: [this]
  8710. });
  8711. };
  8712. DateComponent.prototype.triggerAfterEventSegsRendered = function (segs) {
  8713. var _this = this;
  8714. // an optimization, because getEventLegacy is expensive
  8715. if (this.hasPublicHandlers('eventAfterRender')) {
  8716. segs.forEach(function (seg) {
  8717. var legacy;
  8718. if (seg.el) {
  8719. legacy = seg.footprint.getEventLegacy();
  8720. _this.publiclyTrigger('eventAfterRender', {
  8721. context: legacy,
  8722. args: [legacy, seg.el, _this]
  8723. });
  8724. }
  8725. });
  8726. }
  8727. };
  8728. DateComponent.prototype.triggerBeforeEventsDestroyed = function () {
  8729. this.triggerBeforeEventSegsDestroyed(this.getEventSegs());
  8730. };
  8731. DateComponent.prototype.triggerBeforeEventSegsDestroyed = function (segs) {
  8732. var _this = this;
  8733. if (this.hasPublicHandlers('eventDestroy')) {
  8734. segs.forEach(function (seg) {
  8735. var legacy;
  8736. if (seg.el) {
  8737. legacy = seg.footprint.getEventLegacy();
  8738. _this.publiclyTrigger('eventDestroy', {
  8739. context: legacy,
  8740. args: [legacy, seg.el, _this]
  8741. });
  8742. }
  8743. });
  8744. }
  8745. };
  8746. // Event Rendering Utils
  8747. // -----------------------------------------------------------------------------------------------------------------
  8748. // Hides all rendered event segments linked to the given event
  8749. // RECURSIVE with subcomponents
  8750. DateComponent.prototype.showEventsWithId = function (eventDefId) {
  8751. this.getEventSegs().forEach(function (seg) {
  8752. if (seg.footprint.eventDef.id === eventDefId &&
  8753. seg.el // necessary?
  8754. ) {
  8755. seg.el.css('visibility', '');
  8756. }
  8757. });
  8758. this.callChildren('showEventsWithId', arguments);
  8759. };
  8760. // Shows all rendered event segments linked to the given event
  8761. // RECURSIVE with subcomponents
  8762. DateComponent.prototype.hideEventsWithId = function (eventDefId) {
  8763. this.getEventSegs().forEach(function (seg) {
  8764. if (seg.footprint.eventDef.id === eventDefId &&
  8765. seg.el // necessary?
  8766. ) {
  8767. seg.el.css('visibility', 'hidden');
  8768. }
  8769. });
  8770. this.callChildren('hideEventsWithId', arguments);
  8771. };
  8772. // Drag-n-Drop Rendering (for both events and external elements)
  8773. // ---------------------------------------------------------------------------------------------------------------
  8774. // Renders a visual indication of a event or external-element drag over the given drop zone.
  8775. // If an external-element, seg will be `null`.
  8776. // Must return elements used for any mock events.
  8777. DateComponent.prototype.renderDrag = function (eventFootprints, seg, isTouch) {
  8778. var renderedHelper = false;
  8779. this.iterChildren(function (child) {
  8780. if (child.renderDrag(eventFootprints, seg, isTouch)) {
  8781. renderedHelper = true;
  8782. }
  8783. });
  8784. return renderedHelper;
  8785. };
  8786. // Unrenders a visual indication of an event or external-element being dragged.
  8787. DateComponent.prototype.unrenderDrag = function () {
  8788. this.callChildren('unrenderDrag', arguments);
  8789. };
  8790. // Event Resizing
  8791. // ---------------------------------------------------------------------------------------------------------------
  8792. // Renders a visual indication of an event being resized.
  8793. DateComponent.prototype.renderEventResize = function (eventFootprints, seg, isTouch) {
  8794. this.callChildren('renderEventResize', arguments);
  8795. };
  8796. // Unrenders a visual indication of an event being resized.
  8797. DateComponent.prototype.unrenderEventResize = function () {
  8798. this.callChildren('unrenderEventResize', arguments);
  8799. };
  8800. // Selection
  8801. // ---------------------------------------------------------------------------------------------------------------
  8802. // Renders a visual indication of the selection
  8803. // TODO: rename to `renderSelection` after legacy is gone
  8804. DateComponent.prototype.renderSelectionFootprint = function (componentFootprint) {
  8805. this.renderHighlight(componentFootprint);
  8806. this.callChildren('renderSelectionFootprint', arguments);
  8807. };
  8808. // Unrenders a visual indication of selection
  8809. DateComponent.prototype.unrenderSelection = function () {
  8810. this.unrenderHighlight();
  8811. this.callChildren('unrenderSelection', arguments);
  8812. };
  8813. // Highlight
  8814. // ---------------------------------------------------------------------------------------------------------------
  8815. // Renders an emphasis on the given date range. Given a span (unzoned start/end and other misc data)
  8816. DateComponent.prototype.renderHighlight = function (componentFootprint) {
  8817. if (this.fillRenderer) {
  8818. this.fillRenderer.renderFootprint('highlight', componentFootprint, {
  8819. getClasses: function () {
  8820. return ['fc-highlight'];
  8821. }
  8822. });
  8823. }
  8824. this.callChildren('renderHighlight', arguments);
  8825. };
  8826. // Unrenders the emphasis on a date range
  8827. DateComponent.prototype.unrenderHighlight = function () {
  8828. if (this.fillRenderer) {
  8829. this.fillRenderer.unrender('highlight');
  8830. }
  8831. this.callChildren('unrenderHighlight', arguments);
  8832. };
  8833. // Hit Areas
  8834. // ---------------------------------------------------------------------------------------------------------------
  8835. // just because all DateComponents support this interface
  8836. // doesn't mean they need to have their own internal coord system. they can defer to sub-components.
  8837. DateComponent.prototype.hitsNeeded = function () {
  8838. if (!(this.hitsNeededDepth++)) {
  8839. this.prepareHits();
  8840. }
  8841. this.callChildren('hitsNeeded', arguments);
  8842. };
  8843. DateComponent.prototype.hitsNotNeeded = function () {
  8844. if (this.hitsNeededDepth && !(--this.hitsNeededDepth)) {
  8845. this.releaseHits();
  8846. }
  8847. this.callChildren('hitsNotNeeded', arguments);
  8848. };
  8849. DateComponent.prototype.prepareHits = function () {
  8850. // subclasses can implement
  8851. };
  8852. DateComponent.prototype.releaseHits = function () {
  8853. // subclasses can implement
  8854. };
  8855. // Given coordinates from the topleft of the document, return data about the date-related area underneath.
  8856. // Can return an object with arbitrary properties (although top/right/left/bottom are encouraged).
  8857. // Must have a `grid` property, a reference to this current grid. TODO: avoid this
  8858. // The returned object will be processed by getHitFootprint and getHitEl.
  8859. DateComponent.prototype.queryHit = function (leftOffset, topOffset) {
  8860. var childrenByUid = this.childrenByUid;
  8861. var uid;
  8862. var hit;
  8863. for (uid in childrenByUid) {
  8864. hit = childrenByUid[uid].queryHit(leftOffset, topOffset);
  8865. if (hit) {
  8866. break;
  8867. }
  8868. }
  8869. return hit;
  8870. };
  8871. DateComponent.prototype.getSafeHitFootprint = function (hit) {
  8872. var footprint = this.getHitFootprint(hit);
  8873. if (!this.dateProfile.activeUnzonedRange.containsRange(footprint.unzonedRange)) {
  8874. return null;
  8875. }
  8876. return footprint;
  8877. };
  8878. DateComponent.prototype.getHitFootprint = function (hit) {
  8879. // what about being abstract!?
  8880. };
  8881. // Given position-level information about a date-related area within the grid,
  8882. // should return a jQuery element that best represents it. passed to dayClick callback.
  8883. DateComponent.prototype.getHitEl = function (hit) {
  8884. // what about being abstract!?
  8885. };
  8886. /* Converting eventRange -> eventFootprint
  8887. ------------------------------------------------------------------------------------------------------------------*/
  8888. DateComponent.prototype.eventRangesToEventFootprints = function (eventRanges) {
  8889. var eventFootprints = [];
  8890. var i;
  8891. for (i = 0; i < eventRanges.length; i++) {
  8892. eventFootprints.push.apply(// append
  8893. eventFootprints, this.eventRangeToEventFootprints(eventRanges[i]));
  8894. }
  8895. return eventFootprints;
  8896. };
  8897. DateComponent.prototype.eventRangeToEventFootprints = function (eventRange) {
  8898. return [util_2.eventRangeToEventFootprint(eventRange)];
  8899. };
  8900. /* Converting componentFootprint/eventFootprint -> segs
  8901. ------------------------------------------------------------------------------------------------------------------*/
  8902. DateComponent.prototype.eventFootprintsToSegs = function (eventFootprints) {
  8903. var segs = [];
  8904. var i;
  8905. for (i = 0; i < eventFootprints.length; i++) {
  8906. segs.push.apply(segs, this.eventFootprintToSegs(eventFootprints[i]));
  8907. }
  8908. return segs;
  8909. };
  8910. // Given an event's span (unzoned start/end and other misc data), and the event itself,
  8911. // slices into segments and attaches event-derived properties to them.
  8912. // eventSpan - { start, end, isStart, isEnd, otherthings... }
  8913. DateComponent.prototype.eventFootprintToSegs = function (eventFootprint) {
  8914. var unzonedRange = eventFootprint.componentFootprint.unzonedRange;
  8915. var segs;
  8916. var i;
  8917. var seg;
  8918. segs = this.componentFootprintToSegs(eventFootprint.componentFootprint);
  8919. for (i = 0; i < segs.length; i++) {
  8920. seg = segs[i];
  8921. if (!unzonedRange.isStart) {
  8922. seg.isStart = false;
  8923. }
  8924. if (!unzonedRange.isEnd) {
  8925. seg.isEnd = false;
  8926. }
  8927. seg.footprint = eventFootprint;
  8928. // TODO: rename to seg.eventFootprint
  8929. }
  8930. return segs;
  8931. };
  8932. DateComponent.prototype.componentFootprintToSegs = function (componentFootprint) {
  8933. return [];
  8934. };
  8935. // Utils
  8936. // ---------------------------------------------------------------------------------------------------------------
  8937. DateComponent.prototype.callChildren = function (methodName, args) {
  8938. this.iterChildren(function (child) {
  8939. child[methodName].apply(child, args);
  8940. });
  8941. };
  8942. DateComponent.prototype.iterChildren = function (func) {
  8943. var childrenByUid = this.childrenByUid;
  8944. var uid;
  8945. for (uid in childrenByUid) {
  8946. func(childrenByUid[uid]);
  8947. }
  8948. };
  8949. DateComponent.prototype._getCalendar = function () {
  8950. var t = this;
  8951. return t.calendar || t.view.calendar;
  8952. };
  8953. DateComponent.prototype._getView = function () {
  8954. return this.view;
  8955. };
  8956. DateComponent.prototype._getDateProfile = function () {
  8957. return this._getView().get('dateProfile');
  8958. };
  8959. // Generates HTML for an anchor to another view into the calendar.
  8960. // Will either generate an <a> tag or a non-clickable <span> tag, depending on enabled settings.
  8961. // `gotoOptions` can either be a moment input, or an object with the form:
  8962. // { date, type, forceOff }
  8963. // `type` is a view-type like "day" or "week". default value is "day".
  8964. // `attrs` and `innerHtml` are use to generate the rest of the HTML tag.
  8965. DateComponent.prototype.buildGotoAnchorHtml = function (gotoOptions, attrs, innerHtml) {
  8966. var date;
  8967. var type;
  8968. var forceOff;
  8969. var finalOptions;
  8970. if ($.isPlainObject(gotoOptions)) {
  8971. date = gotoOptions.date;
  8972. type = gotoOptions.type;
  8973. forceOff = gotoOptions.forceOff;
  8974. }
  8975. else {
  8976. date = gotoOptions; // a single moment input
  8977. }
  8978. date = moment_ext_1.default(date); // if a string, parse it
  8979. finalOptions = {
  8980. date: date.format('YYYY-MM-DD'),
  8981. type: type || 'day'
  8982. };
  8983. if (typeof attrs === 'string') {
  8984. innerHtml = attrs;
  8985. attrs = null;
  8986. }
  8987. attrs = attrs ? ' ' + util_1.attrsToStr(attrs) : ''; // will have a leading space
  8988. innerHtml = innerHtml || '';
  8989. if (!forceOff && this.opt('navLinks')) {
  8990. return '<a' + attrs +
  8991. ' data-goto="' + util_1.htmlEscape(JSON.stringify(finalOptions)) + '">' +
  8992. innerHtml +
  8993. '</a>';
  8994. }
  8995. else {
  8996. return '<span' + attrs + '>' +
  8997. innerHtml +
  8998. '</span>';
  8999. }
  9000. };
  9001. DateComponent.prototype.getAllDayHtml = function () {
  9002. return this.opt('allDayHtml') || util_1.htmlEscape(this.opt('allDayText'));
  9003. };
  9004. // Computes HTML classNames for a single-day element
  9005. DateComponent.prototype.getDayClasses = function (date, noThemeHighlight) {
  9006. var view = this._getView();
  9007. var classes = [];
  9008. var today;
  9009. if (!this.dateProfile.activeUnzonedRange.containsDate(date)) {
  9010. classes.push('fc-disabled-day'); // TODO: jQuery UI theme?
  9011. }
  9012. else {
  9013. classes.push('fc-' + util_1.dayIDs[date.day()]);
  9014. if (view.isDateInOtherMonth(date, this.dateProfile)) {
  9015. classes.push('fc-other-month');
  9016. }
  9017. today = view.calendar.getNow();
  9018. if (date.isSame(today, 'day')) {
  9019. classes.push('fc-today');
  9020. if (noThemeHighlight !== true) {
  9021. classes.push(view.calendar.theme.getClass('today'));
  9022. }
  9023. }
  9024. else if (date < today) {
  9025. classes.push('fc-past');
  9026. }
  9027. else {
  9028. classes.push('fc-future');
  9029. }
  9030. }
  9031. return classes;
  9032. };
  9033. // Utility for formatting a range. Accepts a range object, formatting string, and optional separator.
  9034. // Displays all-day ranges naturally, with an inclusive end. Takes the current isRTL into account.
  9035. // The timezones of the dates within `range` will be respected.
  9036. DateComponent.prototype.formatRange = function (range, isAllDay, formatStr, separator) {
  9037. var end = range.end;
  9038. if (isAllDay) {
  9039. end = end.clone().subtract(1); // convert to inclusive. last ms of previous day
  9040. }
  9041. return date_formatting_1.formatRange(range.start, end, formatStr, separator, this.isRTL);
  9042. };
  9043. // Compute the number of the give units in the "current" range.
  9044. // Will return a floating-point number. Won't round.
  9045. DateComponent.prototype.currentRangeAs = function (unit) {
  9046. return this._getDateProfile().currentUnzonedRange.as(unit);
  9047. };
  9048. // Returns the date range of the full days the given range visually appears to occupy.
  9049. // Returns a plain object with start/end, NOT an UnzonedRange!
  9050. DateComponent.prototype.computeDayRange = function (unzonedRange) {
  9051. var calendar = this._getCalendar();
  9052. var startDay = calendar.msToUtcMoment(unzonedRange.startMs, true); // the beginning of the day the range starts
  9053. var end = calendar.msToUtcMoment(unzonedRange.endMs);
  9054. var endTimeMS = +end.time(); // # of milliseconds into `endDay`
  9055. var endDay = end.clone().stripTime(); // the beginning of the day the range exclusively ends
  9056. // If the end time is actually inclusively part of the next day and is equal to or
  9057. // beyond the next day threshold, adjust the end to be the exclusive end of `endDay`.
  9058. // Otherwise, leaving it as inclusive will cause it to exclude `endDay`.
  9059. if (endTimeMS && endTimeMS >= this.nextDayThreshold) {
  9060. endDay.add(1, 'days');
  9061. }
  9062. // If end is within `startDay` but not past nextDayThreshold, assign the default duration of one day.
  9063. if (endDay <= startDay) {
  9064. endDay = startDay.clone().add(1, 'days');
  9065. }
  9066. return { start: startDay, end: endDay };
  9067. };
  9068. // Does the given range visually appear to occupy more than one day?
  9069. DateComponent.prototype.isMultiDayRange = function (unzonedRange) {
  9070. var dayRange = this.computeDayRange(unzonedRange);
  9071. return dayRange.end.diff(dayRange.start, 'days') > 1;
  9072. };
  9073. DateComponent.guid = 0; // TODO: better system for this?
  9074. return DateComponent;
  9075. }(Component_1.default));
  9076. exports.default = DateComponent;
  9077. // legacy
  9078. function convertEventsPayloadToLegacyArray(eventsPayload) {
  9079. var eventDefId;
  9080. var eventInstances;
  9081. var legacyEvents = [];
  9082. var i;
  9083. for (eventDefId in eventsPayload) {
  9084. eventInstances = eventsPayload[eventDefId].eventInstances;
  9085. for (i = 0; i < eventInstances.length; i++) {
  9086. legacyEvents.push(eventInstances[i].toLegacy());
  9087. }
  9088. }
  9089. return legacyEvents;
  9090. }
  9091. /***/ }),
  9092. /* 220 */
  9093. /***/ (function(module, exports, __webpack_require__) {
  9094. Object.defineProperty(exports, "__esModule", { value: true });
  9095. var $ = __webpack_require__(3);
  9096. var moment = __webpack_require__(0);
  9097. var util_1 = __webpack_require__(4);
  9098. var options_1 = __webpack_require__(32);
  9099. var Iterator_1 = __webpack_require__(238);
  9100. var GlobalEmitter_1 = __webpack_require__(21);
  9101. var EmitterMixin_1 = __webpack_require__(11);
  9102. var ListenerMixin_1 = __webpack_require__(7);
  9103. var Toolbar_1 = __webpack_require__(239);
  9104. var OptionsManager_1 = __webpack_require__(240);
  9105. var ViewSpecManager_1 = __webpack_require__(241);
  9106. var Constraints_1 = __webpack_require__(207);
  9107. var locale_1 = __webpack_require__(31);
  9108. var moment_ext_1 = __webpack_require__(10);
  9109. var UnzonedRange_1 = __webpack_require__(5);
  9110. var ComponentFootprint_1 = __webpack_require__(12);
  9111. var EventDateProfile_1 = __webpack_require__(17);
  9112. var EventManager_1 = __webpack_require__(242);
  9113. var BusinessHourGenerator_1 = __webpack_require__(212);
  9114. var EventSourceParser_1 = __webpack_require__(38);
  9115. var EventDefParser_1 = __webpack_require__(49);
  9116. var SingleEventDef_1 = __webpack_require__(13);
  9117. var EventDefMutation_1 = __webpack_require__(37);
  9118. var EventSource_1 = __webpack_require__(6);
  9119. var ThemeRegistry_1 = __webpack_require__(51);
  9120. var Calendar = /** @class */ (function () {
  9121. function Calendar(el, overrides) {
  9122. this.loadingLevel = 0; // number of simultaneous loading tasks
  9123. this.ignoreUpdateViewSize = 0;
  9124. this.freezeContentHeightDepth = 0;
  9125. // declare the current calendar instance relies on GlobalEmitter. needed for garbage collection.
  9126. // unneeded() is called in destroy.
  9127. GlobalEmitter_1.default.needed();
  9128. this.el = el;
  9129. this.viewsByType = {};
  9130. this.optionsManager = new OptionsManager_1.default(this, overrides);
  9131. this.viewSpecManager = new ViewSpecManager_1.default(this.optionsManager, this);
  9132. this.initMomentInternals(); // needs to happen after options hash initialized
  9133. this.initCurrentDate();
  9134. this.initEventManager();
  9135. this.constraints = new Constraints_1.default(this.eventManager, this);
  9136. this.constructed();
  9137. }
  9138. Calendar.prototype.constructed = function () {
  9139. // useful for monkeypatching. used?
  9140. };
  9141. Calendar.prototype.getView = function () {
  9142. return this.view;
  9143. };
  9144. Calendar.prototype.publiclyTrigger = function (name, triggerInfo) {
  9145. var optHandler = this.opt(name);
  9146. var context;
  9147. var args;
  9148. if ($.isPlainObject(triggerInfo)) {
  9149. context = triggerInfo.context;
  9150. args = triggerInfo.args;
  9151. }
  9152. else if ($.isArray(triggerInfo)) {
  9153. args = triggerInfo;
  9154. }
  9155. if (context == null) {
  9156. context = this.el[0]; // fallback context
  9157. }
  9158. if (!args) {
  9159. args = [];
  9160. }
  9161. this.triggerWith(name, context, args); // Emitter's method
  9162. if (optHandler) {
  9163. return optHandler.apply(context, args);
  9164. }
  9165. };
  9166. Calendar.prototype.hasPublicHandlers = function (name) {
  9167. return this.hasHandlers(name) ||
  9168. this.opt(name); // handler specified in options
  9169. };
  9170. // Options Public API
  9171. // -----------------------------------------------------------------------------------------------------------------
  9172. // public getter/setter
  9173. Calendar.prototype.option = function (name, value) {
  9174. var newOptionHash;
  9175. if (typeof name === 'string') {
  9176. if (value === undefined) {
  9177. return this.optionsManager.get(name);
  9178. }
  9179. else {
  9180. newOptionHash = {};
  9181. newOptionHash[name] = value;
  9182. this.optionsManager.add(newOptionHash);
  9183. }
  9184. }
  9185. else if (typeof name === 'object') {
  9186. this.optionsManager.add(name);
  9187. }
  9188. };
  9189. // private getter
  9190. Calendar.prototype.opt = function (name) {
  9191. return this.optionsManager.get(name);
  9192. };
  9193. // View
  9194. // -----------------------------------------------------------------------------------------------------------------
  9195. // Given a view name for a custom view or a standard view, creates a ready-to-go View object
  9196. Calendar.prototype.instantiateView = function (viewType) {
  9197. var spec = this.viewSpecManager.getViewSpec(viewType);
  9198. if (!spec) {
  9199. throw new Error("View type \"" + viewType + "\" is not valid");
  9200. }
  9201. return new spec['class'](this, spec);
  9202. };
  9203. // Returns a boolean about whether the view is okay to instantiate at some point
  9204. Calendar.prototype.isValidViewType = function (viewType) {
  9205. return Boolean(this.viewSpecManager.getViewSpec(viewType));
  9206. };
  9207. Calendar.prototype.changeView = function (viewName, dateOrRange) {
  9208. if (dateOrRange) {
  9209. if (dateOrRange.start && dateOrRange.end) {
  9210. this.optionsManager.recordOverrides({
  9211. visibleRange: dateOrRange
  9212. });
  9213. }
  9214. else {
  9215. this.currentDate = this.moment(dateOrRange).stripZone(); // just like gotoDate
  9216. }
  9217. }
  9218. this.renderView(viewName);
  9219. };
  9220. // Forces navigation to a view for the given date.
  9221. // `viewType` can be a specific view name or a generic one like "week" or "day".
  9222. Calendar.prototype.zoomTo = function (newDate, viewType) {
  9223. var spec;
  9224. viewType = viewType || 'day'; // day is default zoom
  9225. spec = this.viewSpecManager.getViewSpec(viewType) ||
  9226. this.viewSpecManager.getUnitViewSpec(viewType);
  9227. this.currentDate = newDate.clone();
  9228. this.renderView(spec ? spec.type : null);
  9229. };
  9230. // Current Date
  9231. // -----------------------------------------------------------------------------------------------------------------
  9232. Calendar.prototype.initCurrentDate = function () {
  9233. var defaultDateInput = this.opt('defaultDate');
  9234. // compute the initial ambig-timezone date
  9235. if (defaultDateInput != null) {
  9236. this.currentDate = this.moment(defaultDateInput).stripZone();
  9237. }
  9238. else {
  9239. this.currentDate = this.getNow(); // getNow already returns unzoned
  9240. }
  9241. };
  9242. Calendar.prototype.prev = function () {
  9243. var view = this.view;
  9244. var prevInfo = view.dateProfileGenerator.buildPrev(view.get('dateProfile'));
  9245. if (prevInfo.isValid) {
  9246. this.currentDate = prevInfo.date;
  9247. this.renderView();
  9248. }
  9249. };
  9250. Calendar.prototype.next = function () {
  9251. var view = this.view;
  9252. var nextInfo = view.dateProfileGenerator.buildNext(view.get('dateProfile'));
  9253. if (nextInfo.isValid) {
  9254. this.currentDate = nextInfo.date;
  9255. this.renderView();
  9256. }
  9257. };
  9258. Calendar.prototype.prevYear = function () {
  9259. this.currentDate.add(-1, 'years');
  9260. this.renderView();
  9261. };
  9262. Calendar.prototype.nextYear = function () {
  9263. this.currentDate.add(1, 'years');
  9264. this.renderView();
  9265. };
  9266. Calendar.prototype.today = function () {
  9267. this.currentDate = this.getNow(); // should deny like prev/next?
  9268. this.renderView();
  9269. };
  9270. Calendar.prototype.gotoDate = function (zonedDateInput) {
  9271. this.currentDate = this.moment(zonedDateInput).stripZone();
  9272. this.renderView();
  9273. };
  9274. Calendar.prototype.incrementDate = function (delta) {
  9275. this.currentDate.add(moment.duration(delta));
  9276. this.renderView();
  9277. };
  9278. // for external API
  9279. Calendar.prototype.getDate = function () {
  9280. return this.applyTimezone(this.currentDate); // infuse the calendar's timezone
  9281. };
  9282. // Loading Triggering
  9283. // -----------------------------------------------------------------------------------------------------------------
  9284. // Should be called when any type of async data fetching begins
  9285. Calendar.prototype.pushLoading = function () {
  9286. if (!(this.loadingLevel++)) {
  9287. this.publiclyTrigger('loading', [true, this.view]);
  9288. }
  9289. };
  9290. // Should be called when any type of async data fetching completes
  9291. Calendar.prototype.popLoading = function () {
  9292. if (!(--this.loadingLevel)) {
  9293. this.publiclyTrigger('loading', [false, this.view]);
  9294. }
  9295. };
  9296. // High-level Rendering
  9297. // -----------------------------------------------------------------------------------
  9298. Calendar.prototype.render = function () {
  9299. if (!this.contentEl) {
  9300. this.initialRender();
  9301. }
  9302. else if (this.elementVisible()) {
  9303. // mainly for the public API
  9304. this.calcSize();
  9305. this.updateViewSize();
  9306. }
  9307. };
  9308. Calendar.prototype.initialRender = function () {
  9309. var _this = this;
  9310. var el = this.el;
  9311. el.addClass('fc');
  9312. // event delegation for nav links
  9313. el.on('click.fc', 'a[data-goto]', function (ev) {
  9314. var anchorEl = $(ev.currentTarget);
  9315. var gotoOptions = anchorEl.data('goto'); // will automatically parse JSON
  9316. var date = _this.moment(gotoOptions.date);
  9317. var viewType = gotoOptions.type;
  9318. // property like "navLinkDayClick". might be a string or a function
  9319. var customAction = _this.view.opt('navLink' + util_1.capitaliseFirstLetter(viewType) + 'Click');
  9320. if (typeof customAction === 'function') {
  9321. customAction(date, ev);
  9322. }
  9323. else {
  9324. if (typeof customAction === 'string') {
  9325. viewType = customAction;
  9326. }
  9327. _this.zoomTo(date, viewType);
  9328. }
  9329. });
  9330. // called immediately, and upon option change
  9331. this.optionsManager.watch('settingTheme', ['?theme', '?themeSystem'], function (opts) {
  9332. var themeClass = ThemeRegistry_1.getThemeSystemClass(opts.themeSystem || opts.theme);
  9333. var theme = new themeClass(_this.optionsManager);
  9334. var widgetClass = theme.getClass('widget');
  9335. _this.theme = theme;
  9336. if (widgetClass) {
  9337. el.addClass(widgetClass);
  9338. }
  9339. }, function () {
  9340. var widgetClass = _this.theme.getClass('widget');
  9341. _this.theme = null;
  9342. if (widgetClass) {
  9343. el.removeClass(widgetClass);
  9344. }
  9345. });
  9346. this.optionsManager.watch('settingBusinessHourGenerator', ['?businessHours'], function (deps) {
  9347. _this.businessHourGenerator = new BusinessHourGenerator_1.default(deps.businessHours, _this);
  9348. if (_this.view) {
  9349. _this.view.set('businessHourGenerator', _this.businessHourGenerator);
  9350. }
  9351. }, function () {
  9352. _this.businessHourGenerator = null;
  9353. });
  9354. // called immediately, and upon option change.
  9355. // HACK: locale often affects isRTL, so we explicitly listen to that too.
  9356. this.optionsManager.watch('applyingDirClasses', ['?isRTL', '?locale'], function (opts) {
  9357. el.toggleClass('fc-ltr', !opts.isRTL);
  9358. el.toggleClass('fc-rtl', opts.isRTL);
  9359. });
  9360. this.contentEl = $("<div class='fc-view-container'/>").prependTo(el);
  9361. this.initToolbars();
  9362. this.renderHeader();
  9363. this.renderFooter();
  9364. this.renderView(this.opt('defaultView'));
  9365. if (this.opt('handleWindowResize')) {
  9366. $(window).resize(this.windowResizeProxy = util_1.debounce(// prevents rapid calls
  9367. this.windowResize.bind(this), this.opt('windowResizeDelay')));
  9368. }
  9369. };
  9370. Calendar.prototype.destroy = function () {
  9371. if (this.view) {
  9372. this.clearView();
  9373. }
  9374. this.toolbarsManager.proxyCall('removeElement');
  9375. this.contentEl.remove();
  9376. this.el.removeClass('fc fc-ltr fc-rtl');
  9377. // removes theme-related root className
  9378. this.optionsManager.unwatch('settingTheme');
  9379. this.optionsManager.unwatch('settingBusinessHourGenerator');
  9380. this.el.off('.fc'); // unbind nav link handlers
  9381. if (this.windowResizeProxy) {
  9382. $(window).unbind('resize', this.windowResizeProxy);
  9383. this.windowResizeProxy = null;
  9384. }
  9385. GlobalEmitter_1.default.unneeded();
  9386. };
  9387. Calendar.prototype.elementVisible = function () {
  9388. return this.el.is(':visible');
  9389. };
  9390. // Render Queue
  9391. // -----------------------------------------------------------------------------------------------------------------
  9392. Calendar.prototype.bindViewHandlers = function (view) {
  9393. var _this = this;
  9394. view.watch('titleForCalendar', ['title'], function (deps) {
  9395. if (view === _this.view) {
  9396. _this.setToolbarsTitle(deps.title);
  9397. }
  9398. });
  9399. view.watch('dateProfileForCalendar', ['dateProfile'], function (deps) {
  9400. if (view === _this.view) {
  9401. _this.currentDate = deps.dateProfile.date; // might have been constrained by view dates
  9402. _this.updateToolbarButtons(deps.dateProfile);
  9403. }
  9404. });
  9405. };
  9406. Calendar.prototype.unbindViewHandlers = function (view) {
  9407. view.unwatch('titleForCalendar');
  9408. view.unwatch('dateProfileForCalendar');
  9409. };
  9410. // View Rendering
  9411. // -----------------------------------------------------------------------------------
  9412. // Renders a view because of a date change, view-type change, or for the first time.
  9413. // If not given a viewType, keep the current view but render different dates.
  9414. // Accepts an optional scroll state to restore to.
  9415. Calendar.prototype.renderView = function (viewType) {
  9416. var oldView = this.view;
  9417. var newView;
  9418. this.freezeContentHeight();
  9419. if (oldView && viewType && oldView.type !== viewType) {
  9420. this.clearView();
  9421. }
  9422. // if viewType changed, or the view was never created, create a fresh view
  9423. if (!this.view && viewType) {
  9424. newView = this.view =
  9425. this.viewsByType[viewType] ||
  9426. (this.viewsByType[viewType] = this.instantiateView(viewType));
  9427. this.bindViewHandlers(newView);
  9428. newView.startBatchRender(); // so that setElement+setDate rendering are joined
  9429. newView.setElement($("<div class='fc-view fc-" + viewType + "-view' />").appendTo(this.contentEl));
  9430. this.toolbarsManager.proxyCall('activateButton', viewType);
  9431. }
  9432. if (this.view) {
  9433. // prevent unnecessary change firing
  9434. if (this.view.get('businessHourGenerator') !== this.businessHourGenerator) {
  9435. this.view.set('businessHourGenerator', this.businessHourGenerator);
  9436. }
  9437. this.view.setDate(this.currentDate);
  9438. if (newView) {
  9439. newView.stopBatchRender();
  9440. }
  9441. }
  9442. this.thawContentHeight();
  9443. };
  9444. // Unrenders the current view and reflects this change in the Header.
  9445. // Unregsiters the `view`, but does not remove from viewByType hash.
  9446. Calendar.prototype.clearView = function () {
  9447. var currentView = this.view;
  9448. this.toolbarsManager.proxyCall('deactivateButton', currentView.type);
  9449. this.unbindViewHandlers(currentView);
  9450. currentView.removeElement();
  9451. currentView.unsetDate(); // so bindViewHandlers doesn't fire with old values next time
  9452. this.view = null;
  9453. };
  9454. // Destroys the view, including the view object. Then, re-instantiates it and renders it.
  9455. // Maintains the same scroll state.
  9456. // TODO: maintain any other user-manipulated state.
  9457. Calendar.prototype.reinitView = function () {
  9458. var oldView = this.view;
  9459. var scroll = oldView.queryScroll(); // wouldn't be so complicated if Calendar owned the scroll
  9460. this.freezeContentHeight();
  9461. this.clearView();
  9462. this.calcSize();
  9463. this.renderView(oldView.type); // needs the type to freshly render
  9464. this.view.applyScroll(scroll);
  9465. this.thawContentHeight();
  9466. };
  9467. // Resizing
  9468. // -----------------------------------------------------------------------------------
  9469. Calendar.prototype.getSuggestedViewHeight = function () {
  9470. if (this.suggestedViewHeight == null) {
  9471. this.calcSize();
  9472. }
  9473. return this.suggestedViewHeight;
  9474. };
  9475. Calendar.prototype.isHeightAuto = function () {
  9476. return this.opt('contentHeight') === 'auto' || this.opt('height') === 'auto';
  9477. };
  9478. Calendar.prototype.updateViewSize = function (isResize) {
  9479. if (isResize === void 0) { isResize = false; }
  9480. var view = this.view;
  9481. var scroll;
  9482. if (!this.ignoreUpdateViewSize && view) {
  9483. if (isResize) {
  9484. this.calcSize();
  9485. scroll = view.queryScroll();
  9486. }
  9487. this.ignoreUpdateViewSize++;
  9488. view.updateSize(this.getSuggestedViewHeight(), this.isHeightAuto(), isResize);
  9489. this.ignoreUpdateViewSize--;
  9490. if (isResize) {
  9491. view.applyScroll(scroll);
  9492. }
  9493. return true; // signal success
  9494. }
  9495. };
  9496. Calendar.prototype.calcSize = function () {
  9497. if (this.elementVisible()) {
  9498. this._calcSize();
  9499. }
  9500. };
  9501. Calendar.prototype._calcSize = function () {
  9502. var contentHeightInput = this.opt('contentHeight');
  9503. var heightInput = this.opt('height');
  9504. if (typeof contentHeightInput === 'number') {
  9505. this.suggestedViewHeight = contentHeightInput;
  9506. }
  9507. else if (typeof contentHeightInput === 'function') {
  9508. this.suggestedViewHeight = contentHeightInput();
  9509. }
  9510. else if (typeof heightInput === 'number') {
  9511. this.suggestedViewHeight = heightInput - this.queryToolbarsHeight();
  9512. }
  9513. else if (typeof heightInput === 'function') {
  9514. this.suggestedViewHeight = heightInput() - this.queryToolbarsHeight();
  9515. }
  9516. else if (heightInput === 'parent') {
  9517. this.suggestedViewHeight = this.el.parent().height() - this.queryToolbarsHeight();
  9518. }
  9519. else {
  9520. this.suggestedViewHeight = Math.round(this.contentEl.width() /
  9521. Math.max(this.opt('aspectRatio'), .5));
  9522. }
  9523. };
  9524. Calendar.prototype.windowResize = function (ev) {
  9525. if (
  9526. // the purpose: so we don't process jqui "resize" events that have bubbled up
  9527. // cast to any because .target, which is Element, can't be compared to window for some reason.
  9528. ev.target === window &&
  9529. this.view &&
  9530. this.view.isDatesRendered) {
  9531. if (this.updateViewSize(true)) {
  9532. this.publiclyTrigger('windowResize', [this.view]);
  9533. }
  9534. }
  9535. };
  9536. /* Height "Freezing"
  9537. -----------------------------------------------------------------------------*/
  9538. Calendar.prototype.freezeContentHeight = function () {
  9539. if (!(this.freezeContentHeightDepth++)) {
  9540. this.forceFreezeContentHeight();
  9541. }
  9542. };
  9543. Calendar.prototype.forceFreezeContentHeight = function () {
  9544. this.contentEl.css({
  9545. width: '100%',
  9546. height: this.contentEl.height(),
  9547. overflow: 'hidden'
  9548. });
  9549. };
  9550. Calendar.prototype.thawContentHeight = function () {
  9551. this.freezeContentHeightDepth--;
  9552. // always bring back to natural height
  9553. this.contentEl.css({
  9554. width: '',
  9555. height: '',
  9556. overflow: ''
  9557. });
  9558. // but if there are future thaws, re-freeze
  9559. if (this.freezeContentHeightDepth) {
  9560. this.forceFreezeContentHeight();
  9561. }
  9562. };
  9563. // Toolbar
  9564. // -----------------------------------------------------------------------------------------------------------------
  9565. Calendar.prototype.initToolbars = function () {
  9566. this.header = new Toolbar_1.default(this, this.computeHeaderOptions());
  9567. this.footer = new Toolbar_1.default(this, this.computeFooterOptions());
  9568. this.toolbarsManager = new Iterator_1.default([this.header, this.footer]);
  9569. };
  9570. Calendar.prototype.computeHeaderOptions = function () {
  9571. return {
  9572. extraClasses: 'fc-header-toolbar',
  9573. layout: this.opt('header')
  9574. };
  9575. };
  9576. Calendar.prototype.computeFooterOptions = function () {
  9577. return {
  9578. extraClasses: 'fc-footer-toolbar',
  9579. layout: this.opt('footer')
  9580. };
  9581. };
  9582. // can be called repeatedly and Header will rerender
  9583. Calendar.prototype.renderHeader = function () {
  9584. var header = this.header;
  9585. header.setToolbarOptions(this.computeHeaderOptions());
  9586. header.render();
  9587. if (header.el) {
  9588. this.el.prepend(header.el);
  9589. }
  9590. };
  9591. // can be called repeatedly and Footer will rerender
  9592. Calendar.prototype.renderFooter = function () {
  9593. var footer = this.footer;
  9594. footer.setToolbarOptions(this.computeFooterOptions());
  9595. footer.render();
  9596. if (footer.el) {
  9597. this.el.append(footer.el);
  9598. }
  9599. };
  9600. Calendar.prototype.setToolbarsTitle = function (title) {
  9601. this.toolbarsManager.proxyCall('updateTitle', title);
  9602. };
  9603. Calendar.prototype.updateToolbarButtons = function (dateProfile) {
  9604. var now = this.getNow();
  9605. var view = this.view;
  9606. var todayInfo = view.dateProfileGenerator.build(now);
  9607. var prevInfo = view.dateProfileGenerator.buildPrev(view.get('dateProfile'));
  9608. var nextInfo = view.dateProfileGenerator.buildNext(view.get('dateProfile'));
  9609. this.toolbarsManager.proxyCall((todayInfo.isValid && !dateProfile.currentUnzonedRange.containsDate(now)) ?
  9610. 'enableButton' :
  9611. 'disableButton', 'today');
  9612. this.toolbarsManager.proxyCall(prevInfo.isValid ?
  9613. 'enableButton' :
  9614. 'disableButton', 'prev');
  9615. this.toolbarsManager.proxyCall(nextInfo.isValid ?
  9616. 'enableButton' :
  9617. 'disableButton', 'next');
  9618. };
  9619. Calendar.prototype.queryToolbarsHeight = function () {
  9620. return this.toolbarsManager.items.reduce(function (accumulator, toolbar) {
  9621. var toolbarHeight = toolbar.el ? toolbar.el.outerHeight(true) : 0; // includes margin
  9622. return accumulator + toolbarHeight;
  9623. }, 0);
  9624. };
  9625. // Selection
  9626. // -----------------------------------------------------------------------------------------------------------------
  9627. // this public method receives start/end dates in any format, with any timezone
  9628. Calendar.prototype.select = function (zonedStartInput, zonedEndInput) {
  9629. this.view.select(this.buildSelectFootprint.apply(this, arguments));
  9630. };
  9631. Calendar.prototype.unselect = function () {
  9632. if (this.view) {
  9633. this.view.unselect();
  9634. }
  9635. };
  9636. // Given arguments to the select method in the API, returns a span (unzoned start/end and other info)
  9637. Calendar.prototype.buildSelectFootprint = function (zonedStartInput, zonedEndInput) {
  9638. var start = this.moment(zonedStartInput).stripZone();
  9639. var end;
  9640. if (zonedEndInput) {
  9641. end = this.moment(zonedEndInput).stripZone();
  9642. }
  9643. else if (start.hasTime()) {
  9644. end = start.clone().add(this.defaultTimedEventDuration);
  9645. }
  9646. else {
  9647. end = start.clone().add(this.defaultAllDayEventDuration);
  9648. }
  9649. return new ComponentFootprint_1.default(new UnzonedRange_1.default(start, end), !start.hasTime());
  9650. };
  9651. // Date Utils
  9652. // -----------------------------------------------------------------------------------------------------------------
  9653. Calendar.prototype.initMomentInternals = function () {
  9654. var _this = this;
  9655. this.defaultAllDayEventDuration = moment.duration(this.opt('defaultAllDayEventDuration'));
  9656. this.defaultTimedEventDuration = moment.duration(this.opt('defaultTimedEventDuration'));
  9657. // Called immediately, and when any of the options change.
  9658. // Happens before any internal objects rebuild or rerender, because this is very core.
  9659. this.optionsManager.watch('buildingMomentLocale', [
  9660. '?locale', '?monthNames', '?monthNamesShort', '?dayNames', '?dayNamesShort',
  9661. '?firstDay', '?weekNumberCalculation'
  9662. ], function (opts) {
  9663. var weekNumberCalculation = opts.weekNumberCalculation;
  9664. var firstDay = opts.firstDay;
  9665. var _week;
  9666. // normalize
  9667. if (weekNumberCalculation === 'iso') {
  9668. weekNumberCalculation = 'ISO'; // normalize
  9669. }
  9670. var localeData = Object.create(// make a cheap copy
  9671. locale_1.getMomentLocaleData(opts.locale) // will fall back to en
  9672. );
  9673. if (opts.monthNames) {
  9674. localeData._months = opts.monthNames;
  9675. }
  9676. if (opts.monthNamesShort) {
  9677. localeData._monthsShort = opts.monthNamesShort;
  9678. }
  9679. if (opts.dayNames) {
  9680. localeData._weekdays = opts.dayNames;
  9681. }
  9682. if (opts.dayNamesShort) {
  9683. localeData._weekdaysShort = opts.dayNamesShort;
  9684. }
  9685. if (firstDay == null && weekNumberCalculation === 'ISO') {
  9686. firstDay = 1;
  9687. }
  9688. if (firstDay != null) {
  9689. _week = Object.create(localeData._week); // _week: { dow: # }
  9690. _week.dow = firstDay;
  9691. localeData._week = _week;
  9692. }
  9693. if (weekNumberCalculation === 'ISO' ||
  9694. weekNumberCalculation === 'local' ||
  9695. typeof weekNumberCalculation === 'function') {
  9696. localeData._fullCalendar_weekCalc = weekNumberCalculation; // moment-ext will know what to do with it
  9697. }
  9698. _this.localeData = localeData;
  9699. // If the internal current date object already exists, move to new locale.
  9700. // We do NOT need to do this technique for event dates, because this happens when converting to "segments".
  9701. if (_this.currentDate) {
  9702. _this.localizeMoment(_this.currentDate); // sets to localeData
  9703. }
  9704. });
  9705. };
  9706. // Builds a moment using the settings of the current calendar: timezone and locale.
  9707. // Accepts anything the vanilla moment() constructor accepts.
  9708. Calendar.prototype.moment = function () {
  9709. var args = [];
  9710. for (var _i = 0; _i < arguments.length; _i++) {
  9711. args[_i] = arguments[_i];
  9712. }
  9713. var mom;
  9714. if (this.opt('timezone') === 'local') {
  9715. mom = moment_ext_1.default.apply(null, args);
  9716. // Force the moment to be local, because momentExt doesn't guarantee it.
  9717. if (mom.hasTime()) {
  9718. mom.local();
  9719. }
  9720. }
  9721. else if (this.opt('timezone') === 'UTC') {
  9722. mom = moment_ext_1.default.utc.apply(null, args); // process as UTC
  9723. }
  9724. else {
  9725. mom = moment_ext_1.default.parseZone.apply(null, args); // let the input decide the zone
  9726. }
  9727. this.localizeMoment(mom); // TODO
  9728. return mom;
  9729. };
  9730. Calendar.prototype.msToMoment = function (ms, forceAllDay) {
  9731. var mom = moment_ext_1.default.utc(ms); // TODO: optimize by using Date.UTC
  9732. if (forceAllDay) {
  9733. mom.stripTime();
  9734. }
  9735. else {
  9736. mom = this.applyTimezone(mom); // may or may not apply locale
  9737. }
  9738. this.localizeMoment(mom);
  9739. return mom;
  9740. };
  9741. Calendar.prototype.msToUtcMoment = function (ms, forceAllDay) {
  9742. var mom = moment_ext_1.default.utc(ms); // TODO: optimize by using Date.UTC
  9743. if (forceAllDay) {
  9744. mom.stripTime();
  9745. }
  9746. this.localizeMoment(mom);
  9747. return mom;
  9748. };
  9749. // Updates the given moment's locale settings to the current calendar locale settings.
  9750. Calendar.prototype.localizeMoment = function (mom) {
  9751. mom._locale = this.localeData;
  9752. };
  9753. // Returns a boolean about whether or not the calendar knows how to calculate
  9754. // the timezone offset of arbitrary dates in the current timezone.
  9755. Calendar.prototype.getIsAmbigTimezone = function () {
  9756. return this.opt('timezone') !== 'local' && this.opt('timezone') !== 'UTC';
  9757. };
  9758. // Returns a copy of the given date in the current timezone. Has no effect on dates without times.
  9759. Calendar.prototype.applyTimezone = function (date) {
  9760. if (!date.hasTime()) {
  9761. return date.clone();
  9762. }
  9763. var zonedDate = this.moment(date.toArray());
  9764. var timeAdjust = date.time().asMilliseconds() - zonedDate.time().asMilliseconds();
  9765. var adjustedZonedDate;
  9766. // Safari sometimes has problems with this coersion when near DST. Adjust if necessary. (bug #2396)
  9767. if (timeAdjust) {
  9768. adjustedZonedDate = zonedDate.clone().add(timeAdjust); // add milliseconds
  9769. if (date.time().asMilliseconds() - adjustedZonedDate.time().asMilliseconds() === 0) {
  9770. zonedDate = adjustedZonedDate;
  9771. }
  9772. }
  9773. return zonedDate;
  9774. };
  9775. /*
  9776. Assumes the footprint is non-open-ended.
  9777. */
  9778. Calendar.prototype.footprintToDateProfile = function (componentFootprint, ignoreEnd) {
  9779. if (ignoreEnd === void 0) { ignoreEnd = false; }
  9780. var start = moment_ext_1.default.utc(componentFootprint.unzonedRange.startMs);
  9781. var end;
  9782. if (!ignoreEnd) {
  9783. end = moment_ext_1.default.utc(componentFootprint.unzonedRange.endMs);
  9784. }
  9785. if (componentFootprint.isAllDay) {
  9786. start.stripTime();
  9787. if (end) {
  9788. end.stripTime();
  9789. }
  9790. }
  9791. else {
  9792. start = this.applyTimezone(start);
  9793. if (end) {
  9794. end = this.applyTimezone(end);
  9795. }
  9796. }
  9797. return new EventDateProfile_1.default(start, end, this);
  9798. };
  9799. // Returns a moment for the current date, as defined by the client's computer or from the `now` option.
  9800. // Will return an moment with an ambiguous timezone.
  9801. Calendar.prototype.getNow = function () {
  9802. var now = this.opt('now');
  9803. if (typeof now === 'function') {
  9804. now = now();
  9805. }
  9806. return this.moment(now).stripZone();
  9807. };
  9808. // Produces a human-readable string for the given duration.
  9809. // Side-effect: changes the locale of the given duration.
  9810. Calendar.prototype.humanizeDuration = function (duration) {
  9811. return duration.locale(this.opt('locale')).humanize();
  9812. };
  9813. // will return `null` if invalid range
  9814. Calendar.prototype.parseUnzonedRange = function (rangeInput) {
  9815. var start = null;
  9816. var end = null;
  9817. if (rangeInput.start) {
  9818. start = this.moment(rangeInput.start).stripZone();
  9819. }
  9820. if (rangeInput.end) {
  9821. end = this.moment(rangeInput.end).stripZone();
  9822. }
  9823. if (!start && !end) {
  9824. return null;
  9825. }
  9826. if (start && end && end.isBefore(start)) {
  9827. return null;
  9828. }
  9829. return new UnzonedRange_1.default(start, end);
  9830. };
  9831. // Event-Date Utilities
  9832. // -----------------------------------------------------------------------------------------------------------------
  9833. Calendar.prototype.initEventManager = function () {
  9834. var _this = this;
  9835. var eventManager = new EventManager_1.default(this);
  9836. var rawSources = this.opt('eventSources') || [];
  9837. var singleRawSource = this.opt('events');
  9838. this.eventManager = eventManager;
  9839. if (singleRawSource) {
  9840. rawSources.unshift(singleRawSource);
  9841. }
  9842. eventManager.on('release', function (eventsPayload) {
  9843. _this.trigger('eventsReset', eventsPayload);
  9844. });
  9845. eventManager.freeze();
  9846. rawSources.forEach(function (rawSource) {
  9847. var source = EventSourceParser_1.default.parse(rawSource, _this);
  9848. if (source) {
  9849. eventManager.addSource(source);
  9850. }
  9851. });
  9852. eventManager.thaw();
  9853. };
  9854. Calendar.prototype.requestEvents = function (start, end) {
  9855. return this.eventManager.requestEvents(start, end, this.opt('timezone'), !this.opt('lazyFetching'));
  9856. };
  9857. // Get an event's normalized end date. If not present, calculate it from the defaults.
  9858. Calendar.prototype.getEventEnd = function (event) {
  9859. if (event.end) {
  9860. return event.end.clone();
  9861. }
  9862. else {
  9863. return this.getDefaultEventEnd(event.allDay, event.start);
  9864. }
  9865. };
  9866. // Given an event's allDay status and start date, return what its fallback end date should be.
  9867. // TODO: rename to computeDefaultEventEnd
  9868. Calendar.prototype.getDefaultEventEnd = function (allDay, zonedStart) {
  9869. var end = zonedStart.clone();
  9870. if (allDay) {
  9871. end.stripTime().add(this.defaultAllDayEventDuration);
  9872. }
  9873. else {
  9874. end.add(this.defaultTimedEventDuration);
  9875. }
  9876. if (this.getIsAmbigTimezone()) {
  9877. end.stripZone(); // we don't know what the tzo should be
  9878. }
  9879. return end;
  9880. };
  9881. // Public Events API
  9882. // -----------------------------------------------------------------------------------------------------------------
  9883. Calendar.prototype.rerenderEvents = function () {
  9884. this.view.flash('displayingEvents');
  9885. };
  9886. Calendar.prototype.refetchEvents = function () {
  9887. this.eventManager.refetchAllSources();
  9888. };
  9889. Calendar.prototype.renderEvents = function (eventInputs, isSticky) {
  9890. this.eventManager.freeze();
  9891. for (var i = 0; i < eventInputs.length; i++) {
  9892. this.renderEvent(eventInputs[i], isSticky);
  9893. }
  9894. this.eventManager.thaw();
  9895. };
  9896. Calendar.prototype.renderEvent = function (eventInput, isSticky) {
  9897. if (isSticky === void 0) { isSticky = false; }
  9898. var eventManager = this.eventManager;
  9899. var eventDef = EventDefParser_1.default.parse(eventInput, eventInput.source || eventManager.stickySource);
  9900. if (eventDef) {
  9901. eventManager.addEventDef(eventDef, isSticky);
  9902. }
  9903. };
  9904. // legacyQuery operates on legacy event instance objects
  9905. Calendar.prototype.removeEvents = function (legacyQuery) {
  9906. var eventManager = this.eventManager;
  9907. var legacyInstances = [];
  9908. var idMap = {};
  9909. var eventDef;
  9910. var i;
  9911. if (legacyQuery == null) {
  9912. eventManager.removeAllEventDefs(); // persist=true
  9913. }
  9914. else {
  9915. eventManager.getEventInstances().forEach(function (eventInstance) {
  9916. legacyInstances.push(eventInstance.toLegacy());
  9917. });
  9918. legacyInstances = filterLegacyEventInstances(legacyInstances, legacyQuery);
  9919. // compute unique IDs
  9920. for (i = 0; i < legacyInstances.length; i++) {
  9921. eventDef = this.eventManager.getEventDefByUid(legacyInstances[i]._id);
  9922. idMap[eventDef.id] = true;
  9923. }
  9924. eventManager.freeze();
  9925. for (i in idMap) {
  9926. eventManager.removeEventDefsById(i); // persist=true
  9927. }
  9928. eventManager.thaw();
  9929. }
  9930. };
  9931. // legacyQuery operates on legacy event instance objects
  9932. Calendar.prototype.clientEvents = function (legacyQuery) {
  9933. var legacyEventInstances = [];
  9934. this.eventManager.getEventInstances().forEach(function (eventInstance) {
  9935. legacyEventInstances.push(eventInstance.toLegacy());
  9936. });
  9937. return filterLegacyEventInstances(legacyEventInstances, legacyQuery);
  9938. };
  9939. Calendar.prototype.updateEvents = function (eventPropsArray) {
  9940. this.eventManager.freeze();
  9941. for (var i = 0; i < eventPropsArray.length; i++) {
  9942. this.updateEvent(eventPropsArray[i]);
  9943. }
  9944. this.eventManager.thaw();
  9945. };
  9946. Calendar.prototype.updateEvent = function (eventProps) {
  9947. var eventDef = this.eventManager.getEventDefByUid(eventProps._id);
  9948. var eventInstance;
  9949. var eventDefMutation;
  9950. if (eventDef instanceof SingleEventDef_1.default) {
  9951. eventInstance = eventDef.buildInstance();
  9952. eventDefMutation = EventDefMutation_1.default.createFromRawProps(eventInstance, eventProps, // raw props
  9953. null // largeUnit -- who uses it?
  9954. );
  9955. this.eventManager.mutateEventsWithId(eventDef.id, eventDefMutation); // will release
  9956. }
  9957. };
  9958. // Public Event Sources API
  9959. // ------------------------------------------------------------------------------------
  9960. Calendar.prototype.getEventSources = function () {
  9961. return this.eventManager.otherSources.slice(); // clone
  9962. };
  9963. Calendar.prototype.getEventSourceById = function (id) {
  9964. return this.eventManager.getSourceById(EventSource_1.default.normalizeId(id));
  9965. };
  9966. Calendar.prototype.addEventSource = function (sourceInput) {
  9967. var source = EventSourceParser_1.default.parse(sourceInput, this);
  9968. if (source) {
  9969. this.eventManager.addSource(source);
  9970. }
  9971. };
  9972. Calendar.prototype.removeEventSources = function (sourceMultiQuery) {
  9973. var eventManager = this.eventManager;
  9974. var sources;
  9975. var i;
  9976. if (sourceMultiQuery == null) {
  9977. this.eventManager.removeAllSources();
  9978. }
  9979. else {
  9980. sources = eventManager.multiQuerySources(sourceMultiQuery);
  9981. eventManager.freeze();
  9982. for (i = 0; i < sources.length; i++) {
  9983. eventManager.removeSource(sources[i]);
  9984. }
  9985. eventManager.thaw();
  9986. }
  9987. };
  9988. Calendar.prototype.removeEventSource = function (sourceQuery) {
  9989. var eventManager = this.eventManager;
  9990. var sources = eventManager.querySources(sourceQuery);
  9991. var i;
  9992. eventManager.freeze();
  9993. for (i = 0; i < sources.length; i++) {
  9994. eventManager.removeSource(sources[i]);
  9995. }
  9996. eventManager.thaw();
  9997. };
  9998. Calendar.prototype.refetchEventSources = function (sourceMultiQuery) {
  9999. var eventManager = this.eventManager;
  10000. var sources = eventManager.multiQuerySources(sourceMultiQuery);
  10001. var i;
  10002. eventManager.freeze();
  10003. for (i = 0; i < sources.length; i++) {
  10004. eventManager.refetchSource(sources[i]);
  10005. }
  10006. eventManager.thaw();
  10007. };
  10008. // not for internal use. use options module directly instead.
  10009. Calendar.defaults = options_1.globalDefaults;
  10010. Calendar.englishDefaults = options_1.englishDefaults;
  10011. Calendar.rtlDefaults = options_1.rtlDefaults;
  10012. return Calendar;
  10013. }());
  10014. exports.default = Calendar;
  10015. EmitterMixin_1.default.mixInto(Calendar);
  10016. ListenerMixin_1.default.mixInto(Calendar);
  10017. function filterLegacyEventInstances(legacyEventInstances, legacyQuery) {
  10018. if (legacyQuery == null) {
  10019. return legacyEventInstances;
  10020. }
  10021. else if ($.isFunction(legacyQuery)) {
  10022. return legacyEventInstances.filter(legacyQuery);
  10023. }
  10024. else {
  10025. legacyQuery += ''; // normalize to string
  10026. return legacyEventInstances.filter(function (legacyEventInstance) {
  10027. // soft comparison because id not be normalized to string
  10028. // tslint:disable-next-line
  10029. return legacyEventInstance.id == legacyQuery ||
  10030. legacyEventInstance._id === legacyQuery; // can specify internal id, but must exactly match
  10031. });
  10032. }
  10033. }
  10034. /***/ }),
  10035. /* 221 */
  10036. /***/ (function(module, exports, __webpack_require__) {
  10037. Object.defineProperty(exports, "__esModule", { value: true });
  10038. var moment = __webpack_require__(0);
  10039. var util_1 = __webpack_require__(4);
  10040. var UnzonedRange_1 = __webpack_require__(5);
  10041. var DateProfileGenerator = /** @class */ (function () {
  10042. function DateProfileGenerator(_view) {
  10043. this._view = _view;
  10044. }
  10045. DateProfileGenerator.prototype.opt = function (name) {
  10046. return this._view.opt(name);
  10047. };
  10048. DateProfileGenerator.prototype.trimHiddenDays = function (unzonedRange) {
  10049. return this._view.trimHiddenDays(unzonedRange);
  10050. };
  10051. DateProfileGenerator.prototype.msToUtcMoment = function (ms, forceAllDay) {
  10052. return this._view.calendar.msToUtcMoment(ms, forceAllDay);
  10053. };
  10054. /* Date Range Computation
  10055. ------------------------------------------------------------------------------------------------------------------*/
  10056. // Builds a structure with info about what the dates/ranges will be for the "prev" view.
  10057. DateProfileGenerator.prototype.buildPrev = function (currentDateProfile) {
  10058. var prevDate = currentDateProfile.date.clone()
  10059. .startOf(currentDateProfile.currentRangeUnit)
  10060. .subtract(currentDateProfile.dateIncrement);
  10061. return this.build(prevDate, -1);
  10062. };
  10063. // Builds a structure with info about what the dates/ranges will be for the "next" view.
  10064. DateProfileGenerator.prototype.buildNext = function (currentDateProfile) {
  10065. var nextDate = currentDateProfile.date.clone()
  10066. .startOf(currentDateProfile.currentRangeUnit)
  10067. .add(currentDateProfile.dateIncrement);
  10068. return this.build(nextDate, 1);
  10069. };
  10070. // Builds a structure holding dates/ranges for rendering around the given date.
  10071. // Optional direction param indicates whether the date is being incremented/decremented
  10072. // from its previous value. decremented = -1, incremented = 1 (default).
  10073. DateProfileGenerator.prototype.build = function (date, direction, forceToValid) {
  10074. if (forceToValid === void 0) { forceToValid = false; }
  10075. var isDateAllDay = !date.hasTime();
  10076. var validUnzonedRange;
  10077. var minTime = null;
  10078. var maxTime = null;
  10079. var currentInfo;
  10080. var isRangeAllDay;
  10081. var renderUnzonedRange;
  10082. var activeUnzonedRange;
  10083. var isValid;
  10084. validUnzonedRange = this.buildValidRange();
  10085. validUnzonedRange = this.trimHiddenDays(validUnzonedRange);
  10086. if (forceToValid) {
  10087. date = this.msToUtcMoment(validUnzonedRange.constrainDate(date), // returns MS
  10088. isDateAllDay);
  10089. }
  10090. currentInfo = this.buildCurrentRangeInfo(date, direction);
  10091. isRangeAllDay = /^(year|month|week|day)$/.test(currentInfo.unit);
  10092. renderUnzonedRange = this.buildRenderRange(this.trimHiddenDays(currentInfo.unzonedRange), currentInfo.unit, isRangeAllDay);
  10093. renderUnzonedRange = this.trimHiddenDays(renderUnzonedRange);
  10094. activeUnzonedRange = renderUnzonedRange.clone();
  10095. if (!this.opt('showNonCurrentDates')) {
  10096. activeUnzonedRange = activeUnzonedRange.intersect(currentInfo.unzonedRange);
  10097. }
  10098. minTime = moment.duration(this.opt('minTime'));
  10099. maxTime = moment.duration(this.opt('maxTime'));
  10100. activeUnzonedRange = this.adjustActiveRange(activeUnzonedRange, minTime, maxTime);
  10101. activeUnzonedRange = activeUnzonedRange.intersect(validUnzonedRange); // might return null
  10102. if (activeUnzonedRange) {
  10103. date = this.msToUtcMoment(activeUnzonedRange.constrainDate(date), // returns MS
  10104. isDateAllDay);
  10105. }
  10106. // it's invalid if the originally requested date is not contained,
  10107. // or if the range is completely outside of the valid range.
  10108. isValid = currentInfo.unzonedRange.intersectsWith(validUnzonedRange);
  10109. return {
  10110. // constraint for where prev/next operations can go and where events can be dragged/resized to.
  10111. // an object with optional start and end properties.
  10112. validUnzonedRange: validUnzonedRange,
  10113. // range the view is formally responsible for.
  10114. // for example, a month view might have 1st-31st, excluding padded dates
  10115. currentUnzonedRange: currentInfo.unzonedRange,
  10116. // name of largest unit being displayed, like "month" or "week"
  10117. currentRangeUnit: currentInfo.unit,
  10118. isRangeAllDay: isRangeAllDay,
  10119. // dates that display events and accept drag-n-drop
  10120. // will be `null` if no dates accept events
  10121. activeUnzonedRange: activeUnzonedRange,
  10122. // date range with a rendered skeleton
  10123. // includes not-active days that need some sort of DOM
  10124. renderUnzonedRange: renderUnzonedRange,
  10125. // Duration object that denotes the first visible time of any given day
  10126. minTime: minTime,
  10127. // Duration object that denotes the exclusive visible end time of any given day
  10128. maxTime: maxTime,
  10129. isValid: isValid,
  10130. date: date,
  10131. // how far the current date will move for a prev/next operation
  10132. dateIncrement: this.buildDateIncrement(currentInfo.duration)
  10133. // pass a fallback (might be null) ^
  10134. };
  10135. };
  10136. // Builds an object with optional start/end properties.
  10137. // Indicates the minimum/maximum dates to display.
  10138. // not responsible for trimming hidden days.
  10139. DateProfileGenerator.prototype.buildValidRange = function () {
  10140. return this._view.getUnzonedRangeOption('validRange', this._view.calendar.getNow()) ||
  10141. new UnzonedRange_1.default(); // completely open-ended
  10142. };
  10143. // Builds a structure with info about the "current" range, the range that is
  10144. // highlighted as being the current month for example.
  10145. // See build() for a description of `direction`.
  10146. // Guaranteed to have `range` and `unit` properties. `duration` is optional.
  10147. // TODO: accept a MS-time instead of a moment `date`?
  10148. DateProfileGenerator.prototype.buildCurrentRangeInfo = function (date, direction) {
  10149. var viewSpec = this._view.viewSpec;
  10150. var duration = null;
  10151. var unit = null;
  10152. var unzonedRange = null;
  10153. var dayCount;
  10154. if (viewSpec.duration) {
  10155. duration = viewSpec.duration;
  10156. unit = viewSpec.durationUnit;
  10157. unzonedRange = this.buildRangeFromDuration(date, direction, duration, unit);
  10158. }
  10159. else if ((dayCount = this.opt('dayCount'))) {
  10160. unit = 'day';
  10161. unzonedRange = this.buildRangeFromDayCount(date, direction, dayCount);
  10162. }
  10163. else if ((unzonedRange = this.buildCustomVisibleRange(date))) {
  10164. unit = util_1.computeGreatestUnit(unzonedRange.getStart(), unzonedRange.getEnd());
  10165. }
  10166. else {
  10167. duration = this.getFallbackDuration();
  10168. unit = util_1.computeGreatestUnit(duration);
  10169. unzonedRange = this.buildRangeFromDuration(date, direction, duration, unit);
  10170. }
  10171. return { duration: duration, unit: unit, unzonedRange: unzonedRange };
  10172. };
  10173. DateProfileGenerator.prototype.getFallbackDuration = function () {
  10174. return moment.duration({ days: 1 });
  10175. };
  10176. // Returns a new activeUnzonedRange to have time values (un-ambiguate)
  10177. // minTime or maxTime causes the range to expand.
  10178. DateProfileGenerator.prototype.adjustActiveRange = function (unzonedRange, minTime, maxTime) {
  10179. var start = unzonedRange.getStart();
  10180. var end = unzonedRange.getEnd();
  10181. if (this._view.usesMinMaxTime) {
  10182. if (minTime < 0) {
  10183. start.time(0).add(minTime);
  10184. }
  10185. if (maxTime > 24 * 60 * 60 * 1000) {
  10186. end.time(maxTime - (24 * 60 * 60 * 1000));
  10187. }
  10188. }
  10189. return new UnzonedRange_1.default(start, end);
  10190. };
  10191. // Builds the "current" range when it is specified as an explicit duration.
  10192. // `unit` is the already-computed computeGreatestUnit value of duration.
  10193. // TODO: accept a MS-time instead of a moment `date`?
  10194. DateProfileGenerator.prototype.buildRangeFromDuration = function (date, direction, duration, unit) {
  10195. var alignment = this.opt('dateAlignment');
  10196. var dateIncrementInput;
  10197. var dateIncrementDuration;
  10198. var start;
  10199. var end;
  10200. var res;
  10201. // compute what the alignment should be
  10202. if (!alignment) {
  10203. dateIncrementInput = this.opt('dateIncrement');
  10204. if (dateIncrementInput) {
  10205. dateIncrementDuration = moment.duration(dateIncrementInput);
  10206. // use the smaller of the two units
  10207. if (dateIncrementDuration < duration) {
  10208. alignment = util_1.computeDurationGreatestUnit(dateIncrementDuration, dateIncrementInput);
  10209. }
  10210. else {
  10211. alignment = unit;
  10212. }
  10213. }
  10214. else {
  10215. alignment = unit;
  10216. }
  10217. }
  10218. // if the view displays a single day or smaller
  10219. if (duration.as('days') <= 1) {
  10220. if (this._view.isHiddenDay(start)) {
  10221. start = this._view.skipHiddenDays(start, direction);
  10222. start.startOf('day');
  10223. }
  10224. }
  10225. function computeRes() {
  10226. start = date.clone().startOf(alignment);
  10227. end = start.clone().add(duration);
  10228. res = new UnzonedRange_1.default(start, end);
  10229. }
  10230. computeRes();
  10231. // if range is completely enveloped by hidden days, go past the hidden days
  10232. if (!this.trimHiddenDays(res)) {
  10233. date = this._view.skipHiddenDays(date, direction);
  10234. computeRes();
  10235. }
  10236. return res;
  10237. };
  10238. // Builds the "current" range when a dayCount is specified.
  10239. // TODO: accept a MS-time instead of a moment `date`?
  10240. DateProfileGenerator.prototype.buildRangeFromDayCount = function (date, direction, dayCount) {
  10241. var customAlignment = this.opt('dateAlignment');
  10242. var runningCount = 0;
  10243. var start = date.clone();
  10244. var end;
  10245. if (customAlignment) {
  10246. start.startOf(customAlignment);
  10247. }
  10248. start.startOf('day');
  10249. start = this._view.skipHiddenDays(start, direction);
  10250. end = start.clone();
  10251. do {
  10252. end.add(1, 'day');
  10253. if (!this._view.isHiddenDay(end)) {
  10254. runningCount++;
  10255. }
  10256. } while (runningCount < dayCount);
  10257. return new UnzonedRange_1.default(start, end);
  10258. };
  10259. // Builds a normalized range object for the "visible" range,
  10260. // which is a way to define the currentUnzonedRange and activeUnzonedRange at the same time.
  10261. // TODO: accept a MS-time instead of a moment `date`?
  10262. DateProfileGenerator.prototype.buildCustomVisibleRange = function (date) {
  10263. var visibleUnzonedRange = this._view.getUnzonedRangeOption('visibleRange', this._view.calendar.applyTimezone(date) // correct zone. also generates new obj that avoids mutations
  10264. );
  10265. if (visibleUnzonedRange && (visibleUnzonedRange.startMs == null || visibleUnzonedRange.endMs == null)) {
  10266. return null;
  10267. }
  10268. return visibleUnzonedRange;
  10269. };
  10270. // Computes the range that will represent the element/cells for *rendering*,
  10271. // but which may have voided days/times.
  10272. // not responsible for trimming hidden days.
  10273. DateProfileGenerator.prototype.buildRenderRange = function (currentUnzonedRange, currentRangeUnit, isRangeAllDay) {
  10274. return currentUnzonedRange.clone();
  10275. };
  10276. // Compute the duration value that should be added/substracted to the current date
  10277. // when a prev/next operation happens.
  10278. DateProfileGenerator.prototype.buildDateIncrement = function (fallback) {
  10279. var dateIncrementInput = this.opt('dateIncrement');
  10280. var customAlignment;
  10281. if (dateIncrementInput) {
  10282. return moment.duration(dateIncrementInput);
  10283. }
  10284. else if ((customAlignment = this.opt('dateAlignment'))) {
  10285. return moment.duration(1, customAlignment);
  10286. }
  10287. else if (fallback) {
  10288. return fallback;
  10289. }
  10290. else {
  10291. return moment.duration({ days: 1 });
  10292. }
  10293. };
  10294. return DateProfileGenerator;
  10295. }());
  10296. exports.default = DateProfileGenerator;
  10297. /***/ }),
  10298. /* 222 */
  10299. /***/ (function(module, exports, __webpack_require__) {
  10300. Object.defineProperty(exports, "__esModule", { value: true });
  10301. var tslib_1 = __webpack_require__(2);
  10302. var $ = __webpack_require__(3);
  10303. var moment = __webpack_require__(0);
  10304. var exportHooks = __webpack_require__(16);
  10305. var util_1 = __webpack_require__(4);
  10306. var moment_ext_1 = __webpack_require__(10);
  10307. var ListenerMixin_1 = __webpack_require__(7);
  10308. var HitDragListener_1 = __webpack_require__(23);
  10309. var SingleEventDef_1 = __webpack_require__(13);
  10310. var EventInstanceGroup_1 = __webpack_require__(18);
  10311. var EventSource_1 = __webpack_require__(6);
  10312. var Interaction_1 = __webpack_require__(15);
  10313. var ExternalDropping = /** @class */ (function (_super) {
  10314. tslib_1.__extends(ExternalDropping, _super);
  10315. function ExternalDropping() {
  10316. var _this = _super !== null && _super.apply(this, arguments) || this;
  10317. _this.isDragging = false; // jqui-dragging an external element? boolean
  10318. return _this;
  10319. }
  10320. /*
  10321. component impements:
  10322. - eventRangesToEventFootprints
  10323. - isEventInstanceGroupAllowed
  10324. - isExternalInstanceGroupAllowed
  10325. - renderDrag
  10326. - unrenderDrag
  10327. */
  10328. ExternalDropping.prototype.end = function () {
  10329. if (this.dragListener) {
  10330. this.dragListener.endInteraction();
  10331. }
  10332. };
  10333. ExternalDropping.prototype.bindToDocument = function () {
  10334. this.listenTo($(document), {
  10335. dragstart: this.handleDragStart,
  10336. sortstart: this.handleDragStart // jqui
  10337. });
  10338. };
  10339. ExternalDropping.prototype.unbindFromDocument = function () {
  10340. this.stopListeningTo($(document));
  10341. };
  10342. // Called when a jQuery UI drag is initiated anywhere in the DOM
  10343. ExternalDropping.prototype.handleDragStart = function (ev, ui) {
  10344. var el;
  10345. var accept;
  10346. if (this.opt('droppable')) {
  10347. el = $((ui ? ui.item : null) || ev.target);
  10348. // Test that the dragged element passes the dropAccept selector or filter function.
  10349. // FYI, the default is "*" (matches all)
  10350. accept = this.opt('dropAccept');
  10351. if ($.isFunction(accept) ? accept.call(el[0], el) : el.is(accept)) {
  10352. if (!this.isDragging) {
  10353. this.listenToExternalDrag(el, ev, ui);
  10354. }
  10355. }
  10356. }
  10357. };
  10358. // Called when a jQuery UI drag starts and it needs to be monitored for dropping
  10359. ExternalDropping.prototype.listenToExternalDrag = function (el, ev, ui) {
  10360. var _this = this;
  10361. var component = this.component;
  10362. var view = this.view;
  10363. var meta = getDraggedElMeta(el); // extra data about event drop, including possible event to create
  10364. var singleEventDef; // a null value signals an unsuccessful drag
  10365. // listener that tracks mouse movement over date-associated pixel regions
  10366. var dragListener = this.dragListener = new HitDragListener_1.default(component, {
  10367. interactionStart: function () {
  10368. _this.isDragging = true;
  10369. },
  10370. hitOver: function (hit) {
  10371. var isAllowed = true;
  10372. var hitFootprint = hit.component.getSafeHitFootprint(hit); // hit might not belong to this grid
  10373. var mutatedEventInstanceGroup;
  10374. if (hitFootprint) {
  10375. singleEventDef = _this.computeExternalDrop(hitFootprint, meta);
  10376. if (singleEventDef) {
  10377. mutatedEventInstanceGroup = new EventInstanceGroup_1.default(singleEventDef.buildInstances());
  10378. isAllowed = meta.eventProps ? // isEvent?
  10379. component.isEventInstanceGroupAllowed(mutatedEventInstanceGroup) :
  10380. component.isExternalInstanceGroupAllowed(mutatedEventInstanceGroup);
  10381. }
  10382. else {
  10383. isAllowed = false;
  10384. }
  10385. }
  10386. else {
  10387. isAllowed = false;
  10388. }
  10389. if (!isAllowed) {
  10390. singleEventDef = null;
  10391. util_1.disableCursor();
  10392. }
  10393. if (singleEventDef) {
  10394. component.renderDrag(// called without a seg parameter
  10395. component.eventRangesToEventFootprints(mutatedEventInstanceGroup.sliceRenderRanges(component.dateProfile.renderUnzonedRange, view.calendar)));
  10396. }
  10397. },
  10398. hitOut: function () {
  10399. singleEventDef = null; // signal unsuccessful
  10400. },
  10401. hitDone: function () {
  10402. util_1.enableCursor();
  10403. component.unrenderDrag();
  10404. },
  10405. interactionEnd: function (ev) {
  10406. if (singleEventDef) {
  10407. view.reportExternalDrop(singleEventDef, Boolean(meta.eventProps), // isEvent
  10408. Boolean(meta.stick), // isSticky
  10409. el, ev, ui);
  10410. }
  10411. _this.isDragging = false;
  10412. _this.dragListener = null;
  10413. }
  10414. });
  10415. dragListener.startDrag(ev); // start listening immediately
  10416. };
  10417. // Given a hit to be dropped upon, and misc data associated with the jqui drag (guaranteed to be a plain object),
  10418. // returns the zoned start/end dates for the event that would result from the hypothetical drop. end might be null.
  10419. // Returning a null value signals an invalid drop hit.
  10420. // DOES NOT consider overlap/constraint.
  10421. // Assumes both footprints are non-open-ended.
  10422. ExternalDropping.prototype.computeExternalDrop = function (componentFootprint, meta) {
  10423. var calendar = this.view.calendar;
  10424. var start = moment_ext_1.default.utc(componentFootprint.unzonedRange.startMs).stripZone();
  10425. var end;
  10426. var eventDef;
  10427. if (componentFootprint.isAllDay) {
  10428. // if dropped on an all-day span, and element's metadata specified a time, set it
  10429. if (meta.startTime) {
  10430. start.time(meta.startTime);
  10431. }
  10432. else {
  10433. start.stripTime();
  10434. }
  10435. }
  10436. if (meta.duration) {
  10437. end = start.clone().add(meta.duration);
  10438. }
  10439. start = calendar.applyTimezone(start);
  10440. if (end) {
  10441. end = calendar.applyTimezone(end);
  10442. }
  10443. eventDef = SingleEventDef_1.default.parse($.extend({}, meta.eventProps, {
  10444. start: start,
  10445. end: end
  10446. }), new EventSource_1.default(calendar));
  10447. return eventDef;
  10448. };
  10449. return ExternalDropping;
  10450. }(Interaction_1.default));
  10451. exports.default = ExternalDropping;
  10452. ListenerMixin_1.default.mixInto(ExternalDropping);
  10453. /* External-Dragging-Element Data
  10454. ----------------------------------------------------------------------------------------------------------------------*/
  10455. // Require all HTML5 data-* attributes used by FullCalendar to have this prefix.
  10456. // A value of '' will query attributes like data-event. A value of 'fc' will query attributes like data-fc-event.
  10457. exportHooks.dataAttrPrefix = '';
  10458. // Given a jQuery element that might represent a dragged FullCalendar event, returns an intermediate data structure
  10459. // to be used for Event Object creation.
  10460. // A defined `.eventProps`, even when empty, indicates that an event should be created.
  10461. function getDraggedElMeta(el) {
  10462. var prefix = exportHooks.dataAttrPrefix;
  10463. var eventProps; // properties for creating the event, not related to date/time
  10464. var startTime; // a Duration
  10465. var duration;
  10466. var stick;
  10467. if (prefix) {
  10468. prefix += '-';
  10469. }
  10470. eventProps = el.data(prefix + 'event') || null;
  10471. if (eventProps) {
  10472. if (typeof eventProps === 'object') {
  10473. eventProps = $.extend({}, eventProps); // make a copy
  10474. }
  10475. else {
  10476. eventProps = {};
  10477. }
  10478. // pluck special-cased date/time properties
  10479. startTime = eventProps.start;
  10480. if (startTime == null) {
  10481. startTime = eventProps.time;
  10482. } // accept 'time' as well
  10483. duration = eventProps.duration;
  10484. stick = eventProps.stick;
  10485. delete eventProps.start;
  10486. delete eventProps.time;
  10487. delete eventProps.duration;
  10488. delete eventProps.stick;
  10489. }
  10490. // fallback to standalone attribute values for each of the date/time properties
  10491. if (startTime == null) {
  10492. startTime = el.data(prefix + 'start');
  10493. }
  10494. if (startTime == null) {
  10495. startTime = el.data(prefix + 'time');
  10496. } // accept 'time' as well
  10497. if (duration == null) {
  10498. duration = el.data(prefix + 'duration');
  10499. }
  10500. if (stick == null) {
  10501. stick = el.data(prefix + 'stick');
  10502. }
  10503. // massage into correct data types
  10504. startTime = startTime != null ? moment.duration(startTime) : null;
  10505. duration = duration != null ? moment.duration(duration) : null;
  10506. stick = Boolean(stick);
  10507. return { eventProps: eventProps, startTime: startTime, duration: duration, stick: stick };
  10508. }
  10509. /***/ }),
  10510. /* 223 */
  10511. /***/ (function(module, exports, __webpack_require__) {
  10512. Object.defineProperty(exports, "__esModule", { value: true });
  10513. var tslib_1 = __webpack_require__(2);
  10514. var $ = __webpack_require__(3);
  10515. var util_1 = __webpack_require__(4);
  10516. var EventDefMutation_1 = __webpack_require__(37);
  10517. var EventDefDateMutation_1 = __webpack_require__(50);
  10518. var HitDragListener_1 = __webpack_require__(23);
  10519. var Interaction_1 = __webpack_require__(15);
  10520. var EventResizing = /** @class */ (function (_super) {
  10521. tslib_1.__extends(EventResizing, _super);
  10522. /*
  10523. component impements:
  10524. - bindSegHandlerToEl
  10525. - publiclyTrigger
  10526. - diffDates
  10527. - eventRangesToEventFootprints
  10528. - isEventInstanceGroupAllowed
  10529. - getSafeHitFootprint
  10530. */
  10531. function EventResizing(component, eventPointing) {
  10532. var _this = _super.call(this, component) || this;
  10533. _this.isResizing = false;
  10534. _this.eventPointing = eventPointing;
  10535. return _this;
  10536. }
  10537. EventResizing.prototype.end = function () {
  10538. if (this.dragListener) {
  10539. this.dragListener.endInteraction();
  10540. }
  10541. };
  10542. EventResizing.prototype.bindToEl = function (el) {
  10543. var component = this.component;
  10544. component.bindSegHandlerToEl(el, 'mousedown', this.handleMouseDown.bind(this));
  10545. component.bindSegHandlerToEl(el, 'touchstart', this.handleTouchStart.bind(this));
  10546. };
  10547. EventResizing.prototype.handleMouseDown = function (seg, ev) {
  10548. if (this.component.canStartResize(seg, ev)) {
  10549. this.buildDragListener(seg, $(ev.target).is('.fc-start-resizer'))
  10550. .startInteraction(ev, { distance: 5 });
  10551. }
  10552. };
  10553. EventResizing.prototype.handleTouchStart = function (seg, ev) {
  10554. if (this.component.canStartResize(seg, ev)) {
  10555. this.buildDragListener(seg, $(ev.target).is('.fc-start-resizer'))
  10556. .startInteraction(ev);
  10557. }
  10558. };
  10559. // Creates a listener that tracks the user as they resize an event segment.
  10560. // Generic enough to work with any type of Grid.
  10561. EventResizing.prototype.buildDragListener = function (seg, isStart) {
  10562. var _this = this;
  10563. var component = this.component;
  10564. var view = this.view;
  10565. var calendar = view.calendar;
  10566. var eventManager = calendar.eventManager;
  10567. var el = seg.el;
  10568. var eventDef = seg.footprint.eventDef;
  10569. var eventInstance = seg.footprint.eventInstance;
  10570. var isDragging;
  10571. var resizeMutation; // zoned event date properties. falsy if invalid resize
  10572. // Tracks mouse movement over the *grid's* coordinate map
  10573. var dragListener = this.dragListener = new HitDragListener_1.default(component, {
  10574. scroll: this.opt('dragScroll'),
  10575. subjectEl: el,
  10576. interactionStart: function () {
  10577. isDragging = false;
  10578. },
  10579. dragStart: function (ev) {
  10580. isDragging = true;
  10581. // ensure a mouseout on the manipulated event has been reported
  10582. _this.eventPointing.handleMouseout(seg, ev);
  10583. _this.segResizeStart(seg, ev);
  10584. },
  10585. hitOver: function (hit, isOrig, origHit) {
  10586. var isAllowed = true;
  10587. var origHitFootprint = component.getSafeHitFootprint(origHit);
  10588. var hitFootprint = component.getSafeHitFootprint(hit);
  10589. var mutatedEventInstanceGroup;
  10590. if (origHitFootprint && hitFootprint) {
  10591. resizeMutation = isStart ?
  10592. _this.computeEventStartResizeMutation(origHitFootprint, hitFootprint, seg.footprint) :
  10593. _this.computeEventEndResizeMutation(origHitFootprint, hitFootprint, seg.footprint);
  10594. if (resizeMutation) {
  10595. mutatedEventInstanceGroup = eventManager.buildMutatedEventInstanceGroup(eventDef.id, resizeMutation);
  10596. isAllowed = component.isEventInstanceGroupAllowed(mutatedEventInstanceGroup);
  10597. }
  10598. else {
  10599. isAllowed = false;
  10600. }
  10601. }
  10602. else {
  10603. isAllowed = false;
  10604. }
  10605. if (!isAllowed) {
  10606. resizeMutation = null;
  10607. util_1.disableCursor();
  10608. }
  10609. else if (resizeMutation.isEmpty()) {
  10610. // no change. (FYI, event dates might have zones)
  10611. resizeMutation = null;
  10612. }
  10613. if (resizeMutation) {
  10614. view.hideEventsWithId(seg.footprint.eventDef.id);
  10615. view.renderEventResize(component.eventRangesToEventFootprints(mutatedEventInstanceGroup.sliceRenderRanges(component.dateProfile.renderUnzonedRange, calendar)), seg);
  10616. }
  10617. },
  10618. hitOut: function () {
  10619. resizeMutation = null;
  10620. },
  10621. hitDone: function () {
  10622. view.unrenderEventResize(seg);
  10623. view.showEventsWithId(seg.footprint.eventDef.id);
  10624. util_1.enableCursor();
  10625. },
  10626. interactionEnd: function (ev) {
  10627. if (isDragging) {
  10628. _this.segResizeStop(seg, ev);
  10629. }
  10630. if (resizeMutation) {
  10631. // no need to re-show original, will rerender all anyways. esp important if eventRenderWait
  10632. view.reportEventResize(eventInstance, resizeMutation, el, ev);
  10633. }
  10634. _this.dragListener = null;
  10635. }
  10636. });
  10637. return dragListener;
  10638. };
  10639. // Called before event segment resizing starts
  10640. EventResizing.prototype.segResizeStart = function (seg, ev) {
  10641. this.isResizing = true;
  10642. this.component.publiclyTrigger('eventResizeStart', {
  10643. context: seg.el[0],
  10644. args: [
  10645. seg.footprint.getEventLegacy(),
  10646. ev,
  10647. {},
  10648. this.view
  10649. ]
  10650. });
  10651. };
  10652. // Called after event segment resizing stops
  10653. EventResizing.prototype.segResizeStop = function (seg, ev) {
  10654. this.isResizing = false;
  10655. this.component.publiclyTrigger('eventResizeStop', {
  10656. context: seg.el[0],
  10657. args: [
  10658. seg.footprint.getEventLegacy(),
  10659. ev,
  10660. {},
  10661. this.view
  10662. ]
  10663. });
  10664. };
  10665. // Returns new date-information for an event segment being resized from its start
  10666. EventResizing.prototype.computeEventStartResizeMutation = function (startFootprint, endFootprint, origEventFootprint) {
  10667. var origRange = origEventFootprint.componentFootprint.unzonedRange;
  10668. var startDelta = this.component.diffDates(endFootprint.unzonedRange.getStart(), startFootprint.unzonedRange.getStart());
  10669. var dateMutation;
  10670. var eventDefMutation;
  10671. if (origRange.getStart().add(startDelta) < origRange.getEnd()) {
  10672. dateMutation = new EventDefDateMutation_1.default();
  10673. dateMutation.setStartDelta(startDelta);
  10674. eventDefMutation = new EventDefMutation_1.default();
  10675. eventDefMutation.setDateMutation(dateMutation);
  10676. return eventDefMutation;
  10677. }
  10678. return false;
  10679. };
  10680. // Returns new date-information for an event segment being resized from its end
  10681. EventResizing.prototype.computeEventEndResizeMutation = function (startFootprint, endFootprint, origEventFootprint) {
  10682. var origRange = origEventFootprint.componentFootprint.unzonedRange;
  10683. var endDelta = this.component.diffDates(endFootprint.unzonedRange.getEnd(), startFootprint.unzonedRange.getEnd());
  10684. var dateMutation;
  10685. var eventDefMutation;
  10686. if (origRange.getEnd().add(endDelta) > origRange.getStart()) {
  10687. dateMutation = new EventDefDateMutation_1.default();
  10688. dateMutation.setEndDelta(endDelta);
  10689. eventDefMutation = new EventDefMutation_1.default();
  10690. eventDefMutation.setDateMutation(dateMutation);
  10691. return eventDefMutation;
  10692. }
  10693. return false;
  10694. };
  10695. return EventResizing;
  10696. }(Interaction_1.default));
  10697. exports.default = EventResizing;
  10698. /***/ }),
  10699. /* 224 */
  10700. /***/ (function(module, exports, __webpack_require__) {
  10701. Object.defineProperty(exports, "__esModule", { value: true });
  10702. var tslib_1 = __webpack_require__(2);
  10703. var util_1 = __webpack_require__(4);
  10704. var EventDefMutation_1 = __webpack_require__(37);
  10705. var EventDefDateMutation_1 = __webpack_require__(50);
  10706. var DragListener_1 = __webpack_require__(54);
  10707. var HitDragListener_1 = __webpack_require__(23);
  10708. var MouseFollower_1 = __webpack_require__(244);
  10709. var Interaction_1 = __webpack_require__(15);
  10710. var EventDragging = /** @class */ (function (_super) {
  10711. tslib_1.__extends(EventDragging, _super);
  10712. /*
  10713. component implements:
  10714. - bindSegHandlerToEl
  10715. - publiclyTrigger
  10716. - diffDates
  10717. - eventRangesToEventFootprints
  10718. - isEventInstanceGroupAllowed
  10719. */
  10720. function EventDragging(component, eventPointing) {
  10721. var _this = _super.call(this, component) || this;
  10722. _this.isDragging = false;
  10723. _this.eventPointing = eventPointing;
  10724. return _this;
  10725. }
  10726. EventDragging.prototype.end = function () {
  10727. if (this.dragListener) {
  10728. this.dragListener.endInteraction();
  10729. }
  10730. };
  10731. EventDragging.prototype.getSelectionDelay = function () {
  10732. var delay = this.opt('eventLongPressDelay');
  10733. if (delay == null) {
  10734. delay = this.opt('longPressDelay'); // fallback
  10735. }
  10736. return delay;
  10737. };
  10738. EventDragging.prototype.bindToEl = function (el) {
  10739. var component = this.component;
  10740. component.bindSegHandlerToEl(el, 'mousedown', this.handleMousedown.bind(this));
  10741. component.bindSegHandlerToEl(el, 'touchstart', this.handleTouchStart.bind(this));
  10742. };
  10743. EventDragging.prototype.handleMousedown = function (seg, ev) {
  10744. if (!this.component.shouldIgnoreMouse() &&
  10745. this.component.canStartDrag(seg, ev)) {
  10746. this.buildDragListener(seg).startInteraction(ev, { distance: 5 });
  10747. }
  10748. };
  10749. EventDragging.prototype.handleTouchStart = function (seg, ev) {
  10750. var component = this.component;
  10751. var settings = {
  10752. delay: this.view.isEventDefSelected(seg.footprint.eventDef) ? // already selected?
  10753. 0 : this.getSelectionDelay()
  10754. };
  10755. if (component.canStartDrag(seg, ev)) {
  10756. this.buildDragListener(seg).startInteraction(ev, settings);
  10757. }
  10758. else if (component.canStartSelection(seg, ev)) {
  10759. this.buildSelectListener(seg).startInteraction(ev, settings);
  10760. }
  10761. };
  10762. // seg isn't draggable, but let's use a generic DragListener
  10763. // simply for the delay, so it can be selected.
  10764. // Has side effect of setting/unsetting `dragListener`
  10765. EventDragging.prototype.buildSelectListener = function (seg) {
  10766. var _this = this;
  10767. var view = this.view;
  10768. var eventDef = seg.footprint.eventDef;
  10769. var eventInstance = seg.footprint.eventInstance; // null for inverse-background events
  10770. if (this.dragListener) {
  10771. return this.dragListener;
  10772. }
  10773. var dragListener = this.dragListener = new DragListener_1.default({
  10774. dragStart: function (ev) {
  10775. if (dragListener.isTouch &&
  10776. !view.isEventDefSelected(eventDef) &&
  10777. eventInstance) {
  10778. // if not previously selected, will fire after a delay. then, select the event
  10779. view.selectEventInstance(eventInstance);
  10780. }
  10781. },
  10782. interactionEnd: function (ev) {
  10783. _this.dragListener = null;
  10784. }
  10785. });
  10786. return dragListener;
  10787. };
  10788. // Builds a listener that will track user-dragging on an event segment.
  10789. // Generic enough to work with any type of Grid.
  10790. // Has side effect of setting/unsetting `dragListener`
  10791. EventDragging.prototype.buildDragListener = function (seg) {
  10792. var _this = this;
  10793. var component = this.component;
  10794. var view = this.view;
  10795. var calendar = view.calendar;
  10796. var eventManager = calendar.eventManager;
  10797. var el = seg.el;
  10798. var eventDef = seg.footprint.eventDef;
  10799. var eventInstance = seg.footprint.eventInstance; // null for inverse-background events
  10800. var isDragging;
  10801. var mouseFollower; // A clone of the original element that will move with the mouse
  10802. var eventDefMutation;
  10803. if (this.dragListener) {
  10804. return this.dragListener;
  10805. }
  10806. // Tracks mouse movement over the *view's* coordinate map. Allows dragging and dropping between subcomponents
  10807. // of the view.
  10808. var dragListener = this.dragListener = new HitDragListener_1.default(view, {
  10809. scroll: this.opt('dragScroll'),
  10810. subjectEl: el,
  10811. subjectCenter: true,
  10812. interactionStart: function (ev) {
  10813. seg.component = component; // for renderDrag
  10814. isDragging = false;
  10815. mouseFollower = new MouseFollower_1.default(seg.el, {
  10816. additionalClass: 'fc-dragging',
  10817. parentEl: view.el,
  10818. opacity: dragListener.isTouch ? null : _this.opt('dragOpacity'),
  10819. revertDuration: _this.opt('dragRevertDuration'),
  10820. zIndex: 2 // one above the .fc-view
  10821. });
  10822. mouseFollower.hide(); // don't show until we know this is a real drag
  10823. mouseFollower.start(ev);
  10824. },
  10825. dragStart: function (ev) {
  10826. if (dragListener.isTouch &&
  10827. !view.isEventDefSelected(eventDef) &&
  10828. eventInstance) {
  10829. // if not previously selected, will fire after a delay. then, select the event
  10830. view.selectEventInstance(eventInstance);
  10831. }
  10832. isDragging = true;
  10833. // ensure a mouseout on the manipulated event has been reported
  10834. _this.eventPointing.handleMouseout(seg, ev);
  10835. _this.segDragStart(seg, ev);
  10836. view.hideEventsWithId(seg.footprint.eventDef.id);
  10837. },
  10838. hitOver: function (hit, isOrig, origHit) {
  10839. var isAllowed = true;
  10840. var origFootprint;
  10841. var footprint;
  10842. var mutatedEventInstanceGroup;
  10843. // starting hit could be forced (DayGrid.limit)
  10844. if (seg.hit) {
  10845. origHit = seg.hit;
  10846. }
  10847. // hit might not belong to this grid, so query origin grid
  10848. origFootprint = origHit.component.getSafeHitFootprint(origHit);
  10849. footprint = hit.component.getSafeHitFootprint(hit);
  10850. if (origFootprint && footprint) {
  10851. eventDefMutation = _this.computeEventDropMutation(origFootprint, footprint, eventDef);
  10852. if (eventDefMutation) {
  10853. mutatedEventInstanceGroup = eventManager.buildMutatedEventInstanceGroup(eventDef.id, eventDefMutation);
  10854. isAllowed = component.isEventInstanceGroupAllowed(mutatedEventInstanceGroup);
  10855. }
  10856. else {
  10857. isAllowed = false;
  10858. }
  10859. }
  10860. else {
  10861. isAllowed = false;
  10862. }
  10863. if (!isAllowed) {
  10864. eventDefMutation = null;
  10865. util_1.disableCursor();
  10866. }
  10867. // if a valid drop location, have the subclass render a visual indication
  10868. if (eventDefMutation &&
  10869. view.renderDrag(// truthy if rendered something
  10870. component.eventRangesToEventFootprints(mutatedEventInstanceGroup.sliceRenderRanges(component.dateProfile.renderUnzonedRange, calendar)), seg, dragListener.isTouch)) {
  10871. mouseFollower.hide(); // if the subclass is already using a mock event "helper", hide our own
  10872. }
  10873. else {
  10874. mouseFollower.show(); // otherwise, have the helper follow the mouse (no snapping)
  10875. }
  10876. if (isOrig) {
  10877. // needs to have moved hits to be a valid drop
  10878. eventDefMutation = null;
  10879. }
  10880. },
  10881. hitOut: function () {
  10882. view.unrenderDrag(seg); // unrender whatever was done in renderDrag
  10883. mouseFollower.show(); // show in case we are moving out of all hits
  10884. eventDefMutation = null;
  10885. },
  10886. hitDone: function () {
  10887. util_1.enableCursor();
  10888. },
  10889. interactionEnd: function (ev) {
  10890. delete seg.component; // prevent side effects
  10891. // do revert animation if hasn't changed. calls a callback when finished (whether animation or not)
  10892. mouseFollower.stop(!eventDefMutation, function () {
  10893. if (isDragging) {
  10894. view.unrenderDrag(seg);
  10895. _this.segDragStop(seg, ev);
  10896. }
  10897. view.showEventsWithId(seg.footprint.eventDef.id);
  10898. if (eventDefMutation) {
  10899. // no need to re-show original, will rerender all anyways. esp important if eventRenderWait
  10900. view.reportEventDrop(eventInstance, eventDefMutation, el, ev);
  10901. }
  10902. });
  10903. _this.dragListener = null;
  10904. }
  10905. });
  10906. return dragListener;
  10907. };
  10908. // Called before event segment dragging starts
  10909. EventDragging.prototype.segDragStart = function (seg, ev) {
  10910. this.isDragging = true;
  10911. this.component.publiclyTrigger('eventDragStart', {
  10912. context: seg.el[0],
  10913. args: [
  10914. seg.footprint.getEventLegacy(),
  10915. ev,
  10916. {},
  10917. this.view
  10918. ]
  10919. });
  10920. };
  10921. // Called after event segment dragging stops
  10922. EventDragging.prototype.segDragStop = function (seg, ev) {
  10923. this.isDragging = false;
  10924. this.component.publiclyTrigger('eventDragStop', {
  10925. context: seg.el[0],
  10926. args: [
  10927. seg.footprint.getEventLegacy(),
  10928. ev,
  10929. {},
  10930. this.view
  10931. ]
  10932. });
  10933. };
  10934. // DOES NOT consider overlap/constraint
  10935. EventDragging.prototype.computeEventDropMutation = function (startFootprint, endFootprint, eventDef) {
  10936. var eventDefMutation = new EventDefMutation_1.default();
  10937. eventDefMutation.setDateMutation(this.computeEventDateMutation(startFootprint, endFootprint));
  10938. return eventDefMutation;
  10939. };
  10940. EventDragging.prototype.computeEventDateMutation = function (startFootprint, endFootprint) {
  10941. var date0 = startFootprint.unzonedRange.getStart();
  10942. var date1 = endFootprint.unzonedRange.getStart();
  10943. var clearEnd = false;
  10944. var forceTimed = false;
  10945. var forceAllDay = false;
  10946. var dateDelta;
  10947. var dateMutation;
  10948. if (startFootprint.isAllDay !== endFootprint.isAllDay) {
  10949. clearEnd = true;
  10950. if (endFootprint.isAllDay) {
  10951. forceAllDay = true;
  10952. date0.stripTime();
  10953. }
  10954. else {
  10955. forceTimed = true;
  10956. }
  10957. }
  10958. dateDelta = this.component.diffDates(date1, date0);
  10959. dateMutation = new EventDefDateMutation_1.default();
  10960. dateMutation.clearEnd = clearEnd;
  10961. dateMutation.forceTimed = forceTimed;
  10962. dateMutation.forceAllDay = forceAllDay;
  10963. dateMutation.setDateDelta(dateDelta);
  10964. return dateMutation;
  10965. };
  10966. return EventDragging;
  10967. }(Interaction_1.default));
  10968. exports.default = EventDragging;
  10969. /***/ }),
  10970. /* 225 */
  10971. /***/ (function(module, exports, __webpack_require__) {
  10972. Object.defineProperty(exports, "__esModule", { value: true });
  10973. var tslib_1 = __webpack_require__(2);
  10974. var util_1 = __webpack_require__(4);
  10975. var HitDragListener_1 = __webpack_require__(23);
  10976. var ComponentFootprint_1 = __webpack_require__(12);
  10977. var UnzonedRange_1 = __webpack_require__(5);
  10978. var Interaction_1 = __webpack_require__(15);
  10979. var DateSelecting = /** @class */ (function (_super) {
  10980. tslib_1.__extends(DateSelecting, _super);
  10981. /*
  10982. component must implement:
  10983. - bindDateHandlerToEl
  10984. - getSafeHitFootprint
  10985. - renderHighlight
  10986. - unrenderHighlight
  10987. */
  10988. function DateSelecting(component) {
  10989. var _this = _super.call(this, component) || this;
  10990. _this.dragListener = _this.buildDragListener();
  10991. return _this;
  10992. }
  10993. DateSelecting.prototype.end = function () {
  10994. this.dragListener.endInteraction();
  10995. };
  10996. DateSelecting.prototype.getDelay = function () {
  10997. var delay = this.opt('selectLongPressDelay');
  10998. if (delay == null) {
  10999. delay = this.opt('longPressDelay'); // fallback
  11000. }
  11001. return delay;
  11002. };
  11003. DateSelecting.prototype.bindToEl = function (el) {
  11004. var _this = this;
  11005. var component = this.component;
  11006. var dragListener = this.dragListener;
  11007. component.bindDateHandlerToEl(el, 'mousedown', function (ev) {
  11008. if (_this.opt('selectable') && !component.shouldIgnoreMouse()) {
  11009. dragListener.startInteraction(ev, {
  11010. distance: _this.opt('selectMinDistance')
  11011. });
  11012. }
  11013. });
  11014. component.bindDateHandlerToEl(el, 'touchstart', function (ev) {
  11015. if (_this.opt('selectable') && !component.shouldIgnoreTouch()) {
  11016. dragListener.startInteraction(ev, {
  11017. delay: _this.getDelay()
  11018. });
  11019. }
  11020. });
  11021. util_1.preventSelection(el);
  11022. };
  11023. // Creates a listener that tracks the user's drag across day elements, for day selecting.
  11024. DateSelecting.prototype.buildDragListener = function () {
  11025. var _this = this;
  11026. var component = this.component;
  11027. var selectionFootprint; // null if invalid selection
  11028. var dragListener = new HitDragListener_1.default(component, {
  11029. scroll: this.opt('dragScroll'),
  11030. interactionStart: function () {
  11031. selectionFootprint = null;
  11032. },
  11033. dragStart: function (ev) {
  11034. _this.view.unselect(ev); // since we could be rendering a new selection, we want to clear any old one
  11035. },
  11036. hitOver: function (hit, isOrig, origHit) {
  11037. var origHitFootprint;
  11038. var hitFootprint;
  11039. if (origHit) {
  11040. origHitFootprint = component.getSafeHitFootprint(origHit);
  11041. hitFootprint = component.getSafeHitFootprint(hit);
  11042. if (origHitFootprint && hitFootprint) {
  11043. selectionFootprint = _this.computeSelection(origHitFootprint, hitFootprint);
  11044. }
  11045. else {
  11046. selectionFootprint = null;
  11047. }
  11048. if (selectionFootprint) {
  11049. component.renderSelectionFootprint(selectionFootprint);
  11050. }
  11051. else if (selectionFootprint === false) {
  11052. util_1.disableCursor();
  11053. }
  11054. }
  11055. },
  11056. hitOut: function () {
  11057. selectionFootprint = null;
  11058. component.unrenderSelection();
  11059. },
  11060. hitDone: function () {
  11061. util_1.enableCursor();
  11062. },
  11063. interactionEnd: function (ev, isCancelled) {
  11064. if (!isCancelled && selectionFootprint) {
  11065. // the selection will already have been rendered. just report it
  11066. _this.view.reportSelection(selectionFootprint, ev);
  11067. }
  11068. }
  11069. });
  11070. return dragListener;
  11071. };
  11072. // Given the first and last date-spans of a selection, returns another date-span object.
  11073. // Subclasses can override and provide additional data in the span object. Will be passed to renderSelectionFootprint().
  11074. // Will return false if the selection is invalid and this should be indicated to the user.
  11075. // Will return null/undefined if a selection invalid but no error should be reported.
  11076. DateSelecting.prototype.computeSelection = function (footprint0, footprint1) {
  11077. var wholeFootprint = this.computeSelectionFootprint(footprint0, footprint1);
  11078. if (wholeFootprint && !this.isSelectionFootprintAllowed(wholeFootprint)) {
  11079. return false;
  11080. }
  11081. return wholeFootprint;
  11082. };
  11083. // Given two spans, must return the combination of the two.
  11084. // TODO: do this separation of concerns (combining VS validation) for event dnd/resize too.
  11085. // Assumes both footprints are non-open-ended.
  11086. DateSelecting.prototype.computeSelectionFootprint = function (footprint0, footprint1) {
  11087. var ms = [
  11088. footprint0.unzonedRange.startMs,
  11089. footprint0.unzonedRange.endMs,
  11090. footprint1.unzonedRange.startMs,
  11091. footprint1.unzonedRange.endMs
  11092. ];
  11093. ms.sort(util_1.compareNumbers);
  11094. return new ComponentFootprint_1.default(new UnzonedRange_1.default(ms[0], ms[3]), footprint0.isAllDay);
  11095. };
  11096. DateSelecting.prototype.isSelectionFootprintAllowed = function (componentFootprint) {
  11097. return this.component.dateProfile.validUnzonedRange.containsRange(componentFootprint.unzonedRange) &&
  11098. this.view.calendar.constraints.isSelectionFootprintAllowed(componentFootprint);
  11099. };
  11100. return DateSelecting;
  11101. }(Interaction_1.default));
  11102. exports.default = DateSelecting;
  11103. /***/ }),
  11104. /* 226 */
  11105. /***/ (function(module, exports, __webpack_require__) {
  11106. Object.defineProperty(exports, "__esModule", { value: true });
  11107. var tslib_1 = __webpack_require__(2);
  11108. var moment = __webpack_require__(0);
  11109. var $ = __webpack_require__(3);
  11110. var util_1 = __webpack_require__(4);
  11111. var Scroller_1 = __webpack_require__(39);
  11112. var View_1 = __webpack_require__(41);
  11113. var TimeGrid_1 = __webpack_require__(227);
  11114. var DayGrid_1 = __webpack_require__(61);
  11115. var AGENDA_ALL_DAY_EVENT_LIMIT = 5;
  11116. var agendaTimeGridMethods;
  11117. var agendaDayGridMethods;
  11118. /* An abstract class for all agenda-related views. Displays one more columns with time slots running vertically.
  11119. ----------------------------------------------------------------------------------------------------------------------*/
  11120. // Is a manager for the TimeGrid subcomponent and possibly the DayGrid subcomponent (if allDaySlot is on).
  11121. // Responsible for managing width/height.
  11122. var AgendaView = /** @class */ (function (_super) {
  11123. tslib_1.__extends(AgendaView, _super);
  11124. function AgendaView(calendar, viewSpec) {
  11125. var _this = _super.call(this, calendar, viewSpec) || this;
  11126. _this.usesMinMaxTime = true; // indicates that minTime/maxTime affects rendering
  11127. _this.timeGrid = _this.instantiateTimeGrid();
  11128. _this.addChild(_this.timeGrid);
  11129. if (_this.opt('allDaySlot')) {
  11130. _this.dayGrid = _this.instantiateDayGrid(); // the all-day subcomponent of this view
  11131. _this.addChild(_this.dayGrid);
  11132. }
  11133. _this.scroller = new Scroller_1.default({
  11134. overflowX: 'hidden',
  11135. overflowY: 'auto'
  11136. });
  11137. return _this;
  11138. }
  11139. // Instantiates the TimeGrid object this view needs. Draws from this.timeGridClass
  11140. AgendaView.prototype.instantiateTimeGrid = function () {
  11141. var timeGrid = new this.timeGridClass(this);
  11142. util_1.copyOwnProps(agendaTimeGridMethods, timeGrid);
  11143. return timeGrid;
  11144. };
  11145. // Instantiates the DayGrid object this view might need. Draws from this.dayGridClass
  11146. AgendaView.prototype.instantiateDayGrid = function () {
  11147. var dayGrid = new this.dayGridClass(this);
  11148. util_1.copyOwnProps(agendaDayGridMethods, dayGrid);
  11149. return dayGrid;
  11150. };
  11151. /* Rendering
  11152. ------------------------------------------------------------------------------------------------------------------*/
  11153. AgendaView.prototype.renderSkeleton = function () {
  11154. var timeGridWrapEl;
  11155. var timeGridEl;
  11156. this.el.addClass('fc-agenda-view').html(this.renderSkeletonHtml());
  11157. this.scroller.render();
  11158. timeGridWrapEl = this.scroller.el.addClass('fc-time-grid-container');
  11159. timeGridEl = $('<div class="fc-time-grid" />').appendTo(timeGridWrapEl);
  11160. this.el.find('.fc-body > tr > td').append(timeGridWrapEl);
  11161. this.timeGrid.headContainerEl = this.el.find('.fc-head-container');
  11162. this.timeGrid.setElement(timeGridEl);
  11163. if (this.dayGrid) {
  11164. this.dayGrid.setElement(this.el.find('.fc-day-grid'));
  11165. // have the day-grid extend it's coordinate area over the <hr> dividing the two grids
  11166. this.dayGrid.bottomCoordPadding = this.dayGrid.el.next('hr').outerHeight();
  11167. }
  11168. };
  11169. AgendaView.prototype.unrenderSkeleton = function () {
  11170. this.timeGrid.removeElement();
  11171. if (this.dayGrid) {
  11172. this.dayGrid.removeElement();
  11173. }
  11174. this.scroller.destroy();
  11175. };
  11176. // Builds the HTML skeleton for the view.
  11177. // The day-grid and time-grid components will render inside containers defined by this HTML.
  11178. AgendaView.prototype.renderSkeletonHtml = function () {
  11179. var theme = this.calendar.theme;
  11180. return '' +
  11181. '<table class="' + theme.getClass('tableGrid') + '">' +
  11182. (this.opt('columnHeader') ?
  11183. '<thead class="fc-head">' +
  11184. '<tr>' +
  11185. '<td class="fc-head-container ' + theme.getClass('widgetHeader') + '">&nbsp;</td>' +
  11186. '</tr>' +
  11187. '</thead>' :
  11188. '') +
  11189. '<tbody class="fc-body">' +
  11190. '<tr>' +
  11191. '<td class="' + theme.getClass('widgetContent') + '">' +
  11192. (this.dayGrid ?
  11193. '<div class="fc-day-grid"/>' +
  11194. '<hr class="fc-divider ' + theme.getClass('widgetHeader') + '"/>' :
  11195. '') +
  11196. '</td>' +
  11197. '</tr>' +
  11198. '</tbody>' +
  11199. '</table>';
  11200. };
  11201. // Generates an HTML attribute string for setting the width of the axis, if it is known
  11202. AgendaView.prototype.axisStyleAttr = function () {
  11203. if (this.axisWidth != null) {
  11204. return 'style="width:' + this.axisWidth + 'px"';
  11205. }
  11206. return '';
  11207. };
  11208. /* Now Indicator
  11209. ------------------------------------------------------------------------------------------------------------------*/
  11210. AgendaView.prototype.getNowIndicatorUnit = function () {
  11211. return this.timeGrid.getNowIndicatorUnit();
  11212. };
  11213. /* Dimensions
  11214. ------------------------------------------------------------------------------------------------------------------*/
  11215. // Adjusts the vertical dimensions of the view to the specified values
  11216. AgendaView.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  11217. var eventLimit;
  11218. var scrollerHeight;
  11219. var scrollbarWidths;
  11220. _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
  11221. // make all axis cells line up, and record the width so newly created axis cells will have it
  11222. this.axisWidth = util_1.matchCellWidths(this.el.find('.fc-axis'));
  11223. // hack to give the view some height prior to timeGrid's columns being rendered
  11224. // TODO: separate setting height from scroller VS timeGrid.
  11225. if (!this.timeGrid.colEls) {
  11226. if (!isAuto) {
  11227. scrollerHeight = this.computeScrollerHeight(totalHeight);
  11228. this.scroller.setHeight(scrollerHeight);
  11229. }
  11230. return;
  11231. }
  11232. // set of fake row elements that must compensate when scroller has scrollbars
  11233. var noScrollRowEls = this.el.find('.fc-row:not(.fc-scroller *)');
  11234. // reset all dimensions back to the original state
  11235. this.timeGrid.bottomRuleEl.hide(); // .show() will be called later if this <hr> is necessary
  11236. this.scroller.clear(); // sets height to 'auto' and clears overflow
  11237. util_1.uncompensateScroll(noScrollRowEls);
  11238. // limit number of events in the all-day area
  11239. if (this.dayGrid) {
  11240. this.dayGrid.removeSegPopover(); // kill the "more" popover if displayed
  11241. eventLimit = this.opt('eventLimit');
  11242. if (eventLimit && typeof eventLimit !== 'number') {
  11243. eventLimit = AGENDA_ALL_DAY_EVENT_LIMIT; // make sure "auto" goes to a real number
  11244. }
  11245. if (eventLimit) {
  11246. this.dayGrid.limitRows(eventLimit);
  11247. }
  11248. }
  11249. if (!isAuto) {
  11250. scrollerHeight = this.computeScrollerHeight(totalHeight);
  11251. this.scroller.setHeight(scrollerHeight);
  11252. scrollbarWidths = this.scroller.getScrollbarWidths();
  11253. if (scrollbarWidths.left || scrollbarWidths.right) {
  11254. // make the all-day and header rows lines up
  11255. util_1.compensateScroll(noScrollRowEls, scrollbarWidths);
  11256. // the scrollbar compensation might have changed text flow, which might affect height, so recalculate
  11257. // and reapply the desired height to the scroller.
  11258. scrollerHeight = this.computeScrollerHeight(totalHeight);
  11259. this.scroller.setHeight(scrollerHeight);
  11260. }
  11261. // guarantees the same scrollbar widths
  11262. this.scroller.lockOverflow(scrollbarWidths);
  11263. // if there's any space below the slats, show the horizontal rule.
  11264. // this won't cause any new overflow, because lockOverflow already called.
  11265. if (this.timeGrid.getTotalSlatHeight() < scrollerHeight) {
  11266. this.timeGrid.bottomRuleEl.show();
  11267. }
  11268. }
  11269. };
  11270. // given a desired total height of the view, returns what the height of the scroller should be
  11271. AgendaView.prototype.computeScrollerHeight = function (totalHeight) {
  11272. return totalHeight -
  11273. util_1.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
  11274. };
  11275. /* Scroll
  11276. ------------------------------------------------------------------------------------------------------------------*/
  11277. // Computes the initial pre-configured scroll state prior to allowing the user to change it
  11278. AgendaView.prototype.computeInitialDateScroll = function () {
  11279. var scrollTime = moment.duration(this.opt('scrollTime'));
  11280. var top = this.timeGrid.computeTimeTop(scrollTime);
  11281. // zoom can give weird floating-point values. rather scroll a little bit further
  11282. top = Math.ceil(top);
  11283. if (top) {
  11284. top++; // to overcome top border that slots beyond the first have. looks better
  11285. }
  11286. return { top: top };
  11287. };
  11288. AgendaView.prototype.queryDateScroll = function () {
  11289. return { top: this.scroller.getScrollTop() };
  11290. };
  11291. AgendaView.prototype.applyDateScroll = function (scroll) {
  11292. if (scroll.top !== undefined) {
  11293. this.scroller.setScrollTop(scroll.top);
  11294. }
  11295. };
  11296. /* Hit Areas
  11297. ------------------------------------------------------------------------------------------------------------------*/
  11298. // forward all hit-related method calls to the grids (dayGrid might not be defined)
  11299. AgendaView.prototype.getHitFootprint = function (hit) {
  11300. // TODO: hit.component is set as a hack to identify where the hit came from
  11301. return hit.component.getHitFootprint(hit);
  11302. };
  11303. AgendaView.prototype.getHitEl = function (hit) {
  11304. // TODO: hit.component is set as a hack to identify where the hit came from
  11305. return hit.component.getHitEl(hit);
  11306. };
  11307. /* Event Rendering
  11308. ------------------------------------------------------------------------------------------------------------------*/
  11309. AgendaView.prototype.executeEventRender = function (eventsPayload) {
  11310. var dayEventsPayload = {};
  11311. var timedEventsPayload = {};
  11312. var id;
  11313. var eventInstanceGroup;
  11314. // separate the events into all-day and timed
  11315. for (id in eventsPayload) {
  11316. eventInstanceGroup = eventsPayload[id];
  11317. if (eventInstanceGroup.getEventDef().isAllDay()) {
  11318. dayEventsPayload[id] = eventInstanceGroup;
  11319. }
  11320. else {
  11321. timedEventsPayload[id] = eventInstanceGroup;
  11322. }
  11323. }
  11324. this.timeGrid.executeEventRender(timedEventsPayload);
  11325. if (this.dayGrid) {
  11326. this.dayGrid.executeEventRender(dayEventsPayload);
  11327. }
  11328. };
  11329. /* Dragging/Resizing Routing
  11330. ------------------------------------------------------------------------------------------------------------------*/
  11331. // A returned value of `true` signals that a mock "helper" event has been rendered.
  11332. AgendaView.prototype.renderDrag = function (eventFootprints, seg, isTouch) {
  11333. var groups = groupEventFootprintsByAllDay(eventFootprints);
  11334. var renderedHelper = false;
  11335. renderedHelper = this.timeGrid.renderDrag(groups.timed, seg, isTouch);
  11336. if (this.dayGrid) {
  11337. renderedHelper = this.dayGrid.renderDrag(groups.allDay, seg, isTouch) || renderedHelper;
  11338. }
  11339. return renderedHelper;
  11340. };
  11341. AgendaView.prototype.renderEventResize = function (eventFootprints, seg, isTouch) {
  11342. var groups = groupEventFootprintsByAllDay(eventFootprints);
  11343. this.timeGrid.renderEventResize(groups.timed, seg, isTouch);
  11344. if (this.dayGrid) {
  11345. this.dayGrid.renderEventResize(groups.allDay, seg, isTouch);
  11346. }
  11347. };
  11348. /* Selection
  11349. ------------------------------------------------------------------------------------------------------------------*/
  11350. // Renders a visual indication of a selection
  11351. AgendaView.prototype.renderSelectionFootprint = function (componentFootprint) {
  11352. if (!componentFootprint.isAllDay) {
  11353. this.timeGrid.renderSelectionFootprint(componentFootprint);
  11354. }
  11355. else if (this.dayGrid) {
  11356. this.dayGrid.renderSelectionFootprint(componentFootprint);
  11357. }
  11358. };
  11359. return AgendaView;
  11360. }(View_1.default));
  11361. exports.default = AgendaView;
  11362. AgendaView.prototype.timeGridClass = TimeGrid_1.default;
  11363. AgendaView.prototype.dayGridClass = DayGrid_1.default;
  11364. // Will customize the rendering behavior of the AgendaView's timeGrid
  11365. agendaTimeGridMethods = {
  11366. // Generates the HTML that will go before the day-of week header cells
  11367. renderHeadIntroHtml: function () {
  11368. var view = this.view;
  11369. var calendar = view.calendar;
  11370. var weekStart = calendar.msToUtcMoment(this.dateProfile.renderUnzonedRange.startMs, true);
  11371. var weekText;
  11372. if (this.opt('weekNumbers')) {
  11373. weekText = weekStart.format(this.opt('smallWeekFormat'));
  11374. return '' +
  11375. '<th class="fc-axis fc-week-number ' + calendar.theme.getClass('widgetHeader') + '" ' + view.axisStyleAttr() + '>' +
  11376. view.buildGotoAnchorHtml(// aside from link, important for matchCellWidths
  11377. { date: weekStart, type: 'week', forceOff: this.colCnt > 1 }, util_1.htmlEscape(weekText) // inner HTML
  11378. ) +
  11379. '</th>';
  11380. }
  11381. else {
  11382. return '<th class="fc-axis ' + calendar.theme.getClass('widgetHeader') + '" ' + view.axisStyleAttr() + '></th>';
  11383. }
  11384. },
  11385. // Generates the HTML that goes before the bg of the TimeGrid slot area. Long vertical column.
  11386. renderBgIntroHtml: function () {
  11387. var view = this.view;
  11388. return '<td class="fc-axis ' + view.calendar.theme.getClass('widgetContent') + '" ' + view.axisStyleAttr() + '></td>';
  11389. },
  11390. // Generates the HTML that goes before all other types of cells.
  11391. // Affects content-skeleton, helper-skeleton, highlight-skeleton for both the time-grid and day-grid.
  11392. renderIntroHtml: function () {
  11393. var view = this.view;
  11394. return '<td class="fc-axis" ' + view.axisStyleAttr() + '></td>';
  11395. }
  11396. };
  11397. // Will customize the rendering behavior of the AgendaView's dayGrid
  11398. agendaDayGridMethods = {
  11399. // Generates the HTML that goes before the all-day cells
  11400. renderBgIntroHtml: function () {
  11401. var view = this.view;
  11402. return '' +
  11403. '<td class="fc-axis ' + view.calendar.theme.getClass('widgetContent') + '" ' + view.axisStyleAttr() + '>' +
  11404. '<span>' + // needed for matchCellWidths
  11405. view.getAllDayHtml() +
  11406. '</span>' +
  11407. '</td>';
  11408. },
  11409. // Generates the HTML that goes before all other types of cells.
  11410. // Affects content-skeleton, helper-skeleton, highlight-skeleton for both the time-grid and day-grid.
  11411. renderIntroHtml: function () {
  11412. var view = this.view;
  11413. return '<td class="fc-axis" ' + view.axisStyleAttr() + '></td>';
  11414. }
  11415. };
  11416. function groupEventFootprintsByAllDay(eventFootprints) {
  11417. var allDay = [];
  11418. var timed = [];
  11419. var i;
  11420. for (i = 0; i < eventFootprints.length; i++) {
  11421. if (eventFootprints[i].componentFootprint.isAllDay) {
  11422. allDay.push(eventFootprints[i]);
  11423. }
  11424. else {
  11425. timed.push(eventFootprints[i]);
  11426. }
  11427. }
  11428. return { allDay: allDay, timed: timed };
  11429. }
  11430. /***/ }),
  11431. /* 227 */
  11432. /***/ (function(module, exports, __webpack_require__) {
  11433. Object.defineProperty(exports, "__esModule", { value: true });
  11434. var tslib_1 = __webpack_require__(2);
  11435. var $ = __webpack_require__(3);
  11436. var moment = __webpack_require__(0);
  11437. var util_1 = __webpack_require__(4);
  11438. var InteractiveDateComponent_1 = __webpack_require__(40);
  11439. var BusinessHourRenderer_1 = __webpack_require__(56);
  11440. var StandardInteractionsMixin_1 = __webpack_require__(60);
  11441. var DayTableMixin_1 = __webpack_require__(55);
  11442. var CoordCache_1 = __webpack_require__(53);
  11443. var UnzonedRange_1 = __webpack_require__(5);
  11444. var ComponentFootprint_1 = __webpack_require__(12);
  11445. var TimeGridEventRenderer_1 = __webpack_require__(246);
  11446. var TimeGridHelperRenderer_1 = __webpack_require__(247);
  11447. var TimeGridFillRenderer_1 = __webpack_require__(248);
  11448. /* A component that renders one or more columns of vertical time slots
  11449. ----------------------------------------------------------------------------------------------------------------------*/
  11450. // We mixin DayTable, even though there is only a single row of days
  11451. // potential nice values for the slot-duration and interval-duration
  11452. // from largest to smallest
  11453. var AGENDA_STOCK_SUB_DURATIONS = [
  11454. { hours: 1 },
  11455. { minutes: 30 },
  11456. { minutes: 15 },
  11457. { seconds: 30 },
  11458. { seconds: 15 }
  11459. ];
  11460. var TimeGrid = /** @class */ (function (_super) {
  11461. tslib_1.__extends(TimeGrid, _super);
  11462. function TimeGrid(view) {
  11463. var _this = _super.call(this, view) || this;
  11464. _this.processOptions();
  11465. return _this;
  11466. }
  11467. // Slices up the given span (unzoned start/end with other misc data) into an array of segments
  11468. TimeGrid.prototype.componentFootprintToSegs = function (componentFootprint) {
  11469. var segs = this.sliceRangeByTimes(componentFootprint.unzonedRange);
  11470. var i;
  11471. for (i = 0; i < segs.length; i++) {
  11472. if (this.isRTL) {
  11473. segs[i].col = this.daysPerRow - 1 - segs[i].dayIndex;
  11474. }
  11475. else {
  11476. segs[i].col = segs[i].dayIndex;
  11477. }
  11478. }
  11479. return segs;
  11480. };
  11481. /* Date Handling
  11482. ------------------------------------------------------------------------------------------------------------------*/
  11483. TimeGrid.prototype.sliceRangeByTimes = function (unzonedRange) {
  11484. var segs = [];
  11485. var segRange;
  11486. var dayIndex;
  11487. for (dayIndex = 0; dayIndex < this.daysPerRow; dayIndex++) {
  11488. segRange = unzonedRange.intersect(this.dayRanges[dayIndex]);
  11489. if (segRange) {
  11490. segs.push({
  11491. startMs: segRange.startMs,
  11492. endMs: segRange.endMs,
  11493. isStart: segRange.isStart,
  11494. isEnd: segRange.isEnd,
  11495. dayIndex: dayIndex
  11496. });
  11497. }
  11498. }
  11499. return segs;
  11500. };
  11501. /* Options
  11502. ------------------------------------------------------------------------------------------------------------------*/
  11503. // Parses various options into properties of this object
  11504. TimeGrid.prototype.processOptions = function () {
  11505. var slotDuration = this.opt('slotDuration');
  11506. var snapDuration = this.opt('snapDuration');
  11507. var input;
  11508. slotDuration = moment.duration(slotDuration);
  11509. snapDuration = snapDuration ? moment.duration(snapDuration) : slotDuration;
  11510. this.slotDuration = slotDuration;
  11511. this.snapDuration = snapDuration;
  11512. this.snapsPerSlot = slotDuration / snapDuration; // TODO: ensure an integer multiple?
  11513. // might be an array value (for TimelineView).
  11514. // if so, getting the most granular entry (the last one probably).
  11515. input = this.opt('slotLabelFormat');
  11516. if ($.isArray(input)) {
  11517. input = input[input.length - 1];
  11518. }
  11519. this.labelFormat = input ||
  11520. this.opt('smallTimeFormat'); // the computed default
  11521. input = this.opt('slotLabelInterval');
  11522. this.labelInterval = input ?
  11523. moment.duration(input) :
  11524. this.computeLabelInterval(slotDuration);
  11525. };
  11526. // Computes an automatic value for slotLabelInterval
  11527. TimeGrid.prototype.computeLabelInterval = function (slotDuration) {
  11528. var i;
  11529. var labelInterval;
  11530. var slotsPerLabel;
  11531. // find the smallest stock label interval that results in more than one slots-per-label
  11532. for (i = AGENDA_STOCK_SUB_DURATIONS.length - 1; i >= 0; i--) {
  11533. labelInterval = moment.duration(AGENDA_STOCK_SUB_DURATIONS[i]);
  11534. slotsPerLabel = util_1.divideDurationByDuration(labelInterval, slotDuration);
  11535. if (util_1.isInt(slotsPerLabel) && slotsPerLabel > 1) {
  11536. return labelInterval;
  11537. }
  11538. }
  11539. return moment.duration(slotDuration); // fall back. clone
  11540. };
  11541. /* Date Rendering
  11542. ------------------------------------------------------------------------------------------------------------------*/
  11543. TimeGrid.prototype.renderDates = function (dateProfile) {
  11544. this.dateProfile = dateProfile;
  11545. this.updateDayTable();
  11546. this.renderSlats();
  11547. this.renderColumns();
  11548. };
  11549. TimeGrid.prototype.unrenderDates = function () {
  11550. // this.unrenderSlats(); // don't need this because repeated .html() calls clear
  11551. this.unrenderColumns();
  11552. };
  11553. TimeGrid.prototype.renderSkeleton = function () {
  11554. var theme = this.view.calendar.theme;
  11555. this.el.html('<div class="fc-bg"></div>' +
  11556. '<div class="fc-slats"></div>' +
  11557. '<hr class="fc-divider ' + theme.getClass('widgetHeader') + '" style="display:none" />');
  11558. this.bottomRuleEl = this.el.find('hr');
  11559. };
  11560. TimeGrid.prototype.renderSlats = function () {
  11561. var theme = this.view.calendar.theme;
  11562. this.slatContainerEl = this.el.find('> .fc-slats')
  11563. .html(// avoids needing ::unrenderSlats()
  11564. '<table class="' + theme.getClass('tableGrid') + '">' +
  11565. this.renderSlatRowHtml() +
  11566. '</table>');
  11567. this.slatEls = this.slatContainerEl.find('tr');
  11568. this.slatCoordCache = new CoordCache_1.default({
  11569. els: this.slatEls,
  11570. isVertical: true
  11571. });
  11572. };
  11573. // Generates the HTML for the horizontal "slats" that run width-wise. Has a time axis on a side. Depends on RTL.
  11574. TimeGrid.prototype.renderSlatRowHtml = function () {
  11575. var view = this.view;
  11576. var calendar = view.calendar;
  11577. var theme = calendar.theme;
  11578. var isRTL = this.isRTL;
  11579. var dateProfile = this.dateProfile;
  11580. var html = '';
  11581. var slotTime = moment.duration(+dateProfile.minTime); // wish there was .clone() for durations
  11582. var slotIterator = moment.duration(0);
  11583. var slotDate; // will be on the view's first day, but we only care about its time
  11584. var isLabeled;
  11585. var axisHtml;
  11586. // Calculate the time for each slot
  11587. while (slotTime < dateProfile.maxTime) {
  11588. slotDate = calendar.msToUtcMoment(dateProfile.renderUnzonedRange.startMs).time(slotTime);
  11589. isLabeled = util_1.isInt(util_1.divideDurationByDuration(slotIterator, this.labelInterval));
  11590. axisHtml =
  11591. '<td class="fc-axis fc-time ' + theme.getClass('widgetContent') + '" ' + view.axisStyleAttr() + '>' +
  11592. (isLabeled ?
  11593. '<span>' + // for matchCellWidths
  11594. util_1.htmlEscape(slotDate.format(this.labelFormat)) +
  11595. '</span>' :
  11596. '') +
  11597. '</td>';
  11598. html +=
  11599. '<tr data-time="' + slotDate.format('HH:mm:ss') + '"' +
  11600. (isLabeled ? '' : ' class="fc-minor"') +
  11601. '>' +
  11602. (!isRTL ? axisHtml : '') +
  11603. '<td class="' + theme.getClass('widgetContent') + '"/>' +
  11604. (isRTL ? axisHtml : '') +
  11605. '</tr>';
  11606. slotTime.add(this.slotDuration);
  11607. slotIterator.add(this.slotDuration);
  11608. }
  11609. return html;
  11610. };
  11611. TimeGrid.prototype.renderColumns = function () {
  11612. var dateProfile = this.dateProfile;
  11613. var theme = this.view.calendar.theme;
  11614. this.dayRanges = this.dayDates.map(function (dayDate) {
  11615. return new UnzonedRange_1.default(dayDate.clone().add(dateProfile.minTime), dayDate.clone().add(dateProfile.maxTime));
  11616. });
  11617. if (this.headContainerEl) {
  11618. this.headContainerEl.html(this.renderHeadHtml());
  11619. }
  11620. this.el.find('> .fc-bg').html('<table class="' + theme.getClass('tableGrid') + '">' +
  11621. this.renderBgTrHtml(0) + // row=0
  11622. '</table>');
  11623. this.colEls = this.el.find('.fc-day, .fc-disabled-day');
  11624. this.colCoordCache = new CoordCache_1.default({
  11625. els: this.colEls,
  11626. isHorizontal: true
  11627. });
  11628. this.renderContentSkeleton();
  11629. };
  11630. TimeGrid.prototype.unrenderColumns = function () {
  11631. this.unrenderContentSkeleton();
  11632. };
  11633. /* Content Skeleton
  11634. ------------------------------------------------------------------------------------------------------------------*/
  11635. // Renders the DOM that the view's content will live in
  11636. TimeGrid.prototype.renderContentSkeleton = function () {
  11637. var cellHtml = '';
  11638. var i;
  11639. var skeletonEl;
  11640. for (i = 0; i < this.colCnt; i++) {
  11641. cellHtml +=
  11642. '<td>' +
  11643. '<div class="fc-content-col">' +
  11644. '<div class="fc-event-container fc-helper-container"></div>' +
  11645. '<div class="fc-event-container"></div>' +
  11646. '<div class="fc-highlight-container"></div>' +
  11647. '<div class="fc-bgevent-container"></div>' +
  11648. '<div class="fc-business-container"></div>' +
  11649. '</div>' +
  11650. '</td>';
  11651. }
  11652. skeletonEl = this.contentSkeletonEl = $('<div class="fc-content-skeleton">' +
  11653. '<table>' +
  11654. '<tr>' + cellHtml + '</tr>' +
  11655. '</table>' +
  11656. '</div>');
  11657. this.colContainerEls = skeletonEl.find('.fc-content-col');
  11658. this.helperContainerEls = skeletonEl.find('.fc-helper-container');
  11659. this.fgContainerEls = skeletonEl.find('.fc-event-container:not(.fc-helper-container)');
  11660. this.bgContainerEls = skeletonEl.find('.fc-bgevent-container');
  11661. this.highlightContainerEls = skeletonEl.find('.fc-highlight-container');
  11662. this.businessContainerEls = skeletonEl.find('.fc-business-container');
  11663. this.bookendCells(skeletonEl.find('tr')); // TODO: do this on string level
  11664. this.el.append(skeletonEl);
  11665. };
  11666. TimeGrid.prototype.unrenderContentSkeleton = function () {
  11667. if (this.contentSkeletonEl) {
  11668. this.contentSkeletonEl.remove();
  11669. this.contentSkeletonEl = null;
  11670. this.colContainerEls = null;
  11671. this.helperContainerEls = null;
  11672. this.fgContainerEls = null;
  11673. this.bgContainerEls = null;
  11674. this.highlightContainerEls = null;
  11675. this.businessContainerEls = null;
  11676. }
  11677. };
  11678. // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's col
  11679. TimeGrid.prototype.groupSegsByCol = function (segs) {
  11680. var segsByCol = [];
  11681. var i;
  11682. for (i = 0; i < this.colCnt; i++) {
  11683. segsByCol.push([]);
  11684. }
  11685. for (i = 0; i < segs.length; i++) {
  11686. segsByCol[segs[i].col].push(segs[i]);
  11687. }
  11688. return segsByCol;
  11689. };
  11690. // Given segments grouped by column, insert the segments' elements into a parallel array of container
  11691. // elements, each living within a column.
  11692. TimeGrid.prototype.attachSegsByCol = function (segsByCol, containerEls) {
  11693. var col;
  11694. var segs;
  11695. var i;
  11696. for (col = 0; col < this.colCnt; col++) {
  11697. segs = segsByCol[col];
  11698. for (i = 0; i < segs.length; i++) {
  11699. containerEls.eq(col).append(segs[i].el);
  11700. }
  11701. }
  11702. };
  11703. /* Now Indicator
  11704. ------------------------------------------------------------------------------------------------------------------*/
  11705. TimeGrid.prototype.getNowIndicatorUnit = function () {
  11706. return 'minute'; // will refresh on the minute
  11707. };
  11708. TimeGrid.prototype.renderNowIndicator = function (date) {
  11709. // HACK: if date columns not ready for some reason (scheduler)
  11710. if (!this.colContainerEls) {
  11711. return;
  11712. }
  11713. // seg system might be overkill, but it handles scenario where line needs to be rendered
  11714. // more than once because of columns with the same date (resources columns for example)
  11715. var segs = this.componentFootprintToSegs(new ComponentFootprint_1.default(new UnzonedRange_1.default(date, date.valueOf() + 1), // protect against null range
  11716. false // all-day
  11717. ));
  11718. var top = this.computeDateTop(date, date);
  11719. var nodes = [];
  11720. var i;
  11721. // render lines within the columns
  11722. for (i = 0; i < segs.length; i++) {
  11723. nodes.push($('<div class="fc-now-indicator fc-now-indicator-line"></div>')
  11724. .css('top', top)
  11725. .appendTo(this.colContainerEls.eq(segs[i].col))[0]);
  11726. }
  11727. // render an arrow over the axis
  11728. if (segs.length > 0) {
  11729. nodes.push($('<div class="fc-now-indicator fc-now-indicator-arrow"></div>')
  11730. .css('top', top)
  11731. .appendTo(this.el.find('.fc-content-skeleton'))[0]);
  11732. }
  11733. this.nowIndicatorEls = $(nodes);
  11734. };
  11735. TimeGrid.prototype.unrenderNowIndicator = function () {
  11736. if (this.nowIndicatorEls) {
  11737. this.nowIndicatorEls.remove();
  11738. this.nowIndicatorEls = null;
  11739. }
  11740. };
  11741. /* Coordinates
  11742. ------------------------------------------------------------------------------------------------------------------*/
  11743. TimeGrid.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  11744. _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
  11745. this.slatCoordCache.build();
  11746. if (isResize) {
  11747. this.updateSegVerticals([].concat(this.eventRenderer.getSegs(), this.businessSegs || []));
  11748. }
  11749. };
  11750. TimeGrid.prototype.getTotalSlatHeight = function () {
  11751. return this.slatContainerEl.outerHeight();
  11752. };
  11753. // Computes the top coordinate, relative to the bounds of the grid, of the given date.
  11754. // `ms` can be a millisecond UTC time OR a UTC moment.
  11755. // A `startOfDayDate` must be given for avoiding ambiguity over how to treat midnight.
  11756. TimeGrid.prototype.computeDateTop = function (ms, startOfDayDate) {
  11757. return this.computeTimeTop(moment.duration(ms - startOfDayDate.clone().stripTime()));
  11758. };
  11759. // Computes the top coordinate, relative to the bounds of the grid, of the given time (a Duration).
  11760. TimeGrid.prototype.computeTimeTop = function (time) {
  11761. var len = this.slatEls.length;
  11762. var dateProfile = this.dateProfile;
  11763. var slatCoverage = (time - dateProfile.minTime) / this.slotDuration; // floating-point value of # of slots covered
  11764. var slatIndex;
  11765. var slatRemainder;
  11766. // compute a floating-point number for how many slats should be progressed through.
  11767. // from 0 to number of slats (inclusive)
  11768. // constrained because minTime/maxTime might be customized.
  11769. slatCoverage = Math.max(0, slatCoverage);
  11770. slatCoverage = Math.min(len, slatCoverage);
  11771. // an integer index of the furthest whole slat
  11772. // from 0 to number slats (*exclusive*, so len-1)
  11773. slatIndex = Math.floor(slatCoverage);
  11774. slatIndex = Math.min(slatIndex, len - 1);
  11775. // how much further through the slatIndex slat (from 0.0-1.0) must be covered in addition.
  11776. // could be 1.0 if slatCoverage is covering *all* the slots
  11777. slatRemainder = slatCoverage - slatIndex;
  11778. return this.slatCoordCache.getTopPosition(slatIndex) +
  11779. this.slatCoordCache.getHeight(slatIndex) * slatRemainder;
  11780. };
  11781. // Refreshes the CSS top/bottom coordinates for each segment element.
  11782. // Works when called after initial render, after a window resize/zoom for example.
  11783. TimeGrid.prototype.updateSegVerticals = function (segs) {
  11784. this.computeSegVerticals(segs);
  11785. this.assignSegVerticals(segs);
  11786. };
  11787. // For each segment in an array, computes and assigns its top and bottom properties
  11788. TimeGrid.prototype.computeSegVerticals = function (segs) {
  11789. var eventMinHeight = this.opt('agendaEventMinHeight');
  11790. var i;
  11791. var seg;
  11792. var dayDate;
  11793. for (i = 0; i < segs.length; i++) {
  11794. seg = segs[i];
  11795. dayDate = this.dayDates[seg.dayIndex];
  11796. seg.top = this.computeDateTop(seg.startMs, dayDate);
  11797. seg.bottom = Math.max(seg.top + eventMinHeight, this.computeDateTop(seg.endMs, dayDate));
  11798. }
  11799. };
  11800. // Given segments that already have their top/bottom properties computed, applies those values to
  11801. // the segments' elements.
  11802. TimeGrid.prototype.assignSegVerticals = function (segs) {
  11803. var i;
  11804. var seg;
  11805. for (i = 0; i < segs.length; i++) {
  11806. seg = segs[i];
  11807. seg.el.css(this.generateSegVerticalCss(seg));
  11808. }
  11809. };
  11810. // Generates an object with CSS properties for the top/bottom coordinates of a segment element
  11811. TimeGrid.prototype.generateSegVerticalCss = function (seg) {
  11812. return {
  11813. top: seg.top,
  11814. bottom: -seg.bottom // flipped because needs to be space beyond bottom edge of event container
  11815. };
  11816. };
  11817. /* Hit System
  11818. ------------------------------------------------------------------------------------------------------------------*/
  11819. TimeGrid.prototype.prepareHits = function () {
  11820. this.colCoordCache.build();
  11821. this.slatCoordCache.build();
  11822. };
  11823. TimeGrid.prototype.releaseHits = function () {
  11824. this.colCoordCache.clear();
  11825. // NOTE: don't clear slatCoordCache because we rely on it for computeTimeTop
  11826. };
  11827. TimeGrid.prototype.queryHit = function (leftOffset, topOffset) {
  11828. var snapsPerSlot = this.snapsPerSlot;
  11829. var colCoordCache = this.colCoordCache;
  11830. var slatCoordCache = this.slatCoordCache;
  11831. if (colCoordCache.isLeftInBounds(leftOffset) && slatCoordCache.isTopInBounds(topOffset)) {
  11832. var colIndex = colCoordCache.getHorizontalIndex(leftOffset);
  11833. var slatIndex = slatCoordCache.getVerticalIndex(topOffset);
  11834. if (colIndex != null && slatIndex != null) {
  11835. var slatTop = slatCoordCache.getTopOffset(slatIndex);
  11836. var slatHeight = slatCoordCache.getHeight(slatIndex);
  11837. var partial = (topOffset - slatTop) / slatHeight; // floating point number between 0 and 1
  11838. var localSnapIndex = Math.floor(partial * snapsPerSlot); // the snap # relative to start of slat
  11839. var snapIndex = slatIndex * snapsPerSlot + localSnapIndex;
  11840. var snapTop = slatTop + (localSnapIndex / snapsPerSlot) * slatHeight;
  11841. var snapBottom = slatTop + ((localSnapIndex + 1) / snapsPerSlot) * slatHeight;
  11842. return {
  11843. col: colIndex,
  11844. snap: snapIndex,
  11845. component: this,
  11846. left: colCoordCache.getLeftOffset(colIndex),
  11847. right: colCoordCache.getRightOffset(colIndex),
  11848. top: snapTop,
  11849. bottom: snapBottom
  11850. };
  11851. }
  11852. }
  11853. };
  11854. TimeGrid.prototype.getHitFootprint = function (hit) {
  11855. var start = this.getCellDate(0, hit.col); // row=0
  11856. var time = this.computeSnapTime(hit.snap); // pass in the snap-index
  11857. var end;
  11858. start.time(time);
  11859. end = start.clone().add(this.snapDuration);
  11860. return new ComponentFootprint_1.default(new UnzonedRange_1.default(start, end), false // all-day?
  11861. );
  11862. };
  11863. // Given a row number of the grid, representing a "snap", returns a time (Duration) from its start-of-day
  11864. TimeGrid.prototype.computeSnapTime = function (snapIndex) {
  11865. return moment.duration(this.dateProfile.minTime + this.snapDuration * snapIndex);
  11866. };
  11867. TimeGrid.prototype.getHitEl = function (hit) {
  11868. return this.colEls.eq(hit.col);
  11869. };
  11870. /* Event Drag Visualization
  11871. ------------------------------------------------------------------------------------------------------------------*/
  11872. // Renders a visual indication of an event being dragged over the specified date(s).
  11873. // A returned value of `true` signals that a mock "helper" event has been rendered.
  11874. TimeGrid.prototype.renderDrag = function (eventFootprints, seg, isTouch) {
  11875. var i;
  11876. if (seg) {
  11877. if (eventFootprints.length) {
  11878. this.helperRenderer.renderEventDraggingFootprints(eventFootprints, seg, isTouch);
  11879. // signal that a helper has been rendered
  11880. return true;
  11881. }
  11882. }
  11883. else {
  11884. for (i = 0; i < eventFootprints.length; i++) {
  11885. this.renderHighlight(eventFootprints[i].componentFootprint);
  11886. }
  11887. }
  11888. };
  11889. // Unrenders any visual indication of an event being dragged
  11890. TimeGrid.prototype.unrenderDrag = function () {
  11891. this.unrenderHighlight();
  11892. this.helperRenderer.unrender();
  11893. };
  11894. /* Event Resize Visualization
  11895. ------------------------------------------------------------------------------------------------------------------*/
  11896. // Renders a visual indication of an event being resized
  11897. TimeGrid.prototype.renderEventResize = function (eventFootprints, seg, isTouch) {
  11898. this.helperRenderer.renderEventResizingFootprints(eventFootprints, seg, isTouch);
  11899. };
  11900. // Unrenders any visual indication of an event being resized
  11901. TimeGrid.prototype.unrenderEventResize = function () {
  11902. this.helperRenderer.unrender();
  11903. };
  11904. /* Selection
  11905. ------------------------------------------------------------------------------------------------------------------*/
  11906. // Renders a visual indication of a selection. Overrides the default, which was to simply render a highlight.
  11907. TimeGrid.prototype.renderSelectionFootprint = function (componentFootprint) {
  11908. if (this.opt('selectHelper')) {
  11909. this.helperRenderer.renderComponentFootprint(componentFootprint);
  11910. }
  11911. else {
  11912. this.renderHighlight(componentFootprint);
  11913. }
  11914. };
  11915. // Unrenders any visual indication of a selection
  11916. TimeGrid.prototype.unrenderSelection = function () {
  11917. this.helperRenderer.unrender();
  11918. this.unrenderHighlight();
  11919. };
  11920. return TimeGrid;
  11921. }(InteractiveDateComponent_1.default));
  11922. exports.default = TimeGrid;
  11923. TimeGrid.prototype.eventRendererClass = TimeGridEventRenderer_1.default;
  11924. TimeGrid.prototype.businessHourRendererClass = BusinessHourRenderer_1.default;
  11925. TimeGrid.prototype.helperRendererClass = TimeGridHelperRenderer_1.default;
  11926. TimeGrid.prototype.fillRendererClass = TimeGridFillRenderer_1.default;
  11927. StandardInteractionsMixin_1.default.mixInto(TimeGrid);
  11928. DayTableMixin_1.default.mixInto(TimeGrid);
  11929. /***/ }),
  11930. /* 228 */
  11931. /***/ (function(module, exports, __webpack_require__) {
  11932. Object.defineProperty(exports, "__esModule", { value: true });
  11933. var tslib_1 = __webpack_require__(2);
  11934. var UnzonedRange_1 = __webpack_require__(5);
  11935. var DateProfileGenerator_1 = __webpack_require__(221);
  11936. var BasicViewDateProfileGenerator = /** @class */ (function (_super) {
  11937. tslib_1.__extends(BasicViewDateProfileGenerator, _super);
  11938. function BasicViewDateProfileGenerator() {
  11939. return _super !== null && _super.apply(this, arguments) || this;
  11940. }
  11941. // Computes the date range that will be rendered.
  11942. BasicViewDateProfileGenerator.prototype.buildRenderRange = function (currentUnzonedRange, currentRangeUnit, isRangeAllDay) {
  11943. var renderUnzonedRange = _super.prototype.buildRenderRange.call(this, currentUnzonedRange, currentRangeUnit, isRangeAllDay); // an UnzonedRange
  11944. var start = this.msToUtcMoment(renderUnzonedRange.startMs, isRangeAllDay);
  11945. var end = this.msToUtcMoment(renderUnzonedRange.endMs, isRangeAllDay);
  11946. // year and month views should be aligned with weeks. this is already done for week
  11947. if (/^(year|month)$/.test(currentRangeUnit)) {
  11948. start.startOf('week');
  11949. // make end-of-week if not already
  11950. if (end.weekday()) {
  11951. end.add(1, 'week').startOf('week'); // exclusively move backwards
  11952. }
  11953. }
  11954. return new UnzonedRange_1.default(start, end);
  11955. };
  11956. return BasicViewDateProfileGenerator;
  11957. }(DateProfileGenerator_1.default));
  11958. exports.default = BasicViewDateProfileGenerator;
  11959. /***/ }),
  11960. /* 229 */
  11961. /***/ (function(module, exports, __webpack_require__) {
  11962. Object.defineProperty(exports, "__esModule", { value: true });
  11963. var tslib_1 = __webpack_require__(2);
  11964. var moment = __webpack_require__(0);
  11965. var util_1 = __webpack_require__(4);
  11966. var BasicView_1 = __webpack_require__(62);
  11967. var MonthViewDateProfileGenerator_1 = __webpack_require__(253);
  11968. /* A month view with day cells running in rows (one-per-week) and columns
  11969. ----------------------------------------------------------------------------------------------------------------------*/
  11970. var MonthView = /** @class */ (function (_super) {
  11971. tslib_1.__extends(MonthView, _super);
  11972. function MonthView() {
  11973. return _super !== null && _super.apply(this, arguments) || this;
  11974. }
  11975. // Overrides the default BasicView behavior to have special multi-week auto-height logic
  11976. MonthView.prototype.setGridHeight = function (height, isAuto) {
  11977. // if auto, make the height of each row the height that it would be if there were 6 weeks
  11978. if (isAuto) {
  11979. height *= this.dayGrid.rowCnt / 6;
  11980. }
  11981. util_1.distributeHeight(this.dayGrid.rowEls, height, !isAuto); // if auto, don't compensate for height-hogging rows
  11982. };
  11983. MonthView.prototype.isDateInOtherMonth = function (date, dateProfile) {
  11984. return date.month() !== moment.utc(dateProfile.currentUnzonedRange.startMs).month(); // TODO: optimize
  11985. };
  11986. return MonthView;
  11987. }(BasicView_1.default));
  11988. exports.default = MonthView;
  11989. MonthView.prototype.dateProfileGeneratorClass = MonthViewDateProfileGenerator_1.default;
  11990. /***/ }),
  11991. /* 230 */
  11992. /***/ (function(module, exports, __webpack_require__) {
  11993. Object.defineProperty(exports, "__esModule", { value: true });
  11994. var tslib_1 = __webpack_require__(2);
  11995. var $ = __webpack_require__(3);
  11996. var util_1 = __webpack_require__(4);
  11997. var UnzonedRange_1 = __webpack_require__(5);
  11998. var View_1 = __webpack_require__(41);
  11999. var Scroller_1 = __webpack_require__(39);
  12000. var ListEventRenderer_1 = __webpack_require__(254);
  12001. var ListEventPointing_1 = __webpack_require__(255);
  12002. /*
  12003. Responsible for the scroller, and forwarding event-related actions into the "grid".
  12004. */
  12005. var ListView = /** @class */ (function (_super) {
  12006. tslib_1.__extends(ListView, _super);
  12007. function ListView(calendar, viewSpec) {
  12008. var _this = _super.call(this, calendar, viewSpec) || this;
  12009. _this.segSelector = '.fc-list-item'; // which elements accept event actions
  12010. _this.scroller = new Scroller_1.default({
  12011. overflowX: 'hidden',
  12012. overflowY: 'auto'
  12013. });
  12014. return _this;
  12015. }
  12016. ListView.prototype.renderSkeleton = function () {
  12017. this.el.addClass('fc-list-view ' +
  12018. this.calendar.theme.getClass('listView'));
  12019. this.scroller.render();
  12020. this.scroller.el.appendTo(this.el);
  12021. this.contentEl = this.scroller.scrollEl; // shortcut
  12022. };
  12023. ListView.prototype.unrenderSkeleton = function () {
  12024. this.scroller.destroy(); // will remove the Grid too
  12025. };
  12026. ListView.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  12027. _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
  12028. this.scroller.clear(); // sets height to 'auto' and clears overflow
  12029. if (!isAuto) {
  12030. this.scroller.setHeight(this.computeScrollerHeight(totalHeight));
  12031. }
  12032. };
  12033. ListView.prototype.computeScrollerHeight = function (totalHeight) {
  12034. return totalHeight -
  12035. util_1.subtractInnerElHeight(this.el, this.scroller.el); // everything that's NOT the scroller
  12036. };
  12037. ListView.prototype.renderDates = function (dateProfile) {
  12038. var calendar = this.calendar;
  12039. var dayStart = calendar.msToUtcMoment(dateProfile.renderUnzonedRange.startMs, true);
  12040. var viewEnd = calendar.msToUtcMoment(dateProfile.renderUnzonedRange.endMs, true);
  12041. var dayDates = [];
  12042. var dayRanges = [];
  12043. while (dayStart < viewEnd) {
  12044. dayDates.push(dayStart.clone());
  12045. dayRanges.push(new UnzonedRange_1.default(dayStart, dayStart.clone().add(1, 'day')));
  12046. dayStart.add(1, 'day');
  12047. }
  12048. this.dayDates = dayDates;
  12049. this.dayRanges = dayRanges;
  12050. // all real rendering happens in EventRenderer
  12051. };
  12052. // slices by day
  12053. ListView.prototype.componentFootprintToSegs = function (footprint) {
  12054. var dayRanges = this.dayRanges;
  12055. var dayIndex;
  12056. var segRange;
  12057. var seg;
  12058. var segs = [];
  12059. for (dayIndex = 0; dayIndex < dayRanges.length; dayIndex++) {
  12060. segRange = footprint.unzonedRange.intersect(dayRanges[dayIndex]);
  12061. if (segRange) {
  12062. seg = {
  12063. startMs: segRange.startMs,
  12064. endMs: segRange.endMs,
  12065. isStart: segRange.isStart,
  12066. isEnd: segRange.isEnd,
  12067. dayIndex: dayIndex
  12068. };
  12069. segs.push(seg);
  12070. // detect when footprint won't go fully into the next day,
  12071. // and mutate the latest seg to the be the end.
  12072. if (!seg.isEnd && !footprint.isAllDay &&
  12073. dayIndex + 1 < dayRanges.length &&
  12074. footprint.unzonedRange.endMs < dayRanges[dayIndex + 1].startMs + this.nextDayThreshold) {
  12075. seg.endMs = footprint.unzonedRange.endMs;
  12076. seg.isEnd = true;
  12077. break;
  12078. }
  12079. }
  12080. }
  12081. return segs;
  12082. };
  12083. ListView.prototype.renderEmptyMessage = function () {
  12084. this.contentEl.html('<div class="fc-list-empty-wrap2">' + // TODO: try less wraps
  12085. '<div class="fc-list-empty-wrap1">' +
  12086. '<div class="fc-list-empty">' +
  12087. util_1.htmlEscape(this.opt('noEventsMessage')) +
  12088. '</div>' +
  12089. '</div>' +
  12090. '</div>');
  12091. };
  12092. // render the event segments in the view
  12093. ListView.prototype.renderSegList = function (allSegs) {
  12094. var segsByDay = this.groupSegsByDay(allSegs); // sparse array
  12095. var dayIndex;
  12096. var daySegs;
  12097. var i;
  12098. var tableEl = $('<table class="fc-list-table ' + this.calendar.theme.getClass('tableList') + '"><tbody/></table>');
  12099. var tbodyEl = tableEl.find('tbody');
  12100. for (dayIndex = 0; dayIndex < segsByDay.length; dayIndex++) {
  12101. daySegs = segsByDay[dayIndex];
  12102. if (daySegs) {
  12103. // append a day header
  12104. tbodyEl.append(this.dayHeaderHtml(this.dayDates[dayIndex]));
  12105. this.eventRenderer.sortEventSegs(daySegs);
  12106. for (i = 0; i < daySegs.length; i++) {
  12107. tbodyEl.append(daySegs[i].el); // append event row
  12108. }
  12109. }
  12110. }
  12111. this.contentEl.empty().append(tableEl);
  12112. };
  12113. // Returns a sparse array of arrays, segs grouped by their dayIndex
  12114. ListView.prototype.groupSegsByDay = function (segs) {
  12115. var segsByDay = []; // sparse array
  12116. var i;
  12117. var seg;
  12118. for (i = 0; i < segs.length; i++) {
  12119. seg = segs[i];
  12120. (segsByDay[seg.dayIndex] || (segsByDay[seg.dayIndex] = []))
  12121. .push(seg);
  12122. }
  12123. return segsByDay;
  12124. };
  12125. // generates the HTML for the day headers that live amongst the event rows
  12126. ListView.prototype.dayHeaderHtml = function (dayDate) {
  12127. var mainFormat = this.opt('listDayFormat');
  12128. var altFormat = this.opt('listDayAltFormat');
  12129. return '<tr class="fc-list-heading" data-date="' + dayDate.format('YYYY-MM-DD') + '">' +
  12130. '<td class="' + (this.calendar.theme.getClass('tableListHeading') ||
  12131. this.calendar.theme.getClass('widgetHeader')) + '" colspan="3">' +
  12132. (mainFormat ?
  12133. this.buildGotoAnchorHtml(dayDate, { 'class': 'fc-list-heading-main' }, util_1.htmlEscape(dayDate.format(mainFormat)) // inner HTML
  12134. ) :
  12135. '') +
  12136. (altFormat ?
  12137. this.buildGotoAnchorHtml(dayDate, { 'class': 'fc-list-heading-alt' }, util_1.htmlEscape(dayDate.format(altFormat)) // inner HTML
  12138. ) :
  12139. '') +
  12140. '</td>' +
  12141. '</tr>';
  12142. };
  12143. return ListView;
  12144. }(View_1.default));
  12145. exports.default = ListView;
  12146. ListView.prototype.eventRendererClass = ListEventRenderer_1.default;
  12147. ListView.prototype.eventPointingClass = ListEventPointing_1.default;
  12148. /***/ }),
  12149. /* 231 */,
  12150. /* 232 */,
  12151. /* 233 */,
  12152. /* 234 */,
  12153. /* 235 */,
  12154. /* 236 */
  12155. /***/ (function(module, exports, __webpack_require__) {
  12156. var $ = __webpack_require__(3);
  12157. var exportHooks = __webpack_require__(16);
  12158. var util_1 = __webpack_require__(4);
  12159. var Calendar_1 = __webpack_require__(220);
  12160. // for intentional side-effects
  12161. __webpack_require__(10);
  12162. __webpack_require__(47);
  12163. __webpack_require__(256);
  12164. __webpack_require__(257);
  12165. __webpack_require__(260);
  12166. __webpack_require__(261);
  12167. __webpack_require__(262);
  12168. __webpack_require__(263);
  12169. $.fullCalendar = exportHooks;
  12170. $.fn.fullCalendar = function (options) {
  12171. var args = Array.prototype.slice.call(arguments, 1); // for a possible method call
  12172. var res = this; // what this function will return (this jQuery object by default)
  12173. this.each(function (i, _element) {
  12174. var element = $(_element);
  12175. var calendar = element.data('fullCalendar'); // get the existing calendar object (if any)
  12176. var singleRes; // the returned value of this single method call
  12177. // a method call
  12178. if (typeof options === 'string') {
  12179. if (options === 'getCalendar') {
  12180. if (!i) {
  12181. res = calendar;
  12182. }
  12183. }
  12184. else if (options === 'destroy') {
  12185. if (calendar) {
  12186. calendar.destroy();
  12187. element.removeData('fullCalendar');
  12188. }
  12189. }
  12190. else if (!calendar) {
  12191. util_1.warn('Attempting to call a FullCalendar method on an element with no calendar.');
  12192. }
  12193. else if ($.isFunction(calendar[options])) {
  12194. singleRes = calendar[options].apply(calendar, args);
  12195. if (!i) {
  12196. res = singleRes; // record the first method call result
  12197. }
  12198. if (options === 'destroy') {
  12199. element.removeData('fullCalendar');
  12200. }
  12201. }
  12202. else {
  12203. util_1.warn("'" + options + "' is an unknown FullCalendar method.");
  12204. }
  12205. }
  12206. else if (!calendar) {
  12207. calendar = new Calendar_1.default(element, options);
  12208. element.data('fullCalendar', calendar);
  12209. calendar.render();
  12210. }
  12211. });
  12212. return res;
  12213. };
  12214. module.exports = exportHooks;
  12215. /***/ }),
  12216. /* 237 */
  12217. /***/ (function(module, exports, __webpack_require__) {
  12218. Object.defineProperty(exports, "__esModule", { value: true });
  12219. var tslib_1 = __webpack_require__(2);
  12220. var Model_1 = __webpack_require__(48);
  12221. var Component = /** @class */ (function (_super) {
  12222. tslib_1.__extends(Component, _super);
  12223. function Component() {
  12224. return _super !== null && _super.apply(this, arguments) || this;
  12225. }
  12226. Component.prototype.setElement = function (el) {
  12227. this.el = el;
  12228. this.bindGlobalHandlers();
  12229. this.renderSkeleton();
  12230. this.set('isInDom', true);
  12231. };
  12232. Component.prototype.removeElement = function () {
  12233. this.unset('isInDom');
  12234. this.unrenderSkeleton();
  12235. this.unbindGlobalHandlers();
  12236. this.el.remove();
  12237. // NOTE: don't null-out this.el in case the View was destroyed within an API callback.
  12238. // We don't null-out the View's other jQuery element references upon destroy,
  12239. // so we shouldn't kill this.el either.
  12240. };
  12241. Component.prototype.bindGlobalHandlers = function () {
  12242. // subclasses can override
  12243. };
  12244. Component.prototype.unbindGlobalHandlers = function () {
  12245. // subclasses can override
  12246. };
  12247. /*
  12248. NOTE: Can't have a `render` method. Read the deprecation notice in View::executeDateRender
  12249. */
  12250. // Renders the basic structure of the view before any content is rendered
  12251. Component.prototype.renderSkeleton = function () {
  12252. // subclasses should implement
  12253. };
  12254. // Unrenders the basic structure of the view
  12255. Component.prototype.unrenderSkeleton = function () {
  12256. // subclasses should implement
  12257. };
  12258. return Component;
  12259. }(Model_1.default));
  12260. exports.default = Component;
  12261. /***/ }),
  12262. /* 238 */
  12263. /***/ (function(module, exports) {
  12264. Object.defineProperty(exports, "__esModule", { value: true });
  12265. var Iterator = /** @class */ (function () {
  12266. function Iterator(items) {
  12267. this.items = items || [];
  12268. }
  12269. /* Calls a method on every item passing the arguments through */
  12270. Iterator.prototype.proxyCall = function (methodName) {
  12271. var args = [];
  12272. for (var _i = 1; _i < arguments.length; _i++) {
  12273. args[_i - 1] = arguments[_i];
  12274. }
  12275. var results = [];
  12276. this.items.forEach(function (item) {
  12277. results.push(item[methodName].apply(item, args));
  12278. });
  12279. return results;
  12280. };
  12281. return Iterator;
  12282. }());
  12283. exports.default = Iterator;
  12284. /***/ }),
  12285. /* 239 */
  12286. /***/ (function(module, exports, __webpack_require__) {
  12287. Object.defineProperty(exports, "__esModule", { value: true });
  12288. var $ = __webpack_require__(3);
  12289. var util_1 = __webpack_require__(4);
  12290. /* Toolbar with buttons and title
  12291. ----------------------------------------------------------------------------------------------------------------------*/
  12292. var Toolbar = /** @class */ (function () {
  12293. function Toolbar(calendar, toolbarOptions) {
  12294. this.el = null; // mirrors local `el`
  12295. this.viewsWithButtons = [];
  12296. this.calendar = calendar;
  12297. this.toolbarOptions = toolbarOptions;
  12298. }
  12299. // method to update toolbar-specific options, not calendar-wide options
  12300. Toolbar.prototype.setToolbarOptions = function (newToolbarOptions) {
  12301. this.toolbarOptions = newToolbarOptions;
  12302. };
  12303. // can be called repeatedly and will rerender
  12304. Toolbar.prototype.render = function () {
  12305. var sections = this.toolbarOptions.layout;
  12306. var el = this.el;
  12307. if (sections) {
  12308. if (!el) {
  12309. el = this.el = $("<div class='fc-toolbar " + this.toolbarOptions.extraClasses + "'/>");
  12310. }
  12311. else {
  12312. el.empty();
  12313. }
  12314. el.append(this.renderSection('left'))
  12315. .append(this.renderSection('right'))
  12316. .append(this.renderSection('center'))
  12317. .append('<div class="fc-clear"/>');
  12318. }
  12319. else {
  12320. this.removeElement();
  12321. }
  12322. };
  12323. Toolbar.prototype.removeElement = function () {
  12324. if (this.el) {
  12325. this.el.remove();
  12326. this.el = null;
  12327. }
  12328. };
  12329. Toolbar.prototype.renderSection = function (position) {
  12330. var _this = this;
  12331. var calendar = this.calendar;
  12332. var theme = calendar.theme;
  12333. var optionsManager = calendar.optionsManager;
  12334. var viewSpecManager = calendar.viewSpecManager;
  12335. var sectionEl = $('<div class="fc-' + position + '"/>');
  12336. var buttonStr = this.toolbarOptions.layout[position];
  12337. var calendarCustomButtons = optionsManager.get('customButtons') || {};
  12338. var calendarButtonTextOverrides = optionsManager.overrides.buttonText || {};
  12339. var calendarButtonText = optionsManager.get('buttonText') || {};
  12340. if (buttonStr) {
  12341. $.each(buttonStr.split(' '), function (i, buttonGroupStr) {
  12342. var groupChildren = $();
  12343. var isOnlyButtons = true;
  12344. var groupEl;
  12345. $.each(buttonGroupStr.split(','), function (j, buttonName) {
  12346. var customButtonProps;
  12347. var viewSpec;
  12348. var buttonClick;
  12349. var buttonIcon; // only one of these will be set
  12350. var buttonText; // "
  12351. var buttonInnerHtml;
  12352. var buttonClasses;
  12353. var buttonEl;
  12354. var buttonAriaAttr;
  12355. if (buttonName === 'title') {
  12356. groupChildren = groupChildren.add($('<h2>&nbsp;</h2>')); // we always want it to take up height
  12357. isOnlyButtons = false;
  12358. }
  12359. else {
  12360. if ((customButtonProps = calendarCustomButtons[buttonName])) {
  12361. buttonClick = function (ev) {
  12362. if (customButtonProps.click) {
  12363. customButtonProps.click.call(buttonEl[0], ev);
  12364. }
  12365. };
  12366. (buttonIcon = theme.getCustomButtonIconClass(customButtonProps)) ||
  12367. (buttonIcon = theme.getIconClass(buttonName)) ||
  12368. (buttonText = customButtonProps.text);
  12369. }
  12370. else if ((viewSpec = viewSpecManager.getViewSpec(buttonName))) {
  12371. _this.viewsWithButtons.push(buttonName);
  12372. buttonClick = function () {
  12373. calendar.changeView(buttonName);
  12374. };
  12375. (buttonText = viewSpec.buttonTextOverride) ||
  12376. (buttonIcon = theme.getIconClass(buttonName)) ||
  12377. (buttonText = viewSpec.buttonTextDefault);
  12378. }
  12379. else if (calendar[buttonName]) {
  12380. buttonClick = function () {
  12381. calendar[buttonName]();
  12382. };
  12383. (buttonText = calendarButtonTextOverrides[buttonName]) ||
  12384. (buttonIcon = theme.getIconClass(buttonName)) ||
  12385. (buttonText = calendarButtonText[buttonName]);
  12386. // ^ everything else is considered default
  12387. }
  12388. if (buttonClick) {
  12389. buttonClasses = [
  12390. 'fc-' + buttonName + '-button',
  12391. theme.getClass('button'),
  12392. theme.getClass('stateDefault')
  12393. ];
  12394. if (buttonText) {
  12395. buttonInnerHtml = util_1.htmlEscape(buttonText);
  12396. buttonAriaAttr = '';
  12397. }
  12398. else if (buttonIcon) {
  12399. buttonInnerHtml = "<span class='" + buttonIcon + "'></span>";
  12400. buttonAriaAttr = ' aria-label="' + buttonName + '"';
  12401. }
  12402. buttonEl = $(// type="button" so that it doesn't submit a form
  12403. '<button type="button" class="' + buttonClasses.join(' ') + '"' +
  12404. buttonAriaAttr +
  12405. '>' + buttonInnerHtml + '</button>')
  12406. .click(function (ev) {
  12407. // don't process clicks for disabled buttons
  12408. if (!buttonEl.hasClass(theme.getClass('stateDisabled'))) {
  12409. buttonClick(ev);
  12410. // after the click action, if the button becomes the "active" tab, or disabled,
  12411. // it should never have a hover class, so remove it now.
  12412. if (buttonEl.hasClass(theme.getClass('stateActive')) ||
  12413. buttonEl.hasClass(theme.getClass('stateDisabled'))) {
  12414. buttonEl.removeClass(theme.getClass('stateHover'));
  12415. }
  12416. }
  12417. })
  12418. .mousedown(function () {
  12419. // the *down* effect (mouse pressed in).
  12420. // only on buttons that are not the "active" tab, or disabled
  12421. buttonEl
  12422. .not('.' + theme.getClass('stateActive'))
  12423. .not('.' + theme.getClass('stateDisabled'))
  12424. .addClass(theme.getClass('stateDown'));
  12425. })
  12426. .mouseup(function () {
  12427. // undo the *down* effect
  12428. buttonEl.removeClass(theme.getClass('stateDown'));
  12429. })
  12430. .hover(function () {
  12431. // the *hover* effect.
  12432. // only on buttons that are not the "active" tab, or disabled
  12433. buttonEl
  12434. .not('.' + theme.getClass('stateActive'))
  12435. .not('.' + theme.getClass('stateDisabled'))
  12436. .addClass(theme.getClass('stateHover'));
  12437. }, function () {
  12438. // undo the *hover* effect
  12439. buttonEl
  12440. .removeClass(theme.getClass('stateHover'))
  12441. .removeClass(theme.getClass('stateDown')); // if mouseleave happens before mouseup
  12442. });
  12443. groupChildren = groupChildren.add(buttonEl);
  12444. }
  12445. }
  12446. });
  12447. if (isOnlyButtons) {
  12448. groupChildren
  12449. .first().addClass(theme.getClass('cornerLeft')).end()
  12450. .last().addClass(theme.getClass('cornerRight')).end();
  12451. }
  12452. if (groupChildren.length > 1) {
  12453. groupEl = $('<div/>');
  12454. if (isOnlyButtons) {
  12455. groupEl.addClass(theme.getClass('buttonGroup'));
  12456. }
  12457. groupEl.append(groupChildren);
  12458. sectionEl.append(groupEl);
  12459. }
  12460. else {
  12461. sectionEl.append(groupChildren); // 1 or 0 children
  12462. }
  12463. });
  12464. }
  12465. return sectionEl;
  12466. };
  12467. Toolbar.prototype.updateTitle = function (text) {
  12468. if (this.el) {
  12469. this.el.find('h2').text(text);
  12470. }
  12471. };
  12472. Toolbar.prototype.activateButton = function (buttonName) {
  12473. if (this.el) {
  12474. this.el.find('.fc-' + buttonName + '-button')
  12475. .addClass(this.calendar.theme.getClass('stateActive'));
  12476. }
  12477. };
  12478. Toolbar.prototype.deactivateButton = function (buttonName) {
  12479. if (this.el) {
  12480. this.el.find('.fc-' + buttonName + '-button')
  12481. .removeClass(this.calendar.theme.getClass('stateActive'));
  12482. }
  12483. };
  12484. Toolbar.prototype.disableButton = function (buttonName) {
  12485. if (this.el) {
  12486. this.el.find('.fc-' + buttonName + '-button')
  12487. .prop('disabled', true)
  12488. .addClass(this.calendar.theme.getClass('stateDisabled'));
  12489. }
  12490. };
  12491. Toolbar.prototype.enableButton = function (buttonName) {
  12492. if (this.el) {
  12493. this.el.find('.fc-' + buttonName + '-button')
  12494. .prop('disabled', false)
  12495. .removeClass(this.calendar.theme.getClass('stateDisabled'));
  12496. }
  12497. };
  12498. Toolbar.prototype.getViewsWithButtons = function () {
  12499. return this.viewsWithButtons;
  12500. };
  12501. return Toolbar;
  12502. }());
  12503. exports.default = Toolbar;
  12504. /***/ }),
  12505. /* 240 */
  12506. /***/ (function(module, exports, __webpack_require__) {
  12507. Object.defineProperty(exports, "__esModule", { value: true });
  12508. var tslib_1 = __webpack_require__(2);
  12509. var $ = __webpack_require__(3);
  12510. var util_1 = __webpack_require__(4);
  12511. var options_1 = __webpack_require__(32);
  12512. var locale_1 = __webpack_require__(31);
  12513. var Model_1 = __webpack_require__(48);
  12514. var OptionsManager = /** @class */ (function (_super) {
  12515. tslib_1.__extends(OptionsManager, _super);
  12516. function OptionsManager(_calendar, overrides) {
  12517. var _this = _super.call(this) || this;
  12518. _this._calendar = _calendar;
  12519. _this.overrides = $.extend({}, overrides); // make a copy
  12520. _this.dynamicOverrides = {};
  12521. _this.compute();
  12522. return _this;
  12523. }
  12524. OptionsManager.prototype.add = function (newOptionHash) {
  12525. var optionCnt = 0;
  12526. var optionName;
  12527. this.recordOverrides(newOptionHash); // will trigger this model's watchers
  12528. for (optionName in newOptionHash) {
  12529. optionCnt++;
  12530. }
  12531. // special-case handling of single option change.
  12532. // if only one option change, `optionName` will be its name.
  12533. if (optionCnt === 1) {
  12534. if (optionName === 'height' || optionName === 'contentHeight' || optionName === 'aspectRatio') {
  12535. this._calendar.updateViewSize(true); // isResize=true
  12536. return;
  12537. }
  12538. else if (optionName === 'defaultDate') {
  12539. return; // can't change date this way. use gotoDate instead
  12540. }
  12541. else if (optionName === 'businessHours') {
  12542. return; // this model already reacts to this
  12543. }
  12544. else if (/^(event|select)(Overlap|Constraint|Allow)$/.test(optionName)) {
  12545. return; // doesn't affect rendering. only interactions.
  12546. }
  12547. else if (optionName === 'timezone') {
  12548. this._calendar.view.flash('initialEvents');
  12549. return;
  12550. }
  12551. }
  12552. // catch-all. rerender the header and footer and rebuild/rerender the current view
  12553. this._calendar.renderHeader();
  12554. this._calendar.renderFooter();
  12555. // even non-current views will be affected by this option change. do before rerender
  12556. // TODO: detangle
  12557. this._calendar.viewsByType = {};
  12558. this._calendar.reinitView();
  12559. };
  12560. // Computes the flattened options hash for the calendar and assigns to `this.options`.
  12561. // Assumes this.overrides and this.dynamicOverrides have already been initialized.
  12562. OptionsManager.prototype.compute = function () {
  12563. var locale;
  12564. var localeDefaults;
  12565. var isRTL;
  12566. var dirDefaults;
  12567. var rawOptions;
  12568. locale = util_1.firstDefined(// explicit locale option given?
  12569. this.dynamicOverrides.locale, this.overrides.locale);
  12570. localeDefaults = locale_1.localeOptionHash[locale];
  12571. if (!localeDefaults) {
  12572. locale = options_1.globalDefaults.locale;
  12573. localeDefaults = locale_1.localeOptionHash[locale] || {};
  12574. }
  12575. isRTL = util_1.firstDefined(// based on options computed so far, is direction RTL?
  12576. this.dynamicOverrides.isRTL, this.overrides.isRTL, localeDefaults.isRTL, options_1.globalDefaults.isRTL);
  12577. dirDefaults = isRTL ? options_1.rtlDefaults : {};
  12578. this.dirDefaults = dirDefaults;
  12579. this.localeDefaults = localeDefaults;
  12580. rawOptions = options_1.mergeOptions([
  12581. options_1.globalDefaults,
  12582. dirDefaults,
  12583. localeDefaults,
  12584. this.overrides,
  12585. this.dynamicOverrides
  12586. ]);
  12587. locale_1.populateInstanceComputableOptions(rawOptions); // fill in gaps with computed options
  12588. this.reset(rawOptions);
  12589. };
  12590. // stores the new options internally, but does not rerender anything.
  12591. OptionsManager.prototype.recordOverrides = function (newOptionHash) {
  12592. var optionName;
  12593. for (optionName in newOptionHash) {
  12594. this.dynamicOverrides[optionName] = newOptionHash[optionName];
  12595. }
  12596. this._calendar.viewSpecManager.clearCache(); // the dynamic override invalidates the options in this cache, so just clear it
  12597. this.compute(); // this.options needs to be recomputed after the dynamic override
  12598. };
  12599. return OptionsManager;
  12600. }(Model_1.default));
  12601. exports.default = OptionsManager;
  12602. /***/ }),
  12603. /* 241 */
  12604. /***/ (function(module, exports, __webpack_require__) {
  12605. Object.defineProperty(exports, "__esModule", { value: true });
  12606. var moment = __webpack_require__(0);
  12607. var $ = __webpack_require__(3);
  12608. var ViewRegistry_1 = __webpack_require__(22);
  12609. var util_1 = __webpack_require__(4);
  12610. var options_1 = __webpack_require__(32);
  12611. var locale_1 = __webpack_require__(31);
  12612. var ViewSpecManager = /** @class */ (function () {
  12613. function ViewSpecManager(optionsManager, _calendar) {
  12614. this.optionsManager = optionsManager;
  12615. this._calendar = _calendar;
  12616. this.clearCache();
  12617. }
  12618. ViewSpecManager.prototype.clearCache = function () {
  12619. this.viewSpecCache = {};
  12620. };
  12621. // Gets information about how to create a view. Will use a cache.
  12622. ViewSpecManager.prototype.getViewSpec = function (viewType) {
  12623. var cache = this.viewSpecCache;
  12624. return cache[viewType] || (cache[viewType] = this.buildViewSpec(viewType));
  12625. };
  12626. // Given a duration singular unit, like "week" or "day", finds a matching view spec.
  12627. // Preference is given to views that have corresponding buttons.
  12628. ViewSpecManager.prototype.getUnitViewSpec = function (unit) {
  12629. var viewTypes;
  12630. var i;
  12631. var spec;
  12632. if ($.inArray(unit, util_1.unitsDesc) !== -1) {
  12633. // put views that have buttons first. there will be duplicates, but oh well
  12634. viewTypes = this._calendar.header.getViewsWithButtons(); // TODO: include footer as well?
  12635. $.each(ViewRegistry_1.viewHash, function (viewType) {
  12636. viewTypes.push(viewType);
  12637. });
  12638. for (i = 0; i < viewTypes.length; i++) {
  12639. spec = this.getViewSpec(viewTypes[i]);
  12640. if (spec) {
  12641. if (spec.singleUnit === unit) {
  12642. return spec;
  12643. }
  12644. }
  12645. }
  12646. }
  12647. };
  12648. // Builds an object with information on how to create a given view
  12649. ViewSpecManager.prototype.buildViewSpec = function (requestedViewType) {
  12650. var viewOverrides = this.optionsManager.overrides.views || {};
  12651. var specChain = []; // for the view. lowest to highest priority
  12652. var defaultsChain = []; // for the view. lowest to highest priority
  12653. var overridesChain = []; // for the view. lowest to highest priority
  12654. var viewType = requestedViewType;
  12655. var spec; // for the view
  12656. var overrides; // for the view
  12657. var durationInput;
  12658. var duration;
  12659. var unit;
  12660. // iterate from the specific view definition to a more general one until we hit an actual View class
  12661. while (viewType) {
  12662. spec = ViewRegistry_1.viewHash[viewType];
  12663. overrides = viewOverrides[viewType];
  12664. viewType = null; // clear. might repopulate for another iteration
  12665. if (typeof spec === 'function') {
  12666. spec = { 'class': spec };
  12667. }
  12668. if (spec) {
  12669. specChain.unshift(spec);
  12670. defaultsChain.unshift(spec.defaults || {});
  12671. durationInput = durationInput || spec.duration;
  12672. viewType = viewType || spec.type;
  12673. }
  12674. if (overrides) {
  12675. overridesChain.unshift(overrides); // view-specific option hashes have options at zero-level
  12676. durationInput = durationInput || overrides.duration;
  12677. viewType = viewType || overrides.type;
  12678. }
  12679. }
  12680. spec = util_1.mergeProps(specChain);
  12681. spec.type = requestedViewType;
  12682. if (!spec['class']) {
  12683. return false;
  12684. }
  12685. // fall back to top-level `duration` option
  12686. durationInput = durationInput ||
  12687. this.optionsManager.dynamicOverrides.duration ||
  12688. this.optionsManager.overrides.duration;
  12689. if (durationInput) {
  12690. duration = moment.duration(durationInput);
  12691. if (duration.valueOf()) {
  12692. unit = util_1.computeDurationGreatestUnit(duration, durationInput);
  12693. spec.duration = duration;
  12694. spec.durationUnit = unit;
  12695. // view is a single-unit duration, like "week" or "day"
  12696. // incorporate options for this. lowest priority
  12697. if (duration.as(unit) === 1) {
  12698. spec.singleUnit = unit;
  12699. overridesChain.unshift(viewOverrides[unit] || {});
  12700. }
  12701. }
  12702. }
  12703. spec.defaults = options_1.mergeOptions(defaultsChain);
  12704. spec.overrides = options_1.mergeOptions(overridesChain);
  12705. this.buildViewSpecOptions(spec);
  12706. this.buildViewSpecButtonText(spec, requestedViewType);
  12707. return spec;
  12708. };
  12709. // Builds and assigns a view spec's options object from its already-assigned defaults and overrides
  12710. ViewSpecManager.prototype.buildViewSpecOptions = function (spec) {
  12711. var optionsManager = this.optionsManager;
  12712. spec.options = options_1.mergeOptions([
  12713. options_1.globalDefaults,
  12714. spec.defaults,
  12715. optionsManager.dirDefaults,
  12716. optionsManager.localeDefaults,
  12717. optionsManager.overrides,
  12718. spec.overrides,
  12719. optionsManager.dynamicOverrides // dynamically set via setter. highest precedence
  12720. ]);
  12721. locale_1.populateInstanceComputableOptions(spec.options);
  12722. };
  12723. // Computes and assigns a view spec's buttonText-related options
  12724. ViewSpecManager.prototype.buildViewSpecButtonText = function (spec, requestedViewType) {
  12725. var optionsManager = this.optionsManager;
  12726. // given an options object with a possible `buttonText` hash, lookup the buttonText for the
  12727. // requested view, falling back to a generic unit entry like "week" or "day"
  12728. function queryButtonText(options) {
  12729. var buttonText = options.buttonText || {};
  12730. return buttonText[requestedViewType] ||
  12731. // view can decide to look up a certain key
  12732. (spec.buttonTextKey ? buttonText[spec.buttonTextKey] : null) ||
  12733. // a key like "month"
  12734. (spec.singleUnit ? buttonText[spec.singleUnit] : null);
  12735. }
  12736. // highest to lowest priority
  12737. spec.buttonTextOverride =
  12738. queryButtonText(optionsManager.dynamicOverrides) ||
  12739. queryButtonText(optionsManager.overrides) || // constructor-specified buttonText lookup hash takes precedence
  12740. spec.overrides.buttonText; // `buttonText` for view-specific options is a string
  12741. // highest to lowest priority. mirrors buildViewSpecOptions
  12742. spec.buttonTextDefault =
  12743. queryButtonText(optionsManager.localeDefaults) ||
  12744. queryButtonText(optionsManager.dirDefaults) ||
  12745. spec.defaults.buttonText || // a single string. from ViewSubclass.defaults
  12746. queryButtonText(options_1.globalDefaults) ||
  12747. (spec.duration ? this._calendar.humanizeDuration(spec.duration) : null) || // like "3 days"
  12748. requestedViewType; // fall back to given view name
  12749. };
  12750. return ViewSpecManager;
  12751. }());
  12752. exports.default = ViewSpecManager;
  12753. /***/ }),
  12754. /* 242 */
  12755. /***/ (function(module, exports, __webpack_require__) {
  12756. Object.defineProperty(exports, "__esModule", { value: true });
  12757. var $ = __webpack_require__(3);
  12758. var util_1 = __webpack_require__(4);
  12759. var EventPeriod_1 = __webpack_require__(243);
  12760. var ArrayEventSource_1 = __webpack_require__(52);
  12761. var EventSource_1 = __webpack_require__(6);
  12762. var EventSourceParser_1 = __webpack_require__(38);
  12763. var SingleEventDef_1 = __webpack_require__(13);
  12764. var EventInstanceGroup_1 = __webpack_require__(18);
  12765. var EmitterMixin_1 = __webpack_require__(11);
  12766. var ListenerMixin_1 = __webpack_require__(7);
  12767. var EventManager = /** @class */ (function () {
  12768. function EventManager(calendar) {
  12769. this.calendar = calendar;
  12770. this.stickySource = new ArrayEventSource_1.default(calendar);
  12771. this.otherSources = [];
  12772. }
  12773. EventManager.prototype.requestEvents = function (start, end, timezone, force) {
  12774. if (force ||
  12775. !this.currentPeriod ||
  12776. !this.currentPeriod.isWithinRange(start, end) ||
  12777. timezone !== this.currentPeriod.timezone) {
  12778. this.setPeriod(// will change this.currentPeriod
  12779. new EventPeriod_1.default(start, end, timezone));
  12780. }
  12781. return this.currentPeriod.whenReleased();
  12782. };
  12783. // Source Adding/Removing
  12784. // -----------------------------------------------------------------------------------------------------------------
  12785. EventManager.prototype.addSource = function (eventSource) {
  12786. this.otherSources.push(eventSource);
  12787. if (this.currentPeriod) {
  12788. this.currentPeriod.requestSource(eventSource); // might release
  12789. }
  12790. };
  12791. EventManager.prototype.removeSource = function (doomedSource) {
  12792. util_1.removeExact(this.otherSources, doomedSource);
  12793. if (this.currentPeriod) {
  12794. this.currentPeriod.purgeSource(doomedSource); // might release
  12795. }
  12796. };
  12797. EventManager.prototype.removeAllSources = function () {
  12798. this.otherSources = [];
  12799. if (this.currentPeriod) {
  12800. this.currentPeriod.purgeAllSources(); // might release
  12801. }
  12802. };
  12803. // Source Refetching
  12804. // -----------------------------------------------------------------------------------------------------------------
  12805. EventManager.prototype.refetchSource = function (eventSource) {
  12806. var currentPeriod = this.currentPeriod;
  12807. if (currentPeriod) {
  12808. currentPeriod.freeze();
  12809. currentPeriod.purgeSource(eventSource);
  12810. currentPeriod.requestSource(eventSource);
  12811. currentPeriod.thaw();
  12812. }
  12813. };
  12814. EventManager.prototype.refetchAllSources = function () {
  12815. var currentPeriod = this.currentPeriod;
  12816. if (currentPeriod) {
  12817. currentPeriod.freeze();
  12818. currentPeriod.purgeAllSources();
  12819. currentPeriod.requestSources(this.getSources());
  12820. currentPeriod.thaw();
  12821. }
  12822. };
  12823. // Source Querying
  12824. // -----------------------------------------------------------------------------------------------------------------
  12825. EventManager.prototype.getSources = function () {
  12826. return [this.stickySource].concat(this.otherSources);
  12827. };
  12828. // like querySources, but accepts multple match criteria (like multiple IDs)
  12829. EventManager.prototype.multiQuerySources = function (matchInputs) {
  12830. // coerce into an array
  12831. if (!matchInputs) {
  12832. matchInputs = [];
  12833. }
  12834. else if (!$.isArray(matchInputs)) {
  12835. matchInputs = [matchInputs];
  12836. }
  12837. var matchingSources = [];
  12838. var i;
  12839. // resolve raw inputs to real event source objects
  12840. for (i = 0; i < matchInputs.length; i++) {
  12841. matchingSources.push.apply(// append
  12842. matchingSources, this.querySources(matchInputs[i]));
  12843. }
  12844. return matchingSources;
  12845. };
  12846. // matchInput can either by a real event source object, an ID, or the function/URL for the source.
  12847. // returns an array of matching source objects.
  12848. EventManager.prototype.querySources = function (matchInput) {
  12849. var sources = this.otherSources;
  12850. var i;
  12851. var source;
  12852. // given a proper event source object
  12853. for (i = 0; i < sources.length; i++) {
  12854. source = sources[i];
  12855. if (source === matchInput) {
  12856. return [source];
  12857. }
  12858. }
  12859. // an ID match
  12860. source = this.getSourceById(EventSource_1.default.normalizeId(matchInput));
  12861. if (source) {
  12862. return [source];
  12863. }
  12864. // parse as an event source
  12865. matchInput = EventSourceParser_1.default.parse(matchInput, this.calendar);
  12866. if (matchInput) {
  12867. return $.grep(sources, function (source) {
  12868. return isSourcesEquivalent(matchInput, source);
  12869. });
  12870. }
  12871. };
  12872. /*
  12873. ID assumed to already be normalized
  12874. */
  12875. EventManager.prototype.getSourceById = function (id) {
  12876. return $.grep(this.otherSources, function (source) {
  12877. return source.id && source.id === id;
  12878. })[0];
  12879. };
  12880. // Event-Period
  12881. // -----------------------------------------------------------------------------------------------------------------
  12882. EventManager.prototype.setPeriod = function (eventPeriod) {
  12883. if (this.currentPeriod) {
  12884. this.unbindPeriod(this.currentPeriod);
  12885. this.currentPeriod = null;
  12886. }
  12887. this.currentPeriod = eventPeriod;
  12888. this.bindPeriod(eventPeriod);
  12889. eventPeriod.requestSources(this.getSources());
  12890. };
  12891. EventManager.prototype.bindPeriod = function (eventPeriod) {
  12892. this.listenTo(eventPeriod, 'release', function (eventsPayload) {
  12893. this.trigger('release', eventsPayload);
  12894. });
  12895. };
  12896. EventManager.prototype.unbindPeriod = function (eventPeriod) {
  12897. this.stopListeningTo(eventPeriod);
  12898. };
  12899. // Event Getting/Adding/Removing
  12900. // -----------------------------------------------------------------------------------------------------------------
  12901. EventManager.prototype.getEventDefByUid = function (uid) {
  12902. if (this.currentPeriod) {
  12903. return this.currentPeriod.getEventDefByUid(uid);
  12904. }
  12905. };
  12906. EventManager.prototype.addEventDef = function (eventDef, isSticky) {
  12907. if (isSticky) {
  12908. this.stickySource.addEventDef(eventDef);
  12909. }
  12910. if (this.currentPeriod) {
  12911. this.currentPeriod.addEventDef(eventDef); // might release
  12912. }
  12913. };
  12914. EventManager.prototype.removeEventDefsById = function (eventId) {
  12915. this.getSources().forEach(function (eventSource) {
  12916. eventSource.removeEventDefsById(eventId);
  12917. });
  12918. if (this.currentPeriod) {
  12919. this.currentPeriod.removeEventDefsById(eventId); // might release
  12920. }
  12921. };
  12922. EventManager.prototype.removeAllEventDefs = function () {
  12923. this.getSources().forEach(function (eventSource) {
  12924. eventSource.removeAllEventDefs();
  12925. });
  12926. if (this.currentPeriod) {
  12927. this.currentPeriod.removeAllEventDefs();
  12928. }
  12929. };
  12930. // Event Mutating
  12931. // -----------------------------------------------------------------------------------------------------------------
  12932. /*
  12933. Returns an undo function.
  12934. */
  12935. EventManager.prototype.mutateEventsWithId = function (eventDefId, eventDefMutation) {
  12936. var currentPeriod = this.currentPeriod;
  12937. var eventDefs;
  12938. var undoFuncs = [];
  12939. if (currentPeriod) {
  12940. currentPeriod.freeze();
  12941. eventDefs = currentPeriod.getEventDefsById(eventDefId);
  12942. eventDefs.forEach(function (eventDef) {
  12943. // add/remove esp because id might change
  12944. currentPeriod.removeEventDef(eventDef);
  12945. undoFuncs.push(eventDefMutation.mutateSingle(eventDef));
  12946. currentPeriod.addEventDef(eventDef);
  12947. });
  12948. currentPeriod.thaw();
  12949. return function () {
  12950. currentPeriod.freeze();
  12951. for (var i = 0; i < eventDefs.length; i++) {
  12952. currentPeriod.removeEventDef(eventDefs[i]);
  12953. undoFuncs[i]();
  12954. currentPeriod.addEventDef(eventDefs[i]);
  12955. }
  12956. currentPeriod.thaw();
  12957. };
  12958. }
  12959. return function () { };
  12960. };
  12961. /*
  12962. copies and then mutates
  12963. */
  12964. EventManager.prototype.buildMutatedEventInstanceGroup = function (eventDefId, eventDefMutation) {
  12965. var eventDefs = this.getEventDefsById(eventDefId);
  12966. var i;
  12967. var defCopy;
  12968. var allInstances = [];
  12969. for (i = 0; i < eventDefs.length; i++) {
  12970. defCopy = eventDefs[i].clone();
  12971. if (defCopy instanceof SingleEventDef_1.default) {
  12972. eventDefMutation.mutateSingle(defCopy);
  12973. allInstances.push.apply(allInstances, // append
  12974. defCopy.buildInstances());
  12975. }
  12976. }
  12977. return new EventInstanceGroup_1.default(allInstances);
  12978. };
  12979. // Freezing
  12980. // -----------------------------------------------------------------------------------------------------------------
  12981. EventManager.prototype.freeze = function () {
  12982. if (this.currentPeriod) {
  12983. this.currentPeriod.freeze();
  12984. }
  12985. };
  12986. EventManager.prototype.thaw = function () {
  12987. if (this.currentPeriod) {
  12988. this.currentPeriod.thaw();
  12989. }
  12990. };
  12991. // methods that simply forward to EventPeriod
  12992. EventManager.prototype.getEventDefsById = function (eventDefId) {
  12993. return this.currentPeriod.getEventDefsById(eventDefId);
  12994. };
  12995. EventManager.prototype.getEventInstances = function () {
  12996. return this.currentPeriod.getEventInstances();
  12997. };
  12998. EventManager.prototype.getEventInstancesWithId = function (eventDefId) {
  12999. return this.currentPeriod.getEventInstancesWithId(eventDefId);
  13000. };
  13001. EventManager.prototype.getEventInstancesWithoutId = function (eventDefId) {
  13002. return this.currentPeriod.getEventInstancesWithoutId(eventDefId);
  13003. };
  13004. return EventManager;
  13005. }());
  13006. exports.default = EventManager;
  13007. EmitterMixin_1.default.mixInto(EventManager);
  13008. ListenerMixin_1.default.mixInto(EventManager);
  13009. function isSourcesEquivalent(source0, source1) {
  13010. return source0.getPrimitive() === source1.getPrimitive();
  13011. }
  13012. /***/ }),
  13013. /* 243 */
  13014. /***/ (function(module, exports, __webpack_require__) {
  13015. Object.defineProperty(exports, "__esModule", { value: true });
  13016. var $ = __webpack_require__(3);
  13017. var util_1 = __webpack_require__(4);
  13018. var Promise_1 = __webpack_require__(20);
  13019. var EmitterMixin_1 = __webpack_require__(11);
  13020. var UnzonedRange_1 = __webpack_require__(5);
  13021. var EventInstanceGroup_1 = __webpack_require__(18);
  13022. var EventPeriod = /** @class */ (function () {
  13023. function EventPeriod(start, end, timezone) {
  13024. this.pendingCnt = 0;
  13025. this.freezeDepth = 0;
  13026. this.stuntedReleaseCnt = 0;
  13027. this.releaseCnt = 0;
  13028. this.start = start;
  13029. this.end = end;
  13030. this.timezone = timezone;
  13031. this.unzonedRange = new UnzonedRange_1.default(start.clone().stripZone(), end.clone().stripZone());
  13032. this.requestsByUid = {};
  13033. this.eventDefsByUid = {};
  13034. this.eventDefsById = {};
  13035. this.eventInstanceGroupsById = {};
  13036. }
  13037. EventPeriod.prototype.isWithinRange = function (start, end) {
  13038. // TODO: use a range util function?
  13039. return !start.isBefore(this.start) && !end.isAfter(this.end);
  13040. };
  13041. // Requesting and Purging
  13042. // -----------------------------------------------------------------------------------------------------------------
  13043. EventPeriod.prototype.requestSources = function (sources) {
  13044. this.freeze();
  13045. for (var i = 0; i < sources.length; i++) {
  13046. this.requestSource(sources[i]);
  13047. }
  13048. this.thaw();
  13049. };
  13050. EventPeriod.prototype.requestSource = function (source) {
  13051. var _this = this;
  13052. var request = { source: source, status: 'pending', eventDefs: null };
  13053. this.requestsByUid[source.uid] = request;
  13054. this.pendingCnt += 1;
  13055. source.fetch(this.start, this.end, this.timezone).then(function (eventDefs) {
  13056. if (request.status !== 'cancelled') {
  13057. request.status = 'completed';
  13058. request.eventDefs = eventDefs;
  13059. _this.addEventDefs(eventDefs);
  13060. _this.pendingCnt--;
  13061. _this.tryRelease();
  13062. }
  13063. }, function () {
  13064. if (request.status !== 'cancelled') {
  13065. request.status = 'failed';
  13066. _this.pendingCnt--;
  13067. _this.tryRelease();
  13068. }
  13069. });
  13070. };
  13071. EventPeriod.prototype.purgeSource = function (source) {
  13072. var request = this.requestsByUid[source.uid];
  13073. if (request) {
  13074. delete this.requestsByUid[source.uid];
  13075. if (request.status === 'pending') {
  13076. request.status = 'cancelled';
  13077. this.pendingCnt--;
  13078. this.tryRelease();
  13079. }
  13080. else if (request.status === 'completed') {
  13081. request.eventDefs.forEach(this.removeEventDef.bind(this));
  13082. }
  13083. }
  13084. };
  13085. EventPeriod.prototype.purgeAllSources = function () {
  13086. var requestsByUid = this.requestsByUid;
  13087. var uid;
  13088. var request;
  13089. var completedCnt = 0;
  13090. for (uid in requestsByUid) {
  13091. request = requestsByUid[uid];
  13092. if (request.status === 'pending') {
  13093. request.status = 'cancelled';
  13094. }
  13095. else if (request.status === 'completed') {
  13096. completedCnt++;
  13097. }
  13098. }
  13099. this.requestsByUid = {};
  13100. this.pendingCnt = 0;
  13101. if (completedCnt) {
  13102. this.removeAllEventDefs(); // might release
  13103. }
  13104. };
  13105. // Event Definitions
  13106. // -----------------------------------------------------------------------------------------------------------------
  13107. EventPeriod.prototype.getEventDefByUid = function (eventDefUid) {
  13108. return this.eventDefsByUid[eventDefUid];
  13109. };
  13110. EventPeriod.prototype.getEventDefsById = function (eventDefId) {
  13111. var a = this.eventDefsById[eventDefId];
  13112. if (a) {
  13113. return a.slice(); // clone
  13114. }
  13115. return [];
  13116. };
  13117. EventPeriod.prototype.addEventDefs = function (eventDefs) {
  13118. for (var i = 0; i < eventDefs.length; i++) {
  13119. this.addEventDef(eventDefs[i]);
  13120. }
  13121. };
  13122. EventPeriod.prototype.addEventDef = function (eventDef) {
  13123. var eventDefsById = this.eventDefsById;
  13124. var eventDefId = eventDef.id;
  13125. var eventDefs = eventDefsById[eventDefId] || (eventDefsById[eventDefId] = []);
  13126. var eventInstances = eventDef.buildInstances(this.unzonedRange);
  13127. var i;
  13128. eventDefs.push(eventDef);
  13129. this.eventDefsByUid[eventDef.uid] = eventDef;
  13130. for (i = 0; i < eventInstances.length; i++) {
  13131. this.addEventInstance(eventInstances[i], eventDefId);
  13132. }
  13133. };
  13134. EventPeriod.prototype.removeEventDefsById = function (eventDefId) {
  13135. var _this = this;
  13136. this.getEventDefsById(eventDefId).forEach(function (eventDef) {
  13137. _this.removeEventDef(eventDef);
  13138. });
  13139. };
  13140. EventPeriod.prototype.removeAllEventDefs = function () {
  13141. var isEmpty = $.isEmptyObject(this.eventDefsByUid);
  13142. this.eventDefsByUid = {};
  13143. this.eventDefsById = {};
  13144. this.eventInstanceGroupsById = {};
  13145. if (!isEmpty) {
  13146. this.tryRelease();
  13147. }
  13148. };
  13149. EventPeriod.prototype.removeEventDef = function (eventDef) {
  13150. var eventDefsById = this.eventDefsById;
  13151. var eventDefs = eventDefsById[eventDef.id];
  13152. delete this.eventDefsByUid[eventDef.uid];
  13153. if (eventDefs) {
  13154. util_1.removeExact(eventDefs, eventDef);
  13155. if (!eventDefs.length) {
  13156. delete eventDefsById[eventDef.id];
  13157. }
  13158. this.removeEventInstancesForDef(eventDef);
  13159. }
  13160. };
  13161. // Event Instances
  13162. // -----------------------------------------------------------------------------------------------------------------
  13163. EventPeriod.prototype.getEventInstances = function () {
  13164. var eventInstanceGroupsById = this.eventInstanceGroupsById;
  13165. var eventInstances = [];
  13166. var id;
  13167. for (id in eventInstanceGroupsById) {
  13168. eventInstances.push.apply(eventInstances, // append
  13169. eventInstanceGroupsById[id].eventInstances);
  13170. }
  13171. return eventInstances;
  13172. };
  13173. EventPeriod.prototype.getEventInstancesWithId = function (eventDefId) {
  13174. var eventInstanceGroup = this.eventInstanceGroupsById[eventDefId];
  13175. if (eventInstanceGroup) {
  13176. return eventInstanceGroup.eventInstances.slice(); // clone
  13177. }
  13178. return [];
  13179. };
  13180. EventPeriod.prototype.getEventInstancesWithoutId = function (eventDefId) {
  13181. var eventInstanceGroupsById = this.eventInstanceGroupsById;
  13182. var matchingInstances = [];
  13183. var id;
  13184. for (id in eventInstanceGroupsById) {
  13185. if (id !== eventDefId) {
  13186. matchingInstances.push.apply(matchingInstances, // append
  13187. eventInstanceGroupsById[id].eventInstances);
  13188. }
  13189. }
  13190. return matchingInstances;
  13191. };
  13192. EventPeriod.prototype.addEventInstance = function (eventInstance, eventDefId) {
  13193. var eventInstanceGroupsById = this.eventInstanceGroupsById;
  13194. var eventInstanceGroup = eventInstanceGroupsById[eventDefId] ||
  13195. (eventInstanceGroupsById[eventDefId] = new EventInstanceGroup_1.default());
  13196. eventInstanceGroup.eventInstances.push(eventInstance);
  13197. this.tryRelease();
  13198. };
  13199. EventPeriod.prototype.removeEventInstancesForDef = function (eventDef) {
  13200. var eventInstanceGroupsById = this.eventInstanceGroupsById;
  13201. var eventInstanceGroup = eventInstanceGroupsById[eventDef.id];
  13202. var removeCnt;
  13203. if (eventInstanceGroup) {
  13204. removeCnt = util_1.removeMatching(eventInstanceGroup.eventInstances, function (currentEventInstance) {
  13205. return currentEventInstance.def === eventDef;
  13206. });
  13207. if (!eventInstanceGroup.eventInstances.length) {
  13208. delete eventInstanceGroupsById[eventDef.id];
  13209. }
  13210. if (removeCnt) {
  13211. this.tryRelease();
  13212. }
  13213. }
  13214. };
  13215. // Releasing and Freezing
  13216. // -----------------------------------------------------------------------------------------------------------------
  13217. EventPeriod.prototype.tryRelease = function () {
  13218. if (!this.pendingCnt) {
  13219. if (!this.freezeDepth) {
  13220. this.release();
  13221. }
  13222. else {
  13223. this.stuntedReleaseCnt++;
  13224. }
  13225. }
  13226. };
  13227. EventPeriod.prototype.release = function () {
  13228. this.releaseCnt++;
  13229. this.trigger('release', this.eventInstanceGroupsById);
  13230. };
  13231. EventPeriod.prototype.whenReleased = function () {
  13232. var _this = this;
  13233. if (this.releaseCnt) {
  13234. return Promise_1.default.resolve(this.eventInstanceGroupsById);
  13235. }
  13236. else {
  13237. return Promise_1.default.construct(function (onResolve) {
  13238. _this.one('release', onResolve);
  13239. });
  13240. }
  13241. };
  13242. EventPeriod.prototype.freeze = function () {
  13243. if (!(this.freezeDepth++)) {
  13244. this.stuntedReleaseCnt = 0;
  13245. }
  13246. };
  13247. EventPeriod.prototype.thaw = function () {
  13248. if (!(--this.freezeDepth) && this.stuntedReleaseCnt && !this.pendingCnt) {
  13249. this.release();
  13250. }
  13251. };
  13252. return EventPeriod;
  13253. }());
  13254. exports.default = EventPeriod;
  13255. EmitterMixin_1.default.mixInto(EventPeriod);
  13256. /***/ }),
  13257. /* 244 */
  13258. /***/ (function(module, exports, __webpack_require__) {
  13259. Object.defineProperty(exports, "__esModule", { value: true });
  13260. var $ = __webpack_require__(3);
  13261. var util_1 = __webpack_require__(4);
  13262. var ListenerMixin_1 = __webpack_require__(7);
  13263. /* Creates a clone of an element and lets it track the mouse as it moves
  13264. ----------------------------------------------------------------------------------------------------------------------*/
  13265. var MouseFollower = /** @class */ (function () {
  13266. function MouseFollower(sourceEl, options) {
  13267. this.isFollowing = false;
  13268. this.isHidden = false;
  13269. this.isAnimating = false; // doing the revert animation?
  13270. this.options = options = options || {};
  13271. this.sourceEl = sourceEl;
  13272. this.parentEl = options.parentEl ? $(options.parentEl) : sourceEl.parent(); // default to sourceEl's parent
  13273. }
  13274. // Causes the element to start following the mouse
  13275. MouseFollower.prototype.start = function (ev) {
  13276. if (!this.isFollowing) {
  13277. this.isFollowing = true;
  13278. this.y0 = util_1.getEvY(ev);
  13279. this.x0 = util_1.getEvX(ev);
  13280. this.topDelta = 0;
  13281. this.leftDelta = 0;
  13282. if (!this.isHidden) {
  13283. this.updatePosition();
  13284. }
  13285. if (util_1.getEvIsTouch(ev)) {
  13286. this.listenTo($(document), 'touchmove', this.handleMove);
  13287. }
  13288. else {
  13289. this.listenTo($(document), 'mousemove', this.handleMove);
  13290. }
  13291. }
  13292. };
  13293. // Causes the element to stop following the mouse. If shouldRevert is true, will animate back to original position.
  13294. // `callback` gets invoked when the animation is complete. If no animation, it is invoked immediately.
  13295. MouseFollower.prototype.stop = function (shouldRevert, callback) {
  13296. var _this = this;
  13297. var revertDuration = this.options.revertDuration;
  13298. var complete = function () {
  13299. _this.isAnimating = false;
  13300. _this.removeElement();
  13301. _this.top0 = _this.left0 = null; // reset state for future updatePosition calls
  13302. if (callback) {
  13303. callback();
  13304. }
  13305. };
  13306. if (this.isFollowing && !this.isAnimating) {
  13307. this.isFollowing = false;
  13308. this.stopListeningTo($(document));
  13309. if (shouldRevert && revertDuration && !this.isHidden) {
  13310. this.isAnimating = true;
  13311. this.el.animate({
  13312. top: this.top0,
  13313. left: this.left0
  13314. }, {
  13315. duration: revertDuration,
  13316. complete: complete
  13317. });
  13318. }
  13319. else {
  13320. complete();
  13321. }
  13322. }
  13323. };
  13324. // Gets the tracking element. Create it if necessary
  13325. MouseFollower.prototype.getEl = function () {
  13326. var el = this.el;
  13327. if (!el) {
  13328. el = this.el = this.sourceEl.clone()
  13329. .addClass(this.options.additionalClass || '')
  13330. .css({
  13331. position: 'absolute',
  13332. visibility: '',
  13333. display: this.isHidden ? 'none' : '',
  13334. margin: 0,
  13335. right: 'auto',
  13336. bottom: 'auto',
  13337. width: this.sourceEl.width(),
  13338. height: this.sourceEl.height(),
  13339. opacity: this.options.opacity || '',
  13340. zIndex: this.options.zIndex
  13341. });
  13342. // we don't want long taps or any mouse interaction causing selection/menus.
  13343. // would use preventSelection(), but that prevents selectstart, causing problems.
  13344. el.addClass('fc-unselectable');
  13345. el.appendTo(this.parentEl);
  13346. }
  13347. return el;
  13348. };
  13349. // Removes the tracking element if it has already been created
  13350. MouseFollower.prototype.removeElement = function () {
  13351. if (this.el) {
  13352. this.el.remove();
  13353. this.el = null;
  13354. }
  13355. };
  13356. // Update the CSS position of the tracking element
  13357. MouseFollower.prototype.updatePosition = function () {
  13358. var sourceOffset;
  13359. var origin;
  13360. this.getEl(); // ensure this.el
  13361. // make sure origin info was computed
  13362. if (this.top0 == null) {
  13363. sourceOffset = this.sourceEl.offset();
  13364. origin = this.el.offsetParent().offset();
  13365. this.top0 = sourceOffset.top - origin.top;
  13366. this.left0 = sourceOffset.left - origin.left;
  13367. }
  13368. this.el.css({
  13369. top: this.top0 + this.topDelta,
  13370. left: this.left0 + this.leftDelta
  13371. });
  13372. };
  13373. // Gets called when the user moves the mouse
  13374. MouseFollower.prototype.handleMove = function (ev) {
  13375. this.topDelta = util_1.getEvY(ev) - this.y0;
  13376. this.leftDelta = util_1.getEvX(ev) - this.x0;
  13377. if (!this.isHidden) {
  13378. this.updatePosition();
  13379. }
  13380. };
  13381. // Temporarily makes the tracking element invisible. Can be called before following starts
  13382. MouseFollower.prototype.hide = function () {
  13383. if (!this.isHidden) {
  13384. this.isHidden = true;
  13385. if (this.el) {
  13386. this.el.hide();
  13387. }
  13388. }
  13389. };
  13390. // Show the tracking element after it has been temporarily hidden
  13391. MouseFollower.prototype.show = function () {
  13392. if (this.isHidden) {
  13393. this.isHidden = false;
  13394. this.updatePosition();
  13395. this.getEl().show();
  13396. }
  13397. };
  13398. return MouseFollower;
  13399. }());
  13400. exports.default = MouseFollower;
  13401. ListenerMixin_1.default.mixInto(MouseFollower);
  13402. /***/ }),
  13403. /* 245 */
  13404. /***/ (function(module, exports, __webpack_require__) {
  13405. Object.defineProperty(exports, "__esModule", { value: true });
  13406. var tslib_1 = __webpack_require__(2);
  13407. var HitDragListener_1 = __webpack_require__(23);
  13408. var Interaction_1 = __webpack_require__(15);
  13409. var DateClicking = /** @class */ (function (_super) {
  13410. tslib_1.__extends(DateClicking, _super);
  13411. /*
  13412. component must implement:
  13413. - bindDateHandlerToEl
  13414. - getSafeHitFootprint
  13415. - getHitEl
  13416. */
  13417. function DateClicking(component) {
  13418. var _this = _super.call(this, component) || this;
  13419. _this.dragListener = _this.buildDragListener();
  13420. return _this;
  13421. }
  13422. DateClicking.prototype.end = function () {
  13423. this.dragListener.endInteraction();
  13424. };
  13425. DateClicking.prototype.bindToEl = function (el) {
  13426. var component = this.component;
  13427. var dragListener = this.dragListener;
  13428. component.bindDateHandlerToEl(el, 'mousedown', function (ev) {
  13429. if (!component.shouldIgnoreMouse()) {
  13430. dragListener.startInteraction(ev);
  13431. }
  13432. });
  13433. component.bindDateHandlerToEl(el, 'touchstart', function (ev) {
  13434. if (!component.shouldIgnoreTouch()) {
  13435. dragListener.startInteraction(ev);
  13436. }
  13437. });
  13438. };
  13439. // Creates a listener that tracks the user's drag across day elements, for day clicking.
  13440. DateClicking.prototype.buildDragListener = function () {
  13441. var _this = this;
  13442. var component = this.component;
  13443. var dayClickHit; // null if invalid dayClick
  13444. var dragListener = new HitDragListener_1.default(component, {
  13445. scroll: this.opt('dragScroll'),
  13446. interactionStart: function () {
  13447. dayClickHit = dragListener.origHit;
  13448. },
  13449. hitOver: function (hit, isOrig, origHit) {
  13450. // if user dragged to another cell at any point, it can no longer be a dayClick
  13451. if (!isOrig) {
  13452. dayClickHit = null;
  13453. }
  13454. },
  13455. hitOut: function () {
  13456. dayClickHit = null;
  13457. },
  13458. interactionEnd: function (ev, isCancelled) {
  13459. var componentFootprint;
  13460. if (!isCancelled && dayClickHit) {
  13461. componentFootprint = component.getSafeHitFootprint(dayClickHit);
  13462. if (componentFootprint) {
  13463. _this.view.triggerDayClick(componentFootprint, component.getHitEl(dayClickHit), ev);
  13464. }
  13465. }
  13466. }
  13467. });
  13468. // because dragListener won't be called with any time delay, "dragging" will begin immediately,
  13469. // which will kill any touchmoving/scrolling. Prevent this.
  13470. dragListener.shouldCancelTouchScroll = false;
  13471. dragListener.scrollAlwaysKills = true;
  13472. return dragListener;
  13473. };
  13474. return DateClicking;
  13475. }(Interaction_1.default));
  13476. exports.default = DateClicking;
  13477. /***/ }),
  13478. /* 246 */
  13479. /***/ (function(module, exports, __webpack_require__) {
  13480. Object.defineProperty(exports, "__esModule", { value: true });
  13481. var tslib_1 = __webpack_require__(2);
  13482. var util_1 = __webpack_require__(4);
  13483. var EventRenderer_1 = __webpack_require__(42);
  13484. /*
  13485. Only handles foreground segs.
  13486. Does not own rendering. Use for low-level util methods by TimeGrid.
  13487. */
  13488. var TimeGridEventRenderer = /** @class */ (function (_super) {
  13489. tslib_1.__extends(TimeGridEventRenderer, _super);
  13490. function TimeGridEventRenderer(timeGrid, fillRenderer) {
  13491. var _this = _super.call(this, timeGrid, fillRenderer) || this;
  13492. _this.timeGrid = timeGrid;
  13493. return _this;
  13494. }
  13495. TimeGridEventRenderer.prototype.renderFgSegs = function (segs) {
  13496. this.renderFgSegsIntoContainers(segs, this.timeGrid.fgContainerEls);
  13497. };
  13498. // Given an array of foreground segments, render a DOM element for each, computes position,
  13499. // and attaches to the column inner-container elements.
  13500. TimeGridEventRenderer.prototype.renderFgSegsIntoContainers = function (segs, containerEls) {
  13501. var segsByCol;
  13502. var col;
  13503. segsByCol = this.timeGrid.groupSegsByCol(segs);
  13504. for (col = 0; col < this.timeGrid.colCnt; col++) {
  13505. this.updateFgSegCoords(segsByCol[col]);
  13506. }
  13507. this.timeGrid.attachSegsByCol(segsByCol, containerEls);
  13508. };
  13509. TimeGridEventRenderer.prototype.unrenderFgSegs = function () {
  13510. if (this.fgSegs) {
  13511. this.fgSegs.forEach(function (seg) {
  13512. seg.el.remove();
  13513. });
  13514. }
  13515. };
  13516. // Computes a default event time formatting string if `timeFormat` is not explicitly defined
  13517. TimeGridEventRenderer.prototype.computeEventTimeFormat = function () {
  13518. return this.opt('noMeridiemTimeFormat'); // like "6:30" (no AM/PM)
  13519. };
  13520. // Computes a default `displayEventEnd` value if one is not expliclty defined
  13521. TimeGridEventRenderer.prototype.computeDisplayEventEnd = function () {
  13522. return true;
  13523. };
  13524. // Renders the HTML for a single event segment's default rendering
  13525. TimeGridEventRenderer.prototype.fgSegHtml = function (seg, disableResizing) {
  13526. var view = this.view;
  13527. var calendar = view.calendar;
  13528. var componentFootprint = seg.footprint.componentFootprint;
  13529. var isAllDay = componentFootprint.isAllDay;
  13530. var eventDef = seg.footprint.eventDef;
  13531. var isDraggable = view.isEventDefDraggable(eventDef);
  13532. var isResizableFromStart = !disableResizing && seg.isStart && view.isEventDefResizableFromStart(eventDef);
  13533. var isResizableFromEnd = !disableResizing && seg.isEnd && view.isEventDefResizableFromEnd(eventDef);
  13534. var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd);
  13535. var skinCss = util_1.cssToStr(this.getSkinCss(eventDef));
  13536. var timeText;
  13537. var fullTimeText; // more verbose time text. for the print stylesheet
  13538. var startTimeText; // just the start time text
  13539. classes.unshift('fc-time-grid-event', 'fc-v-event');
  13540. // if the event appears to span more than one day...
  13541. if (view.isMultiDayRange(componentFootprint.unzonedRange)) {
  13542. // Don't display time text on segments that run entirely through a day.
  13543. // That would appear as midnight-midnight and would look dumb.
  13544. // Otherwise, display the time text for the *segment's* times (like 6pm-midnight or midnight-10am)
  13545. if (seg.isStart || seg.isEnd) {
  13546. var zonedStart = calendar.msToMoment(seg.startMs);
  13547. var zonedEnd = calendar.msToMoment(seg.endMs);
  13548. timeText = this._getTimeText(zonedStart, zonedEnd, isAllDay);
  13549. fullTimeText = this._getTimeText(zonedStart, zonedEnd, isAllDay, 'LT');
  13550. startTimeText = this._getTimeText(zonedStart, zonedEnd, isAllDay, null, false); // displayEnd=false
  13551. }
  13552. }
  13553. else {
  13554. // Display the normal time text for the *event's* times
  13555. timeText = this.getTimeText(seg.footprint);
  13556. fullTimeText = this.getTimeText(seg.footprint, 'LT');
  13557. startTimeText = this.getTimeText(seg.footprint, null, false); // displayEnd=false
  13558. }
  13559. return '<a class="' + classes.join(' ') + '"' +
  13560. (eventDef.url ?
  13561. ' href="' + util_1.htmlEscape(eventDef.url) + '"' :
  13562. '') +
  13563. (skinCss ?
  13564. ' style="' + skinCss + '"' :
  13565. '') +
  13566. '>' +
  13567. '<div class="fc-content">' +
  13568. (timeText ?
  13569. '<div class="fc-time"' +
  13570. ' data-start="' + util_1.htmlEscape(startTimeText) + '"' +
  13571. ' data-full="' + util_1.htmlEscape(fullTimeText) + '"' +
  13572. '>' +
  13573. '<span>' + util_1.htmlEscape(timeText) + '</span>' +
  13574. '</div>' :
  13575. '') +
  13576. (eventDef.title ?
  13577. '<div class="fc-title">' +
  13578. util_1.htmlEscape(eventDef.title) +
  13579. '</div>' :
  13580. '') +
  13581. '</div>' +
  13582. '<div class="fc-bg"/>' +
  13583. /* TODO: write CSS for this
  13584. (isResizableFromStart ?
  13585. '<div class="fc-resizer fc-start-resizer" />' :
  13586. ''
  13587. ) +
  13588. */
  13589. (isResizableFromEnd ?
  13590. '<div class="fc-resizer fc-end-resizer" />' :
  13591. '') +
  13592. '</a>';
  13593. };
  13594. // Given segments that are assumed to all live in the *same column*,
  13595. // compute their verical/horizontal coordinates and assign to their elements.
  13596. TimeGridEventRenderer.prototype.updateFgSegCoords = function (segs) {
  13597. this.timeGrid.computeSegVerticals(segs); // horizontals relies on this
  13598. this.computeFgSegHorizontals(segs); // compute horizontal coordinates, z-index's, and reorder the array
  13599. this.timeGrid.assignSegVerticals(segs);
  13600. this.assignFgSegHorizontals(segs);
  13601. };
  13602. // Given an array of segments that are all in the same column, sets the backwardCoord and forwardCoord on each.
  13603. // NOTE: Also reorders the given array by date!
  13604. TimeGridEventRenderer.prototype.computeFgSegHorizontals = function (segs) {
  13605. var levels;
  13606. var level0;
  13607. var i;
  13608. this.sortEventSegs(segs); // order by certain criteria
  13609. levels = buildSlotSegLevels(segs);
  13610. computeForwardSlotSegs(levels);
  13611. if ((level0 = levels[0])) {
  13612. for (i = 0; i < level0.length; i++) {
  13613. computeSlotSegPressures(level0[i]);
  13614. }
  13615. for (i = 0; i < level0.length; i++) {
  13616. this.computeFgSegForwardBack(level0[i], 0, 0);
  13617. }
  13618. }
  13619. };
  13620. // Calculate seg.forwardCoord and seg.backwardCoord for the segment, where both values range
  13621. // from 0 to 1. If the calendar is left-to-right, the seg.backwardCoord maps to "left" and
  13622. // seg.forwardCoord maps to "right" (via percentage). Vice-versa if the calendar is right-to-left.
  13623. //
  13624. // The segment might be part of a "series", which means consecutive segments with the same pressure
  13625. // who's width is unknown until an edge has been hit. `seriesBackwardPressure` is the number of
  13626. // segments behind this one in the current series, and `seriesBackwardCoord` is the starting
  13627. // coordinate of the first segment in the series.
  13628. TimeGridEventRenderer.prototype.computeFgSegForwardBack = function (seg, seriesBackwardPressure, seriesBackwardCoord) {
  13629. var forwardSegs = seg.forwardSegs;
  13630. var i;
  13631. if (seg.forwardCoord === undefined) {
  13632. if (!forwardSegs.length) {
  13633. // if there are no forward segments, this segment should butt up against the edge
  13634. seg.forwardCoord = 1;
  13635. }
  13636. else {
  13637. // sort highest pressure first
  13638. this.sortForwardSegs(forwardSegs);
  13639. // this segment's forwardCoord will be calculated from the backwardCoord of the
  13640. // highest-pressure forward segment.
  13641. this.computeFgSegForwardBack(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord);
  13642. seg.forwardCoord = forwardSegs[0].backwardCoord;
  13643. }
  13644. // calculate the backwardCoord from the forwardCoord. consider the series
  13645. seg.backwardCoord = seg.forwardCoord -
  13646. (seg.forwardCoord - seriesBackwardCoord) / // available width for series
  13647. (seriesBackwardPressure + 1); // # of segments in the series
  13648. // use this segment's coordinates to computed the coordinates of the less-pressurized
  13649. // forward segments
  13650. for (i = 0; i < forwardSegs.length; i++) {
  13651. this.computeFgSegForwardBack(forwardSegs[i], 0, seg.forwardCoord);
  13652. }
  13653. }
  13654. };
  13655. TimeGridEventRenderer.prototype.sortForwardSegs = function (forwardSegs) {
  13656. forwardSegs.sort(util_1.proxy(this, 'compareForwardSegs'));
  13657. };
  13658. // A cmp function for determining which forward segment to rely on more when computing coordinates.
  13659. TimeGridEventRenderer.prototype.compareForwardSegs = function (seg1, seg2) {
  13660. // put higher-pressure first
  13661. return seg2.forwardPressure - seg1.forwardPressure ||
  13662. // put segments that are closer to initial edge first (and favor ones with no coords yet)
  13663. (seg1.backwardCoord || 0) - (seg2.backwardCoord || 0) ||
  13664. // do normal sorting...
  13665. this.compareEventSegs(seg1, seg2);
  13666. };
  13667. // Given foreground event segments that have already had their position coordinates computed,
  13668. // assigns position-related CSS values to their elements.
  13669. TimeGridEventRenderer.prototype.assignFgSegHorizontals = function (segs) {
  13670. var i;
  13671. var seg;
  13672. for (i = 0; i < segs.length; i++) {
  13673. seg = segs[i];
  13674. seg.el.css(this.generateFgSegHorizontalCss(seg));
  13675. // if the height is short, add a className for alternate styling
  13676. if (seg.bottom - seg.top < 30) {
  13677. seg.el.addClass('fc-short');
  13678. }
  13679. }
  13680. };
  13681. // Generates an object with CSS properties/values that should be applied to an event segment element.
  13682. // Contains important positioning-related properties that should be applied to any event element, customized or not.
  13683. TimeGridEventRenderer.prototype.generateFgSegHorizontalCss = function (seg) {
  13684. var shouldOverlap = this.opt('slotEventOverlap');
  13685. var backwardCoord = seg.backwardCoord; // the left side if LTR. the right side if RTL. floating-point
  13686. var forwardCoord = seg.forwardCoord; // the right side if LTR. the left side if RTL. floating-point
  13687. var props = this.timeGrid.generateSegVerticalCss(seg); // get top/bottom first
  13688. var isRTL = this.timeGrid.isRTL;
  13689. var left; // amount of space from left edge, a fraction of the total width
  13690. var right; // amount of space from right edge, a fraction of the total width
  13691. if (shouldOverlap) {
  13692. // double the width, but don't go beyond the maximum forward coordinate (1.0)
  13693. forwardCoord = Math.min(1, backwardCoord + (forwardCoord - backwardCoord) * 2);
  13694. }
  13695. if (isRTL) {
  13696. left = 1 - forwardCoord;
  13697. right = backwardCoord;
  13698. }
  13699. else {
  13700. left = backwardCoord;
  13701. right = 1 - forwardCoord;
  13702. }
  13703. props.zIndex = seg.level + 1; // convert from 0-base to 1-based
  13704. props.left = left * 100 + '%';
  13705. props.right = right * 100 + '%';
  13706. if (shouldOverlap && seg.forwardPressure) {
  13707. // add padding to the edge so that forward stacked events don't cover the resizer's icon
  13708. props[isRTL ? 'marginLeft' : 'marginRight'] = 10 * 2; // 10 is a guesstimate of the icon's width
  13709. }
  13710. return props;
  13711. };
  13712. return TimeGridEventRenderer;
  13713. }(EventRenderer_1.default));
  13714. exports.default = TimeGridEventRenderer;
  13715. // Builds an array of segments "levels". The first level will be the leftmost tier of segments if the calendar is
  13716. // left-to-right, or the rightmost if the calendar is right-to-left. Assumes the segments are already ordered by date.
  13717. function buildSlotSegLevels(segs) {
  13718. var levels = [];
  13719. var i;
  13720. var seg;
  13721. var j;
  13722. for (i = 0; i < segs.length; i++) {
  13723. seg = segs[i];
  13724. // go through all the levels and stop on the first level where there are no collisions
  13725. for (j = 0; j < levels.length; j++) {
  13726. if (!computeSlotSegCollisions(seg, levels[j]).length) {
  13727. break;
  13728. }
  13729. }
  13730. seg.level = j;
  13731. (levels[j] || (levels[j] = [])).push(seg);
  13732. }
  13733. return levels;
  13734. }
  13735. // For every segment, figure out the other segments that are in subsequent
  13736. // levels that also occupy the same vertical space. Accumulate in seg.forwardSegs
  13737. function computeForwardSlotSegs(levels) {
  13738. var i;
  13739. var level;
  13740. var j;
  13741. var seg;
  13742. var k;
  13743. for (i = 0; i < levels.length; i++) {
  13744. level = levels[i];
  13745. for (j = 0; j < level.length; j++) {
  13746. seg = level[j];
  13747. seg.forwardSegs = [];
  13748. for (k = i + 1; k < levels.length; k++) {
  13749. computeSlotSegCollisions(seg, levels[k], seg.forwardSegs);
  13750. }
  13751. }
  13752. }
  13753. }
  13754. // Figure out which path forward (via seg.forwardSegs) results in the longest path until
  13755. // the furthest edge is reached. The number of segments in this path will be seg.forwardPressure
  13756. function computeSlotSegPressures(seg) {
  13757. var forwardSegs = seg.forwardSegs;
  13758. var forwardPressure = 0;
  13759. var i;
  13760. var forwardSeg;
  13761. if (seg.forwardPressure === undefined) {
  13762. for (i = 0; i < forwardSegs.length; i++) {
  13763. forwardSeg = forwardSegs[i];
  13764. // figure out the child's maximum forward path
  13765. computeSlotSegPressures(forwardSeg);
  13766. // either use the existing maximum, or use the child's forward pressure
  13767. // plus one (for the forwardSeg itself)
  13768. forwardPressure = Math.max(forwardPressure, 1 + forwardSeg.forwardPressure);
  13769. }
  13770. seg.forwardPressure = forwardPressure;
  13771. }
  13772. }
  13773. // Find all the segments in `otherSegs` that vertically collide with `seg`.
  13774. // Append into an optionally-supplied `results` array and return.
  13775. function computeSlotSegCollisions(seg, otherSegs, results) {
  13776. if (results === void 0) { results = []; }
  13777. for (var i = 0; i < otherSegs.length; i++) {
  13778. if (isSlotSegCollision(seg, otherSegs[i])) {
  13779. results.push(otherSegs[i]);
  13780. }
  13781. }
  13782. return results;
  13783. }
  13784. // Do these segments occupy the same vertical space?
  13785. function isSlotSegCollision(seg1, seg2) {
  13786. return seg1.bottom > seg2.top && seg1.top < seg2.bottom;
  13787. }
  13788. /***/ }),
  13789. /* 247 */
  13790. /***/ (function(module, exports, __webpack_require__) {
  13791. Object.defineProperty(exports, "__esModule", { value: true });
  13792. var tslib_1 = __webpack_require__(2);
  13793. var $ = __webpack_require__(3);
  13794. var HelperRenderer_1 = __webpack_require__(58);
  13795. var TimeGridHelperRenderer = /** @class */ (function (_super) {
  13796. tslib_1.__extends(TimeGridHelperRenderer, _super);
  13797. function TimeGridHelperRenderer() {
  13798. return _super !== null && _super.apply(this, arguments) || this;
  13799. }
  13800. TimeGridHelperRenderer.prototype.renderSegs = function (segs, sourceSeg) {
  13801. var helperNodes = [];
  13802. var i;
  13803. var seg;
  13804. var sourceEl;
  13805. // TODO: not good to call eventRenderer this way
  13806. this.eventRenderer.renderFgSegsIntoContainers(segs, this.component.helperContainerEls);
  13807. // Try to make the segment that is in the same row as sourceSeg look the same
  13808. for (i = 0; i < segs.length; i++) {
  13809. seg = segs[i];
  13810. if (sourceSeg && sourceSeg.col === seg.col) {
  13811. sourceEl = sourceSeg.el;
  13812. seg.el.css({
  13813. left: sourceEl.css('left'),
  13814. right: sourceEl.css('right'),
  13815. 'margin-left': sourceEl.css('margin-left'),
  13816. 'margin-right': sourceEl.css('margin-right')
  13817. });
  13818. }
  13819. helperNodes.push(seg.el[0]);
  13820. }
  13821. return $(helperNodes); // must return the elements rendered
  13822. };
  13823. return TimeGridHelperRenderer;
  13824. }(HelperRenderer_1.default));
  13825. exports.default = TimeGridHelperRenderer;
  13826. /***/ }),
  13827. /* 248 */
  13828. /***/ (function(module, exports, __webpack_require__) {
  13829. Object.defineProperty(exports, "__esModule", { value: true });
  13830. var tslib_1 = __webpack_require__(2);
  13831. var FillRenderer_1 = __webpack_require__(57);
  13832. var TimeGridFillRenderer = /** @class */ (function (_super) {
  13833. tslib_1.__extends(TimeGridFillRenderer, _super);
  13834. function TimeGridFillRenderer() {
  13835. return _super !== null && _super.apply(this, arguments) || this;
  13836. }
  13837. TimeGridFillRenderer.prototype.attachSegEls = function (type, segs) {
  13838. var timeGrid = this.component;
  13839. var containerEls;
  13840. // TODO: more efficient lookup
  13841. if (type === 'bgEvent') {
  13842. containerEls = timeGrid.bgContainerEls;
  13843. }
  13844. else if (type === 'businessHours') {
  13845. containerEls = timeGrid.businessContainerEls;
  13846. }
  13847. else if (type === 'highlight') {
  13848. containerEls = timeGrid.highlightContainerEls;
  13849. }
  13850. timeGrid.updateSegVerticals(segs);
  13851. timeGrid.attachSegsByCol(timeGrid.groupSegsByCol(segs), containerEls);
  13852. return segs.map(function (seg) {
  13853. return seg.el[0];
  13854. });
  13855. };
  13856. return TimeGridFillRenderer;
  13857. }(FillRenderer_1.default));
  13858. exports.default = TimeGridFillRenderer;
  13859. /***/ }),
  13860. /* 249 */
  13861. /***/ (function(module, exports, __webpack_require__) {
  13862. /* A rectangular panel that is absolutely positioned over other content
  13863. ------------------------------------------------------------------------------------------------------------------------
  13864. Options:
  13865. - className (string)
  13866. - content (HTML string or jQuery element set)
  13867. - parentEl
  13868. - top
  13869. - left
  13870. - right (the x coord of where the right edge should be. not a "CSS" right)
  13871. - autoHide (boolean)
  13872. - show (callback)
  13873. - hide (callback)
  13874. */
  13875. Object.defineProperty(exports, "__esModule", { value: true });
  13876. var $ = __webpack_require__(3);
  13877. var util_1 = __webpack_require__(4);
  13878. var ListenerMixin_1 = __webpack_require__(7);
  13879. var Popover = /** @class */ (function () {
  13880. function Popover(options) {
  13881. this.isHidden = true;
  13882. this.margin = 10; // the space required between the popover and the edges of the scroll container
  13883. this.options = options || {};
  13884. }
  13885. // Shows the popover on the specified position. Renders it if not already
  13886. Popover.prototype.show = function () {
  13887. if (this.isHidden) {
  13888. if (!this.el) {
  13889. this.render();
  13890. }
  13891. this.el.show();
  13892. this.position();
  13893. this.isHidden = false;
  13894. this.trigger('show');
  13895. }
  13896. };
  13897. // Hides the popover, through CSS, but does not remove it from the DOM
  13898. Popover.prototype.hide = function () {
  13899. if (!this.isHidden) {
  13900. this.el.hide();
  13901. this.isHidden = true;
  13902. this.trigger('hide');
  13903. }
  13904. };
  13905. // Creates `this.el` and renders content inside of it
  13906. Popover.prototype.render = function () {
  13907. var _this = this;
  13908. var options = this.options;
  13909. this.el = $('<div class="fc-popover"/>')
  13910. .addClass(options.className || '')
  13911. .css({
  13912. // position initially to the top left to avoid creating scrollbars
  13913. top: 0,
  13914. left: 0
  13915. })
  13916. .append(options.content)
  13917. .appendTo(options.parentEl);
  13918. // when a click happens on anything inside with a 'fc-close' className, hide the popover
  13919. this.el.on('click', '.fc-close', function () {
  13920. _this.hide();
  13921. });
  13922. if (options.autoHide) {
  13923. this.listenTo($(document), 'mousedown', this.documentMousedown);
  13924. }
  13925. };
  13926. // Triggered when the user clicks *anywhere* in the document, for the autoHide feature
  13927. Popover.prototype.documentMousedown = function (ev) {
  13928. // only hide the popover if the click happened outside the popover
  13929. if (this.el && !$(ev.target).closest(this.el).length) {
  13930. this.hide();
  13931. }
  13932. };
  13933. // Hides and unregisters any handlers
  13934. Popover.prototype.removeElement = function () {
  13935. this.hide();
  13936. if (this.el) {
  13937. this.el.remove();
  13938. this.el = null;
  13939. }
  13940. this.stopListeningTo($(document), 'mousedown');
  13941. };
  13942. // Positions the popover optimally, using the top/left/right options
  13943. Popover.prototype.position = function () {
  13944. var options = this.options;
  13945. var origin = this.el.offsetParent().offset();
  13946. var width = this.el.outerWidth();
  13947. var height = this.el.outerHeight();
  13948. var windowEl = $(window);
  13949. var viewportEl = util_1.getScrollParent(this.el);
  13950. var viewportTop;
  13951. var viewportLeft;
  13952. var viewportOffset;
  13953. var top; // the "position" (not "offset") values for the popover
  13954. var left; //
  13955. // compute top and left
  13956. top = options.top || 0;
  13957. if (options.left !== undefined) {
  13958. left = options.left;
  13959. }
  13960. else if (options.right !== undefined) {
  13961. left = options.right - width; // derive the left value from the right value
  13962. }
  13963. else {
  13964. left = 0;
  13965. }
  13966. if (viewportEl.is(window) || viewportEl.is(document)) {
  13967. viewportEl = windowEl;
  13968. viewportTop = 0; // the window is always at the top left
  13969. viewportLeft = 0; // (and .offset() won't work if called here)
  13970. }
  13971. else {
  13972. viewportOffset = viewportEl.offset();
  13973. viewportTop = viewportOffset.top;
  13974. viewportLeft = viewportOffset.left;
  13975. }
  13976. // if the window is scrolled, it causes the visible area to be further down
  13977. viewportTop += windowEl.scrollTop();
  13978. viewportLeft += windowEl.scrollLeft();
  13979. // constrain to the view port. if constrained by two edges, give precedence to top/left
  13980. if (options.viewportConstrain !== false) {
  13981. top = Math.min(top, viewportTop + viewportEl.outerHeight() - height - this.margin);
  13982. top = Math.max(top, viewportTop + this.margin);
  13983. left = Math.min(left, viewportLeft + viewportEl.outerWidth() - width - this.margin);
  13984. left = Math.max(left, viewportLeft + this.margin);
  13985. }
  13986. this.el.css({
  13987. top: top - origin.top,
  13988. left: left - origin.left
  13989. });
  13990. };
  13991. // Triggers a callback. Calls a function in the option hash of the same name.
  13992. // Arguments beyond the first `name` are forwarded on.
  13993. // TODO: better code reuse for this. Repeat code
  13994. Popover.prototype.trigger = function (name) {
  13995. if (this.options[name]) {
  13996. this.options[name].apply(this, Array.prototype.slice.call(arguments, 1));
  13997. }
  13998. };
  13999. return Popover;
  14000. }());
  14001. exports.default = Popover;
  14002. ListenerMixin_1.default.mixInto(Popover);
  14003. /***/ }),
  14004. /* 250 */
  14005. /***/ (function(module, exports, __webpack_require__) {
  14006. Object.defineProperty(exports, "__esModule", { value: true });
  14007. var tslib_1 = __webpack_require__(2);
  14008. var $ = __webpack_require__(3);
  14009. var util_1 = __webpack_require__(4);
  14010. var EventRenderer_1 = __webpack_require__(42);
  14011. /* Event-rendering methods for the DayGrid class
  14012. ----------------------------------------------------------------------------------------------------------------------*/
  14013. var DayGridEventRenderer = /** @class */ (function (_super) {
  14014. tslib_1.__extends(DayGridEventRenderer, _super);
  14015. function DayGridEventRenderer(dayGrid, fillRenderer) {
  14016. var _this = _super.call(this, dayGrid, fillRenderer) || this;
  14017. _this.dayGrid = dayGrid;
  14018. return _this;
  14019. }
  14020. DayGridEventRenderer.prototype.renderBgRanges = function (eventRanges) {
  14021. // don't render timed background events
  14022. eventRanges = $.grep(eventRanges, function (eventRange) {
  14023. return eventRange.eventDef.isAllDay();
  14024. });
  14025. _super.prototype.renderBgRanges.call(this, eventRanges);
  14026. };
  14027. // Renders the given foreground event segments onto the grid
  14028. DayGridEventRenderer.prototype.renderFgSegs = function (segs) {
  14029. var rowStructs = this.rowStructs = this.renderSegRows(segs);
  14030. // append to each row's content skeleton
  14031. this.dayGrid.rowEls.each(function (i, rowNode) {
  14032. $(rowNode).find('.fc-content-skeleton > table').append(rowStructs[i].tbodyEl);
  14033. });
  14034. };
  14035. // Unrenders all currently rendered foreground event segments
  14036. DayGridEventRenderer.prototype.unrenderFgSegs = function () {
  14037. var rowStructs = this.rowStructs || [];
  14038. var rowStruct;
  14039. while ((rowStruct = rowStructs.pop())) {
  14040. rowStruct.tbodyEl.remove();
  14041. }
  14042. this.rowStructs = null;
  14043. };
  14044. // Uses the given events array to generate <tbody> elements that should be appended to each row's content skeleton.
  14045. // Returns an array of rowStruct objects (see the bottom of `renderSegRow`).
  14046. // PRECONDITION: each segment shoud already have a rendered and assigned `.el`
  14047. DayGridEventRenderer.prototype.renderSegRows = function (segs) {
  14048. var rowStructs = [];
  14049. var segRows;
  14050. var row;
  14051. segRows = this.groupSegRows(segs); // group into nested arrays
  14052. // iterate each row of segment groupings
  14053. for (row = 0; row < segRows.length; row++) {
  14054. rowStructs.push(this.renderSegRow(row, segRows[row]));
  14055. }
  14056. return rowStructs;
  14057. };
  14058. // Given a row # and an array of segments all in the same row, render a <tbody> element, a skeleton that contains
  14059. // the segments. Returns object with a bunch of internal data about how the render was calculated.
  14060. // NOTE: modifies rowSegs
  14061. DayGridEventRenderer.prototype.renderSegRow = function (row, rowSegs) {
  14062. var colCnt = this.dayGrid.colCnt;
  14063. var segLevels = this.buildSegLevels(rowSegs); // group into sub-arrays of levels
  14064. var levelCnt = Math.max(1, segLevels.length); // ensure at least one level
  14065. var tbody = $('<tbody/>');
  14066. var segMatrix = []; // lookup for which segments are rendered into which level+col cells
  14067. var cellMatrix = []; // lookup for all <td> elements of the level+col matrix
  14068. var loneCellMatrix = []; // lookup for <td> elements that only take up a single column
  14069. var i;
  14070. var levelSegs;
  14071. var col;
  14072. var tr;
  14073. var j;
  14074. var seg;
  14075. var td;
  14076. // populates empty cells from the current column (`col`) to `endCol`
  14077. function emptyCellsUntil(endCol) {
  14078. while (col < endCol) {
  14079. // try to grab a cell from the level above and extend its rowspan. otherwise, create a fresh cell
  14080. td = (loneCellMatrix[i - 1] || [])[col];
  14081. if (td) {
  14082. td.attr('rowspan', parseInt(td.attr('rowspan') || 1, 10) + 1);
  14083. }
  14084. else {
  14085. td = $('<td/>');
  14086. tr.append(td);
  14087. }
  14088. cellMatrix[i][col] = td;
  14089. loneCellMatrix[i][col] = td;
  14090. col++;
  14091. }
  14092. }
  14093. for (i = 0; i < levelCnt; i++) {
  14094. levelSegs = segLevels[i];
  14095. col = 0;
  14096. tr = $('<tr/>');
  14097. segMatrix.push([]);
  14098. cellMatrix.push([]);
  14099. loneCellMatrix.push([]);
  14100. // levelCnt might be 1 even though there are no actual levels. protect against this.
  14101. // this single empty row is useful for styling.
  14102. if (levelSegs) {
  14103. for (j = 0; j < levelSegs.length; j++) {
  14104. seg = levelSegs[j];
  14105. emptyCellsUntil(seg.leftCol);
  14106. // create a container that occupies or more columns. append the event element.
  14107. td = $('<td class="fc-event-container"/>').append(seg.el);
  14108. if (seg.leftCol !== seg.rightCol) {
  14109. td.attr('colspan', seg.rightCol - seg.leftCol + 1);
  14110. }
  14111. else {
  14112. loneCellMatrix[i][col] = td;
  14113. }
  14114. while (col <= seg.rightCol) {
  14115. cellMatrix[i][col] = td;
  14116. segMatrix[i][col] = seg;
  14117. col++;
  14118. }
  14119. tr.append(td);
  14120. }
  14121. }
  14122. emptyCellsUntil(colCnt); // finish off the row
  14123. this.dayGrid.bookendCells(tr);
  14124. tbody.append(tr);
  14125. }
  14126. return {
  14127. row: row,
  14128. tbodyEl: tbody,
  14129. cellMatrix: cellMatrix,
  14130. segMatrix: segMatrix,
  14131. segLevels: segLevels,
  14132. segs: rowSegs
  14133. };
  14134. };
  14135. // Stacks a flat array of segments, which are all assumed to be in the same row, into subarrays of vertical levels.
  14136. // NOTE: modifies segs
  14137. DayGridEventRenderer.prototype.buildSegLevels = function (segs) {
  14138. var levels = [];
  14139. var i;
  14140. var seg;
  14141. var j;
  14142. // Give preference to elements with certain criteria, so they have
  14143. // a chance to be closer to the top.
  14144. this.sortEventSegs(segs);
  14145. for (i = 0; i < segs.length; i++) {
  14146. seg = segs[i];
  14147. // loop through levels, starting with the topmost, until the segment doesn't collide with other segments
  14148. for (j = 0; j < levels.length; j++) {
  14149. if (!isDaySegCollision(seg, levels[j])) {
  14150. break;
  14151. }
  14152. }
  14153. // `j` now holds the desired subrow index
  14154. seg.level = j;
  14155. // create new level array if needed and append segment
  14156. (levels[j] || (levels[j] = [])).push(seg);
  14157. }
  14158. // order segments left-to-right. very important if calendar is RTL
  14159. for (j = 0; j < levels.length; j++) {
  14160. levels[j].sort(compareDaySegCols);
  14161. }
  14162. return levels;
  14163. };
  14164. // Given a flat array of segments, return an array of sub-arrays, grouped by each segment's row
  14165. DayGridEventRenderer.prototype.groupSegRows = function (segs) {
  14166. var segRows = [];
  14167. var i;
  14168. for (i = 0; i < this.dayGrid.rowCnt; i++) {
  14169. segRows.push([]);
  14170. }
  14171. for (i = 0; i < segs.length; i++) {
  14172. segRows[segs[i].row].push(segs[i]);
  14173. }
  14174. return segRows;
  14175. };
  14176. // Computes a default event time formatting string if `timeFormat` is not explicitly defined
  14177. DayGridEventRenderer.prototype.computeEventTimeFormat = function () {
  14178. return this.opt('extraSmallTimeFormat'); // like "6p" or "6:30p"
  14179. };
  14180. // Computes a default `displayEventEnd` value if one is not expliclty defined
  14181. DayGridEventRenderer.prototype.computeDisplayEventEnd = function () {
  14182. return this.dayGrid.colCnt === 1; // we'll likely have space if there's only one day
  14183. };
  14184. // Builds the HTML to be used for the default element for an individual segment
  14185. DayGridEventRenderer.prototype.fgSegHtml = function (seg, disableResizing) {
  14186. var view = this.view;
  14187. var eventDef = seg.footprint.eventDef;
  14188. var isAllDay = seg.footprint.componentFootprint.isAllDay;
  14189. var isDraggable = view.isEventDefDraggable(eventDef);
  14190. var isResizableFromStart = !disableResizing && isAllDay &&
  14191. seg.isStart && view.isEventDefResizableFromStart(eventDef);
  14192. var isResizableFromEnd = !disableResizing && isAllDay &&
  14193. seg.isEnd && view.isEventDefResizableFromEnd(eventDef);
  14194. var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd);
  14195. var skinCss = util_1.cssToStr(this.getSkinCss(eventDef));
  14196. var timeHtml = '';
  14197. var timeText;
  14198. var titleHtml;
  14199. classes.unshift('fc-day-grid-event', 'fc-h-event');
  14200. // Only display a timed events time if it is the starting segment
  14201. if (seg.isStart) {
  14202. timeText = this.getTimeText(seg.footprint);
  14203. if (timeText) {
  14204. timeHtml = '<span class="fc-time">' + util_1.htmlEscape(timeText) + '</span>';
  14205. }
  14206. }
  14207. titleHtml =
  14208. '<span class="fc-title">' +
  14209. (util_1.htmlEscape(eventDef.title || '') || '&nbsp;') + // we always want one line of height
  14210. '</span>';
  14211. return '<a class="' + classes.join(' ') + '"' +
  14212. (eventDef.url ?
  14213. ' href="' + util_1.htmlEscape(eventDef.url) + '"' :
  14214. '') +
  14215. (skinCss ?
  14216. ' style="' + skinCss + '"' :
  14217. '') +
  14218. '>' +
  14219. '<div class="fc-content">' +
  14220. (this.dayGrid.isRTL ?
  14221. titleHtml + ' ' + timeHtml : // put a natural space in between
  14222. timeHtml + ' ' + titleHtml //
  14223. ) +
  14224. '</div>' +
  14225. (isResizableFromStart ?
  14226. '<div class="fc-resizer fc-start-resizer" />' :
  14227. '') +
  14228. (isResizableFromEnd ?
  14229. '<div class="fc-resizer fc-end-resizer" />' :
  14230. '') +
  14231. '</a>';
  14232. };
  14233. return DayGridEventRenderer;
  14234. }(EventRenderer_1.default));
  14235. exports.default = DayGridEventRenderer;
  14236. // Computes whether two segments' columns collide. They are assumed to be in the same row.
  14237. function isDaySegCollision(seg, otherSegs) {
  14238. var i;
  14239. var otherSeg;
  14240. for (i = 0; i < otherSegs.length; i++) {
  14241. otherSeg = otherSegs[i];
  14242. if (otherSeg.leftCol <= seg.rightCol &&
  14243. otherSeg.rightCol >= seg.leftCol) {
  14244. return true;
  14245. }
  14246. }
  14247. return false;
  14248. }
  14249. // A cmp function for determining the leftmost event
  14250. function compareDaySegCols(a, b) {
  14251. return a.leftCol - b.leftCol;
  14252. }
  14253. /***/ }),
  14254. /* 251 */
  14255. /***/ (function(module, exports, __webpack_require__) {
  14256. Object.defineProperty(exports, "__esModule", { value: true });
  14257. var tslib_1 = __webpack_require__(2);
  14258. var $ = __webpack_require__(3);
  14259. var HelperRenderer_1 = __webpack_require__(58);
  14260. var DayGridHelperRenderer = /** @class */ (function (_super) {
  14261. tslib_1.__extends(DayGridHelperRenderer, _super);
  14262. function DayGridHelperRenderer() {
  14263. return _super !== null && _super.apply(this, arguments) || this;
  14264. }
  14265. // Renders a mock "helper" event. `sourceSeg` is the associated internal segment object. It can be null.
  14266. DayGridHelperRenderer.prototype.renderSegs = function (segs, sourceSeg) {
  14267. var helperNodes = [];
  14268. var rowStructs;
  14269. // TODO: not good to call eventRenderer this way
  14270. rowStructs = this.eventRenderer.renderSegRows(segs);
  14271. // inject each new event skeleton into each associated row
  14272. this.component.rowEls.each(function (row, rowNode) {
  14273. var rowEl = $(rowNode); // the .fc-row
  14274. var skeletonEl = $('<div class="fc-helper-skeleton"><table/></div>'); // will be absolutely positioned
  14275. var skeletonTopEl;
  14276. var skeletonTop;
  14277. // If there is an original segment, match the top position. Otherwise, put it at the row's top level
  14278. if (sourceSeg && sourceSeg.row === row) {
  14279. skeletonTop = sourceSeg.el.position().top;
  14280. }
  14281. else {
  14282. skeletonTopEl = rowEl.find('.fc-content-skeleton tbody');
  14283. if (!skeletonTopEl.length) {
  14284. skeletonTopEl = rowEl.find('.fc-content-skeleton table');
  14285. }
  14286. skeletonTop = skeletonTopEl.position().top;
  14287. }
  14288. skeletonEl.css('top', skeletonTop)
  14289. .find('table')
  14290. .append(rowStructs[row].tbodyEl);
  14291. rowEl.append(skeletonEl);
  14292. helperNodes.push(skeletonEl[0]);
  14293. });
  14294. return $(helperNodes); // must return the elements rendered
  14295. };
  14296. return DayGridHelperRenderer;
  14297. }(HelperRenderer_1.default));
  14298. exports.default = DayGridHelperRenderer;
  14299. /***/ }),
  14300. /* 252 */
  14301. /***/ (function(module, exports, __webpack_require__) {
  14302. Object.defineProperty(exports, "__esModule", { value: true });
  14303. var tslib_1 = __webpack_require__(2);
  14304. var $ = __webpack_require__(3);
  14305. var FillRenderer_1 = __webpack_require__(57);
  14306. var DayGridFillRenderer = /** @class */ (function (_super) {
  14307. tslib_1.__extends(DayGridFillRenderer, _super);
  14308. function DayGridFillRenderer() {
  14309. var _this = _super !== null && _super.apply(this, arguments) || this;
  14310. _this.fillSegTag = 'td'; // override the default tag name
  14311. return _this;
  14312. }
  14313. DayGridFillRenderer.prototype.attachSegEls = function (type, segs) {
  14314. var nodes = [];
  14315. var i;
  14316. var seg;
  14317. var skeletonEl;
  14318. for (i = 0; i < segs.length; i++) {
  14319. seg = segs[i];
  14320. skeletonEl = this.renderFillRow(type, seg);
  14321. this.component.rowEls.eq(seg.row).append(skeletonEl);
  14322. nodes.push(skeletonEl[0]);
  14323. }
  14324. return nodes;
  14325. };
  14326. // Generates the HTML needed for one row of a fill. Requires the seg's el to be rendered.
  14327. DayGridFillRenderer.prototype.renderFillRow = function (type, seg) {
  14328. var colCnt = this.component.colCnt;
  14329. var startCol = seg.leftCol;
  14330. var endCol = seg.rightCol + 1;
  14331. var className;
  14332. var skeletonEl;
  14333. var trEl;
  14334. if (type === 'businessHours') {
  14335. className = 'bgevent';
  14336. }
  14337. else {
  14338. className = type.toLowerCase();
  14339. }
  14340. skeletonEl = $('<div class="fc-' + className + '-skeleton">' +
  14341. '<table><tr/></table>' +
  14342. '</div>');
  14343. trEl = skeletonEl.find('tr');
  14344. if (startCol > 0) {
  14345. trEl.append('<td colspan="' + startCol + '"/>');
  14346. }
  14347. trEl.append(seg.el.attr('colspan', endCol - startCol));
  14348. if (endCol < colCnt) {
  14349. trEl.append('<td colspan="' + (colCnt - endCol) + '"/>');
  14350. }
  14351. this.component.bookendCells(trEl);
  14352. return skeletonEl;
  14353. };
  14354. return DayGridFillRenderer;
  14355. }(FillRenderer_1.default));
  14356. exports.default = DayGridFillRenderer;
  14357. /***/ }),
  14358. /* 253 */
  14359. /***/ (function(module, exports, __webpack_require__) {
  14360. Object.defineProperty(exports, "__esModule", { value: true });
  14361. var tslib_1 = __webpack_require__(2);
  14362. var BasicViewDateProfileGenerator_1 = __webpack_require__(228);
  14363. var UnzonedRange_1 = __webpack_require__(5);
  14364. var MonthViewDateProfileGenerator = /** @class */ (function (_super) {
  14365. tslib_1.__extends(MonthViewDateProfileGenerator, _super);
  14366. function MonthViewDateProfileGenerator() {
  14367. return _super !== null && _super.apply(this, arguments) || this;
  14368. }
  14369. // Computes the date range that will be rendered.
  14370. MonthViewDateProfileGenerator.prototype.buildRenderRange = function (currentUnzonedRange, currentRangeUnit, isRangeAllDay) {
  14371. var renderUnzonedRange = _super.prototype.buildRenderRange.call(this, currentUnzonedRange, currentRangeUnit, isRangeAllDay);
  14372. var start = this.msToUtcMoment(renderUnzonedRange.startMs, isRangeAllDay);
  14373. var end = this.msToUtcMoment(renderUnzonedRange.endMs, isRangeAllDay);
  14374. var rowCnt;
  14375. // ensure 6 weeks
  14376. if (this.opt('fixedWeekCount')) {
  14377. rowCnt = Math.ceil(// could be partial weeks due to hiddenDays
  14378. end.diff(start, 'weeks', true) // dontRound=true
  14379. );
  14380. end.add(6 - rowCnt, 'weeks');
  14381. }
  14382. return new UnzonedRange_1.default(start, end);
  14383. };
  14384. return MonthViewDateProfileGenerator;
  14385. }(BasicViewDateProfileGenerator_1.default));
  14386. exports.default = MonthViewDateProfileGenerator;
  14387. /***/ }),
  14388. /* 254 */
  14389. /***/ (function(module, exports, __webpack_require__) {
  14390. Object.defineProperty(exports, "__esModule", { value: true });
  14391. var tslib_1 = __webpack_require__(2);
  14392. var util_1 = __webpack_require__(4);
  14393. var EventRenderer_1 = __webpack_require__(42);
  14394. var ListEventRenderer = /** @class */ (function (_super) {
  14395. tslib_1.__extends(ListEventRenderer, _super);
  14396. function ListEventRenderer() {
  14397. return _super !== null && _super.apply(this, arguments) || this;
  14398. }
  14399. ListEventRenderer.prototype.renderFgSegs = function (segs) {
  14400. if (!segs.length) {
  14401. this.component.renderEmptyMessage();
  14402. }
  14403. else {
  14404. this.component.renderSegList(segs);
  14405. }
  14406. };
  14407. // generates the HTML for a single event row
  14408. ListEventRenderer.prototype.fgSegHtml = function (seg) {
  14409. var view = this.view;
  14410. var calendar = view.calendar;
  14411. var theme = calendar.theme;
  14412. var eventFootprint = seg.footprint;
  14413. var eventDef = eventFootprint.eventDef;
  14414. var componentFootprint = eventFootprint.componentFootprint;
  14415. var url = eventDef.url;
  14416. var classes = ['fc-list-item'].concat(this.getClasses(eventDef));
  14417. var bgColor = this.getBgColor(eventDef);
  14418. var timeHtml;
  14419. if (componentFootprint.isAllDay) {
  14420. timeHtml = view.getAllDayHtml();
  14421. }
  14422. else if (view.isMultiDayRange(componentFootprint.unzonedRange)) {
  14423. if (seg.isStart || seg.isEnd) {
  14424. timeHtml = util_1.htmlEscape(this._getTimeText(calendar.msToMoment(seg.startMs), calendar.msToMoment(seg.endMs), componentFootprint.isAllDay));
  14425. }
  14426. else {
  14427. timeHtml = view.getAllDayHtml();
  14428. }
  14429. }
  14430. else {
  14431. // Display the normal time text for the *event's* times
  14432. timeHtml = util_1.htmlEscape(this.getTimeText(eventFootprint));
  14433. }
  14434. if (url) {
  14435. classes.push('fc-has-url');
  14436. }
  14437. return '<tr class="' + classes.join(' ') + '">' +
  14438. (this.displayEventTime ?
  14439. '<td class="fc-list-item-time ' + theme.getClass('widgetContent') + '">' +
  14440. (timeHtml || '') +
  14441. '</td>' :
  14442. '') +
  14443. '<td class="fc-list-item-marker ' + theme.getClass('widgetContent') + '">' +
  14444. '<span class="fc-event-dot"' +
  14445. (bgColor ?
  14446. ' style="background-color:' + bgColor + '"' :
  14447. '') +
  14448. '></span>' +
  14449. '</td>' +
  14450. '<td class="fc-list-item-title ' + theme.getClass('widgetContent') + '">' +
  14451. '<a' + (url ? ' href="' + util_1.htmlEscape(url) + '"' : '') + '>' +
  14452. util_1.htmlEscape(eventDef.title || '') +
  14453. '</a>' +
  14454. '</td>' +
  14455. '</tr>';
  14456. };
  14457. // like "4:00am"
  14458. ListEventRenderer.prototype.computeEventTimeFormat = function () {
  14459. return this.opt('mediumTimeFormat');
  14460. };
  14461. return ListEventRenderer;
  14462. }(EventRenderer_1.default));
  14463. exports.default = ListEventRenderer;
  14464. /***/ }),
  14465. /* 255 */
  14466. /***/ (function(module, exports, __webpack_require__) {
  14467. Object.defineProperty(exports, "__esModule", { value: true });
  14468. var tslib_1 = __webpack_require__(2);
  14469. var $ = __webpack_require__(3);
  14470. var EventPointing_1 = __webpack_require__(59);
  14471. var ListEventPointing = /** @class */ (function (_super) {
  14472. tslib_1.__extends(ListEventPointing, _super);
  14473. function ListEventPointing() {
  14474. return _super !== null && _super.apply(this, arguments) || this;
  14475. }
  14476. // for events with a url, the whole <tr> should be clickable,
  14477. // but it's impossible to wrap with an <a> tag. simulate this.
  14478. ListEventPointing.prototype.handleClick = function (seg, ev) {
  14479. var url;
  14480. _super.prototype.handleClick.call(this, seg, ev); // might prevent the default action
  14481. // not clicking on or within an <a> with an href
  14482. if (!$(ev.target).closest('a[href]').length) {
  14483. url = seg.footprint.eventDef.url;
  14484. if (url && !ev.isDefaultPrevented()) {
  14485. window.location.href = url; // simulate link click
  14486. }
  14487. }
  14488. };
  14489. return ListEventPointing;
  14490. }(EventPointing_1.default));
  14491. exports.default = ListEventPointing;
  14492. /***/ }),
  14493. /* 256 */
  14494. /***/ (function(module, exports, __webpack_require__) {
  14495. Object.defineProperty(exports, "__esModule", { value: true });
  14496. var EventSourceParser_1 = __webpack_require__(38);
  14497. var ArrayEventSource_1 = __webpack_require__(52);
  14498. var FuncEventSource_1 = __webpack_require__(215);
  14499. var JsonFeedEventSource_1 = __webpack_require__(216);
  14500. EventSourceParser_1.default.registerClass(ArrayEventSource_1.default);
  14501. EventSourceParser_1.default.registerClass(FuncEventSource_1.default);
  14502. EventSourceParser_1.default.registerClass(JsonFeedEventSource_1.default);
  14503. /***/ }),
  14504. /* 257 */
  14505. /***/ (function(module, exports, __webpack_require__) {
  14506. Object.defineProperty(exports, "__esModule", { value: true });
  14507. var ThemeRegistry_1 = __webpack_require__(51);
  14508. var StandardTheme_1 = __webpack_require__(213);
  14509. var JqueryUiTheme_1 = __webpack_require__(214);
  14510. var Bootstrap3Theme_1 = __webpack_require__(258);
  14511. var Bootstrap4Theme_1 = __webpack_require__(259);
  14512. ThemeRegistry_1.defineThemeSystem('standard', StandardTheme_1.default);
  14513. ThemeRegistry_1.defineThemeSystem('jquery-ui', JqueryUiTheme_1.default);
  14514. ThemeRegistry_1.defineThemeSystem('bootstrap3', Bootstrap3Theme_1.default);
  14515. ThemeRegistry_1.defineThemeSystem('bootstrap4', Bootstrap4Theme_1.default);
  14516. /***/ }),
  14517. /* 258 */
  14518. /***/ (function(module, exports, __webpack_require__) {
  14519. Object.defineProperty(exports, "__esModule", { value: true });
  14520. var tslib_1 = __webpack_require__(2);
  14521. var Theme_1 = __webpack_require__(19);
  14522. var Bootstrap3Theme = /** @class */ (function (_super) {
  14523. tslib_1.__extends(Bootstrap3Theme, _super);
  14524. function Bootstrap3Theme() {
  14525. return _super !== null && _super.apply(this, arguments) || this;
  14526. }
  14527. return Bootstrap3Theme;
  14528. }(Theme_1.default));
  14529. exports.default = Bootstrap3Theme;
  14530. Bootstrap3Theme.prototype.classes = {
  14531. widget: 'fc-bootstrap3',
  14532. tableGrid: 'table-bordered',
  14533. tableList: 'table',
  14534. tableListHeading: 'active',
  14535. buttonGroup: 'btn-group',
  14536. button: 'btn btn-default',
  14537. stateActive: 'active',
  14538. stateDisabled: 'disabled',
  14539. today: 'alert alert-info',
  14540. popover: 'panel panel-default',
  14541. popoverHeader: 'panel-heading',
  14542. popoverContent: 'panel-body',
  14543. // day grid
  14544. // for left/right border color when border is inset from edges (all-day in agenda view)
  14545. // avoid `panel` class b/c don't want margins/radius. only border color.
  14546. headerRow: 'panel-default',
  14547. dayRow: 'panel-default',
  14548. // list view
  14549. listView: 'panel panel-default'
  14550. };
  14551. Bootstrap3Theme.prototype.baseIconClass = 'glyphicon';
  14552. Bootstrap3Theme.prototype.iconClasses = {
  14553. close: 'glyphicon-remove',
  14554. prev: 'glyphicon-chevron-left',
  14555. next: 'glyphicon-chevron-right',
  14556. prevYear: 'glyphicon-backward',
  14557. nextYear: 'glyphicon-forward'
  14558. };
  14559. Bootstrap3Theme.prototype.iconOverrideOption = 'bootstrapGlyphicons';
  14560. Bootstrap3Theme.prototype.iconOverrideCustomButtonOption = 'bootstrapGlyphicon';
  14561. Bootstrap3Theme.prototype.iconOverridePrefix = 'glyphicon-';
  14562. /***/ }),
  14563. /* 259 */
  14564. /***/ (function(module, exports, __webpack_require__) {
  14565. Object.defineProperty(exports, "__esModule", { value: true });
  14566. var tslib_1 = __webpack_require__(2);
  14567. var Theme_1 = __webpack_require__(19);
  14568. var Bootstrap4Theme = /** @class */ (function (_super) {
  14569. tslib_1.__extends(Bootstrap4Theme, _super);
  14570. function Bootstrap4Theme() {
  14571. return _super !== null && _super.apply(this, arguments) || this;
  14572. }
  14573. return Bootstrap4Theme;
  14574. }(Theme_1.default));
  14575. exports.default = Bootstrap4Theme;
  14576. Bootstrap4Theme.prototype.classes = {
  14577. widget: 'fc-bootstrap4',
  14578. tableGrid: 'table-bordered',
  14579. tableList: 'table',
  14580. tableListHeading: 'table-active',
  14581. buttonGroup: 'btn-group',
  14582. button: 'btn btn-primary',
  14583. stateActive: 'active',
  14584. stateDisabled: 'disabled',
  14585. today: 'alert alert-info',
  14586. popover: 'card card-primary',
  14587. popoverHeader: 'card-header',
  14588. popoverContent: 'card-body',
  14589. // day grid
  14590. // for left/right border color when border is inset from edges (all-day in agenda view)
  14591. // avoid `table` class b/c don't want margins/padding/structure. only border color.
  14592. headerRow: 'table-bordered',
  14593. dayRow: 'table-bordered',
  14594. // list view
  14595. listView: 'card card-primary'
  14596. };
  14597. Bootstrap4Theme.prototype.baseIconClass = 'fa';
  14598. Bootstrap4Theme.prototype.iconClasses = {
  14599. close: 'fa-times',
  14600. prev: 'fa-chevron-left',
  14601. next: 'fa-chevron-right',
  14602. prevYear: 'fa-angle-double-left',
  14603. nextYear: 'fa-angle-double-right'
  14604. };
  14605. Bootstrap4Theme.prototype.iconOverrideOption = 'bootstrapFontAwesome';
  14606. Bootstrap4Theme.prototype.iconOverrideCustomButtonOption = 'bootstrapFontAwesome';
  14607. Bootstrap4Theme.prototype.iconOverridePrefix = 'fa-';
  14608. /***/ }),
  14609. /* 260 */
  14610. /***/ (function(module, exports, __webpack_require__) {
  14611. Object.defineProperty(exports, "__esModule", { value: true });
  14612. var ViewRegistry_1 = __webpack_require__(22);
  14613. var BasicView_1 = __webpack_require__(62);
  14614. var MonthView_1 = __webpack_require__(229);
  14615. ViewRegistry_1.defineView('basic', {
  14616. 'class': BasicView_1.default
  14617. });
  14618. ViewRegistry_1.defineView('basicDay', {
  14619. type: 'basic',
  14620. duration: { days: 1 }
  14621. });
  14622. ViewRegistry_1.defineView('basicWeek', {
  14623. type: 'basic',
  14624. duration: { weeks: 1 }
  14625. });
  14626. ViewRegistry_1.defineView('month', {
  14627. 'class': MonthView_1.default,
  14628. duration: { months: 1 },
  14629. defaults: {
  14630. fixedWeekCount: true
  14631. }
  14632. });
  14633. /***/ }),
  14634. /* 261 */
  14635. /***/ (function(module, exports, __webpack_require__) {
  14636. Object.defineProperty(exports, "__esModule", { value: true });
  14637. var ViewRegistry_1 = __webpack_require__(22);
  14638. var AgendaView_1 = __webpack_require__(226);
  14639. ViewRegistry_1.defineView('agenda', {
  14640. 'class': AgendaView_1.default,
  14641. defaults: {
  14642. allDaySlot: true,
  14643. slotDuration: '00:30:00',
  14644. slotEventOverlap: true // a bad name. confused with overlap/constraint system
  14645. }
  14646. });
  14647. ViewRegistry_1.defineView('agendaDay', {
  14648. type: 'agenda',
  14649. duration: { days: 1 }
  14650. });
  14651. ViewRegistry_1.defineView('agendaWeek', {
  14652. type: 'agenda',
  14653. duration: { weeks: 1 }
  14654. });
  14655. /***/ }),
  14656. /* 262 */
  14657. /***/ (function(module, exports, __webpack_require__) {
  14658. Object.defineProperty(exports, "__esModule", { value: true });
  14659. var ViewRegistry_1 = __webpack_require__(22);
  14660. var ListView_1 = __webpack_require__(230);
  14661. ViewRegistry_1.defineView('list', {
  14662. 'class': ListView_1.default,
  14663. buttonTextKey: 'list',
  14664. defaults: {
  14665. buttonText: 'list',
  14666. listDayFormat: 'LL',
  14667. noEventsMessage: 'No events to display'
  14668. }
  14669. });
  14670. ViewRegistry_1.defineView('listDay', {
  14671. type: 'list',
  14672. duration: { days: 1 },
  14673. defaults: {
  14674. listDayFormat: 'dddd' // day-of-week is all we need. full date is probably in header
  14675. }
  14676. });
  14677. ViewRegistry_1.defineView('listWeek', {
  14678. type: 'list',
  14679. duration: { weeks: 1 },
  14680. defaults: {
  14681. listDayFormat: 'dddd',
  14682. listDayAltFormat: 'LL'
  14683. }
  14684. });
  14685. ViewRegistry_1.defineView('listMonth', {
  14686. type: 'list',
  14687. duration: { month: 1 },
  14688. defaults: {
  14689. listDayAltFormat: 'dddd' // day-of-week is nice-to-have
  14690. }
  14691. });
  14692. ViewRegistry_1.defineView('listYear', {
  14693. type: 'list',
  14694. duration: { year: 1 },
  14695. defaults: {
  14696. listDayAltFormat: 'dddd' // day-of-week is nice-to-have
  14697. }
  14698. });
  14699. /***/ }),
  14700. /* 263 */
  14701. /***/ (function(module, exports) {
  14702. Object.defineProperty(exports, "__esModule", { value: true });
  14703. /***/ })
  14704. /******/ ]);
  14705. });