scheduler.js 258 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338
  1. /*!
  2. * FullCalendar Scheduler v1.9.4
  3. * Docs & License: https://fullcalendar.io/scheduler/
  4. * (c) 2018 Adam Shaw
  5. */
  6. (function webpackUniversalModuleDefinition(root, factory) {
  7. if(typeof exports === 'object' && typeof module === 'object')
  8. module.exports = factory(require("fullcalendar"), require("jquery"), require("moment"));
  9. else if(typeof define === 'function' && define.amd)
  10. define(["fullcalendar", "jquery", "moment"], factory);
  11. else {
  12. var a = typeof exports === 'object' ? factory(require("fullcalendar"), require("jquery"), require("moment")) : factory(root["FullCalendar"], root["jQuery"], root["moment"]);
  13. for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
  14. }
  15. })(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_0__, __WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_15__) {
  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 = 36);
  79. /******/ })
  80. /************************************************************************/
  81. /******/ ([
  82. /* 0 */
  83. /***/ (function(module, exports) {
  84. module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
  85. /***/ }),
  86. /* 1 */
  87. /***/ (function(module, exports) {
  88. /*
  89. derived from:
  90. https://github.com/Microsoft/tslib/blob/v1.6.0/tslib.js
  91. only include the helpers we need, to keep down filesize
  92. */
  93. var extendStatics = Object.setPrototypeOf ||
  94. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  95. function (d, b) { for (var p in b)
  96. if (b.hasOwnProperty(p))
  97. d[p] = b[p]; };
  98. exports.__extends = function (d, b) {
  99. extendStatics(d, b);
  100. function __() { this.constructor = d; }
  101. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  102. };
  103. /***/ }),
  104. /* 2 */
  105. /***/ (function(module, exports) {
  106. module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
  107. /***/ }),
  108. /* 3 */,
  109. /* 4 */,
  110. /* 5 */,
  111. /* 6 */
  112. /***/ (function(module, exports, __webpack_require__) {
  113. Object.defineProperty(exports, "__esModule", { value: true });
  114. var tslib_1 = __webpack_require__(1);
  115. var fullcalendar_1 = __webpack_require__(0);
  116. var ResourceComponentFootprint = /** @class */ (function (_super) {
  117. tslib_1.__extends(ResourceComponentFootprint, _super);
  118. function ResourceComponentFootprint(unzonedRange, isAllDay, resourceId) {
  119. var _this = _super.call(this, unzonedRange, isAllDay) || this;
  120. _this.resourceId = resourceId;
  121. return _this;
  122. }
  123. ResourceComponentFootprint.prototype.toLegacy = function (calendar) {
  124. var obj = _super.prototype.toLegacy.call(this, calendar);
  125. obj.resourceId = this.resourceId;
  126. return obj;
  127. };
  128. return ResourceComponentFootprint;
  129. }(fullcalendar_1.ComponentFootprint));
  130. exports.default = ResourceComponentFootprint;
  131. /***/ }),
  132. /* 7 */,
  133. /* 8 */,
  134. /* 9 */
  135. /***/ (function(module, exports, __webpack_require__) {
  136. Object.defineProperty(exports, "__esModule", { value: true });
  137. var tslib_1 = __webpack_require__(1);
  138. var $ = __webpack_require__(2);
  139. var fullcalendar_1 = __webpack_require__(0);
  140. var ResourceViewMixin = /** @class */ (function (_super) {
  141. tslib_1.__extends(ResourceViewMixin, _super);
  142. function ResourceViewMixin() {
  143. return _super !== null && _super.apply(this, arguments) || this;
  144. }
  145. ResourceViewMixin.mixInto = function (destClass) {
  146. var _this = this;
  147. fullcalendar_1.Mixin.mixInto.call(this, destClass);
  148. [
  149. 'bindBaseRenderHandlers',
  150. 'queryScroll',
  151. 'applyScroll',
  152. 'triggerDayClick',
  153. 'triggerSelect',
  154. 'triggerExternalDrop',
  155. 'handleResourceAdd',
  156. 'handleResourceRemove'
  157. ].forEach(function (methodName) {
  158. destClass.prototype[methodName] = _this.prototype[methodName];
  159. });
  160. };
  161. ResourceViewMixin.prototype.initResourceView = function () {
  162. var _this = this;
  163. // new task
  164. var resourceDeps = ['hasResources'];
  165. if (!this.canHandleSpecificResources) {
  166. resourceDeps.push('displayingDates');
  167. }
  168. this.watch('displayingResources', resourceDeps, function () {
  169. _this.requestResourcesRender(_this.get('currentResources'));
  170. }, function () {
  171. _this.requestResourcesUnrender();
  172. });
  173. // start relying on displayingResources
  174. this.watch('displayingBusinessHours', [
  175. 'businessHourGenerator',
  176. 'displayingResources',
  177. 'displayingDates'
  178. ], function (deps) {
  179. _this.requestBusinessHoursRender(deps.businessHourGenerator);
  180. }, function () {
  181. _this.requestBusinessHoursUnrender();
  182. });
  183. // start relying on resource displaying rather than just current resources
  184. this.watch('displayingEvents', ['displayingResources', 'hasEvents'], function () {
  185. _this.requestEventsRender(_this.get('currentEvents'));
  186. }, function () {
  187. _this.requestEventsUnrender();
  188. });
  189. };
  190. // Logic: base render trigger should fire when BOTH the resources and dates have rendered,
  191. // but the unrender trigger should fire after ONLY the dates are about to be unrendered.
  192. ResourceViewMixin.prototype.bindBaseRenderHandlers = function () {
  193. var isResourcesRendered = false;
  194. var isDatesRendered = false;
  195. this.on('resourcesRendered', function () {
  196. if (!isResourcesRendered) {
  197. isResourcesRendered = true;
  198. if (isDatesRendered) {
  199. this.whenSizeUpdated(this.triggerViewRender);
  200. }
  201. }
  202. });
  203. this.on('datesRendered', function () {
  204. if (!isDatesRendered) {
  205. isDatesRendered = true;
  206. if (isResourcesRendered) {
  207. this.whenSizeUpdated(this.triggerViewRender);
  208. }
  209. }
  210. });
  211. this.on('before:resourcesUnrendered', function () {
  212. if (isResourcesRendered) {
  213. isResourcesRendered = false;
  214. }
  215. });
  216. this.on('before:datesUnrendered', function () {
  217. if (isDatesRendered) {
  218. isDatesRendered = false;
  219. this.triggerViewDestroy();
  220. }
  221. });
  222. };
  223. // Scroll
  224. // ----------------------------------------------------------------------------------------------
  225. ResourceViewMixin.prototype.queryScroll = function () {
  226. var scroll = fullcalendar_1.View.prototype.queryScroll.apply(this, arguments);
  227. if (this.isResourcesRendered) {
  228. $.extend(scroll, this.queryResourceScroll());
  229. }
  230. return scroll;
  231. };
  232. ResourceViewMixin.prototype.applyScroll = function (scroll) {
  233. fullcalendar_1.View.prototype.applyScroll.apply(this, arguments);
  234. if (this.isResourcesRendered) {
  235. this.applyResourceScroll(scroll);
  236. }
  237. };
  238. ResourceViewMixin.prototype.queryResourceScroll = function () {
  239. return {}; // subclasses must implement
  240. };
  241. ResourceViewMixin.prototype.applyResourceScroll = function () {
  242. // subclasses must implement
  243. };
  244. // Rendering Utils
  245. // ----------------------------------------------------------------------------------------------
  246. ResourceViewMixin.prototype.getResourceText = function (resource) {
  247. return this.getResourceTextFunc()(resource);
  248. };
  249. ResourceViewMixin.prototype.getResourceTextFunc = function () {
  250. if (this.resourceTextFunc) {
  251. return this.resourceTextFunc;
  252. }
  253. else {
  254. var func = this.opt('resourceText');
  255. if (typeof func !== 'function') {
  256. func = function (resource) { return resource.title || resource.id; };
  257. }
  258. this.resourceTextFunc = func;
  259. return func;
  260. }
  261. };
  262. // Resource Change Handling
  263. // ----------------------------------------------------------------------------------------------
  264. ResourceViewMixin.prototype.handleResourceAdd = function (resource) {
  265. this.requestResourceRender(resource);
  266. };
  267. ResourceViewMixin.prototype.handleResourceRemove = function (resource) {
  268. this.requestResourceUnrender(resource);
  269. };
  270. // Resource Rendering
  271. // ----------------------------------------------------------------------------------------------
  272. ResourceViewMixin.prototype.requestResourcesRender = function (resources) {
  273. var _this = this;
  274. this.requestRender(function () {
  275. _this.executeResourcesRender(resources);
  276. }, 'resource', 'init');
  277. };
  278. ResourceViewMixin.prototype.requestResourcesUnrender = function () {
  279. var _this = this;
  280. this.requestRender(function () {
  281. _this.executeResourcesUnrender();
  282. }, 'resource', 'destroy');
  283. };
  284. ResourceViewMixin.prototype.requestResourceRender = function (resource) {
  285. var _this = this;
  286. this.requestRender(function () {
  287. _this.executeResourceRender(resource);
  288. }, 'resource', 'add');
  289. };
  290. ResourceViewMixin.prototype.requestResourceUnrender = function (resource) {
  291. var _this = this;
  292. this.requestRender(function () {
  293. _this.executeResourceUnrender(resource);
  294. }, 'resource', 'remove');
  295. };
  296. // Resource High-level Rendering/Unrendering
  297. // ----------------------------------------------------------------------------------------------
  298. ResourceViewMixin.prototype.executeResourcesRender = function (resources) {
  299. this.renderResources(resources);
  300. this.isResourcesRendered = true;
  301. this.trigger('resourcesRendered');
  302. };
  303. ResourceViewMixin.prototype.executeResourcesUnrender = function () {
  304. this.trigger('before:resourcesUnrendered');
  305. this.unrenderResources();
  306. this.isResourcesRendered = false;
  307. };
  308. ResourceViewMixin.prototype.executeResourceRender = function (resource) {
  309. this.renderResource(resource);
  310. };
  311. ResourceViewMixin.prototype.executeResourceUnrender = function (resource) {
  312. this.unrenderResource(resource);
  313. };
  314. // Triggering
  315. // ----------------------------------------------------------------------------------------------
  316. /*
  317. footprint is a ResourceComponentFootprint
  318. */
  319. ResourceViewMixin.prototype.triggerDayClick = function (footprint, dayEl, ev) {
  320. var dateProfile = this.calendar.footprintToDateProfile(footprint);
  321. this.publiclyTrigger('dayClick', {
  322. context: dayEl,
  323. args: [
  324. dateProfile.start,
  325. ev,
  326. this,
  327. footprint.resourceId ?
  328. this.calendar.resourceManager.getResourceById(footprint.resourceId) :
  329. null
  330. ]
  331. });
  332. };
  333. /*
  334. footprint is a ResourceComponentFootprint
  335. */
  336. ResourceViewMixin.prototype.triggerSelect = function (footprint, ev) {
  337. var dateProfile = this.calendar.footprintToDateProfile(footprint);
  338. this.publiclyTrigger('select', {
  339. context: this,
  340. args: [
  341. dateProfile.start,
  342. dateProfile.end,
  343. ev,
  344. this,
  345. footprint.resourceId ?
  346. this.calendar.resourceManager.getResourceById(footprint.resourceId) :
  347. null
  348. ]
  349. });
  350. };
  351. // override the view's default trigger in order to provide a resourceId to the `drop` event
  352. // TODO: make more DRY with core
  353. ResourceViewMixin.prototype.triggerExternalDrop = function (singleEventDef, isEvent, el, ev, ui) {
  354. // trigger 'drop' regardless of whether element represents an event
  355. this.publiclyTrigger('drop', {
  356. context: el[0],
  357. args: [
  358. singleEventDef.dateProfile.start.clone(),
  359. ev,
  360. ui,
  361. singleEventDef.getResourceIds()[0],
  362. this
  363. ]
  364. });
  365. if (isEvent) {
  366. // signal an external event landed
  367. this.publiclyTrigger('eventReceive', {
  368. context: this,
  369. args: [
  370. singleEventDef.buildInstance().toLegacy(),
  371. this
  372. ]
  373. });
  374. }
  375. };
  376. return ResourceViewMixin;
  377. }(fullcalendar_1.Mixin));
  378. exports.default = ResourceViewMixin;
  379. ResourceViewMixin.prototype.isResourcesRendered = false;
  380. /***/ }),
  381. /* 10 */,
  382. /* 11 */,
  383. /* 12 */,
  384. /* 13 */
  385. /***/ (function(module, exports, __webpack_require__) {
  386. Object.defineProperty(exports, "__esModule", { value: true });
  387. var tslib_1 = __webpack_require__(1);
  388. var $ = __webpack_require__(2);
  389. var fullcalendar_1 = __webpack_require__(0);
  390. var ResourceDayTableMixin_1 = __webpack_require__(21);
  391. var ResourceComponentFootprint_1 = __webpack_require__(6);
  392. var ResourceDayGrid = /** @class */ (function (_super) {
  393. tslib_1.__extends(ResourceDayGrid, _super);
  394. function ResourceDayGrid(view) {
  395. var _this = _super.call(this, view) || this;
  396. _this.isResourceFootprintsEnabled = true;
  397. return _this;
  398. }
  399. ResourceDayGrid.prototype.renderDates = function (dateProfile) {
  400. this.dateProfile = dateProfile;
  401. };
  402. ResourceDayGrid.prototype.renderResources = function (resources) {
  403. this.registerResources(resources);
  404. this.renderGrid();
  405. if (this.headContainerEl) {
  406. this.processHeadResourceEls(this.headContainerEl);
  407. }
  408. };
  409. // TODO: make DRY with ResourceTimeGrid
  410. ResourceDayGrid.prototype.getHitFootprint = function (hit) {
  411. var plainFootprint = _super.prototype.getHitFootprint.call(this, hit);
  412. return new ResourceComponentFootprint_1.default(plainFootprint.unzonedRange, plainFootprint.isAllDay, this.getColResource(hit.col).id);
  413. };
  414. ResourceDayGrid.prototype.componentFootprintToSegs = function (componentFootprint) {
  415. var resourceCnt = this.resourceCnt;
  416. var genericSegs = // no assigned resources
  417. this.datesAboveResources ?
  418. this.sliceRangeByDay(componentFootprint.unzonedRange) : // each day-per-resource will need its own column
  419. this.sliceRangeByRow(componentFootprint.unzonedRange);
  420. var resourceSegs = [];
  421. for (var _i = 0, genericSegs_1 = genericSegs; _i < genericSegs_1.length; _i++) {
  422. var seg = genericSegs_1[_i];
  423. for (var resourceIndex = 0; resourceIndex < resourceCnt; resourceIndex++) {
  424. var resourceObj = this.flattenedResources[resourceIndex];
  425. if (!(componentFootprint instanceof ResourceComponentFootprint_1.default) ||
  426. (componentFootprint.resourceId === resourceObj.id)) {
  427. var copy = $.extend({}, seg);
  428. copy.resource = resourceObj;
  429. if (this.isRTL) {
  430. copy.leftCol = this.indicesToCol(resourceIndex, seg.lastRowDayIndex);
  431. copy.rightCol = this.indicesToCol(resourceIndex, seg.firstRowDayIndex);
  432. }
  433. else {
  434. copy.leftCol = this.indicesToCol(resourceIndex, seg.firstRowDayIndex);
  435. copy.rightCol = this.indicesToCol(resourceIndex, seg.lastRowDayIndex);
  436. }
  437. resourceSegs.push(copy);
  438. }
  439. }
  440. }
  441. return resourceSegs;
  442. };
  443. return ResourceDayGrid;
  444. }(fullcalendar_1.DayGrid));
  445. exports.default = ResourceDayGrid;
  446. ResourceDayTableMixin_1.default.mixInto(ResourceDayGrid);
  447. /***/ }),
  448. /* 14 */
  449. /***/ (function(module, exports, __webpack_require__) {
  450. Object.defineProperty(exports, "__esModule", { value: true });
  451. var tslib_1 = __webpack_require__(1);
  452. var $ = __webpack_require__(2);
  453. var moment = __webpack_require__(15);
  454. var fullcalendar_1 = __webpack_require__(0);
  455. var ClippedScroller_1 = __webpack_require__(24);
  456. var ScrollerCanvas_1 = __webpack_require__(25);
  457. var ScrollJoiner_1 = __webpack_require__(16);
  458. var ScrollFollower_1 = __webpack_require__(26);
  459. var TimelineEventRenderer_1 = __webpack_require__(17);
  460. var TimelineFillRenderer_1 = __webpack_require__(28);
  461. var TimelineHelperRenderer_1 = __webpack_require__(29);
  462. var TimelineEventDragging_1 = __webpack_require__(40);
  463. var TimelineEventResizing_1 = __webpack_require__(41);
  464. var TimelineView_defaults_1 = __webpack_require__(42);
  465. var TimelineView = /** @class */ (function (_super) {
  466. tslib_1.__extends(TimelineView, _super);
  467. function TimelineView(calendar, viewSpec) {
  468. var _this = _super.call(this, calendar, viewSpec) || this;
  469. _this.emphasizeWeeks = false;
  470. _this.isTimeBodyScrolled = false;
  471. _this.slotWidth = _this.opt('slotWidth');
  472. return _this;
  473. }
  474. // Footprints
  475. // ------------------------------------------------------------------------------------------------------------------
  476. /*
  477. TODO: avoid using Moments. use slat system somehow
  478. THEN, can have componentFootprintToSegs handle this on its own
  479. */
  480. TimelineView.prototype.normalizeComponentFootprint = function (componentFootprint) {
  481. var adjustedEnd;
  482. var adjustedStart;
  483. var unzonedRange = componentFootprint.unzonedRange;
  484. if (this.isTimeScale) {
  485. adjustedStart = this.normalizeGridDate(unzonedRange.getStart());
  486. adjustedEnd = this.normalizeGridDate(unzonedRange.getEnd());
  487. }
  488. else {
  489. var dayRange = this.computeDayRange(unzonedRange);
  490. if (this.largeUnit) {
  491. adjustedStart = dayRange.start.clone().startOf(this.largeUnit);
  492. adjustedEnd = dayRange.end.clone().startOf(this.largeUnit);
  493. // if date is partially through the interval, or is in the same interval as the start,
  494. // make the exclusive end be the *next* interval
  495. if (!adjustedEnd.isSame(dayRange.end) || !adjustedEnd.isAfter(adjustedStart)) {
  496. adjustedEnd.add(this.slotDuration);
  497. }
  498. }
  499. else {
  500. adjustedStart = dayRange.start;
  501. adjustedEnd = dayRange.end;
  502. }
  503. }
  504. return new fullcalendar_1.ComponentFootprint(new fullcalendar_1.UnzonedRange(adjustedStart, adjustedEnd), !this.isTimeScale // isAllDay
  505. );
  506. };
  507. TimelineView.prototype.componentFootprintToSegs = function (footprint) {
  508. var footprintStart = footprint.unzonedRange.getStart();
  509. var footprintEnd = footprint.unzonedRange.getEnd();
  510. var normalFootprint = this.normalizeComponentFootprint(footprint);
  511. var segs = [];
  512. // protect against when the span is entirely in an invalid date region
  513. if (this.computeDateSnapCoverage(footprintStart) < this.computeDateSnapCoverage(footprintEnd)) {
  514. // intersect the footprint's range with the grid'd range
  515. var segRange = normalFootprint.unzonedRange.intersect(this.normalizedUnzonedRange);
  516. if (segRange) {
  517. var segStart = segRange.getStart();
  518. var segEnd = segRange.getEnd();
  519. segs.push({
  520. start: segStart,
  521. end: segEnd,
  522. isStart: segRange.isStart && this.isValidDate(segStart),
  523. isEnd: segRange.isEnd && this.isValidDate(segEnd.clone().subtract(1))
  524. });
  525. }
  526. }
  527. // TODO: what if month slots? should round it to nearest month
  528. // TODO: dragging/resizing in this situation? deltas for dragging/resizing breaks down
  529. return segs;
  530. };
  531. // Date Computation
  532. // ------------------------------------------------------------------------------------------------------------------
  533. /*
  534. Makes the given date consistent with isTimeScale/largeUnit,
  535. so, either removes the times, ensures a time, or makes it the startOf largeUnit.
  536. Strips all timezones. Returns new copy.
  537. TODO: should maybe be called "normalizeRangeDate".
  538. */
  539. TimelineView.prototype.normalizeGridDate = function (date) {
  540. var normalDate = date.clone();
  541. this.calendar.localizeMoment(normalDate); // mostly for startOf
  542. if (this.isTimeScale) {
  543. if (!normalDate.hasTime()) {
  544. normalDate.time(0);
  545. }
  546. }
  547. else {
  548. normalDate = normalDate.clone().stripTime();
  549. if (this.largeUnit) {
  550. normalDate.startOf(this.largeUnit);
  551. }
  552. }
  553. return normalDate;
  554. };
  555. TimelineView.prototype.isValidDate = function (date) {
  556. if (this.isHiddenDay(date)) {
  557. return false;
  558. }
  559. else if (this.isTimeScale) {
  560. // determine if the time is within minTime/maxTime, which may have wacky values
  561. var ms = date.time() - this.dateProfile.minTime; // milliseconds since minTime
  562. ms = ((ms % 86400000) + 86400000) % 86400000; // make negative values wrap to 24hr clock
  563. return ms < this.timeWindowMs; // before the maxTime?
  564. }
  565. else {
  566. return true;
  567. }
  568. };
  569. TimelineView.prototype.updateGridDates = function () {
  570. var snapIndex = -1;
  571. var snapDiff = 0; // index of the diff :(
  572. var snapDiffToIndex = [];
  573. var snapIndexToDiff = [];
  574. var date = this.normalizedUnzonedStart.clone();
  575. while (date < this.normalizedUnzonedEnd) {
  576. if (this.isValidDate(date)) {
  577. snapIndex++;
  578. snapDiffToIndex.push(snapIndex);
  579. snapIndexToDiff.push(snapDiff);
  580. }
  581. else {
  582. snapDiffToIndex.push(snapIndex + 0.5);
  583. }
  584. date.add(this.snapDuration);
  585. snapDiff++;
  586. }
  587. this.snapDiffToIndex = snapDiffToIndex;
  588. this.snapIndexToDiff = snapIndexToDiff;
  589. this.snapCnt = snapIndex + 1; // is always one behind
  590. this.slotCnt = this.snapCnt / this.snapsPerSlot;
  591. };
  592. // Skeleton Rendering
  593. // ------------------------------------------------------------------------------------------------------------------
  594. TimelineView.prototype.renderSkeleton = function () {
  595. this.el.addClass('fc-timeline');
  596. if (this.opt('eventOverlap') === false) {
  597. this.el.addClass('fc-no-overlap');
  598. }
  599. this.el.html(this.renderSkeletonHtml());
  600. this.timeHeadEl = this.el.find('thead .fc-time-area');
  601. this.timeBodyEl = this.el.find('tbody .fc-time-area');
  602. this.timeHeadScroller = new ClippedScroller_1.default({
  603. overflowX: 'clipped-scroll',
  604. overflowY: 'hidden'
  605. });
  606. this.timeHeadScroller.canvas = new ScrollerCanvas_1.default();
  607. this.timeHeadScroller.render();
  608. this.timeHeadScroller.el.appendTo(this.timeHeadEl);
  609. this.timeBodyScroller = new ClippedScroller_1.default();
  610. this.timeBodyScroller.canvas = new ScrollerCanvas_1.default();
  611. this.timeBodyScroller.render();
  612. this.timeBodyScroller.el.appendTo(this.timeBodyEl);
  613. this.isTimeBodyScrolled = false; // because if the grid has been rerendered, it will get a zero scroll
  614. this.timeBodyScroller.on('scroll', fullcalendar_1.proxy(this, 'handleTimeBodyScrolled'));
  615. this.slatContainerEl = $('<div class="fc-slats"/>').appendTo(this.timeBodyScroller.canvas.bgEl);
  616. this.segContainerEl = $('<div class="fc-event-container"/>').appendTo(this.timeBodyScroller.canvas.contentEl);
  617. this.bgSegContainerEl = this.timeBodyScroller.canvas.bgEl;
  618. this.timeBodyBoundCache = new fullcalendar_1.CoordCache({
  619. els: this.timeBodyScroller.canvas.el,
  620. isHorizontal: true,
  621. isVertical: true
  622. });
  623. this.timeScrollJoiner = new ScrollJoiner_1.default('horizontal', [this.timeHeadScroller, this.timeBodyScroller]);
  624. // the date/time text on the top axis that stays put while scrolling happens
  625. this.headDateFollower = new ScrollFollower_1.default(this.timeHeadScroller, true); // allowPointerEvents=true
  626. // the event titles that stay put while scrolling happens
  627. this.eventTitleFollower = new ScrollFollower_1.default(this.timeBodyScroller);
  628. this.eventTitleFollower.minTravel = 50;
  629. //
  630. if (this.isRTL) {
  631. this.eventTitleFollower.containOnNaturalRight = true;
  632. }
  633. else {
  634. this.eventTitleFollower.containOnNaturalLeft = true;
  635. }
  636. _super.prototype.renderSkeleton.call(this);
  637. };
  638. TimelineView.prototype.renderSkeletonHtml = function () {
  639. var theme = this.calendar.theme;
  640. return "<table class=\"" + theme.getClass('tableGrid') + "\"> <thead class=\"fc-head\"> <tr> <td class=\"fc-time-area " + theme.getClass('widgetHeader') + "\"></td> </tr> </thead> <tbody class=\"fc-body\"> <tr> <td class=\"fc-time-area " + theme.getClass('widgetContent') + "\"></td> </tr> </tbody> </table>";
  641. };
  642. TimelineView.prototype.unrenderSkeleton = function () {
  643. this.handleTimeBodyScrolled(0);
  644. _super.prototype.unrenderSkeleton.call(this);
  645. };
  646. // Date Rendering
  647. // ------------------------------------------------------------------------------------------------------------------
  648. TimelineView.prototype.renderDates = function (dateProfile) {
  649. TimelineView_defaults_1.initScaleProps(this);
  650. this.timeWindowMs = dateProfile.maxTime - dateProfile.minTime;
  651. // makes sure zone is stripped
  652. this.normalizedUnzonedStart = this.normalizeGridDate(dateProfile.renderUnzonedRange.getStart());
  653. this.normalizedUnzonedEnd = this.normalizeGridDate(dateProfile.renderUnzonedRange.getEnd());
  654. // apply minTime/maxTime
  655. // TODO: move towards .time(), but didn't play well with negatives.
  656. // TODO: View should be responsible.
  657. if (this.isTimeScale) {
  658. this.normalizedUnzonedStart.add(dateProfile.minTime);
  659. this.normalizedUnzonedEnd.subtract(1, 'day').add(dateProfile.maxTime);
  660. }
  661. this.normalizedUnzonedRange = new fullcalendar_1.UnzonedRange(this.normalizedUnzonedStart, this.normalizedUnzonedEnd);
  662. var slotDates = [];
  663. var date = this.normalizedUnzonedStart.clone();
  664. this.calendar.localizeMoment(date);
  665. while (date < this.normalizedUnzonedEnd) {
  666. if (this.isValidDate(date)) {
  667. slotDates.push(date.clone());
  668. }
  669. date.add(this.slotDuration);
  670. }
  671. this.slotDates = slotDates;
  672. this.updateGridDates();
  673. var slatHtmlRes = this.renderSlatHtml();
  674. this.timeHeadScroller.canvas.contentEl.html(slatHtmlRes.headHtml);
  675. this.timeHeadColEls = this.timeHeadScroller.canvas.contentEl.find('col');
  676. this.slatContainerEl.html(slatHtmlRes.bodyHtml);
  677. this.slatColEls = this.slatContainerEl.find('col');
  678. this.slatEls = this.slatContainerEl.find('td');
  679. this.slatCoordCache = new fullcalendar_1.CoordCache({
  680. els: this.slatEls,
  681. isHorizontal: true
  682. });
  683. // for the inner divs within the slats
  684. // used for event rendering and scrollTime, to disregard slat border
  685. this.slatInnerCoordCache = new fullcalendar_1.CoordCache({
  686. els: this.slatEls.find('> div'),
  687. isHorizontal: true,
  688. // we use this coord cache for getPosition* for event rendering.
  689. // workaround for .fc-content's negative margins.
  690. offsetParent: this.timeBodyScroller.canvas.el
  691. });
  692. for (var i = 0; i < this.slotDates.length; i++) {
  693. date = this.slotDates[i];
  694. this.publiclyTrigger('dayRender', {
  695. context: this,
  696. args: [date, this.slatEls.eq(i), this]
  697. });
  698. }
  699. if (this.headDateFollower) {
  700. this.headDateFollower.setSpriteEls(this.timeHeadEl.find('tr:not(:last-child) .fc-cell-text'));
  701. }
  702. };
  703. TimelineView.prototype.unrenderDates = function () {
  704. if (this.headDateFollower) {
  705. this.headDateFollower.clearSprites();
  706. }
  707. this.timeHeadScroller.canvas.contentEl.empty();
  708. this.slatContainerEl.empty();
  709. // clear the widths,
  710. // for no jupiness when navigating
  711. this.timeHeadScroller.canvas.clearWidth();
  712. this.timeBodyScroller.canvas.clearWidth();
  713. };
  714. TimelineView.prototype.renderSlatHtml = function () {
  715. var cell;
  716. var date;
  717. var rowCells;
  718. var format;
  719. var theme = this.calendar.theme;
  720. var labelInterval = this.labelInterval;
  721. var formats = this.headerFormats;
  722. var cellRows = formats.map(function (format) { return []; }); // indexed by row,col
  723. var leadingCell = null;
  724. var prevWeekNumber = null;
  725. var slotDates = this.slotDates;
  726. var slotCells = []; // meta
  727. var rowUnits = formats.map(function (format) { return (fullcalendar_1.queryMostGranularFormatUnit(format)); });
  728. for (var _i = 0, slotDates_1 = slotDates; _i < slotDates_1.length; _i++) {
  729. date = slotDates_1[_i];
  730. var weekNumber = date.week();
  731. var isWeekStart = this.emphasizeWeeks && (prevWeekNumber !== null) && (prevWeekNumber !== weekNumber);
  732. for (var row = 0; row < formats.length; row++) {
  733. format = formats[row];
  734. rowCells = cellRows[row];
  735. leadingCell = rowCells[rowCells.length - 1];
  736. var isSuperRow = (formats.length > 1) && (row < (formats.length - 1)); // more than one row and not the last
  737. var newCell = null;
  738. if (isSuperRow) {
  739. var text = date.format(format);
  740. if (!leadingCell || (leadingCell.text !== text)) {
  741. newCell = this.buildCellObject(date, text, rowUnits[row]);
  742. }
  743. else {
  744. leadingCell.colspan += 1;
  745. }
  746. }
  747. else {
  748. if (!leadingCell || fullcalendar_1.isInt(fullcalendar_1.divideRangeByDuration(this.normalizedUnzonedStart, date, labelInterval))) {
  749. var text = date.format(format);
  750. newCell = this.buildCellObject(date, text, rowUnits[row]);
  751. }
  752. else {
  753. leadingCell.colspan += 1;
  754. }
  755. }
  756. if (newCell) {
  757. newCell.weekStart = isWeekStart;
  758. rowCells.push(newCell);
  759. }
  760. }
  761. slotCells.push({ weekStart: isWeekStart });
  762. prevWeekNumber = weekNumber;
  763. }
  764. var isChrono = labelInterval > this.slotDuration;
  765. var isSingleDay = this.slotDuration.as('days') === 1;
  766. var html = '<table class="' + theme.getClass('tableGrid') + '">';
  767. html += '<colgroup>';
  768. for (var _a = 0, slotDates_2 = slotDates; _a < slotDates_2.length; _a++) {
  769. date = slotDates_2[_a];
  770. html += '<col/>';
  771. }
  772. html += '</colgroup>';
  773. html += '<tbody>';
  774. for (var i = 0; i < cellRows.length; i++) {
  775. rowCells = cellRows[i];
  776. var isLast = i === (cellRows.length - 1);
  777. html += '<tr' + (isChrono && isLast ? ' class="fc-chrono"' : '') + '>';
  778. for (var _b = 0, rowCells_1 = rowCells; _b < rowCells_1.length; _b++) {
  779. cell = rowCells_1[_b];
  780. var headerCellClassNames = [theme.getClass('widgetHeader')];
  781. if (cell.weekStart) {
  782. headerCellClassNames.push('fc-em-cell');
  783. }
  784. if (isSingleDay) {
  785. headerCellClassNames = headerCellClassNames.concat(this.getDayClasses(cell.date, true) // adds "today" class and other day-based classes
  786. );
  787. }
  788. html +=
  789. '<th class="' + headerCellClassNames.join(' ') + '"' +
  790. ' data-date="' + cell.date.format() + '"' +
  791. (cell.colspan > 1 ? ' colspan="' + cell.colspan + '"' : '') +
  792. '>' +
  793. '<div class="fc-cell-content">' +
  794. cell.spanHtml +
  795. '</div>' +
  796. '</th>';
  797. }
  798. html += '</tr>';
  799. }
  800. html += '</tbody></table>';
  801. var slatHtml = '<table class="' + theme.getClass('tableGrid') + '">';
  802. slatHtml += '<colgroup>';
  803. for (var _c = 0, slotCells_1 = slotCells; _c < slotCells_1.length; _c++) {
  804. cell = slotCells_1[_c];
  805. slatHtml += '<col/>';
  806. }
  807. slatHtml += '</colgroup>';
  808. slatHtml += '<tbody><tr>';
  809. for (var i = 0; i < slotCells.length; i++) {
  810. cell = slotCells[i];
  811. date = slotDates[i];
  812. slatHtml += this.slatCellHtml(date, cell.weekStart);
  813. }
  814. slatHtml += '</tr></tbody></table>';
  815. return { headHtml: html, bodyHtml: slatHtml };
  816. };
  817. TimelineView.prototype.buildCellObject = function (date, text, rowUnit) {
  818. date = date.clone(); // ensure our own reference
  819. var spanHtml = this.buildGotoAnchorHtml({
  820. date: date,
  821. type: rowUnit,
  822. forceOff: !rowUnit
  823. }, {
  824. 'class': 'fc-cell-text'
  825. }, fullcalendar_1.htmlEscape(text));
  826. return { text: text, spanHtml: spanHtml, date: date, colspan: 1 };
  827. };
  828. TimelineView.prototype.slatCellHtml = function (date, isEm) {
  829. var classes;
  830. var theme = this.calendar.theme;
  831. if (this.isTimeScale) {
  832. classes = [];
  833. classes.push(fullcalendar_1.isInt(fullcalendar_1.divideRangeByDuration(this.normalizedUnzonedStart, date, this.labelInterval)) ?
  834. 'fc-major' :
  835. 'fc-minor');
  836. }
  837. else {
  838. classes = this.getDayClasses(date);
  839. classes.push('fc-day');
  840. }
  841. classes.unshift(theme.getClass('widgetContent'));
  842. if (isEm) {
  843. classes.push('fc-em-cell');
  844. }
  845. return '<td class="' + classes.join(' ') + '"' +
  846. ' data-date="' + date.format() + '"' +
  847. '><div /></td>';
  848. };
  849. // Business Hours
  850. // ------------------------------------------------------------------------------------------------------------------
  851. TimelineView.prototype.renderBusinessHours = function (businessHourPayload) {
  852. if (!this.largeUnit) {
  853. return _super.prototype.renderBusinessHours.call(this, businessHourPayload);
  854. }
  855. };
  856. // Now Indicator
  857. // ------------------------------------------------------------------------------------------------------------------
  858. TimelineView.prototype.getNowIndicatorUnit = function () {
  859. // TODO: converge with largeUnit. precompute
  860. if (this.isTimeScale) {
  861. return fullcalendar_1.computeGreatestUnit(this.slotDuration);
  862. }
  863. };
  864. // will only execute if isTimeScale
  865. TimelineView.prototype.renderNowIndicator = function (date) {
  866. var nodes = [];
  867. date = this.normalizeGridDate(date);
  868. if (this.normalizedUnzonedRange.containsDate(date)) {
  869. var coord = this.dateToCoord(date);
  870. var css = this.isRTL ?
  871. { right: -coord } :
  872. { left: coord };
  873. nodes.push($("<div class='fc-now-indicator fc-now-indicator-arrow'></div>")
  874. .css(css)
  875. .appendTo(this.timeHeadScroller.canvas.el)[0]);
  876. nodes.push($("<div class='fc-now-indicator fc-now-indicator-line'></div>")
  877. .css(css)
  878. .appendTo(this.timeBodyScroller.canvas.el)[0]);
  879. }
  880. this.nowIndicatorEls = $(nodes);
  881. };
  882. // will only execute if isTimeScale
  883. TimelineView.prototype.unrenderNowIndicator = function () {
  884. if (this.nowIndicatorEls) {
  885. this.nowIndicatorEls.remove();
  886. this.nowIndicatorEls = null;
  887. }
  888. };
  889. // Sizing
  890. // ------------------------------------------------------------------------------------------------------------------
  891. TimelineView.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  892. var bodyHeight;
  893. var containerMinWidth;
  894. var containerWidth;
  895. var nonLastSlotWidth;
  896. if (isAuto) {
  897. bodyHeight = 'auto';
  898. }
  899. else {
  900. bodyHeight = totalHeight - this.headHeight() - this.queryMiscHeight();
  901. }
  902. this.timeBodyScroller.setHeight(bodyHeight);
  903. // reason for this complicated method is that things went wrong when:
  904. // slots/headers didn't fill content area and needed to be stretched
  905. // cells wouldn't align (rounding issues with available width calculated
  906. // differently because of padding VS scrollbar trick)
  907. var isDatesRendered = this.timeHeadColEls; // TODO: refactor use of this
  908. if (isDatesRendered) {
  909. var slotWidth = Math.round(this.slotWidth || (this.slotWidth = this.computeSlotWidth()));
  910. containerWidth = slotWidth * this.slotDates.length;
  911. containerMinWidth = '';
  912. nonLastSlotWidth = slotWidth;
  913. var availableWidth = this.timeBodyScroller.getClientWidth();
  914. if (availableWidth > containerWidth) {
  915. containerMinWidth = availableWidth;
  916. containerWidth = '';
  917. nonLastSlotWidth = Math.floor(availableWidth / this.slotDates.length);
  918. }
  919. }
  920. else {
  921. containerWidth = '';
  922. containerMinWidth = '';
  923. }
  924. this.timeHeadScroller.canvas.setWidth(containerWidth);
  925. this.timeHeadScroller.canvas.setMinWidth(containerMinWidth);
  926. this.timeBodyScroller.canvas.setWidth(containerWidth);
  927. this.timeBodyScroller.canvas.setMinWidth(containerMinWidth);
  928. if (isDatesRendered) {
  929. this.timeHeadColEls.slice(0, -1).add(this.slatColEls.slice(0, -1))
  930. .css('width', nonLastSlotWidth);
  931. }
  932. this.timeHeadScroller.updateSize();
  933. this.timeBodyScroller.updateSize();
  934. this.timeScrollJoiner.update();
  935. if (isDatesRendered) {
  936. this.buildCoords();
  937. // TODO: left/right CSS assignment also happens earlier in renderFgSegs
  938. this.updateSegPositions();
  939. // this updateSize method is triggered by callers who don't always subsequently call updateNowIndicator,
  940. // and updateSize always has the risk of changing horizontal spacing which will affect nowIndicator positioning,
  941. // so always call it here too. will often rerender twice unfortunately.
  942. // TODO: more closely integrate updateSize with updateNowIndicator
  943. this.updateNowIndicator();
  944. }
  945. if (this.headDateFollower) {
  946. this.headDateFollower.update();
  947. }
  948. if (this.eventTitleFollower) {
  949. this.eventTitleFollower.update();
  950. }
  951. };
  952. TimelineView.prototype.queryMiscHeight = function () {
  953. return this.el.outerHeight() -
  954. this.timeHeadScroller.el.outerHeight() -
  955. this.timeBodyScroller.el.outerHeight();
  956. };
  957. TimelineView.prototype.computeSlotWidth = function () {
  958. var maxInnerWidth = 0; // TODO: harness core's `matchCellWidths` for this
  959. var innerEls = this.timeHeadEl.find('tr:last-child th .fc-cell-text'); // TODO: cache
  960. innerEls.each(function (i, node) {
  961. var innerWidth = $(node).outerWidth();
  962. return maxInnerWidth = Math.max(maxInnerWidth, innerWidth);
  963. });
  964. var headerWidth = maxInnerWidth + 1; // assume no padding, and one pixel border
  965. var slotsPerLabel = fullcalendar_1.divideDurationByDuration(this.labelInterval, this.slotDuration); // TODO: rename labelDuration?
  966. var slotWidth = Math.ceil(headerWidth / slotsPerLabel);
  967. var minWidth = this.timeHeadColEls.eq(0).css('min-width');
  968. if (minWidth) {
  969. minWidth = parseInt(minWidth, 10);
  970. if (minWidth) {
  971. slotWidth = Math.max(slotWidth, minWidth);
  972. }
  973. }
  974. return slotWidth;
  975. };
  976. // Coordinates
  977. // ------------------------------------------------------------------------------------------------------------------
  978. TimelineView.prototype.buildCoords = function () {
  979. this.timeBodyBoundCache.build();
  980. this.slatCoordCache.build();
  981. this.slatInnerCoordCache.build();
  982. };
  983. // returned value is between 0 and the number of snaps
  984. TimelineView.prototype.computeDateSnapCoverage = function (date) {
  985. var snapDiff = fullcalendar_1.divideRangeByDuration(this.normalizedUnzonedStart, date, this.snapDuration);
  986. if (snapDiff < 0) {
  987. return 0;
  988. }
  989. else if (snapDiff >= this.snapDiffToIndex.length) {
  990. return this.snapCnt;
  991. }
  992. else {
  993. var snapDiffInt = Math.floor(snapDiff);
  994. var snapCoverage = this.snapDiffToIndex[snapDiffInt];
  995. if (fullcalendar_1.isInt(snapCoverage)) { // not an in-between value
  996. snapCoverage += snapDiff - snapDiffInt; // add the remainder
  997. }
  998. else {
  999. // a fractional value, meaning the date is not visible
  1000. // always round up in this case. works for start AND end dates in a range.
  1001. snapCoverage = Math.ceil(snapCoverage);
  1002. }
  1003. return snapCoverage;
  1004. }
  1005. };
  1006. // for LTR, results range from 0 to width of area
  1007. // for RTL, results range from negative width of area to 0
  1008. TimelineView.prototype.dateToCoord = function (date) {
  1009. var snapCoverage = this.computeDateSnapCoverage(date);
  1010. var slotCoverage = snapCoverage / this.snapsPerSlot;
  1011. var slotIndex = Math.floor(slotCoverage);
  1012. slotIndex = Math.min(slotIndex, this.slotCnt - 1);
  1013. var partial = slotCoverage - slotIndex;
  1014. var coordCache = this.slatInnerCoordCache;
  1015. if (this.isRTL) {
  1016. return (coordCache.getRightPosition(slotIndex) -
  1017. (coordCache.getWidth(slotIndex) * partial)) - this.timeBodyBoundCache.getWidth(0);
  1018. }
  1019. else {
  1020. return (coordCache.getLeftPosition(slotIndex) +
  1021. (coordCache.getWidth(slotIndex) * partial));
  1022. }
  1023. };
  1024. TimelineView.prototype.rangeToCoords = function (range) {
  1025. if (this.isRTL) {
  1026. return { right: this.dateToCoord(range.start), left: this.dateToCoord(range.end) };
  1027. }
  1028. else {
  1029. return { left: this.dateToCoord(range.start), right: this.dateToCoord(range.end) };
  1030. }
  1031. };
  1032. // a getter / setter
  1033. TimelineView.prototype.headHeight = function () {
  1034. var args = [];
  1035. for (var _i = 0; _i < arguments.length; _i++) {
  1036. args[_i] = arguments[_i];
  1037. }
  1038. var table = this.timeHeadScroller.canvas.contentEl.find('table');
  1039. return table.height.apply(table, args);
  1040. };
  1041. // this needs to be called if v scrollbars appear on body container. or zooming
  1042. TimelineView.prototype.updateSegPositions = function () {
  1043. var segs = [].concat(this.getEventSegs(), this.getBusinessHourSegs());
  1044. for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {
  1045. var seg = segs_1[_i];
  1046. var coords = this.rangeToCoords(seg);
  1047. seg.el.css({
  1048. left: (seg.left = coords.left),
  1049. right: -(seg.right = coords.right)
  1050. });
  1051. }
  1052. };
  1053. // Scrolling
  1054. // ---------------------------------------------------------------------------------
  1055. TimelineView.prototype.handleTimeBodyScrolled = function (top) {
  1056. if (top) {
  1057. if (!this.isTimeBodyScrolled) {
  1058. this.isTimeBodyScrolled = true;
  1059. this.el.addClass('fc-scrolled');
  1060. }
  1061. }
  1062. else {
  1063. if (this.isTimeBodyScrolled) {
  1064. this.isTimeBodyScrolled = false;
  1065. this.el.removeClass('fc-scrolled');
  1066. }
  1067. }
  1068. };
  1069. TimelineView.prototype.computeInitialDateScroll = function () {
  1070. var unzonedRange = this.get('dateProfile').activeUnzonedRange;
  1071. var left = 0;
  1072. if (this.isTimeScale) {
  1073. var scrollTime = this.opt('scrollTime');
  1074. if (scrollTime) {
  1075. scrollTime = moment.duration(scrollTime);
  1076. left = this.dateToCoord(unzonedRange.getStart().time(scrollTime)); // TODO: fix this for RTL
  1077. }
  1078. }
  1079. return { left: left };
  1080. };
  1081. TimelineView.prototype.queryDateScroll = function () {
  1082. return { left: this.timeBodyScroller.getScrollLeft() };
  1083. };
  1084. TimelineView.prototype.applyDateScroll = function (scroll) {
  1085. if (scroll.left != null) {
  1086. // TODO: workaround for FF. the ScrollJoiner sibling won't react fast enough
  1087. // to override the native initial crappy scroll that FF applies.
  1088. // TODO: have the ScrollJoiner handle this
  1089. // Similar code in ResourceTimelineView::setScroll
  1090. this.timeHeadScroller.setScrollLeft(scroll.left);
  1091. this.timeBodyScroller.setScrollLeft(scroll.left);
  1092. }
  1093. };
  1094. // Hit System
  1095. // ------------------------------------------------------------------------------------------------------------------
  1096. TimelineView.prototype.prepareHits = function () {
  1097. this.buildCoords();
  1098. };
  1099. // FYI: we don't want to clear the slatCoordCache in releaseHits()
  1100. // because those coordinates are needed for dateToCoord()
  1101. TimelineView.prototype.queryHit = function (leftOffset, topOffset) {
  1102. var snapsPerSlot = this.snapsPerSlot;
  1103. var slatCoordCache = this.slatCoordCache;
  1104. var timeBodyBoundCache = this.timeBodyBoundCache;
  1105. // within scroll container's content rectangle?
  1106. if (timeBodyBoundCache.isPointInBounds(leftOffset, topOffset)) {
  1107. var slatIndex = slatCoordCache.getHorizontalIndex(leftOffset);
  1108. if (slatIndex != null) {
  1109. var localSnapIndex = void 0;
  1110. var partial = void 0;
  1111. var snapIndex = void 0;
  1112. var snapLeft = void 0;
  1113. var snapRight = void 0;
  1114. var slatWidth = slatCoordCache.getWidth(slatIndex);
  1115. if (this.isRTL) {
  1116. var slatRight = slatCoordCache.getRightOffset(slatIndex);
  1117. partial = (slatRight - leftOffset) / slatWidth;
  1118. localSnapIndex = Math.floor(partial * snapsPerSlot);
  1119. snapIndex = (slatIndex * snapsPerSlot) + localSnapIndex;
  1120. snapRight = slatRight - ((localSnapIndex / snapsPerSlot) * slatWidth);
  1121. snapLeft = snapRight - (((localSnapIndex + 1) / snapsPerSlot) * slatWidth);
  1122. }
  1123. else {
  1124. var slatLeft = slatCoordCache.getLeftOffset(slatIndex);
  1125. partial = (leftOffset - slatLeft) / slatWidth;
  1126. localSnapIndex = Math.floor(partial * snapsPerSlot);
  1127. snapIndex = (slatIndex * snapsPerSlot) + localSnapIndex;
  1128. snapLeft = slatLeft + ((localSnapIndex / snapsPerSlot) * slatWidth);
  1129. snapRight = slatLeft + (((localSnapIndex + 1) / snapsPerSlot) * slatWidth);
  1130. }
  1131. return {
  1132. snap: snapIndex,
  1133. component: this,
  1134. left: snapLeft,
  1135. right: snapRight,
  1136. top: timeBodyBoundCache.getTopOffset(0),
  1137. bottom: timeBodyBoundCache.getBottomOffset(0)
  1138. };
  1139. }
  1140. }
  1141. };
  1142. TimelineView.prototype.getHitFootprint = function (hit) {
  1143. return new fullcalendar_1.ComponentFootprint(this.getSnapUnzonedRange(hit.snap), !this.isTimeScale // isAllDay
  1144. );
  1145. };
  1146. TimelineView.prototype.getHitEl = function (hit) {
  1147. return this.getSnapEl(hit.snap); // TODO: write a test for this
  1148. };
  1149. /*
  1150. TODO: avoid using moments
  1151. */
  1152. TimelineView.prototype.getSnapUnzonedRange = function (snapIndex) {
  1153. var start = this.normalizedUnzonedStart.clone();
  1154. start.add(fullcalendar_1.multiplyDuration(this.snapDuration, this.snapIndexToDiff[snapIndex]));
  1155. var end = start.clone().add(this.snapDuration);
  1156. return new fullcalendar_1.UnzonedRange(start, end);
  1157. };
  1158. TimelineView.prototype.getSnapEl = function (snapIndex) {
  1159. return this.slatEls.eq(Math.floor(snapIndex / this.snapsPerSlot));
  1160. };
  1161. // Event Resizing
  1162. // ------------------------------------------------------------------------------------------------------------------
  1163. // Renders a visual indication of an event being resized
  1164. TimelineView.prototype.renderEventResize = function (eventFootprints, seg, isTouch) {
  1165. for (var _i = 0, eventFootprints_1 = eventFootprints; _i < eventFootprints_1.length; _i++) {
  1166. var eventFootprint = eventFootprints_1[_i];
  1167. this.renderHighlight(eventFootprint.componentFootprint);
  1168. }
  1169. return this.helperRenderer.renderEventResizingFootprints(eventFootprints, seg, isTouch);
  1170. };
  1171. // Unrenders a visual indication of an event being resized
  1172. TimelineView.prototype.unrenderEventResize = function () {
  1173. this.unrenderHighlight();
  1174. return this.helperRenderer.unrender();
  1175. };
  1176. // DnD
  1177. // ------------------------------------------------------------------------------------------------------------------
  1178. // TODO: different technique based on scale.
  1179. // when dragging, middle of event is the drop.
  1180. // should be the edges when isTimeScale.
  1181. TimelineView.prototype.renderDrag = function (eventFootprints, seg, isTouch) {
  1182. if (seg) {
  1183. this.helperRenderer.renderEventDraggingFootprints(eventFootprints, seg, isTouch);
  1184. return true; // signal helper rendered
  1185. }
  1186. else {
  1187. for (var _i = 0, eventFootprints_2 = eventFootprints; _i < eventFootprints_2.length; _i++) {
  1188. var eventFootprint = eventFootprints_2[_i];
  1189. this.renderHighlight(eventFootprint.componentFootprint);
  1190. }
  1191. return false; // signal helper not rendered
  1192. }
  1193. };
  1194. TimelineView.prototype.unrenderDrag = function () {
  1195. this.helperRenderer.unrender();
  1196. return this.unrenderHighlight();
  1197. };
  1198. return TimelineView;
  1199. }(fullcalendar_1.View));
  1200. exports.default = TimelineView;
  1201. // config
  1202. TimelineView.prototype.usesMinMaxTime = true; // for View. indicates that minTime/maxTime affects rendering
  1203. // TODO: rename these
  1204. TimelineView.prototype.eventRendererClass = TimelineEventRenderer_1.default;
  1205. TimelineView.prototype.fillRendererClass = TimelineFillRenderer_1.default;
  1206. TimelineView.prototype.businessHourRendererClass = fullcalendar_1.BusinessHourRenderer;
  1207. TimelineView.prototype.helperRendererClass = TimelineHelperRenderer_1.default;
  1208. TimelineView.prototype.eventDraggingClass = TimelineEventDragging_1.default;
  1209. TimelineView.prototype.eventResizingClass = TimelineEventResizing_1.default;
  1210. fullcalendar_1.StandardInteractionsMixin.mixInto(TimelineView);
  1211. /***/ }),
  1212. /* 15 */
  1213. /***/ (function(module, exports) {
  1214. module.exports = __WEBPACK_EXTERNAL_MODULE_15__;
  1215. /***/ }),
  1216. /* 16 */
  1217. /***/ (function(module, exports) {
  1218. Object.defineProperty(exports, "__esModule", { value: true });
  1219. var ScrollJoiner = /** @class */ (function () {
  1220. function ScrollJoiner(axis, scrollers) {
  1221. this.axis = axis;
  1222. this.scrollers = scrollers;
  1223. for (var _i = 0, _a = this.scrollers; _i < _a.length; _i++) {
  1224. var scroller = _a[_i];
  1225. this.initScroller(scroller);
  1226. }
  1227. }
  1228. ScrollJoiner.prototype.initScroller = function (scroller) {
  1229. var _this = this;
  1230. // when the user scrolls via mousewheel, we know for sure the target
  1231. // scroller should be the master. capture the various x-browser events that fire.
  1232. scroller.scrollEl.on('wheel mousewheel DomMouseScroll MozMousePixelScroll', function () {
  1233. _this.assignMasterScroller(scroller);
  1234. });
  1235. scroller.on('scrollStart', function () {
  1236. if (!_this.masterScroller) {
  1237. _this.assignMasterScroller(scroller);
  1238. }
  1239. }).on('scroll', function () {
  1240. if (scroller === _this.masterScroller) {
  1241. for (var _i = 0, _a = _this.scrollers; _i < _a.length; _i++) {
  1242. var otherScroller = _a[_i];
  1243. if (otherScroller !== scroller) {
  1244. switch (_this.axis) {
  1245. case 'horizontal':
  1246. otherScroller.setNativeScrollLeft(scroller.getNativeScrollLeft());
  1247. break;
  1248. case 'vertical':
  1249. otherScroller.setScrollTop(scroller.getScrollTop());
  1250. break;
  1251. }
  1252. }
  1253. }
  1254. }
  1255. }).on('scrollEnd', function () {
  1256. if (scroller === _this.masterScroller) {
  1257. _this.unassignMasterScroller();
  1258. }
  1259. });
  1260. };
  1261. ScrollJoiner.prototype.assignMasterScroller = function (scroller) {
  1262. this.unassignMasterScroller();
  1263. this.masterScroller = scroller;
  1264. for (var _i = 0, _a = this.scrollers; _i < _a.length; _i++) {
  1265. var otherScroller = _a[_i];
  1266. if (otherScroller !== scroller) {
  1267. otherScroller.disableTouchScroll();
  1268. }
  1269. }
  1270. };
  1271. ScrollJoiner.prototype.unassignMasterScroller = function () {
  1272. if (this.masterScroller) {
  1273. for (var _i = 0, _a = this.scrollers; _i < _a.length; _i++) {
  1274. var otherScroller = _a[_i];
  1275. otherScroller.enableTouchScroll();
  1276. }
  1277. this.masterScroller = null;
  1278. }
  1279. };
  1280. ScrollJoiner.prototype.update = function () {
  1281. var allWidths = this.scrollers.map(function (scroller) { return scroller.getScrollbarWidths(); });
  1282. var maxLeft = 0;
  1283. var maxRight = 0;
  1284. var maxTop = 0;
  1285. var maxBottom = 0;
  1286. var scroller;
  1287. var widths;
  1288. var i;
  1289. for (var _i = 0, allWidths_1 = allWidths; _i < allWidths_1.length; _i++) {
  1290. widths = allWidths_1[_i];
  1291. maxLeft = Math.max(maxLeft, widths.left);
  1292. maxRight = Math.max(maxRight, widths.right);
  1293. maxTop = Math.max(maxTop, widths.top);
  1294. maxBottom = Math.max(maxBottom, widths.bottom);
  1295. }
  1296. for (i = 0; i < this.scrollers.length; i++) {
  1297. scroller = this.scrollers[i];
  1298. widths = allWidths[i];
  1299. scroller.canvas.setGutters(this.axis === 'horizontal' ?
  1300. {
  1301. left: maxLeft - widths.left,
  1302. right: maxRight - widths.right
  1303. } :
  1304. {
  1305. top: maxTop - widths.top,
  1306. bottom: maxBottom - widths.bottom
  1307. });
  1308. }
  1309. };
  1310. return ScrollJoiner;
  1311. }());
  1312. exports.default = ScrollJoiner;
  1313. /***/ }),
  1314. /* 17 */
  1315. /***/ (function(module, exports, __webpack_require__) {
  1316. Object.defineProperty(exports, "__esModule", { value: true });
  1317. var tslib_1 = __webpack_require__(1);
  1318. var fullcalendar_1 = __webpack_require__(0);
  1319. var ScrollFollowerSprite_1 = __webpack_require__(27);
  1320. var TimelineEventRenderer = /** @class */ (function (_super) {
  1321. tslib_1.__extends(TimelineEventRenderer, _super);
  1322. function TimelineEventRenderer() {
  1323. return _super !== null && _super.apply(this, arguments) || this;
  1324. }
  1325. /*
  1326. component must be { segContainerEl, segContainerHeight, rangeToCoords }
  1327. */
  1328. TimelineEventRenderer.prototype.computeDisplayEventTime = function () {
  1329. return !this.view.isTimeScale; // because times should be obvious via axis
  1330. };
  1331. TimelineEventRenderer.prototype.computeDisplayEventEnd = function () {
  1332. return false;
  1333. };
  1334. // Computes a default event time formatting string if `timeFormat` is not explicitly defined
  1335. TimelineEventRenderer.prototype.computeEventTimeFormat = function () {
  1336. return this.view.opt('extraSmallTimeFormat');
  1337. };
  1338. TimelineEventRenderer.prototype.renderFgSegs = function (segs) {
  1339. var eventTitleFollower = this.view.eventTitleFollower;
  1340. for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {
  1341. var seg = segs_1[_i];
  1342. // TODO: centralize logic (also in updateSegPositions)
  1343. var coords = this.component.rangeToCoords(seg);
  1344. seg.el.css({
  1345. left: (seg.left = coords.left),
  1346. right: -(seg.right = coords.right)
  1347. });
  1348. }
  1349. // attach segs
  1350. for (var _a = 0, segs_2 = segs; _a < segs_2.length; _a++) {
  1351. var seg = segs_2[_a];
  1352. seg.el.appendTo(this.component.segContainerEl);
  1353. }
  1354. // compute seg verticals
  1355. for (var _b = 0, segs_3 = segs; _b < segs_3.length; _b++) {
  1356. var seg = segs_3[_b];
  1357. seg.height = seg.el.outerHeight(true); // include margin
  1358. }
  1359. this.buildSegLevels(segs);
  1360. this.component.segContainerHeight = computeOffsetForSegs(segs); // returns this value!
  1361. // assign seg verticals
  1362. for (var _c = 0, segs_4 = segs; _c < segs_4.length; _c++) {
  1363. var seg = segs_4[_c];
  1364. seg.el.css('top', seg.top);
  1365. }
  1366. this.component.segContainerEl.height(this.component.segContainerHeight);
  1367. for (var _d = 0, segs_5 = segs; _d < segs_5.length; _d++) {
  1368. var seg = segs_5[_d];
  1369. var titleEl = seg.el.find('.fc-title');
  1370. if (titleEl.length) {
  1371. seg.scrollFollowerSprite = new ScrollFollowerSprite_1.default(titleEl);
  1372. eventTitleFollower.addSprite(seg.scrollFollowerSprite);
  1373. }
  1374. }
  1375. };
  1376. // NOTE: this modifies the order of segs
  1377. TimelineEventRenderer.prototype.buildSegLevels = function (segs) {
  1378. var segLevels = [];
  1379. this.sortEventSegs(segs);
  1380. for (var _i = 0, segs_6 = segs; _i < segs_6.length; _i++) {
  1381. var unplacedSeg = segs_6[_i];
  1382. unplacedSeg.above = [];
  1383. // determine the first level with no collisions
  1384. var level = 0; // level index
  1385. while (level < segLevels.length) {
  1386. var isLevelCollision = false;
  1387. // determine collisions
  1388. for (var _a = 0, _b = segLevels[level]; _a < _b.length; _a++) {
  1389. var placedSeg = _b[_a];
  1390. if (timeRowSegsCollide(unplacedSeg, placedSeg)) {
  1391. unplacedSeg.above.push(placedSeg);
  1392. isLevelCollision = true;
  1393. }
  1394. }
  1395. if (isLevelCollision) {
  1396. level += 1;
  1397. }
  1398. else {
  1399. break;
  1400. }
  1401. }
  1402. // insert into the first non-colliding level. create if necessary
  1403. (segLevels[level] || (segLevels[level] = []))
  1404. .push(unplacedSeg);
  1405. // record possible colliding segments below (TODO: automated test for this)
  1406. level += 1;
  1407. while (level < segLevels.length) {
  1408. for (var _c = 0, _d = segLevels[level]; _c < _d.length; _c++) {
  1409. var belowSeg = _d[_c];
  1410. if (timeRowSegsCollide(unplacedSeg, belowSeg)) {
  1411. belowSeg.above.push(unplacedSeg);
  1412. }
  1413. }
  1414. level += 1;
  1415. }
  1416. }
  1417. return segLevels;
  1418. };
  1419. TimelineEventRenderer.prototype.unrenderFgSegs = function (segs) {
  1420. if (this.component.segContainerEl) { // rendered before?
  1421. var eventTitleFollower = this.view.eventTitleFollower;
  1422. for (var _i = 0, segs_7 = segs; _i < segs_7.length; _i++) {
  1423. var seg = segs_7[_i];
  1424. if (seg.scrollFollowerSprite) {
  1425. eventTitleFollower.removeSprite(seg.scrollFollowerSprite);
  1426. }
  1427. }
  1428. this.component.segContainerEl.empty();
  1429. this.component.segContainerEl.height('');
  1430. this.component.segContainerHeight = null;
  1431. }
  1432. };
  1433. TimelineEventRenderer.prototype.fgSegHtml = function (seg, disableResizing) {
  1434. var eventDef = seg.footprint.eventDef;
  1435. var isDraggable = this.view.isEventDefDraggable(eventDef);
  1436. var isResizableFromStart = seg.isStart && this.view.isEventDefResizableFromStart(eventDef);
  1437. var isResizableFromEnd = seg.isEnd && this.view.isEventDefResizableFromEnd(eventDef);
  1438. var classes = this.getSegClasses(seg, isDraggable, isResizableFromStart || isResizableFromEnd);
  1439. classes.unshift('fc-timeline-event', 'fc-h-event');
  1440. var timeText = this.getTimeText(seg.footprint);
  1441. return '<a class="' + classes.join(' ') + '" style="' + fullcalendar_1.cssToStr(this.getSkinCss(seg.footprint.eventDef)) + '"' +
  1442. (eventDef.url ?
  1443. ' href="' + fullcalendar_1.htmlEscape(eventDef.url) + '"' :
  1444. '') +
  1445. '>' +
  1446. '<div class="fc-content">' +
  1447. (timeText ?
  1448. '<span class="fc-time">' +
  1449. fullcalendar_1.htmlEscape(timeText) +
  1450. '</span>'
  1451. :
  1452. '') +
  1453. '<span class="fc-title">' +
  1454. (eventDef.title ? fullcalendar_1.htmlEscape(eventDef.title) : '&nbsp;') +
  1455. '</span>' +
  1456. '</div>' +
  1457. '<div class="fc-bg" />' +
  1458. (isResizableFromStart ?
  1459. '<div class="fc-resizer fc-start-resizer"></div>' :
  1460. '') +
  1461. (isResizableFromEnd ?
  1462. '<div class="fc-resizer fc-end-resizer"></div>' :
  1463. '') +
  1464. '</a>';
  1465. };
  1466. return TimelineEventRenderer;
  1467. }(fullcalendar_1.EventRenderer));
  1468. exports.default = TimelineEventRenderer;
  1469. // Seg Rendering Utils
  1470. // ----------------------------------------------------------------------------------------------------------------------
  1471. function computeOffsetForSegs(segs) {
  1472. var max = 0;
  1473. for (var _i = 0, segs_8 = segs; _i < segs_8.length; _i++) {
  1474. var seg = segs_8[_i];
  1475. max = Math.max(max, computeOffsetForSeg(seg));
  1476. }
  1477. return max;
  1478. }
  1479. function computeOffsetForSeg(seg) {
  1480. if ((seg.top == null)) {
  1481. seg.top = computeOffsetForSegs(seg.above);
  1482. }
  1483. return seg.top + seg.height;
  1484. }
  1485. function timeRowSegsCollide(seg0, seg1) {
  1486. return (seg0.left < seg1.right) && (seg0.right > seg1.left);
  1487. }
  1488. /***/ }),
  1489. /* 18 */
  1490. /***/ (function(module, exports, __webpack_require__) {
  1491. Object.defineProperty(exports, "__esModule", { value: true });
  1492. var tslib_1 = __webpack_require__(1);
  1493. var $ = __webpack_require__(2);
  1494. var fullcalendar_1 = __webpack_require__(0);
  1495. var util_1 = __webpack_require__(44);
  1496. /*
  1497. An abstract node in a row-hierarchy tree.
  1498. May be a self-contained single row, a row with subrows,
  1499. OR a grouping of rows without its own distinct row.
  1500. */
  1501. var RowParent = /** @class */ (function (_super) {
  1502. tslib_1.__extends(RowParent, _super);
  1503. function RowParent(view) {
  1504. var _this = _super.call(this, view) // will assign this.view
  1505. || this;
  1506. _this.children = [];
  1507. _this.depth = 0;
  1508. _this.trHash = {};
  1509. _this.trs = $();
  1510. _this.isExpanded = _this.view.opt('resourcesInitiallyExpanded');
  1511. return _this;
  1512. }
  1513. // Hierarchy
  1514. // ------------------------------------------------------------------------------------------------------------------
  1515. /*
  1516. Adds the given node as a child.
  1517. Will be inserted at the `index`. If not given, will be appended to the end.
  1518. */
  1519. RowParent.prototype.addChildRowNode = function (child, index) {
  1520. child.removeFromParentAndDom(); // in case it belonged somewhere else previously
  1521. var children = this.children;
  1522. // insert into the children array
  1523. if (index != null) {
  1524. children.splice(index, 0, child);
  1525. }
  1526. else {
  1527. index = children.length;
  1528. children.push(child);
  1529. }
  1530. // compute the previous sibling of child
  1531. child.prevSibling =
  1532. index > 0 ?
  1533. children[index - 1] :
  1534. null;
  1535. // update the next sibling's prevSibling
  1536. if (index < (children.length - 1)) {
  1537. children[index + 1].prevSibling = child;
  1538. }
  1539. child.parent = this;
  1540. child.depth = this.depth + (this.hasOwnRow ? 1 : 0);
  1541. this.descendantAdded(child);
  1542. };
  1543. /*
  1544. Removes the given child from the node. Assumes it is a direct child.
  1545. If not a direct child, returns false and nothing happens.
  1546. */
  1547. RowParent.prototype.removeChild = function (child) {
  1548. var i;
  1549. var children = this.children;
  1550. var isFound = false;
  1551. // look for the node in the children array
  1552. for (i = 0; i < children.length; i++) {
  1553. var testChild = children[i];
  1554. if (testChild === child) { // found!
  1555. isFound = true;
  1556. break; // after this, `i` will contain the index
  1557. }
  1558. }
  1559. if (!isFound) {
  1560. return false; // return false if not found
  1561. }
  1562. else {
  1563. // rewire the next sibling's prevSibling to skip
  1564. if (i < (children.length - 1)) { // there must be a next sibling
  1565. children[i + 1].prevSibling = child.prevSibling;
  1566. }
  1567. children.splice(i, 1); // remove node from the array
  1568. // unwire child from the parent/siblings
  1569. child.parent = null;
  1570. child.prevSibling = null;
  1571. this.descendantRemoved(child);
  1572. return child; // return on success (needed?)
  1573. }
  1574. };
  1575. /*
  1576. Removes all of the node's children from the hierarchy.
  1577. */
  1578. RowParent.prototype.removeChildren = function () {
  1579. for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
  1580. var child = _a[_i];
  1581. this.descendantRemoved(child);
  1582. }
  1583. this.children = [];
  1584. };
  1585. /*
  1586. Removes this node from its parent
  1587. */
  1588. RowParent.prototype.removeFromParentAndDom = function () {
  1589. if (this.parent) {
  1590. this.parent.removeChild(this);
  1591. }
  1592. if (this.get('isInDom')) {
  1593. this.removeElement();
  1594. }
  1595. };
  1596. /*
  1597. Gets the last direct child node
  1598. */
  1599. RowParent.prototype.getLastChild = function () {
  1600. var children = this.children;
  1601. return children[children.length - 1];
  1602. };
  1603. /*
  1604. Walks backward in the hierarchy to find the previous row leaf node.
  1605. When looking at the hierarchy in a flat linear fashion, this is the revealed row just before the current.
  1606. */
  1607. RowParent.prototype.getPrevRowInDom = function () {
  1608. var node = this;
  1609. while (node) {
  1610. if (node.prevSibling) {
  1611. // attempt to go into the deepest last child of the previous sibling
  1612. var lastChild = void 0;
  1613. node = node.prevSibling;
  1614. while ((lastChild = node.getLastChild())) {
  1615. node = lastChild;
  1616. }
  1617. }
  1618. else {
  1619. // otherwise, move up to the parent
  1620. node = node.parent;
  1621. }
  1622. // return this "previous" node if it has an exposed row
  1623. if (node && node.get('isInDom') && node.hasOwnRow) {
  1624. return node;
  1625. }
  1626. }
  1627. return null;
  1628. };
  1629. /*
  1630. Returns the first node in the subtree that has a revealed row
  1631. */
  1632. RowParent.prototype.getLeadingRow = function () {
  1633. if (this.hasOwnRow) {
  1634. return this;
  1635. }
  1636. else if (this.isExpanded && this.children.length) {
  1637. return this.children[0].getLeadingRow();
  1638. }
  1639. };
  1640. /*
  1641. Generates a flat array containing all the row-nodes of the subtree. Descendants + self
  1642. */
  1643. RowParent.prototype.getRows = function (batchArray) {
  1644. if (batchArray === void 0) { batchArray = []; }
  1645. if (this.hasOwnRow) {
  1646. batchArray.push(this);
  1647. }
  1648. for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
  1649. var child = _a[_i];
  1650. child.getRows(batchArray);
  1651. }
  1652. return batchArray;
  1653. };
  1654. /*
  1655. Generates a flat array containing all the nodes (row/non-row) of the subtree. Descendants + self
  1656. */
  1657. RowParent.prototype.getNodes = function (batchArray) {
  1658. if (batchArray === void 0) { batchArray = []; }
  1659. batchArray.push(this);
  1660. for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
  1661. var child = _a[_i];
  1662. child.getNodes(batchArray);
  1663. }
  1664. return batchArray;
  1665. };
  1666. /*
  1667. Generates a flat array containing all the descendant nodes the current node
  1668. */
  1669. RowParent.prototype.getDescendants = function () {
  1670. var batchArray = [];
  1671. for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
  1672. var child = _a[_i];
  1673. child.getNodes(batchArray);
  1674. }
  1675. return batchArray;
  1676. };
  1677. // Rendering
  1678. // ------------------------------------------------------------------------------------------------------------------
  1679. RowParent.prototype.show = function () {
  1680. if (!this.get('isInDom')) {
  1681. this.renderSkeleton();
  1682. }
  1683. };
  1684. RowParent.prototype.hide = function () {
  1685. if (this.get('isInDom')) {
  1686. this.removeElement();
  1687. }
  1688. };
  1689. /*
  1690. Builds and populates the TRs for each row type. Inserts them into the DOM.
  1691. Does this only for this single row. Not recursive. If not a row (hasOwnRow=false), does not render anything.
  1692. PRECONDITION: assumes the parent has already been rendered.
  1693. */
  1694. RowParent.prototype.renderSkeleton = function () {
  1695. this.trHash = {};
  1696. var trNodes = [];
  1697. if (this.hasOwnRow) { // only bother rendering TRs if we know this node has a real row
  1698. var prevRow = this.getPrevRowInDom(); // the row before this row, in the overall linear flat list
  1699. // let the view's tbody structure determine which TRs should be rendered
  1700. for (var type in this.view.tbodyHash) {
  1701. // build the TR and record it
  1702. // assign before calling the render methods, because they might rely
  1703. var tbody = this.view.tbodyHash[type];
  1704. var tr = $('<tr/>');
  1705. this.trHash[type] = tr;
  1706. trNodes.push(tr[0]);
  1707. // call the subclass' render method for this row type (if available)
  1708. var renderMethodName = 'render' + fullcalendar_1.capitaliseFirstLetter(type) + 'Skeleton';
  1709. if (this[renderMethodName]) {
  1710. this[renderMethodName](tr);
  1711. }
  1712. // insert the TR into the DOM
  1713. if (prevRow) {
  1714. prevRow.trHash[type].after(tr);
  1715. }
  1716. else {
  1717. tbody.prepend(tr); // belongs in the very first position
  1718. }
  1719. }
  1720. // build a single jQuery object. use event delegation for calling toggleExpanded
  1721. this.trs = $(trNodes)
  1722. .on('click', '.fc-expander', fullcalendar_1.proxy(this, 'toggleExpanded'));
  1723. this.thisRowShown();
  1724. }
  1725. this.set('isInDom', true);
  1726. if (this.isExpanded) {
  1727. for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
  1728. var child = _a[_i];
  1729. child.renderSkeleton();
  1730. }
  1731. }
  1732. };
  1733. /*
  1734. Unpopulates and removes all of this row's TRs from the DOM. Only for this single row. Not recursive.
  1735. Will trigger "hidden".
  1736. */
  1737. RowParent.prototype.removeElement = function () {
  1738. // call the subclass' render method for each row type (if available)
  1739. for (var type in this.trHash) {
  1740. var tr = this.trHash[type];
  1741. var unrenderMethodName = 'unrender' + fullcalendar_1.capitaliseFirstLetter(type) + 'Skeleton';
  1742. if (this[unrenderMethodName]) {
  1743. this[unrenderMethodName](tr);
  1744. }
  1745. }
  1746. this.unset('isInDom');
  1747. this.thisRowHidden();
  1748. this.trHash = {};
  1749. this.trs.remove(); // remove from DOM
  1750. this.trs = $();
  1751. for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
  1752. var child = _a[_i];
  1753. if (child.get('isInDom')) {
  1754. child.removeElement();
  1755. }
  1756. }
  1757. };
  1758. /*
  1759. A simple getter for retrieving a TR jQuery object of a certain row type
  1760. */
  1761. RowParent.prototype.getTr = function (type) {
  1762. return this.trHash[type];
  1763. };
  1764. // Expanding / Collapsing
  1765. // ------------------------------------------------------------------------------------------------------------------
  1766. // Use by row groups and rows with subrows
  1767. /*
  1768. Reveals this node's children if they have not already been revealed. Changes any expander icon.
  1769. */
  1770. RowParent.prototype.expand = function () {
  1771. if (!this.isExpanded) {
  1772. this.isExpanded = true;
  1773. this.indicateExpanded();
  1774. for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
  1775. var child = _a[_i];
  1776. child.show();
  1777. }
  1778. this.view.calendar.updateViewSize(); // notify view of dimension change
  1779. this.animateExpand();
  1780. }
  1781. };
  1782. /*
  1783. Hides this node's children if they are not already hidden. Changes any expander icon.
  1784. */
  1785. RowParent.prototype.collapse = function () {
  1786. if (this.isExpanded) {
  1787. this.isExpanded = false;
  1788. this.indicateCollapsed();
  1789. for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
  1790. var child = _a[_i];
  1791. child.hide();
  1792. }
  1793. this.view.calendar.updateViewSize(); // notify view of dimension change
  1794. }
  1795. };
  1796. /*
  1797. Switches between expanded/collapsed states
  1798. */
  1799. RowParent.prototype.toggleExpanded = function () {
  1800. if (this.isExpanded) {
  1801. this.collapse();
  1802. }
  1803. else {
  1804. this.expand();
  1805. }
  1806. };
  1807. /*
  1808. Changes the expander icon to the "expanded" state
  1809. */
  1810. RowParent.prototype.indicateExpanded = function () {
  1811. this.trs.find('.fc-expander .fc-icon')
  1812. .removeClass(this.getCollapsedIcon())
  1813. .addClass(this.getExpandedIcon());
  1814. };
  1815. /*
  1816. Changes the expander icon to the "collapsed" state
  1817. */
  1818. RowParent.prototype.indicateCollapsed = function () {
  1819. this.trs.find('.fc-expander .fc-icon')
  1820. .removeClass(this.getExpandedIcon())
  1821. .addClass(this.getCollapsedIcon());
  1822. };
  1823. RowParent.prototype.indicateExpandingEnabled = function () {
  1824. this.trs.find('.fc-expander-space')
  1825. .addClass('fc-expander');
  1826. if (this.isExpanded) {
  1827. this.indicateExpanded();
  1828. }
  1829. else {
  1830. this.indicateCollapsed();
  1831. }
  1832. };
  1833. RowParent.prototype.indicateExpandingDisabled = function () {
  1834. this.trs.find('.fc-expander-space')
  1835. .removeClass('fc-expander')
  1836. .find('.fc-icon')
  1837. .removeClass(this.getExpandedIcon())
  1838. .removeClass(this.getCollapsedIcon());
  1839. };
  1840. RowParent.prototype.updateExpandingEnabled = function () {
  1841. if (this.hasOwnRow && this.children.length) {
  1842. this.indicateExpandingEnabled();
  1843. }
  1844. else {
  1845. this.indicateExpandingDisabled();
  1846. }
  1847. };
  1848. RowParent.prototype.getExpandedIcon = function () {
  1849. return 'fc-icon-down-triangle';
  1850. };
  1851. RowParent.prototype.getCollapsedIcon = function () {
  1852. var dir = this.view.isRTL ? 'left' : 'right';
  1853. return 'fc-icon-' + dir + '-triangle';
  1854. };
  1855. /*
  1856. Causes a slide-down CSS transition to demonstrate that the expand has happened
  1857. */
  1858. RowParent.prototype.animateExpand = function () {
  1859. var firstChild = this.children[0];
  1860. var leadingRow = firstChild && firstChild.getLeadingRow();
  1861. var trs = leadingRow && leadingRow.trs;
  1862. if (trs) {
  1863. trs.addClass('fc-collapsed');
  1864. setTimeout(function () {
  1865. trs.addClass('fc-transitioning'); // enable transitioning
  1866. trs.removeClass('fc-collapsed'); // transition back to non-collapsed state
  1867. });
  1868. // cross-browser way to determine when the transition finishes
  1869. trs.one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function () {
  1870. trs.removeClass('fc-transitioning'); // will remove the overflow:hidden
  1871. });
  1872. }
  1873. };
  1874. // Sizing
  1875. // ------------------------------------------------------------------------------------------------------------------
  1876. /*
  1877. Find each TRs "inner div" (div within first cell). This div controls each TRs height.
  1878. Returns the max pixel height.
  1879. */
  1880. RowParent.prototype.getMaxTrInnerHeight = function () {
  1881. var max = 0;
  1882. $.each(this.trHash, function (type, tr) {
  1883. // exclude multi-rowspans (probably done for row grouping)
  1884. var innerEl = util_1.getOwnCells(tr).find('> div:not(.fc-cell-content):first');
  1885. max = Math.max(innerEl.height(), max);
  1886. });
  1887. return max;
  1888. };
  1889. /*
  1890. Find each TRs "inner div" and sets all of their heights to the same value.
  1891. */
  1892. RowParent.prototype.setTrInnerHeight = function (height) {
  1893. // exclude multi-rowspans (probably done for row grouping)
  1894. $.each(this.trHash, function (type, tr) {
  1895. util_1.getOwnCells(tr).find('> div:not(.fc-cell-content):first')
  1896. .height(height);
  1897. });
  1898. };
  1899. // Triggering
  1900. // ------------------------------------------------------------------------------------------------------------------
  1901. RowParent.prototype.descendantAdded = function (row) {
  1902. if (this.get('isInDom') && this.hasOwnRow && (this.children.length === 1)) {
  1903. this.indicateExpandingEnabled();
  1904. }
  1905. (this.parent || this.view).descendantAdded(row);
  1906. };
  1907. RowParent.prototype.descendantRemoved = function (row) {
  1908. if (this.get('isInDom') && this.hasOwnRow && (this.children.length === 0)) {
  1909. this.indicateExpandingDisabled();
  1910. }
  1911. (this.parent || this.view).descendantRemoved(row);
  1912. };
  1913. RowParent.prototype.thisRowShown = function () {
  1914. (this.parent || this.view).descendantShown(this);
  1915. };
  1916. RowParent.prototype.thisRowHidden = function () {
  1917. (this.parent || this.view).descendantHidden(this);
  1918. };
  1919. RowParent.prototype.descendantShown = function (row) {
  1920. (this.parent || this.view).descendantShown(row);
  1921. };
  1922. RowParent.prototype.descendantHidden = function (row) {
  1923. (this.parent || this.view).descendantHidden(row);
  1924. };
  1925. return RowParent;
  1926. }(fullcalendar_1.DateComponent));
  1927. exports.default = RowParent;
  1928. RowParent.prototype.hasOwnRow = false;
  1929. /***/ }),
  1930. /* 19 */
  1931. /***/ (function(module, exports) {
  1932. Object.defineProperty(exports, "__esModule", { value: true });
  1933. var Resource = /** @class */ (function () {
  1934. function Resource() {
  1935. }
  1936. Resource.extractIds = function (rawProps, calendar) {
  1937. var resourceField = calendar.opt('eventResourceField') || 'resourceId';
  1938. var resourceIds = [];
  1939. if (rawProps.resourceIds) {
  1940. for (var _i = 0, _a = rawProps.resourceIds; _i < _a.length; _i++) {
  1941. var rawResourceId = _a[_i];
  1942. resourceIds.push(Resource.normalizeId(rawResourceId));
  1943. }
  1944. }
  1945. if (rawProps[resourceField] != null) {
  1946. resourceIds.push(Resource.normalizeId(rawProps[resourceField]));
  1947. }
  1948. return resourceIds;
  1949. };
  1950. Resource.normalizeId = function (rawId) {
  1951. return String(rawId);
  1952. };
  1953. return Resource;
  1954. }());
  1955. exports.default = Resource;
  1956. /***/ }),
  1957. /* 20 */
  1958. /***/ (function(module, exports, __webpack_require__) {
  1959. Object.defineProperty(exports, "__esModule", { value: true });
  1960. var tslib_1 = __webpack_require__(1);
  1961. var fullcalendar_1 = __webpack_require__(0);
  1962. var ResourceViewMixin_1 = __webpack_require__(9);
  1963. var ResourceDayGrid_1 = __webpack_require__(13);
  1964. var ResourceTimeGrid_1 = __webpack_require__(38);
  1965. var ResourceAgendaView = /** @class */ (function (_super) {
  1966. tslib_1.__extends(ResourceAgendaView, _super);
  1967. function ResourceAgendaView(calendar, viewSpec) {
  1968. var _this = _super.call(this, calendar, viewSpec) || this;
  1969. _this.initResourceView();
  1970. return _this;
  1971. }
  1972. return ResourceAgendaView;
  1973. }(fullcalendar_1.AgendaView));
  1974. exports.default = ResourceAgendaView;
  1975. ResourceAgendaView.prototype.timeGridClass = ResourceTimeGrid_1.default;
  1976. ResourceAgendaView.prototype.dayGridClass = ResourceDayGrid_1.default;
  1977. ResourceViewMixin_1.default.mixInto(ResourceAgendaView);
  1978. /***/ }),
  1979. /* 21 */
  1980. /***/ (function(module, exports, __webpack_require__) {
  1981. Object.defineProperty(exports, "__esModule", { value: true });
  1982. var tslib_1 = __webpack_require__(1);
  1983. var $ = __webpack_require__(2);
  1984. var fullcalendar_1 = __webpack_require__(0);
  1985. var ResourceComponentFootprint_1 = __webpack_require__(6);
  1986. /*
  1987. Requirements:
  1988. - must be a Grid
  1989. - grid must have a view that's a ResourceView
  1990. - DayTableMixin must already be mixed in
  1991. */
  1992. var ResourceDayTableMixin = /** @class */ (function (_super) {
  1993. tslib_1.__extends(ResourceDayTableMixin, _super);
  1994. function ResourceDayTableMixin() {
  1995. return _super !== null && _super.apply(this, arguments) || this;
  1996. }
  1997. ResourceDayTableMixin.mixInto = function (destClass) {
  1998. var _this = this;
  1999. fullcalendar_1.Mixin.mixInto.call(this, destClass);
  2000. [
  2001. 'updateDayTableCols',
  2002. 'computeColCnt',
  2003. 'getColDayIndex',
  2004. 'renderHeadTrHtml',
  2005. 'renderBgCellsHtml',
  2006. 'renderBusinessHours',
  2007. 'allowCrossResource'
  2008. ].forEach(function (methodName) {
  2009. destClass.prototype[methodName] = _this.prototype[methodName];
  2010. });
  2011. };
  2012. // Resource Data
  2013. // ----------------------------------------------------------------------------------------------
  2014. // does not do any rendering. rendering is responsibility of host object
  2015. ResourceDayTableMixin.prototype.registerResources = function (resources) {
  2016. this.flattenedResources = this.flattenResources(resources);
  2017. this.resourceCnt = this.flattenedResources.length;
  2018. this.updateDayTable(); // will call computeColCnt
  2019. };
  2020. // flattens and sorts
  2021. ResourceDayTableMixin.prototype.flattenResources = function (resources) {
  2022. var sortFunc;
  2023. var orderVal = this.opt('resourceOrder');
  2024. if (orderVal) {
  2025. var orderSpecs_1 = fullcalendar_1.parseFieldSpecs(orderVal);
  2026. sortFunc = function (a, b) { return fullcalendar_1.compareByFieldSpecs(a, b, orderSpecs_1); };
  2027. }
  2028. else {
  2029. sortFunc = null;
  2030. }
  2031. var res = [];
  2032. this.accumulateResources(resources, sortFunc, res);
  2033. return res;
  2034. };
  2035. // just flattens
  2036. ResourceDayTableMixin.prototype.accumulateResources = function (resources, sortFunc, res) {
  2037. var sortedResources;
  2038. if (sortFunc) {
  2039. sortedResources = resources.slice(0); // make copy
  2040. sortedResources.sort(sortFunc); // sorts in place
  2041. }
  2042. else {
  2043. sortedResources = resources;
  2044. }
  2045. for (var _i = 0, sortedResources_1 = sortedResources; _i < sortedResources_1.length; _i++) {
  2046. var resource = sortedResources_1[_i];
  2047. res.push(resource);
  2048. this.accumulateResources(resource.children, sortFunc, res);
  2049. }
  2050. };
  2051. // Table Layout
  2052. // ----------------------------------------------------------------------------------------------
  2053. ResourceDayTableMixin.prototype.updateDayTableCols = function () {
  2054. this.datesAboveResources = this.opt('groupByDateAndResource');
  2055. fullcalendar_1.DayTableMixin.prototype.updateDayTableCols.call(this);
  2056. };
  2057. ResourceDayTableMixin.prototype.computeColCnt = function () {
  2058. return this.resourceCnt * this.daysPerRow;
  2059. };
  2060. ResourceDayTableMixin.prototype.getColDayIndex = function (col) {
  2061. if (this.isRTL) {
  2062. col = this.colCnt - 1 - col;
  2063. }
  2064. if (this.datesAboveResources) {
  2065. return Math.floor(col / (this.resourceCnt || 1));
  2066. }
  2067. else {
  2068. return col % this.daysPerRow;
  2069. }
  2070. };
  2071. ResourceDayTableMixin.prototype.getColResource = function (col) {
  2072. return this.flattenedResources[this.getColResourceIndex(col)];
  2073. };
  2074. ResourceDayTableMixin.prototype.getColResourceIndex = function (col) {
  2075. if (this.isRTL) {
  2076. col = this.colCnt - 1 - col;
  2077. }
  2078. if (this.datesAboveResources) {
  2079. return col % (this.resourceCnt || 1);
  2080. }
  2081. else {
  2082. return Math.floor(col / this.daysPerRow);
  2083. }
  2084. };
  2085. ResourceDayTableMixin.prototype.indicesToCol = function (resourceIndex, dayIndex) {
  2086. var col = this.datesAboveResources ?
  2087. (dayIndex * (this.resourceCnt || 1)) + resourceIndex :
  2088. (resourceIndex * this.daysPerRow) + dayIndex;
  2089. if (this.isRTL) {
  2090. col = this.colCnt - 1 - col;
  2091. }
  2092. return col;
  2093. };
  2094. // Header Rendering
  2095. // ----------------------------------------------------------------------------------------------
  2096. ResourceDayTableMixin.prototype.renderHeadTrHtml = function () {
  2097. if (this.daysPerRow > 1) {
  2098. // do two levels
  2099. if (this.datesAboveResources) {
  2100. return this.renderHeadDateAndResourceHtml();
  2101. }
  2102. else {
  2103. return this.renderHeadResourceAndDateHtml();
  2104. }
  2105. }
  2106. else {
  2107. // do one level
  2108. return this.renderHeadResourceHtml();
  2109. }
  2110. };
  2111. // renders one row of resources header cell
  2112. ResourceDayTableMixin.prototype.renderHeadResourceHtml = function () {
  2113. var _this = this;
  2114. var resourceHtmls = this.flattenedResources.map(function (resource) { return (_this.renderHeadResourceCellHtml(resource)); });
  2115. if (!resourceHtmls.length) {
  2116. resourceHtmls.push('<td>&nbsp;</td>');
  2117. }
  2118. return this.wrapTr(resourceHtmls, 'renderHeadIntroHtml');
  2119. };
  2120. // renders resource cells above date cells
  2121. ResourceDayTableMixin.prototype.renderHeadResourceAndDateHtml = function () {
  2122. var resourceHtmls = [];
  2123. var dateHtmls = [];
  2124. var daysPerRow = this.daysPerRow;
  2125. for (var _i = 0, _a = this.flattenedResources; _i < _a.length; _i++) {
  2126. var resource = _a[_i];
  2127. resourceHtmls.push(this.renderHeadResourceCellHtml(resource, null, this.daysPerRow));
  2128. for (var dayIndex = 0; dayIndex < daysPerRow; dayIndex++) {
  2129. var date = this.dayDates[dayIndex].clone();
  2130. dateHtmls.push(this.renderHeadResourceDateCellHtml(date, resource));
  2131. }
  2132. }
  2133. if (!resourceHtmls.length) {
  2134. resourceHtmls.push('<td>&nbsp;</td>');
  2135. }
  2136. if (!dateHtmls.length) {
  2137. dateHtmls.push('<td>&nbsp;</td>');
  2138. }
  2139. return this.wrapTr(resourceHtmls, 'renderHeadIntroHtml') +
  2140. this.wrapTr(dateHtmls, 'renderHeadIntroHtml');
  2141. };
  2142. // renders date cells above resource cells
  2143. ResourceDayTableMixin.prototype.renderHeadDateAndResourceHtml = function () {
  2144. var dateHtmls = [];
  2145. var resourceHtmls = [];
  2146. var daysPerRow = this.daysPerRow;
  2147. for (var dayIndex = 0; dayIndex < daysPerRow; dayIndex++) {
  2148. var date = this.dayDates[dayIndex].clone();
  2149. dateHtmls.push(this.renderHeadDateCellHtml(date, this.resourceCnt) // with colspan
  2150. );
  2151. for (var _i = 0, _a = this.flattenedResources; _i < _a.length; _i++) {
  2152. var resource = _a[_i];
  2153. resourceHtmls.push(this.renderHeadResourceCellHtml(resource, date));
  2154. }
  2155. }
  2156. if (!dateHtmls.length) {
  2157. dateHtmls.push('<td>&nbsp;</td>');
  2158. }
  2159. if (!resourceHtmls.length) {
  2160. resourceHtmls.push('<td>&nbsp;</td>');
  2161. }
  2162. return this.wrapTr(dateHtmls, 'renderHeadIntroHtml') +
  2163. this.wrapTr(resourceHtmls, 'renderHeadIntroHtml');
  2164. };
  2165. // given a resource and an optional date
  2166. ResourceDayTableMixin.prototype.renderHeadResourceCellHtml = function (resource, date, colspan) {
  2167. if (colspan === void 0) { colspan = 1; }
  2168. return '<th class="fc-resource-cell"' +
  2169. ' data-resource-id="' + resource.id + '"' +
  2170. (date ?
  2171. ' data-date="' + date.format('YYYY-MM-DD') + '"' :
  2172. '') +
  2173. (colspan > 1 ?
  2174. ' colspan="' + colspan + '"' :
  2175. '') +
  2176. '>' +
  2177. fullcalendar_1.htmlEscape(this.view.getResourceText(resource)) +
  2178. '</th>';
  2179. };
  2180. // given a date and a required resource
  2181. ResourceDayTableMixin.prototype.renderHeadResourceDateCellHtml = function (date, resource, colspan) {
  2182. if (colspan === void 0) { colspan = 1; }
  2183. return this.renderHeadDateCellHtml(date, colspan, 'data-resource-id="' + resource.id + '"');
  2184. };
  2185. // given a container with already rendered resource cells
  2186. ResourceDayTableMixin.prototype.processHeadResourceEls = function (containerEl) {
  2187. var _this = this;
  2188. containerEl.find('.fc-resource-cell').each(function (col, node) {
  2189. var resource;
  2190. if (_this.datesAboveResources) {
  2191. // each resource <td> is a distinct column
  2192. resource = _this.getColResource(col);
  2193. }
  2194. else {
  2195. // each resource <td> covers multiple columns of dates
  2196. resource = _this.flattenedResources[_this.isRTL ?
  2197. _this.flattenedResources.length - 1 - col :
  2198. col];
  2199. }
  2200. _this.publiclyTrigger('resourceRender', {
  2201. context: resource,
  2202. args: [
  2203. resource,
  2204. $(node),
  2205. $(),
  2206. _this.view
  2207. ]
  2208. });
  2209. });
  2210. };
  2211. // Bg Rendering
  2212. // ----------------------------------------------------------------------------------------------
  2213. // TODO: unify with DayTableMixin more, instead of completely redefining
  2214. ResourceDayTableMixin.prototype.renderBgCellsHtml = function (row) {
  2215. var htmls = [];
  2216. var colCnt = this.colCnt;
  2217. for (var col = 0; col < colCnt; col++) {
  2218. var date = this.getCellDate(row, col);
  2219. var resource = this.getColResource(col);
  2220. htmls.push(this.renderResourceBgCellHtml(date, resource));
  2221. }
  2222. if (!htmls.length) {
  2223. htmls.push('<td>&nbsp;</td>');
  2224. }
  2225. return htmls.join(''); // already accounted for RTL
  2226. };
  2227. ResourceDayTableMixin.prototype.renderResourceBgCellHtml = function (date, resource) {
  2228. return this.renderBgCellHtml(date, 'data-resource-id="' + resource.id + '"');
  2229. };
  2230. // Rendering Utils
  2231. // ----------------------------------------------------------------------------------------------
  2232. // only works for when given cells are ordered chronologically
  2233. // mutates cellHtmls
  2234. // TODO: make this a DayTableMixin utility
  2235. ResourceDayTableMixin.prototype.wrapTr = function (cellHtmls, introMethodName) {
  2236. if (this.isRTL) {
  2237. cellHtmls.reverse();
  2238. return '<tr>' +
  2239. cellHtmls.join('') +
  2240. this[introMethodName]() +
  2241. '</tr>';
  2242. }
  2243. else {
  2244. return '<tr>' +
  2245. this[introMethodName]() +
  2246. cellHtmls.join('') +
  2247. '</tr>';
  2248. }
  2249. };
  2250. // Business Hours
  2251. // ----------------------------------------------------------------------------------------------
  2252. ResourceDayTableMixin.prototype.renderBusinessHours = function (businessHourGenerator) {
  2253. var isAllDay = this.hasAllDayBusinessHours;
  2254. var unzonedRange = this.dateProfile.activeUnzonedRange;
  2255. var eventFootprints = [];
  2256. for (var _i = 0, _a = this.flattenedResources; _i < _a.length; _i++) {
  2257. var resource = _a[_i];
  2258. var eventInstanceGroup = (resource.businessHourGenerator || businessHourGenerator)
  2259. .buildEventInstanceGroup(isAllDay, unzonedRange);
  2260. if (eventInstanceGroup) {
  2261. for (var _b = 0, _c = eventInstanceGroup.sliceRenderRanges(unzonedRange); _b < _c.length; _b++) {
  2262. var eventRange = _c[_b];
  2263. eventFootprints.push(new fullcalendar_1.EventFootprint(new ResourceComponentFootprint_1.default(eventRange.unzonedRange, isAllDay, resource.id), eventRange.eventDef, eventRange.eventInstance));
  2264. }
  2265. }
  2266. }
  2267. return this.businessHourRenderer.renderEventFootprints(eventFootprints);
  2268. };
  2269. return ResourceDayTableMixin;
  2270. }(fullcalendar_1.Mixin));
  2271. exports.default = ResourceDayTableMixin;
  2272. ResourceDayTableMixin.prototype.resourceCnt = 0;
  2273. ResourceDayTableMixin.prototype.datesAboveResources = false;
  2274. ResourceDayTableMixin.prototype.allowCrossResource = false;
  2275. /***/ }),
  2276. /* 22 */
  2277. /***/ (function(module, exports, __webpack_require__) {
  2278. Object.defineProperty(exports, "__esModule", { value: true });
  2279. var tslib_1 = __webpack_require__(1);
  2280. var fullcalendar_1 = __webpack_require__(0);
  2281. var ResourceViewMixin_1 = __webpack_require__(9);
  2282. var ResourceDayGrid_1 = __webpack_require__(13);
  2283. var ResourceBasicView = /** @class */ (function (_super) {
  2284. tslib_1.__extends(ResourceBasicView, _super);
  2285. function ResourceBasicView(calendar, viewSpec) {
  2286. var _this = _super.call(this, calendar, viewSpec) || this;
  2287. _this.initResourceView();
  2288. return _this;
  2289. }
  2290. return ResourceBasicView;
  2291. }(fullcalendar_1.BasicView));
  2292. exports.default = ResourceBasicView;
  2293. ResourceBasicView.prototype.dayGridClass = ResourceDayGrid_1.default;
  2294. ResourceViewMixin_1.default.mixInto(ResourceBasicView);
  2295. /***/ }),
  2296. /* 23 */
  2297. /***/ (function(module, exports, __webpack_require__) {
  2298. Object.defineProperty(exports, "__esModule", { value: true });
  2299. var tslib_1 = __webpack_require__(1);
  2300. var fullcalendar_1 = __webpack_require__(0);
  2301. var ResourceViewMixin_1 = __webpack_require__(9);
  2302. var ResourceDayGrid_1 = __webpack_require__(13);
  2303. var ResourceMonthView = /** @class */ (function (_super) {
  2304. tslib_1.__extends(ResourceMonthView, _super);
  2305. function ResourceMonthView(calendar, viewSpec) {
  2306. var _this = _super.call(this, calendar, viewSpec) || this;
  2307. _this.initResourceView();
  2308. return _this;
  2309. }
  2310. return ResourceMonthView;
  2311. }(fullcalendar_1.MonthView));
  2312. exports.default = ResourceMonthView;
  2313. ResourceMonthView.prototype.dayGridClass = ResourceDayGrid_1.default;
  2314. ResourceViewMixin_1.default.mixInto(ResourceMonthView);
  2315. /***/ }),
  2316. /* 24 */
  2317. /***/ (function(module, exports, __webpack_require__) {
  2318. Object.defineProperty(exports, "__esModule", { value: true });
  2319. var tslib_1 = __webpack_require__(1);
  2320. var $ = __webpack_require__(2);
  2321. var fullcalendar_1 = __webpack_require__(0);
  2322. var EnhancedScroller_1 = __webpack_require__(39);
  2323. /*
  2324. A Scroller, but with a wrapping div that allows "clipping" away of native scrollbars,
  2325. giving the appearance that there are no scrollbars.
  2326. */
  2327. var ClippedScroller = /** @class */ (function (_super) {
  2328. tslib_1.__extends(ClippedScroller, _super);
  2329. /*
  2330. Received overflows can be set to 'clipped', meaning scrollbars shouldn't be visible
  2331. to the user, but the area should still scroll.
  2332. */
  2333. function ClippedScroller(options) {
  2334. var _this = _super.call(this, options) || this;
  2335. _this.isHScrollbarsClipped = false;
  2336. _this.isVScrollbarsClipped = false;
  2337. if (_this.overflowX === 'clipped-scroll') {
  2338. _this.overflowX = 'scroll';
  2339. _this.isHScrollbarsClipped = true;
  2340. }
  2341. if (_this.overflowY === 'clipped-scroll') {
  2342. _this.overflowY = 'scroll';
  2343. _this.isVScrollbarsClipped = true;
  2344. }
  2345. return _this;
  2346. }
  2347. ClippedScroller.prototype.renderEl = function () {
  2348. var scrollEl = _super.prototype.renderEl.call(this);
  2349. return $('<div class="fc-scroller-clip" />').append(scrollEl); // return value
  2350. };
  2351. ClippedScroller.prototype.updateSize = function () {
  2352. var scrollEl = this.scrollEl;
  2353. var scrollbarWidths = fullcalendar_1.getScrollbarWidths(scrollEl); // the native ones
  2354. var cssProps = { marginLeft: 0, marginRight: 0, marginTop: 0, marginBottom: 0 };
  2355. // give the inner scrolling div negative margins so that its scrollbars
  2356. // are nudged outside of the bounding box of the wrapper, which is overflow:hidden
  2357. if (this.isHScrollbarsClipped) {
  2358. cssProps.marginTop = -scrollbarWidths.top;
  2359. cssProps.marginBottom = -scrollbarWidths.bottom;
  2360. }
  2361. if (this.isVScrollbarsClipped) {
  2362. cssProps.marginLeft = -scrollbarWidths.left;
  2363. cssProps.marginRight = -scrollbarWidths.right;
  2364. }
  2365. scrollEl.css(cssProps);
  2366. // if we are attempting to hide the scrollbars offscreen, OSX/iOS will still
  2367. // display the floating scrollbars. attach a className to force-hide them.
  2368. return scrollEl.toggleClass('fc-no-scrollbars', (this.isHScrollbarsClipped || (this.overflowX === 'hidden')) && // should never show?
  2369. (this.isVScrollbarsClipped || (this.overflowY === 'hidden')) && // should never show?
  2370. !( // doesn't have any scrollbar mass
  2371. scrollbarWidths.top ||
  2372. scrollbarWidths.bottom ||
  2373. scrollbarWidths.left ||
  2374. scrollbarWidths.right));
  2375. };
  2376. /*
  2377. Accounts for 'clipped' scrollbars
  2378. */
  2379. ClippedScroller.prototype.getScrollbarWidths = function () {
  2380. var widths = fullcalendar_1.getScrollbarWidths(this.scrollEl);
  2381. if (this.isHScrollbarsClipped) {
  2382. widths.top = 0;
  2383. widths.bottom = 0;
  2384. }
  2385. if (this.isVScrollbarsClipped) {
  2386. widths.left = 0;
  2387. widths.right = 0;
  2388. }
  2389. return widths;
  2390. };
  2391. return ClippedScroller;
  2392. }(EnhancedScroller_1.default));
  2393. exports.default = ClippedScroller;
  2394. /***/ }),
  2395. /* 25 */
  2396. /***/ (function(module, exports, __webpack_require__) {
  2397. Object.defineProperty(exports, "__esModule", { value: true });
  2398. var $ = __webpack_require__(2);
  2399. /*
  2400. A rectangular area of content that lives within a Scroller.
  2401. Can have "gutters", areas of dead spacing around the perimeter.
  2402. Also very useful for forcing a width, which a Scroller cannot do alone.
  2403. Has a content area that lives above a background area.
  2404. */
  2405. var ScrollerCanvas = /** @class */ (function () {
  2406. function ScrollerCanvas() {
  2407. this.gutters = {};
  2408. }
  2409. ScrollerCanvas.prototype.render = function () {
  2410. this.el = $("<div class=\"fc-scroller-canvas\"> <div class=\"fc-content\"></div> <div class=\"fc-bg\"></div> </div>");
  2411. this.contentEl = this.el.find('.fc-content');
  2412. this.bgEl = this.el.find('.fc-bg');
  2413. };
  2414. /*
  2415. If falsy, resets all the gutters to 0
  2416. */
  2417. ScrollerCanvas.prototype.setGutters = function (gutters) {
  2418. if (!gutters) {
  2419. this.gutters = {};
  2420. }
  2421. else {
  2422. $.extend(this.gutters, gutters);
  2423. }
  2424. this.updateSize();
  2425. };
  2426. ScrollerCanvas.prototype.setWidth = function (width) {
  2427. this.width = width;
  2428. this.updateSize();
  2429. };
  2430. ScrollerCanvas.prototype.setMinWidth = function (minWidth) {
  2431. this.minWidth = minWidth;
  2432. this.updateSize();
  2433. };
  2434. ScrollerCanvas.prototype.clearWidth = function () {
  2435. this.width = null;
  2436. this.minWidth = null;
  2437. this.updateSize();
  2438. };
  2439. ScrollerCanvas.prototype.updateSize = function () {
  2440. var gutters = this.gutters;
  2441. this.el // is border-box (width includes padding)
  2442. .toggleClass('fc-gutter-left', Boolean(gutters.left))
  2443. .toggleClass('fc-gutter-right', Boolean(gutters.right))
  2444. .toggleClass('fc-gutter-top', Boolean(gutters.top))
  2445. .toggleClass('fc-gutter-bottom', Boolean(gutters.bottom))
  2446. .css({
  2447. paddingLeft: gutters.left || '',
  2448. paddingRight: gutters.right || '',
  2449. paddingTop: gutters.top || '',
  2450. paddingBottom: gutters.bottom || '',
  2451. width: (this.width != null) ?
  2452. this.width + (gutters.left || 0) + (gutters.right || 0) :
  2453. '',
  2454. minWidth: (this.minWidth != null) ?
  2455. this.minWidth + (gutters.left || 0) + (gutters.right || 0) :
  2456. ''
  2457. });
  2458. this.bgEl.css({
  2459. left: gutters.left || '',
  2460. right: gutters.right || '',
  2461. top: gutters.top || '',
  2462. bottom: gutters.bottom || ''
  2463. });
  2464. };
  2465. return ScrollerCanvas;
  2466. }());
  2467. exports.default = ScrollerCanvas;
  2468. /***/ }),
  2469. /* 26 */
  2470. /***/ (function(module, exports, __webpack_require__) {
  2471. Object.defineProperty(exports, "__esModule", { value: true });
  2472. var $ = __webpack_require__(2);
  2473. var fullcalendar_1 = __webpack_require__(0);
  2474. var ScrollFollowerSprite_1 = __webpack_require__(27);
  2475. var ScrollFollower = /** @class */ (function () {
  2476. function ScrollFollower(scroller, allowPointerEvents) {
  2477. if (allowPointerEvents === void 0) { allowPointerEvents = false; }
  2478. var _this = this;
  2479. this.isHFollowing = true;
  2480. this.isVFollowing = false;
  2481. this.allowPointerEvents = false;
  2482. this.containOnNaturalLeft = false;
  2483. this.containOnNaturalRight = false;
  2484. this.minTravel = 0;
  2485. this.allowPointerEvents = allowPointerEvents;
  2486. this.scroller = scroller;
  2487. this.spritesById = {};
  2488. scroller.on('scroll', function () {
  2489. if (scroller.isTouchedEver) {
  2490. // touch devices should only updated after the scroll is over
  2491. _this.isTouch = true;
  2492. _this.isForcedRelative = true; // touch devices scroll too quick to make absolute ever look good
  2493. }
  2494. else {
  2495. _this.isTouch = false;
  2496. // this.isForcedRelative = false // why?
  2497. _this.handleScroll();
  2498. }
  2499. });
  2500. // for touch devices
  2501. scroller.on('scrollEnd', function () {
  2502. _this.handleScroll();
  2503. });
  2504. }
  2505. // TODO: have a destroy method.
  2506. // View's whose skeletons get destroyed should unregister their scrollfollowers.
  2507. /*
  2508. `els` is as a jQuery set of elements.
  2509. If elements are already position:relative, is a performance benefit.
  2510. */
  2511. ScrollFollower.prototype.setSpriteEls = function (els) {
  2512. var _this = this;
  2513. this.clearSprites();
  2514. els.each(function (i, node) {
  2515. _this.addSprite(new ScrollFollowerSprite_1.default($(node)));
  2516. });
  2517. };
  2518. ScrollFollower.prototype.clearSprites = function () {
  2519. this.iterSprites(function (sprite) { return sprite.clear(); });
  2520. this.spritesById = {};
  2521. };
  2522. ScrollFollower.prototype.addSprite = function (sprite) {
  2523. sprite.follower = this;
  2524. this.spritesById[sprite.id] = sprite;
  2525. };
  2526. ScrollFollower.prototype.removeSprite = function (sprite) {
  2527. sprite.clear();
  2528. delete this.spritesById[sprite.id];
  2529. };
  2530. ScrollFollower.prototype.handleScroll = function () {
  2531. this.updateViewport();
  2532. this.updatePositions();
  2533. };
  2534. ScrollFollower.prototype.cacheDimensions = function () {
  2535. this.updateViewport();
  2536. this.scrollbarWidths = this.scroller.getScrollbarWidths();
  2537. this.contentOffset = this.scroller.canvas.el.offset();
  2538. this.iterSprites(function (sprite) { return sprite.cacheDimensions(); });
  2539. };
  2540. ScrollFollower.prototype.updateViewport = function () {
  2541. var scroller = this.scroller;
  2542. var left = scroller.getScrollFromLeft();
  2543. var top = scroller.getScrollTop();
  2544. // TODO: use getViewportRect() for getting this rect
  2545. return this.viewportRect = {
  2546. left: left,
  2547. right: left + scroller.getClientWidth(),
  2548. top: top,
  2549. bottom: top + scroller.getClientHeight()
  2550. };
  2551. };
  2552. ScrollFollower.prototype.forceRelative = function () {
  2553. if (!this.isForcedRelative) {
  2554. this.isForcedRelative = true;
  2555. this.iterSprites(function (sprite) {
  2556. if (sprite.doAbsolute) {
  2557. return sprite.assignPosition();
  2558. }
  2559. });
  2560. }
  2561. };
  2562. ScrollFollower.prototype.clearForce = function () {
  2563. if (this.isForcedRelative && !this.isTouch) { // don't allow touch to ever NOT be relative
  2564. this.isForcedRelative = false;
  2565. this.iterSprites(function (sprite) { return sprite.assignPosition(); });
  2566. }
  2567. };
  2568. ScrollFollower.prototype.update = function () {
  2569. this.cacheDimensions();
  2570. this.updatePositions();
  2571. };
  2572. ScrollFollower.prototype.updatePositions = function () {
  2573. this.iterSprites(function (sprite) { return sprite.updatePosition(); });
  2574. };
  2575. // relative to inner content pane
  2576. ScrollFollower.prototype.getContentRect = function (el) {
  2577. return fullcalendar_1.getContentRect(el, this.contentOffset);
  2578. };
  2579. // relative to inner content pane
  2580. ScrollFollower.prototype.getBoundingRect = function (el) {
  2581. return fullcalendar_1.getOuterRect(el, this.contentOffset);
  2582. };
  2583. ScrollFollower.prototype.iterSprites = function (func) {
  2584. for (var id in this.spritesById) {
  2585. var sprite = this.spritesById[id];
  2586. func(sprite, id);
  2587. }
  2588. };
  2589. return ScrollFollower;
  2590. }());
  2591. exports.default = ScrollFollower;
  2592. /***/ }),
  2593. /* 27 */
  2594. /***/ (function(module, exports, __webpack_require__) {
  2595. Object.defineProperty(exports, "__esModule", { value: true });
  2596. var fullcalendar_1 = __webpack_require__(0);
  2597. var ScrollFollowerSprite = /** @class */ (function () {
  2598. /*
  2599. If given el is already position:relative, is a performance gain
  2600. */
  2601. function ScrollFollowerSprite(el) {
  2602. this.isEnabled = true;
  2603. this.isHFollowing = false;
  2604. this.isVFollowing = false;
  2605. this.doAbsolute = false;
  2606. this.isAbsolute = false;
  2607. this.isCentered = false;
  2608. this.isBlock = false;
  2609. this.el = el;
  2610. this.id = String(ScrollFollowerSprite.uid++);
  2611. this.isBlock = this.el.css('display') === 'block';
  2612. if (this.el.css('position') !== 'relative') {
  2613. this.el.css('position', 'relative');
  2614. }
  2615. }
  2616. ScrollFollowerSprite.prototype.disable = function () {
  2617. if (this.isEnabled) {
  2618. this.isEnabled = false;
  2619. this.resetPosition();
  2620. this.unabsolutize();
  2621. }
  2622. };
  2623. ScrollFollowerSprite.prototype.enable = function () {
  2624. if (!this.isEnabled) {
  2625. this.isEnabled = true;
  2626. this.assignPosition();
  2627. }
  2628. };
  2629. ScrollFollowerSprite.prototype.clear = function () {
  2630. this.disable();
  2631. this.follower = null;
  2632. this.absoluteEl = null;
  2633. };
  2634. ScrollFollowerSprite.prototype.cacheDimensions = function () {
  2635. var isHFollowing = false;
  2636. var isVFollowing = false;
  2637. var isCentered = false;
  2638. this.naturalWidth = this.el.width();
  2639. this.resetPosition();
  2640. var follower = this.follower;
  2641. var naturalRect = (this.naturalRect = follower.getBoundingRect(this.el));
  2642. var parentEl = this.el.parent();
  2643. this.parentRect = follower.getBoundingRect(parentEl);
  2644. var containerRect = (this.containerRect = joinRects(follower.getContentRect(parentEl), naturalRect));
  2645. var minTravel = follower.minTravel;
  2646. if (follower.containOnNaturalLeft) {
  2647. containerRect.left = naturalRect.left;
  2648. }
  2649. if (follower.containOnNaturalRight) {
  2650. containerRect.right = naturalRect.right;
  2651. }
  2652. if (follower.isHFollowing) {
  2653. if ((getRectWidth(containerRect) - getRectWidth(naturalRect)) >= minTravel) {
  2654. isCentered = this.el.css('text-align') === 'center';
  2655. isHFollowing = true;
  2656. }
  2657. }
  2658. if (follower.isVFollowing) {
  2659. if ((getRectHeight(containerRect) - getRectHeight(naturalRect)) >= minTravel) {
  2660. isVFollowing = true;
  2661. }
  2662. }
  2663. this.isHFollowing = isHFollowing;
  2664. this.isVFollowing = isVFollowing;
  2665. this.isCentered = isCentered;
  2666. };
  2667. ScrollFollowerSprite.prototype.updatePosition = function () {
  2668. this.computePosition();
  2669. this.assignPosition();
  2670. };
  2671. ScrollFollowerSprite.prototype.resetPosition = function () {
  2672. this.el.css({
  2673. top: '',
  2674. left: ''
  2675. });
  2676. };
  2677. ScrollFollowerSprite.prototype.computePosition = function () {
  2678. var viewportRect = this.follower.viewportRect;
  2679. var parentRect = this.parentRect;
  2680. var containerRect = this.containerRect;
  2681. var visibleParentRect = fullcalendar_1.intersectRects(viewportRect, parentRect);
  2682. var rect = null;
  2683. var doAbsolute = false;
  2684. if (visibleParentRect) { // is parent element onscreen?
  2685. rect = copyRect(this.naturalRect);
  2686. var subjectRect = fullcalendar_1.intersectRects(rect, parentRect);
  2687. // will we need to reposition?
  2688. if ((this.isCentered && !testRectContains(viewportRect, parentRect)) || // centering and container not completely in view?
  2689. (subjectRect && !testRectContains(viewportRect, subjectRect))) { // subject not completely in view?
  2690. doAbsolute = true;
  2691. if (this.isHFollowing) {
  2692. if (this.isCentered) {
  2693. var rectWidth = getRectWidth(rect);
  2694. rect.left = ((visibleParentRect.left + visibleParentRect.right) / 2) - (rectWidth / 2);
  2695. rect.right = rect.left + rectWidth;
  2696. }
  2697. else {
  2698. if (!hContainRect(rect, viewportRect)) { // move into view. already there?
  2699. doAbsolute = false;
  2700. }
  2701. }
  2702. if (hContainRect(rect, containerRect)) { // move within container. needed to move?
  2703. doAbsolute = false;
  2704. }
  2705. }
  2706. if (this.isVFollowing) {
  2707. if (!vContainRect(rect, viewportRect)) { // move into view. already there?
  2708. doAbsolute = false;
  2709. }
  2710. if (vContainRect(rect, containerRect)) { // move within container. needed to move?
  2711. doAbsolute = false;
  2712. }
  2713. }
  2714. if (!testRectContains(viewportRect, rect)) { // partially offscreen?
  2715. doAbsolute = false;
  2716. }
  2717. }
  2718. }
  2719. this.rect = rect;
  2720. this.doAbsolute = doAbsolute;
  2721. };
  2722. ScrollFollowerSprite.prototype.assignPosition = function () {
  2723. if (this.isEnabled) {
  2724. if (!this.rect) { // completely offscreen?
  2725. this.unabsolutize();
  2726. }
  2727. else if (this.doAbsolute && !this.follower.isForcedRelative) {
  2728. this.absolutize();
  2729. this.absoluteEl.css({
  2730. top: (this.rect.top - this.follower.viewportRect.top) + this.follower.scrollbarWidths.top,
  2731. left: (this.rect.left - this.follower.viewportRect.left) + this.follower.scrollbarWidths.left,
  2732. width: this.isBlock ? this.naturalWidth : ''
  2733. });
  2734. }
  2735. else {
  2736. var top_1 = this.rect.top - this.naturalRect.top;
  2737. var left = this.rect.left - this.naturalRect.left;
  2738. this.unabsolutize();
  2739. this.el.toggleClass('fc-following', Boolean(top_1 || left))
  2740. .css({
  2741. top: top_1,
  2742. left: left
  2743. });
  2744. }
  2745. }
  2746. };
  2747. ScrollFollowerSprite.prototype.absolutize = function () {
  2748. if (!this.isAbsolute) {
  2749. if (!this.absoluteEl) {
  2750. this.absoluteEl = this.buildAbsoluteEl();
  2751. }
  2752. this.absoluteEl.appendTo(this.follower.scroller.el);
  2753. this.el.css('visibility', 'hidden');
  2754. this.isAbsolute = true;
  2755. }
  2756. };
  2757. ScrollFollowerSprite.prototype.unabsolutize = function () {
  2758. if (this.isAbsolute) {
  2759. this.absoluteEl.detach();
  2760. this.el.css('visibility', '');
  2761. this.isAbsolute = false;
  2762. }
  2763. };
  2764. ScrollFollowerSprite.prototype.buildAbsoluteEl = function () {
  2765. var el = this.el.clone().addClass('fc-following');
  2766. el.css({
  2767. 'position': 'absolute',
  2768. 'z-index': 1000,
  2769. 'font-weight': this.el.css('font-weight'),
  2770. 'font-size': this.el.css('font-size'),
  2771. 'font-family': this.el.css('font-family'),
  2772. 'text-decoration': this.el.css('text-decoration'),
  2773. 'color': this.el.css('color'),
  2774. 'padding-top': this.el.css('padding-top'),
  2775. 'padding-bottom': this.el.css('padding-bottom'),
  2776. 'padding-left': this.el.css('padding-left'),
  2777. 'padding-right': this.el.css('padding-right')
  2778. });
  2779. if (!this.follower.allowPointerEvents) {
  2780. el.css('pointer-events', 'none');
  2781. }
  2782. return el;
  2783. };
  2784. ScrollFollowerSprite.uid = 0;
  2785. return ScrollFollowerSprite;
  2786. }());
  2787. exports.default = ScrollFollowerSprite;
  2788. // Geometry Utils
  2789. // ----------------------------------------------------------------------------------------------------------------------
  2790. // TODO: move somewhere more common
  2791. function copyRect(rect) {
  2792. return {
  2793. left: rect.left,
  2794. right: rect.right,
  2795. top: rect.top,
  2796. bottom: rect.bottom
  2797. };
  2798. }
  2799. function getRectWidth(rect) {
  2800. return rect.right - rect.left;
  2801. }
  2802. function getRectHeight(rect) {
  2803. return rect.bottom - rect.top;
  2804. }
  2805. function testRectContains(rect, innerRect) {
  2806. return testRectHContains(rect, innerRect) && testRectVContains(rect, innerRect);
  2807. }
  2808. function testRectHContains(rect, innerRect) {
  2809. return (innerRect.left >= rect.left) && (innerRect.right <= rect.right);
  2810. }
  2811. function testRectVContains(rect, innerRect) {
  2812. return (innerRect.top >= rect.top) && (innerRect.bottom <= rect.bottom);
  2813. }
  2814. function hContainRect(rect, outerRect) {
  2815. if (rect.left < outerRect.left) {
  2816. rect.right = outerRect.left + getRectWidth(rect);
  2817. rect.left = outerRect.left;
  2818. return true;
  2819. }
  2820. else if (rect.right > outerRect.right) {
  2821. rect.left = outerRect.right - getRectWidth(rect);
  2822. rect.right = outerRect.right;
  2823. return true;
  2824. }
  2825. else {
  2826. return false;
  2827. }
  2828. }
  2829. function vContainRect(rect, outerRect) {
  2830. if (rect.top < outerRect.top) {
  2831. rect.bottom = outerRect.top + getRectHeight(rect);
  2832. rect.top = outerRect.top;
  2833. return true;
  2834. }
  2835. else if (rect.bottom > outerRect.bottom) {
  2836. rect.top = outerRect.bottom - getRectHeight(rect);
  2837. rect.bottom = outerRect.bottom;
  2838. return true;
  2839. }
  2840. else {
  2841. return false;
  2842. }
  2843. }
  2844. function joinRects(rect1, rect2) {
  2845. return {
  2846. left: Math.min(rect1.left, rect2.left),
  2847. right: Math.max(rect1.right, rect2.right),
  2848. top: Math.min(rect1.top, rect2.top),
  2849. bottom: Math.max(rect1.bottom, rect2.bottom)
  2850. };
  2851. }
  2852. /***/ }),
  2853. /* 28 */
  2854. /***/ (function(module, exports, __webpack_require__) {
  2855. Object.defineProperty(exports, "__esModule", { value: true });
  2856. var tslib_1 = __webpack_require__(1);
  2857. var $ = __webpack_require__(2);
  2858. var fullcalendar_1 = __webpack_require__(0);
  2859. var TimelineFillRenderer = /** @class */ (function (_super) {
  2860. tslib_1.__extends(TimelineFillRenderer, _super);
  2861. function TimelineFillRenderer() {
  2862. return _super !== null && _super.apply(this, arguments) || this;
  2863. }
  2864. /*
  2865. component must be { bgSegContainerEl, rangeToCoords }
  2866. */
  2867. TimelineFillRenderer.prototype.attachSegEls = function (type, segs) {
  2868. if (segs.length) {
  2869. var className = void 0;
  2870. if (type === 'businessHours') {
  2871. className = 'bgevent';
  2872. }
  2873. else {
  2874. className = type.toLowerCase();
  2875. }
  2876. // making a new container each time is OKAY
  2877. // all types of segs (background or business hours or whatever) are rendered in one pass
  2878. var containerEl = $('<div class="fc-' + className + '-container" />')
  2879. .appendTo(this.component.bgSegContainerEl);
  2880. for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {
  2881. var seg = segs_1[_i];
  2882. var coords = this.component.rangeToCoords(seg); // TODO: make DRY
  2883. seg.el.css({
  2884. left: (seg.left = coords.left),
  2885. right: -(seg.right = coords.right)
  2886. });
  2887. seg.el.appendTo(containerEl);
  2888. }
  2889. return containerEl; // return value
  2890. }
  2891. };
  2892. return TimelineFillRenderer;
  2893. }(fullcalendar_1.FillRenderer));
  2894. exports.default = TimelineFillRenderer;
  2895. /***/ }),
  2896. /* 29 */
  2897. /***/ (function(module, exports, __webpack_require__) {
  2898. Object.defineProperty(exports, "__esModule", { value: true });
  2899. var tslib_1 = __webpack_require__(1);
  2900. var $ = __webpack_require__(2);
  2901. var fullcalendar_1 = __webpack_require__(0);
  2902. var TimelineHelperRenderer = /** @class */ (function (_super) {
  2903. tslib_1.__extends(TimelineHelperRenderer, _super);
  2904. function TimelineHelperRenderer() {
  2905. return _super !== null && _super.apply(this, arguments) || this;
  2906. }
  2907. /*
  2908. component must be { innerEl, rangeToCoords, ?resource }
  2909. */
  2910. TimelineHelperRenderer.prototype.renderSegs = function (segs, sourceSeg) {
  2911. var helperNodes = []; // .fc-event-container
  2912. for (var _i = 0, segs_1 = segs; _i < segs_1.length; _i++) {
  2913. var seg = segs_1[_i];
  2914. // TODO: centralize logic (also in renderFgSegsInContainers)
  2915. var coords = this.component.rangeToCoords(seg);
  2916. seg.el.css({
  2917. left: (seg.left = coords.left),
  2918. right: -(seg.right = coords.right)
  2919. });
  2920. // TODO: detangle the concept of resources
  2921. // TODO: how to identify these two segs as the same!?
  2922. if (sourceSeg && (sourceSeg.resourceId === (this.component.resource != null ? this.component.resource.id : undefined))) {
  2923. seg.el.css('top', sourceSeg.el.css('top'));
  2924. }
  2925. else {
  2926. seg.el.css('top', 0);
  2927. }
  2928. }
  2929. var helperContainerEl = $('<div class="fc-event-container fc-helper-container"/>')
  2930. .appendTo(this.component.innerEl);
  2931. helperNodes.push(helperContainerEl[0]);
  2932. for (var _a = 0, segs_2 = segs; _a < segs_2.length; _a++) {
  2933. var seg = segs_2[_a];
  2934. helperContainerEl.append(seg.el);
  2935. }
  2936. return $(helperNodes); // return value. TODO: need to accumulate across calls?
  2937. };
  2938. return TimelineHelperRenderer;
  2939. }(fullcalendar_1.HelperRenderer));
  2940. exports.default = TimelineHelperRenderer;
  2941. /***/ }),
  2942. /* 30 */
  2943. /***/ (function(module, exports, __webpack_require__) {
  2944. Object.defineProperty(exports, "__esModule", { value: true });
  2945. var tslib_1 = __webpack_require__(1);
  2946. var $ = __webpack_require__(2);
  2947. var fullcalendar_1 = __webpack_require__(0);
  2948. var ScrollJoiner_1 = __webpack_require__(16);
  2949. var ResourceComponentFootprint_1 = __webpack_require__(6);
  2950. var ResourceViewMixin_1 = __webpack_require__(9);
  2951. var TimelineView_1 = __webpack_require__(14);
  2952. var Spreadsheet_1 = __webpack_require__(43);
  2953. var ResourceTimelineEventRenderer_1 = __webpack_require__(45);
  2954. var RowParent_1 = __webpack_require__(18);
  2955. var ResourceRow_1 = __webpack_require__(46);
  2956. var HRowGroup_1 = __webpack_require__(47);
  2957. var VRowGroup_1 = __webpack_require__(31);
  2958. var EventRow_1 = __webpack_require__(33);
  2959. var ResourceTimelineView = /** @class */ (function (_super) {
  2960. tslib_1.__extends(ResourceTimelineView, _super);
  2961. function ResourceTimelineView(calendar, viewSpec) {
  2962. var _this = _super.call(this, calendar, viewSpec) || this;
  2963. _this.canHandleSpecificResources = true;
  2964. _this.isResourceFootprintsEnabled = true;
  2965. _this.nestingCnt = 0;
  2966. _this.indiBizCnt = 0;
  2967. _this.isIndiBizRendered = false;
  2968. _this.isGenericBizRendered = false;
  2969. _this.initResourceView();
  2970. _this.processResourceOptions();
  2971. _this.spreadsheet = new Spreadsheet_1.default(_this);
  2972. _this.rowHierarchy = new RowParent_1.default(_this);
  2973. _this.rowHierarchy.isExpanded = true; // hack to always show, regardless of resourcesInitiallyExpanded
  2974. _this.resourceRowHash = {};
  2975. return _this;
  2976. }
  2977. // Resource Options
  2978. // ------------------------------------------------------------------------------------------------------------------
  2979. ResourceTimelineView.prototype.processResourceOptions = function () {
  2980. var allColSpecs = this.opt('resourceColumns') || [];
  2981. var labelText = this.opt('resourceLabelText'); // TODO: view.override
  2982. var defaultLabelText = 'Resources'; // TODO: view.defaults
  2983. var superHeaderText = null;
  2984. if (!allColSpecs.length) {
  2985. allColSpecs.push({
  2986. labelText: labelText || defaultLabelText,
  2987. text: this.getResourceTextFunc()
  2988. });
  2989. }
  2990. else {
  2991. superHeaderText = labelText;
  2992. }
  2993. var plainColSpecs = [];
  2994. var groupColSpecs = [];
  2995. var groupSpecs = [];
  2996. var isVGrouping = false;
  2997. var isHGrouping = false;
  2998. for (var _i = 0, allColSpecs_1 = allColSpecs; _i < allColSpecs_1.length; _i++) {
  2999. var colSpec = allColSpecs_1[_i];
  3000. if (colSpec.group) {
  3001. groupColSpecs.push(colSpec);
  3002. }
  3003. else {
  3004. plainColSpecs.push(colSpec);
  3005. }
  3006. }
  3007. plainColSpecs[0].isMain = true;
  3008. if (groupColSpecs.length) {
  3009. groupSpecs = groupColSpecs;
  3010. isVGrouping = true;
  3011. }
  3012. else {
  3013. var hGroupField = this.opt('resourceGroupField');
  3014. if (hGroupField) {
  3015. isHGrouping = true;
  3016. groupSpecs.push({
  3017. field: hGroupField,
  3018. text: this.opt('resourceGroupText'),
  3019. render: this.opt('resourceGroupRender')
  3020. });
  3021. }
  3022. }
  3023. var allOrderSpecs = fullcalendar_1.parseFieldSpecs(this.opt('resourceOrder'));
  3024. var plainOrderSpecs = [];
  3025. for (var _a = 0, allOrderSpecs_1 = allOrderSpecs; _a < allOrderSpecs_1.length; _a++) {
  3026. var orderSpec = allOrderSpecs_1[_a];
  3027. var isGroup = false;
  3028. for (var _b = 0, groupSpecs_1 = groupSpecs; _b < groupSpecs_1.length; _b++) {
  3029. var groupSpec = groupSpecs_1[_b];
  3030. if (groupSpec.field === orderSpec.field) {
  3031. groupSpec.order = orderSpec.order; // -1, 0, 1
  3032. isGroup = true;
  3033. break;
  3034. }
  3035. }
  3036. if (!isGroup) {
  3037. plainOrderSpecs.push(orderSpec);
  3038. }
  3039. }
  3040. this.superHeaderText = superHeaderText;
  3041. this.isVGrouping = isVGrouping;
  3042. this.isHGrouping = isHGrouping;
  3043. this.groupSpecs = groupSpecs;
  3044. this.colSpecs = groupColSpecs.concat(plainColSpecs);
  3045. this.orderSpecs = plainOrderSpecs;
  3046. };
  3047. // Skeleton Rendering
  3048. // ------------------------------------------------------------------------------------------------------------------
  3049. ResourceTimelineView.prototype.renderSkeleton = function () {
  3050. _super.prototype.renderSkeleton.call(this);
  3051. var theme = this.calendar.theme;
  3052. this.spreadsheet.el = this.el.find('tbody .fc-resource-area');
  3053. this.spreadsheet.headEl = this.el.find('thead .fc-resource-area');
  3054. this.spreadsheet.renderSkeleton();
  3055. // ^ is not a Grid/DateComponent
  3056. // only non-resource grid needs this, so kill it
  3057. // TODO: look into better solution
  3058. this.segContainerEl.remove();
  3059. this.segContainerEl = null;
  3060. var timeBodyContainerEl = $("<div class=\"fc-rows\"> <table class=\"" + theme.getClass('tableGrid') + "\"> <tbody/> </table> </div>").appendTo(this.timeBodyScroller.canvas.contentEl);
  3061. this.timeBodyTbodyEl = timeBodyContainerEl.find('tbody');
  3062. this.tbodyHash = {
  3063. spreadsheet: this.spreadsheet.tbodyEl,
  3064. event: this.timeBodyTbodyEl
  3065. };
  3066. this.resourceScrollJoiner = new ScrollJoiner_1.default('vertical', [
  3067. this.spreadsheet.bodyScroller,
  3068. this.timeBodyScroller
  3069. ]);
  3070. this.initDividerMoving();
  3071. };
  3072. ResourceTimelineView.prototype.renderSkeletonHtml = function () {
  3073. var theme = this.calendar.theme;
  3074. return "<table class=\"" + theme.getClass('tableGrid') + "\"> <thead class=\"fc-head\"> <tr> <td class=\"fc-resource-area " + theme.getClass('widgetHeader') + "\"></td> <td class=\"fc-divider fc-col-resizer " + theme.getClass('widgetHeader') + "\"></td> <td class=\"fc-time-area " + theme.getClass('widgetHeader') + "\"></td> </tr> </thead> <tbody class=\"fc-body\"> <tr> <td class=\"fc-resource-area " + theme.getClass('widgetContent') + "\"></td> <td class=\"fc-divider fc-col-resizer " + theme.getClass('widgetHeader') + "\"></td> <td class=\"fc-time-area " + theme.getClass('widgetContent') + "\"></td> </tr> </tbody> </table>";
  3075. };
  3076. // Divider Moving
  3077. // ------------------------------------------------------------------------------------------------------------------
  3078. ResourceTimelineView.prototype.initDividerMoving = function () {
  3079. var _this = this;
  3080. var left = this.opt('resourceAreaWidth');
  3081. this.dividerEls = this.el.find('.fc-divider');
  3082. // tableWidth available after spreadsheet.renderSkeleton
  3083. this.dividerWidth = left != null ? left : this.spreadsheet.tableWidth;
  3084. if (this.dividerWidth != null) {
  3085. this.positionDivider(this.dividerWidth);
  3086. }
  3087. this.dividerEls.on('mousedown', function (ev) {
  3088. _this.dividerMousedown(ev);
  3089. });
  3090. };
  3091. ResourceTimelineView.prototype.dividerMousedown = function (ev) {
  3092. var _this = this;
  3093. var isRTL = this.opt('isRTL');
  3094. var minWidth = 30;
  3095. var maxWidth = this.el.width() - 30;
  3096. var origWidth = this.getNaturalDividerWidth();
  3097. var dragListener = new fullcalendar_1.DragListener({
  3098. dragStart: function () {
  3099. _this.dividerEls.addClass('fc-active');
  3100. },
  3101. drag: function (dx, dy) {
  3102. var width;
  3103. if (isRTL) {
  3104. width = origWidth - dx;
  3105. }
  3106. else {
  3107. width = origWidth + dx;
  3108. }
  3109. width = Math.max(width, minWidth);
  3110. width = Math.min(width, maxWidth);
  3111. _this.dividerWidth = width;
  3112. _this.positionDivider(width);
  3113. _this.calendar.updateViewSize();
  3114. },
  3115. dragEnd: function () {
  3116. _this.dividerEls.removeClass('fc-active');
  3117. }
  3118. });
  3119. dragListener.startInteraction(ev);
  3120. };
  3121. ResourceTimelineView.prototype.getNaturalDividerWidth = function () {
  3122. return this.el.find('.fc-resource-area').width(); // TODO: don't we have this cached?
  3123. };
  3124. ResourceTimelineView.prototype.positionDivider = function (w) {
  3125. this.el.find('.fc-resource-area').css('width', w); // TODO: don't we have this cached?
  3126. };
  3127. // Sizing
  3128. // ------------------------------------------------------------------------------------------------------------------
  3129. ResourceTimelineView.prototype.updateSize = function (totalHeight, isAuto, isResize) {
  3130. var bodyHeight;
  3131. if (this.rowsNeedingHeightSync) {
  3132. this.syncRowHeights(this.rowsNeedingHeightSync);
  3133. this.rowsNeedingHeightSync = null;
  3134. }
  3135. else { // a resize or an event rerender
  3136. this.syncRowHeights(); // sync all
  3137. }
  3138. var headHeight = this.syncHeadHeights();
  3139. if (isAuto) {
  3140. bodyHeight = 'auto';
  3141. }
  3142. else {
  3143. bodyHeight = totalHeight - headHeight - this.queryMiscHeight();
  3144. }
  3145. this.timeBodyScroller.setHeight(bodyHeight);
  3146. this.spreadsheet.bodyScroller.setHeight(bodyHeight);
  3147. this.spreadsheet.updateSize();
  3148. // do children AFTER because of ScrollFollowerSprite abs position issues
  3149. _super.prototype.updateSize.call(this, totalHeight, isAuto, isResize);
  3150. // do once spreadsheet area and event slat area have correct height, for gutters
  3151. this.resourceScrollJoiner.update();
  3152. };
  3153. ResourceTimelineView.prototype.queryMiscHeight = function () {
  3154. return this.el.outerHeight() -
  3155. Math.max(this.spreadsheet.headScroller.el.outerHeight(), this.timeHeadScroller.el.outerHeight()) -
  3156. Math.max(this.spreadsheet.bodyScroller.el.outerHeight(), this.timeBodyScroller.el.outerHeight());
  3157. };
  3158. ResourceTimelineView.prototype.syncHeadHeights = function () {
  3159. this.spreadsheet.headHeight('auto');
  3160. this.headHeight('auto');
  3161. var headHeight = Math.max(this.spreadsheet.headHeight(), this.headHeight());
  3162. this.spreadsheet.headHeight(headHeight);
  3163. this.headHeight(headHeight);
  3164. return headHeight;
  3165. };
  3166. // Scrolling
  3167. // ------------------------------------------------------------------------------------------------------------------
  3168. // this is useful for scrolling prev/next dates while resource is scrolled down
  3169. ResourceTimelineView.prototype.queryResourceScroll = function () {
  3170. var scroll = {};
  3171. var scrollerTop = this.timeBodyScroller.scrollEl.offset().top; // TODO: use getClientRect
  3172. for (var _i = 0, _a = this.getVisibleRows(); _i < _a.length; _i++) {
  3173. var rowObj = _a[_i];
  3174. if (rowObj.resource) {
  3175. var el = rowObj.getTr('event');
  3176. var elBottom = el.offset().top + el.outerHeight();
  3177. if (elBottom > scrollerTop) {
  3178. scroll.resourceId = rowObj.resource.id;
  3179. scroll.bottom = elBottom - scrollerTop;
  3180. break;
  3181. }
  3182. }
  3183. }
  3184. // TODO: what about left scroll state for spreadsheet area?
  3185. return scroll;
  3186. };
  3187. ResourceTimelineView.prototype.applyResourceScroll = function (scroll) {
  3188. if (scroll.resourceId) {
  3189. var row = this.getResourceRow(scroll.resourceId);
  3190. if (row) {
  3191. var el = row.getTr('event');
  3192. if (el) {
  3193. var innerTop = this.timeBodyScroller.canvas.el.offset().top; // TODO: use -scrollHeight or something
  3194. var elBottom = el.offset().top + el.outerHeight();
  3195. var scrollTop = elBottom - scroll.bottom - innerTop;
  3196. this.timeBodyScroller.setScrollTop(scrollTop);
  3197. this.spreadsheet.bodyScroller.setScrollTop(scrollTop);
  3198. }
  3199. }
  3200. }
  3201. };
  3202. ResourceTimelineView.prototype.scrollToResource = function (resource) {
  3203. var row = this.getResourceRow(resource.id);
  3204. if (row) {
  3205. var el = row.getTr('event');
  3206. if (el) {
  3207. var innerTop = this.timeBodyScroller.canvas.el.offset().top; // TODO: use -scrollHeight or something
  3208. var scrollTop = el.offset().top - innerTop;
  3209. this.timeBodyScroller.setScrollTop(scrollTop);
  3210. this.spreadsheet.bodyScroller.setScrollTop(scrollTop);
  3211. }
  3212. }
  3213. };
  3214. // Hit System
  3215. // ------------------------------------------------------------------------------------------------------------------
  3216. ResourceTimelineView.prototype.prepareHits = function () {
  3217. var shownEventRows = [];
  3218. _super.prototype.prepareHits.call(this);
  3219. this.eventRows = this.getEventRows();
  3220. this.eventRows.forEach(function (row) {
  3221. if (row.get('isInDom')) {
  3222. shownEventRows.push(row);
  3223. }
  3224. });
  3225. var trArray = shownEventRows.map(function (row) { return (row.getTr('event')[0]); });
  3226. this.shownEventRows = shownEventRows;
  3227. this.rowCoordCache = new fullcalendar_1.CoordCache({
  3228. els: trArray,
  3229. isVertical: true
  3230. });
  3231. this.rowCoordCache.build();
  3232. };
  3233. ResourceTimelineView.prototype.releaseHits = function () {
  3234. _super.prototype.releaseHits.call(this);
  3235. this.eventRows = null;
  3236. this.shownEventRows = null;
  3237. this.rowCoordCache.clear();
  3238. };
  3239. ResourceTimelineView.prototype.queryHit = function (leftOffset, topOffset) {
  3240. var simpleHit = _super.prototype.queryHit.call(this, leftOffset, topOffset);
  3241. if (simpleHit) {
  3242. var rowIndex = this.rowCoordCache.getVerticalIndex(topOffset);
  3243. if (rowIndex != null) {
  3244. return {
  3245. resourceId: this.shownEventRows[rowIndex].resource.id,
  3246. snap: simpleHit.snap,
  3247. component: this,
  3248. left: simpleHit.left,
  3249. right: simpleHit.right,
  3250. top: this.rowCoordCache.getTopOffset(rowIndex),
  3251. bottom: this.rowCoordCache.getBottomOffset(rowIndex)
  3252. };
  3253. }
  3254. }
  3255. };
  3256. ResourceTimelineView.prototype.getHitFootprint = function (hit) {
  3257. var componentFootprint = _super.prototype.getHitFootprint.call(this, hit);
  3258. return new ResourceComponentFootprint_1.default(componentFootprint.unzonedRange, componentFootprint.isAllDay, hit.resourceId);
  3259. };
  3260. ResourceTimelineView.prototype.getHitEl = function (hit) {
  3261. return this.getSnapEl(hit.snap);
  3262. };
  3263. // Resource Data
  3264. // ------------------------------------------------------------------------------------------------------------------
  3265. ResourceTimelineView.prototype.renderResources = function (resources) {
  3266. for (var _i = 0, resources_1 = resources; _i < resources_1.length; _i++) {
  3267. var resource = resources_1[_i];
  3268. this.renderResource(resource);
  3269. }
  3270. };
  3271. ResourceTimelineView.prototype.unrenderResources = function () {
  3272. this.rowHierarchy.removeElement();
  3273. this.rowHierarchy.removeChildren();
  3274. for (var id in this.resourceRowHash) {
  3275. this.removeChild(this.resourceRowHash[id]); // for DateComponent!
  3276. }
  3277. this.resourceRowHash = {};
  3278. };
  3279. ResourceTimelineView.prototype.renderResource = function (resource) {
  3280. this.insertResource(resource);
  3281. };
  3282. ResourceTimelineView.prototype.unrenderResource = function (resource) {
  3283. this.removeResource(resource);
  3284. };
  3285. // Event Rendering
  3286. // ------------------------------------------------------------------------------------------------------------------
  3287. ResourceTimelineView.prototype.executeEventRender = function (eventsPayload) {
  3288. var payloadsByResourceId = {};
  3289. var genericPayload = {};
  3290. var resourceId;
  3291. for (var eventDefId in eventsPayload) {
  3292. var eventInstanceGroup = eventsPayload[eventDefId];
  3293. var eventDef = eventInstanceGroup.getEventDef();
  3294. var resourceIds = eventDef.getResourceIds();
  3295. if (resourceIds.length) {
  3296. for (var _i = 0, resourceIds_1 = resourceIds; _i < resourceIds_1.length; _i++) {
  3297. resourceId = resourceIds_1[_i];
  3298. var bucket = payloadsByResourceId[resourceId] || (payloadsByResourceId[resourceId] = {});
  3299. bucket[eventDefId] = eventInstanceGroup;
  3300. }
  3301. // only render bg segs that have no resources
  3302. }
  3303. else if (eventDef.hasBgRendering()) {
  3304. genericPayload[eventDefId] = eventInstanceGroup;
  3305. }
  3306. }
  3307. this.eventRenderer.render(genericPayload);
  3308. for (resourceId in payloadsByResourceId) {
  3309. var resourceEventsPayload = payloadsByResourceId[resourceId];
  3310. var row = this.getResourceRow(resourceId);
  3311. if (row) {
  3312. row.executeEventRender(resourceEventsPayload);
  3313. }
  3314. }
  3315. };
  3316. // Business Hours Rendering
  3317. // ------------------------------------------------------------------------------------------------------------------
  3318. ResourceTimelineView.prototype.renderBusinessHours = function (businessHourGenerator) {
  3319. this.genericBiz = businessHourGenerator; // save for later
  3320. this.isIndiBizRendered = false;
  3321. this.isGenericBizRendered = false;
  3322. if (this.indiBizCnt) {
  3323. this.isIndiBizRendered = true;
  3324. for (var _i = 0, _a = this.getEventRows(); _i < _a.length; _i++) {
  3325. var row = _a[_i];
  3326. row.renderBusinessHours(row.resource.businessHourGenerator ||
  3327. businessHourGenerator);
  3328. }
  3329. }
  3330. else {
  3331. this.isGenericBizRendered = true;
  3332. this.businessHourRenderer.render(businessHourGenerator);
  3333. }
  3334. };
  3335. ResourceTimelineView.prototype.updateIndiBiz = function () {
  3336. if ((this.indiBizCnt && this.isGenericBizRendered) ||
  3337. (!this.indiBizCnt && this.isIndiBizRendered)) {
  3338. this.unrenderBusinessHours();
  3339. this.renderBusinessHours(this.genericBiz);
  3340. }
  3341. };
  3342. // Row Management
  3343. // ------------------------------------------------------------------------------------------------------------------
  3344. // creates a row for the given resource and inserts it into the hierarchy.
  3345. // if `parentResourceRow` is given, inserts it as a direct child
  3346. // does not render
  3347. ResourceTimelineView.prototype.insertResource = function (resource, parentResourceRow) {
  3348. var noExplicitParent = !parentResourceRow;
  3349. var row = new ResourceRow_1.default(this, resource);
  3350. if (!parentResourceRow) {
  3351. if (resource.parent) {
  3352. parentResourceRow = this.getResourceRow(resource.parent.id);
  3353. }
  3354. else if (resource.parentId) {
  3355. parentResourceRow = this.getResourceRow(resource.parentId);
  3356. }
  3357. }
  3358. if (parentResourceRow) {
  3359. this.insertRowAsChild(row, parentResourceRow);
  3360. }
  3361. else {
  3362. this.insertRow(row);
  3363. }
  3364. this.addChild(row); // for DateComponent!
  3365. this.resourceRowHash[resource.id] = row;
  3366. if (resource.businessHourGenerator) {
  3367. this.indiBizCnt++;
  3368. // hack to get dynamically-added resources with custom business hours to render
  3369. if (this.isIndiBizRendered) {
  3370. row.businessHourGenerator = resource.businessHourGenerator;
  3371. }
  3372. this.updateIndiBiz();
  3373. }
  3374. for (var _i = 0, _a = resource.children; _i < _a.length; _i++) {
  3375. var childResource = _a[_i];
  3376. this.insertResource(childResource, row);
  3377. }
  3378. if (noExplicitParent && computeIsChildrenVisible(row.parent)) {
  3379. row.renderSkeleton();
  3380. }
  3381. return row;
  3382. };
  3383. // does not unrender
  3384. ResourceTimelineView.prototype.removeResource = function (resource) {
  3385. var row = this.resourceRowHash[resource.id];
  3386. if (row) {
  3387. delete this.resourceRowHash[resource.id];
  3388. this.removeChild(row); // for DateComponent!
  3389. row.removeFromParentAndDom();
  3390. if (resource.businessHourGenerator) {
  3391. this.indiBizCnt--;
  3392. this.updateIndiBiz();
  3393. }
  3394. }
  3395. return row;
  3396. };
  3397. // inserts the given row into the hierarchy.
  3398. // `parent` can be any tree root of the hierarchy.
  3399. // `orderSpecs` will recursively create groups within the root before inserting the row.
  3400. ResourceTimelineView.prototype.insertRow = function (row, parent, groupSpecs) {
  3401. if (parent === void 0) { parent = this.rowHierarchy; }
  3402. if (groupSpecs === void 0) { groupSpecs = this.groupSpecs; }
  3403. if (groupSpecs.length) {
  3404. var group = this.ensureResourceGroup(row, parent, groupSpecs[0]);
  3405. if (group instanceof HRowGroup_1.default) {
  3406. this.insertRowAsChild(row, group); // horizontal rows can only be one level deep
  3407. }
  3408. else {
  3409. this.insertRow(row, group, groupSpecs.slice(1));
  3410. }
  3411. }
  3412. else {
  3413. this.insertRowAsChild(row, parent);
  3414. }
  3415. };
  3416. // inserts the given row as a direct child of the given parent
  3417. ResourceTimelineView.prototype.insertRowAsChild = function (row, parent) {
  3418. return parent.addChildRowNode(row, this.computeChildRowPosition(row, parent));
  3419. };
  3420. // computes the position at which the given node should be inserted into the parent's children
  3421. // if no specific position is determined, returns null
  3422. ResourceTimelineView.prototype.computeChildRowPosition = function (child, parent) {
  3423. if (this.orderSpecs.length) {
  3424. for (var i = 0; i < parent.children.length; i++) {
  3425. var sibling = parent.children[i];
  3426. var cmp = this.compareResources(sibling.resource || {}, child.resource || {});
  3427. if (cmp > 0) { // went 1 past. insert at i
  3428. return i;
  3429. }
  3430. }
  3431. }
  3432. return null;
  3433. };
  3434. // given two resources, returns a cmp value (-1, 0, 1)
  3435. ResourceTimelineView.prototype.compareResources = function (a, b) {
  3436. return fullcalendar_1.compareByFieldSpecs(a, b, this.orderSpecs);
  3437. };
  3438. // given information on how a row should be inserted into one of the parent's child groups,
  3439. // ensure a child group exists, creating it if necessary, and then return it.
  3440. // spec MIGHT NOT HAVE AN ORDER
  3441. ResourceTimelineView.prototype.ensureResourceGroup = function (row, parent, spec) {
  3442. var i;
  3443. var testGroup;
  3444. var groupValue = (row.resource || {})[spec.field]; // the groupValue of the row
  3445. var group = null;
  3446. // find an existing group that matches, or determine the position for a new group
  3447. if (spec.order) {
  3448. for (i = 0; i < parent.children.length; i++) {
  3449. testGroup = parent.children[i];
  3450. var cmp = fullcalendar_1.flexibleCompare(testGroup.groupValue, groupValue) * spec.order;
  3451. if (cmp === 0) { // an exact match with an existing group
  3452. group = testGroup;
  3453. break;
  3454. }
  3455. else if (cmp > 0) { // the row's desired group is after testGroup. insert at this position
  3456. break;
  3457. }
  3458. }
  3459. }
  3460. else { // the groups are unordered
  3461. for (i = 0; i < parent.children.length; i++) {
  3462. testGroup = parent.children[i];
  3463. if (testGroup.groupValue === groupValue) {
  3464. group = testGroup;
  3465. break;
  3466. }
  3467. }
  3468. } // `i` will be at the end if group was not found
  3469. // create a new group
  3470. if (!group) {
  3471. if (this.isVGrouping) {
  3472. group = new VRowGroup_1.default(this, spec, groupValue);
  3473. }
  3474. else {
  3475. group = new HRowGroup_1.default(this, spec, groupValue);
  3476. }
  3477. parent.addChildRowNode(group, i);
  3478. group.renderSkeleton(); // always immediately render groups
  3479. }
  3480. return group;
  3481. };
  3482. // Row Rendering
  3483. // ------------------------------------------------------------------------------------------------------------------
  3484. ResourceTimelineView.prototype.descendantAdded = function (row) {
  3485. var wasNesting = this.isNesting;
  3486. var isNesting = Boolean(this.nestingCnt += row.depth ? 1 : 0);
  3487. if (wasNesting !== isNesting) {
  3488. this.el.toggleClass('fc-nested', isNesting)
  3489. .toggleClass('fc-flat', !isNesting);
  3490. this.isNesting = isNesting;
  3491. }
  3492. };
  3493. ResourceTimelineView.prototype.descendantRemoved = function (row) {
  3494. var wasNesting = this.isNesting;
  3495. var isNesting = Boolean(this.nestingCnt -= row.depth ? 1 : 0);
  3496. if (wasNesting !== isNesting) {
  3497. this.el.toggleClass('fc-nested', isNesting)
  3498. .toggleClass('fc-flat', !isNesting);
  3499. this.isNesting = isNesting;
  3500. }
  3501. };
  3502. ResourceTimelineView.prototype.descendantShown = function (row) {
  3503. (this.rowsNeedingHeightSync || (this.rowsNeedingHeightSync = [])).push(row);
  3504. };
  3505. ResourceTimelineView.prototype.descendantHidden = function (row) {
  3506. if (!this.rowsNeedingHeightSync) { // signals to updateSize that specific rows hidden
  3507. this.rowsNeedingHeightSync = [];
  3508. }
  3509. };
  3510. // visibleRows is flat. does not do recursive
  3511. ResourceTimelineView.prototype.syncRowHeights = function (visibleRows, safe) {
  3512. if (visibleRows === void 0) { visibleRows = this.getVisibleRows(); }
  3513. if (safe === void 0) { safe = false; }
  3514. for (var _i = 0, visibleRows_1 = visibleRows; _i < visibleRows_1.length; _i++) {
  3515. var row = visibleRows_1[_i];
  3516. row.setTrInnerHeight('');
  3517. }
  3518. var innerHeights = visibleRows.map(function (row) {
  3519. var h = row.getMaxTrInnerHeight();
  3520. if (safe) {
  3521. h += h % 2; // FF and zoom only like even numbers for alignment
  3522. }
  3523. return h;
  3524. });
  3525. for (var i = 0; i < visibleRows.length; i++) {
  3526. var row = visibleRows[i];
  3527. row.setTrInnerHeight(innerHeights[i]);
  3528. }
  3529. if (!safe) {
  3530. var h1 = this.spreadsheet.tbodyEl.height();
  3531. var h2 = this.timeBodyTbodyEl.height();
  3532. if (Math.abs(h1 - h2) > 1) {
  3533. this.syncRowHeights(visibleRows, true);
  3534. }
  3535. }
  3536. };
  3537. // Row Querying
  3538. // ------------------------------------------------------------------------------------------------------------------
  3539. ResourceTimelineView.prototype.getVisibleRows = function () {
  3540. var result = [];
  3541. for (var _i = 0, _a = this.rowHierarchy.getRows(); _i < _a.length; _i++) {
  3542. var row = _a[_i];
  3543. if (row.get('isInDom')) {
  3544. result.push(row);
  3545. }
  3546. }
  3547. return result;
  3548. };
  3549. ResourceTimelineView.prototype.getEventRows = function () {
  3550. return this.rowHierarchy.getRows().filter(function (row) { return (row instanceof EventRow_1.default); });
  3551. };
  3552. ResourceTimelineView.prototype.getResourceRow = function (resourceId) {
  3553. return this.resourceRowHash[resourceId];
  3554. };
  3555. // Selection
  3556. // ------------------------------------------------------------------------------------------------------------------
  3557. ResourceTimelineView.prototype.renderSelectionFootprint = function (componentFootprint) {
  3558. if (componentFootprint.resourceId) {
  3559. var rowObj = this.getResourceRow(componentFootprint.resourceId);
  3560. if (rowObj) {
  3561. return rowObj.renderSelectionFootprint(componentFootprint);
  3562. }
  3563. }
  3564. else {
  3565. return _super.prototype.renderSelectionFootprint.call(this, componentFootprint);
  3566. }
  3567. };
  3568. // Event Resizing (route to rows)
  3569. // ------------------------------------------------------------------------------------------------------------------
  3570. ResourceTimelineView.prototype.renderEventResize = function (eventFootprints, seg, isTouch) {
  3571. var map = groupEventFootprintsByResourceId(eventFootprints);
  3572. for (var resourceId in map) {
  3573. var resourceEventFootprints = map[resourceId];
  3574. var rowObj = this.getResourceRow(resourceId);
  3575. // render helpers
  3576. rowObj.helperRenderer.renderEventDraggingFootprints(resourceEventFootprints, seg, isTouch);
  3577. // render highlight
  3578. for (var _i = 0, resourceEventFootprints_1 = resourceEventFootprints; _i < resourceEventFootprints_1.length; _i++) {
  3579. var eventFootprint = resourceEventFootprints_1[_i];
  3580. rowObj.renderHighlight(eventFootprint.componentFootprint);
  3581. }
  3582. }
  3583. };
  3584. ResourceTimelineView.prototype.unrenderEventResize = function () {
  3585. for (var _i = 0, _a = this.getEventRows(); _i < _a.length; _i++) {
  3586. var rowObj = _a[_i];
  3587. rowObj.helperRenderer.unrender();
  3588. rowObj.unrenderHighlight();
  3589. }
  3590. };
  3591. // DnD (route to rows)
  3592. // ------------------------------------------------------------------------------------------------------------------
  3593. ResourceTimelineView.prototype.renderDrag = function (eventFootprints, seg, isTouch) {
  3594. var map = groupEventFootprintsByResourceId(eventFootprints);
  3595. var resourceEventFootprints;
  3596. var resourceId;
  3597. var rowObj;
  3598. if (seg) {
  3599. // draw helper
  3600. for (resourceId in map) {
  3601. resourceEventFootprints = map[resourceId];
  3602. rowObj = this.getResourceRow(resourceId);
  3603. rowObj.helperRenderer.renderEventDraggingFootprints(resourceEventFootprints, seg, isTouch);
  3604. }
  3605. return true; // signal helper rendered
  3606. }
  3607. else {
  3608. // draw highlight
  3609. for (resourceId in map) {
  3610. resourceEventFootprints = map[resourceId];
  3611. for (var _i = 0, resourceEventFootprints_2 = resourceEventFootprints; _i < resourceEventFootprints_2.length; _i++) {
  3612. var eventFootprint = resourceEventFootprints_2[_i];
  3613. rowObj = this.getResourceRow(resourceId);
  3614. rowObj.renderHighlight(eventFootprint.componentFootprint);
  3615. }
  3616. }
  3617. return false; // signal helper not rendered
  3618. }
  3619. };
  3620. ResourceTimelineView.prototype.unrenderDrag = function () {
  3621. for (var _i = 0, _a = this.getEventRows(); _i < _a.length; _i++) {
  3622. var rowObj = _a[_i];
  3623. rowObj.helperRenderer.unrender();
  3624. rowObj.unrenderHighlight();
  3625. }
  3626. };
  3627. return ResourceTimelineView;
  3628. }(TimelineView_1.default));
  3629. exports.default = ResourceTimelineView;
  3630. ResourceTimelineView.prototype.eventRendererClass = ResourceTimelineEventRenderer_1.default;
  3631. ResourceViewMixin_1.default.mixInto(ResourceTimelineView);
  3632. // Utils
  3633. // ------------------------------------------------------------------------------------------------------------------
  3634. function groupEventFootprintsByResourceId(eventFootprints) {
  3635. var map = {};
  3636. for (var _i = 0, eventFootprints_1 = eventFootprints; _i < eventFootprints_1.length; _i++) {
  3637. var eventFootprint = eventFootprints_1[_i];
  3638. (map[eventFootprint.componentFootprint.resourceId] || (map[eventFootprint.componentFootprint.resourceId] = []))
  3639. .push(eventFootprint);
  3640. }
  3641. return map;
  3642. }
  3643. /*
  3644. if `current` is null, returns true
  3645. */
  3646. function computeIsChildrenVisible(current) {
  3647. while (current) {
  3648. if (!current.isExpanded) {
  3649. return false;
  3650. }
  3651. current = current.parent;
  3652. }
  3653. return true;
  3654. }
  3655. /***/ }),
  3656. /* 31 */
  3657. /***/ (function(module, exports, __webpack_require__) {
  3658. Object.defineProperty(exports, "__esModule", { value: true });
  3659. var tslib_1 = __webpack_require__(1);
  3660. var $ = __webpack_require__(2);
  3661. var RowGroup_1 = __webpack_require__(32);
  3662. /*
  3663. A row grouping that renders as a tall multi-cell vertical span in the "spreadsheet" area
  3664. */
  3665. var VRowGroup = /** @class */ (function (_super) {
  3666. tslib_1.__extends(VRowGroup, _super);
  3667. function VRowGroup(view, groupSpec, groupValue) {
  3668. var _this = _super.call(this, view, groupSpec, groupValue) || this;
  3669. _this.rowspan = 0;
  3670. return _this;
  3671. }
  3672. /*
  3673. Makes sure the groupTd has the correct rowspan / place in the DOM.
  3674. PRECONDITION: in the case of multiple group nesting, a child's renderRowspan()
  3675. will be called before the parent's renderRowspan().
  3676. */
  3677. VRowGroup.prototype.renderRowspan = function () {
  3678. var leadingTr;
  3679. var theme = this.view.calendar.theme;
  3680. if (this.rowspan) { // takes up at least one row?
  3681. // ensure the TD element
  3682. if (!this.groupTd) {
  3683. this.groupTd = $('<td class="' + theme.getClass('widgetContent') + '"/>')
  3684. .append(this.renderGroupContentEl());
  3685. }
  3686. this.groupTd.attr('rowspan', this.rowspan);
  3687. // (re)insert groupTd if it was never inserted, or the first TR is different
  3688. leadingTr = this.getLeadingRow().getTr('spreadsheet');
  3689. if (leadingTr !== this.leadingTr) {
  3690. if (leadingTr) { // might not exist if child was unrendered before parent
  3691. leadingTr.prepend(this.groupTd); // parents will later prepend their own
  3692. }
  3693. this.leadingTr = leadingTr;
  3694. }
  3695. }
  3696. else { // takes up zero rows?
  3697. // remove the TD element if it was rendered
  3698. if (this.groupTd) {
  3699. this.groupTd.remove();
  3700. this.groupTd = null;
  3701. }
  3702. this.leadingTr = null;
  3703. }
  3704. };
  3705. /*
  3706. Called when a row somewhere within the grouping is shown
  3707. */
  3708. VRowGroup.prototype.descendantShown = function (row) {
  3709. this.rowspan += 1;
  3710. this.renderRowspan();
  3711. _super.prototype.descendantShown.call(this, row); // will bubble to parent
  3712. };
  3713. /*
  3714. Called when a row somewhere within the grouping is hidden
  3715. */
  3716. VRowGroup.prototype.descendantHidden = function (row) {
  3717. this.rowspan -= 1;
  3718. this.renderRowspan();
  3719. _super.prototype.descendantHidden.call(this, row);
  3720. };
  3721. return VRowGroup;
  3722. }(RowGroup_1.default));
  3723. exports.default = VRowGroup;
  3724. /***/ }),
  3725. /* 32 */
  3726. /***/ (function(module, exports, __webpack_require__) {
  3727. Object.defineProperty(exports, "__esModule", { value: true });
  3728. var tslib_1 = __webpack_require__(1);
  3729. var $ = __webpack_require__(2);
  3730. var RowParent_1 = __webpack_require__(18);
  3731. /*
  3732. An abstract node in a row-hierarchy tree that contains other nodes.
  3733. Will have some sort of rendered label indicating the grouping,
  3734. up to the subclass for determining what to do with it.
  3735. */
  3736. var RowGroup = /** @class */ (function (_super) {
  3737. tslib_1.__extends(RowGroup, _super);
  3738. function RowGroup(view, groupSpec, groupValue) {
  3739. var _this = _super.call(this, view) || this;
  3740. _this.groupSpec = groupSpec;
  3741. _this.groupValue = groupValue;
  3742. return _this;
  3743. }
  3744. /*
  3745. Called when this row (if it renders a row) or a subrow is removed
  3746. */
  3747. RowGroup.prototype.descendantRemoved = function (row) {
  3748. _super.prototype.descendantRemoved.call(this, row); // bubble up to the view and let the node be fully removed
  3749. // and there are no more children in the group, implictly remove this group as well
  3750. if (!this.children.length) {
  3751. this.removeFromParentAndDom();
  3752. }
  3753. };
  3754. /*
  3755. Renders the content wrapper element that will be inserted into this row's TD cell
  3756. */
  3757. RowGroup.prototype.renderGroupContentEl = function () {
  3758. var contentEl = $('<div class="fc-cell-content" />')
  3759. .append(this.renderGroupTextEl());
  3760. var filter = this.groupSpec.render;
  3761. if (typeof filter === 'function') {
  3762. contentEl = filter(contentEl, this.groupValue) || contentEl;
  3763. }
  3764. return contentEl;
  3765. };
  3766. /*
  3767. Renders the text span element that will be inserted into this row's TD cell.
  3768. Goes within the content element.
  3769. */
  3770. RowGroup.prototype.renderGroupTextEl = function () {
  3771. var text = this.groupValue || ''; // might be null/undefined if an ad-hoc grouping
  3772. var filter = this.groupSpec.text;
  3773. if (typeof filter === 'function') {
  3774. text = filter(text) || text;
  3775. }
  3776. return $('<span class="fc-cell-text" />').text(text);
  3777. };
  3778. return RowGroup;
  3779. }(RowParent_1.default));
  3780. exports.default = RowGroup;
  3781. /***/ }),
  3782. /* 33 */
  3783. /***/ (function(module, exports, __webpack_require__) {
  3784. Object.defineProperty(exports, "__esModule", { value: true });
  3785. var tslib_1 = __webpack_require__(1);
  3786. var fullcalendar_1 = __webpack_require__(0);
  3787. var RowParent_1 = __webpack_require__(18);
  3788. var TimelineFillRenderer_1 = __webpack_require__(28);
  3789. var TimelineEventRenderer_1 = __webpack_require__(17);
  3790. var TimelineHelperRenderer_1 = __webpack_require__(29);
  3791. var EventRow = /** @class */ (function (_super) {
  3792. tslib_1.__extends(EventRow, _super);
  3793. function EventRow() {
  3794. return _super !== null && _super.apply(this, arguments) || this;
  3795. }
  3796. EventRow.prototype.renderEventSkeleton = function (tr) {
  3797. var theme = this.view.calendar.theme;
  3798. tr.html("<td class=\"" + theme.getClass('widgetContent') + "\"> <div> <div class=\"fc-event-container\" /> </div> </td>");
  3799. this.segContainerEl = tr.find('.fc-event-container');
  3800. this.innerEl = (this.bgSegContainerEl = tr.find('td > div'));
  3801. };
  3802. EventRow.prototype.rangeToCoords = function (range) {
  3803. return this.view.rangeToCoords(range);
  3804. };
  3805. EventRow.prototype.componentFootprintToSegs = function (componentFootprint) {
  3806. return this.view.componentFootprintToSegs(componentFootprint);
  3807. };
  3808. return EventRow;
  3809. }(RowParent_1.default));
  3810. exports.default = EventRow;
  3811. EventRow.prototype.fillRendererClass = TimelineFillRenderer_1.default;
  3812. EventRow.prototype.eventRendererClass = TimelineEventRenderer_1.default;
  3813. EventRow.prototype.helperRendererClass = TimelineHelperRenderer_1.default;
  3814. EventRow.prototype.businessHourRendererClass = fullcalendar_1.BusinessHourRenderer;
  3815. EventRow.prototype.hasOwnRow = true;
  3816. /***/ }),
  3817. /* 34 */,
  3818. /* 35 */,
  3819. /* 36 */
  3820. /***/ (function(module, exports, __webpack_require__) {
  3821. Object.defineProperty(exports, "__esModule", { value: true });
  3822. var exportHooks = __webpack_require__(0);
  3823. // imports solely for side-effects
  3824. __webpack_require__(37);
  3825. __webpack_require__(48);
  3826. __webpack_require__(50);
  3827. __webpack_require__(51);
  3828. __webpack_require__(53);
  3829. __webpack_require__(54);
  3830. __webpack_require__(55);
  3831. __webpack_require__(56);
  3832. __webpack_require__(57);
  3833. __webpack_require__(58);
  3834. __webpack_require__(59);
  3835. __webpack_require__(60);
  3836. __webpack_require__(61);
  3837. __webpack_require__(62);
  3838. __webpack_require__(63);
  3839. __webpack_require__(64);
  3840. __webpack_require__(65);
  3841. __webpack_require__(66);
  3842. __webpack_require__(67);
  3843. __webpack_require__(68);
  3844. var schedulerVersion = '1.9.4';
  3845. exportHooks.schedulerVersion = schedulerVersion;
  3846. /*
  3847. When the required internal version is upped,
  3848. also update the .json files with a new minor version requirement.
  3849. Example: bump ~2.7.2 to ~2.8.0
  3850. Use a tilde to match future patch-level changes only!
  3851. */
  3852. if (exportHooks.internalApiVersion !== 12) {
  3853. throw new Error('v' + schedulerVersion + ' of FullCalendar Scheduler ' +
  3854. 'is incompatible with v' + exportHooks.version + ' of the core.\n' +
  3855. 'Please see http://fullcalendar.io/support/ for more information.');
  3856. }
  3857. /***/ }),
  3858. /* 37 */
  3859. /***/ (function(module, exports, __webpack_require__) {
  3860. Object.defineProperty(exports, "__esModule", { value: true });
  3861. var exportHooks = __webpack_require__(0);
  3862. var ResourceAgendaView_1 = __webpack_require__(20);
  3863. var ResourceBasicView_1 = __webpack_require__(22);
  3864. var ResourceMonthView_1 = __webpack_require__(23);
  3865. var TimelineView_1 = __webpack_require__(14);
  3866. var ResourceTimelineView_1 = __webpack_require__(30);
  3867. // TODO: find a better way
  3868. exportHooks.ResourceAgendaView = ResourceAgendaView_1.default;
  3869. exportHooks.ResourceBasicView = ResourceBasicView_1.default;
  3870. exportHooks.ResourceMonthView = ResourceMonthView_1.default;
  3871. exportHooks.TimelineView = TimelineView_1.default;
  3872. exportHooks.ResourceTimelineView = ResourceTimelineView_1.default;
  3873. /***/ }),
  3874. /* 38 */
  3875. /***/ (function(module, exports, __webpack_require__) {
  3876. Object.defineProperty(exports, "__esModule", { value: true });
  3877. var tslib_1 = __webpack_require__(1);
  3878. var $ = __webpack_require__(2);
  3879. var fullcalendar_1 = __webpack_require__(0);
  3880. var ResourceDayTableMixin_1 = __webpack_require__(21);
  3881. var ResourceComponentFootprint_1 = __webpack_require__(6);
  3882. var ResourceTimeGrid = /** @class */ (function (_super) {
  3883. tslib_1.__extends(ResourceTimeGrid, _super);
  3884. function ResourceTimeGrid(view) {
  3885. var _this = _super.call(this, view) || this;
  3886. _this.isResourceFootprintsEnabled = true;
  3887. return _this;
  3888. }
  3889. ResourceTimeGrid.prototype.renderDates = function (dateProfile) {
  3890. this.dateProfile = dateProfile;
  3891. this.renderSlats();
  3892. };
  3893. ResourceTimeGrid.prototype.renderResources = function (resources) {
  3894. this.registerResources(resources);
  3895. this.renderColumns();
  3896. if (this.headContainerEl) {
  3897. this.processHeadResourceEls(this.headContainerEl);
  3898. }
  3899. };
  3900. // TODO: make DRY with ResourceDayGrid
  3901. ResourceTimeGrid.prototype.getHitFootprint = function (hit) {
  3902. var plainFootprint = _super.prototype.getHitFootprint.call(this, hit);
  3903. return new ResourceComponentFootprint_1.default(plainFootprint.unzonedRange, plainFootprint.isAllDay, this.getColResource(hit.col).id);
  3904. };
  3905. ResourceTimeGrid.prototype.componentFootprintToSegs = function (componentFootprint) {
  3906. var resourceCnt = this.resourceCnt;
  3907. var genericSegs = this.sliceRangeByTimes(componentFootprint.unzonedRange); // no assigned resources
  3908. var resourceSegs = [];
  3909. for (var _i = 0, genericSegs_1 = genericSegs; _i < genericSegs_1.length; _i++) {
  3910. var seg = genericSegs_1[_i];
  3911. for (var resourceIndex = 0; resourceIndex < resourceCnt; resourceIndex++) {
  3912. var resourceObj = this.flattenedResources[resourceIndex];
  3913. if (!(componentFootprint instanceof ResourceComponentFootprint_1.default) ||
  3914. (componentFootprint.resourceId === resourceObj.id)) {
  3915. var copy = $.extend({}, seg);
  3916. copy.resource = resourceObj;
  3917. copy.col = this.indicesToCol(resourceIndex, seg.dayIndex);
  3918. resourceSegs.push(copy);
  3919. }
  3920. }
  3921. }
  3922. return resourceSegs;
  3923. };
  3924. return ResourceTimeGrid;
  3925. }(fullcalendar_1.TimeGrid));
  3926. exports.default = ResourceTimeGrid;
  3927. ResourceDayTableMixin_1.default.mixInto(ResourceTimeGrid);
  3928. /***/ }),
  3929. /* 39 */
  3930. /***/ (function(module, exports, __webpack_require__) {
  3931. Object.defineProperty(exports, "__esModule", { value: true });
  3932. var tslib_1 = __webpack_require__(1);
  3933. var $ = __webpack_require__(2);
  3934. var fullcalendar_1 = __webpack_require__(0);
  3935. var rtlScrollSystem = null;
  3936. /*
  3937. A Scroller with additional functionality:
  3938. - optional ScrollerCanvas for content
  3939. - fired events for scroll start/end
  3940. - cross-browser normalization of horizontal scroll for RTL
  3941. */
  3942. var EnhancedScroller = /** @class */ (function (_super) {
  3943. tslib_1.__extends(EnhancedScroller, _super);
  3944. function EnhancedScroller(options) {
  3945. var _this = _super.call(this, options) || this;
  3946. _this.isScrolling = false;
  3947. _this.isTouching = false;
  3948. _this.isTouchedEver = false;
  3949. _this.isMoving = false;
  3950. _this.isTouchScrollEnabled = true;
  3951. _this.requestMovingEnd = fullcalendar_1.debounce(_this.reportMovingEnd, 500);
  3952. return _this;
  3953. }
  3954. EnhancedScroller.prototype.render = function () {
  3955. _super.prototype.render.call(this);
  3956. if (this.canvas) {
  3957. this.canvas.render();
  3958. this.canvas.el.appendTo(this.scrollEl);
  3959. }
  3960. this.bindHandlers();
  3961. };
  3962. EnhancedScroller.prototype.destroy = function () {
  3963. _super.prototype.destroy.call(this);
  3964. this.unbindHandlers();
  3965. };
  3966. // Touch scroll prevention
  3967. // ----------------------------------------------------------------------------------------------
  3968. EnhancedScroller.prototype.disableTouchScroll = function () {
  3969. this.isTouchScrollEnabled = false;
  3970. this.bindPreventTouchScroll(); // will be unbound in enableTouchScroll or reportTouchEnd
  3971. };
  3972. EnhancedScroller.prototype.enableTouchScroll = function () {
  3973. this.isTouchScrollEnabled = true;
  3974. // only immediately unbind if a touch event is NOT in progress.
  3975. // otherwise, it will be handled by reportTouchEnd.
  3976. if (!this.isTouching) {
  3977. this.unbindPreventTouchScroll();
  3978. }
  3979. };
  3980. EnhancedScroller.prototype.bindPreventTouchScroll = function () {
  3981. if (!this.preventTouchScrollHandler) {
  3982. this.scrollEl.on('touchmove', (this.preventTouchScrollHandler = fullcalendar_1.preventDefault));
  3983. }
  3984. };
  3985. EnhancedScroller.prototype.unbindPreventTouchScroll = function () {
  3986. if (this.preventTouchScrollHandler) {
  3987. this.scrollEl.off('touchmove', this.preventTouchScrollHandler);
  3988. this.preventTouchScrollHandler = null;
  3989. }
  3990. };
  3991. // Handlers
  3992. // ----------------------------------------------------------------------------------------------
  3993. EnhancedScroller.prototype.bindHandlers = function () {
  3994. return this.listenTo(this.scrollEl, {
  3995. scroll: this.reportScroll,
  3996. touchstart: this.reportTouchStart,
  3997. touchend: this.reportTouchEnd
  3998. });
  3999. };
  4000. EnhancedScroller.prototype.unbindHandlers = function () {
  4001. return this.stopListeningTo(this.scrollEl);
  4002. };
  4003. // Scroll Events
  4004. // ----------------------------------------------------------------------------------------------
  4005. EnhancedScroller.prototype.reportScroll = function () {
  4006. if (!this.isScrolling) {
  4007. this.reportScrollStart();
  4008. }
  4009. this.trigger('scroll');
  4010. this.isMoving = true;
  4011. this.requestMovingEnd();
  4012. };
  4013. EnhancedScroller.prototype.reportScrollStart = function () {
  4014. if (!this.isScrolling) {
  4015. this.isScrolling = true;
  4016. this.trigger('scrollStart', this.isTouching); // created in constructor
  4017. }
  4018. };
  4019. EnhancedScroller.prototype.reportMovingEnd = function () {
  4020. this.isMoving = false;
  4021. // only end the scroll if not currently touching.
  4022. // if touching, the scrolling will end later, on touchend.
  4023. if (!this.isTouching) {
  4024. this.reportScrollEnd();
  4025. }
  4026. };
  4027. EnhancedScroller.prototype.reportScrollEnd = function () {
  4028. if (this.isScrolling) {
  4029. this.trigger('scrollEnd');
  4030. this.isScrolling = false;
  4031. }
  4032. };
  4033. // Touch Events
  4034. // ----------------------------------------------------------------------------------------------
  4035. // will fire *before* the scroll event is fired
  4036. EnhancedScroller.prototype.reportTouchStart = function () {
  4037. this.isTouching = true;
  4038. this.isTouchedEver = true;
  4039. };
  4040. EnhancedScroller.prototype.reportTouchEnd = function () {
  4041. if (this.isTouching) {
  4042. this.isTouching = false;
  4043. // if touch scrolling was re-enabled during a recent touch scroll
  4044. // then unbind the handlers that are preventing it from happening.
  4045. if (this.isTouchScrollEnabled) {
  4046. this.unbindPreventTouchScroll(); // won't do anything if not bound
  4047. }
  4048. // if the user ended their touch, and the scroll area wasn't moving,
  4049. // we consider this to be the end of the scroll.
  4050. if (!this.isMoving) {
  4051. this.reportScrollEnd(); // won't fire if already ended
  4052. }
  4053. }
  4054. };
  4055. // Horizontal Scroll Normalization
  4056. // ----------------------------------------------------------------------------------------------
  4057. // http://stackoverflow.com/questions/24276619/better-way-to-get-the-viewport-of-a-scrollable-div-in-rtl-mode/24394376#24394376
  4058. /*
  4059. If RTL, and scrolled to the left, returns NEGATIVE value (like Firefox)
  4060. */
  4061. EnhancedScroller.prototype.getScrollLeft = function () {
  4062. var direction = this.scrollEl.css('direction');
  4063. var node = this.scrollEl[0];
  4064. var val = node.scrollLeft;
  4065. if (direction === 'rtl') {
  4066. switch (rtlScrollSystem) {
  4067. case 'positive':
  4068. val = (val + node.clientWidth) - node.scrollWidth;
  4069. break;
  4070. case 'reverse':
  4071. val = -val;
  4072. break;
  4073. }
  4074. }
  4075. return val;
  4076. };
  4077. /*
  4078. Accepts a NEGATIVE value for when scrolled in RTL
  4079. */
  4080. EnhancedScroller.prototype.setScrollLeft = function (val) {
  4081. var direction = this.scrollEl.css('direction');
  4082. var node = this.scrollEl[0];
  4083. if (direction === 'rtl') {
  4084. switch (rtlScrollSystem) {
  4085. case 'positive':
  4086. val = (val - node.clientWidth) + node.scrollWidth;
  4087. break;
  4088. case 'reverse':
  4089. val = -val;
  4090. break;
  4091. }
  4092. }
  4093. node.scrollLeft = val;
  4094. };
  4095. /*
  4096. Always returns the number of pixels scrolled from the leftmost position (even if RTL).
  4097. Always positive.
  4098. */
  4099. EnhancedScroller.prototype.getScrollFromLeft = function () {
  4100. var direction = this.scrollEl.css('direction');
  4101. var node = this.scrollEl[0];
  4102. var val = node.scrollLeft;
  4103. if (direction === 'rtl') {
  4104. switch (rtlScrollSystem) {
  4105. case 'negative':
  4106. val = (val - node.clientWidth) + node.scrollWidth;
  4107. break;
  4108. case 'reverse':
  4109. val = (-val - node.clientWidth) + node.scrollWidth;
  4110. break;
  4111. }
  4112. }
  4113. return val;
  4114. };
  4115. EnhancedScroller.prototype.getNativeScrollLeft = function () {
  4116. return this.scrollEl[0].scrollLeft;
  4117. };
  4118. EnhancedScroller.prototype.setNativeScrollLeft = function (val) {
  4119. this.scrollEl[0].scrollLeft = val;
  4120. };
  4121. return EnhancedScroller;
  4122. }(fullcalendar_1.Scroller));
  4123. exports.default = EnhancedScroller;
  4124. fullcalendar_1.EmitterMixin.mixInto(EnhancedScroller);
  4125. fullcalendar_1.ListenerMixin.mixInto(EnhancedScroller);
  4126. // Horizontal Scroll System Detection
  4127. // ----------------------------------------------------------------------------------------------
  4128. function detectRtlScrollSystem() {
  4129. var el = $("<div style=\" position: absolute; top: -1000px; width: 1px; height: 1px; overflow: scroll; direction: rtl; font-size: 100px; \">A</div>").appendTo('body');
  4130. var node = el[0];
  4131. var system = (function () {
  4132. if (node.scrollLeft > 0) {
  4133. return 'positive';
  4134. }
  4135. else {
  4136. node.scrollLeft = 1;
  4137. if (node.scrollLeft > 0) {
  4138. return 'reverse';
  4139. }
  4140. else {
  4141. return 'negative';
  4142. }
  4143. }
  4144. })();
  4145. el.remove();
  4146. return system;
  4147. }
  4148. $(function () {
  4149. rtlScrollSystem = detectRtlScrollSystem();
  4150. });
  4151. /***/ }),
  4152. /* 40 */
  4153. /***/ (function(module, exports, __webpack_require__) {
  4154. Object.defineProperty(exports, "__esModule", { value: true });
  4155. var tslib_1 = __webpack_require__(1);
  4156. var fullcalendar_1 = __webpack_require__(0);
  4157. /*
  4158. TODO: use pubsub instead?
  4159. */
  4160. var TimelineEventDragging = /** @class */ (function (_super) {
  4161. tslib_1.__extends(TimelineEventDragging, _super);
  4162. function TimelineEventDragging() {
  4163. return _super !== null && _super.apply(this, arguments) || this;
  4164. }
  4165. TimelineEventDragging.prototype.segDragStart = function (seg, ev) {
  4166. _super.prototype.segDragStart.call(this, seg, ev);
  4167. if (this.component.eventTitleFollower) {
  4168. this.component.eventTitleFollower.forceRelative();
  4169. }
  4170. };
  4171. TimelineEventDragging.prototype.segDragStop = function (seg, ev) {
  4172. _super.prototype.segDragStop.call(this, seg, ev);
  4173. if (this.component.eventTitleFollower) {
  4174. this.component.eventTitleFollower.clearForce();
  4175. }
  4176. };
  4177. return TimelineEventDragging;
  4178. }(fullcalendar_1.EventDragging));
  4179. exports.default = TimelineEventDragging;
  4180. /***/ }),
  4181. /* 41 */
  4182. /***/ (function(module, exports, __webpack_require__) {
  4183. Object.defineProperty(exports, "__esModule", { value: true });
  4184. var tslib_1 = __webpack_require__(1);
  4185. var fullcalendar_1 = __webpack_require__(0);
  4186. /*
  4187. TODO: use pubsub instead?
  4188. */
  4189. var TimelineEventResizing = /** @class */ (function (_super) {
  4190. tslib_1.__extends(TimelineEventResizing, _super);
  4191. function TimelineEventResizing() {
  4192. return _super !== null && _super.apply(this, arguments) || this;
  4193. }
  4194. TimelineEventResizing.prototype.segResizeStart = function (seg, ev) {
  4195. _super.prototype.segResizeStart.call(this, seg, ev);
  4196. if (this.component.eventTitleFollower) {
  4197. return this.component.eventTitleFollower.forceRelative();
  4198. }
  4199. };
  4200. TimelineEventResizing.prototype.segResizeStop = function (seg, ev) {
  4201. _super.prototype.segResizeStop.call(this, seg, ev);
  4202. if (this.component.eventTitleFollower) {
  4203. return this.component.eventTitleFollower.clearForce();
  4204. }
  4205. };
  4206. return TimelineEventResizing;
  4207. }(fullcalendar_1.EventResizing));
  4208. exports.default = TimelineEventResizing;
  4209. /***/ }),
  4210. /* 42 */
  4211. /***/ (function(module, exports, __webpack_require__) {
  4212. Object.defineProperty(exports, "__esModule", { value: true });
  4213. var $ = __webpack_require__(2);
  4214. var moment = __webpack_require__(15);
  4215. var core = __webpack_require__(0);
  4216. var MIN_AUTO_LABELS = 18; // more than `12` months but less that `24` hours
  4217. var MAX_AUTO_SLOTS_PER_LABEL = 6; // allows 6 10-min slots in an hour
  4218. var MAX_AUTO_CELLS = 200; // allows 4-days to have a :30 slot duration
  4219. core.MAX_TIMELINE_SLOTS = 1000;
  4220. // potential nice values for slot-duration and interval-duration
  4221. var STOCK_SUB_DURATIONS = [
  4222. { years: 1 },
  4223. { months: 1 },
  4224. { days: 1 },
  4225. { hours: 1 },
  4226. { minutes: 30 },
  4227. { minutes: 15 },
  4228. { minutes: 10 },
  4229. { minutes: 5 },
  4230. { minutes: 1 },
  4231. { seconds: 30 },
  4232. { seconds: 15 },
  4233. { seconds: 10 },
  4234. { seconds: 5 },
  4235. { seconds: 1 },
  4236. { milliseconds: 500 },
  4237. { milliseconds: 100 },
  4238. { milliseconds: 10 },
  4239. { milliseconds: 1 }
  4240. ];
  4241. function initScaleProps(timelineView) {
  4242. timelineView.labelInterval = queryDurationOption(timelineView, 'slotLabelInterval');
  4243. timelineView.slotDuration = queryDurationOption(timelineView, 'slotDuration');
  4244. validateLabelAndSlot(timelineView); // validate after computed grid duration
  4245. ensureLabelInterval(timelineView);
  4246. ensureSlotDuration(timelineView);
  4247. var input = timelineView.opt('slotLabelFormat');
  4248. var type = $.type(input);
  4249. timelineView.headerFormats =
  4250. type === 'array' ?
  4251. input
  4252. : type === 'string' ?
  4253. [input]
  4254. :
  4255. computeHeaderFormats(timelineView);
  4256. timelineView.isTimeScale = core.durationHasTime(timelineView.slotDuration);
  4257. var largeUnit = null;
  4258. if (!timelineView.isTimeScale) {
  4259. var slotUnit = core.computeGreatestUnit(timelineView.slotDuration);
  4260. if (/year|month|week/.test(slotUnit)) {
  4261. largeUnit = slotUnit;
  4262. }
  4263. }
  4264. timelineView.largeUnit = largeUnit;
  4265. timelineView.emphasizeWeeks = (timelineView.slotDuration.as('days') === 1) &&
  4266. (timelineView.currentRangeAs('weeks') >= 2) &&
  4267. !timelineView.opt('businessHours');
  4268. /*
  4269. console.log('label interval =', timelineView.labelInterval.humanize())
  4270. console.log('slot duration =', timelineView.slotDuration.humanize())
  4271. console.log('header formats =', timelineView.headerFormats)
  4272. console.log('isTimeScale', timelineView.isTimeScale)
  4273. console.log('largeUnit', timelineView.largeUnit)
  4274. */
  4275. var rawSnapDuration = timelineView.opt('snapDuration');
  4276. timelineView.snapDuration =
  4277. rawSnapDuration ?
  4278. moment.duration(rawSnapDuration) :
  4279. timelineView.slotDuration;
  4280. timelineView.snapsPerSlot = core.divideDurationByDuration(timelineView.slotDuration, timelineView.snapDuration);
  4281. }
  4282. exports.initScaleProps = initScaleProps;
  4283. function queryDurationOption(timelineView, name) {
  4284. var input = timelineView.opt(name);
  4285. if (input != null) {
  4286. var dur = moment.duration(input);
  4287. if (+dur) {
  4288. return dur;
  4289. }
  4290. }
  4291. }
  4292. function validateLabelAndSlot(timelineView) {
  4293. var currentUnzonedRange = timelineView.dateProfile.currentUnzonedRange;
  4294. // make sure labelInterval doesn't exceed the max number of cells
  4295. if (timelineView.labelInterval) {
  4296. var labelCnt = core.divideRangeByDuration(currentUnzonedRange.getStart(), currentUnzonedRange.getEnd(), timelineView.labelInterval);
  4297. if (labelCnt > core.MAX_TIMELINE_SLOTS) {
  4298. core.warn('slotLabelInterval results in too many cells');
  4299. timelineView.labelInterval = null;
  4300. }
  4301. }
  4302. // make sure slotDuration doesn't exceed the maximum number of cells
  4303. if (timelineView.slotDuration) {
  4304. var slotCnt = core.divideRangeByDuration(currentUnzonedRange.getStart(), currentUnzonedRange.getEnd(), timelineView.slotDuration);
  4305. if (slotCnt > core.MAX_TIMELINE_SLOTS) {
  4306. core.warn('slotDuration results in too many cells');
  4307. timelineView.slotDuration = null;
  4308. }
  4309. }
  4310. // make sure labelInterval is a multiple of slotDuration
  4311. if (timelineView.labelInterval && timelineView.slotDuration) {
  4312. var slotsPerLabel = core.divideDurationByDuration(timelineView.labelInterval, timelineView.slotDuration);
  4313. if (!core.isInt(slotsPerLabel) || (slotsPerLabel < 1)) {
  4314. core.warn('slotLabelInterval must be a multiple of slotDuration');
  4315. return timelineView.slotDuration = null;
  4316. }
  4317. }
  4318. }
  4319. function ensureLabelInterval(timelineView) {
  4320. var currentUnzonedRange = timelineView.dateProfile.currentUnzonedRange;
  4321. var labelInterval = timelineView.labelInterval;
  4322. if (!labelInterval) {
  4323. // compute based off the slot duration
  4324. // find the largest label interval with an acceptable slots-per-label
  4325. var input = void 0;
  4326. if (timelineView.slotDuration) {
  4327. for (var _i = 0, STOCK_SUB_DURATIONS_1 = STOCK_SUB_DURATIONS; _i < STOCK_SUB_DURATIONS_1.length; _i++) {
  4328. input = STOCK_SUB_DURATIONS_1[_i];
  4329. var tryLabelInterval = moment.duration(input);
  4330. var slotsPerLabel = core.divideDurationByDuration(tryLabelInterval, timelineView.slotDuration);
  4331. if (core.isInt(slotsPerLabel) && (slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL)) {
  4332. labelInterval = tryLabelInterval;
  4333. break;
  4334. }
  4335. }
  4336. // use the slot duration as a last resort
  4337. if (!labelInterval) {
  4338. labelInterval = timelineView.slotDuration;
  4339. }
  4340. // compute based off the view's duration
  4341. // find the largest label interval that yields the minimum number of labels
  4342. }
  4343. else {
  4344. for (var _a = 0, STOCK_SUB_DURATIONS_2 = STOCK_SUB_DURATIONS; _a < STOCK_SUB_DURATIONS_2.length; _a++) {
  4345. input = STOCK_SUB_DURATIONS_2[_a];
  4346. labelInterval = moment.duration(input);
  4347. var labelCnt = core.divideRangeByDuration(currentUnzonedRange.getStart(), currentUnzonedRange.getEnd(), labelInterval);
  4348. if (labelCnt >= MIN_AUTO_LABELS) {
  4349. break;
  4350. }
  4351. }
  4352. }
  4353. timelineView.labelInterval = labelInterval;
  4354. }
  4355. return labelInterval;
  4356. }
  4357. function ensureSlotDuration(timelineView) {
  4358. var currentUnzonedRange = timelineView.dateProfile.currentUnzonedRange;
  4359. var slotDuration = timelineView.slotDuration;
  4360. if (!slotDuration) {
  4361. var labelInterval = ensureLabelInterval(timelineView); // will compute if necessary
  4362. // compute based off the label interval
  4363. // find the largest slot duration that is different from labelInterval, but still acceptable
  4364. for (var _i = 0, STOCK_SUB_DURATIONS_3 = STOCK_SUB_DURATIONS; _i < STOCK_SUB_DURATIONS_3.length; _i++) {
  4365. var input = STOCK_SUB_DURATIONS_3[_i];
  4366. var trySlotDuration = moment.duration(input);
  4367. var slotsPerLabel = core.divideDurationByDuration(labelInterval, trySlotDuration);
  4368. if (core.isInt(slotsPerLabel) && (slotsPerLabel > 1) && (slotsPerLabel <= MAX_AUTO_SLOTS_PER_LABEL)) {
  4369. slotDuration = trySlotDuration;
  4370. break;
  4371. }
  4372. }
  4373. // only allow the value if it won't exceed the view's # of slots limit
  4374. if (slotDuration) {
  4375. var slotCnt = core.divideRangeByDuration(currentUnzonedRange.getStart(), currentUnzonedRange.getEnd(), slotDuration);
  4376. if (slotCnt > MAX_AUTO_CELLS) {
  4377. slotDuration = null;
  4378. }
  4379. }
  4380. // use the label interval as a last resort
  4381. if (!slotDuration) {
  4382. slotDuration = labelInterval;
  4383. }
  4384. timelineView.slotDuration = slotDuration;
  4385. }
  4386. return slotDuration;
  4387. }
  4388. function computeHeaderFormats(timelineView) {
  4389. var format1;
  4390. var format2;
  4391. var labelInterval = timelineView.labelInterval;
  4392. var unit = core.computeGreatestUnit(labelInterval);
  4393. var weekNumbersVisible = timelineView.opt('weekNumbers');
  4394. var format0 = (format1 = (format2 = null));
  4395. // NOTE: weekNumber computation function wont work
  4396. if ((unit === 'week') && !weekNumbersVisible) {
  4397. unit = 'day';
  4398. }
  4399. switch (unit) {
  4400. case 'year':
  4401. format0 = 'YYYY'; // '2015'
  4402. break;
  4403. case 'month':
  4404. if (timelineView.currentRangeAs('years') > 1) {
  4405. format0 = 'YYYY'; // '2015'
  4406. }
  4407. format1 = 'MMM'; // 'Jan'
  4408. break;
  4409. case 'week':
  4410. if (timelineView.currentRangeAs('years') > 1) {
  4411. format0 = 'YYYY'; // '2015'
  4412. }
  4413. format1 = timelineView.opt('shortWeekFormat'); // 'Wk4'
  4414. break;
  4415. case 'day':
  4416. if (timelineView.currentRangeAs('years') > 1) {
  4417. format0 = timelineView.opt('monthYearFormat'); // 'January 2014'
  4418. }
  4419. else if (timelineView.currentRangeAs('months') > 1) {
  4420. format0 = 'MMMM'; // 'January'
  4421. }
  4422. if (weekNumbersVisible) {
  4423. format1 = timelineView.opt('weekFormat'); // 'Wk 4'
  4424. }
  4425. // TODO: would use smallDayDateFormat but the way timeline does RTL,
  4426. // we don't want the text to be flipped
  4427. format2 = 'dd D'; // @opt('smallDayDateFormat') # 'Su 9'
  4428. break;
  4429. case 'hour':
  4430. if (weekNumbersVisible) {
  4431. format0 = timelineView.opt('weekFormat'); // 'Wk 4'
  4432. }
  4433. if (timelineView.currentRangeAs('days') > 1) {
  4434. format1 = timelineView.opt('dayOfMonthFormat'); // 'Fri 9/15'
  4435. }
  4436. format2 = timelineView.opt('smallTimeFormat'); // '6pm'
  4437. break;
  4438. case 'minute':
  4439. // sufficiently large number of different minute cells?
  4440. if ((labelInterval.asMinutes() / 60) >= MAX_AUTO_SLOTS_PER_LABEL) {
  4441. format0 = timelineView.opt('hourFormat'); // '6pm'
  4442. format1 = '[:]mm'; // ':30'
  4443. }
  4444. else {
  4445. format0 = timelineView.opt('mediumTimeFormat'); // '6:30pm'
  4446. }
  4447. break;
  4448. case 'second':
  4449. // sufficiently large number of different second cells?
  4450. if ((labelInterval.asSeconds() / 60) >= MAX_AUTO_SLOTS_PER_LABEL) {
  4451. format0 = 'LT'; // '8:30 PM'
  4452. format1 = '[:]ss'; // ':30'
  4453. }
  4454. else {
  4455. format0 = 'LTS'; // '8:30:45 PM'
  4456. }
  4457. break;
  4458. case 'millisecond':
  4459. format0 = 'LTS'; // '8:30:45 PM'
  4460. format1 = '[.]SSS'; // '750'
  4461. break;
  4462. }
  4463. return [].concat(format0 || [], format1 || [], format2 || []);
  4464. }
  4465. /***/ }),
  4466. /* 43 */
  4467. /***/ (function(module, exports, __webpack_require__) {
  4468. Object.defineProperty(exports, "__esModule", { value: true });
  4469. var $ = __webpack_require__(2);
  4470. var fullcalendar_1 = __webpack_require__(0);
  4471. var ClippedScroller_1 = __webpack_require__(24);
  4472. var ScrollerCanvas_1 = __webpack_require__(25);
  4473. var ScrollJoiner_1 = __webpack_require__(16);
  4474. var ScrollFollower_1 = __webpack_require__(26);
  4475. var VRowGroup_1 = __webpack_require__(31);
  4476. var COL_MIN_WIDTH = 30;
  4477. var Spreadsheet = /** @class */ (function () {
  4478. function Spreadsheet(view) {
  4479. this.colGroupHtml = '';
  4480. this.view = view;
  4481. this.isRTL = this.view.opt('isRTL'); // doesn't descend from Grid, so needs to do this
  4482. this.givenColWidths = this.colWidths =
  4483. this.view.colSpecs.map(function (colSpec) { return colSpec.width; });
  4484. }
  4485. Spreadsheet.prototype.renderSkeleton = function () {
  4486. var theme = this.view.calendar.theme;
  4487. this.headScroller = new ClippedScroller_1.default({
  4488. overflowX: 'clipped-scroll',
  4489. overflowY: 'hidden'
  4490. });
  4491. this.headScroller.canvas = new ScrollerCanvas_1.default();
  4492. this.headScroller.render();
  4493. this.headScroller.canvas.contentEl.html(this.renderHeadHtml());
  4494. this.headEl.append(this.headScroller.el);
  4495. this.bodyScroller = new ClippedScroller_1.default({ overflowY: 'clipped-scroll' });
  4496. this.bodyScroller.canvas = new ScrollerCanvas_1.default();
  4497. this.bodyScroller.render();
  4498. this.bodyScroller.canvas.contentEl.html("<div class=\"fc-rows\"> <table class=\"" + theme.getClass('tableGrid') + "\">" + this.colGroupHtml + "<tbody/> </table> </div>"); // colGroupHtml hack
  4499. this.tbodyEl = this.bodyScroller.canvas.contentEl.find('tbody');
  4500. this.el.append(this.bodyScroller.el);
  4501. this.scrollJoiner = new ScrollJoiner_1.default('horizontal', [this.headScroller, this.bodyScroller]);
  4502. this.headTable = this.headEl.find('table');
  4503. this.headColEls = this.headEl.find('col');
  4504. this.headCellEls = this.headScroller.canvas.contentEl.find('tr:last-child th');
  4505. this.bodyColEls = this.el.find('col');
  4506. this.bodyTable = this.el.find('table');
  4507. this.colMinWidths = this.computeColMinWidths();
  4508. this.applyColWidths();
  4509. this.initColResizing();
  4510. };
  4511. Spreadsheet.prototype.renderHeadHtml = function () {
  4512. var theme = this.view.calendar.theme;
  4513. var colSpecs = this.view.colSpecs;
  4514. var html = '<table class="' + theme.getClass('tableGrid') + '">';
  4515. var colGroupHtml = '<colgroup>';
  4516. for (var _i = 0, colSpecs_1 = colSpecs; _i < colSpecs_1.length; _i++) {
  4517. var o = colSpecs_1[_i];
  4518. if (o.isMain) {
  4519. colGroupHtml += '<col class="fc-main-col"/>';
  4520. }
  4521. else {
  4522. colGroupHtml += '<col/>';
  4523. }
  4524. }
  4525. colGroupHtml += '</colgroup>';
  4526. this.colGroupHtml = colGroupHtml;
  4527. html += colGroupHtml;
  4528. html += '<tbody>';
  4529. if (this.view.superHeaderText) {
  4530. html +=
  4531. '<tr class="fc-super">' +
  4532. '<th class="' + theme.getClass('widgetHeader') + '" colspan="' + colSpecs.length + '">' +
  4533. '<div class="fc-cell-content">' +
  4534. '<span class="fc-cell-text">' +
  4535. fullcalendar_1.htmlEscape(this.view.superHeaderText) +
  4536. '</span>' +
  4537. '</div>' +
  4538. '</th>' +
  4539. '</tr>';
  4540. }
  4541. html += '<tr>';
  4542. for (var i = 0; i < colSpecs.length; i++) {
  4543. var o = colSpecs[i];
  4544. var isLast = i === (colSpecs.length - 1);
  4545. html +=
  4546. "<th class=\"" + theme.getClass('widgetHeader') + "\">" +
  4547. '<div>' +
  4548. '<div class="fc-cell-content">' +
  4549. (o.isMain ?
  4550. '<span class="fc-expander-space">' +
  4551. '<span class="fc-icon"></span>' +
  4552. '</span>' :
  4553. '') +
  4554. '<span class="fc-cell-text">' +
  4555. fullcalendar_1.htmlEscape(o.labelText || '') + // what about normalizing this value ahead of time?
  4556. '</span>' +
  4557. '</div>' +
  4558. (!isLast ? '<div class="fc-col-resizer"></div>' : '') +
  4559. '</div>' +
  4560. '</th>';
  4561. }
  4562. html += '</tr>';
  4563. html += '</tbody></table>';
  4564. return html;
  4565. };
  4566. Spreadsheet.prototype.initColResizing = function () {
  4567. var _this = this;
  4568. this.headEl.find('th .fc-col-resizer').each(function (i, resizerEl) {
  4569. resizerEl = $(resizerEl);
  4570. resizerEl.on('mousedown', function (ev) {
  4571. _this.colResizeMousedown(i, ev, resizerEl);
  4572. });
  4573. });
  4574. };
  4575. Spreadsheet.prototype.colResizeMousedown = function (i, ev, resizerEl) {
  4576. var _this = this;
  4577. var colWidths = (this.colWidths = this.queryColWidths());
  4578. colWidths.pop();
  4579. colWidths.push(null); // will result in 'auto' or ''
  4580. var origColWidth = colWidths[i];
  4581. var minWidth = Math.min(this.colMinWidths[i], COL_MIN_WIDTH); // if given width is smaller, allow it
  4582. var dragListener = new fullcalendar_1.DragListener({
  4583. dragStart: function () {
  4584. resizerEl.addClass('fc-active');
  4585. },
  4586. drag: function (dx, dy) {
  4587. var width = origColWidth + (_this.isRTL ? -dx : dx);
  4588. width = Math.max(width, minWidth);
  4589. colWidths[i] = width;
  4590. _this.applyColWidths();
  4591. },
  4592. dragEnd: function () {
  4593. resizerEl.removeClass('fc-active');
  4594. }
  4595. });
  4596. dragListener.startInteraction(ev);
  4597. };
  4598. Spreadsheet.prototype.applyColWidths = function () {
  4599. var cssWidth;
  4600. var i;
  4601. var colWidth;
  4602. var colMinWidths = this.colMinWidths;
  4603. var colWidths = this.colWidths;
  4604. var allNumbers = true;
  4605. var anyPercentages = false;
  4606. var total = 0;
  4607. for (var _i = 0, colWidths_1 = colWidths; _i < colWidths_1.length; _i++) {
  4608. colWidth = colWidths_1[_i];
  4609. if (typeof colWidth === 'number') {
  4610. total += colWidth;
  4611. }
  4612. else {
  4613. allNumbers = false;
  4614. if (colWidth) {
  4615. anyPercentages = true;
  4616. }
  4617. }
  4618. }
  4619. // percentage widths play better with 'auto' but h-grouped cells don't
  4620. var defaultCssWidth = anyPercentages && !this.view.isHGrouping ?
  4621. 'auto' :
  4622. '';
  4623. var cssWidths = colWidths.map(function (colWidth) { return (colWidth != null ? colWidth : defaultCssWidth); });
  4624. // if allNumbers
  4625. // cssWidths.pop()
  4626. // cssWidths.push('auto')
  4627. var tableMinWidth = 0;
  4628. for (i = 0; i < cssWidths.length; i++) {
  4629. cssWidth = cssWidths[i];
  4630. tableMinWidth +=
  4631. typeof cssWidth === 'number' ?
  4632. cssWidth :
  4633. colMinWidths[i];
  4634. }
  4635. for (i = 0; i < cssWidths.length; i++) {
  4636. cssWidth = cssWidths[i];
  4637. this.headColEls.eq(i).css('width', cssWidth);
  4638. this.bodyColEls.eq(i).css('width', cssWidth);
  4639. }
  4640. this.headScroller.canvas.setMinWidth(tableMinWidth); // not really a table width anymore
  4641. this.bodyScroller.canvas.setMinWidth(tableMinWidth);
  4642. this.tableMinWidth = tableMinWidth;
  4643. this.tableWidth = allNumbers ? total : undefined;
  4644. };
  4645. Spreadsheet.prototype.computeColMinWidths = function () {
  4646. var _this = this;
  4647. return this.givenColWidths.map(function (width, i) { return (typeof width === 'number' ?
  4648. width :
  4649. parseInt(_this.headColEls.eq(i).css('min-width'), 10) || COL_MIN_WIDTH); });
  4650. };
  4651. Spreadsheet.prototype.queryColWidths = function () {
  4652. return this.headCellEls.map(function (i, node) { return ($(node).outerWidth()); }).get();
  4653. };
  4654. // Sizing
  4655. // ---------------------------------------------------------------------------------
  4656. Spreadsheet.prototype.updateSize = function () {
  4657. this.headScroller.updateSize();
  4658. this.bodyScroller.updateSize();
  4659. this.scrollJoiner.update();
  4660. this.updateCellFollower();
  4661. };
  4662. Spreadsheet.prototype.headHeight = function () {
  4663. var table = this.headScroller.canvas.contentEl.find('table');
  4664. return table.height.apply(table, arguments);
  4665. };
  4666. // completely reninitializes every time there's add/remove
  4667. // TODO: optimize
  4668. Spreadsheet.prototype.updateCellFollower = function () {
  4669. if (this.cellFollower) {
  4670. this.cellFollower.clearSprites(); // the closest thing to a destroy
  4671. }
  4672. this.cellFollower = new ScrollFollower_1.default(this.bodyScroller, true); // allowPointerEvents
  4673. this.cellFollower.isHFollowing = false;
  4674. this.cellFollower.isVFollowing = true;
  4675. var nodes = [];
  4676. for (var _i = 0, _a = this.view.rowHierarchy.getNodes(); _i < _a.length; _i++) {
  4677. var row = _a[_i];
  4678. if (row instanceof VRowGroup_1.default) {
  4679. if (row.groupTd) {
  4680. var cellContent = row.groupTd.find('.fc-cell-content');
  4681. if (cellContent.length) {
  4682. nodes.push(cellContent[0]);
  4683. }
  4684. }
  4685. }
  4686. }
  4687. this.cellFollower.setSpriteEls($(nodes));
  4688. this.cellFollower.update();
  4689. };
  4690. return Spreadsheet;
  4691. }());
  4692. exports.default = Spreadsheet;
  4693. /***/ }),
  4694. /* 44 */
  4695. /***/ (function(module, exports) {
  4696. Object.defineProperty(exports, "__esModule", { value: true });
  4697. /*
  4698. Given a jQuery <tr> set, returns the <td>'s that do not have multi-line rowspans.
  4699. Would use the [rowspan] selector, but never not defined in IE8.
  4700. */
  4701. function getOwnCells(trs) {
  4702. return trs.find('> td').filter(function (i, tdNode) { return (tdNode.rowSpan <= 1); });
  4703. }
  4704. exports.getOwnCells = getOwnCells;
  4705. /***/ }),
  4706. /* 45 */
  4707. /***/ (function(module, exports, __webpack_require__) {
  4708. Object.defineProperty(exports, "__esModule", { value: true });
  4709. var tslib_1 = __webpack_require__(1);
  4710. var TimelineEventRenderer_1 = __webpack_require__(17);
  4711. var ResourceTimelineEventRenderer = /** @class */ (function (_super) {
  4712. tslib_1.__extends(ResourceTimelineEventRenderer, _super);
  4713. function ResourceTimelineEventRenderer() {
  4714. return _super !== null && _super.apply(this, arguments) || this;
  4715. }
  4716. // don't render any fg segs
  4717. ResourceTimelineEventRenderer.prototype.renderFgRanges = function (eventRanges) {
  4718. // subclasses can implement
  4719. };
  4720. ResourceTimelineEventRenderer.prototype.unrenderFgRanges = function () {
  4721. // otherwise will try do manip DOM, js error
  4722. };
  4723. return ResourceTimelineEventRenderer;
  4724. }(TimelineEventRenderer_1.default));
  4725. exports.default = ResourceTimelineEventRenderer;
  4726. /***/ }),
  4727. /* 46 */
  4728. /***/ (function(module, exports, __webpack_require__) {
  4729. Object.defineProperty(exports, "__esModule", { value: true });
  4730. var tslib_1 = __webpack_require__(1);
  4731. var $ = __webpack_require__(2);
  4732. var fullcalendar_1 = __webpack_require__(0);
  4733. var EventRow_1 = __webpack_require__(33);
  4734. /*
  4735. A row that renders information about a particular resource, as well as it events (handled by superclass)
  4736. */
  4737. var ResourceRow = /** @class */ (function (_super) {
  4738. tslib_1.__extends(ResourceRow, _super);
  4739. function ResourceRow(view, resource) {
  4740. var _this = _super.call(this, view) || this;
  4741. _this.resource = resource;
  4742. _this.eventRenderer.designatedResource = _this.resource;
  4743. return _this;
  4744. }
  4745. ResourceRow.prototype.renderSkeleton = function () {
  4746. _super.prototype.renderSkeleton.call(this);
  4747. this.updateExpandingEnabled();
  4748. if (this.eventsPayload) {
  4749. EventRow_1.default.prototype.executeEventRender.call(this, this.eventsPayload);
  4750. }
  4751. if (this.businessHourGenerator &&
  4752. this.view.dateProfile // hack
  4753. ) {
  4754. EventRow_1.default.prototype.renderBusinessHours.call(this, this.businessHourGenerator);
  4755. }
  4756. this.view.publiclyTrigger('resourceRender', {
  4757. context: this.resource,
  4758. args: [
  4759. this.resource,
  4760. this.getTr('spreadsheet').find('> td'),
  4761. this.getTr('event').find('> td'),
  4762. this.view
  4763. ]
  4764. });
  4765. };
  4766. ResourceRow.prototype.removeElement = function () {
  4767. _super.prototype.removeElement.call(this);
  4768. if (this.eventsPayload) {
  4769. EventRow_1.default.prototype.executeEventUnrender.call(this, this.eventsPayload);
  4770. }
  4771. if (this.businessHourGenerator) {
  4772. EventRow_1.default.prototype.unrenderBusinessHours.call(this, this.businessHourGenerator);
  4773. }
  4774. };
  4775. ResourceRow.prototype.renderEventSkeleton = function (tr) {
  4776. _super.prototype.renderEventSkeleton.call(this, tr);
  4777. tr.attr('data-resource-id', this.resource.id);
  4778. };
  4779. ResourceRow.prototype.executeEventRender = function (eventsPayload) {
  4780. this.eventsPayload = eventsPayload;
  4781. if (this.get('isInDom')) {
  4782. _super.prototype.executeEventRender.call(this, this.eventsPayload);
  4783. }
  4784. };
  4785. ResourceRow.prototype.executeEventUnrender = function () {
  4786. _super.prototype.executeEventUnrender.call(this);
  4787. this.eventsPayload = null;
  4788. };
  4789. ResourceRow.prototype.renderBusinessHours = function (businessHourGenerator) {
  4790. this.businessHourGenerator = businessHourGenerator;
  4791. if (this.get('isInDom')) {
  4792. _super.prototype.renderBusinessHours.call(this, this.businessHourGenerator);
  4793. }
  4794. };
  4795. ResourceRow.prototype.unrenderBusinessHours = function () {
  4796. _super.prototype.unrenderBusinessHours.call(this);
  4797. this.businessHourGenerator = null;
  4798. };
  4799. /*
  4800. Populates the TR with cells containing data about the resource
  4801. */
  4802. ResourceRow.prototype.renderSpreadsheetSkeleton = function (tr) {
  4803. var theme = this.view.calendar.theme;
  4804. var resource = this.resource;
  4805. for (var _i = 0, _a = this.view.colSpecs; _i < _a.length; _i++) {
  4806. var colSpec = _a[_i];
  4807. if (colSpec.group) { // not responsible for group-based rows. VRowGroup is
  4808. continue;
  4809. }
  4810. var input = // the source text, and the main argument for the filter functions
  4811. colSpec.field ?
  4812. resource[colSpec.field] || null :
  4813. resource;
  4814. var text = typeof colSpec.text === 'function' ?
  4815. colSpec.text(resource, input) : // the colspec provided a text filter function
  4816. input;
  4817. var contentEl = $('<div class="fc-cell-content">' +
  4818. (colSpec.isMain ? this.renderGutterHtml() : '') +
  4819. '<span class="fc-cell-text">' +
  4820. (text ? fullcalendar_1.htmlEscape(text) : '&nbsp;') +
  4821. '</span>' +
  4822. '</div>');
  4823. if (typeof colSpec.render === 'function') { // a filter function for the element
  4824. contentEl = colSpec.render(resource, contentEl, input) || contentEl;
  4825. }
  4826. var td = $('<td class="' + theme.getClass('widgetContent') + '"/>')
  4827. .append(contentEl);
  4828. // the first cell of the row needs to have an inner div for setTrInnerHeight
  4829. if (colSpec.isMain) {
  4830. td.wrapInner('<div/>');
  4831. }
  4832. tr.append(td);
  4833. }
  4834. tr.attr('data-resource-id', resource.id);
  4835. };
  4836. /*
  4837. Renders the HTML responsible for the subrow expander area,
  4838. as well as the space before it (used to align expanders of similar depths)
  4839. */
  4840. ResourceRow.prototype.renderGutterHtml = function () {
  4841. var html = '';
  4842. var depth = this.depth;
  4843. for (var i = 0; i < depth; i++) {
  4844. html += '<span class="fc-icon"/>';
  4845. }
  4846. html +=
  4847. '<span class="fc-expander-space">' +
  4848. '<span class="fc-icon"></span>' +
  4849. '</span>';
  4850. return html;
  4851. };
  4852. return ResourceRow;
  4853. }(EventRow_1.default));
  4854. exports.default = ResourceRow;
  4855. /***/ }),
  4856. /* 47 */
  4857. /***/ (function(module, exports, __webpack_require__) {
  4858. Object.defineProperty(exports, "__esModule", { value: true });
  4859. var tslib_1 = __webpack_require__(1);
  4860. var $ = __webpack_require__(2);
  4861. var RowGroup_1 = __webpack_require__(32);
  4862. /*
  4863. A row grouping that renders as a single solid row that spans width-wise (like a horizontal rule)
  4864. */
  4865. var HRowGroup = /** @class */ (function (_super) {
  4866. tslib_1.__extends(HRowGroup, _super);
  4867. function HRowGroup() {
  4868. return _super !== null && _super.apply(this, arguments) || this;
  4869. }
  4870. HRowGroup.prototype.renderSkeleton = function () {
  4871. _super.prototype.renderSkeleton.call(this);
  4872. this.updateExpandingEnabled();
  4873. };
  4874. /*
  4875. Renders this row's TR for the "spreadsheet" quadrant, the area with info about each resource
  4876. */
  4877. HRowGroup.prototype.renderSpreadsheetSkeleton = function (tr) {
  4878. var contentEl = this.renderGroupContentEl();
  4879. // add an expander icon. binding handlers and updating are done by RowParent
  4880. contentEl.prepend('<span class="fc-expander">' +
  4881. '<span class="fc-icon"></span>' +
  4882. '</span>');
  4883. return $('<td class="fc-divider" />')
  4884. .attr('colspan', this.view.colSpecs.length) // span across all columns
  4885. .append($('<div/>').append(contentEl) // needed by setTrInnerHeight
  4886. )
  4887. .appendTo(tr);
  4888. };
  4889. /*
  4890. Renders this row's TR for the quadrant that contains a resource's events
  4891. */
  4892. HRowGroup.prototype.renderEventSkeleton = function (tr) {
  4893. // insert a single cell, with a single empty <div> (needed by setTrInnerHeight).
  4894. // there will be no content
  4895. return tr.append("<td class=\"fc-divider\"> <div/> </td>");
  4896. };
  4897. return HRowGroup;
  4898. }(RowGroup_1.default));
  4899. exports.default = HRowGroup;
  4900. HRowGroup.prototype.hasOwnRow = true; // actually renders its own row and takes up height
  4901. /***/ }),
  4902. /* 48 */
  4903. /***/ (function(module, exports, __webpack_require__) {
  4904. Object.defineProperty(exports, "__esModule", { value: true });
  4905. var $ = __webpack_require__(2);
  4906. var fullcalendar_1 = __webpack_require__(0);
  4907. var Resource_1 = __webpack_require__(19);
  4908. var ResourceManager_1 = __webpack_require__(49);
  4909. var ResourceComponentFootprint_1 = __webpack_require__(6);
  4910. // NOTE: for public methods, always be sure of the return value. for chaining
  4911. var origMethods = {
  4912. constructed: fullcalendar_1.Calendar.prototype.constructed,
  4913. buildSelectFootprint: fullcalendar_1.Calendar.prototype.buildSelectFootprint
  4914. };
  4915. // option defaults
  4916. fullcalendar_1.Calendar.defaults.refetchResourcesOnNavigate = false;
  4917. fullcalendar_1.Calendar.defaults.filterResourcesWithEvents = false;
  4918. fullcalendar_1.Calendar.prototype.resourceManager = null;
  4919. fullcalendar_1.Calendar.prototype.constructed = function () {
  4920. origMethods.constructed.apply(this, arguments);
  4921. this.resourceManager = new ResourceManager_1.default(this);
  4922. };
  4923. fullcalendar_1.Calendar.prototype.instantiateView = function (viewType) {
  4924. var spec = this.viewSpecManager.getViewSpec(viewType);
  4925. var viewClass = spec['class'];
  4926. if (this.opt('resources') && (spec.options.resources !== false)) {
  4927. if (spec.queryResourceClass) {
  4928. viewClass = spec.queryResourceClass(spec) || viewClass; // might return falsy
  4929. }
  4930. else if (spec.resourceClass) {
  4931. viewClass = spec.resourceClass;
  4932. }
  4933. }
  4934. return new viewClass(this, spec);
  4935. };
  4936. // for the API only
  4937. // retrieves what is currently in memory. no fetching
  4938. fullcalendar_1.Calendar.prototype.getResources = function () {
  4939. return Array.prototype.slice.call(// make a copy
  4940. this.resourceManager.topLevelResources);
  4941. };
  4942. // assumes all resources already loaded
  4943. fullcalendar_1.Calendar.prototype.addResource = function (resourceInput, scroll) {
  4944. var _this = this;
  4945. if (scroll === void 0) { scroll = false; }
  4946. this.resourceManager.addResource(resourceInput)
  4947. .then(function (resource) {
  4948. if (scroll && _this.view.scrollToResource) {
  4949. return _this.view.scrollToResource(resource);
  4950. }
  4951. });
  4952. };
  4953. // assumes all resources already loaded
  4954. fullcalendar_1.Calendar.prototype.removeResource = function (idOrResource) {
  4955. return this.resourceManager.removeResource(idOrResource);
  4956. };
  4957. fullcalendar_1.Calendar.prototype.refetchResources = function () {
  4958. this.resourceManager.clear();
  4959. this.view.flash('initialResources');
  4960. };
  4961. fullcalendar_1.Calendar.prototype.rerenderResources = function () {
  4962. this.resourceManager.resetCurrentResources();
  4963. };
  4964. fullcalendar_1.Calendar.prototype.buildSelectFootprint = function (zonedStartInput, zonedEndInput, resourceId) {
  4965. var plainFootprint = origMethods.buildSelectFootprint.apply(this, arguments);
  4966. if (resourceId) {
  4967. return new ResourceComponentFootprint_1.default(plainFootprint.unzonedRange, plainFootprint.isAllDay, resourceId);
  4968. }
  4969. else {
  4970. return plainFootprint;
  4971. }
  4972. };
  4973. fullcalendar_1.Calendar.prototype.getResourceById = function (id) {
  4974. return this.resourceManager.getResourceById(id);
  4975. };
  4976. // Resources + Events
  4977. // ----------------------------------------------------------------------------------------
  4978. // DEPRECATED. for external API backwards compatibility
  4979. fullcalendar_1.Calendar.prototype.getEventResourceId = function (event) {
  4980. return this.getEventResourceIds(event)[0];
  4981. };
  4982. fullcalendar_1.Calendar.prototype.getEventResourceIds = function (event) {
  4983. var eventDef = this.eventManager.getEventDefByUid(event._id);
  4984. if (eventDef) {
  4985. return eventDef.getResourceIds();
  4986. }
  4987. else {
  4988. return [];
  4989. }
  4990. };
  4991. // DEPRECATED
  4992. fullcalendar_1.Calendar.prototype.setEventResourceId = function (event, resourceId) {
  4993. this.setEventResourceIds(event, resourceId ? [resourceId] : []);
  4994. };
  4995. fullcalendar_1.Calendar.prototype.setEventResourceIds = function (event, resourceIds) {
  4996. var eventDef = this.eventManager.getEventDefByUid(event._id);
  4997. if (eventDef) {
  4998. eventDef.resourceIds = resourceIds.map(function (rawResourceId) {
  4999. return Resource_1.default.normalizeId(rawResourceId);
  5000. });
  5001. }
  5002. };
  5003. // NOTE: views pair *segments* to resources. that's why there's no code reuse
  5004. fullcalendar_1.Calendar.prototype.getResourceEvents = function (idOrResource) {
  5005. var _this = this;
  5006. var resource = typeof idOrResource === 'object' ?
  5007. idOrResource :
  5008. this.getResourceById(idOrResource);
  5009. if (resource) {
  5010. // return the event cache, filtered by events assigned to the resource
  5011. // TODO: move away from using clientId
  5012. return this.clientEvents(function (event) {
  5013. return $.inArray(resource.id, _this.getEventResourceIds(event)) !== -1;
  5014. });
  5015. }
  5016. else {
  5017. return [];
  5018. }
  5019. };
  5020. // DEPRECATED. for external API backwards compatibility
  5021. fullcalendar_1.Calendar.prototype.getEventResource = function (idOrEvent) {
  5022. return this.getEventResources(idOrEvent)[0];
  5023. };
  5024. fullcalendar_1.Calendar.prototype.getEventResources = function (idOrEvent) {
  5025. var event = typeof idOrEvent === 'object' ?
  5026. idOrEvent :
  5027. this.clientEvents(idOrEvent)[0];
  5028. var resources = [];
  5029. if (event) {
  5030. for (var _i = 0, _a = this.getEventResourceIds(event); _i < _a.length; _i++) {
  5031. var resourceId = _a[_i];
  5032. var resource = this.getResourceById(resourceId);
  5033. if (resource) {
  5034. resources.push(resource);
  5035. }
  5036. }
  5037. }
  5038. return resources;
  5039. };
  5040. /***/ }),
  5041. /* 49 */
  5042. /***/ (function(module, exports, __webpack_require__) {
  5043. Object.defineProperty(exports, "__esModule", { value: true });
  5044. var tslib_1 = __webpack_require__(1);
  5045. var $ = __webpack_require__(2);
  5046. var fullcalendar_1 = __webpack_require__(0);
  5047. var ResourceManager = /** @class */ (function (_super) {
  5048. tslib_1.__extends(ResourceManager, _super);
  5049. function ResourceManager(calendar) {
  5050. var _this = _super.call(this) || this;
  5051. _this.fetchId = 0;
  5052. _this.calendar = calendar;
  5053. _this.initializeCache();
  5054. return _this;
  5055. }
  5056. // Resource Data Getting
  5057. // ------------------------------------------------------------------------------------------------------------------
  5058. /*
  5059. Like fetchResources, but won't refetch if already fetched.
  5060. */
  5061. ResourceManager.prototype.getResources = function (start, end) {
  5062. var isSameRange = (!start && !this.currentStart) || // both nonexistent ranges?
  5063. (start && this.currentStart && start.isSame(this.currentStart) && end.isSame(this.currentEnd));
  5064. if (!this.fetching || !isSameRange) { // first time? or is range different?
  5065. return this.fetchResources(start, end);
  5066. }
  5067. else {
  5068. return this.fetching;
  5069. }
  5070. };
  5071. /*
  5072. Will always fetch, even if done previously.
  5073. Accepts optional chrono-related params to pass on to the raw resource sources.
  5074. Returns a promise.
  5075. */
  5076. ResourceManager.prototype.fetchResources = function (start, end) {
  5077. var _this = this;
  5078. var currentFetchId = (this.fetchId += 1);
  5079. return this.fetching =
  5080. fullcalendar_1.Promise.construct(function (resolve, reject) {
  5081. _this.fetchResourceInputs(function (resourceInputs) {
  5082. if (currentFetchId === _this.fetchId) {
  5083. _this.setResources(resourceInputs);
  5084. return resolve(_this.topLevelResources);
  5085. }
  5086. else {
  5087. return reject();
  5088. }
  5089. }, start, end);
  5090. });
  5091. };
  5092. /*
  5093. Accepts optional chrono-related params to pass on to the raw resource sources.
  5094. Calls callback when done.
  5095. */
  5096. ResourceManager.prototype.fetchResourceInputs = function (callback, start, end) {
  5097. var _this = this;
  5098. var calendar = this.calendar;
  5099. var source = calendar.opt('resources');
  5100. var timezone = calendar.opt('timezone');
  5101. if ($.type(source) === 'string') {
  5102. source = { url: source };
  5103. }
  5104. switch ($.type(source)) {
  5105. case 'function':
  5106. this.calendar.pushLoading();
  5107. source(function (resourceInputs) {
  5108. _this.calendar.popLoading();
  5109. callback(resourceInputs);
  5110. }, start, end, calendar.opt('timezone'));
  5111. break;
  5112. case 'object':
  5113. calendar.pushLoading();
  5114. var requestParams = {};
  5115. if (start && end) {
  5116. requestParams[calendar.opt('startParam')] = start.format();
  5117. requestParams[calendar.opt('endParam')] = end.format();
  5118. // mimick what EventManager does
  5119. // TODO: more DRY
  5120. if (timezone && (timezone !== 'local')) {
  5121. requestParams[calendar.opt('timezoneParam')] = timezone;
  5122. }
  5123. }
  5124. $.ajax(// TODO: handle failure
  5125. $.extend({ data: requestParams }, ResourceManager.ajaxDefaults, source)).then(function (resourceInputs) {
  5126. calendar.popLoading();
  5127. callback(resourceInputs);
  5128. });
  5129. break;
  5130. case 'array':
  5131. callback(source);
  5132. break;
  5133. default:
  5134. callback([]);
  5135. break;
  5136. }
  5137. };
  5138. ResourceManager.prototype.getResourceById = function (id) {
  5139. return this.resourcesById[id];
  5140. };
  5141. // assumes already completed fetch
  5142. // does not guarantee order
  5143. ResourceManager.prototype.getFlatResources = function () {
  5144. var result = [];
  5145. for (var id in this.resourcesById) {
  5146. result.push(this.resourcesById[id]);
  5147. }
  5148. return result;
  5149. };
  5150. // Resource Adding
  5151. // ------------------------------------------------------------------------------------------------------------------
  5152. ResourceManager.prototype.initializeCache = function () {
  5153. this.topLevelResources = [];
  5154. this.resourcesById = {};
  5155. };
  5156. ResourceManager.prototype.setResources = function (resourceInputs) {
  5157. var _this = this;
  5158. var resource;
  5159. var wasSet = Boolean(this.topLevelResources);
  5160. this.initializeCache();
  5161. var resources = resourceInputs.map(function (resourceInput) { return (_this.buildResource(resourceInput)); });
  5162. var validResources = [];
  5163. for (var _i = 0, resources_1 = resources; _i < resources_1.length; _i++) {
  5164. resource = resources_1[_i];
  5165. if (this.addResourceToIndex(resource)) {
  5166. validResources.push(resource);
  5167. }
  5168. }
  5169. for (var _a = 0, validResources_1 = validResources; _a < validResources_1.length; _a++) {
  5170. resource = validResources_1[_a];
  5171. this.addResourceToTree(resource);
  5172. }
  5173. if (wasSet) {
  5174. this.trigger('reset', this.topLevelResources);
  5175. }
  5176. else {
  5177. this.trigger('set', this.topLevelResources);
  5178. }
  5179. this.calendar.publiclyTrigger('resourcesSet', [this.topLevelResources]);
  5180. };
  5181. ResourceManager.prototype.resetCurrentResources = function () {
  5182. if (this.topLevelResources) {
  5183. this.trigger('reset', this.topLevelResources);
  5184. }
  5185. };
  5186. ResourceManager.prototype.clear = function () {
  5187. this.topLevelResources = null;
  5188. this.fetching = null;
  5189. };
  5190. ResourceManager.prototype.addResource = function (resourceInput) {
  5191. var _this = this;
  5192. if (this.fetching) {
  5193. return this.fetching.then(function () {
  5194. var resource = _this.buildResource(resourceInput);
  5195. if (_this.addResourceToIndex(resource)) {
  5196. _this.addResourceToTree(resource);
  5197. _this.trigger('add', resource, _this.topLevelResources);
  5198. return resource;
  5199. }
  5200. else {
  5201. return false;
  5202. }
  5203. });
  5204. }
  5205. else {
  5206. return fullcalendar_1.Promise.reject();
  5207. }
  5208. };
  5209. ResourceManager.prototype.addResourceToIndex = function (resource) {
  5210. if (this.resourcesById[resource.id]) {
  5211. return false;
  5212. }
  5213. else {
  5214. this.resourcesById[resource.id] = resource;
  5215. for (var _i = 0, _a = resource.children; _i < _a.length; _i++) {
  5216. var child = _a[_i];
  5217. this.addResourceToIndex(child);
  5218. }
  5219. return true;
  5220. }
  5221. };
  5222. ResourceManager.prototype.addResourceToTree = function (resource) {
  5223. if (!resource.parent) {
  5224. var siblings = void 0;
  5225. var parentId = String(resource['parentId'] != null ? resource['parentId'] : '');
  5226. if (parentId) {
  5227. var parent_1 = this.resourcesById[parentId];
  5228. if (parent_1) {
  5229. resource.parent = parent_1;
  5230. siblings = parent_1.children;
  5231. }
  5232. else {
  5233. return false;
  5234. }
  5235. }
  5236. else {
  5237. siblings = this.topLevelResources;
  5238. }
  5239. siblings.push(resource);
  5240. }
  5241. return true;
  5242. };
  5243. // Resource Removing
  5244. // ------------------------------------------------------------------------------------------------------------------
  5245. ResourceManager.prototype.removeResource = function (idOrResource) {
  5246. var _this = this;
  5247. var id = typeof idOrResource === 'object' ?
  5248. idOrResource.id :
  5249. idOrResource;
  5250. if (this.fetching) {
  5251. return this.fetching.then(function () {
  5252. var resource = _this.removeResourceFromIndex(id);
  5253. if (resource) {
  5254. _this.removeResourceFromTree(resource);
  5255. _this.trigger('remove', resource, _this.topLevelResources);
  5256. }
  5257. return resource;
  5258. });
  5259. }
  5260. else {
  5261. return fullcalendar_1.Promise.reject();
  5262. }
  5263. };
  5264. ResourceManager.prototype.removeResourceFromIndex = function (resourceId) {
  5265. var resource = this.resourcesById[resourceId];
  5266. if (resource) {
  5267. delete this.resourcesById[resourceId];
  5268. for (var _i = 0, _a = resource.children; _i < _a.length; _i++) {
  5269. var child = _a[_i];
  5270. this.removeResourceFromIndex(child.id);
  5271. }
  5272. return resource;
  5273. }
  5274. else {
  5275. return false;
  5276. }
  5277. };
  5278. ResourceManager.prototype.removeResourceFromTree = function (resource, siblings) {
  5279. if (siblings === void 0) { siblings = this.topLevelResources; }
  5280. for (var i = 0; i < siblings.length; i++) {
  5281. var sibling = siblings[i];
  5282. if (sibling === resource) {
  5283. resource.parent = null;
  5284. siblings.splice(i, 1);
  5285. return true;
  5286. }
  5287. if (this.removeResourceFromTree(resource, sibling.children)) {
  5288. return true;
  5289. }
  5290. }
  5291. return false;
  5292. };
  5293. // Resource Data Utils
  5294. // ------------------------------------------------------------------------------------------------------------------
  5295. ResourceManager.prototype.buildResource = function (resourceInput) {
  5296. var _this = this;
  5297. var resource = $.extend({}, resourceInput);
  5298. var rawClassName = resourceInput.eventClassName;
  5299. resource.id = String(resourceInput.id != null ?
  5300. resourceInput.id :
  5301. '_fc' + (ResourceManager.resourceGuid++));
  5302. // TODO: consolidate repeat logic
  5303. resource.eventClassName = (function () {
  5304. switch ($.type(rawClassName)) {
  5305. case 'string':
  5306. return rawClassName.split(/\s+/);
  5307. case 'array':
  5308. return rawClassName;
  5309. default:
  5310. return [];
  5311. }
  5312. })();
  5313. if (resourceInput.businessHours) {
  5314. resource.businessHourGenerator = new fullcalendar_1.BusinessHourGenerator(resourceInput.businessHours, this.calendar);
  5315. }
  5316. resource.children = (resourceInput.children || []).map(function (childInput) {
  5317. var child = _this.buildResource(childInput);
  5318. child.parent = resource;
  5319. return child;
  5320. });
  5321. return resource;
  5322. };
  5323. ResourceManager.resourceGuid = 1;
  5324. ResourceManager.ajaxDefaults = {
  5325. dataType: 'json',
  5326. cache: false
  5327. };
  5328. return ResourceManager;
  5329. }(fullcalendar_1.Class));
  5330. exports.default = ResourceManager;
  5331. fullcalendar_1.EmitterMixin.mixInto(ResourceManager);
  5332. /***/ }),
  5333. /* 50 */
  5334. /***/ (function(module, exports, __webpack_require__) {
  5335. Object.defineProperty(exports, "__esModule", { value: true });
  5336. var $ = __webpack_require__(2);
  5337. var fullcalendar_1 = __webpack_require__(0);
  5338. var Resource_1 = __webpack_require__(19);
  5339. var ResourceComponentFootprint_1 = __webpack_require__(6);
  5340. var origMethods = {
  5341. getPeerEventInstances: fullcalendar_1.Constraints.prototype.getPeerEventInstances,
  5342. isFootprintAllowed: fullcalendar_1.Constraints.prototype.isFootprintAllowed,
  5343. buildCurrentBusinessFootprints: fullcalendar_1.Constraints.prototype.buildCurrentBusinessFootprints,
  5344. footprintContainsFootprint: fullcalendar_1.Constraints.prototype.footprintContainsFootprint,
  5345. footprintsIntersect: fullcalendar_1.Constraints.prototype.footprintsIntersect,
  5346. eventRangeToEventFootprints: fullcalendar_1.Constraints.prototype.eventRangeToEventFootprints,
  5347. parseFootprints: fullcalendar_1.Constraints.prototype.parseFootprints
  5348. };
  5349. fullcalendar_1.Constraints.prototype.getPeerEventInstances = function (subjectEventDef) {
  5350. var subjectResourceIds = subjectEventDef.getResourceIds();
  5351. var peerInstances = origMethods.getPeerEventInstances.apply(this, arguments);
  5352. if (!subjectResourceIds.length) {
  5353. return peerInstances;
  5354. }
  5355. else {
  5356. return peerInstances.filter(function (peerInstance) {
  5357. // always consider non-resource events to be peers
  5358. if (!peerInstance.def.resourceIds.length) {
  5359. return true;
  5360. }
  5361. // has same resource? consider it a peer
  5362. for (var _i = 0, subjectResourceIds_1 = subjectResourceIds; _i < subjectResourceIds_1.length; _i++) {
  5363. var resourceId = subjectResourceIds_1[_i];
  5364. if (peerInstance.def.hasResourceId(resourceId)) {
  5365. return true;
  5366. }
  5367. }
  5368. return false;
  5369. });
  5370. }
  5371. };
  5372. // enforce resource ID constraint
  5373. fullcalendar_1.Constraints.prototype.isFootprintAllowed = function (footprint, peerEventFootprints, constraintVal, overlapVal, subjectEventInstance) {
  5374. if (typeof constraintVal === 'object') {
  5375. var constrainToResourceIds = Resource_1.default.extractIds(constraintVal, this);
  5376. if (constrainToResourceIds.length && (!(footprint instanceof ResourceComponentFootprint_1.default) ||
  5377. $.inArray(footprint.resourceId, constrainToResourceIds) === -1)) {
  5378. return false;
  5379. }
  5380. }
  5381. return origMethods.isFootprintAllowed.apply(this, arguments);
  5382. };
  5383. fullcalendar_1.Constraints.prototype.buildCurrentBusinessFootprints = function (isAllDay) {
  5384. var flatResources = this._calendar.resourceManager.getFlatResources();
  5385. var anyCustomBusinessHours = false;
  5386. // any per-resource business hours? or will one global businessHours suffice?
  5387. for (var _i = 0, flatResources_1 = flatResources; _i < flatResources_1.length; _i++) {
  5388. var resource = flatResources_1[_i];
  5389. if (resource.businessHourGenerator) {
  5390. anyCustomBusinessHours = true;
  5391. }
  5392. }
  5393. // if there are any custom business hours, all business hours must be sliced per-resources
  5394. if (anyCustomBusinessHours) {
  5395. var view = this._calendar.view;
  5396. var generalBusinessHourGenerator = view.get('businessHourGenerator');
  5397. var unzonedRange = view.dateProfile.activeUnzonedRange;
  5398. var componentFootprints = [];
  5399. for (var _a = 0, flatResources_2 = flatResources; _a < flatResources_2.length; _a++) {
  5400. var resource = flatResources_2[_a];
  5401. var businessHourGenerator = resource.businessHourGenerator || generalBusinessHourGenerator;
  5402. var eventInstanceGroup = businessHourGenerator.buildEventInstanceGroup(isAllDay, unzonedRange);
  5403. if (eventInstanceGroup) {
  5404. for (var _b = 0, _c = eventInstanceGroup.getAllEventRanges(); _b < _c.length; _b++) {
  5405. var eventRange = _c[_b];
  5406. componentFootprints.push(new ResourceComponentFootprint_1.default(eventRange.unzonedRange, isAllDay, // isAllDay
  5407. resource.id));
  5408. }
  5409. }
  5410. }
  5411. return componentFootprints;
  5412. }
  5413. else {
  5414. return origMethods.buildCurrentBusinessFootprints.apply(this, arguments);
  5415. }
  5416. };
  5417. fullcalendar_1.Constraints.prototype.footprintContainsFootprint = function (outerFootprint, innerFootprint) {
  5418. if (outerFootprint instanceof ResourceComponentFootprint_1.default &&
  5419. (!(innerFootprint instanceof ResourceComponentFootprint_1.default) ||
  5420. (innerFootprint.resourceId !== outerFootprint.resourceId))) {
  5421. return false;
  5422. }
  5423. return origMethods.footprintContainsFootprint.apply(this, arguments);
  5424. };
  5425. fullcalendar_1.Constraints.prototype.footprintsIntersect = function (footprint0, footprint1) {
  5426. if (footprint0 instanceof ResourceComponentFootprint_1.default &&
  5427. footprint1 instanceof ResourceComponentFootprint_1.default &&
  5428. (footprint0.resourceId !== footprint1.resourceId)) {
  5429. return false;
  5430. }
  5431. return origMethods.footprintsIntersect.apply(this, arguments);
  5432. };
  5433. /*
  5434. TODO: somehow more DRY with DateComponent::eventRangeToEventFootprints monkeypatch
  5435. */
  5436. fullcalendar_1.Constraints.prototype.eventRangeToEventFootprints = function (eventRange) {
  5437. var eventDef = eventRange.eventDef;
  5438. var resourceIds = eventDef.getResourceIds();
  5439. if (resourceIds.length) {
  5440. return resourceIds.map(function (resourceId) { return (new fullcalendar_1.EventFootprint(new ResourceComponentFootprint_1.default(eventRange.unzonedRange, eventDef.isAllDay(), resourceId), eventDef, eventRange.eventInstance // might not exist
  5441. )); });
  5442. }
  5443. else {
  5444. return origMethods.eventRangeToEventFootprints.apply(this, arguments);
  5445. }
  5446. };
  5447. fullcalendar_1.Constraints.prototype.parseFootprints = function (input) {
  5448. var plainFootprints = origMethods.parseFootprints.apply(this, arguments);
  5449. var resourceIds = input.resourceIds || [];
  5450. if (input.resourceId) {
  5451. resourceIds = [input.resourceId].concat(resourceIds);
  5452. }
  5453. if (resourceIds.length) {
  5454. var footprints = [];
  5455. for (var _i = 0, resourceIds_1 = resourceIds; _i < resourceIds_1.length; _i++) {
  5456. var resourceId = resourceIds_1[_i];
  5457. for (var _a = 0, plainFootprints_1 = plainFootprints; _a < plainFootprints_1.length; _a++) {
  5458. var plainFootprint = plainFootprints_1[_a];
  5459. footprints.push(new ResourceComponentFootprint_1.default(plainFootprint.unzonedRange, plainFootprint.isAllDay, resourceId));
  5460. }
  5461. }
  5462. return footprints;
  5463. }
  5464. else {
  5465. return plainFootprints;
  5466. }
  5467. };
  5468. /***/ }),
  5469. /* 51 */
  5470. /***/ (function(module, exports, __webpack_require__) {
  5471. Object.defineProperty(exports, "__esModule", { value: true });
  5472. var fullcalendar_1 = __webpack_require__(0);
  5473. var license_1 = __webpack_require__(52);
  5474. // pre-monkeypatch methods
  5475. var origMethods = {
  5476. setElement: fullcalendar_1.View.prototype.setElement,
  5477. removeElement: fullcalendar_1.View.prototype.removeElement,
  5478. triggerViewRender: fullcalendar_1.View.prototype.triggerViewRender
  5479. };
  5480. // new properties
  5481. fullcalendar_1.View.prototype.canHandleSpecificResources = false;
  5482. // View Rendering
  5483. // --------------------------------------------------------------------------------------------------
  5484. fullcalendar_1.View.prototype.setElement = function () {
  5485. origMethods.setElement.apply(this, arguments);
  5486. this.watchResources(); // do after have the el, because might render, which assumes a render skeleton
  5487. };
  5488. fullcalendar_1.View.prototype.removeElement = function () {
  5489. this.unwatchResources();
  5490. origMethods.removeElement.apply(this, arguments);
  5491. };
  5492. // Show the warning even for non-resource views
  5493. // inject license key before 'viewRender' which is called by super's afterBaseDisplay
  5494. fullcalendar_1.View.prototype.triggerViewRender = function () {
  5495. license_1.processLicenseKey(this.opt('schedulerLicenseKey'), this.el // container element
  5496. );
  5497. origMethods.triggerViewRender.apply(this, arguments);
  5498. };
  5499. // Resource Binding
  5500. // --------------------------------------------------------------------------------------------------
  5501. fullcalendar_1.View.prototype.watchResources = function () {
  5502. var _this = this;
  5503. var initialDepNames = [];
  5504. var bindingDepNames = ['initialResources'];
  5505. if (this.opt('refetchResourcesOnNavigate')) {
  5506. initialDepNames.push('dateProfile');
  5507. }
  5508. if (this.opt('filterResourcesWithEvents')) {
  5509. bindingDepNames.push('currentEvents');
  5510. }
  5511. this.watch('initialResources', initialDepNames, function (deps) {
  5512. return _this.getInitialResources(deps.dateProfile); // promise
  5513. });
  5514. this.watch('bindingResources', bindingDepNames, function (deps) {
  5515. _this.bindResourceChanges(deps.currentEvents);
  5516. _this.setResources(deps.initialResources, deps.currentEvents);
  5517. }, function () {
  5518. _this.unbindResourceChanges();
  5519. _this.unsetResources();
  5520. });
  5521. };
  5522. fullcalendar_1.View.prototype.unwatchResources = function () {
  5523. this.unwatch('initialResources');
  5524. this.unwatch('bindingResources');
  5525. };
  5526. // dateProfile is optional
  5527. fullcalendar_1.View.prototype.getInitialResources = function (dateProfile) {
  5528. var calendar = this.calendar;
  5529. if (dateProfile) {
  5530. return calendar.resourceManager.getResources(calendar.msToMoment(dateProfile.activeUnzonedRange.startMs, dateProfile.isRangeAllDay), calendar.msToMoment(dateProfile.activeUnzonedRange.endMs, dateProfile.isRangeAllDay));
  5531. }
  5532. else {
  5533. return calendar.resourceManager.getResources();
  5534. }
  5535. };
  5536. // eventsPayload is optional
  5537. fullcalendar_1.View.prototype.bindResourceChanges = function (eventsPayload) {
  5538. var _this = this;
  5539. this.listenTo(this.calendar.resourceManager, {
  5540. set: function (resources) {
  5541. _this.setResources(resources, eventsPayload);
  5542. },
  5543. unset: function () {
  5544. _this.unsetResources();
  5545. },
  5546. reset: function (resources) {
  5547. _this.resetResources(resources, eventsPayload);
  5548. },
  5549. add: function (resource, allResources) {
  5550. _this.addResource(resource, allResources, eventsPayload);
  5551. },
  5552. remove: function (resource, allResources) {
  5553. _this.removeResource(resource, allResources, eventsPayload);
  5554. }
  5555. });
  5556. };
  5557. fullcalendar_1.View.prototype.unbindResourceChanges = function () {
  5558. this.stopListeningTo(this.calendar.resourceManager);
  5559. };
  5560. // Event Rendering
  5561. // --------------------------------------------------------------------------------------------------
  5562. fullcalendar_1.View.watch('displayingEvents', ['displayingDates', 'hasEvents', 'currentResources'], function (deps) {
  5563. this.requestEventsRender(this.get('currentEvents'));
  5564. }, function () {
  5565. this.requestEventsUnrender();
  5566. });
  5567. // Resource Data
  5568. // --------------------------------------------------------------------------------------------------
  5569. // currentEvents is optional
  5570. fullcalendar_1.View.prototype.setResources = function (resources, eventsPayload) {
  5571. if (eventsPayload) {
  5572. resources = this.filterResourcesWithEvents(resources, eventsPayload);
  5573. }
  5574. this.set('currentResources', resources);
  5575. this.set('hasResources', true);
  5576. };
  5577. fullcalendar_1.View.prototype.unsetResources = function () {
  5578. this.unset('currentResources');
  5579. this.unset('hasResources');
  5580. };
  5581. // eventsPayload is optional
  5582. fullcalendar_1.View.prototype.resetResources = function (resources, eventsPayload) {
  5583. this.startBatchRender();
  5584. this.unsetResources();
  5585. this.setResources(resources, eventsPayload);
  5586. this.stopBatchRender();
  5587. };
  5588. // eventsPayload is optional
  5589. fullcalendar_1.View.prototype.addResource = function (resource, allResources, eventsPayload) {
  5590. if (!this.canHandleSpecificResources) {
  5591. this.resetResources(allResources, eventsPayload);
  5592. return;
  5593. }
  5594. if (eventsPayload) {
  5595. var a = this.filterResourcesWithEvents([resource], eventsPayload);
  5596. if (!a.length) {
  5597. resource = null;
  5598. }
  5599. }
  5600. if (resource) {
  5601. this.set('currentResources', allResources); // TODO: filter against eventsPayload?
  5602. this.handleResourceAdd(resource);
  5603. }
  5604. };
  5605. fullcalendar_1.View.prototype.removeResource = function (resource, allResources, eventsPayload) {
  5606. if (!this.canHandleSpecificResources) {
  5607. this.resetResources(allResources, eventsPayload);
  5608. return;
  5609. }
  5610. this.set('currentResources', allResources); // TODO: filter against eventsPayload?
  5611. this.handleResourceRemove(resource);
  5612. };
  5613. // Resource Change Handling
  5614. // --------------------------------------------------------------------------------------------------
  5615. fullcalendar_1.View.prototype.handleResourceAdd = function (resource) {
  5616. // subclasses should implement
  5617. };
  5618. fullcalendar_1.View.prototype.handleResourceRemove = function (resource) {
  5619. // subclasses should implement
  5620. };
  5621. // Resource Filtering
  5622. // ------------------------------------------------------------------------------------------------------------------
  5623. fullcalendar_1.View.prototype.filterResourcesWithEvents = function (resources, eventsPayload) {
  5624. var eventRanges = this.eventsPayloadToRanges(eventsPayload);
  5625. var resourceIdHits = {};
  5626. for (var _i = 0, eventRanges_1 = eventRanges; _i < eventRanges_1.length; _i++) {
  5627. var eventRange = eventRanges_1[_i];
  5628. for (var _a = 0, _b = eventRange.eventDef.getResourceIds(); _a < _b.length; _a++) {
  5629. var resourceId = _b[_a];
  5630. resourceIdHits[resourceId] = true;
  5631. }
  5632. }
  5633. return _filterResourcesWithEvents(resources, resourceIdHits);
  5634. };
  5635. fullcalendar_1.View.prototype.eventsPayloadToRanges = function (eventsPayload) {
  5636. var dateProfile = this._getDateProfile();
  5637. var allEventRanges = [];
  5638. for (var eventDefId in eventsPayload) {
  5639. var instanceGroup = eventsPayload[eventDefId];
  5640. var eventRanges = instanceGroup.sliceRenderRanges(dateProfile.activeUnzonedRange);
  5641. allEventRanges.push.apply(allEventRanges, (eventRanges || []));
  5642. }
  5643. return allEventRanges;
  5644. };
  5645. // provides a new structure with masked objects
  5646. function _filterResourcesWithEvents(sourceResources, resourceIdHits) {
  5647. var filteredResources = [];
  5648. for (var _i = 0, sourceResources_1 = sourceResources; _i < sourceResources_1.length; _i++) {
  5649. var sourceResource = sourceResources_1[_i];
  5650. if (sourceResource.children.length) {
  5651. var filteredChildren = _filterResourcesWithEvents(sourceResource.children, resourceIdHits);
  5652. if (filteredChildren.length || resourceIdHits[sourceResource.id]) {
  5653. var filteredResource = Object.create(sourceResource); // mask
  5654. filteredResource.children = filteredChildren;
  5655. filteredResources.push(filteredResource);
  5656. }
  5657. }
  5658. else { // no children, so no need to mask
  5659. if (resourceIdHits[sourceResource.id]) {
  5660. filteredResources.push(sourceResource);
  5661. }
  5662. }
  5663. }
  5664. return filteredResources;
  5665. }
  5666. /***/ }),
  5667. /* 52 */
  5668. /***/ (function(module, exports, __webpack_require__) {
  5669. Object.defineProperty(exports, "__esModule", { value: true });
  5670. var $ = __webpack_require__(2);
  5671. var moment = __webpack_require__(15);
  5672. var exportHooks = __webpack_require__(0);
  5673. var RELEASE_DATE = '2018-03-27'; // for Scheduler
  5674. var UPGRADE_WINDOW = { years: 1, weeks: 1 }; // 1 week leeway, for tz shift reasons too
  5675. var LICENSE_INFO_URL = 'http://fullcalendar.io/scheduler/license/';
  5676. var PRESET_LICENSE_KEYS = [
  5677. 'GPL-My-Project-Is-Open-Source',
  5678. 'CC-Attribution-NonCommercial-NoDerivatives'
  5679. ];
  5680. function processLicenseKey(key, containerEl) {
  5681. if (!isImmuneUrl(window.location.href) && !isValidKey(key)) {
  5682. if (!detectWarningInContainer(containerEl)) {
  5683. return renderingWarningInContainer('Please use a valid license key. <a href="' + LICENSE_INFO_URL + '">More Info</a>', containerEl);
  5684. }
  5685. }
  5686. }
  5687. exports.processLicenseKey = processLicenseKey;
  5688. /*
  5689. This decryption is not meant to be bulletproof. Just a way to remind about an upgrade.
  5690. */
  5691. function isValidKey(key) {
  5692. if ($.inArray(key, PRESET_LICENSE_KEYS) !== -1) {
  5693. return true;
  5694. }
  5695. var parts = (key || '').match(/^(\d+)\-fcs\-(\d+)$/);
  5696. if (parts && (parts[1].length === 10)) {
  5697. var purchaseDate = moment.utc(parseInt(parts[2], 10) * 1000);
  5698. var releaseDate = moment.utc(exportHooks.mockSchedulerReleaseDate || RELEASE_DATE);
  5699. if (releaseDate.isValid()) { // token won't be replaced in dev mode
  5700. var minPurchaseDate = releaseDate.clone().subtract(UPGRADE_WINDOW);
  5701. if (purchaseDate.isAfter(minPurchaseDate)) {
  5702. return true;
  5703. }
  5704. }
  5705. }
  5706. return false;
  5707. }
  5708. exports.isValidKey = isValidKey;
  5709. function isImmuneUrl(url) {
  5710. return /\w+\:\/\/fullcalendar\.io\/|\/demos\/[\w-]+\.html$/.test(url);
  5711. }
  5712. exports.isImmuneUrl = isImmuneUrl;
  5713. function renderingWarningInContainer(messageHtml, containerEl) {
  5714. return containerEl.append($('<div class="fc-license-message" />').html(messageHtml));
  5715. }
  5716. exports.renderingWarningInContainer = renderingWarningInContainer;
  5717. // returns boolean of whether a license message is already rendered
  5718. function detectWarningInContainer(containerEl) {
  5719. return containerEl.find('.fc-license-message').length >= 1;
  5720. }
  5721. exports.detectWarningInContainer = detectWarningInContainer;
  5722. /***/ }),
  5723. /* 53 */
  5724. /***/ (function(module, exports, __webpack_require__) {
  5725. Object.defineProperty(exports, "__esModule", { value: true });
  5726. var fullcalendar_1 = __webpack_require__(0);
  5727. var ResourceComponentFootprint_1 = __webpack_require__(6);
  5728. // references to pre-monkeypatched methods
  5729. var origMethods = {
  5730. eventRangeToEventFootprints: fullcalendar_1.DateComponent.prototype.eventRangeToEventFootprints
  5731. };
  5732. // configuration for subclasses
  5733. fullcalendar_1.DateComponent.prototype.isResourceFootprintsEnabled = false;
  5734. fullcalendar_1.DateComponent.prototype.eventRangeToEventFootprints = function (eventRange) {
  5735. if (!this.isResourceFootprintsEnabled) {
  5736. return origMethods.eventRangeToEventFootprints.apply(this, arguments);
  5737. }
  5738. else {
  5739. var eventDef_1 = eventRange.eventDef;
  5740. var resourceIds = eventDef_1.getResourceIds();
  5741. if (resourceIds.length) {
  5742. return resourceIds.map(function (resourceId) { return (new fullcalendar_1.EventFootprint(new ResourceComponentFootprint_1.default(eventRange.unzonedRange, eventDef_1.isAllDay(), resourceId), eventDef_1, eventRange.eventInstance // might not exist
  5743. )); });
  5744. }
  5745. else if (eventDef_1.hasBgRendering()) { // TODO: it's strange to be relying on this
  5746. return origMethods.eventRangeToEventFootprints.apply(this, arguments);
  5747. }
  5748. else {
  5749. return [];
  5750. }
  5751. }
  5752. };
  5753. // Resource Low-level Rendering
  5754. // ----------------------------------------------------------------------------------------------
  5755. // ResourceViewMixin wires these up
  5756. fullcalendar_1.DateComponent.prototype.renderResources = function (resources) {
  5757. this.callChildren('renderResources', arguments);
  5758. };
  5759. fullcalendar_1.DateComponent.prototype.unrenderResources = function () {
  5760. this.callChildren('unrenderResources', arguments);
  5761. };
  5762. fullcalendar_1.DateComponent.prototype.renderResource = function (resource) {
  5763. this.callChildren('renderResource', arguments);
  5764. };
  5765. fullcalendar_1.DateComponent.prototype.unrenderResource = function (resource) {
  5766. this.callChildren('unrenderResource', arguments);
  5767. };
  5768. /***/ }),
  5769. /* 54 */
  5770. /***/ (function(module, exports, __webpack_require__) {
  5771. Object.defineProperty(exports, "__esModule", { value: true });
  5772. var fullcalendar_1 = __webpack_require__(0);
  5773. // references to pre-monkeypatched methods
  5774. var origMethods = {
  5775. isEventDefDraggable: fullcalendar_1.InteractiveDateComponent.prototype.isEventDefDraggable
  5776. };
  5777. // configuration for subclasses
  5778. // whether we should attempt to render selections or resizes that span across different resources
  5779. fullcalendar_1.InteractiveDateComponent.prototype.allowCrossResource = true;
  5780. // ^ is this worth the complexity?
  5781. // if an event's dates are not draggable, but it's resource IS, still allow dragging
  5782. fullcalendar_1.InteractiveDateComponent.prototype.isEventDefDraggable = function (eventDef) {
  5783. return this.isEventDefResourceEditable(eventDef) ||
  5784. origMethods.isEventDefDraggable.call(this, eventDef);
  5785. };
  5786. fullcalendar_1.InteractiveDateComponent.prototype.isEventDefResourceEditable = function (eventDef) {
  5787. var bool = eventDef.resourceEditable;
  5788. if (bool == null) {
  5789. bool = (eventDef.source || {}).resourceEditable;
  5790. if (bool == null) {
  5791. bool = this.opt('eventResourceEditable');
  5792. if (bool == null) {
  5793. bool = this.isEventDefGenerallyEditable(eventDef);
  5794. }
  5795. }
  5796. }
  5797. return bool;
  5798. };
  5799. /***/ }),
  5800. /* 55 */
  5801. /***/ (function(module, exports, __webpack_require__) {
  5802. Object.defineProperty(exports, "__esModule", { value: true });
  5803. var fullcalendar_1 = __webpack_require__(0);
  5804. // references to pre-monkeypatched methods
  5805. var origMethods = {
  5806. getFallbackStylingObjs: fullcalendar_1.EventRenderer.prototype.getFallbackStylingObjs
  5807. };
  5808. fullcalendar_1.EventRenderer.prototype.designatedResource = null; // optionally set by caller. forces @currentResource
  5809. fullcalendar_1.EventRenderer.prototype.currentResource = null; // when set, will affect future rendered segs
  5810. fullcalendar_1.EventRenderer.prototype.beforeFgSegHtml = function (seg) {
  5811. var segResourceId = seg.footprint.componentFootprint.resourceId;
  5812. if (this.designatedResource) {
  5813. this.currentResource = this.designatedResource;
  5814. }
  5815. else if (segResourceId) {
  5816. this.currentResource = queryResourceObject(this, segResourceId);
  5817. }
  5818. else {
  5819. this.currentResource = null;
  5820. }
  5821. };
  5822. fullcalendar_1.EventRenderer.prototype.getFallbackStylingObjs = function (eventDef) {
  5823. var objs = origMethods.getFallbackStylingObjs.apply(this, arguments);
  5824. if (this.currentResource) {
  5825. objs.unshift(this.currentResource);
  5826. }
  5827. else {
  5828. var resources = [];
  5829. for (var _i = 0, _a = eventDef.getResourceIds(); _i < _a.length; _i++) {
  5830. var id = _a[_i];
  5831. var resource = queryResourceObject(this, id);
  5832. if (resource) {
  5833. resources.push(resource);
  5834. }
  5835. }
  5836. objs = resources.concat(objs);
  5837. }
  5838. return objs;
  5839. };
  5840. function queryResourceObject(eventRenderer, id) {
  5841. return eventRenderer.view.calendar.resourceManager.getResourceById(id);
  5842. }
  5843. /***/ }),
  5844. /* 56 */
  5845. /***/ (function(module, exports, __webpack_require__) {
  5846. Object.defineProperty(exports, "__esModule", { value: true });
  5847. var fullcalendar_1 = __webpack_require__(0);
  5848. var ResourceComponentFootprint_1 = __webpack_require__(6);
  5849. // references to pre-monkeypatched methods
  5850. var origMethods = {
  5851. computeSelectionFootprint: fullcalendar_1.DateSelecting.prototype.computeSelectionFootprint
  5852. };
  5853. fullcalendar_1.DateSelecting.prototype.computeSelectionFootprint = function (startFootprint, endFootprint) {
  5854. if (startFootprint.resourceId && endFootprint.resourceId &&
  5855. (startFootprint.resourceId !== endFootprint.resourceId) &&
  5856. !this.component.allowCrossResource) {
  5857. return null; // explicity disallow selection across two different resources
  5858. }
  5859. else {
  5860. var footprint = origMethods.computeSelectionFootprint.apply(this, arguments);
  5861. if (startFootprint.resourceId) {
  5862. // create a new footprint with resourceId data
  5863. footprint = new ResourceComponentFootprint_1.default(footprint.unzonedRange, footprint.isAllDay, startFootprint.resourceId);
  5864. }
  5865. return footprint;
  5866. }
  5867. };
  5868. /***/ }),
  5869. /* 57 */
  5870. /***/ (function(module, exports, __webpack_require__) {
  5871. Object.defineProperty(exports, "__esModule", { value: true });
  5872. var fullcalendar_1 = __webpack_require__(0);
  5873. // references to pre-monkeypatched methods
  5874. var origMethods = {
  5875. computeEventDropMutation: fullcalendar_1.EventDragging.prototype.computeEventDropMutation
  5876. };
  5877. /*
  5878. monkeypatching can cause an event to seem draggable if the resource is editable but the
  5879. start/end dates are NOT. make sure to account for this.
  5880. */
  5881. fullcalendar_1.EventDragging.prototype.computeEventDropMutation = function (startFootprint, endFootprint, eventDef) {
  5882. var isDatesDraggable = this.component.isEventDefStartEditable(eventDef);
  5883. if (startFootprint.resourceId && endFootprint.resourceId &&
  5884. (startFootprint.resourceId !== endFootprint.resourceId) &&
  5885. this.component.isEventDefResourceEditable(eventDef)) {
  5886. var mutation = new fullcalendar_1.EventDefMutation();
  5887. mutation.oldResourceId = startFootprint.resourceId;
  5888. mutation.newResourceId = endFootprint.resourceId;
  5889. if (isDatesDraggable) {
  5890. mutation.setDateMutation(this.computeEventDateMutation(startFootprint, endFootprint));
  5891. }
  5892. return mutation;
  5893. }
  5894. else if (isDatesDraggable) {
  5895. return origMethods.computeEventDropMutation.apply(this, arguments);
  5896. }
  5897. };
  5898. /***/ }),
  5899. /* 58 */
  5900. /***/ (function(module, exports, __webpack_require__) {
  5901. Object.defineProperty(exports, "__esModule", { value: true });
  5902. var fullcalendar_1 = __webpack_require__(0);
  5903. // references to pre-monkeypatched methods
  5904. var origMethods = {
  5905. computeEventStartResizeMutation: fullcalendar_1.EventResizing.prototype.computeEventStartResizeMutation,
  5906. computeEventEndResizeMutation: fullcalendar_1.EventResizing.prototype.computeEventEndResizeMutation
  5907. };
  5908. fullcalendar_1.EventResizing.prototype.computeEventStartResizeMutation = function (startFootprint, endFootprint, origEventFootprint) {
  5909. if (startFootprint.resourceId && endFootprint.resourceId &&
  5910. (startFootprint.resourceId !== endFootprint.resourceId) &&
  5911. !this.component.allowCrossResource) {
  5912. return null; // explicity disallow resizing across two different resources
  5913. }
  5914. else {
  5915. return origMethods.computeEventStartResizeMutation.apply(this, arguments);
  5916. }
  5917. };
  5918. fullcalendar_1.EventResizing.prototype.computeEventEndResizeMutation = function (startFootprint, endFootprint, origEventFootprint) {
  5919. if (startFootprint.resourceId && endFootprint.resourceId &&
  5920. (startFootprint.resourceId !== endFootprint.resourceId) &&
  5921. !this.component.allowCrossResource) {
  5922. return null; // explicity disallow resizing across two different resources
  5923. }
  5924. else {
  5925. return origMethods.computeEventEndResizeMutation.apply(this, arguments);
  5926. }
  5927. };
  5928. /***/ }),
  5929. /* 59 */
  5930. /***/ (function(module, exports, __webpack_require__) {
  5931. Object.defineProperty(exports, "__esModule", { value: true });
  5932. var fullcalendar_1 = __webpack_require__(0);
  5933. // references to pre-monkeypatched methods
  5934. var origMethods = {
  5935. computeExternalDrop: fullcalendar_1.ExternalDropping.prototype.computeExternalDrop
  5936. };
  5937. fullcalendar_1.ExternalDropping.prototype.computeExternalDrop = function (componentFootprint, meta) {
  5938. var eventDef = origMethods.computeExternalDrop.apply(this, arguments);
  5939. if (componentFootprint.resourceId) {
  5940. eventDef.addResourceId(componentFootprint.resourceId);
  5941. }
  5942. return eventDef;
  5943. };
  5944. /***/ }),
  5945. /* 60 */
  5946. /***/ (function(module, exports, __webpack_require__) {
  5947. Object.defineProperty(exports, "__esModule", { value: true });
  5948. var fullcalendar_1 = __webpack_require__(0);
  5949. // defineStandardProps won't work :(
  5950. // TODO: find a better way
  5951. fullcalendar_1.EventSource.prototype.standardPropMap.resourceEditable = true; // automatically transfer
  5952. /***/ }),
  5953. /* 61 */
  5954. /***/ (function(module, exports, __webpack_require__) {
  5955. Object.defineProperty(exports, "__esModule", { value: true });
  5956. var $ = __webpack_require__(2);
  5957. var fullcalendar_1 = __webpack_require__(0);
  5958. var Resource_1 = __webpack_require__(19);
  5959. var origMethods = {
  5960. applyMiscProps: fullcalendar_1.EventDef.prototype.applyMiscProps,
  5961. clone: fullcalendar_1.EventDef.prototype.clone,
  5962. toLegacy: fullcalendar_1.EventDef.prototype.toLegacy
  5963. };
  5964. fullcalendar_1.EventDef.defineStandardProps({
  5965. resourceEditable: true // automatically transfer
  5966. });
  5967. /*
  5968. new class members
  5969. */
  5970. fullcalendar_1.EventDef.prototype.resourceIds = null;
  5971. fullcalendar_1.EventDef.prototype.resourceEditable = null; // `null` is unspecified state
  5972. /*
  5973. NOTE: we can use defineStandardProps/applyManualStandardProps (example below)
  5974. once we do away with the deprecated eventResourceField.
  5975. */
  5976. fullcalendar_1.EventDef.prototype.applyMiscProps = function (rawProps) {
  5977. rawProps = $.extend({}, rawProps); // clone, because of delete
  5978. this.resourceIds = Resource_1.default.extractIds(rawProps, this.source.calendar);
  5979. delete rawProps.resourceId;
  5980. delete rawProps.resourceIds;
  5981. origMethods.applyMiscProps.apply(this, arguments);
  5982. };
  5983. /*
  5984. EventDef.defineStandardProps({
  5985. resourceId: false # manually handle
  5986. resourceIds: false # manually handle
  5987. });
  5988. EventDef.prototype.applyManualStandardProps = function(rawProps) {
  5989. origApplyManualStandardProps.apply(this, arguments);
  5990. this.resourceIds = Resource.extractIds(rawProps, this.source.calendar);
  5991. };
  5992. */
  5993. /*
  5994. resourceId should already be normalized
  5995. */
  5996. fullcalendar_1.EventDef.prototype.hasResourceId = function (resourceId) {
  5997. return $.inArray(resourceId, this.resourceIds) !== -1;
  5998. };
  5999. /*
  6000. resourceId should already be normalized
  6001. */
  6002. fullcalendar_1.EventDef.prototype.removeResourceId = function (resourceId) {
  6003. fullcalendar_1.removeExact(this.resourceIds, resourceId);
  6004. };
  6005. /*
  6006. resourceId should already be normalized
  6007. */
  6008. fullcalendar_1.EventDef.prototype.addResourceId = function (resourceId) {
  6009. if (!this.hasResourceId(resourceId)) {
  6010. this.resourceIds.push(resourceId);
  6011. }
  6012. };
  6013. fullcalendar_1.EventDef.prototype.getResourceIds = function () {
  6014. if (this.resourceIds) {
  6015. return this.resourceIds.slice(); // clone
  6016. }
  6017. else {
  6018. return [];
  6019. }
  6020. };
  6021. fullcalendar_1.EventDef.prototype.clone = function () {
  6022. var def = origMethods.clone.apply(this, arguments);
  6023. def.resourceIds = this.getResourceIds();
  6024. return def;
  6025. };
  6026. fullcalendar_1.EventDef.prototype.toLegacy = function () {
  6027. var obj = origMethods.toLegacy.apply(this, arguments);
  6028. var resourceIds = this.getResourceIds();
  6029. obj.resourceId =
  6030. resourceIds.length === 1 ?
  6031. resourceIds[0] :
  6032. null;
  6033. obj.resourceIds =
  6034. resourceIds.length > 1 ?
  6035. resourceIds :
  6036. null;
  6037. if (this.resourceEditable != null) { // allows an unspecified state
  6038. obj.resourceEditable = this.resourceEditable;
  6039. }
  6040. return obj;
  6041. };
  6042. /***/ }),
  6043. /* 62 */
  6044. /***/ (function(module, exports, __webpack_require__) {
  6045. Object.defineProperty(exports, "__esModule", { value: true });
  6046. var fullcalendar_1 = __webpack_require__(0);
  6047. var oldMutateSingle = fullcalendar_1.EventDefMutation.prototype.mutateSingle;
  6048. // either both will be set, or neither will be set
  6049. fullcalendar_1.EventDefMutation.prototype.oldResourceId = null;
  6050. fullcalendar_1.EventDefMutation.prototype.newResourceId = null;
  6051. fullcalendar_1.EventDefMutation.prototype.mutateSingle = function (eventDef) {
  6052. var undo = oldMutateSingle.apply(this, arguments);
  6053. var savedResourceIds = null;
  6054. if (this.oldResourceId && eventDef.hasResourceId(this.oldResourceId)) {
  6055. savedResourceIds = eventDef.getResourceIds();
  6056. eventDef.removeResourceId(this.oldResourceId);
  6057. eventDef.addResourceId(this.newResourceId);
  6058. }
  6059. return function () {
  6060. undo();
  6061. if (savedResourceIds) {
  6062. eventDef.resourceIds = savedResourceIds;
  6063. }
  6064. };
  6065. };
  6066. /***/ }),
  6067. /* 63 */
  6068. /***/ (function(module, exports, __webpack_require__) {
  6069. Object.defineProperty(exports, "__esModule", { value: true });
  6070. var fullcalendar_1 = __webpack_require__(0);
  6071. var TimelineView_1 = __webpack_require__(14);
  6072. fullcalendar_1.defineView('timeline', {
  6073. class: TimelineView_1.default,
  6074. defaults: {
  6075. eventResizableFromStart: true
  6076. }
  6077. });
  6078. fullcalendar_1.defineView('timelineDay', {
  6079. type: 'timeline',
  6080. duration: { days: 1 }
  6081. });
  6082. fullcalendar_1.defineView('timelineWeek', {
  6083. type: 'timeline',
  6084. duration: { weeks: 1 }
  6085. });
  6086. fullcalendar_1.defineView('timelineMonth', {
  6087. type: 'timeline',
  6088. duration: { months: 1 }
  6089. });
  6090. fullcalendar_1.defineView('timelineYear', {
  6091. type: 'timeline',
  6092. duration: { years: 1 }
  6093. });
  6094. /***/ }),
  6095. /* 64 */
  6096. /***/ (function(module, exports, __webpack_require__) {
  6097. Object.defineProperty(exports, "__esModule", { value: true });
  6098. var fullcalendar_1 = __webpack_require__(0);
  6099. var ResourceTimelineView_1 = __webpack_require__(30);
  6100. fullcalendar_1.getViewConfig('timeline').resourceClass = ResourceTimelineView_1.default;
  6101. fullcalendar_1.Calendar.defaults.resourcesInitiallyExpanded = true;
  6102. /***/ }),
  6103. /* 65 */
  6104. /***/ (function(module, exports, __webpack_require__) {
  6105. Object.defineProperty(exports, "__esModule", { value: true });
  6106. var fullcalendar_1 = __webpack_require__(0);
  6107. var ResourceBasicView_1 = __webpack_require__(22);
  6108. var ResourceMonthView_1 = __webpack_require__(23);
  6109. // TODO: make more DRY (with agenda's config too)
  6110. fullcalendar_1.getViewConfig('basic').queryResourceClass = function (viewSpec) {
  6111. var explicitGrouping = viewSpec.options.groupByResource ||
  6112. viewSpec.options.groupByDateAndResource;
  6113. var showsResources = false;
  6114. if (explicitGrouping != null) {
  6115. showsResources = explicitGrouping;
  6116. }
  6117. else if (viewSpec.duration) {
  6118. showsResources = viewSpec.duration.as('days') === 1;
  6119. }
  6120. if (showsResources) {
  6121. return ResourceBasicView_1.default;
  6122. }
  6123. };
  6124. fullcalendar_1.getViewConfig('month').queryResourceClass = function (viewSpec) {
  6125. if (viewSpec.options.groupByResource ||
  6126. viewSpec.options.groupByDateAndResource) {
  6127. return ResourceMonthView_1.default;
  6128. }
  6129. };
  6130. /***/ }),
  6131. /* 66 */
  6132. /***/ (function(module, exports, __webpack_require__) {
  6133. Object.defineProperty(exports, "__esModule", { value: true });
  6134. var fullcalendar_1 = __webpack_require__(0);
  6135. var ResourceAgendaView_1 = __webpack_require__(20);
  6136. /*
  6137. TODO: make more DRY, with basic's config
  6138. */
  6139. fullcalendar_1.getViewConfig('agenda').queryResourceClass = function (viewSpec) {
  6140. var explicitGrouping = viewSpec.options.groupByResource ||
  6141. viewSpec.options.groupByDateAndResource;
  6142. var showsResources = false;
  6143. if (explicitGrouping != null) {
  6144. showsResources = explicitGrouping;
  6145. }
  6146. else if (viewSpec.duration) {
  6147. showsResources = viewSpec.duration.as('days') === 1;
  6148. }
  6149. if (showsResources) {
  6150. return ResourceAgendaView_1.default;
  6151. }
  6152. };
  6153. /***/ }),
  6154. /* 67 */
  6155. /***/ (function(module, exports) {
  6156. Object.defineProperty(exports, "__esModule", { value: true });
  6157. /***/ }),
  6158. /* 68 */
  6159. /***/ (function(module, exports) {
  6160. Object.defineProperty(exports, "__esModule", { value: true });
  6161. /***/ })
  6162. /******/ ]);
  6163. });