jsgantt.js 210 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064
  1. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.JSGantt = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
  2. "use strict";
  3. Object.defineProperty(exports, "__esModule", { value: true });
  4. var jsGantt = require("./src/jsgantt");
  5. module.exports = jsGantt.JSGantt;
  6. exports.JSGantt = jsGantt.JSGantt;
  7. },{"./src/jsgantt":6}],2:[function(require,module,exports){
  8. "use strict";
  9. Object.defineProperty(exports, "__esModule", { value: true });
  10. var lang = require("./lang");
  11. var events_1 = require("./events");
  12. var general_utils_1 = require("./utils/general_utils");
  13. var task_1 = require("./task");
  14. var xml_1 = require("./xml");
  15. var draw_columns_1 = require("./draw_columns");
  16. var draw_utils_1 = require("./utils/draw_utils");
  17. var draw_dependencies_1 = require("./draw_dependencies");
  18. var options_1 = require("./options");
  19. var date_utils_1 = require("./utils/date_utils");
  20. /**
  21. * function that loads the main gantt chart properties and functions
  22. * @param pDiv (required) this is a div object created in HTML
  23. * @param pFormat (required) - used to indicate whether chart should be drawn in "hour", "day", "week", "month", or "quarter" format
  24. */
  25. exports.GanttChart = function (pDiv, pFormat) {
  26. this.vDiv = pDiv;
  27. this.vFormat = pFormat;
  28. this.vDivId = null;
  29. this.vUseFade = 1;
  30. this.vUseMove = 1;
  31. this.vUseRowHlt = 1;
  32. this.vUseToolTip = 1;
  33. this.vUseSort = 1;
  34. this.vUseSingleCell = 25000;
  35. this.vShowRes = 1;
  36. this.vShowDur = 1;
  37. this.vShowComp = 1;
  38. this.vShowStartDate = 1;
  39. this.vShowEndDate = 1;
  40. this.vShowPlanStartDate = 0;
  41. this.vShowPlanEndDate = 0;
  42. this.vShowCost = 0;
  43. this.vShowAddEntries = 0;
  44. this.vShowEndWeekDate = 1;
  45. this.vShowWeekends = 1;
  46. this.vShowTaskInfoRes = 1;
  47. this.vShowTaskInfoDur = 1;
  48. this.vShowTaskInfoComp = 1;
  49. this.vShowTaskInfoStartDate = 1;
  50. this.vShowTaskInfoEndDate = 1;
  51. this.vShowTaskInfoNotes = 1;
  52. this.vShowTaskInfoLink = 0;
  53. this.vShowDeps = 1;
  54. this.vTotalHeight = undefined;
  55. this.vWorkingDays = {
  56. 0: true,
  57. 1: true,
  58. 2: true,
  59. 3: true,
  60. 4: true,
  61. 5: true,
  62. 6: true
  63. };
  64. this.vEventClickCollapse = null;
  65. this.vEventClickRow = null;
  66. this.vEvents = {
  67. taskname: null,
  68. res: null,
  69. dur: null,
  70. comp: null,
  71. startdate: null,
  72. enddate: null,
  73. planstartdate: null,
  74. planenddate: null,
  75. cost: null,
  76. beforeDraw: null,
  77. afterDraw: null,
  78. beforeLineDraw: null,
  79. afterLineDraw: null,
  80. onLineDraw: null,
  81. onLineContainerHover: null
  82. };
  83. this.vEventsChange = {
  84. taskname: null,
  85. res: null,
  86. dur: null,
  87. comp: null,
  88. startdate: null,
  89. enddate: null,
  90. planstartdate: null,
  91. planenddate: null,
  92. cost: null,
  93. line: null
  94. };
  95. this.vResources = null;
  96. this.vAdditionalHeaders = {};
  97. this.vColumnOrder = draw_columns_1.COLUMN_ORDER;
  98. this.vEditable = false;
  99. this.vDebug = false;
  100. this.vShowSelector = new Array('top');
  101. this.vDateInputFormat = 'yyyy-mm-dd';
  102. this.vDateTaskTableDisplayFormat = date_utils_1.parseDateFormatStr('dd/mm/yyyy');
  103. this.vDateTaskDisplayFormat = date_utils_1.parseDateFormatStr('dd month yyyy');
  104. this.vHourMajorDateDisplayFormat = date_utils_1.parseDateFormatStr('day dd month yyyy');
  105. this.vHourMinorDateDisplayFormat = date_utils_1.parseDateFormatStr('HH');
  106. this.vDayMajorDateDisplayFormat = date_utils_1.parseDateFormatStr('dd/mm/yyyy');
  107. this.vDayMinorDateDisplayFormat = date_utils_1.parseDateFormatStr('dd');
  108. this.vWeekMajorDateDisplayFormat = date_utils_1.parseDateFormatStr('yyyy');
  109. this.vWeekMinorDateDisplayFormat = date_utils_1.parseDateFormatStr('dd/mm');
  110. this.vMonthMajorDateDisplayFormat = date_utils_1.parseDateFormatStr('yyyy');
  111. this.vMonthMinorDateDisplayFormat = date_utils_1.parseDateFormatStr('mon');
  112. this.vQuarterMajorDateDisplayFormat = date_utils_1.parseDateFormatStr('yyyy');
  113. this.vQuarterMinorDateDisplayFormat = date_utils_1.parseDateFormatStr('qq');
  114. this.vUseFullYear = date_utils_1.parseDateFormatStr('dd/mm/yyyy');
  115. this.vCaptionType;
  116. this.vDepId = 1;
  117. this.vTaskList = new Array();
  118. this.vFormatArr = new Array('hour', 'day', 'week', 'month', 'quarter');
  119. this.vMonthDaysArr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
  120. this.vProcessNeeded = true;
  121. this.vMinGpLen = 8;
  122. this.vScrollTo = '';
  123. this.vHourColWidth = 18;
  124. this.vDayColWidth = 18;
  125. this.vWeekColWidth = 36;
  126. this.vMonthColWidth = 36;
  127. this.vQuarterColWidth = 18;
  128. this.vRowHeight = 20;
  129. this.vTodayPx = -1;
  130. this.vLangs = lang;
  131. this.vLang = navigator.language && navigator.language in lang ? navigator.language : 'en';
  132. this.vChartBody = null;
  133. this.vChartHead = null;
  134. this.vListBody = null;
  135. this.vChartTable = null;
  136. this.vLines = null;
  137. this.vTimer = 20;
  138. this.vTooltipDelay = 1500;
  139. this.vTooltipTemplate = null;
  140. this.vMinDate = null;
  141. this.vMaxDate = null;
  142. this.includeGetSet = options_1.includeGetSet.bind(this);
  143. this.includeGetSet();
  144. this.mouseOver = events_1.mouseOver;
  145. this.mouseOut = events_1.mouseOut;
  146. this.addListener = events_1.addListener.bind(this);
  147. this.removeListener = events_1.removeListener.bind(this);
  148. this.createTaskInfo = task_1.createTaskInfo;
  149. this.AddTaskItem = task_1.AddTaskItem;
  150. this.AddTaskItemObject = task_1.AddTaskItemObject;
  151. this.RemoveTaskItem = task_1.RemoveTaskItem;
  152. this.ClearTasks = task_1.ClearTasks;
  153. this.getXMLProject = xml_1.getXMLProject;
  154. this.getXMLTask = xml_1.getXMLTask;
  155. this.CalcTaskXY = draw_utils_1.CalcTaskXY.bind(this);
  156. // sLine: Draw a straight line (colored one-pixel wide div)
  157. this.sLine = draw_utils_1.sLine.bind(this);
  158. this.drawDependency = draw_dependencies_1.drawDependency.bind(this);
  159. this.DrawDependencies = draw_dependencies_1.DrawDependencies.bind(this);
  160. this.getArrayLocationByID = draw_utils_1.getArrayLocationByID.bind(this);
  161. this.drawSelector = draw_utils_1.drawSelector.bind(this);
  162. this.clearDependencies = function () {
  163. var parent = this.getLines();
  164. if (this.vEventsChange.line &&
  165. typeof this.vEventsChange.line === 'function') {
  166. this.removeListener('click', this.vEventsChange.line, parent);
  167. this.addListener('click', this.vEventsChange.line, parent);
  168. }
  169. while (parent.hasChildNodes())
  170. parent.removeChild(parent.firstChild);
  171. this.vDepId = 1;
  172. };
  173. this.drawListHead = function (vLeftHeader) {
  174. var _this = this;
  175. var vTmpDiv = draw_utils_1.newNode(vLeftHeader, 'div', this.vDivId + 'glisthead', 'glistlbl gcontainercol');
  176. var gListLbl = vTmpDiv;
  177. this.setListBody(vTmpDiv);
  178. var vTmpTab = draw_utils_1.newNode(vTmpDiv, 'table', null, 'gtasktableh');
  179. var vTmpTBody = draw_utils_1.newNode(vTmpTab, 'tbody');
  180. var vTmpRow = draw_utils_1.newNode(vTmpTBody, 'tr');
  181. draw_utils_1.newNode(vTmpRow, 'td', null, 'gtasklist', '\u00A0');
  182. var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gtaskname', null, null, null, null, this.getColumnOrder().length + 1);
  183. vTmpCell.appendChild(this.drawSelector('top'));
  184. vTmpRow = draw_utils_1.newNode(vTmpTBody, 'tr');
  185. draw_utils_1.newNode(vTmpRow, 'td', null, 'gtasklist', '\u00A0');
  186. draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskname', '\u00A0');
  187. this.getColumnOrder().forEach(function (column) {
  188. if (_this[column] == 1 || column === 'vAdditionalHeaders') {
  189. draw_columns_1.draw_task_headings(column, vTmpRow, _this.vLangs, _this.vLang, _this.vAdditionalHeaders, _this.vEvents);
  190. }
  191. });
  192. return gListLbl;
  193. };
  194. this.drawListBody = function (vLeftHeader) {
  195. var _this = this;
  196. var vTmpContentTabOuterWrapper = draw_utils_1.newNode(vLeftHeader, 'div', null, 'gtasktableouterwrapper');
  197. var vTmpContentTabWrapper = draw_utils_1.newNode(vTmpContentTabOuterWrapper, 'div', null, 'gtasktablewrapper');
  198. vTmpContentTabWrapper.style.width = "calc(100% + " + general_utils_1.getScrollbarWidth() + "px)";
  199. var vTmpContentTab = draw_utils_1.newNode(vTmpContentTabWrapper, 'table', null, 'gtasktable');
  200. var vTmpContentTBody = draw_utils_1.newNode(vTmpContentTab, 'tbody');
  201. var vNumRows = 0;
  202. var _loop_1 = function (i) {
  203. var vBGColor = void 0;
  204. if (this_1.vTaskList[i].getGroup() == 1)
  205. vBGColor = 'ggroupitem';
  206. else
  207. vBGColor = 'glineitem';
  208. var vID = this_1.vTaskList[i].getID();
  209. var vTmpRow_1, vTmpCell_1 = void 0;
  210. if ((!(this_1.vTaskList[i].getParItem() && this_1.vTaskList[i].getParItem().getGroup() == 2)) || this_1.vTaskList[i].getGroup() == 2) {
  211. if (this_1.vTaskList[i].getVisible() == 0)
  212. vTmpRow_1 = draw_utils_1.newNode(vTmpContentTBody, 'tr', this_1.vDivId + 'child_' + vID, 'gname ' + vBGColor, null, null, null, 'none');
  213. else
  214. vTmpRow_1 = draw_utils_1.newNode(vTmpContentTBody, 'tr', this_1.vDivId + 'child_' + vID, 'gname ' + vBGColor);
  215. this_1.vTaskList[i].setListChildRow(vTmpRow_1);
  216. draw_utils_1.newNode(vTmpRow_1, 'td', null, 'gtasklist', '\u00A0');
  217. var editableClass = this_1.vEditable ? 'gtaskname gtaskeditable' : 'gtaskname';
  218. vTmpCell_1 = draw_utils_1.newNode(vTmpRow_1, 'td', null, editableClass);
  219. var vCellContents = '';
  220. for (var j = 1; j < this_1.vTaskList[i].getLevel(); j++) {
  221. vCellContents += '\u00A0\u00A0\u00A0\u00A0';
  222. }
  223. var task_2 = this_1.vTaskList[i];
  224. var vEventClickRow_1 = this_1.vEventClickRow;
  225. var vEventClickCollapse_1 = this_1.vEventClickCollapse;
  226. events_1.addListener('click', function (e) {
  227. if (e.target.classList.contains('gfoldercollapse') === false) {
  228. if (vEventClickRow_1 && typeof vEventClickRow_1 === "function") {
  229. vEventClickRow_1(task_2);
  230. }
  231. }
  232. else {
  233. if (vEventClickCollapse_1 && typeof vEventClickCollapse_1 === "function") {
  234. vEventClickCollapse_1(task_2);
  235. }
  236. }
  237. }, vTmpRow_1);
  238. if (this_1.vTaskList[i].getGroup() == 1) {
  239. var vTmpDiv = draw_utils_1.newNode(vTmpCell_1, 'div', null, null, vCellContents);
  240. var vTmpSpan = draw_utils_1.newNode(vTmpDiv, 'span', this_1.vDivId + 'group_' + vID, 'gfoldercollapse', (this_1.vTaskList[i].getOpen() == 1) ? '-' : '+');
  241. this_1.vTaskList[i].setGroupSpan(vTmpSpan);
  242. events_1.addFolderListeners(this_1, vTmpSpan, vID);
  243. var divTask = document.createElement('span');
  244. divTask.innerHTML = '\u00A0' + this_1.vTaskList[i].getName();
  245. vTmpDiv.appendChild(divTask);
  246. // const text = makeInput(this.vTaskList[i].getName(), this.vEditable, 'text');
  247. // vTmpDiv.appendChild(document.createNode(text));
  248. var callback = function (task, e) { return task.setName(e.target.value); };
  249. events_1.addListenerInputCell(vTmpCell_1, this_1.vEventsChange, callback, this_1.vTaskList, i, 'taskname', this_1.Draw.bind(this_1));
  250. events_1.addListenerClickCell(vTmpDiv, this_1.vEvents, this_1.vTaskList[i], 'taskname');
  251. }
  252. else {
  253. vCellContents += '\u00A0\u00A0\u00A0\u00A0';
  254. var text = draw_utils_1.makeInput(this_1.vTaskList[i].getName(), this_1.vEditable, 'text');
  255. var vTmpDiv = draw_utils_1.newNode(vTmpCell_1, 'div', null, null, vCellContents + text);
  256. var callback = function (task, e) { return task.setName(e.target.value); };
  257. events_1.addListenerInputCell(vTmpCell_1, this_1.vEventsChange, callback, this_1.vTaskList, i, 'taskname', this_1.Draw.bind(this_1));
  258. events_1.addListenerClickCell(vTmpCell_1, this_1.vEvents, this_1.vTaskList[i], 'taskname');
  259. }
  260. this_1.getColumnOrder().forEach(function (column) {
  261. if (_this[column] == 1 || column === 'vAdditionalHeaders') {
  262. draw_columns_1.draw_header(column, i, vTmpRow_1, _this.vTaskList, _this.vEditable, _this.vEventsChange, _this.vEvents, _this.vDateTaskTableDisplayFormat, _this.vAdditionalHeaders, _this.vFormat, _this.vLangs, _this.vLang, _this.vResources, _this.Draw.bind(_this));
  263. }
  264. });
  265. vNumRows++;
  266. }
  267. };
  268. var this_1 = this;
  269. for (var i = 0; i < this.vTaskList.length; i++) {
  270. _loop_1(i);
  271. }
  272. // Render no daa in the chart
  273. if (this.vTaskList.length == 0) {
  274. var totalColumns = this.getColumnOrder()
  275. .filter(function (column) { return _this[column] == 1 || column === 'vAdditionalHeaders'; })
  276. .length;
  277. var vTmpRow_2 = draw_utils_1.newNode(vTmpContentTBody, 'tr', this.vDivId + 'child_', 'gname ');
  278. // this.vTaskList[i].setListChildRow(vTmpRow);
  279. var vTmpCell_2 = draw_utils_1.newNode(vTmpRow_2, 'td', null, 'gtasknolist', '', null, null, null, totalColumns);
  280. var vOutput = document.createDocumentFragment();
  281. draw_utils_1.newNode(vOutput, 'div', null, 'gtasknolist-label', this.vLangs[this.vLang]['nodata'] + '.');
  282. vTmpCell_2.appendChild(vOutput);
  283. }
  284. // DRAW the date format selector at bottom left.
  285. var vTmpRow = draw_utils_1.newNode(vTmpContentTBody, 'tr');
  286. draw_utils_1.newNode(vTmpRow, 'td', null, 'gtasklist', '\u00A0');
  287. var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gspanning gtaskname');
  288. vTmpCell.appendChild(this.drawSelector('bottom'));
  289. this.getColumnOrder().forEach(function (column) {
  290. if (_this[column] == 1 || column === 'vAdditionalHeaders') {
  291. draw_columns_1.draw_bottom(column, vTmpRow, _this.vAdditionalHeaders);
  292. }
  293. });
  294. // Add some white space so the vertical scroll distance should always be greater
  295. // than for the right pane (keep to a minimum as it is seen in unconstrained height designs)
  296. // newNode(vTmpDiv2, 'br');
  297. // newNode(vTmpDiv2, 'br');
  298. return {
  299. vNumRows: vNumRows,
  300. vTmpContentTabWrapper: vTmpContentTabWrapper
  301. };
  302. };
  303. /**
  304. *
  305. * DRAW CHAR HEAD
  306. *
  307. */
  308. this.drawChartHead = function (vMinDate, vMaxDate, vColWidth, vNumRows) {
  309. var vRightHeader = document.createDocumentFragment();
  310. var vTmpDiv = draw_utils_1.newNode(vRightHeader, 'div', this.vDivId + 'gcharthead', 'gchartlbl gcontainercol');
  311. var gChartLbl = vTmpDiv;
  312. this.setChartHead(vTmpDiv);
  313. var vTmpTab = draw_utils_1.newNode(vTmpDiv, 'table', this.vDivId + 'chartTableh', 'gcharttableh');
  314. var vTmpTBody = draw_utils_1.newNode(vTmpTab, 'tbody');
  315. var vTmpRow = draw_utils_1.newNode(vTmpTBody, 'tr');
  316. var vTmpDate = new Date();
  317. vTmpDate.setFullYear(vMinDate.getFullYear(), vMinDate.getMonth(), vMinDate.getDate());
  318. if (this.vFormat == 'hour')
  319. vTmpDate.setHours(vMinDate.getHours());
  320. else
  321. vTmpDate.setHours(0);
  322. vTmpDate.setMinutes(0);
  323. vTmpDate.setSeconds(0);
  324. vTmpDate.setMilliseconds(0);
  325. var vColSpan = 1;
  326. // Major Date Header
  327. while (vTmpDate.getTime() <= vMaxDate.getTime()) {
  328. var vHeaderCellClass = 'gmajorheading';
  329. var vCellContents = '';
  330. if (this.vFormat == 'day') {
  331. var colspan = 7;
  332. if (!this.vShowWeekends) {
  333. vHeaderCellClass += ' headweekends';
  334. colspan = 5;
  335. }
  336. var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vHeaderCellClass, null, null, null, null, colspan);
  337. vCellContents += date_utils_1.formatDateStr(vTmpDate, this.vDayMajorDateDisplayFormat, this.vLangs[this.vLang]);
  338. vTmpDate.setDate(vTmpDate.getDate() + 6);
  339. if (this.vShowEndWeekDate == 1)
  340. vCellContents += ' - ' + date_utils_1.formatDateStr(vTmpDate, this.vDayMajorDateDisplayFormat, this.vLangs[this.vLang]);
  341. draw_utils_1.newNode(vTmpCell, 'div', null, null, vCellContents, vColWidth * colspan);
  342. vTmpDate.setDate(vTmpDate.getDate() + 1);
  343. }
  344. else if (this.vFormat == 'week') {
  345. var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vHeaderCellClass, null, vColWidth);
  346. draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vWeekMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth);
  347. vTmpDate.setDate(vTmpDate.getDate() + 7);
  348. }
  349. else if (this.vFormat == 'month') {
  350. vColSpan = (12 - vTmpDate.getMonth());
  351. if (vTmpDate.getFullYear() == vMaxDate.getFullYear())
  352. vColSpan -= (11 - vMaxDate.getMonth());
  353. var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vHeaderCellClass, null, null, null, null, vColSpan);
  354. draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vMonthMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth * vColSpan);
  355. vTmpDate.setFullYear(vTmpDate.getFullYear() + 1, 0, 1);
  356. }
  357. else if (this.vFormat == 'quarter') {
  358. vColSpan = (4 - Math.floor(vTmpDate.getMonth() / 3));
  359. if (vTmpDate.getFullYear() == vMaxDate.getFullYear())
  360. vColSpan -= (3 - Math.floor(vMaxDate.getMonth() / 3));
  361. var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vHeaderCellClass, null, null, null, null, vColSpan);
  362. draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vQuarterMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth * vColSpan);
  363. vTmpDate.setFullYear(vTmpDate.getFullYear() + 1, 0, 1);
  364. }
  365. else if (this.vFormat == 'hour') {
  366. vColSpan = (24 - vTmpDate.getHours());
  367. if (vTmpDate.getFullYear() == vMaxDate.getFullYear() &&
  368. vTmpDate.getMonth() == vMaxDate.getMonth() &&
  369. vTmpDate.getDate() == vMaxDate.getDate())
  370. vColSpan -= (23 - vMaxDate.getHours());
  371. var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vHeaderCellClass, null, null, null, null, vColSpan);
  372. draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vHourMajorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth * vColSpan);
  373. vTmpDate.setHours(0);
  374. vTmpDate.setDate(vTmpDate.getDate() + 1);
  375. }
  376. }
  377. vTmpRow = draw_utils_1.newNode(vTmpTBody, 'tr', null, 'footerdays');
  378. // Minor Date header and Cell Rows
  379. vTmpDate.setFullYear(vMinDate.getFullYear(), vMinDate.getMonth(), vMinDate.getDate()); // , vMinDate.getHours()
  380. if (this.vFormat == 'hour')
  381. vTmpDate.setHours(vMinDate.getHours());
  382. var vNumCols = 0;
  383. while (vTmpDate.getTime() <= vMaxDate.getTime()) {
  384. var vMinorHeaderCellClass = 'gminorheading';
  385. if (this.vFormat == 'day') {
  386. if (vTmpDate.getDay() % 6 == 0) {
  387. if (!this.vShowWeekends) {
  388. vTmpDate.setDate(vTmpDate.getDate() + 1);
  389. continue;
  390. }
  391. vMinorHeaderCellClass += 'wkend';
  392. }
  393. if (vTmpDate <= vMaxDate) {
  394. var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vMinorHeaderCellClass);
  395. draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vDayMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth);
  396. vNumCols++;
  397. }
  398. vTmpDate.setDate(vTmpDate.getDate() + 1);
  399. }
  400. else if (this.vFormat == 'week') {
  401. if (vTmpDate <= vMaxDate) {
  402. var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vMinorHeaderCellClass);
  403. draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vWeekMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth);
  404. vNumCols++;
  405. }
  406. vTmpDate.setDate(vTmpDate.getDate() + 7);
  407. }
  408. else if (this.vFormat == 'month') {
  409. if (vTmpDate <= vMaxDate) {
  410. var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vMinorHeaderCellClass);
  411. draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vMonthMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth);
  412. vNumCols++;
  413. }
  414. vTmpDate.setDate(vTmpDate.getDate() + 1);
  415. while (vTmpDate.getDate() > 1) {
  416. vTmpDate.setDate(vTmpDate.getDate() + 1);
  417. }
  418. }
  419. else if (this.vFormat == 'quarter') {
  420. if (vTmpDate <= vMaxDate) {
  421. var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vMinorHeaderCellClass);
  422. draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vQuarterMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth);
  423. vNumCols++;
  424. }
  425. vTmpDate.setDate(vTmpDate.getDate() + 81);
  426. while (vTmpDate.getDate() > 1)
  427. vTmpDate.setDate(vTmpDate.getDate() + 1);
  428. }
  429. else if (this.vFormat == 'hour') {
  430. for (var i = vTmpDate.getHours(); i < 24; i++) {
  431. vTmpDate.setHours(i); //works around daylight savings but may look a little odd on days where the clock goes forward
  432. if (vTmpDate <= vMaxDate) {
  433. var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, vMinorHeaderCellClass);
  434. draw_utils_1.newNode(vTmpCell, 'div', null, null, date_utils_1.formatDateStr(vTmpDate, this.vHourMinorDateDisplayFormat, this.vLangs[this.vLang]), vColWidth);
  435. vNumCols++;
  436. }
  437. }
  438. vTmpDate.setHours(0);
  439. vTmpDate.setDate(vTmpDate.getDate() + 1);
  440. }
  441. }
  442. var vDateRow = vTmpRow;
  443. // Calculate size of grids : Plus 3 because 1 border left + 2 of paddings
  444. var vTaskLeftPx = (vNumCols * (vColWidth + 3)) + 1;
  445. // Fix a small space at the end for day
  446. if (this.vFormat === 'day') {
  447. vTaskLeftPx += 2;
  448. }
  449. vTmpTab.style.width = vTaskLeftPx + 'px'; // Ensure that the headings has exactly the same width as the chart grid
  450. // const vTaskPlanLeftPx = (vNumCols * (vColWidth + 3)) + 1;
  451. var vSingleCell = false;
  452. if (this.vUseSingleCell !== 0 && this.vUseSingleCell < (vNumCols * vNumRows))
  453. vSingleCell = true;
  454. draw_utils_1.newNode(vTmpDiv, 'div', null, 'rhscrpad', null, null, vTaskLeftPx + 1);
  455. vTmpDiv = draw_utils_1.newNode(vRightHeader, 'div', null, 'glabelfooter');
  456. return { gChartLbl: gChartLbl, vTaskLeftPx: vTaskLeftPx, vSingleCell: vSingleCell, vDateRow: vDateRow, vRightHeader: vRightHeader, vNumCols: vNumCols };
  457. };
  458. /**
  459. *
  460. * DRAW CHART BODY
  461. *
  462. */
  463. this.drawCharBody = function (vTaskLeftPx, vTmpContentTabWrapper, gChartLbl, gListLbl, vMinDate, vMaxDate, vSingleCell, vNumCols, vColWidth, vDateRow) {
  464. var vRightTable = document.createDocumentFragment();
  465. var vTmpDiv = draw_utils_1.newNode(vRightTable, 'div', this.vDivId + 'gchartbody', 'gchartgrid gcontainercol');
  466. this.setChartBody(vTmpDiv);
  467. var vTmpTab = draw_utils_1.newNode(vTmpDiv, 'table', this.vDivId + 'chartTable', 'gcharttable', null, vTaskLeftPx);
  468. this.setChartTable(vTmpTab);
  469. draw_utils_1.newNode(vTmpDiv, 'div', null, 'rhscrpad', null, null, vTaskLeftPx + 1);
  470. var vTmpTBody = draw_utils_1.newNode(vTmpTab, 'tbody');
  471. var vTmpTFoot = draw_utils_1.newNode(vTmpTab, 'tfoot');
  472. events_1.syncScroll([vTmpContentTabWrapper, vTmpDiv], 'scrollTop');
  473. events_1.syncScroll([gChartLbl, vTmpDiv], 'scrollLeft');
  474. events_1.syncScroll([vTmpContentTabWrapper, gListLbl], 'scrollLeft');
  475. // Draw each row
  476. var i = 0;
  477. var j = 0;
  478. var bd;
  479. if (this.vDebug) {
  480. bd = new Date();
  481. console.info('before tasks loop', bd);
  482. }
  483. for (i = 0; i < this.vTaskList.length; i++) {
  484. var curTaskStart = this.vTaskList[i].getStart() ? this.vTaskList[i].getStart() : this.vTaskList[i].getPlanStart();
  485. var curTaskEnd = this.vTaskList[i].getEnd() ? this.vTaskList[i].getEnd() : this.vTaskList[i].getPlanEnd();
  486. var vTaskLeftPx_1 = general_utils_1.getOffset(vMinDate, curTaskStart, vColWidth, this.vFormat, this.vShowWeekends);
  487. var vTaskRightPx = general_utils_1.getOffset(curTaskStart, curTaskEnd, vColWidth, this.vFormat, this.vShowWeekends);
  488. var curTaskPlanStart = void 0, curTaskPlanEnd = void 0;
  489. curTaskPlanStart = this.vTaskList[i].getPlanStart();
  490. curTaskPlanEnd = this.vTaskList[i].getPlanEnd();
  491. var vTaskPlanLeftPx = 0;
  492. var vTaskPlanRightPx = 0;
  493. if (curTaskPlanStart && curTaskPlanEnd) {
  494. vTaskPlanLeftPx = general_utils_1.getOffset(vMinDate, curTaskPlanStart, vColWidth, this.vFormat, this.vShowWeekends);
  495. vTaskPlanRightPx = general_utils_1.getOffset(curTaskPlanStart, curTaskPlanEnd, vColWidth, this.vFormat, this.vShowWeekends);
  496. }
  497. var vID = this.vTaskList[i].getID();
  498. var vComb = (this.vTaskList[i].getParItem() && this.vTaskList[i].getParItem().getGroup() == 2);
  499. var vCellFormat = '';
  500. var vTmpDiv_1 = null;
  501. var vTmpItem = this.vTaskList[i];
  502. var vCaptClass = null;
  503. // set cell width only for first row because of table-layout:fixed
  504. var taskCellWidth = i === 0 ? vColWidth : null;
  505. if (this.vTaskList[i].getMile() && !vComb) {
  506. var vTmpRow = draw_utils_1.newNode(vTmpTBody, 'tr', this.vDivId + 'childrow_' + vID, 'gmileitem gmile' + this.vFormat, null, null, null, ((this.vTaskList[i].getVisible() == 0) ? 'none' : null));
  507. this.vTaskList[i].setChildRow(vTmpRow);
  508. events_1.addThisRowListeners(this, this.vTaskList[i].getListChildRow(), vTmpRow);
  509. var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskcell gtaskcellmile', null, vColWidth, null, null, null);
  510. vTmpDiv_1 = draw_utils_1.newNode(vTmpCell, 'div', null, 'gtaskcelldiv', '\u00A0\u00A0');
  511. vTmpDiv_1 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer', null, 12, vTaskLeftPx_1 + vTaskRightPx - 6);
  512. this.vTaskList[i].setBarDiv(vTmpDiv_1);
  513. var vTmpDiv2 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'taskbar_' + vID, this.vTaskList[i].getClass(), null, 12);
  514. this.vTaskList[i].setTaskDiv(vTmpDiv2);
  515. if (this.vTaskList[i].getCompVal() < 100)
  516. vTmpDiv2.appendChild(document.createTextNode('\u25CA'));
  517. else {
  518. vTmpDiv2 = draw_utils_1.newNode(vTmpDiv2, 'div', null, 'gmilediamond');
  519. draw_utils_1.newNode(vTmpDiv2, 'div', null, 'gmdtop');
  520. draw_utils_1.newNode(vTmpDiv2, 'div', null, 'gmdbottom');
  521. }
  522. vCaptClass = 'gmilecaption';
  523. if (!vSingleCell && !vComb) {
  524. this.drawColsChart(vNumCols, vTmpRow, taskCellWidth, vMinDate, vMaxDate);
  525. }
  526. }
  527. else {
  528. var vTaskWidth = vTaskRightPx;
  529. // Draw Group Bar which has outer div with inner group div
  530. // and several small divs to left and right to create angled-end indicators
  531. if (this.vTaskList[i].getGroup()) {
  532. vTaskWidth = (vTaskWidth > this.vMinGpLen && vTaskWidth < this.vMinGpLen * 2) ? this.vMinGpLen * 2 : vTaskWidth; // Expand to show two end points
  533. vTaskWidth = (vTaskWidth < this.vMinGpLen) ? this.vMinGpLen : vTaskWidth; // expand to show one end point
  534. var vTmpRow = draw_utils_1.newNode(vTmpTBody, 'tr', this.vDivId + 'childrow_' + vID, ((this.vTaskList[i].getGroup() == 2) ? 'glineitem gitem' : 'ggroupitem ggroup') + this.vFormat, null, null, null, ((this.vTaskList[i].getVisible() == 0) ? 'none' : null));
  535. this.vTaskList[i].setChildRow(vTmpRow);
  536. events_1.addThisRowListeners(this, this.vTaskList[i].getListChildRow(), vTmpRow);
  537. var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskcell gtaskcellbar', null, vColWidth, null, null);
  538. vTmpDiv_1 = draw_utils_1.newNode(vTmpCell, 'div', null, 'gtaskcelldiv', '\u00A0\u00A0');
  539. this.vTaskList[i].setCellDiv(vTmpDiv_1);
  540. if (this.vTaskList[i].getGroup() == 1) {
  541. vTmpDiv_1 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer', null, vTaskWidth, vTaskLeftPx_1);
  542. this.vTaskList[i].setBarDiv(vTmpDiv_1);
  543. var vTmpDiv2 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'taskbar_' + vID, this.vTaskList[i].getClass(), null, vTaskWidth);
  544. this.vTaskList[i].setTaskDiv(vTmpDiv2);
  545. draw_utils_1.newNode(vTmpDiv2, 'div', this.vDivId + 'complete_' + vID, this.vTaskList[i].getClass() + 'complete', null, this.vTaskList[i].getCompStr());
  546. draw_utils_1.newNode(vTmpDiv_1, 'div', null, this.vTaskList[i].getClass() + 'endpointleft');
  547. if (vTaskWidth >= this.vMinGpLen * 2)
  548. draw_utils_1.newNode(vTmpDiv_1, 'div', null, this.vTaskList[i].getClass() + 'endpointright');
  549. vCaptClass = 'ggroupcaption';
  550. }
  551. if (!vSingleCell && !vComb) {
  552. this.drawColsChart(vNumCols, vTmpRow, taskCellWidth, vMinDate, vMaxDate);
  553. }
  554. }
  555. else {
  556. vTaskWidth = (vTaskWidth <= 0) ? 1 : vTaskWidth;
  557. /**
  558. * DRAW THE BOXES FOR GANTT
  559. */
  560. var vTmpDivCell = void 0, vTmpRow = void 0;
  561. if (vComb) {
  562. vTmpDivCell = vTmpDiv_1 = this.vTaskList[i].getParItem().getCellDiv();
  563. }
  564. else {
  565. // Draw Task Bar which has colored bar div
  566. vTmpRow = draw_utils_1.newNode(vTmpTBody, 'tr', this.vDivId + 'childrow_' + vID, 'glineitem gitem' + this.vFormat, null, null, null, ((this.vTaskList[i].getVisible() == 0) ? 'none' : null));
  567. this.vTaskList[i].setChildRow(vTmpRow);
  568. events_1.addThisRowListeners(this, this.vTaskList[i].getListChildRow(), vTmpRow);
  569. var vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gtaskcell gtaskcellcolorbar', null, taskCellWidth, null, null);
  570. vTmpDivCell = vTmpDiv_1 = draw_utils_1.newNode(vTmpCell, 'div', null, 'gtaskcelldiv', '\u00A0\u00A0');
  571. }
  572. // DRAW TASK BAR
  573. vTmpDiv_1 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer', null, vTaskWidth, vTaskLeftPx_1);
  574. this.vTaskList[i].setBarDiv(vTmpDiv_1);
  575. var vTmpDiv2 = void 0;
  576. if (this.vTaskList[i].getStartVar()) {
  577. // textbar
  578. vTmpDiv2 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'taskbar_' + vID, this.vTaskList[i].getClass(), null, vTaskWidth);
  579. if (this.vTaskList[i].getBarText()) {
  580. draw_utils_1.newNode(vTmpDiv2, 'span', this.vDivId + 'tasktextbar_' + vID, 'textbar', this.vTaskList[i].getBarText(), this.vTaskList[i].getCompRestStr());
  581. }
  582. this.vTaskList[i].setTaskDiv(vTmpDiv2);
  583. }
  584. // PLANNED
  585. // If exist and one of them are different, show plan bar... show if there is no real vStart as well (just plan dates)
  586. if (vTaskPlanLeftPx && ((vTaskPlanLeftPx != vTaskLeftPx_1 || vTaskPlanRightPx != vTaskRightPx) || !this.vTaskList[i].getStartVar())) {
  587. var vTmpPlanDiv = draw_utils_1.newNode(vTmpDivCell, 'div', this.vDivId + 'bardiv_' + vID, 'gtaskbarcontainer gplan', null, vTaskPlanRightPx, vTaskPlanLeftPx);
  588. var vTmpPlanDiv2 = draw_utils_1.newNode(vTmpPlanDiv, 'div', this.vDivId + 'taskbar_' + vID, this.vTaskList[i].getClass() + ' gplan', null, vTaskPlanRightPx);
  589. this.vTaskList[i].setPlanTaskDiv(vTmpPlanDiv2);
  590. }
  591. // and opaque completion div
  592. if (vTmpDiv2) {
  593. draw_utils_1.newNode(vTmpDiv2, 'div', this.vDivId + 'complete_' + vID, this.vTaskList[i].getClass() + 'complete', null, this.vTaskList[i].getCompStr());
  594. }
  595. // caption
  596. if (vComb)
  597. vTmpItem = this.vTaskList[i].getParItem();
  598. if (!vComb || (vComb && this.vTaskList[i].getParItem().getEnd() == this.vTaskList[i].getEnd()))
  599. vCaptClass = 'gcaption';
  600. // Background cells
  601. if (!vSingleCell && !vComb && vTmpRow) {
  602. this.drawColsChart(vNumCols, vTmpRow, taskCellWidth, vMinDate, vMaxDate);
  603. }
  604. }
  605. }
  606. if (this.getCaptionType() && vCaptClass !== null) {
  607. var vCaptionStr = void 0;
  608. switch (this.getCaptionType()) {
  609. case 'Caption':
  610. vCaptionStr = vTmpItem.getCaption();
  611. break;
  612. case 'Resource':
  613. vCaptionStr = vTmpItem.getResource();
  614. break;
  615. case 'Duration':
  616. vCaptionStr = vTmpItem.getDuration(this.vFormat, this.vLangs[this.vLang]);
  617. break;
  618. case 'Complete':
  619. vCaptionStr = vTmpItem.getCompStr();
  620. break;
  621. }
  622. draw_utils_1.newNode(vTmpDiv_1, 'div', null, vCaptClass, vCaptionStr, 120, (vCaptClass == 'gmilecaption') ? 12 : 0);
  623. }
  624. // Add Task Info div for tooltip
  625. if (this.vTaskList[i].getTaskDiv() && vTmpDiv_1) {
  626. var vTmpDiv2 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'tt' + vID, null, null, null, null, 'none');
  627. var _a = this.createTaskInfo(this.vTaskList[i], this.vTooltipTemplate), component = _a.component, callback = _a.callback;
  628. vTmpDiv2.appendChild(component);
  629. events_1.addTooltipListeners(this, this.vTaskList[i].getTaskDiv(), vTmpDiv2, callback);
  630. }
  631. // Add Plan Task Info div for tooltip
  632. if (this.vTaskList[i].getPlanTaskDiv() && vTmpDiv_1) {
  633. var vTmpDiv2 = draw_utils_1.newNode(vTmpDiv_1, 'div', this.vDivId + 'tt' + vID, null, null, null, null, 'none');
  634. var _b = this.createTaskInfo(this.vTaskList[i], this.vTooltipTemplate), component = _b.component, callback = _b.callback;
  635. vTmpDiv2.appendChild(component);
  636. events_1.addTooltipListeners(this, this.vTaskList[i].getPlanTaskDiv(), vTmpDiv2, callback);
  637. }
  638. }
  639. // Include the footer with the days/week/month...
  640. if (vSingleCell) {
  641. var vTmpTFootTRow = draw_utils_1.newNode(vTmpTFoot, 'tr');
  642. var vTmpTFootTCell = draw_utils_1.newNode(vTmpTFootTRow, 'td', null, null, null, '100%');
  643. var vTmpTFootTCellTable = draw_utils_1.newNode(vTmpTFootTCell, 'table', null, 'gcharttableh', null, '100%');
  644. var vTmpTFootTCellTableTBody = draw_utils_1.newNode(vTmpTFootTCellTable, 'tbody');
  645. vTmpTFootTCellTableTBody.appendChild(vDateRow.cloneNode(true));
  646. }
  647. else {
  648. vTmpTFoot.appendChild(vDateRow.cloneNode(true));
  649. }
  650. return { vRightTable: vRightTable };
  651. };
  652. this.drawColsChart = function (vNumCols, vTmpRow, taskCellWidth, pStartDate, pEndDate) {
  653. if (pStartDate === void 0) { pStartDate = null; }
  654. if (pEndDate === void 0) { pEndDate = null; }
  655. var columnCurrentDay = null;
  656. // Find the Current day cell to put a different class
  657. if (this.vShowWeekends !== false && pStartDate && pEndDate && (this.vFormat == 'day' || this.vFormat == 'week')) {
  658. var curTaskStart = new Date(pStartDate.getTime());
  659. var curTaskEnd = new Date();
  660. var onePeriod = 3600000;
  661. if (this.vFormat == 'day') {
  662. onePeriod *= 24;
  663. }
  664. else if (this.vFormat == 'week') {
  665. onePeriod *= 24 * 7;
  666. }
  667. columnCurrentDay = Math.floor(general_utils_1.calculateCurrentDateOffset(curTaskStart, curTaskEnd) / onePeriod) - 1;
  668. }
  669. for (var j = 0; j < vNumCols - 1; j++) {
  670. var vCellFormat = 'gtaskcell gtaskcellcols';
  671. if (this.vShowWeekends !== false && this.vFormat == 'day' && ((j % 7 == 4) || (j % 7 == 5))) {
  672. vCellFormat = 'gtaskcellwkend';
  673. }
  674. //When is the column is the current day/week,give a different class
  675. else if ((this.vFormat == 'week' || this.vFormat == 'day') && j === columnCurrentDay) {
  676. vCellFormat = 'gtaskcellcurrent';
  677. }
  678. draw_utils_1.newNode(vTmpRow, 'td', null, vCellFormat, '\u00A0\u00A0', taskCellWidth);
  679. }
  680. };
  681. /**
  682. *
  683. *
  684. * DRAWING PROCESS
  685. *
  686. * vTaskRightPx,vTaskWidth,vTaskPlanLeftPx,vTaskPlanRightPx,vID
  687. */
  688. this.Draw = function () {
  689. var vMaxDate = new Date();
  690. var vMinDate = new Date();
  691. var vColWidth = 0;
  692. var bd;
  693. if (this.vEvents && this.vEvents.beforeDraw) {
  694. this.vEvents.beforeDraw();
  695. }
  696. if (this.vDebug) {
  697. bd = new Date();
  698. console.info('before draw', bd);
  699. }
  700. // Process all tasks, reset parent date and completion % if task list has altered
  701. if (this.vProcessNeeded)
  702. task_1.processRows(this.vTaskList, 0, -1, 1, 1, this.getUseSort(), this.vDebug);
  703. this.vProcessNeeded = false;
  704. // get overall min/max dates plus padding
  705. vMinDate = date_utils_1.getMinDate(this.vTaskList, this.vFormat, this.getMinDate() && date_utils_1.coerceDate(this.getMinDate()));
  706. vMaxDate = date_utils_1.getMaxDate(this.vTaskList, this.vFormat, this.getMaxDate() && date_utils_1.coerceDate(this.getMaxDate()));
  707. // Calculate chart width variables.
  708. if (this.vFormat == 'day')
  709. vColWidth = this.vDayColWidth;
  710. else if (this.vFormat == 'week')
  711. vColWidth = this.vWeekColWidth;
  712. else if (this.vFormat == 'month')
  713. vColWidth = this.vMonthColWidth;
  714. else if (this.vFormat == 'quarter')
  715. vColWidth = this.vQuarterColWidth;
  716. else if (this.vFormat == 'hour')
  717. vColWidth = this.vHourColWidth;
  718. // DRAW the Left-side of the chart (names, resources, comp%)
  719. var vLeftHeader = document.createDocumentFragment();
  720. /**
  721. * LIST HEAD
  722. */
  723. var gListLbl = this.drawListHead(vLeftHeader);
  724. /**
  725. * LIST BODY
  726. */
  727. var _a = this.drawListBody(vLeftHeader), vNumRows = _a.vNumRows, vTmpContentTabWrapper = _a.vTmpContentTabWrapper;
  728. /**
  729. * CHART HEAD
  730. */
  731. var _b = this.drawChartHead(vMinDate, vMaxDate, vColWidth, vNumRows), gChartLbl = _b.gChartLbl, vTaskLeftPx = _b.vTaskLeftPx, vSingleCell = _b.vSingleCell, vRightHeader = _b.vRightHeader, vDateRow = _b.vDateRow, vNumCols = _b.vNumCols;
  732. /**
  733. * CHART GRID
  734. */
  735. var vRightTable = this.drawCharBody(vTaskLeftPx, vTmpContentTabWrapper, gChartLbl, gListLbl, vMinDate, vMaxDate, vSingleCell, vNumCols, vColWidth, vDateRow).vRightTable;
  736. if (this.vDebug) {
  737. var ad = new Date();
  738. console.info('after tasks loop', ad, (ad.getTime() - bd.getTime()));
  739. }
  740. // MAIN VIEW: Appending all generated components to main view
  741. while (this.vDiv.hasChildNodes())
  742. this.vDiv.removeChild(this.vDiv.firstChild);
  743. var vTmpDiv = draw_utils_1.newNode(this.vDiv, 'div', null, 'gchartcontainer');
  744. vTmpDiv.style.height = this.vTotalHeight;
  745. var leftvTmpDiv = draw_utils_1.newNode(vTmpDiv, 'div', null, 'gmain gmainleft');
  746. leftvTmpDiv.appendChild(vLeftHeader);
  747. // leftvTmpDiv.appendChild(vLeftTable);
  748. var rightvTmpDiv = draw_utils_1.newNode(vTmpDiv, 'div', null, 'gmain gmainright');
  749. rightvTmpDiv.appendChild(vRightHeader);
  750. rightvTmpDiv.appendChild(vRightTable);
  751. vTmpDiv.appendChild(leftvTmpDiv);
  752. vTmpDiv.appendChild(rightvTmpDiv);
  753. draw_utils_1.newNode(vTmpDiv, 'div', null, 'ggridfooter');
  754. var vTmpDiv2 = draw_utils_1.newNode(this.getChartBody(), 'div', this.vDivId + 'Lines', 'glinediv');
  755. if (this.vEvents.onLineContainerHover && typeof this.vEvents.onLineContainerHover === 'function') {
  756. events_1.addListener('mouseover', this.vEvents.onLineContainerHover, vTmpDiv2);
  757. events_1.addListener('mouseout', this.vEvents.onLineContainerHover, vTmpDiv2);
  758. }
  759. vTmpDiv2.style.visibility = 'hidden';
  760. this.setLines(vTmpDiv2);
  761. /* Quick hack to show the generated HTML on older browsers
  762. let tmpGenSrc=document.createElement('textarea');
  763. tmpGenSrc.appendChild(document.createTextNode(vTmpDiv.innerHTML));
  764. vDiv.appendChild(tmpGenSrc);
  765. //*/
  766. // LISTENERS: Now all the content exists, register scroll listeners
  767. events_1.addScrollListeners(this);
  768. // SCROLL: now check if we are actually scrolling the pane
  769. if (this.vScrollTo != '') {
  770. var vScrollDate = new Date(vMinDate.getTime());
  771. var vScrollPx = 0;
  772. if (this.vScrollTo.substr && this.vScrollTo.substr(0, 2) == 'px') {
  773. vScrollPx = parseInt(this.vScrollTo.substr(2));
  774. }
  775. else {
  776. if (this.vScrollTo === 'today') {
  777. vScrollDate = new Date();
  778. }
  779. else if (this.vScrollTo instanceof Date) {
  780. vScrollDate = this.vScrollTo;
  781. }
  782. else {
  783. vScrollDate = date_utils_1.parseDateStr(this.vScrollTo, this.getDateInputFormat());
  784. }
  785. if (this.vFormat == 'hour')
  786. vScrollDate.setMinutes(0, 0, 0);
  787. else
  788. vScrollDate.setHours(0, 0, 0, 0);
  789. vScrollPx = general_utils_1.getOffset(vMinDate, vScrollDate, vColWidth, this.vFormat, this.vShowWeekends) - 30;
  790. }
  791. this.getChartBody().scrollLeft = vScrollPx;
  792. }
  793. if (vMinDate.getTime() <= (new Date()).getTime() && vMaxDate.getTime() >= (new Date()).getTime()) {
  794. this.vTodayPx = general_utils_1.getOffset(vMinDate, new Date(), vColWidth, this.vFormat, this.vShowWeekends);
  795. }
  796. else
  797. this.vTodayPx = -1;
  798. // DEPENDENCIES: Draw lines of Dependencies
  799. var bdd;
  800. if (this.vDebug) {
  801. bdd = new Date();
  802. console.info('before DrawDependencies', bdd);
  803. }
  804. if (this.vEvents && typeof this.vEvents.beforeLineDraw === 'function') {
  805. this.vEvents.beforeLineDraw();
  806. }
  807. this.DrawDependencies(this.vDebug);
  808. events_1.addListenerDependencies(this.vLineOptions);
  809. // EVENTS
  810. if (this.vEvents && typeof this.vEvents.afterLineDraw === 'function') {
  811. this.vEvents.afterLineDraw();
  812. }
  813. if (this.vDebug) {
  814. var ad = new Date();
  815. console.info('after DrawDependencies', ad, (ad.getTime() - bdd.getTime()));
  816. }
  817. this.drawComplete(vMinDate, vColWidth, bd);
  818. };
  819. /**
  820. * Actions after all the render process
  821. */
  822. this.drawComplete = function (vMinDate, vColWidth, bd) {
  823. if (this.vDebug) {
  824. var ad = new Date();
  825. console.info('after draw', ad, (ad.getTime() - bd.getTime()));
  826. }
  827. events_1.updateGridHeaderWidth(this);
  828. this.chartRowDateToX = function (date) {
  829. return general_utils_1.getOffset(vMinDate, date, vColWidth, this.vFormat, this.vShowWeekends);
  830. };
  831. if (this.vEvents && this.vEvents.afterDraw) {
  832. this.vEvents.afterDraw();
  833. }
  834. };
  835. if (this.vDiv && this.vDiv.nodeName && this.vDiv.nodeName.toLowerCase() == 'div')
  836. this.vDivId = this.vDiv.id;
  837. }; //GanttChart
  838. },{"./draw_columns":3,"./draw_dependencies":4,"./events":5,"./lang":8,"./options":9,"./task":10,"./utils/date_utils":11,"./utils/draw_utils":12,"./utils/general_utils":13,"./xml":14}],3:[function(require,module,exports){
  839. "use strict";
  840. Object.defineProperty(exports, "__esModule", { value: true });
  841. var date_utils_1 = require("./utils/date_utils");
  842. var task_1 = require("./task");
  843. var events_1 = require("./events");
  844. var draw_utils_1 = require("./utils/draw_utils");
  845. exports.COLUMN_ORDER = [
  846. 'vShowRes',
  847. 'vShowDur',
  848. 'vShowComp',
  849. 'vShowStartDate',
  850. 'vShowEndDate',
  851. 'vShowPlanStartDate',
  852. 'vShowPlanEndDate',
  853. 'vShowCost',
  854. 'vAdditionalHeaders',
  855. 'vShowAddEntries'
  856. ];
  857. var COLUMNS_TYPES = {
  858. 'vShowRes': 'res',
  859. 'vShowDur': 'dur',
  860. 'vShowComp': 'comp',
  861. 'vShowStartDate': 'startdate',
  862. 'vShowEndDate': 'enddate',
  863. 'vShowPlanStartDate': 'planstartdate',
  864. 'vShowPlanEndDate': 'planenddate',
  865. 'vShowCost': 'cost',
  866. 'vShowAddEntries': 'addentries'
  867. };
  868. exports.draw_header = function (column, i, vTmpRow, vTaskList, vEditable, vEventsChange, vEvents, vDateTaskTableDisplayFormat, vAdditionalHeaders, vFormat, vLangs, vLang, vResources, Draw) {
  869. var vTmpCell, vTmpDiv;
  870. if ('vShowRes' === column) {
  871. vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gres');
  872. var text = draw_utils_1.makeInput(vTaskList[i].getResource(), vEditable, 'resource', vTaskList[i].getResource(), vResources);
  873. vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text);
  874. var callback = function (task, e) { return task.setResource(e.target.value); };
  875. events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList, i, 'res', Draw, 'change');
  876. events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'res');
  877. }
  878. if ('vShowDur' === column) {
  879. vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gdur');
  880. var text = draw_utils_1.makeInput(vTaskList[i].getDuration(vFormat, vLangs[vLang]), vEditable, 'text', vTaskList[i].getDuration());
  881. vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text);
  882. var callback = function (task, e) { return task.setDuration(e.target.value); };
  883. events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList, i, 'dur', Draw);
  884. events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'dur');
  885. }
  886. if ('vShowComp' === column) {
  887. vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gcomp');
  888. var text = draw_utils_1.makeInput(vTaskList[i].getCompStr(), vEditable, 'percentage', vTaskList[i].getCompVal());
  889. vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text);
  890. var callback = function (task, e) { task.setComp(e.target.value); task.setCompVal(e.target.value); };
  891. events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList, i, 'comp', Draw);
  892. events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'comp');
  893. }
  894. if ('vShowStartDate' === column) {
  895. vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gstartdate');
  896. var v = date_utils_1.formatDateStr(vTaskList[i].getStartVar(), vDateTaskTableDisplayFormat, vLangs[vLang]);
  897. var text = draw_utils_1.makeInput(v, vEditable, 'date', vTaskList[i].getStartVar());
  898. vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text);
  899. var callback = function (task, e) { return task.setStart(e.target.value); };
  900. events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList, i, 'start', Draw);
  901. events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'start');
  902. }
  903. if ('vShowEndDate' === column) {
  904. vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'genddate');
  905. var v = date_utils_1.formatDateStr(vTaskList[i].getEndVar(), vDateTaskTableDisplayFormat, vLangs[vLang]);
  906. var text = draw_utils_1.makeInput(v, vEditable, 'date', vTaskList[i].getEndVar());
  907. vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text);
  908. var callback = function (task, e) { return task.setEnd(e.target.value); };
  909. events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList, i, 'end', Draw);
  910. events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'end');
  911. }
  912. if ('vShowPlanStartDate' === column) {
  913. vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gplanstartdate');
  914. var v = vTaskList[i].getPlanStart() ? date_utils_1.formatDateStr(vTaskList[i].getPlanStart(), vDateTaskTableDisplayFormat, vLangs[vLang]) : '';
  915. var text = draw_utils_1.makeInput(v, vEditable, 'date', vTaskList[i].getPlanStart());
  916. vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text);
  917. var callback = function (task, e) { return task.setPlanStart(e.target.value); };
  918. events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList, i, 'planstart', Draw);
  919. events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'planstart');
  920. }
  921. if ('vShowPlanEndDate' === column) {
  922. vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gplanenddate');
  923. var v = vTaskList[i].getPlanEnd() ? date_utils_1.formatDateStr(vTaskList[i].getPlanEnd(), vDateTaskTableDisplayFormat, vLangs[vLang]) : '';
  924. var text = draw_utils_1.makeInput(v, vEditable, 'date', vTaskList[i].getPlanEnd());
  925. vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text);
  926. var callback = function (task, e) { return task.setPlanEnd(e.target.value); };
  927. events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList, i, 'planend', Draw);
  928. events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'planend');
  929. }
  930. if ('vShowCost' === column) {
  931. vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gcost');
  932. var text = draw_utils_1.makeInput(vTaskList[i].getCost(), vEditable, 'cost');
  933. vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, text);
  934. var callback = function (task, e) { return task.setCost(e.target.value); };
  935. events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList, i, 'cost', Draw);
  936. events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'cost');
  937. }
  938. if ('vAdditionalHeaders' === column && vAdditionalHeaders) {
  939. for (var key in vAdditionalHeaders) {
  940. var header = vAdditionalHeaders[key];
  941. var css = header.class ? header.class : "gadditional-" + key;
  942. var data = vTaskList[i].getDataObject();
  943. vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, "gadditional " + css);
  944. vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, data ? data[key] : '');
  945. events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], "additional_" + key);
  946. // const callback = (task, e) => task.setCost(e.target.value);
  947. // addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList, i, 'costdate');
  948. }
  949. }
  950. if ('vShowAddEntries' === column) {
  951. vTmpCell = draw_utils_1.newNode(vTmpRow, 'td', null, 'gaddentries');
  952. var button = "<button>+</button>";
  953. vTmpDiv = draw_utils_1.newNode(vTmpCell, 'div', null, null, button);
  954. var callback = function (task, e) {
  955. task_1.AddTaskItemObject({
  956. vParent: task.getParent()
  957. });
  958. };
  959. events_1.addListenerInputCell(vTmpCell, vEventsChange, callback, vTaskList, i, 'addentries', Draw.bind(this));
  960. events_1.addListenerClickCell(vTmpCell, vEvents, vTaskList[i], 'addentries');
  961. }
  962. };
  963. exports.draw_bottom = function (column, vTmpRow, vAdditionalHeaders) {
  964. if ('vAdditionalHeaders' === column && vAdditionalHeaders) {
  965. for (var key in vAdditionalHeaders) {
  966. var header = vAdditionalHeaders[key];
  967. var css = header.class ? header.class : "gadditional-" + key;
  968. draw_utils_1.newNode(vTmpRow, 'td', null, "gspanning gadditional " + css, '\u00A0');
  969. }
  970. }
  971. else {
  972. var type = COLUMNS_TYPES[column];
  973. draw_utils_1.newNode(vTmpRow, 'td', null, "gspanning g" + type, '\u00A0');
  974. }
  975. };
  976. // export const draw_list_headings = function (column, vTmpRow, vAdditionalHeaders, vEvents) {
  977. // let nodeCreated;
  978. // if ('vAdditionalHeaders' === column && vAdditionalHeaders) {
  979. // for (const key in vAdditionalHeaders) {
  980. // const header = vAdditionalHeaders[key];
  981. // const css = header.class ? header.class : `gadditional-${key}`;
  982. // newNode(vTmpRow, 'td', null, `gspanning gadditional ${css}`, '\u00A0');
  983. // }
  984. // } else {
  985. // const type = COLUMNS_TYPES[column];
  986. // nodeCreated = newNode(vTmpRow, 'td', null, `gspanning g${type}`, '\u00A0');
  987. // addListenerClickCell(nodeCreated, vEvents, { hader: true, column }, type);
  988. // }
  989. // }
  990. exports.draw_task_headings = function (column, vTmpRow, vLangs, vLang, vAdditionalHeaders, vEvents) {
  991. var nodeCreated;
  992. if ('vAdditionalHeaders' === column && vAdditionalHeaders) {
  993. for (var key in vAdditionalHeaders) {
  994. var header = vAdditionalHeaders[key];
  995. var text = header.translate ? vLangs[vLang][header.translate] : header.title;
  996. var css = header.class ? header.class : "gadditional-" + key;
  997. nodeCreated = draw_utils_1.newNode(vTmpRow, 'td', null, "gtaskheading gadditional " + css, text);
  998. }
  999. }
  1000. else {
  1001. var type = COLUMNS_TYPES[column];
  1002. nodeCreated = draw_utils_1.newNode(vTmpRow, 'td', null, "gtaskheading g" + type, vLangs[vLang][type]);
  1003. events_1.addListenerClickCell(nodeCreated, vEvents, { hader: true, column: column }, type);
  1004. }
  1005. };
  1006. },{"./events":5,"./task":10,"./utils/date_utils":11,"./utils/draw_utils":12}],4:[function(require,module,exports){
  1007. "use strict";
  1008. Object.defineProperty(exports, "__esModule", { value: true });
  1009. exports.drawDependency = function (x1, y1, x2, y2, pType, pClass) {
  1010. var vDir = 1;
  1011. var vBend = false;
  1012. var vShort = 4;
  1013. var vRow = Math.floor(this.getRowHeight() / 2);
  1014. if (y2 < y1)
  1015. vRow *= -1;
  1016. switch (pType) {
  1017. case 'SF':
  1018. vShort *= -1;
  1019. if (x1 - 10 <= x2 && y1 != y2)
  1020. vBend = true;
  1021. vDir = -1;
  1022. break;
  1023. case 'SS':
  1024. if (x1 < x2)
  1025. vShort *= -1;
  1026. else
  1027. vShort = x2 - x1 - (2 * vShort);
  1028. break;
  1029. case 'FF':
  1030. if (x1 <= x2)
  1031. vShort = x2 - x1 + (2 * vShort);
  1032. vDir = -1;
  1033. break;
  1034. default:
  1035. if (x1 + 10 >= x2 && y1 != y2)
  1036. vBend = true;
  1037. break;
  1038. }
  1039. if (vBend) {
  1040. this.sLine(x1, y1, x1 + vShort, y1, pClass);
  1041. this.sLine(x1 + vShort, y1, x1 + vShort, y2 - vRow, pClass);
  1042. this.sLine(x1 + vShort, y2 - vRow, x2 - (vShort * 2), y2 - vRow, pClass);
  1043. this.sLine(x2 - (vShort * 2), y2 - vRow, x2 - (vShort * 2), y2, pClass);
  1044. this.sLine(x2 - (vShort * 2), y2, x2 - (1 * vDir), y2, pClass);
  1045. }
  1046. else if (y1 != y2) {
  1047. this.sLine(x1, y1, x1 + vShort, y1, pClass);
  1048. this.sLine(x1 + vShort, y1, x1 + vShort, y2, pClass);
  1049. this.sLine(x1 + vShort, y2, x2 - (1 * vDir), y2, pClass);
  1050. }
  1051. else
  1052. this.sLine(x1, y1, x2 - (1 * vDir), y2, pClass);
  1053. var vTmpDiv = this.sLine(x2, y2, x2 - 3 - ((vDir < 0) ? 1 : 0), y2 - 3 - ((vDir < 0) ? 1 : 0), pClass + "Arw");
  1054. vTmpDiv.style.width = '0px';
  1055. vTmpDiv.style.height = '0px';
  1056. };
  1057. exports.DrawDependencies = function (vDebug) {
  1058. if (vDebug === void 0) { vDebug = false; }
  1059. if (this.getShowDeps() == 1) {
  1060. this.CalcTaskXY(); //First recalculate the x,y
  1061. this.clearDependencies();
  1062. var vList = this.getList();
  1063. for (var i = 0; i < vList.length; i++) {
  1064. var vDepend = vList[i].getDepend();
  1065. var vDependType = vList[i].getDepType();
  1066. var n = vDepend.length;
  1067. if (n > 0 && vList[i].getVisible() == 1) {
  1068. for (var k = 0; k < n; k++) {
  1069. var vTask = this.getArrayLocationByID(vDepend[k]);
  1070. if (vTask >= 0 && vList[vTask].getGroup() != 2) {
  1071. if (vList[vTask].getVisible() == 1) {
  1072. if (vDebug) {
  1073. console.info("init drawDependency ", vList[vTask].getID(), new Date());
  1074. }
  1075. var cssClass = 'gDepId' + vList[vTask].getID() +
  1076. ' ' + 'gDepNextId' + vList[i].getID();
  1077. var dependedData = vList[vTask].getDataObject();
  1078. var nextDependedData = vList[i].getDataObject();
  1079. if (dependedData && dependedData.pID && nextDependedData && nextDependedData.pID) {
  1080. cssClass += ' gDepDataId' + dependedData.pID + ' ' + 'gDepNextDataId' + nextDependedData.pID;
  1081. }
  1082. if (vDependType[k] == 'SS')
  1083. this.drawDependency(vList[vTask].getStartX() - 1, vList[vTask].getStartY(), vList[i].getStartX() - 1, vList[i].getStartY(), 'SS', cssClass + ' gDepSS');
  1084. else if (vDependType[k] == 'FF')
  1085. this.drawDependency(vList[vTask].getEndX(), vList[vTask].getEndY(), vList[i].getEndX(), vList[i].getEndY(), 'FF', cssClass + ' gDepFF');
  1086. else if (vDependType[k] == 'SF')
  1087. this.drawDependency(vList[vTask].getStartX() - 1, vList[vTask].getStartY(), vList[i].getEndX(), vList[i].getEndY(), 'SF', cssClass + ' gDepSF');
  1088. else if (vDependType[k] == 'FS')
  1089. this.drawDependency(vList[vTask].getEndX(), vList[vTask].getEndY(), vList[i].getStartX() - 1, vList[i].getStartY(), 'FS', cssClass + ' gDepFS');
  1090. }
  1091. }
  1092. }
  1093. }
  1094. }
  1095. }
  1096. // draw the current date line
  1097. if (this.vTodayPx >= 0) {
  1098. this.sLine(this.vTodayPx, 0, this.vTodayPx, this.getChartTable().offsetHeight - 1, 'gCurDate');
  1099. }
  1100. };
  1101. },{}],5:[function(require,module,exports){
  1102. "use strict";
  1103. Object.defineProperty(exports, "__esModule", { value: true });
  1104. var general_utils_1 = require("./utils/general_utils");
  1105. // Function to open/close and hide/show children of specified task
  1106. exports.folder = function (pID, ganttObj) {
  1107. var vList = ganttObj.getList();
  1108. ganttObj.clearDependencies(); // clear these first so slow rendering doesn't look odd
  1109. for (var i = 0; i < vList.length; i++) {
  1110. if (vList[i].getID() == pID) {
  1111. if (vList[i].getOpen() == 1) {
  1112. vList[i].setOpen(0);
  1113. exports.hide(pID, ganttObj);
  1114. if (general_utils_1.isIE())
  1115. vList[i].getGroupSpan().innerText = '+';
  1116. else
  1117. vList[i].getGroupSpan().textContent = '+';
  1118. }
  1119. else {
  1120. vList[i].setOpen(1);
  1121. exports.show(pID, 1, ganttObj);
  1122. if (general_utils_1.isIE())
  1123. vList[i].getGroupSpan().innerText = '-';
  1124. else
  1125. vList[i].getGroupSpan().textContent = '-';
  1126. }
  1127. }
  1128. }
  1129. var bd;
  1130. if (this.vDebug) {
  1131. bd = new Date();
  1132. console.info('after drawDependency', bd);
  1133. }
  1134. ganttObj.DrawDependencies(this.vDebug);
  1135. if (this.vDebug) {
  1136. var ad = new Date();
  1137. console.info('after drawDependency', ad, (ad.getTime() - bd.getTime()));
  1138. }
  1139. };
  1140. exports.hide = function (pID, ganttObj) {
  1141. var vList = ganttObj.getList();
  1142. var vID = 0;
  1143. for (var i = 0; i < vList.length; i++) {
  1144. if (vList[i].getParent() == pID) {
  1145. vID = vList[i].getID();
  1146. // it's unlikely but if the task list has been updated since
  1147. // the chart was drawn some of the rows may not exist
  1148. if (vList[i].getListChildRow())
  1149. vList[i].getListChildRow().style.display = 'none';
  1150. if (vList[i].getChildRow())
  1151. vList[i].getChildRow().style.display = 'none';
  1152. vList[i].setVisible(0);
  1153. if (vList[i].getGroup())
  1154. exports.hide(vID, ganttObj);
  1155. }
  1156. }
  1157. };
  1158. // Function to show children of specified task
  1159. exports.show = function (pID, pTop, ganttObj) {
  1160. var vList = ganttObj.getList();
  1161. var vID = 0;
  1162. var vState = '';
  1163. for (var i = 0; i < vList.length; i++) {
  1164. if (vList[i].getParent() == pID) {
  1165. if (!vList[i].getParItem()) {
  1166. console.error("Cant find parent on who event (maybe problems with Task ID and Parent Id mixes?)");
  1167. }
  1168. if (vList[i].getParItem().getGroupSpan()) {
  1169. if (general_utils_1.isIE())
  1170. vState = vList[i].getParItem().getGroupSpan().innerText;
  1171. else
  1172. vState = vList[i].getParItem().getGroupSpan().textContent;
  1173. }
  1174. i = vList.length;
  1175. }
  1176. }
  1177. for (var i = 0; i < vList.length; i++) {
  1178. if (vList[i].getParent() == pID) {
  1179. var vChgState = false;
  1180. vID = vList[i].getID();
  1181. if (pTop == 1 && vState == '+')
  1182. vChgState = true;
  1183. else if (vState == '-')
  1184. vChgState = true;
  1185. else if (vList[i].getParItem() && vList[i].getParItem().getGroup() == 2)
  1186. vList[i].setVisible(1);
  1187. if (vChgState) {
  1188. if (vList[i].getListChildRow())
  1189. vList[i].getListChildRow().style.display = '';
  1190. if (vList[i].getChildRow())
  1191. vList[i].getChildRow().style.display = '';
  1192. vList[i].setVisible(1);
  1193. }
  1194. if (vList[i].getGroup())
  1195. exports.show(vID, 0, ganttObj);
  1196. }
  1197. }
  1198. };
  1199. exports.mouseOver = function (pObj1, pObj2) {
  1200. if (this.getUseRowHlt()) {
  1201. pObj1.className += ' gitemhighlight';
  1202. pObj2.className += ' gitemhighlight';
  1203. }
  1204. };
  1205. exports.mouseOut = function (pObj1, pObj2) {
  1206. if (this.getUseRowHlt()) {
  1207. pObj1.className = pObj1.className.replace(/(?:^|\s)gitemhighlight(?!\S)/g, '');
  1208. pObj2.className = pObj2.className.replace(/(?:^|\s)gitemhighlight(?!\S)/g, '');
  1209. }
  1210. };
  1211. exports.showToolTip = function (pGanttChartObj, e, pContents, pWidth, pTimer) {
  1212. var vTtDivId = pGanttChartObj.getDivId() + 'JSGanttToolTip';
  1213. var vMaxW = 500;
  1214. var vMaxAlpha = 100;
  1215. var vShowing = pContents.id;
  1216. if (pGanttChartObj.getUseToolTip()) {
  1217. if (pGanttChartObj.vTool == null) {
  1218. pGanttChartObj.vTool = document.createElement('div');
  1219. pGanttChartObj.vTool.id = vTtDivId;
  1220. pGanttChartObj.vTool.className = 'JSGanttToolTip';
  1221. pGanttChartObj.vTool.vToolCont = document.createElement('div');
  1222. pGanttChartObj.vTool.vToolCont.id = vTtDivId + 'cont';
  1223. pGanttChartObj.vTool.vToolCont.className = 'JSGanttToolTipcont';
  1224. pGanttChartObj.vTool.vToolCont.setAttribute('showing', '');
  1225. pGanttChartObj.vTool.appendChild(pGanttChartObj.vTool.vToolCont);
  1226. document.body.appendChild(pGanttChartObj.vTool);
  1227. pGanttChartObj.vTool.style.opacity = 0;
  1228. pGanttChartObj.vTool.setAttribute('currentOpacity', 0);
  1229. pGanttChartObj.vTool.setAttribute('fadeIncrement', 10);
  1230. pGanttChartObj.vTool.setAttribute('moveSpeed', 10);
  1231. pGanttChartObj.vTool.style.filter = 'alpha(opacity=0)';
  1232. pGanttChartObj.vTool.style.visibility = 'hidden';
  1233. pGanttChartObj.vTool.style.left = Math.floor(((e) ? e.clientX : window.event.clientX) / 2) + 'px';
  1234. pGanttChartObj.vTool.style.top = Math.floor(((e) ? e.clientY : window.event.clientY) / 2) + 'px';
  1235. this.addListener('mouseover', function () { clearTimeout(pGanttChartObj.vTool.delayTimeout); }, pGanttChartObj.vTool);
  1236. this.addListener('mouseout', function () { general_utils_1.delayedHide(pGanttChartObj, pGanttChartObj.vTool, pTimer); }, pGanttChartObj.vTool);
  1237. }
  1238. clearTimeout(pGanttChartObj.vTool.delayTimeout);
  1239. var newHTML = pContents.innerHTML;
  1240. if (pGanttChartObj.vTool.vToolCont.getAttribute("content") !== newHTML) {
  1241. pGanttChartObj.vTool.vToolCont.innerHTML = pContents.innerHTML;
  1242. // as we are allowing arbitrary HTML we should remove any tag ids to prevent duplication
  1243. general_utils_1.stripIds(pGanttChartObj.vTool.vToolCont);
  1244. pGanttChartObj.vTool.vToolCont.setAttribute("content", newHTML);
  1245. }
  1246. if (pGanttChartObj.vTool.vToolCont.getAttribute('showing') != vShowing || pGanttChartObj.vTool.style.visibility != 'visible') {
  1247. if (pGanttChartObj.vTool.vToolCont.getAttribute('showing') != vShowing) {
  1248. pGanttChartObj.vTool.vToolCont.setAttribute('showing', vShowing);
  1249. }
  1250. pGanttChartObj.vTool.style.visibility = 'visible';
  1251. // Rather than follow the mouse just have it stay put
  1252. general_utils_1.updateFlyingObj(e, pGanttChartObj, pTimer);
  1253. pGanttChartObj.vTool.style.width = (pWidth) ? pWidth + 'px' : 'auto';
  1254. if (!pWidth && general_utils_1.isIE()) {
  1255. pGanttChartObj.vTool.style.width = pGanttChartObj.vTool.offsetWidth;
  1256. }
  1257. if (pGanttChartObj.vTool.offsetWidth > vMaxW) {
  1258. pGanttChartObj.vTool.style.width = vMaxW + 'px';
  1259. }
  1260. }
  1261. if (pGanttChartObj.getUseFade()) {
  1262. clearInterval(pGanttChartObj.vTool.fadeInterval);
  1263. pGanttChartObj.vTool.fadeInterval = setInterval(function () { general_utils_1.fadeToolTip(1, pGanttChartObj.vTool, vMaxAlpha); }, pTimer);
  1264. }
  1265. else {
  1266. pGanttChartObj.vTool.style.opacity = vMaxAlpha * 0.01;
  1267. pGanttChartObj.vTool.style.filter = 'alpha(opacity=' + vMaxAlpha + ')';
  1268. }
  1269. }
  1270. };
  1271. exports.addListener = function (eventName, handler, control) {
  1272. // Check if control is a string
  1273. if (control === String(control))
  1274. control = general_utils_1.findObj(control);
  1275. if (control.addEventListener) //Standard W3C
  1276. {
  1277. return control.addEventListener(eventName, handler, false);
  1278. }
  1279. else if (control.attachEvent) //IExplore
  1280. {
  1281. return control.attachEvent('on' + eventName, handler);
  1282. }
  1283. else {
  1284. return false;
  1285. }
  1286. };
  1287. exports.removeListener = function (eventName, handler, control) {
  1288. // Check if control is a string
  1289. if (control === String(control))
  1290. control = general_utils_1.findObj(control);
  1291. if (control.removeEventListener) {
  1292. //Standard W3C
  1293. return control.removeEventListener(eventName, handler, false);
  1294. }
  1295. else if (control.detachEvent) {
  1296. //IExplore
  1297. return control.attachEvent('on' + eventName, handler);
  1298. }
  1299. else {
  1300. return false;
  1301. }
  1302. };
  1303. exports.syncScroll = function (elements, attrName) {
  1304. var syncFlags = new Map(elements.map(function (e) { return [e, false]; }));
  1305. function scrollEvent(e) {
  1306. if (!syncFlags.get(e.target)) {
  1307. for (var _i = 0, elements_2 = elements; _i < elements_2.length; _i++) {
  1308. var el = elements_2[_i];
  1309. if (el !== e.target) {
  1310. syncFlags.set(el, true);
  1311. el[attrName] = e.target[attrName];
  1312. }
  1313. }
  1314. }
  1315. syncFlags.set(e.target, false);
  1316. }
  1317. for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
  1318. var el = elements_1[_i];
  1319. el.addEventListener('scroll', scrollEvent);
  1320. }
  1321. };
  1322. exports.addTooltipListeners = function (pGanttChart, pObj1, pObj2, callback) {
  1323. var isShowingTooltip = false;
  1324. exports.addListener('mouseover', function (e) {
  1325. if (isShowingTooltip || !callback) {
  1326. exports.showToolTip(pGanttChart, e, pObj2, null, pGanttChart.getTimer());
  1327. }
  1328. else if (callback) {
  1329. isShowingTooltip = true;
  1330. var promise = callback();
  1331. exports.showToolTip(pGanttChart, e, pObj2, null, pGanttChart.getTimer());
  1332. if (promise && promise.then) {
  1333. promise.then(function () {
  1334. if (pGanttChart.vTool.vToolCont.getAttribute('showing') === pObj2.id &&
  1335. pGanttChart.vTool.style.visibility === 'visible') {
  1336. exports.showToolTip(pGanttChart, e, pObj2, null, pGanttChart.getTimer());
  1337. }
  1338. });
  1339. }
  1340. }
  1341. }, pObj1);
  1342. exports.addListener('mouseout', function (e) {
  1343. var outTo = e.relatedTarget;
  1344. if (general_utils_1.isParentElementOrSelf(outTo, pObj1) || (pGanttChart.vTool && general_utils_1.isParentElementOrSelf(outTo, pGanttChart.vTool))) {
  1345. // not actually out
  1346. }
  1347. else {
  1348. isShowingTooltip = false;
  1349. }
  1350. general_utils_1.delayedHide(pGanttChart, pGanttChart.vTool, pGanttChart.getTimer());
  1351. }, pObj1);
  1352. };
  1353. exports.addThisRowListeners = function (pGanttChart, pObj1, pObj2) {
  1354. exports.addListener('mouseover', function () { pGanttChart.mouseOver(pObj1, pObj2); }, pObj1);
  1355. exports.addListener('mouseover', function () { pGanttChart.mouseOver(pObj1, pObj2); }, pObj2);
  1356. exports.addListener('mouseout', function () { pGanttChart.mouseOut(pObj1, pObj2); }, pObj1);
  1357. exports.addListener('mouseout', function () { pGanttChart.mouseOut(pObj1, pObj2); }, pObj2);
  1358. };
  1359. exports.updateGridHeaderWidth = function (pGanttChart) {
  1360. var head = pGanttChart.getChartHead();
  1361. var body = pGanttChart.getChartBody();
  1362. if (!head || !body)
  1363. return;
  1364. var isScrollVisible = body.scrollHeight > body.clientHeight;
  1365. if (isScrollVisible) {
  1366. head.style.width = "calc(100% - " + general_utils_1.getScrollbarWidth() + "px)";
  1367. }
  1368. else {
  1369. head.style.width = '100%';
  1370. }
  1371. };
  1372. exports.addFolderListeners = function (pGanttChart, pObj, pID) {
  1373. exports.addListener('click', function () {
  1374. exports.folder(pID, pGanttChart);
  1375. exports.updateGridHeaderWidth(pGanttChart);
  1376. }, pObj);
  1377. };
  1378. exports.addFormatListeners = function (pGanttChart, pFormat, pObj) {
  1379. exports.addListener('click', function () { general_utils_1.changeFormat(pFormat, pGanttChart); }, pObj);
  1380. };
  1381. exports.addScrollListeners = function (pGanttChart) {
  1382. exports.addListener('resize', function () { pGanttChart.getChartHead().scrollLeft = pGanttChart.getChartBody().scrollLeft; }, window);
  1383. exports.addListener('resize', function () {
  1384. pGanttChart.getListBody().scrollTop = pGanttChart.getChartBody().scrollTop;
  1385. }, window);
  1386. };
  1387. exports.addListenerClickCell = function (vTmpCell, vEvents, task, column) {
  1388. exports.addListener('click', function (e) {
  1389. if (e.target.classList.contains('gfoldercollapse') === false &&
  1390. vEvents[column] && typeof vEvents[column] === 'function') {
  1391. vEvents[column](task, e, vTmpCell, column);
  1392. }
  1393. }, vTmpCell);
  1394. };
  1395. exports.addListenerInputCell = function (vTmpCell, vEventsChange, callback, tasks, index, column, draw, event) {
  1396. if (draw === void 0) { draw = null; }
  1397. if (event === void 0) { event = 'blur'; }
  1398. var task = tasks[index];
  1399. if (vTmpCell.children[0] && vTmpCell.children[0].children && vTmpCell.children[0].children[0]) {
  1400. var tagName = vTmpCell.children[0].children[0].tagName;
  1401. var selectInputOrButton = tagName === 'SELECT' || tagName === 'INPUT' || tagName === 'BUTTON';
  1402. if (selectInputOrButton) {
  1403. exports.addListener(event, function (e) {
  1404. if (callback) {
  1405. callback(task, e);
  1406. }
  1407. if (vEventsChange[column] && typeof vEventsChange[column] === 'function') {
  1408. var q = vEventsChange[column](tasks, task, e, vTmpCell, vColumnsNames[column]);
  1409. if (q && q.then) {
  1410. q.then(function (e) { return draw(); });
  1411. }
  1412. else {
  1413. draw();
  1414. }
  1415. }
  1416. else {
  1417. draw();
  1418. }
  1419. }, vTmpCell.children[0].children[0]);
  1420. }
  1421. }
  1422. };
  1423. exports.addListenerDependencies = function (vLineOptions) {
  1424. var elements = document.querySelectorAll('.gtaskbarcontainer');
  1425. for (var i = 0; i < elements.length; i++) {
  1426. var taskDiv = elements[i];
  1427. taskDiv.addEventListener('mouseover', function (e) {
  1428. toggleDependencies(e, vLineOptions);
  1429. });
  1430. taskDiv.addEventListener('mouseout', function (e) {
  1431. toggleDependencies(e, vLineOptions);
  1432. });
  1433. }
  1434. };
  1435. var toggleDependencies = function (e, vLineOptions) {
  1436. var target = e.currentTarget;
  1437. var ids = target.getAttribute('id').split('_');
  1438. var style = vLineOptions && vLineOptions.borderStyleHover !== undefined ? vLineOptions.hoverStyle : 'groove';
  1439. if (e.type === 'mouseout') {
  1440. style = '';
  1441. }
  1442. if (ids.length > 1) {
  1443. var frameZones = Array.from(document.querySelectorAll(".gDepId" + ids[1]));
  1444. frameZones.forEach(function (c) {
  1445. c.style.borderStyle = style;
  1446. });
  1447. // document.querySelectorAll(`.gDepId${ids[1]}`).forEach((c: any) => {
  1448. // c.style.borderStyle = style;
  1449. // });
  1450. }
  1451. };
  1452. var vColumnsNames = {
  1453. taskname: 'pName',
  1454. res: 'pRes',
  1455. dur: '',
  1456. comp: 'pComp',
  1457. start: 'pStart',
  1458. end: 'pEnd',
  1459. planstart: 'pPlanStart',
  1460. planend: 'pPlanEnd',
  1461. link: 'pLink',
  1462. cost: 'pCost',
  1463. mile: 'pMile',
  1464. group: 'pGroup',
  1465. parent: 'pParent',
  1466. open: 'pOpen',
  1467. depend: 'pDepend',
  1468. caption: 'pCaption',
  1469. note: 'pNotes'
  1470. };
  1471. },{"./utils/general_utils":13}],6:[function(require,module,exports){
  1472. "use strict";
  1473. /*
  1474. * Copyright (c) 2013-2018, Paul Geldart, Eduardo Rodrigues, Ricardo Cardoso and Mario Mol.
  1475. *
  1476. * Redistribution and use in source and binary forms, with or without
  1477. * modification, are permitted provided that the following conditions are met:
  1478. * * Redistributions of source code must retain the above copyright
  1479. * notice, this list of conditions and the following disclaimer.
  1480. * * Redistributions in binary form must reproduce the above copyright
  1481. * notice, this list of conditions and the following disclaimer in the
  1482. * documentation and/or other materials provided with the distribution.
  1483. * * Neither the name of AUTHORS nor the names of its contributors
  1484. * may be used to endorse or promote products derived from this software
  1485. * without specific prior written permission.
  1486. *
  1487. * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS OR
  1488. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  1489. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  1490. * IN NO EVENT SHALL AUTHORS BE LIABLE FOR ANY DIRECT,
  1491. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  1492. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  1493. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  1494. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  1495. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  1496. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  1497. This project is based on jsGantt 1.2, (which can be obtained from
  1498. https://code.google.com/p/jsgantt/) and remains under the original BSD license.
  1499. Copyright (c) 2009, Shlomy Gantz BlueBrick Inc.
  1500. */
  1501. Object.defineProperty(exports, "__esModule", { value: true });
  1502. var events_1 = require("./events");
  1503. var general_utils_1 = require("./utils/general_utils");
  1504. var xml_1 = require("./xml");
  1505. var task_1 = require("./task");
  1506. var draw_1 = require("./draw");
  1507. var json_1 = require("./json");
  1508. var date_utils_1 = require("./utils/date_utils");
  1509. if (!exports.JSGantt)
  1510. exports.JSGantt = {};
  1511. exports.JSGantt.isIE = general_utils_1.isIE;
  1512. exports.JSGantt.TaskItem = task_1.TaskItem;
  1513. exports.JSGantt.GanttChart = draw_1.GanttChart;
  1514. exports.JSGantt.updateFlyingObj = general_utils_1.updateFlyingObj;
  1515. exports.JSGantt.showToolTip = events_1.showToolTip;
  1516. exports.JSGantt.stripIds = general_utils_1.stripIds;
  1517. exports.JSGantt.stripUnwanted = general_utils_1.stripUnwanted;
  1518. exports.JSGantt.delayedHide = general_utils_1.delayedHide;
  1519. exports.JSGantt.hideToolTip = general_utils_1.hideToolTip;
  1520. exports.JSGantt.fadeToolTip = general_utils_1.fadeToolTip;
  1521. exports.JSGantt.moveToolTip = general_utils_1.moveToolTip;
  1522. exports.JSGantt.getZoomFactor = general_utils_1.getZoomFactor;
  1523. exports.JSGantt.getOffset = general_utils_1.getOffset;
  1524. exports.JSGantt.getScrollPositions = general_utils_1.getScrollPositions;
  1525. exports.JSGantt.processRows = task_1.processRows;
  1526. exports.JSGantt.sortTasks = task_1.sortTasks;
  1527. // Used to determine the minimum date of all tasks and set lower bound based on format
  1528. exports.JSGantt.getMinDate = date_utils_1.getMinDate;
  1529. // Used to determine the maximum date of all tasks and set upper bound based on format
  1530. exports.JSGantt.getMaxDate = date_utils_1.getMaxDate;
  1531. // This function finds the document id of the specified object
  1532. exports.JSGantt.findObj = general_utils_1.findObj;
  1533. exports.JSGantt.changeFormat = general_utils_1.changeFormat;
  1534. // Tasks
  1535. exports.JSGantt.folder = events_1.folder;
  1536. exports.JSGantt.hide = events_1.hide;
  1537. exports.JSGantt.show = events_1.show;
  1538. exports.JSGantt.taskLink = task_1.taskLink;
  1539. exports.JSGantt.parseDateStr = date_utils_1.parseDateStr;
  1540. exports.JSGantt.formatDateStr = date_utils_1.formatDateStr;
  1541. exports.JSGantt.parseDateFormatStr = date_utils_1.parseDateFormatStr;
  1542. // XML
  1543. exports.JSGantt.parseXML = xml_1.parseXML;
  1544. exports.JSGantt.parseXMLString = xml_1.parseXMLString;
  1545. exports.JSGantt.findXMLNode = xml_1.findXMLNode;
  1546. exports.JSGantt.getXMLNodeValue = xml_1.getXMLNodeValue;
  1547. exports.JSGantt.AddXMLTask = xml_1.AddXMLTask;
  1548. // JSON
  1549. exports.JSGantt.parseJSON = json_1.parseJSON;
  1550. exports.JSGantt.parseJSONString = json_1.parseJSONString;
  1551. exports.JSGantt.addJSONTask = json_1.addJSONTask;
  1552. exports.JSGantt.benchMark = general_utils_1.benchMark;
  1553. exports.JSGantt.getIsoWeek = date_utils_1.getIsoWeek;
  1554. exports.JSGantt.addListener = events_1.addListener;
  1555. exports.JSGantt.addTooltipListeners = events_1.addTooltipListeners;
  1556. exports.JSGantt.addThisRowListeners = events_1.addThisRowListeners;
  1557. exports.JSGantt.addFolderListeners = events_1.addFolderListeners;
  1558. exports.JSGantt.addFormatListeners = events_1.addFormatListeners;
  1559. exports.JSGantt.addScrollListeners = events_1.addScrollListeners;
  1560. exports.JSGantt.criticalPath = general_utils_1.criticalPath;
  1561. },{"./draw":2,"./events":5,"./json":7,"./task":10,"./utils/date_utils":11,"./utils/general_utils":13,"./xml":14}],7:[function(require,module,exports){
  1562. "use strict";
  1563. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  1564. return new (P || (P = Promise))(function (resolve, reject) {
  1565. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  1566. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  1567. function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
  1568. step((generator = generator.apply(thisArg, _arguments || [])).next());
  1569. });
  1570. };
  1571. var __generator = (this && this.__generator) || function (thisArg, body) {
  1572. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  1573. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  1574. function verb(n) { return function (v) { return step([n, v]); }; }
  1575. function step(op) {
  1576. if (f) throw new TypeError("Generator is already executing.");
  1577. while (_) try {
  1578. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  1579. if (y = 0, t) op = [op[0] & 2, t.value];
  1580. switch (op[0]) {
  1581. case 0: case 1: t = op; break;
  1582. case 4: _.label++; return { value: op[1], done: false };
  1583. case 5: _.label++; y = op[1]; op = [0]; continue;
  1584. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  1585. default:
  1586. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  1587. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  1588. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  1589. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  1590. if (t[2]) _.ops.pop();
  1591. _.trys.pop(); continue;
  1592. }
  1593. op = body.call(thisArg, _);
  1594. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  1595. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  1596. }
  1597. };
  1598. Object.defineProperty(exports, "__esModule", { value: true });
  1599. var task_1 = require("./task");
  1600. var general_utils_1 = require("./utils/general_utils");
  1601. /**
  1602. *
  1603. * @param pFile
  1604. * @param pGanttlet
  1605. */
  1606. exports.parseJSON = function (pFile, pGanttVar, vDebug, redrawAfter) {
  1607. if (vDebug === void 0) { vDebug = false; }
  1608. if (redrawAfter === void 0) { redrawAfter = true; }
  1609. return __awaiter(this, void 0, void 0, function () {
  1610. var jsonObj, bd, ad;
  1611. return __generator(this, function (_a) {
  1612. switch (_a.label) {
  1613. case 0: return [4 /*yield*/, general_utils_1.makeRequest(pFile, true, true)];
  1614. case 1:
  1615. jsonObj = _a.sent();
  1616. if (vDebug) {
  1617. bd = new Date();
  1618. console.info('before jsonparse', bd);
  1619. }
  1620. exports.addJSONTask(pGanttVar, jsonObj);
  1621. if (this.vDebug) {
  1622. ad = new Date();
  1623. console.info('after addJSONTask', ad, (ad.getTime() - bd.getTime()));
  1624. }
  1625. if (redrawAfter) {
  1626. pGanttVar.Draw();
  1627. }
  1628. return [2 /*return*/, jsonObj];
  1629. }
  1630. });
  1631. });
  1632. };
  1633. exports.parseJSONString = function (pStr, pGanttVar) {
  1634. exports.addJSONTask(pGanttVar, JSON.parse(pStr));
  1635. };
  1636. exports.addJSONTask = function (pGanttVar, pJsonObj) {
  1637. for (var index = 0; index < pJsonObj.length; index++) {
  1638. var id = void 0;
  1639. var name_1 = void 0;
  1640. var start = void 0;
  1641. var end = void 0;
  1642. var planstart = void 0;
  1643. var planend = void 0;
  1644. var itemClass = void 0;
  1645. var link = '';
  1646. var milestone = 0;
  1647. var resourceName = '';
  1648. var completion = void 0;
  1649. var group = 0;
  1650. var parent_1 = void 0;
  1651. var open_1 = void 0;
  1652. var dependsOn = '';
  1653. var caption = '';
  1654. var notes = '';
  1655. var cost = void 0;
  1656. var duration = '';
  1657. var bartext = '';
  1658. var additionalObject = {};
  1659. for (var prop in pJsonObj[index]) {
  1660. var property = prop;
  1661. var value = pJsonObj[index][property];
  1662. switch (property.toLowerCase()) {
  1663. case 'pid':
  1664. case 'id':
  1665. id = value;
  1666. break;
  1667. case 'pname':
  1668. case 'name':
  1669. name_1 = value;
  1670. break;
  1671. case 'pstart':
  1672. case 'start':
  1673. start = value;
  1674. break;
  1675. case 'pend':
  1676. case 'end':
  1677. end = value;
  1678. break;
  1679. case 'pplanstart':
  1680. case 'planstart':
  1681. planstart = value;
  1682. break;
  1683. case 'pplanend':
  1684. case 'planend':
  1685. planend = value;
  1686. break;
  1687. case 'pclass':
  1688. case 'class':
  1689. itemClass = value;
  1690. break;
  1691. case 'plink':
  1692. case 'link':
  1693. link = value;
  1694. break;
  1695. case 'pmile':
  1696. case 'mile':
  1697. milestone = value;
  1698. break;
  1699. case 'pres':
  1700. case 'res':
  1701. resourceName = value;
  1702. break;
  1703. case 'pcomp':
  1704. case 'comp':
  1705. completion = value;
  1706. break;
  1707. case 'pgroup':
  1708. case 'group':
  1709. group = value;
  1710. break;
  1711. case 'pparent':
  1712. case 'parent':
  1713. parent_1 = value;
  1714. break;
  1715. case 'popen':
  1716. case 'open':
  1717. open_1 = value;
  1718. break;
  1719. case 'pdepend':
  1720. case 'depend':
  1721. dependsOn = value;
  1722. break;
  1723. case 'pcaption':
  1724. case 'caption':
  1725. caption = value;
  1726. break;
  1727. case 'pnotes':
  1728. case 'notes':
  1729. notes = value;
  1730. break;
  1731. case 'pcost':
  1732. case 'cost':
  1733. cost = value;
  1734. break;
  1735. case 'duration':
  1736. case 'pduration':
  1737. duration = value;
  1738. break;
  1739. case 'bartext':
  1740. case 'pbartext':
  1741. bartext = value;
  1742. break;
  1743. default:
  1744. additionalObject[property.toLowerCase()] = value;
  1745. }
  1746. }
  1747. //if (id != undefined && !isNaN(parseInt(id)) && isFinite(id) && name && start && end && itemClass && completion != undefined && !isNaN(parseFloat(completion)) && isFinite(completion) && !isNaN(parseInt(parent)) && isFinite(parent)) {
  1748. pGanttVar.AddTaskItem(new task_1.TaskItem(id, name_1, start, end, itemClass, link, milestone, resourceName, completion, group, parent_1, open_1, dependsOn, caption, notes, pGanttVar, cost, planstart, planend, duration, bartext, additionalObject));
  1749. //}
  1750. }
  1751. };
  1752. },{"./task":10,"./utils/general_utils":13}],8:[function(require,module,exports){
  1753. "use strict";
  1754. Object.defineProperty(exports, "__esModule", { value: true });
  1755. var es = {
  1756. 'january': 'Enero',
  1757. 'february': 'Febrero',
  1758. 'march': 'Marzo',
  1759. 'april': 'Abril',
  1760. 'maylong': 'Mayo',
  1761. 'june': 'Junio',
  1762. 'july': 'Julio',
  1763. 'august': 'Agosto',
  1764. 'september': 'Septiembre',
  1765. 'october': 'Octubre',
  1766. 'november': 'Noviembre',
  1767. 'december': 'Diciembre',
  1768. 'jan': 'Ene',
  1769. 'feb': 'Feb',
  1770. 'mar': 'Mar',
  1771. 'apr': 'Abr',
  1772. 'may': 'May',
  1773. 'jun': 'Jun',
  1774. 'jul': 'Jul',
  1775. 'aug': 'Ago',
  1776. 'sep': 'Sep',
  1777. 'oct': 'Oct',
  1778. 'nov': 'Nov',
  1779. 'dec': 'Dic',
  1780. 'sunday': 'Domingo',
  1781. 'monday': 'Lunes',
  1782. 'tuesday': 'Martes',
  1783. 'wednesday': 'Miércoles',
  1784. 'thursday': 'Jueves',
  1785. 'friday': 'Viernes',
  1786. 'saturday': 'Sábado',
  1787. 'sun': ' Dom',
  1788. 'mon': ' Lun',
  1789. 'tue': ' Mar',
  1790. 'wed': ' Mie',
  1791. 'thu': ' Jue',
  1792. 'fri': ' Vie',
  1793. 'sat': ' Sab',
  1794. 'res': 'Recurso',
  1795. 'dur': 'Duración',
  1796. 'comp': '% Compl.',
  1797. 'completion': 'Completado',
  1798. 'startdate': 'Inicio',
  1799. 'planstartdate': 'Inicio Planificado',
  1800. 'cost': 'Coste',
  1801. 'enddate': 'Fin',
  1802. 'planenddate': 'Fin Planificado',
  1803. 'moreinfo': 'Más Información',
  1804. 'nodata': 'No tasks found',
  1805. 'notes': 'Notas',
  1806. 'format': 'Formato',
  1807. 'hour': 'Hora',
  1808. 'day': 'Día',
  1809. 'week': 'Semana',
  1810. 'month': 'Mes',
  1811. 'quarter': 'Trimestre',
  1812. 'hours': 'Horas',
  1813. 'days': 'Días',
  1814. 'weeks': 'Semanas',
  1815. 'months': 'Meses',
  1816. 'quarters': 'Trimestres',
  1817. 'hr': 'h',
  1818. 'dy': 'Día',
  1819. 'wk': 'Sem.',
  1820. 'mth': 'Mes',
  1821. 'qtr': 'Trim.',
  1822. 'hrs': 'h',
  1823. 'dys': 'Días',
  1824. 'wks': 'Sem.',
  1825. 'mths': 'Meses',
  1826. 'qtrs': 'Trim.',
  1827. 'tooltipLoading': 'Cargando...'
  1828. };
  1829. exports.es = es;
  1830. var en = {
  1831. 'format': 'Format',
  1832. 'hour': 'Hour',
  1833. 'day': 'Day',
  1834. 'week': 'Week',
  1835. 'month': 'Month',
  1836. 'quarter': 'Quarter',
  1837. 'hours': 'Hours',
  1838. 'days': 'Days',
  1839. 'weeks': 'Weeks',
  1840. 'months': 'Months',
  1841. 'quarters': 'Quarters',
  1842. 'hr': 'Hr',
  1843. 'dy': 'Day',
  1844. 'wk': 'Wk',
  1845. 'mth': 'Mth',
  1846. 'qtr': 'Qtr',
  1847. 'hrs': 'Hrs',
  1848. 'dys': 'Days',
  1849. 'wks': 'Wks',
  1850. 'mths': 'Mths',
  1851. 'qtrs': 'Qtrs',
  1852. 'res': 'Resource',
  1853. 'dur': 'Duration',
  1854. 'comp': '% Comp.',
  1855. 'completion': 'Completion',
  1856. 'startdate': 'Start Date',
  1857. 'planstartdate': 'Plan Start Date',
  1858. 'enddate': 'End Date',
  1859. 'planenddate': 'Plan End Date',
  1860. 'cost': 'Cost',
  1861. 'moreinfo': 'More Information',
  1862. 'nodata': 'No tasks found',
  1863. 'notes': 'Notes',
  1864. 'january': 'January',
  1865. 'february': 'February',
  1866. 'march': 'March',
  1867. 'april': 'April',
  1868. 'maylong': 'May',
  1869. 'june': 'June',
  1870. 'july': 'July',
  1871. 'august': 'August',
  1872. 'september': 'September',
  1873. 'october': 'October',
  1874. 'november': 'November',
  1875. 'december': 'December',
  1876. 'jan': 'Jan',
  1877. 'feb': 'Feb',
  1878. 'mar': 'Mar',
  1879. 'apr': 'Apr',
  1880. 'may': 'May',
  1881. 'jun': 'Jun',
  1882. 'jul': 'Jul',
  1883. 'aug': 'Aug',
  1884. 'sep': 'Sep',
  1885. 'oct': 'Oct',
  1886. 'nov': 'Nov',
  1887. 'dec': 'Dec',
  1888. 'sunday': 'Sunday',
  1889. 'monday': 'Monday',
  1890. 'tuesday': 'Tuesday',
  1891. 'wednesday': 'Wednesday',
  1892. 'thursday': 'Thursday',
  1893. 'friday': 'Friday',
  1894. 'saturday': 'Saturday',
  1895. 'sun': 'Sun',
  1896. 'mon': 'Mon',
  1897. 'tue': 'Tue',
  1898. 'wed': 'Wed',
  1899. 'thu': 'Thu',
  1900. 'fri': 'Fri',
  1901. 'sat': 'Sat',
  1902. 'tooltipLoading': 'Loading...'
  1903. };
  1904. exports.en = en;
  1905. var de = {
  1906. 'format': 'Ansicht',
  1907. 'hour': 'Stunde',
  1908. 'day': 'Tag',
  1909. 'week': 'Woche',
  1910. 'month': 'Monat',
  1911. 'quarter': 'Quartal',
  1912. 'hours': 'Stunden',
  1913. 'days': 'Tage',
  1914. 'weeks': 'Wochen',
  1915. 'months': 'Monate',
  1916. 'quarters': 'Quartale',
  1917. 'hr': 'h',
  1918. 'dy': 'T',
  1919. 'wk': 'W',
  1920. 'mth': 'M',
  1921. 'qtr': 'Q',
  1922. 'hrs': 'Std',
  1923. 'dys': 'Tage',
  1924. 'wks': 'Wochen',
  1925. 'mths': 'Monate',
  1926. 'qtrs': 'Quartal',
  1927. 'res': 'Resource',
  1928. 'dur': 'Dauer',
  1929. 'comp': '%Fertig',
  1930. 'completion': 'Fertigstellung',
  1931. 'startdate': 'Erste Buchu',
  1932. 'planstartdate': 'Erste Buchu Plan',
  1933. 'enddate': 'Letzte Buchung',
  1934. 'planenddate': 'Plan Letzte Buchung',
  1935. 'cost': 'Cost',
  1936. 'moreinfo': 'Weitere Infos',
  1937. 'nodata': 'No tasks found',
  1938. 'notes': 'Anmerkung',
  1939. 'january': 'Jänner',
  1940. 'february': 'Februar',
  1941. 'march': 'März',
  1942. 'april': 'April',
  1943. 'maylong': 'Mai',
  1944. 'june': 'Juni',
  1945. 'july': 'Juli',
  1946. 'august': 'August',
  1947. 'september': 'September',
  1948. 'october': 'Oktober',
  1949. 'november': 'November',
  1950. 'december': 'Dezember',
  1951. 'jan': 'Jan',
  1952. 'feb': 'Feb',
  1953. 'mar': 'Mar',
  1954. 'apr': 'Apr',
  1955. 'may': 'Mai',
  1956. 'jun': 'Jun',
  1957. 'jul': 'Jul',
  1958. 'aug': 'Aug',
  1959. 'sep': 'Sep',
  1960. 'oct': 'Okt',
  1961. 'nov': 'Nov',
  1962. 'dec': 'Dez',
  1963. 'sunday': 'Sonntag',
  1964. 'monday': 'Montag',
  1965. 'tuesday': 'Dienstag',
  1966. 'wednesday': 'Mittwoch',
  1967. 'thursday': 'Donnerstag',
  1968. 'friday': 'Freitag',
  1969. 'saturday': 'Samstag',
  1970. 'sun': 'So',
  1971. 'mon': 'Mo', 'tue': 'Di', 'wed': 'Mi', 'thu': 'Do', 'fri': 'Fr', 'sat': 'Sa'
  1972. };
  1973. exports.de = de;
  1974. var pt = {
  1975. 'hours': 'Horas',
  1976. 'days': 'Dias',
  1977. 'weeks': 'Weeks',
  1978. 'months': 'Months',
  1979. 'quarters': 'Quarters',
  1980. 'format': 'Formato',
  1981. 'hour': 'Hora',
  1982. 'day': 'Dia',
  1983. 'week': 'Semana',
  1984. 'month': 'Mês',
  1985. 'quarter': 'Trimestre',
  1986. 'hr': 'hr',
  1987. 'dy': 'dia',
  1988. 'wk': 'sem.',
  1989. 'mth': 'mês',
  1990. 'qtr': 'qtr',
  1991. 'hrs': 'hrs',
  1992. 'dys': 'dias',
  1993. 'wks': 'sem.',
  1994. 'mths': 'meses',
  1995. 'qtrs': 'qtrs',
  1996. 'completion': 'Terminado',
  1997. 'comp': '% Completado',
  1998. 'moreinfo': 'Mais informações',
  1999. 'nodata': 'Sem atividades',
  2000. 'notes': 'Notas',
  2001. 'res': 'Responsável',
  2002. 'dur': 'Duração',
  2003. 'startdate': 'Data inicial',
  2004. 'planstartdate': 'Plan Data inicial',
  2005. 'enddate': 'Data final',
  2006. 'planenddate': 'Plan Data final',
  2007. 'cost': 'Custo',
  2008. 'jan': 'Jan',
  2009. 'feb': 'Fev',
  2010. 'mar': 'Mar',
  2011. 'apr': 'Abr',
  2012. 'may': 'Mai',
  2013. 'jun': 'Jun',
  2014. 'jul': 'Jul',
  2015. 'aug': 'Ago',
  2016. 'sep': 'Set',
  2017. 'oct': 'Out',
  2018. 'nov': 'Nov',
  2019. 'dec': 'Dez',
  2020. 'january': 'Janeiro',
  2021. 'february': 'Fevereiro',
  2022. 'march': 'Março',
  2023. 'april': 'Abril',
  2024. 'maylong': 'Maio',
  2025. 'june': 'Junho',
  2026. 'july': 'Julho',
  2027. 'august': 'Agosto',
  2028. 'september': 'Setembro',
  2029. 'october': 'Outubro',
  2030. 'november': 'Novembro',
  2031. 'december': 'Dezembro',
  2032. 'sun': 'Dom',
  2033. 'mon': 'Seg',
  2034. 'tue': 'Ter',
  2035. 'wed': 'Qua',
  2036. 'thu': 'Qui',
  2037. 'fri': 'Sex',
  2038. 'sat': 'Sab'
  2039. };
  2040. exports.pt = pt;
  2041. var ru = {
  2042. 'january': 'Январь',
  2043. 'february': 'Февраль',
  2044. 'march': 'Март',
  2045. 'april': 'Апрель',
  2046. 'maylong': 'Май',
  2047. 'june': 'Июнь',
  2048. 'july': 'Июль',
  2049. 'august': 'Август', 'september': 'Сентябрь',
  2050. 'october': 'Октябрь',
  2051. 'november': 'Ноябрь',
  2052. 'december': 'Декабрь',
  2053. 'jan': 'Янв',
  2054. 'feb': 'Фев',
  2055. 'mar': 'Мар',
  2056. 'apr': 'Апр',
  2057. 'may': 'Май',
  2058. 'jun': 'Июн',
  2059. 'jul': 'Июл',
  2060. 'aug': 'Авг',
  2061. 'sep': 'Сен',
  2062. 'oct': 'Окт',
  2063. 'nov': 'Ноя',
  2064. 'dec': 'Дек',
  2065. 'sunday': 'Воскресенье',
  2066. 'monday': 'Понедельник',
  2067. 'tuesday': 'Вторник',
  2068. 'wednesday': 'Среда',
  2069. 'thursday': 'Четверг',
  2070. 'friday': 'Пятница',
  2071. 'saturday': 'Суббота',
  2072. 'sun': ' Вс',
  2073. 'mon': ' Пн',
  2074. 'tue': ' Вт',
  2075. 'wed': ' Ср',
  2076. 'thu': ' Чт',
  2077. 'fri': ' Пт',
  2078. 'sat': ' Сб',
  2079. 'res': 'Ресурс',
  2080. 'dur': 'Длительность',
  2081. 'comp': '% выполнения',
  2082. 'completion': 'Выполнено',
  2083. 'startdate': 'Нач. дата',
  2084. 'planstartdate': 'Plan Нач. дата',
  2085. 'enddate': 'Кон. дата',
  2086. 'planenddate': 'Plan Кон. дата',
  2087. 'cost': 'Cost',
  2088. 'moreinfo': 'Детали',
  2089. 'nodata': 'No tasks found',
  2090. 'notes': 'Заметки',
  2091. 'format': 'Формат',
  2092. 'hour': 'Час',
  2093. 'day': 'День',
  2094. 'week': 'Неделя',
  2095. 'month': 'Месяц',
  2096. 'quarter': 'Кварт',
  2097. 'hours': 'Часов',
  2098. 'days': 'Дней',
  2099. 'weeks': 'Недель',
  2100. 'months': 'Месяцев',
  2101. 'quarters': 'Кварталов',
  2102. 'hr': 'ч.',
  2103. 'dy': 'дн.',
  2104. 'wk': 'нед.',
  2105. 'mth': 'мес.',
  2106. 'qtr': 'кв.',
  2107. 'hrs': 'ч.',
  2108. 'dys': 'дн.',
  2109. 'wks': 'нед.',
  2110. 'mths': 'мес.',
  2111. 'qtrs': 'кв.',
  2112. 'tooltipLoading': 'Загрузка...'
  2113. };
  2114. exports.ru = ru;
  2115. /**
  2116. * Mois : http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=3619
  2117. Jours : http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=3617
  2118. */
  2119. var fr = {
  2120. 'january': 'Janvier',
  2121. 'february': 'Février',
  2122. 'march': 'Mars',
  2123. 'april': 'Avril',
  2124. 'maylong': 'Mai',
  2125. 'june': 'Juin',
  2126. 'july': 'Juillet',
  2127. 'august': 'Août',
  2128. 'september': 'Septembre',
  2129. 'october': 'Octobre',
  2130. 'november': 'Novembre',
  2131. 'december': 'Décembre',
  2132. 'jan': 'Janv',
  2133. 'feb': 'Févr',
  2134. 'mar': 'Mars',
  2135. 'apr': 'Avr',
  2136. 'may': 'Mai',
  2137. 'jun': 'Juin',
  2138. 'jul': 'Juil',
  2139. 'aug': 'Août',
  2140. 'sep': 'Sept',
  2141. 'oct': 'Oct',
  2142. 'nov': 'Nov',
  2143. 'dec': 'Déc',
  2144. 'sunday': 'Dimanche',
  2145. 'monday': 'Lundi',
  2146. 'tuesday': 'Mardi',
  2147. 'wednesday': 'Mercredi',
  2148. 'thursday': 'Jeudi',
  2149. 'friday': 'Vendredi',
  2150. 'saturday': 'Samedi',
  2151. 'sun': 'Dim',
  2152. 'mon': 'Lun',
  2153. 'tue': 'Mar',
  2154. 'wed': 'Mer',
  2155. 'thu': 'Jeu',
  2156. 'fri': 'Ven',
  2157. 'sat': 'Sam',
  2158. 'res': 'Ressource',
  2159. 'dur': 'Durée',
  2160. 'comp': '% Term.',
  2161. 'completion': 'Terminé',
  2162. 'startdate': 'Début',
  2163. 'planstartdate': 'Plan Début',
  2164. 'enddate': 'Fin',
  2165. 'planenddate': 'Plan Fin',
  2166. 'cost': 'Cost',
  2167. 'moreinfo': "Plus d'informations",
  2168. 'nodata': 'No tasks found',
  2169. 'notes': 'Notes',
  2170. 'format': 'Format',
  2171. 'hour': 'Heure',
  2172. 'day': 'Jour',
  2173. 'week': 'Semaine',
  2174. 'month': 'Mois',
  2175. 'quarter': 'Trimestre',
  2176. 'hours': 'Heures',
  2177. 'days': 'Jours',
  2178. 'weeks': 'Semaines',
  2179. 'months': 'Mois',
  2180. 'quarters': 'Trimestres',
  2181. 'hr': 'h',
  2182. 'dy': 'j',
  2183. 'wk': 'sem',
  2184. 'mth': 'mois',
  2185. 'qtr': 'tri',
  2186. 'hrs': 'h',
  2187. 'dys': 'j',
  2188. 'wks': 'sem',
  2189. 'mths': 'mois',
  2190. 'qtrs': 'tri'
  2191. };
  2192. exports.fr = fr;
  2193. var cn = {
  2194. 'january': '一月',
  2195. 'february': '二月',
  2196. 'march': '三月',
  2197. 'april': '四月',
  2198. 'maylong': '五月',
  2199. 'june': '六月',
  2200. 'july': '七月',
  2201. 'august': '八月',
  2202. 'september': '九月',
  2203. 'october': '十月',
  2204. 'november': '十一月',
  2205. 'december': '十二月',
  2206. 'jan': '一月',
  2207. 'feb': '二月',
  2208. 'mar': '三月',
  2209. 'apr': '四月',
  2210. 'may': '五月',
  2211. 'jun': '六月',
  2212. 'jul': '七月',
  2213. 'aug': '八月',
  2214. 'sep': '九月',
  2215. 'oct': '十月',
  2216. 'nov': '十一月',
  2217. 'dec': '十二月',
  2218. 'sunday': '星期日',
  2219. 'monday': '星期一',
  2220. 'tuesday': '星期二',
  2221. 'wednesday': '星期三',
  2222. 'thursday': '星期四',
  2223. 'friday': '星期五',
  2224. 'saturday': '星期六',
  2225. 'sun': '星期日',
  2226. 'mon': '星期一',
  2227. 'tue': '星期二',
  2228. 'wed': '星期三',
  2229. 'thu': '星期四',
  2230. 'fri': '星期五',
  2231. 'sat': '星期六',
  2232. 'res': '資源',
  2233. 'dur': '時程',
  2234. 'comp': '達成率',
  2235. 'completion': '達成',
  2236. 'startdate': '起始日期',
  2237. 'planstartdate': '計劃起始日期',
  2238. 'enddate': '截止日期',
  2239. 'planenddate': '計劃截止日期',
  2240. 'cost': '成本',
  2241. 'moreinfo': "更多資訊",
  2242. 'nodata': 'No tasks found',
  2243. 'notes': '備註',
  2244. 'format': '格式',
  2245. 'hour': '時',
  2246. 'day': '日',
  2247. 'week': '星期',
  2248. 'month': '月',
  2249. 'quarter': '季',
  2250. 'hours': '小時',
  2251. 'days': '天',
  2252. 'weeks': '週',
  2253. 'months': '月',
  2254. 'quarters': '季',
  2255. 'hr': '小時',
  2256. 'dy': '天',
  2257. 'wk': '週',
  2258. 'mth': '月',
  2259. 'qtr': '季',
  2260. 'hrs': '小時',
  2261. 'dys': '天',
  2262. 'wks': '週',
  2263. 'mths': '月',
  2264. 'qtrs': '季'
  2265. };
  2266. exports.cn = cn;
  2267. var sv = {
  2268. 'format': 'Filter',
  2269. 'hour': 'Timme',
  2270. 'day': 'Dag',
  2271. 'week': 'Vecka',
  2272. 'month': 'Månad',
  2273. 'quarter': 'Kvartal',
  2274. 'hours': 'Timmar',
  2275. 'days': 'Dagar',
  2276. 'weeks': 'Veckor',
  2277. 'months': 'Månader',
  2278. 'quarters': 'Kvartal',
  2279. 'hr': 'Timme',
  2280. 'dy': 'Dag',
  2281. 'wk': 'Vecka',
  2282. 'mth': 'Månad',
  2283. 'qtr': 'Q',
  2284. 'hrs': 'Timmar',
  2285. 'dys': 'Dagar',
  2286. 'wks': 'Veckor',
  2287. 'mths': 'Månader',
  2288. 'qtrs': 'Q',
  2289. 'res': 'Resurs',
  2290. 'dur': 'Tidsåtgång',
  2291. 'comp': '% klart',
  2292. 'completion': 'Klart',
  2293. 'startdate': 'Startdatum',
  2294. 'planstartdate': 'Planerad startdatum',
  2295. 'enddate': 'Slutdatum',
  2296. 'planenddate': 'Planerad slutdatum',
  2297. 'cost': 'Kostnad',
  2298. 'moreinfo': 'Mer Information',
  2299. 'nodata': 'No tasks found',
  2300. 'notes': 'Notes',
  2301. 'january': 'januari',
  2302. 'february': 'februari',
  2303. 'march': 'mars',
  2304. 'april': 'april',
  2305. 'maylong': 'maj',
  2306. 'june': 'juni',
  2307. 'july': 'juli',
  2308. 'august': 'augusti',
  2309. 'september': 'september',
  2310. 'october': 'oktober',
  2311. 'november': 'november',
  2312. 'december': 'december',
  2313. 'jan': 'jan',
  2314. 'feb': 'feb',
  2315. 'mar': 'mar',
  2316. 'apr': 'apr',
  2317. 'may': 'maj',
  2318. 'jun': 'jun',
  2319. 'jul': 'jul',
  2320. 'aug': 'aug',
  2321. 'sep': 'sep',
  2322. 'oct': 'okt',
  2323. 'nov': 'nov',
  2324. 'dec': 'dec',
  2325. 'sunday': 'söndag',
  2326. 'monday': 'måndag',
  2327. 'tuesday': 'tisdag',
  2328. 'wednesday': 'onsdag',
  2329. 'thursday': 'torsdag',
  2330. 'friday': 'fredag',
  2331. 'saturday': 'lördag',
  2332. 'sun': 'sön',
  2333. 'mon': 'mån',
  2334. 'tue': 'tis',
  2335. 'wed': 'ons',
  2336. 'thu': 'tor',
  2337. 'fri': 'fre',
  2338. 'sat': 'lör'
  2339. };
  2340. exports.sv = sv;
  2341. var nl = {
  2342. 'format': 'Format',
  2343. 'hour': 'Uur',
  2344. 'day': 'Dag',
  2345. 'week': 'Week',
  2346. 'month': 'Maand',
  2347. 'quarter': 'Kwartaal',
  2348. 'hours': 'Uren',
  2349. 'days': 'Dagen',
  2350. 'weeks': 'Weken',
  2351. 'months': 'Maanden',
  2352. 'quarters': 'Kwartalen',
  2353. 'hr': 'uur',
  2354. 'dy': 'dag',
  2355. 'wk': 'wk',
  2356. 'mth': 'mnd',
  2357. 'qtr': 'kw',
  2358. 'hrs': 'uren',
  2359. 'dys': 'dagen',
  2360. 'wks': 'weken',
  2361. 'mths': 'maanden',
  2362. 'qtrs': 'kwartalen',
  2363. 'res': 'Resource',
  2364. 'dur': 'Doorlooptijd',
  2365. 'comp': '% gereed',
  2366. 'completion': 'Gereed',
  2367. 'startdate': 'Startdatum',
  2368. 'planstartdate': 'Geplande startdatum',
  2369. 'enddate': 'Einddatum',
  2370. 'planenddate': 'Geplande einddatum',
  2371. 'cost': 'Kosten',
  2372. 'moreinfo': 'Meer informatie',
  2373. 'nodata': 'No tasks found',
  2374. 'notes': 'Notities',
  2375. 'january': 'januari',
  2376. 'february': 'februari',
  2377. 'march': 'maart',
  2378. 'april': 'april',
  2379. 'maylong': 'mei',
  2380. 'june': 'juni',
  2381. 'july': 'juli',
  2382. 'august': 'augustus',
  2383. 'september': 'september',
  2384. 'october': 'oktober',
  2385. 'november': 'november',
  2386. 'december': 'december',
  2387. 'jan': 'jan',
  2388. 'feb': 'feb',
  2389. 'mar': 'mrt',
  2390. 'apr': 'apr',
  2391. 'may': 'mei',
  2392. 'jun': 'jun',
  2393. 'jul': 'jul',
  2394. 'aug': 'aug',
  2395. 'sep': 'sep',
  2396. 'oct': 'okt',
  2397. 'nov': 'nov',
  2398. 'dec': 'dec',
  2399. 'sunday': 'zondag',
  2400. 'monday': 'maandag',
  2401. 'tuesday': 'dinsdag',
  2402. 'wednesday': 'woensdag',
  2403. 'thursday': 'donderdag',
  2404. 'friday': 'vrijdag',
  2405. 'saturday': 'zaterdag',
  2406. 'sun': 'zo',
  2407. 'mon': 'ma',
  2408. 'tue': 'di',
  2409. 'wed': 'wo',
  2410. 'thu': 'do',
  2411. 'fri': 'vr',
  2412. 'sat': 'za'
  2413. };
  2414. exports.nl = nl;
  2415. var id = {
  2416. 'format': 'Format',
  2417. 'hour': 'Jam',
  2418. 'day': 'Hari',
  2419. 'week': 'Minggu',
  2420. 'month': 'Bulan',
  2421. 'quarter': 'Kuartal',
  2422. 'hours': 'Jam',
  2423. 'days': 'Hari',
  2424. 'weeks': 'Minggu',
  2425. 'months': 'Bulan',
  2426. 'quarters': 'Kuartal',
  2427. 'hr': 'Jam',
  2428. 'dy': 'Hari',
  2429. 'wk': 'Min',
  2430. 'mth': 'Bln',
  2431. 'qtr': 'Krtl',
  2432. 'hrs': 'Jam',
  2433. 'dys': 'Hari',
  2434. 'wks': 'Min',
  2435. 'mths': 'Bln',
  2436. 'qtrs': 'Krtl',
  2437. 'res': 'Sumber Daya',
  2438. 'dur': 'Durasi',
  2439. 'comp': '% Penyelesaian',
  2440. 'completion': 'Penyelesaian',
  2441. 'startdate': 'Tanggal Mulai',
  2442. 'planstartdate': 'Perencanaan Tanggal Mulai',
  2443. 'enddate': 'Tanggal Akhir',
  2444. 'planenddate': 'Perencanaan Tanggal Akhir',
  2445. 'cost': 'Biaya',
  2446. 'moreinfo': 'Informasi Lebih Lanjut',
  2447. 'nodata': 'No tasks found',
  2448. 'notes': 'Catatan',
  2449. 'january': 'Januari',
  2450. 'february': 'Februari',
  2451. 'march': 'Maret',
  2452. 'april': 'April',
  2453. 'maylong': 'Mei',
  2454. 'june': 'Juni',
  2455. 'july': 'Juli',
  2456. 'august': 'Agustus',
  2457. 'september': 'September',
  2458. 'october': 'Oktober',
  2459. 'november': 'November',
  2460. 'december': 'Desember',
  2461. 'jan': 'Jan',
  2462. 'feb': 'Feb',
  2463. 'mar': 'Mar',
  2464. 'apr': 'Apr',
  2465. 'may': 'Mei',
  2466. 'jun': 'Jun',
  2467. 'jul': 'Jul',
  2468. 'aug': 'Agu',
  2469. 'sep': 'Sep',
  2470. 'oct': 'Okt',
  2471. 'nov': 'Nov',
  2472. 'dec': 'Des',
  2473. 'sunday': 'Minggu',
  2474. 'monday': 'Senin',
  2475. 'tuesday': 'Selasa',
  2476. 'wednesday': 'Rabu',
  2477. 'thursday': 'Kamis',
  2478. 'friday': 'Jumat',
  2479. 'saturday': 'Sabtu',
  2480. 'sun': 'Min',
  2481. 'mon': 'Sen',
  2482. 'tue': 'Sel',
  2483. 'wed': 'Rab',
  2484. 'thu': 'Kam',
  2485. 'fri': 'Jum',
  2486. 'sat': 'Sab'
  2487. };
  2488. exports.id = id;
  2489. var tr = {
  2490. 'format': 'Biçim',
  2491. 'hour': 'Saat',
  2492. 'day': 'Gün',
  2493. 'week': 'Hafta',
  2494. 'month': 'Ay',
  2495. 'quarter': 'Çeyrek Yıl',
  2496. 'hours': 'Saat',
  2497. 'days': 'Gün',
  2498. 'weeks': 'Hafta',
  2499. 'months': 'Ay',
  2500. 'quarters': 'Çeyrek Yıl',
  2501. 'hr': 'Saat',
  2502. 'dy': 'Gün',
  2503. 'wk': 'Hft',
  2504. 'mth': 'Ay',
  2505. 'qtr': 'Çyrk',
  2506. 'hrs': 'Saat',
  2507. 'dys': 'Gün',
  2508. 'wks': 'Hft',
  2509. 'mths': 'Ay',
  2510. 'qtrs': 'Çyrk',
  2511. 'res': 'Kaynak',
  2512. 'dur': 'Süre',
  2513. 'comp': '% Tamamlanma.',
  2514. 'completion': 'Tamamlanma',
  2515. 'startdate': 'Başlangıç Tarihi',
  2516. 'planstartdate': 'Plan Başlama Tarihi',
  2517. 'enddate': 'Bitiş Tarihi',
  2518. 'planenddate': 'Plan Bitiş Tarihi',
  2519. 'cost': 'Tutar',
  2520. 'moreinfo': 'Daha Fazla Bilgi',
  2521. 'nodata': 'No tasks found',
  2522. 'notes': 'Notlar',
  2523. 'january': 'Ocak',
  2524. 'february': 'Şubat',
  2525. 'march': 'Mart',
  2526. 'april': 'Nisan',
  2527. 'maylong': 'Mayıs',
  2528. 'june': 'Haziran',
  2529. 'july': 'Temmuz',
  2530. 'august': 'Ağustos',
  2531. 'september': 'Eylül',
  2532. 'october': 'Ekim',
  2533. 'november': 'Kasım',
  2534. 'december': 'Aralık',
  2535. 'jan': 'Oca',
  2536. 'feb': 'Şub',
  2537. 'mar': 'Mar',
  2538. 'apr': 'Nis',
  2539. 'may': 'May',
  2540. 'jun': 'Haz',
  2541. 'jul': 'Tem',
  2542. 'aug': 'Ağu',
  2543. 'sep': 'Eyl',
  2544. 'oct': 'Eki',
  2545. 'nov': 'Kas',
  2546. 'dec': 'Ara',
  2547. 'sunday': 'Pazar',
  2548. 'monday': 'Pazartesi',
  2549. 'tuesday': 'Salı',
  2550. 'wednesday': 'Çarşamba',
  2551. 'thursday': 'Perşembe',
  2552. 'friday': 'Cuma',
  2553. 'saturday': 'Cumartesi',
  2554. 'sun': 'Paz',
  2555. 'mon': 'Pzt',
  2556. 'tue': 'Sal',
  2557. 'wed': 'Çrş',
  2558. 'thu': 'Prş',
  2559. 'fri': 'Cum',
  2560. 'sat': 'Cmt'
  2561. };
  2562. exports.tr = tr;
  2563. var ja = {
  2564. 'format': 'タイムライン表示',
  2565. 'hour': '時',
  2566. 'day': '日',
  2567. 'week': '週',
  2568. 'month': '月',
  2569. 'quarter': '四半期',
  2570. 'hours': '時間',
  2571. 'days': '日間',
  2572. 'weeks': '週間',
  2573. 'months': '月間',
  2574. 'quarters': '四半期',
  2575. 'hr': '時',
  2576. 'dy': '日',
  2577. 'wk': '週',
  2578. 'mth': '月',
  2579. 'qtr': '四',
  2580. 'hrs': '時間',
  2581. 'dys': '日間',
  2582. 'wks': '週間',
  2583. 'mths': '月間',
  2584. 'qtrs': '四半期',
  2585. 'res': 'リソース',
  2586. 'dur': '期間',
  2587. 'comp': '進捗率',
  2588. 'completion': '進捗率',
  2589. 'startdate': '開始日',
  2590. 'planstartdate': '予定開始日',
  2591. 'enddate': '期日',
  2592. 'planenddate': '予定期日',
  2593. 'cost': 'コスト',
  2594. 'moreinfo': '詳細',
  2595. 'nodata': 'No tasks found',
  2596. 'notes': 'ノート',
  2597. 'january': '1月',
  2598. 'february': '2月',
  2599. 'march': '3月',
  2600. 'april': '4月',
  2601. 'maylong': '5月',
  2602. 'june': '6月',
  2603. 'july': '7月',
  2604. 'august': '8月',
  2605. 'september': '9月',
  2606. 'october': '10月',
  2607. 'november': '11月',
  2608. 'december': '12月',
  2609. 'jan': '1月',
  2610. 'feb': '2月',
  2611. 'mar': '3月',
  2612. 'apr': '4月',
  2613. 'may': '5月',
  2614. 'jun': '6月',
  2615. 'jul': '7月',
  2616. 'aug': '8月',
  2617. 'sep': '9月',
  2618. 'oct': '10月',
  2619. 'nov': '11月',
  2620. 'dec': '12月',
  2621. 'sunday': '日曜日',
  2622. 'monday': '月曜日',
  2623. 'tuesday': '火曜日',
  2624. 'wednesday': '水曜日',
  2625. 'thursday': '木曜日',
  2626. 'friday': '金曜日',
  2627. 'saturday': '土曜日',
  2628. 'sun': '日',
  2629. 'mon': '月',
  2630. 'tue': '火',
  2631. 'wed': '水',
  2632. 'thu': '木',
  2633. 'fri': '金',
  2634. 'sat': '土',
  2635. 'tooltipLoading': 'ローディング中...'
  2636. };
  2637. exports.ja = ja;
  2638. var cs = {
  2639. 'format': 'Zobrazení',
  2640. 'hour': 'Hodina',
  2641. 'day': 'Den',
  2642. 'week': 'Týden',
  2643. 'month': 'Měsíc',
  2644. 'quarter': 'Kvartál',
  2645. 'hours': 'Hodiny',
  2646. 'days': 'Dni',
  2647. 'weeks': 'Týdny',
  2648. 'months': 'Měsíce',
  2649. 'quarters': 'Kvartály',
  2650. 'hr': 'Ho',
  2651. 'dy': 'Den',
  2652. 'wk': 'Tyd',
  2653. 'mth': 'Měs',
  2654. 'qtr': 'Kvar',
  2655. 'hrs': 'Ho',
  2656. 'dys': 'Dni',
  2657. 'wks': 'Tyd',
  2658. 'mths': 'Měs',
  2659. 'qtrs': 'Kvar',
  2660. 'res': 'Přiřazeno',
  2661. 'dur': 'Trvání',
  2662. 'comp': '% Hotovo',
  2663. 'completion': 'Hotovo',
  2664. 'startdate': 'Start',
  2665. 'planstartdate': 'Plánovaný start',
  2666. 'enddate': 'Konec',
  2667. 'planenddate': 'Plánovaný konec',
  2668. 'cost': 'Náklady',
  2669. 'moreinfo': 'Více informací',
  2670. 'nodata': 'No tasks found',
  2671. 'notes': 'Poznámky',
  2672. 'january': 'Leden',
  2673. 'february': 'Únor',
  2674. 'march': 'Březen',
  2675. 'april': 'Duben',
  2676. 'maylong': 'Květen',
  2677. 'june': 'Červen',
  2678. 'july': 'Červenec',
  2679. 'august': 'Srpen',
  2680. 'september': 'Září',
  2681. 'october': 'Říjen',
  2682. 'november': 'Listopad',
  2683. 'december': 'Prosinec',
  2684. 'jan': 'Led',
  2685. 'feb': 'Úno',
  2686. 'mar': 'Bře',
  2687. 'apr': 'Dub',
  2688. 'may': 'Kvě',
  2689. 'jun': 'Čer',
  2690. 'jul': 'Čvc',
  2691. 'aug': 'Srp',
  2692. 'sep': 'Zář',
  2693. 'oct': 'Říj',
  2694. 'nov': 'Lis',
  2695. 'dec': 'Pro',
  2696. 'sunday': 'Neděle',
  2697. 'monday': 'Pondělí',
  2698. 'tuesday': 'Úterý',
  2699. 'wednesday': 'Středa',
  2700. 'thursday': 'Čtvrtek',
  2701. 'friday': 'Pátek',
  2702. 'saturday': 'Sobota',
  2703. 'sun': 'Ne',
  2704. 'mon': 'Po',
  2705. 'tue': 'Út',
  2706. 'wed': 'St',
  2707. 'thu': 'Čt',
  2708. 'fri': 'Pa',
  2709. 'sat': 'So',
  2710. 'tooltipLoading': 'Nahrávám...'
  2711. };
  2712. exports.cs = cs;
  2713. var hu = {
  2714. 'format': 'Formátum',
  2715. 'hour': 'Óra',
  2716. 'day': 'Nap',
  2717. 'week': 'Hét',
  2718. 'month': 'Hónap',
  2719. 'quarter': 'Negyedév ',
  2720. 'hours': 'Órák',
  2721. 'days': 'Nap',
  2722. 'weeks': 'Hét',
  2723. 'months': 'Hónap',
  2724. 'quarters': 'Negyedév',
  2725. 'hr': 'Ó',
  2726. 'dy': 'Nap',
  2727. 'wk': 'Hét',
  2728. 'mth': 'Hó',
  2729. 'qtr': 'NÉ',
  2730. 'hrs': 'Óra',
  2731. 'dys': 'Nap',
  2732. 'wks': 'Hét',
  2733. 'mths': 'Hó',
  2734. 'qtrs': 'NÉ',
  2735. 'res': 'Erőforrás',
  2736. 'dur': 'Időtartam',
  2737. 'comp': '% Kész',
  2738. 'completion': 'Elkészült',
  2739. 'startdate': 'Kezdés',
  2740. 'planstartdate': 'Tervezett kezdés',
  2741. 'enddate': 'Befejezés',
  2742. 'planenddate': 'Tervezett befejezés',
  2743. 'cost': 'Költség',
  2744. 'moreinfo': 'További információ',
  2745. 'nodata': 'No tasks found',
  2746. 'notes': 'Jegyzetek',
  2747. 'january': 'Január',
  2748. 'february': 'Február',
  2749. 'march': 'Március',
  2750. 'april': 'Április',
  2751. 'maylong': 'Május',
  2752. 'june': 'Június',
  2753. 'july': 'Július',
  2754. 'august': 'Augusztus',
  2755. 'september': 'Szeptember',
  2756. 'october': 'Október',
  2757. 'november': 'November',
  2758. 'december': 'December',
  2759. 'jan': 'Jan',
  2760. 'feb': 'Feb',
  2761. 'mar': 'Már',
  2762. 'apr': 'Ápr',
  2763. 'may': 'Máj',
  2764. 'jun': 'Jún',
  2765. 'jul': 'Júl',
  2766. 'aug': 'Aug',
  2767. 'sep': 'Szep',
  2768. 'oct': 'Okt',
  2769. 'nov': 'Nov',
  2770. 'dec': 'Dec',
  2771. 'sunday': 'Vasárnap',
  2772. 'monday': 'Hétfő',
  2773. 'tuesday': 'Kedd',
  2774. 'wednesday': 'Szerda',
  2775. 'thursday': 'Csütörtök',
  2776. 'friday': 'Péntek',
  2777. 'saturday': 'Szombat',
  2778. 'sun': 'Vas',
  2779. 'mon': 'Hé',
  2780. 'tue': 'Ke',
  2781. 'wed': 'Sze',
  2782. 'thu': 'Csü',
  2783. 'fri': 'Pén',
  2784. 'sat': 'Szo',
  2785. 'tooltipLoading': 'Belöltés...'
  2786. };
  2787. exports.hu = hu;
  2788. var ko = {
  2789. 'format': '구분',
  2790. 'hour': '시',
  2791. 'day': '일',
  2792. 'week': '주',
  2793. 'month': '월',
  2794. 'quarter': '분기',
  2795. 'hours': '시',
  2796. 'days': '일',
  2797. 'weeks': '주',
  2798. 'months': '월',
  2799. 'quarters': '분기',
  2800. 'hr': '시',
  2801. 'dy': '일',
  2802. 'wk': '주',
  2803. 'mth': '월',
  2804. 'qtr': '분기',
  2805. 'hrs': '시',
  2806. 'dys': '일',
  2807. 'wks': '주',
  2808. 'mths': '월',
  2809. 'qtrs': '분기',
  2810. 'res': '이름',
  2811. 'dur': '기간',
  2812. 'comp': '% ',
  2813. 'completion': '완료',
  2814. 'startdate': '시작일자',
  2815. 'planstartdate': '계획 시작일자',
  2816. 'enddate': '종료일자',
  2817. 'planenddate': '계획 종료일자',
  2818. 'cost': '비용',
  2819. 'moreinfo': '더 많은 정보',
  2820. 'nodata': 'No tasks found',
  2821. 'notes': '비고',
  2822. 'january': '1월',
  2823. 'february': '2월',
  2824. 'march': '3월',
  2825. 'april': '4월',
  2826. 'maylong': '5월',
  2827. 'june': '6월',
  2828. 'july': '7월',
  2829. 'august': '8월',
  2830. 'september': '9월',
  2831. 'october': '10월',
  2832. 'november': '11월',
  2833. 'december': '12월',
  2834. 'jan': '1',
  2835. 'feb': '2',
  2836. 'mar': '3',
  2837. 'apr': '4',
  2838. 'may': '5',
  2839. 'jun': '6',
  2840. 'jul': '7',
  2841. 'aug': '8',
  2842. 'sep': '9',
  2843. 'oct': '10',
  2844. 'nov': '11',
  2845. 'dec': '12',
  2846. 'sunday': '일요일',
  2847. 'monday': '월요일',
  2848. 'tuesday': '화요일',
  2849. 'wednesday': '수요일',
  2850. 'thursday': '목요일',
  2851. 'friday': '금요일',
  2852. 'saturday': '토요일',
  2853. 'sun': '일',
  2854. 'mon': '월',
  2855. 'tue': '화',
  2856. 'wed': '수',
  2857. 'thu': '목',
  2858. 'fri': '금',
  2859. 'sat': '토',
  2860. 'tooltipLoading': '로딩중...'
  2861. };
  2862. exports.ko = ko;
  2863. },{}],9:[function(require,module,exports){
  2864. "use strict";
  2865. Object.defineProperty(exports, "__esModule", { value: true });
  2866. var date_utils_1 = require("./utils/date_utils");
  2867. var draw_columns_1 = require("./draw_columns");
  2868. exports.includeGetSet = function () {
  2869. /**
  2870. * SETTERS
  2871. */
  2872. this.setOptions = function (options) {
  2873. var keys = Object.keys(options);
  2874. for (var i = 0; i < keys.length; i++) {
  2875. var key = keys[i];
  2876. var val = options[key];
  2877. if (key === 'vResources' || key === 'vColumnOrder') {
  2878. // ev = `this.set${key.substr(1)}(val)`;
  2879. this['set' + key.substr(1)](val);
  2880. }
  2881. else if (val instanceof Array) {
  2882. // ev = `this.set${key.substr(1)}(...val)`;
  2883. this['set' + key.substr(1)].apply(this, val);
  2884. }
  2885. else {
  2886. // ev = `this.set${key.substr(1)}(val)`;
  2887. this['set' + key.substr(1)](val);
  2888. }
  2889. }
  2890. };
  2891. this.setUseFade = function (pVal) { this.vUseFade = pVal; };
  2892. this.setUseMove = function (pVal) { this.vUseMove = pVal; };
  2893. this.setUseRowHlt = function (pVal) { this.vUseRowHlt = pVal; };
  2894. this.setUseToolTip = function (pVal) { this.vUseToolTip = pVal; };
  2895. this.setUseSort = function (pVal) { this.vUseSort = pVal; };
  2896. this.setUseSingleCell = function (pVal) { this.vUseSingleCell = pVal * 1; };
  2897. this.setFormatArr = function () {
  2898. var vValidFormats = 'hour day week month quarter';
  2899. this.vFormatArr = new Array();
  2900. for (var i = 0, j = 0; i < arguments.length; i++) {
  2901. if (vValidFormats.indexOf(arguments[i].toLowerCase()) != -1 && arguments[i].length > 1) {
  2902. this.vFormatArr[j++] = arguments[i].toLowerCase();
  2903. var vRegExp = new RegExp('(?:^|\s)' + arguments[i] + '(?!\S)', 'g');
  2904. vValidFormats = vValidFormats.replace(vRegExp, '');
  2905. }
  2906. }
  2907. };
  2908. this.setShowRes = function (pVal) { this.vShowRes = pVal; };
  2909. this.setShowDur = function (pVal) { this.vShowDur = pVal; };
  2910. this.setShowComp = function (pVal) { this.vShowComp = pVal; };
  2911. this.setShowStartDate = function (pVal) { this.vShowStartDate = pVal; };
  2912. this.setShowEndDate = function (pVal) { this.vShowEndDate = pVal; };
  2913. this.setShowPlanStartDate = function (pVal) { this.vShowPlanStartDate = pVal; };
  2914. this.setShowPlanEndDate = function (pVal) { this.vShowPlanEndDate = pVal; };
  2915. this.setShowCost = function (pVal) { this.vShowCost = pVal; };
  2916. this.setShowAddEntries = function (pVal) { this.vShowAddEntries = pVal; };
  2917. this.setShowTaskInfoRes = function (pVal) { this.vShowTaskInfoRes = pVal; };
  2918. this.setShowTaskInfoDur = function (pVal) { this.vShowTaskInfoDur = pVal; };
  2919. this.setShowTaskInfoComp = function (pVal) { this.vShowTaskInfoComp = pVal; };
  2920. this.setShowTaskInfoStartDate = function (pVal) { this.vShowTaskInfoStartDate = pVal; };
  2921. this.setShowTaskInfoEndDate = function (pVal) { this.vShowTaskInfoEndDate = pVal; };
  2922. this.setShowTaskInfoNotes = function (pVal) { this.vShowTaskInfoNotes = pVal; };
  2923. this.setShowTaskInfoLink = function (pVal) { this.vShowTaskInfoLink = pVal; };
  2924. this.setShowEndWeekDate = function (pVal) { this.vShowEndWeekDate = pVal; };
  2925. this.setShowWeekends = function (pVal) { this.vShowWeekends = pVal; };
  2926. this.setShowSelector = function () {
  2927. var vValidSelectors = 'top bottom';
  2928. this.vShowSelector = new Array();
  2929. for (var i = 0, j = 0; i < arguments.length; i++) {
  2930. if (vValidSelectors.indexOf(arguments[i].toLowerCase()) != -1 && arguments[i].length > 1) {
  2931. this.vShowSelector[j++] = arguments[i].toLowerCase();
  2932. var vRegExp = new RegExp('(?:^|\s)' + arguments[i] + '(?!\S)', 'g');
  2933. vValidSelectors = vValidSelectors.replace(vRegExp, '');
  2934. }
  2935. }
  2936. };
  2937. this.setShowDeps = function (pVal) { this.vShowDeps = pVal; };
  2938. this.setDateInputFormat = function (pVal) { this.vDateInputFormat = pVal; };
  2939. this.setDateTaskTableDisplayFormat = function (pVal) { this.vDateTaskTableDisplayFormat = date_utils_1.parseDateFormatStr(pVal); };
  2940. this.setDateTaskDisplayFormat = function (pVal) { this.vDateTaskDisplayFormat = date_utils_1.parseDateFormatStr(pVal); };
  2941. this.setHourMajorDateDisplayFormat = function (pVal) { this.vHourMajorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); };
  2942. this.setHourMinorDateDisplayFormat = function (pVal) { this.vHourMinorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); };
  2943. this.setDayMajorDateDisplayFormat = function (pVal) { this.vDayMajorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); };
  2944. this.setDayMinorDateDisplayFormat = function (pVal) { this.vDayMinorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); };
  2945. this.setWeekMajorDateDisplayFormat = function (pVal) { this.vWeekMajorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); };
  2946. this.setWeekMinorDateDisplayFormat = function (pVal) { this.vWeekMinorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); };
  2947. this.setMonthMajorDateDisplayFormat = function (pVal) { this.vMonthMajorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); };
  2948. this.setMonthMinorDateDisplayFormat = function (pVal) { this.vMonthMinorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); };
  2949. this.setQuarterMajorDateDisplayFormat = function (pVal) { this.vQuarterMajorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); };
  2950. this.setQuarterMinorDateDisplayFormat = function (pVal) { this.vQuarterMinorDateDisplayFormat = date_utils_1.parseDateFormatStr(pVal); };
  2951. this.setCaptionType = function (pType) { this.vCaptionType = pType; };
  2952. this.setFormat = function (pFormat) {
  2953. this.vFormat = pFormat;
  2954. this.Draw();
  2955. };
  2956. this.setWorkingDays = function (workingDays) { this.vWorkingDays = workingDays; };
  2957. this.setMinGpLen = function (pMinGpLen) { this.vMinGpLen = pMinGpLen; };
  2958. this.setScrollTo = function (pDate) { this.vScrollTo = pDate; };
  2959. this.setHourColWidth = function (pWidth) { this.vHourColWidth = pWidth; };
  2960. this.setDayColWidth = function (pWidth) { this.vDayColWidth = pWidth; };
  2961. this.setWeekColWidth = function (pWidth) { this.vWeekColWidth = pWidth; };
  2962. this.setMonthColWidth = function (pWidth) { this.vMonthColWidth = pWidth; };
  2963. this.setQuarterColWidth = function (pWidth) { this.vQuarterColWidth = pWidth; };
  2964. this.setRowHeight = function (pHeight) { this.vRowHeight = pHeight; };
  2965. this.setLang = function (pLang) { if (this.vLangs[pLang])
  2966. this.vLang = pLang; };
  2967. this.setChartBody = function (pDiv) { if (typeof HTMLDivElement !== 'function' || pDiv instanceof HTMLDivElement)
  2968. this.vChartBody = pDiv; };
  2969. this.setChartHead = function (pDiv) { if (typeof HTMLDivElement !== 'function' || pDiv instanceof HTMLDivElement)
  2970. this.vChartHead = pDiv; };
  2971. this.setListBody = function (pDiv) { if (typeof HTMLDivElement !== 'function' || pDiv instanceof HTMLDivElement)
  2972. this.vListBody = pDiv; };
  2973. this.setChartTable = function (pTable) { if (typeof HTMLTableElement !== 'function' || pTable instanceof HTMLTableElement)
  2974. this.vChartTable = pTable; };
  2975. this.setLines = function (pDiv) { if (typeof HTMLDivElement !== 'function' || pDiv instanceof HTMLDivElement)
  2976. this.vLines = pDiv; };
  2977. this.setLineOptions = function (lineOptions) { this.vLineOptions = lineOptions; };
  2978. this.setTimer = function (pVal) { this.vTimer = pVal * 1; };
  2979. this.setTooltipDelay = function (pVal) { this.vTooltipDelay = pVal * 1; };
  2980. this.setTooltipTemplate = function (pVal) { this.vTooltipTemplate = pVal; };
  2981. this.setMinDate = function (pVal) { this.vMinDate = pVal; };
  2982. this.setMaxDate = function (pVal) { this.vMaxDate = pVal; };
  2983. this.addLang = function (pLang, pVals) {
  2984. if (!this.vLangs[pLang]) {
  2985. this.vLangs[pLang] = new Object();
  2986. for (var vKey in this.vLangs['en'])
  2987. this.vLangs[pLang][vKey] = (pVals[vKey]) ? document.createTextNode(pVals[vKey]).data : this.vLangs['en'][vKey];
  2988. }
  2989. };
  2990. this.setTotalHeight = function (pVal) { this.vTotalHeight = pVal; };
  2991. // EVENTS
  2992. this.setEvents = function (pEvents) { this.vEvents = pEvents; };
  2993. this.setEventsChange = function (pEventsChange) { this.vEventsChange = pEventsChange; };
  2994. this.setEventClickRow = function (fn) { this.vEventClickRow = fn; };
  2995. this.setEventClickCollapse = function (fn) { this.vEventClickCollapse = fn; };
  2996. this.setResources = function (resources) { this.vResources = resources; };
  2997. this.setAdditionalHeaders = function (headers) { this.vAdditionalHeaders = headers; };
  2998. this.setColumnOrder = function (order) { this.vColumnOrder = order; };
  2999. this.setEditable = function (editable) { this.vEditable = editable; };
  3000. this.setDebug = function (debug) { this.vDebug = debug; };
  3001. /**
  3002. * GETTERS
  3003. */
  3004. this.getDivId = function () { return this.vDivId; };
  3005. this.getUseFade = function () { return this.vUseFade; };
  3006. this.getUseMove = function () { return this.vUseMove; };
  3007. this.getUseRowHlt = function () { return this.vUseRowHlt; };
  3008. this.getUseToolTip = function () { return this.vUseToolTip; };
  3009. this.getUseSort = function () { return this.vUseSort; };
  3010. this.getUseSingleCell = function () { return this.vUseSingleCell; };
  3011. this.getFormatArr = function () { return this.vFormatArr; };
  3012. this.getShowRes = function () { return this.vShowRes; };
  3013. this.getShowDur = function () { return this.vShowDur; };
  3014. this.getShowComp = function () { return this.vShowComp; };
  3015. this.getShowStartDate = function () { return this.vShowStartDate; };
  3016. this.getShowEndDate = function () { return this.vShowEndDate; };
  3017. this.getShowPlanStartDate = function () { return this.vShowPlanStartDate; };
  3018. this.getShowPlanEndDate = function () { return this.vShowPlanEndDate; };
  3019. this.getShowCost = function () { return this.vShowCost; };
  3020. this.getShowAddEntries = function () { return this.vShowAddEntries; };
  3021. this.getShowTaskInfoRes = function () { return this.vShowTaskInfoRes; };
  3022. this.getShowTaskInfoDur = function () { return this.vShowTaskInfoDur; };
  3023. this.getShowTaskInfoComp = function () { return this.vShowTaskInfoComp; };
  3024. this.getShowTaskInfoStartDate = function () { return this.vShowTaskInfoStartDate; };
  3025. this.getShowTaskInfoEndDate = function () { return this.vShowTaskInfoEndDate; };
  3026. this.getShowTaskInfoNotes = function () { return this.vShowTaskInfoNotes; };
  3027. this.getShowTaskInfoLink = function () { return this.vShowTaskInfoLink; };
  3028. this.getShowEndWeekDate = function () { return this.vShowEndWeekDate; };
  3029. this.getShowWeekends = function () { return this.vShowWeekends; };
  3030. this.getShowSelector = function () { return this.vShowSelector; };
  3031. this.getShowDeps = function () { return this.vShowDeps; };
  3032. this.getDateInputFormat = function () { return this.vDateInputFormat; };
  3033. this.getDateTaskTableDisplayFormat = function () { return this.vDateTaskTableDisplayFormat; };
  3034. this.getDateTaskDisplayFormat = function () { return this.vDateTaskDisplayFormat; };
  3035. this.getHourMajorDateDisplayFormat = function () { return this.vHourMajorDateDisplayFormat; };
  3036. this.getHourMinorDateDisplayFormat = function () { return this.vHourMinorDateDisplayFormat; };
  3037. this.getDayMajorDateDisplayFormat = function () { return this.vDayMajorDateDisplayFormat; };
  3038. this.getDayMinorDateDisplayFormat = function () { return this.vDayMinorDateDisplayFormat; };
  3039. this.getWeekMajorDateDisplayFormat = function () { return this.vWeekMajorDateDisplayFormat; };
  3040. this.getWeekMinorDateDisplayFormat = function () { return this.vWeekMinorDateDisplayFormat; };
  3041. this.getMonthMajorDateDisplayFormat = function () { return this.vMonthMajorDateDisplayFormat; };
  3042. this.getMonthMinorDateDisplayFormat = function () { return this.vMonthMinorDateDisplayFormat; };
  3043. this.getQuarterMajorDateDisplayFormat = function () { return this.vQuarterMajorDateDisplayFormat; };
  3044. this.getQuarterMinorDateDisplayFormat = function () { return this.vQuarterMinorDateDisplayFormat; };
  3045. this.getCaptionType = function () { return this.vCaptionType; };
  3046. this.getMinGpLen = function () { return this.vMinGpLen; };
  3047. this.getScrollTo = function () { return this.vScrollTo; };
  3048. this.getHourColWidth = function () { return this.vHourColWidth; };
  3049. this.getDayColWidth = function () { return this.vDayColWidth; };
  3050. this.getWeekColWidth = function () { return this.vWeekColWidth; };
  3051. this.getMonthColWidth = function () { return this.vMonthColWidth; };
  3052. this.getQuarterColWidth = function () { return this.vQuarterColWidth; };
  3053. this.getRowHeight = function () { return this.vRowHeight; };
  3054. this.getChartBody = function () { return this.vChartBody; };
  3055. this.getChartHead = function () { return this.vChartHead; };
  3056. this.getListBody = function () { return this.vListBody; };
  3057. this.getChartTable = function () { return this.vChartTable; };
  3058. this.getLines = function () { return this.vLines; };
  3059. this.getTimer = function () { return this.vTimer; };
  3060. this.getMinDate = function () { return this.vMinDate; };
  3061. this.getMaxDate = function () { return this.vMaxDate; };
  3062. this.getTooltipDelay = function () { return this.vTooltipDelay; };
  3063. this.getList = function () { return this.vTaskList; };
  3064. //EVENTS
  3065. this.getEventsClickCell = function () { return this.vEvents; };
  3066. this.getEventsChange = function () { return this.vEventsChange; };
  3067. this.getEventClickRow = function () { return this.vEventClickRow; };
  3068. this.getEventClickCollapse = function () { return this.vEventClickCollapse; };
  3069. this.getResources = function () { return this.vResources; };
  3070. this.getAdditionalHeaders = function () { return this.vAdditionalHeaders; };
  3071. this.getColumnOrder = function () { return this.vColumnOrder || draw_columns_1.COLUMN_ORDER; };
  3072. };
  3073. },{"./draw_columns":3,"./utils/date_utils":11}],10:[function(require,module,exports){
  3074. "use strict";
  3075. var __assign = (this && this.__assign) || function () {
  3076. __assign = Object.assign || function(t) {
  3077. for (var s, i = 1, n = arguments.length; i < n; i++) {
  3078. s = arguments[i];
  3079. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  3080. t[p] = s[p];
  3081. }
  3082. return t;
  3083. };
  3084. return __assign.apply(this, arguments);
  3085. };
  3086. Object.defineProperty(exports, "__esModule", { value: true });
  3087. var general_utils_1 = require("./utils/general_utils");
  3088. var draw_utils_1 = require("./utils/draw_utils");
  3089. var date_utils_1 = require("./utils/date_utils");
  3090. // function to open window to display task link
  3091. exports.taskLink = function (pRef, pWidth, pHeight) {
  3092. var vWidth, vHeight;
  3093. if (pWidth)
  3094. vWidth = pWidth;
  3095. else
  3096. vWidth = 400;
  3097. if (pHeight)
  3098. vHeight = pHeight;
  3099. else
  3100. vHeight = 400;
  3101. window.open(pRef, 'newwin', 'height=' + vHeight + ',width=' + vWidth); // let OpenWindow =
  3102. };
  3103. exports.sortTasks = function (pList, pID, pIdx) {
  3104. if (pList.length < 2) {
  3105. return pIdx;
  3106. }
  3107. var sortIdx = pIdx;
  3108. var sortArr = new Array();
  3109. for (var i = 0; i < pList.length; i++) {
  3110. if (pList[i].getParent() == pID)
  3111. sortArr.push(pList[i]);
  3112. }
  3113. if (sortArr.length > 0) {
  3114. sortArr.sort(function (a, b) {
  3115. var i = a.getStart().getTime() - b.getStart().getTime();
  3116. if (i == 0)
  3117. i = a.getEnd().getTime() - b.getEnd().getTime();
  3118. if (i == 0)
  3119. return a.getID() - b.getID();
  3120. else
  3121. return i;
  3122. });
  3123. }
  3124. for (var j = 0; j < sortArr.length; j++) {
  3125. for (var i = 0; i < pList.length; i++) {
  3126. if (pList[i].getID() == sortArr[j].getID()) {
  3127. pList[i].setSortIdx(sortIdx++);
  3128. sortIdx = exports.sortTasks(pList, pList[i].getID(), sortIdx);
  3129. }
  3130. }
  3131. }
  3132. return sortIdx;
  3133. };
  3134. exports.TaskItemObject = function (object) {
  3135. var pDataObject = __assign({}, object);
  3136. general_utils_1.internalProperties.forEach(function (property) {
  3137. delete pDataObject[property];
  3138. });
  3139. return new exports.TaskItem(object.pID, object.pName, object.pStart, object.pEnd, object.pClass, object.pLink, object.pMile, object.pRes, object.pComp, object.pGroup, object.pParent, object.pOpen, object.pDepend, object.pCaption, object.pNotes, object.pGantt, object.pCost, object.pPlanStart, object.pPlanEnd, object.pDuration, object.pBarText, object);
  3140. };
  3141. exports.TaskItem = function (pID, pName, pStart, pEnd, pClass, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGantt, pCost, pPlanStart, pPlanEnd, pDuration, pBarText, pDataObject) {
  3142. if (pCost === void 0) { pCost = null; }
  3143. if (pPlanStart === void 0) { pPlanStart = null; }
  3144. if (pPlanEnd === void 0) { pPlanEnd = null; }
  3145. if (pDuration === void 0) { pDuration = null; }
  3146. if (pBarText === void 0) { pBarText = null; }
  3147. if (pDataObject === void 0) { pDataObject = null; }
  3148. var vGantt = pGantt ? pGantt : this;
  3149. var _id = document.createTextNode(pID).data;
  3150. var vID = general_utils_1.hashKey(document.createTextNode(pID).data);
  3151. var vName = document.createTextNode(pName).data;
  3152. var vStart = null;
  3153. var vEnd = null;
  3154. var vPlanStart = null;
  3155. var vPlanEnd = null;
  3156. var vGroupMinStart = null;
  3157. var vGroupMinEnd = null;
  3158. var vGroupMinPlanStart = null;
  3159. var vGroupMinPlanEnd = null;
  3160. var vClass = document.createTextNode(pClass).data;
  3161. var vLink = document.createTextNode(pLink).data;
  3162. var vMile = parseInt(document.createTextNode(pMile).data);
  3163. var vRes = document.createTextNode(pRes).data;
  3164. var vComp = parseFloat(document.createTextNode(pComp).data);
  3165. var vCost = parseInt(document.createTextNode(pCost).data);
  3166. var vGroup = parseInt(document.createTextNode(pGroup).data);
  3167. var vDataObject = pDataObject;
  3168. var vCompVal;
  3169. var parent = document.createTextNode(pParent).data;
  3170. if (parent && parent !== '0') {
  3171. parent = general_utils_1.hashKey(parent).toString();
  3172. }
  3173. var vParent = parent;
  3174. var vOpen = (vGroup == 2) ? 1 : parseInt(document.createTextNode(pOpen).data);
  3175. var vDepend = new Array();
  3176. var vDependType = new Array();
  3177. var vCaption = document.createTextNode(pCaption).data;
  3178. var vDuration = pDuration || '';
  3179. var vBarText = pBarText || '';
  3180. var vLevel = 0;
  3181. var vNumKid = 0;
  3182. var vWeight = 0;
  3183. var vVisible = 1;
  3184. var vSortIdx = 0;
  3185. var vToDelete = false;
  3186. var x1, y1, x2, y2;
  3187. var vNotes;
  3188. var vParItem = null;
  3189. var vCellDiv = null;
  3190. var vBarDiv = null;
  3191. var vTaskDiv = null;
  3192. var vPlanTaskDiv = null;
  3193. var vListChildRow = null;
  3194. var vChildRow = null;
  3195. var vGroupSpan = null;
  3196. vNotes = document.createElement('span');
  3197. vNotes.className = 'gTaskNotes';
  3198. if (pNotes != null) {
  3199. vNotes.innerHTML = pNotes;
  3200. general_utils_1.stripUnwanted(vNotes);
  3201. }
  3202. if (pStart != null && pStart != '') {
  3203. vStart = (pStart instanceof Date) ? pStart : date_utils_1.parseDateStr(document.createTextNode(pStart).data, vGantt.getDateInputFormat());
  3204. vGroupMinStart = vStart;
  3205. }
  3206. if (pEnd != null && pEnd != '') {
  3207. vEnd = (pEnd instanceof Date) ? pEnd : date_utils_1.parseDateStr(document.createTextNode(pEnd).data, vGantt.getDateInputFormat());
  3208. vGroupMinEnd = vEnd;
  3209. }
  3210. if (pPlanStart != null && pPlanStart != '') {
  3211. vPlanStart = (pPlanStart instanceof Date) ? pPlanStart : date_utils_1.parseDateStr(document.createTextNode(pPlanStart).data, vGantt.getDateInputFormat());
  3212. vGroupMinPlanStart = vPlanStart;
  3213. }
  3214. if (pPlanEnd != null && pPlanEnd != '') {
  3215. vPlanEnd = (pPlanEnd instanceof Date) ? pPlanEnd : date_utils_1.parseDateStr(document.createTextNode(pPlanEnd).data, vGantt.getDateInputFormat());
  3216. vGroupMinPlanEnd = vPlanEnd;
  3217. }
  3218. if (pDepend != null) {
  3219. var vDependStr = pDepend + '';
  3220. var vDepList = vDependStr.split(',');
  3221. var n = vDepList.length;
  3222. for (var k = 0; k < n; k++) {
  3223. if (vDepList[k].toUpperCase().endsWith('SS')) {
  3224. vDepend[k] = vDepList[k].substring(0, vDepList[k].length - 2);
  3225. vDependType[k] = 'SS';
  3226. }
  3227. else if (vDepList[k].toUpperCase().endsWith('FF')) {
  3228. vDepend[k] = vDepList[k].substring(0, vDepList[k].length - 2);
  3229. vDependType[k] = 'FF';
  3230. }
  3231. else if (vDepList[k].toUpperCase().endsWith('SF')) {
  3232. vDepend[k] = vDepList[k].substring(0, vDepList[k].length - 2);
  3233. vDependType[k] = 'SF';
  3234. }
  3235. else if (vDepList[k].toUpperCase().endsWith('FS')) {
  3236. vDepend[k] = vDepList[k].substring(0, vDepList[k].length - 2);
  3237. vDependType[k] = 'FS';
  3238. }
  3239. else {
  3240. vDepend[k] = vDepList[k];
  3241. vDependType[k] = 'FS';
  3242. }
  3243. if (vDepend[k]) {
  3244. vDepend[k] = general_utils_1.hashKey(vDepend[k]).toString();
  3245. }
  3246. }
  3247. }
  3248. this.getID = function () { return vID; };
  3249. this.getOriginalID = function () { return _id; };
  3250. this.getGantt = function () { return vGantt; };
  3251. this.getName = function () { return vName; };
  3252. this.getStart = function () {
  3253. if (vStart)
  3254. return vStart;
  3255. else if (vPlanStart)
  3256. return vPlanStart;
  3257. else
  3258. return new Date();
  3259. };
  3260. this.getStartVar = function () {
  3261. return vStart;
  3262. };
  3263. this.getEnd = function () {
  3264. if (vEnd)
  3265. return vEnd;
  3266. else if (vPlanEnd)
  3267. return vPlanEnd;
  3268. else if (vStart && vDuration) {
  3269. var date = new Date(vStart);
  3270. var vUnits = vDuration.split(' ');
  3271. var value = parseInt(vUnits[0]);
  3272. switch (vUnits[1]) {
  3273. case 'hour':
  3274. date.setMinutes(date.getMinutes() + (value * 60));
  3275. break;
  3276. case 'day':
  3277. date.setMinutes(date.getMinutes() + (value * 60 * 24));
  3278. break;
  3279. case 'week':
  3280. date.setMinutes(date.getMinutes() + (value * 60 * 24 * 7));
  3281. break;
  3282. case 'month':
  3283. date.setMonth(date.getMonth() + (value));
  3284. break;
  3285. case 'quarter':
  3286. date.setMonth(date.getMonth() + (value * 3));
  3287. break;
  3288. }
  3289. return date;
  3290. }
  3291. else
  3292. return new Date();
  3293. };
  3294. this.getEndVar = function () {
  3295. return vEnd;
  3296. };
  3297. this.getPlanStart = function () { return vPlanStart ? vPlanStart : vStart; };
  3298. this.getPlanEnd = function () { return vPlanEnd ? vPlanEnd : vEnd; };
  3299. this.getCost = function () { return vCost; };
  3300. this.getGroupMinStart = function () { return vGroupMinStart; };
  3301. this.getGroupMinEnd = function () { return vGroupMinEnd; };
  3302. this.getGroupMinPlanStart = function () { return vGroupMinPlanStart; };
  3303. this.getGroupMinPlanEnd = function () { return vGroupMinPlanEnd; };
  3304. this.getClass = function () { return vClass; };
  3305. this.getLink = function () { return vLink; };
  3306. this.getMile = function () { return vMile; };
  3307. this.getDepend = function () {
  3308. if (vDepend)
  3309. return vDepend;
  3310. else
  3311. return null;
  3312. };
  3313. this.getDataObject = function () { return vDataObject; };
  3314. this.getDepType = function () { if (vDependType)
  3315. return vDependType;
  3316. else
  3317. return null; };
  3318. this.getCaption = function () { if (vCaption)
  3319. return vCaption;
  3320. else
  3321. return ''; };
  3322. this.getResource = function () { if (vRes)
  3323. return vRes;
  3324. else
  3325. return '\u00A0'; };
  3326. this.getCompVal = function () { if (vComp)
  3327. return vComp;
  3328. else if (vCompVal)
  3329. return vCompVal;
  3330. else
  3331. return 0; };
  3332. this.getCompStr = function () { if (vComp)
  3333. return vComp + '%';
  3334. else if (vCompVal)
  3335. return vCompVal + '%';
  3336. else
  3337. return ''; };
  3338. this.getCompRestStr = function () { if (vComp)
  3339. return (100 - vComp) + '%';
  3340. else if (vCompVal)
  3341. return (100 - vCompVal) + '%';
  3342. else
  3343. return ''; };
  3344. this.getNotes = function () { return vNotes; };
  3345. this.getSortIdx = function () { return vSortIdx; };
  3346. this.getToDelete = function () { return vToDelete; };
  3347. this.getDuration = function (pFormat, pLang) {
  3348. if (vMile) {
  3349. vDuration = '-';
  3350. }
  3351. else if (!vEnd && !vStart && vPlanStart && vPlanEnd) {
  3352. return calculateVDuration(pFormat, pLang, this.getPlanStart(), this.getPlanEnd());
  3353. }
  3354. else if (!vEnd && vDuration) {
  3355. return vDuration;
  3356. }
  3357. else {
  3358. vDuration = calculateVDuration(pFormat, pLang, this.getStart(), this.getEnd());
  3359. }
  3360. return vDuration;
  3361. };
  3362. function calculateVDuration(pFormat, pLang, start, end) {
  3363. var vDuration;
  3364. var vUnits = null;
  3365. switch (pFormat) {
  3366. case 'week':
  3367. vUnits = 'day';
  3368. break;
  3369. case 'month':
  3370. vUnits = 'week';
  3371. break;
  3372. case 'quarter':
  3373. vUnits = 'month';
  3374. break;
  3375. default:
  3376. vUnits = pFormat;
  3377. break;
  3378. }
  3379. // let vTaskEnd = new Date(this.getEnd().getTime());
  3380. // if ((vTaskEnd.getTime() - (vTaskEnd.getTimezoneOffset() * 60000)) % (86400000) == 0) {
  3381. // vTaskEnd = new Date(vTaskEnd.getFullYear(), vTaskEnd.getMonth(), vTaskEnd.getDate() + 1, vTaskEnd.getHours(), vTaskEnd.getMinutes(), vTaskEnd.getSeconds());
  3382. // }
  3383. // let tmpPer = (getOffset(this.getStart(), vTaskEnd, 999, vUnits)) / 1000;
  3384. var hours = (end.getTime() - start.getTime()) / 1000 / 60 / 60;
  3385. var tmpPer;
  3386. switch (vUnits) {
  3387. case 'hour':
  3388. tmpPer = Math.round(hours);
  3389. vDuration = tmpPer + ' ' + ((tmpPer != 1) ? pLang['hrs'] : pLang['hr']);
  3390. break;
  3391. case 'day':
  3392. tmpPer = Math.round(hours / 24);
  3393. vDuration = tmpPer + ' ' + ((tmpPer != 1) ? pLang['dys'] : pLang['dy']);
  3394. break;
  3395. case 'week':
  3396. tmpPer = Math.round(hours / 24 / 7);
  3397. vDuration = tmpPer + ' ' + ((tmpPer != 1) ? pLang['wks'] : pLang['wk']);
  3398. break;
  3399. case 'month':
  3400. tmpPer = Math.round(hours / 24 / 7 / 30);
  3401. vDuration = tmpPer + ' ' + ((tmpPer != 1) ? pLang['mths'] : pLang['mth']);
  3402. break;
  3403. case 'quarter':
  3404. tmpPer = Math.round(hours / 24 / 7 / 30 / 3);
  3405. vDuration = tmpPer + ' ' + ((tmpPer != 1) ? pLang['qtrs'] : pLang['qtr']);
  3406. break;
  3407. }
  3408. return vDuration;
  3409. }
  3410. this.getBarText = function () { return vBarText; };
  3411. this.getParent = function () { return vParent; };
  3412. this.getGroup = function () { return vGroup; };
  3413. this.getOpen = function () { return vOpen; };
  3414. this.getLevel = function () { return vLevel; };
  3415. this.getNumKids = function () { return vNumKid; };
  3416. this.getWeight = function () { return vWeight; };
  3417. this.getStartX = function () { return x1; };
  3418. this.getStartY = function () { return y1; };
  3419. this.getEndX = function () { return x2; };
  3420. this.getEndY = function () { return y2; };
  3421. this.getVisible = function () { return vVisible; };
  3422. this.getParItem = function () { return vParItem; };
  3423. this.getCellDiv = function () { return vCellDiv; };
  3424. this.getBarDiv = function () { return vBarDiv; };
  3425. this.getTaskDiv = function () { return vTaskDiv; };
  3426. this.getPlanTaskDiv = function () { return vPlanTaskDiv; };
  3427. this.getChildRow = function () { return vChildRow; };
  3428. this.getListChildRow = function () { return vListChildRow; };
  3429. this.getGroupSpan = function () { return vGroupSpan; };
  3430. this.setName = function (pName) { vName = pName; };
  3431. this.setNotes = function (pNotes) { vNotes = pNotes; };
  3432. this.setClass = function (pClass) { vClass = pClass; };
  3433. this.setCost = function (pCost) { vCost = pCost; };
  3434. this.setResource = function (pRes) { vRes = pRes; };
  3435. this.setDuration = function (pDuration) { vDuration = pDuration; };
  3436. this.setDataObject = function (pDataObject) { vDataObject = pDataObject; };
  3437. this.setStart = function (pStart) {
  3438. if (pStart instanceof Date) {
  3439. vStart = pStart;
  3440. }
  3441. else {
  3442. var temp = new Date(pStart);
  3443. if (temp instanceof Date && !isNaN(temp.valueOf())) {
  3444. vStart = temp;
  3445. }
  3446. }
  3447. };
  3448. this.setEnd = function (pEnd) {
  3449. if (pEnd instanceof Date) {
  3450. vEnd = pEnd;
  3451. }
  3452. else {
  3453. var temp = new Date(pEnd);
  3454. if (temp instanceof Date && !isNaN(temp.valueOf())) {
  3455. vEnd = temp;
  3456. }
  3457. }
  3458. };
  3459. this.setPlanStart = function (pPlanStart) {
  3460. if (pPlanStart instanceof Date)
  3461. vPlanStart = pPlanStart;
  3462. else
  3463. vPlanStart = new Date(pPlanStart);
  3464. };
  3465. this.setPlanEnd = function (pPlanEnd) {
  3466. if (pPlanEnd instanceof Date)
  3467. vPlanEnd = pPlanEnd;
  3468. else
  3469. vPlanEnd = new Date(pPlanEnd);
  3470. };
  3471. this.setGroupMinStart = function (pStart) { if (pStart instanceof Date)
  3472. vGroupMinStart = pStart; };
  3473. this.setGroupMinEnd = function (pEnd) { if (pEnd instanceof Date)
  3474. vGroupMinEnd = pEnd; };
  3475. this.setLevel = function (pLevel) { vLevel = parseInt(document.createTextNode(pLevel).data); };
  3476. this.setNumKid = function (pNumKid) { vNumKid = parseInt(document.createTextNode(pNumKid).data); };
  3477. this.setWeight = function (pWeight) { vWeight = parseInt(document.createTextNode(pWeight).data); };
  3478. this.setCompVal = function (pCompVal) { vCompVal = parseFloat(document.createTextNode(pCompVal).data); };
  3479. this.setComp = function (pComp) {
  3480. vComp = parseInt(document.createTextNode(pComp).data);
  3481. };
  3482. this.setStartX = function (pX) { x1 = parseInt(document.createTextNode(pX).data); };
  3483. this.setStartY = function (pY) { y1 = parseInt(document.createTextNode(pY).data); };
  3484. this.setEndX = function (pX) { x2 = parseInt(document.createTextNode(pX).data); };
  3485. this.setEndY = function (pY) { y2 = parseInt(document.createTextNode(pY).data); };
  3486. this.setOpen = function (pOpen) { vOpen = parseInt(document.createTextNode(pOpen).data); };
  3487. this.setVisible = function (pVisible) { vVisible = parseInt(document.createTextNode(pVisible).data); };
  3488. this.setSortIdx = function (pSortIdx) { vSortIdx = parseInt(document.createTextNode(pSortIdx).data); };
  3489. this.setToDelete = function (pToDelete) { if (pToDelete)
  3490. vToDelete = true;
  3491. else
  3492. vToDelete = false; };
  3493. this.setParItem = function (pParItem) { if (pParItem)
  3494. vParItem = pParItem; };
  3495. this.setCellDiv = function (pCellDiv) { if (typeof HTMLDivElement !== 'function' || pCellDiv instanceof HTMLDivElement)
  3496. vCellDiv = pCellDiv; }; //"typeof HTMLDivElement !== 'function'" to play nice with ie6 and 7
  3497. this.setGroup = function (pGroup) {
  3498. if (pGroup === true || pGroup === 'true') {
  3499. vGroup = 1;
  3500. }
  3501. else if (pGroup === false || pGroup === 'false') {
  3502. vGroup = 0;
  3503. }
  3504. else {
  3505. vGroup = parseInt(document.createTextNode(pGroup).data);
  3506. }
  3507. };
  3508. this.setBarText = function (pBarText) { if (pBarText)
  3509. vBarText = pBarText; };
  3510. this.setBarDiv = function (pDiv) { if (typeof HTMLDivElement !== 'function' || pDiv instanceof HTMLDivElement)
  3511. vBarDiv = pDiv; };
  3512. this.setTaskDiv = function (pDiv) { if (typeof HTMLDivElement !== 'function' || pDiv instanceof HTMLDivElement)
  3513. vTaskDiv = pDiv; };
  3514. this.setPlanTaskDiv = function (pDiv) { if (typeof HTMLDivElement !== 'function' || pDiv instanceof HTMLDivElement)
  3515. vPlanTaskDiv = pDiv; };
  3516. this.setChildRow = function (pRow) { if (typeof HTMLTableRowElement !== 'function' || pRow instanceof HTMLTableRowElement)
  3517. vChildRow = pRow; };
  3518. this.setListChildRow = function (pRow) { if (typeof HTMLTableRowElement !== 'function' || pRow instanceof HTMLTableRowElement)
  3519. vListChildRow = pRow; };
  3520. this.setGroupSpan = function (pSpan) { if (typeof HTMLSpanElement !== 'function' || pSpan instanceof HTMLSpanElement)
  3521. vGroupSpan = pSpan; };
  3522. this.getAllData = function () {
  3523. return {
  3524. pID: vID,
  3525. pName: vName,
  3526. pStart: vStart,
  3527. pEnd: vEnd,
  3528. pPlanStart: vPlanStart,
  3529. pPlanEnd: vPlanEnd,
  3530. pGroupMinStart: vGroupMinStart,
  3531. pGroupMinEnd: vGroupMinEnd,
  3532. pClass: vClass,
  3533. pLink: vLink,
  3534. pMile: vMile,
  3535. pRes: vRes,
  3536. pComp: vComp,
  3537. pCost: vCost,
  3538. pGroup: vGroup,
  3539. pDataObjec: vDataObject
  3540. };
  3541. };
  3542. };
  3543. /**
  3544. * @param pTask
  3545. * @param templateStrOrFn template string or function(task). In any case parameters in template string are substituted.
  3546. * If string - just a static template.
  3547. * If function(task): string - per task template. Can return null|undefined to fallback to default template.
  3548. * If function(task): Promise<string>) - async per task template. Tooltip will show 'Loading...' if promise is not yet complete.
  3549. * Otherwise returned template will be handled in the same manner as in other cases.
  3550. */
  3551. exports.createTaskInfo = function (pTask, templateStrOrFn) {
  3552. var _this = this;
  3553. if (templateStrOrFn === void 0) { templateStrOrFn = null; }
  3554. var vTmpDiv;
  3555. var vTaskInfoBox = document.createDocumentFragment();
  3556. var vTaskInfo = draw_utils_1.newNode(vTaskInfoBox, 'div', null, 'gTaskInfo');
  3557. var setupTemplate = function (template) {
  3558. vTaskInfo.innerHTML = "";
  3559. if (template) {
  3560. var allData_1 = pTask.getAllData();
  3561. general_utils_1.internalProperties.forEach(function (key) {
  3562. var lang;
  3563. if (general_utils_1.internalPropertiesLang[key]) {
  3564. lang = _this.vLangs[_this.vLang][general_utils_1.internalPropertiesLang[key]];
  3565. }
  3566. if (!lang) {
  3567. lang = key;
  3568. }
  3569. var val = allData_1[key];
  3570. template = template.replace("{{" + key + "}}", val);
  3571. if (lang) {
  3572. template = template.replace("{{Lang:" + key + "}}", lang);
  3573. }
  3574. else {
  3575. template = template.replace("{{Lang:" + key + "}}", key);
  3576. }
  3577. });
  3578. draw_utils_1.newNode(vTaskInfo, 'span', null, 'gTtTemplate', template);
  3579. }
  3580. else {
  3581. draw_utils_1.newNode(vTaskInfo, 'span', null, 'gTtTitle', pTask.getName());
  3582. if (_this.vShowTaskInfoStartDate == 1) {
  3583. vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTIsd');
  3584. draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['startdate'] + ': ');
  3585. draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskText', date_utils_1.formatDateStr(pTask.getStart(), _this.vDateTaskDisplayFormat, _this.vLangs[_this.vLang]));
  3586. }
  3587. if (_this.vShowTaskInfoEndDate == 1) {
  3588. vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTIed');
  3589. draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['enddate'] + ': ');
  3590. draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskText', date_utils_1.formatDateStr(pTask.getEnd(), _this.vDateTaskDisplayFormat, _this.vLangs[_this.vLang]));
  3591. }
  3592. if (_this.vShowTaskInfoDur == 1 && !pTask.getMile()) {
  3593. vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTId');
  3594. draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['duration'] + ': ');
  3595. draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskText', pTask.getDuration(_this.vFormat, _this.vLangs[_this.vLang]));
  3596. }
  3597. if (_this.vShowTaskInfoComp == 1) {
  3598. vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTIc');
  3599. draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['completion'] + ': ');
  3600. draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskText', pTask.getCompStr());
  3601. }
  3602. if (_this.vShowTaskInfoRes == 1) {
  3603. vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTIr');
  3604. draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['resource'] + ': ');
  3605. draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskText', pTask.getResource());
  3606. }
  3607. if (_this.vShowTaskInfoLink == 1 && pTask.getLink() != '') {
  3608. vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTIl');
  3609. var vTmpNode = draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel');
  3610. vTmpNode = draw_utils_1.newNode(vTmpNode, 'a', null, 'gTaskText', _this.vLangs[_this.vLang]['moreinfo']);
  3611. vTmpNode.setAttribute('href', pTask.getLink());
  3612. }
  3613. if (_this.vShowTaskInfoNotes == 1) {
  3614. vTmpDiv = draw_utils_1.newNode(vTaskInfo, 'div', null, 'gTILine gTIn');
  3615. draw_utils_1.newNode(vTmpDiv, 'span', null, 'gTaskLabel', _this.vLangs[_this.vLang]['notes'] + ': ');
  3616. if (pTask.getNotes())
  3617. vTmpDiv.appendChild(pTask.getNotes());
  3618. }
  3619. }
  3620. };
  3621. var callback;
  3622. if (typeof templateStrOrFn === 'function') {
  3623. callback = function () {
  3624. var strOrPromise = templateStrOrFn(pTask);
  3625. if (!strOrPromise || typeof strOrPromise === 'string') {
  3626. setupTemplate(strOrPromise);
  3627. }
  3628. else if (strOrPromise.then) {
  3629. setupTemplate(_this.vLangs[_this.vLang]['tooltipLoading'] || _this.vLangs['en']['tooltipLoading']);
  3630. return strOrPromise.then(setupTemplate);
  3631. }
  3632. };
  3633. }
  3634. else {
  3635. setupTemplate(templateStrOrFn);
  3636. }
  3637. return { component: vTaskInfoBox, callback: callback };
  3638. };
  3639. exports.AddTaskItem = function (value) {
  3640. var vExists = false;
  3641. for (var i = 0; i < this.vTaskList.length; i++) {
  3642. if (this.vTaskList[i].getID() == value.getID()) {
  3643. i = this.vTaskList.length;
  3644. vExists = true;
  3645. }
  3646. }
  3647. if (!vExists) {
  3648. this.vTaskList.push(value);
  3649. this.vProcessNeeded = true;
  3650. }
  3651. };
  3652. exports.AddTaskItemObject = function (object) {
  3653. if (!object.pGantt) {
  3654. object.pGantt = this;
  3655. }
  3656. return this.AddTaskItem(exports.TaskItemObject(object));
  3657. };
  3658. exports.RemoveTaskItem = function (pID) {
  3659. // simply mark the task for removal at this point - actually remove it next time we re-draw the chart
  3660. for (var i = 0; i < this.vTaskList.length; i++) {
  3661. if (this.vTaskList[i].getID() == pID)
  3662. this.vTaskList[i].setToDelete(true);
  3663. else if (this.vTaskList[i].getParent() == pID)
  3664. this.RemoveTaskItem(this.vTaskList[i].getID());
  3665. }
  3666. this.vProcessNeeded = true;
  3667. };
  3668. exports.ClearTasks = function () {
  3669. var _this = this;
  3670. this.vTaskList.map(function (task) { return _this.RemoveTaskItem(task.getID()); });
  3671. this.vProcessNeeded = true;
  3672. };
  3673. // Recursively process task tree ... set min, max dates of parent tasks and identfy task level.
  3674. exports.processRows = function (pList, pID, pRow, pLevel, pOpen, pUseSort, vDebug) {
  3675. if (vDebug === void 0) { vDebug = false; }
  3676. var vMinDate = null;
  3677. var vMaxDate = null;
  3678. var vMinPlanDate = null;
  3679. var vMaxPlanDate = null;
  3680. var vVisible = pOpen;
  3681. var vCurItem = null;
  3682. var vCompSum = 0;
  3683. var vMinSet = 0;
  3684. var vMaxSet = 0;
  3685. var vMinPlanSet = 0;
  3686. var vMaxPlanSet = 0;
  3687. var vNumKid = 0;
  3688. var vWeight = 0;
  3689. var vLevel = pLevel;
  3690. var vList = pList;
  3691. var vComb = false;
  3692. var i = 0;
  3693. for (i = 0; i < pList.length; i++) {
  3694. if (pList[i].getToDelete()) {
  3695. pList.splice(i, 1);
  3696. i--;
  3697. }
  3698. if (i >= 0 && pList[i].getID() == pID)
  3699. vCurItem = pList[i];
  3700. }
  3701. for (i = 0; i < pList.length; i++) {
  3702. if (pList[i].getParent() == pID) {
  3703. vVisible = pOpen;
  3704. pList[i].setParItem(vCurItem);
  3705. pList[i].setVisible(vVisible);
  3706. if (vVisible == 1 && pList[i].getOpen() == 0)
  3707. vVisible = 0;
  3708. if (pList[i].getMile() && pList[i].getParItem() && pList[i].getParItem().getGroup() == 2) { //remove milestones owned by combined groups
  3709. pList.splice(i, 1);
  3710. i--;
  3711. continue;
  3712. }
  3713. pList[i].setLevel(vLevel);
  3714. if (pList[i].getGroup()) {
  3715. if (pList[i].getParItem() && pList[i].getParItem().getGroup() == 2)
  3716. pList[i].setGroup(2);
  3717. exports.processRows(vList, pList[i].getID(), i, vLevel + 1, vVisible, 0);
  3718. }
  3719. if (pList[i].getStartVar() && (vMinSet == 0 || pList[i].getStartVar() < vMinDate)) {
  3720. vMinDate = pList[i].getStartVar();
  3721. vMinSet = 1;
  3722. }
  3723. if (pList[i].getEndVar() && (vMaxSet == 0 || pList[i].getEndVar() > vMaxDate)) {
  3724. vMaxDate = pList[i].getEndVar();
  3725. vMaxSet = 1;
  3726. }
  3727. if (vMinPlanSet == 0 || pList[i].getPlanStart() < vMinPlanDate) {
  3728. vMinPlanDate = pList[i].getPlanStart();
  3729. vMinPlanSet = 1;
  3730. }
  3731. if (vMaxPlanSet == 0 || pList[i].getPlanEnd() > vMaxPlanDate) {
  3732. vMaxPlanDate = pList[i].getPlanEnd();
  3733. vMaxPlanSet = 1;
  3734. }
  3735. vNumKid++;
  3736. vWeight += pList[i].getEnd() - pList[i].getStart() + 1;
  3737. vCompSum += pList[i].getCompVal() * (pList[i].getEnd() - pList[i].getStart() + 1);
  3738. pList[i].setSortIdx(i * pList.length);
  3739. }
  3740. }
  3741. if (pRow >= 0) {
  3742. if (pList[pRow].getGroupMinStart() != null && pList[pRow].getGroupMinStart() < vMinDate) {
  3743. vMinDate = pList[pRow].getGroupMinStart();
  3744. }
  3745. if (pList[pRow].getGroupMinEnd() != null && pList[pRow].getGroupMinEnd() > vMaxDate) {
  3746. vMaxDate = pList[pRow].getGroupMinEnd();
  3747. }
  3748. if (vMinDate) {
  3749. pList[pRow].setStart(vMinDate);
  3750. }
  3751. if (vMaxDate) {
  3752. pList[pRow].setEnd(vMaxDate);
  3753. }
  3754. if (pList[pRow].getGroupMinPlanStart() != null && pList[pRow].getGroupMinPlanStart() < vMinPlanDate) {
  3755. vMinPlanDate = pList[pRow].getGroupMinPlanStart();
  3756. }
  3757. if (pList[pRow].getGroupMinPlanEnd() != null && pList[pRow].getGroupMinPlanEnd() > vMaxPlanDate) {
  3758. vMaxPlanDate = pList[pRow].getGroupMinPlanEnd();
  3759. }
  3760. if (vMinPlanDate) {
  3761. pList[pRow].setPlanStart(vMinPlanDate);
  3762. }
  3763. if (vMaxPlanDate) {
  3764. pList[pRow].setPlanEnd(vMaxPlanDate);
  3765. }
  3766. pList[pRow].setNumKid(vNumKid);
  3767. pList[pRow].setWeight(vWeight);
  3768. pList[pRow].setCompVal(Math.ceil(vCompSum / vWeight));
  3769. }
  3770. if (pID == 0 && pUseSort == 1) {
  3771. var bd = void 0;
  3772. if (vDebug) {
  3773. bd = new Date();
  3774. console.info('before afterTasks', bd);
  3775. }
  3776. exports.sortTasks(pList, 0, 0);
  3777. if (vDebug) {
  3778. var ad = new Date();
  3779. console.info('after afterTasks', ad, (ad.getTime() - bd.getTime()));
  3780. }
  3781. pList.sort(function (a, b) { return a.getSortIdx() - b.getSortIdx(); });
  3782. }
  3783. if (pID == 0 && pUseSort != 1) // Need to sort combined tasks regardless
  3784. {
  3785. for (i = 0; i < pList.length; i++) {
  3786. if (pList[i].getGroup() == 2) {
  3787. vComb = true;
  3788. var bd = void 0;
  3789. if (vDebug) {
  3790. bd = new Date();
  3791. console.info('before sortTasks', bd);
  3792. }
  3793. exports.sortTasks(pList, pList[i].getID(), pList[i].getSortIdx() + 1);
  3794. if (vDebug) {
  3795. var ad = new Date();
  3796. console.info('after sortTasks', ad, (ad.getTime() - bd.getTime()));
  3797. }
  3798. }
  3799. }
  3800. if (vComb == true)
  3801. pList.sort(function (a, b) { return a.getSortIdx() - b.getSortIdx(); });
  3802. }
  3803. };
  3804. },{"./utils/date_utils":11,"./utils/draw_utils":12,"./utils/general_utils":13}],11:[function(require,module,exports){
  3805. "use strict";
  3806. Object.defineProperty(exports, "__esModule", { value: true });
  3807. /**
  3808. * DATES
  3809. */
  3810. exports.getMinDate = function (pList, pFormat, pMinDate) {
  3811. var vDate = new Date();
  3812. if (pList.length <= 0)
  3813. return pMinDate || vDate;
  3814. vDate.setTime((pMinDate && pMinDate.getTime()) || pList[0].getStart().getTime());
  3815. // Parse all Task Start dates to find min
  3816. for (var i = 0; i < pList.length; i++) {
  3817. if (pList[i].getStart().getTime() < vDate.getTime())
  3818. vDate.setTime(pList[i].getStart().getTime());
  3819. if (pList[i].getPlanStart() && pList[i].getPlanStart().getTime() < vDate.getTime())
  3820. vDate.setTime(pList[i].getPlanStart().getTime());
  3821. }
  3822. // Adjust min date to specific format boundaries (first of week or first of month)
  3823. if (pFormat == 'day') {
  3824. vDate.setDate(vDate.getDate() - 1);
  3825. while (vDate.getDay() % 7 != 1)
  3826. vDate.setDate(vDate.getDate() - 1);
  3827. }
  3828. else if (pFormat == 'week') {
  3829. vDate.setDate(vDate.getDate() - 1);
  3830. while (vDate.getDay() % 7 != 1)
  3831. vDate.setDate(vDate.getDate() - 1);
  3832. }
  3833. else if (pFormat == 'month') {
  3834. vDate.setDate(vDate.getDate() - 15);
  3835. while (vDate.getDate() > 1)
  3836. vDate.setDate(vDate.getDate() - 1);
  3837. }
  3838. else if (pFormat == 'quarter') {
  3839. vDate.setDate(vDate.getDate() - 31);
  3840. if (vDate.getMonth() == 0 || vDate.getMonth() == 1 || vDate.getMonth() == 2)
  3841. vDate.setFullYear(vDate.getFullYear(), 0, 1);
  3842. else if (vDate.getMonth() == 3 || vDate.getMonth() == 4 || vDate.getMonth() == 5)
  3843. vDate.setFullYear(vDate.getFullYear(), 3, 1);
  3844. else if (vDate.getMonth() == 6 || vDate.getMonth() == 7 || vDate.getMonth() == 8)
  3845. vDate.setFullYear(vDate.getFullYear(), 6, 1);
  3846. else if (vDate.getMonth() == 9 || vDate.getMonth() == 10 || vDate.getMonth() == 11)
  3847. vDate.setFullYear(vDate.getFullYear(), 9, 1);
  3848. }
  3849. else if (pFormat == 'hour') {
  3850. vDate.setHours(vDate.getHours() - 1);
  3851. while (vDate.getHours() % 6 != 0)
  3852. vDate.setHours(vDate.getHours() - 1);
  3853. }
  3854. if (pFormat == 'hour')
  3855. vDate.setMinutes(0, 0);
  3856. else
  3857. vDate.setHours(0, 0, 0);
  3858. return (vDate);
  3859. };
  3860. exports.getMaxDate = function (pList, pFormat, pMaxDate) {
  3861. var vDate = new Date();
  3862. if (pList.length <= 0)
  3863. return pMaxDate || vDate;
  3864. vDate.setTime((pMaxDate && pMaxDate.getTime()) || pList[0].getEnd().getTime());
  3865. // Parse all Task End dates to find max
  3866. for (var i = 0; i < pList.length; i++) {
  3867. if (pList[i].getEnd().getTime() > vDate.getTime())
  3868. vDate.setTime(pList[i].getEnd().getTime());
  3869. if (pList[i].getPlanEnd() && pList[i].getPlanEnd().getTime() > vDate.getTime())
  3870. vDate.setTime(pList[i].getPlanEnd().getTime());
  3871. }
  3872. // Adjust max date to specific format boundaries (end of week or end of month)
  3873. if (pFormat == 'day') {
  3874. vDate.setDate(vDate.getDate() + 1);
  3875. while (vDate.getDay() % 7 != 0)
  3876. vDate.setDate(vDate.getDate() + 1);
  3877. }
  3878. else if (pFormat == 'week') {
  3879. //For weeks, what is the last logical boundary?
  3880. vDate.setDate(vDate.getDate() + 1);
  3881. while (vDate.getDay() % 7 != 0)
  3882. vDate.setDate(vDate.getDate() + 1);
  3883. }
  3884. else if (pFormat == 'month') {
  3885. // Set to last day of current Month
  3886. while (vDate.getDate() > 1)
  3887. vDate.setDate(vDate.getDate() + 1);
  3888. vDate.setDate(vDate.getDate() - 1);
  3889. }
  3890. else if (pFormat == 'quarter') {
  3891. // Set to last day of current Quarter
  3892. if (vDate.getMonth() == 0 || vDate.getMonth() == 1 || vDate.getMonth() == 2)
  3893. vDate.setFullYear(vDate.getFullYear(), 2, 31);
  3894. else if (vDate.getMonth() == 3 || vDate.getMonth() == 4 || vDate.getMonth() == 5)
  3895. vDate.setFullYear(vDate.getFullYear(), 5, 30);
  3896. else if (vDate.getMonth() == 6 || vDate.getMonth() == 7 || vDate.getMonth() == 8)
  3897. vDate.setFullYear(vDate.getFullYear(), 8, 30);
  3898. else if (vDate.getMonth() == 9 || vDate.getMonth() == 10 || vDate.getMonth() == 11)
  3899. vDate.setFullYear(vDate.getFullYear(), 11, 31);
  3900. }
  3901. else if (pFormat == 'hour') {
  3902. if (vDate.getHours() == 0)
  3903. vDate.setDate(vDate.getDate() + 1);
  3904. vDate.setHours(vDate.getHours() + 1);
  3905. while (vDate.getHours() % 6 != 5)
  3906. vDate.setHours(vDate.getHours() + 1);
  3907. }
  3908. return (vDate);
  3909. };
  3910. exports.coerceDate = function (date) {
  3911. if (date instanceof Date) {
  3912. return date;
  3913. }
  3914. else {
  3915. var temp = new Date(date);
  3916. if (temp instanceof Date && !isNaN(temp.valueOf())) {
  3917. return temp;
  3918. }
  3919. }
  3920. };
  3921. exports.parseDateStr = function (pDateStr, pFormatStr) {
  3922. var vDate = new Date();
  3923. var vDateParts = pDateStr.split(/[^0-9]/);
  3924. if (pDateStr.length >= 10 && vDateParts.length >= 3) {
  3925. while (vDateParts.length < 5)
  3926. vDateParts.push(0);
  3927. switch (pFormatStr) {
  3928. case 'mm/dd/yyyy':
  3929. vDate = new Date(vDateParts[2], vDateParts[0] - 1, vDateParts[1], vDateParts[3], vDateParts[4]);
  3930. break;
  3931. case 'dd/mm/yyyy':
  3932. vDate = new Date(vDateParts[2], vDateParts[1] - 1, vDateParts[0], vDateParts[3], vDateParts[4]);
  3933. break;
  3934. case 'yyyy-mm-dd':
  3935. vDate = new Date(vDateParts[0], vDateParts[1] - 1, vDateParts[2], vDateParts[3], vDateParts[4]);
  3936. break;
  3937. case 'yyyy-mm-dd HH:MI:SS':
  3938. vDate = new Date(vDateParts[0], vDateParts[1] - 1, vDateParts[2], vDateParts[3], vDateParts[4], vDateParts[5]);
  3939. break;
  3940. }
  3941. }
  3942. return (vDate);
  3943. };
  3944. exports.formatDateStr = function (pDate, pDateFormatArr, pL) {
  3945. // Fix on issue #303 - getXMLTask is passing null as pDates
  3946. if (!pDate) {
  3947. return;
  3948. }
  3949. var vDateStr = '';
  3950. var vYear2Str = pDate.getFullYear().toString().substring(2, 4);
  3951. var vMonthStr = (pDate.getMonth() + 1) + '';
  3952. var vMonthArr = new Array(pL['january'], pL['february'], pL['march'], pL['april'], pL['maylong'], pL['june'], pL['july'], pL['august'], pL['september'], pL['october'], pL['november'], pL['december']);
  3953. var vDayArr = new Array(pL['sunday'], pL['monday'], pL['tuesday'], pL['wednesday'], pL['thursday'], pL['friday'], pL['saturday']);
  3954. var vMthArr = new Array(pL['jan'], pL['feb'], pL['mar'], pL['apr'], pL['may'], pL['jun'], pL['jul'], pL['aug'], pL['sep'], pL['oct'], pL['nov'], pL['dec']);
  3955. var vDyArr = new Array(pL['sun'], pL['mon'], pL['tue'], pL['wed'], pL['thu'], pL['fri'], pL['sat']);
  3956. for (var i = 0; i < pDateFormatArr.length; i++) {
  3957. switch (pDateFormatArr[i]) {
  3958. case 'dd':
  3959. if (pDate.getDate() < 10)
  3960. vDateStr += '0'; // now fall through
  3961. case 'd':
  3962. vDateStr += pDate.getDate();
  3963. break;
  3964. case 'day':
  3965. vDateStr += vDyArr[pDate.getDay()];
  3966. break;
  3967. case 'DAY':
  3968. vDateStr += vDayArr[pDate.getDay()];
  3969. break;
  3970. case 'mm':
  3971. if (parseInt(vMonthStr, 10) < 10)
  3972. vDateStr += '0'; // now fall through
  3973. case 'm':
  3974. vDateStr += vMonthStr;
  3975. break;
  3976. case 'mon':
  3977. vDateStr += vMthArr[pDate.getMonth()];
  3978. break;
  3979. case 'month':
  3980. vDateStr += vMonthArr[pDate.getMonth()];
  3981. break;
  3982. case 'yyyy':
  3983. vDateStr += pDate.getFullYear();
  3984. break;
  3985. case 'yy':
  3986. vDateStr += vYear2Str;
  3987. break;
  3988. case 'qq':
  3989. vDateStr += pL['qtr']; // now fall through
  3990. case 'q':
  3991. vDateStr += Math.floor(pDate.getMonth() / 3) + 1;
  3992. break;
  3993. case 'hh':
  3994. if ((((pDate.getHours() % 12) == 0) ? 12 : pDate.getHours() % 12) < 10)
  3995. vDateStr += '0'; // now fall through
  3996. case 'h':
  3997. vDateStr += ((pDate.getHours() % 12) == 0) ? 12 : pDate.getHours() % 12;
  3998. break;
  3999. case 'HH':
  4000. if ((pDate.getHours()) < 10)
  4001. vDateStr += '0'; // now fall through
  4002. case 'H':
  4003. vDateStr += (pDate.getHours());
  4004. break;
  4005. case 'MI':
  4006. if (pDate.getMinutes() < 10)
  4007. vDateStr += '0'; // now fall through
  4008. case 'mi':
  4009. vDateStr += pDate.getMinutes();
  4010. break;
  4011. case 'SS':
  4012. if (pDate.getSeconds() < 10)
  4013. vDateStr += '0'; // now fall through
  4014. case 'ss':
  4015. vDateStr += pDate.getSeconds();
  4016. break;
  4017. case 'pm':
  4018. vDateStr += ((pDate.getHours()) < 12) ? 'am' : 'pm';
  4019. break;
  4020. case 'PM':
  4021. vDateStr += ((pDate.getHours()) < 12) ? 'AM' : 'PM';
  4022. break;
  4023. case 'ww':
  4024. if (exports.getIsoWeek(pDate) < 10)
  4025. vDateStr += '0'; // now fall through
  4026. case 'w':
  4027. vDateStr += exports.getIsoWeek(pDate);
  4028. break;
  4029. case 'week':
  4030. var vWeekNum = exports.getIsoWeek(pDate);
  4031. var vYear = pDate.getFullYear();
  4032. var vDayOfWeek = (pDate.getDay() == 0) ? 7 : pDate.getDay();
  4033. if (vWeekNum >= 52 && parseInt(vMonthStr, 10) === 1)
  4034. vYear--;
  4035. if (vWeekNum == 1 && parseInt(vMonthStr, 10) === 12)
  4036. vYear++;
  4037. if (vWeekNum < 10)
  4038. vWeekNum = parseInt('0' + vWeekNum, 10);
  4039. vDateStr += vYear + '-W' + vWeekNum + '-' + vDayOfWeek;
  4040. break;
  4041. default:
  4042. if (pL[pDateFormatArr[i].toLowerCase()])
  4043. vDateStr += pL[pDateFormatArr[i].toLowerCase()];
  4044. else
  4045. vDateStr += pDateFormatArr[i];
  4046. break;
  4047. }
  4048. }
  4049. return vDateStr;
  4050. };
  4051. exports.parseDateFormatStr = function (pFormatStr) {
  4052. var vComponantStr = '';
  4053. var vCurrChar = '';
  4054. var vSeparators = new RegExp('[\/\\ -.,\'":]');
  4055. var vDateFormatArray = new Array();
  4056. for (var i = 0; i < pFormatStr.length; i++) {
  4057. vCurrChar = pFormatStr.charAt(i);
  4058. if ((vCurrChar.match(vSeparators)) || (i + 1 == pFormatStr.length)) // separator or end of string
  4059. {
  4060. if ((i + 1 == pFormatStr.length) && (!(vCurrChar.match(vSeparators)))) // at end of string add any non-separator chars to the current component
  4061. {
  4062. vComponantStr += vCurrChar;
  4063. }
  4064. vDateFormatArray.push(vComponantStr);
  4065. if (vCurrChar.match(vSeparators))
  4066. vDateFormatArray.push(vCurrChar);
  4067. vComponantStr = '';
  4068. }
  4069. else {
  4070. vComponantStr += vCurrChar;
  4071. }
  4072. }
  4073. return vDateFormatArray;
  4074. };
  4075. /**
  4076. * We have to compare against the monday of the first week of the year containing 04 jan *not* 01/01
  4077. * 60*60*24*1000=86400000
  4078. * @param pDate
  4079. */
  4080. exports.getIsoWeek = function (pDate) {
  4081. var dayMiliseconds = 86400000;
  4082. var keyDay = new Date(pDate.getFullYear(), 0, 4, 0, 0, 0);
  4083. var keyDayOfWeek = (keyDay.getDay() == 0) ? 6 : keyDay.getDay() - 1; // define monday as 0
  4084. var firstMondayYearTime = keyDay.getTime() - (keyDayOfWeek * dayMiliseconds);
  4085. var thisDate = new Date(pDate.getFullYear(), pDate.getMonth(), pDate.getDate(), 0, 0, 0); // This at 00:00:00
  4086. var thisTime = thisDate.getTime();
  4087. var daysFromFirstMonday = Math.round(((thisTime - firstMondayYearTime) / dayMiliseconds));
  4088. var lastWeek = 99;
  4089. var thisWeek = 99;
  4090. var firstMondayYear = new Date(firstMondayYearTime);
  4091. thisWeek = Math.ceil((daysFromFirstMonday + 1) / 7);
  4092. if (thisWeek <= 0)
  4093. thisWeek = exports.getIsoWeek(new Date(pDate.getFullYear() - 1, 11, 31, 0, 0, 0));
  4094. else if (thisWeek == 53 && (new Date(pDate.getFullYear(), 0, 1, 0, 0, 0)).getDay() != 4 && (new Date(pDate.getFullYear(), 11, 31, 0, 0, 0)).getDay() != 4)
  4095. thisWeek = 1;
  4096. return thisWeek;
  4097. };
  4098. },{}],12:[function(require,module,exports){
  4099. "use strict";
  4100. Object.defineProperty(exports, "__esModule", { value: true });
  4101. var events_1 = require("../events");
  4102. exports.makeInput = function (formattedValue, editable, type, value, choices) {
  4103. if (type === void 0) { type = 'text'; }
  4104. if (value === void 0) { value = null; }
  4105. if (choices === void 0) { choices = null; }
  4106. if (!value) {
  4107. value = formattedValue;
  4108. }
  4109. if (editable) {
  4110. switch (type) {
  4111. case 'date':
  4112. // Take timezone into account before converting to ISO String
  4113. value = value ? new Date(value.getTime() - (value.getTimezoneOffset() * 60000)).toISOString().split('T')[0] : '';
  4114. return "<input class=\"gantt-inputtable\" type=\"date\" value=\"" + value + "\">";
  4115. case 'resource':
  4116. if (choices) {
  4117. var found = choices.filter(function (c) { return c.id == value || c.name == value; });
  4118. if (found && found.length > 0) {
  4119. value = found[0].id;
  4120. }
  4121. else {
  4122. choices.push({ id: value, name: value });
  4123. }
  4124. return "<select>" + choices.map(function (c) { return "<option value=\"" + c.id + "\" " + (value == c.id ? 'selected' : '') + " >" + c.name + "</option>"; }).join('') + "</select>";
  4125. }
  4126. else {
  4127. return "<input class=\"gantt-inputtable\" type=\"text\" value=\"" + (value ? value : '') + "\">";
  4128. }
  4129. case 'cost':
  4130. return "<input class=\"gantt-inputtable\" type=\"number\" max=\"100\" min=\"0\" value=\"" + (value ? value : '') + "\">";
  4131. default:
  4132. return "<input class=\"gantt-inputtable\" value=\"" + (value ? value : '') + "\">";
  4133. }
  4134. }
  4135. else {
  4136. return formattedValue;
  4137. }
  4138. };
  4139. exports.newNode = function (pParent, pNodeType, pId, pClass, pText, pWidth, pLeft, pDisplay, pColspan, pAttribs) {
  4140. if (pId === void 0) { pId = null; }
  4141. if (pClass === void 0) { pClass = null; }
  4142. if (pText === void 0) { pText = null; }
  4143. if (pWidth === void 0) { pWidth = null; }
  4144. if (pLeft === void 0) { pLeft = null; }
  4145. if (pDisplay === void 0) { pDisplay = null; }
  4146. if (pColspan === void 0) { pColspan = null; }
  4147. if (pAttribs === void 0) { pAttribs = null; }
  4148. var vNewNode = pParent.appendChild(document.createElement(pNodeType));
  4149. if (pAttribs) {
  4150. for (var i = 0; i + 1 < pAttribs.length; i += 2) {
  4151. vNewNode.setAttribute(pAttribs[i], pAttribs[i + 1]);
  4152. }
  4153. }
  4154. if (pId)
  4155. vNewNode.id = pId; // I wish I could do this with setAttribute but older IEs don't play nice
  4156. if (pClass)
  4157. vNewNode.className = pClass;
  4158. if (pWidth)
  4159. vNewNode.style.width = (isNaN(pWidth * 1)) ? pWidth : pWidth + 'px';
  4160. if (pLeft)
  4161. vNewNode.style.left = (isNaN(pLeft * 1)) ? pLeft : pLeft + 'px';
  4162. if (pText) {
  4163. if (pText.indexOf && pText.indexOf('<') === -1) {
  4164. vNewNode.appendChild(document.createTextNode(pText));
  4165. }
  4166. else {
  4167. vNewNode.insertAdjacentHTML('beforeend', pText);
  4168. }
  4169. }
  4170. if (pDisplay)
  4171. vNewNode.style.display = pDisplay;
  4172. if (pColspan)
  4173. vNewNode.colSpan = pColspan;
  4174. return vNewNode;
  4175. };
  4176. exports.getArrayLocationByID = function (pId) {
  4177. var vList = this.getList();
  4178. for (var i = 0; i < vList.length; i++) {
  4179. if (vList[i].getID() == pId)
  4180. return i;
  4181. }
  4182. return -1;
  4183. };
  4184. exports.CalcTaskXY = function () {
  4185. var vID;
  4186. var vList = this.getList();
  4187. var vBarDiv;
  4188. var vTaskDiv;
  4189. var vParDiv;
  4190. var vLeft, vTop, vWidth;
  4191. var vHeight = Math.floor((this.getRowHeight() / 2));
  4192. for (var i = 0; i < vList.length; i++) {
  4193. vID = vList[i].getID();
  4194. vBarDiv = vList[i].getBarDiv();
  4195. vTaskDiv = vList[i].getTaskDiv();
  4196. if ((vList[i].getParItem() && vList[i].getParItem().getGroup() == 2)) {
  4197. vParDiv = vList[i].getParItem().getChildRow();
  4198. }
  4199. else
  4200. vParDiv = vList[i].getChildRow();
  4201. if (vBarDiv) {
  4202. vList[i].setStartX(vBarDiv.offsetLeft + 1);
  4203. vList[i].setStartY(vParDiv.offsetTop + vBarDiv.offsetTop + vHeight - 1);
  4204. vList[i].setEndX(vBarDiv.offsetLeft + vBarDiv.offsetWidth + 1);
  4205. vList[i].setEndY(vParDiv.offsetTop + vBarDiv.offsetTop + vHeight - 1);
  4206. }
  4207. }
  4208. };
  4209. exports.sLine = function (x1, y1, x2, y2, pClass) {
  4210. var vLeft = Math.min(x1, x2);
  4211. var vTop = Math.min(y1, y2);
  4212. var vWid = Math.abs(x2 - x1) + 1;
  4213. var vHgt = Math.abs(y2 - y1) + 1;
  4214. var vTmpDiv = document.createElement('div');
  4215. vTmpDiv.id = this.vDivId + 'line' + this.vDepId++;
  4216. vTmpDiv.style.position = 'absolute';
  4217. vTmpDiv.style.overflow = 'hidden';
  4218. vTmpDiv.style.zIndex = '0';
  4219. vTmpDiv.style.left = vLeft + 'px';
  4220. vTmpDiv.style.top = vTop + 'px';
  4221. vTmpDiv.style.width = vWid + 'px';
  4222. vTmpDiv.style.height = vHgt + 'px';
  4223. vTmpDiv.style.visibility = 'visible';
  4224. if (vWid == 1)
  4225. vTmpDiv.className = 'glinev';
  4226. else
  4227. vTmpDiv.className = 'glineh';
  4228. if (pClass)
  4229. vTmpDiv.className += ' ' + pClass;
  4230. this.getLines().appendChild(vTmpDiv);
  4231. if (this.vEvents.onLineDraw && typeof this.vEvents.onLineDraw === 'function') {
  4232. this.vEvents.onLineDraw(vTmpDiv);
  4233. }
  4234. return vTmpDiv;
  4235. };
  4236. exports.drawSelector = function (pPos) {
  4237. var vOutput = document.createDocumentFragment();
  4238. var vDisplay = false;
  4239. for (var i = 0; i < this.vShowSelector.length && !vDisplay; i++) {
  4240. if (this.vShowSelector[i].toLowerCase() == pPos.toLowerCase())
  4241. vDisplay = true;
  4242. }
  4243. if (vDisplay) {
  4244. var vTmpDiv = exports.newNode(vOutput, 'div', null, 'gselector', this.vLangs[this.vLang]['format'] + ':');
  4245. if (this.vFormatArr.join().toLowerCase().indexOf('hour') != -1)
  4246. events_1.addFormatListeners(this, 'hour', exports.newNode(vTmpDiv, 'span', this.vDivId + 'formathour' + pPos, 'gformlabel' + ((this.vFormat == 'hour') ? ' gselected' : ''), this.vLangs[this.vLang]['hour']));
  4247. if (this.vFormatArr.join().toLowerCase().indexOf('day') != -1)
  4248. events_1.addFormatListeners(this, 'day', exports.newNode(vTmpDiv, 'span', this.vDivId + 'formatday' + pPos, 'gformlabel' + ((this.vFormat == 'day') ? ' gselected' : ''), this.vLangs[this.vLang]['day']));
  4249. if (this.vFormatArr.join().toLowerCase().indexOf('week') != -1)
  4250. events_1.addFormatListeners(this, 'week', exports.newNode(vTmpDiv, 'span', this.vDivId + 'formatweek' + pPos, 'gformlabel' + ((this.vFormat == 'week') ? ' gselected' : ''), this.vLangs[this.vLang]['week']));
  4251. if (this.vFormatArr.join().toLowerCase().indexOf('month') != -1)
  4252. events_1.addFormatListeners(this, 'month', exports.newNode(vTmpDiv, 'span', this.vDivId + 'formatmonth' + pPos, 'gformlabel' + ((this.vFormat == 'month') ? ' gselected' : ''), this.vLangs[this.vLang]['month']));
  4253. if (this.vFormatArr.join().toLowerCase().indexOf('quarter') != -1)
  4254. events_1.addFormatListeners(this, 'quarter', exports.newNode(vTmpDiv, 'span', this.vDivId + 'formatquarter' + pPos, 'gformlabel' + ((this.vFormat == 'quarter') ? ' gselected' : ''), this.vLangs[this.vLang]['quarter']));
  4255. }
  4256. else {
  4257. exports.newNode(vOutput, 'div', null, 'gselector');
  4258. }
  4259. return vOutput;
  4260. };
  4261. },{"../events":5}],13:[function(require,module,exports){
  4262. "use strict";
  4263. Object.defineProperty(exports, "__esModule", { value: true });
  4264. exports.internalProperties = ['pID', 'pName', 'pStart', 'pEnd', 'pClass', 'pLink', 'pMile', 'pRes', 'pComp', 'pGroup', 'pParent',
  4265. 'pOpen', 'pDepend', 'pCaption', 'pNotes', 'pGantt', 'pCost', 'pPlanStart', 'pPlanEnd'];
  4266. exports.internalPropertiesLang = {
  4267. 'pID': 'id',
  4268. 'pName': 'name',
  4269. 'pStart': 'startdate',
  4270. 'pEnd': 'enddate',
  4271. 'pLink': 'link',
  4272. 'pMile': 'mile',
  4273. 'pRes': 'resource',
  4274. 'pComp': 'comp',
  4275. 'pGroup': 'group',
  4276. 'pParent': 'parent',
  4277. 'pOpen': 'open',
  4278. 'pDepend': 'depend',
  4279. 'pCaption': 'caption',
  4280. 'pNotes': 'notes',
  4281. 'pCost': 'cost',
  4282. 'pPlanStart': 'planstartdate',
  4283. 'pPlanEnd': 'planenddate'
  4284. };
  4285. exports.findObj = function (theObj, theDoc) {
  4286. if (theDoc === void 0) { theDoc = null; }
  4287. var p, i, foundObj;
  4288. if (!theDoc)
  4289. theDoc = document;
  4290. if (document.getElementById)
  4291. foundObj = document.getElementById(theObj);
  4292. return foundObj;
  4293. };
  4294. exports.changeFormat = function (pFormat, ganttObj) {
  4295. if (ganttObj)
  4296. ganttObj.setFormat(pFormat);
  4297. else
  4298. alert('Chart undefined');
  4299. };
  4300. exports.stripIds = function (pNode) {
  4301. for (var i = 0; i < pNode.childNodes.length; i++) {
  4302. if ('removeAttribute' in pNode.childNodes[i])
  4303. pNode.childNodes[i].removeAttribute('id');
  4304. if (pNode.childNodes[i].hasChildNodes())
  4305. exports.stripIds(pNode.childNodes[i]);
  4306. }
  4307. };
  4308. exports.stripUnwanted = function (pNode) {
  4309. var vAllowedTags = new Array('#text', 'p', 'br', 'ul', 'ol', 'li', 'div', 'span', 'img');
  4310. for (var i = 0; i < pNode.childNodes.length; i++) {
  4311. /* versions of IE<9 don't support indexOf on arrays so add trailing comma to the joined array and lookup value to stop substring matches */
  4312. if ((vAllowedTags.join().toLowerCase() + ',').indexOf(pNode.childNodes[i].nodeName.toLowerCase() + ',') == -1) {
  4313. pNode.replaceChild(document.createTextNode(pNode.childNodes[i].outerHTML), pNode.childNodes[i]);
  4314. }
  4315. if (pNode.childNodes[i].hasChildNodes())
  4316. exports.stripUnwanted(pNode.childNodes[i]);
  4317. }
  4318. };
  4319. exports.delayedHide = function (pGanttChartObj, pTool, pTimer) {
  4320. var vDelay = pGanttChartObj.getTooltipDelay() || 1500;
  4321. if (pTool)
  4322. pTool.delayTimeout = setTimeout(function () { exports.hideToolTip(pGanttChartObj, pTool, pTimer); }, vDelay);
  4323. };
  4324. exports.getZoomFactor = function () {
  4325. var vFactor = 1;
  4326. if (document.body.getBoundingClientRect) {
  4327. // rect is only in physical pixel size in IE before version 8
  4328. var vRect = document.body.getBoundingClientRect();
  4329. var vPhysicalW = vRect.right - vRect.left;
  4330. var vLogicalW = document.body.offsetWidth;
  4331. // the zoom level is always an integer percent value
  4332. vFactor = Math.round((vPhysicalW / vLogicalW) * 100) / 100;
  4333. }
  4334. return vFactor;
  4335. };
  4336. exports.benchMark = function (pItem) {
  4337. var vEndTime = new Date().getTime();
  4338. alert(pItem + ': Elapsed time: ' + ((vEndTime - this.vBenchTime) / 1000) + ' seconds.');
  4339. this.vBenchTime = new Date().getTime();
  4340. };
  4341. exports.getScrollPositions = function () {
  4342. var vScrollLeft = window.pageXOffset;
  4343. var vScrollTop = window.pageYOffset;
  4344. if (!('pageXOffset' in window)) // Internet Explorer before version 9
  4345. {
  4346. var vZoomFactor = exports.getZoomFactor();
  4347. vScrollLeft = Math.round(document.documentElement.scrollLeft / vZoomFactor);
  4348. vScrollTop = Math.round(document.documentElement.scrollTop / vZoomFactor);
  4349. }
  4350. return { x: vScrollLeft, y: vScrollTop };
  4351. };
  4352. var scrollbarWidth = undefined;
  4353. exports.getScrollbarWidth = function () {
  4354. if (scrollbarWidth)
  4355. return scrollbarWidth;
  4356. var outer = document.createElement('div');
  4357. outer.className = 'gscrollbar-calculation-container';
  4358. document.body.appendChild(outer);
  4359. // Creating inner element and placing it in the container
  4360. var inner = document.createElement('div');
  4361. outer.appendChild(inner);
  4362. // Calculating difference between container's full width and the child width
  4363. scrollbarWidth = (outer.offsetWidth - inner.offsetWidth);
  4364. // Removing temporary elements from the DOM
  4365. outer.parentNode.removeChild(outer);
  4366. return scrollbarWidth;
  4367. };
  4368. exports.calculateCurrentDateOffset = function (curTaskStart, curTaskEnd) {
  4369. var tmpTaskStart = Date.UTC(curTaskStart.getFullYear(), curTaskStart.getMonth(), curTaskStart.getDate(), curTaskStart.getHours(), 0, 0);
  4370. var tmpTaskEnd = Date.UTC(curTaskEnd.getFullYear(), curTaskEnd.getMonth(), curTaskEnd.getDate(), curTaskEnd.getHours(), 0, 0);
  4371. return (tmpTaskEnd - tmpTaskStart);
  4372. };
  4373. exports.getOffset = function (pStartDate, pEndDate, pColWidth, pFormat, pShowWeekends) {
  4374. var DAY_CELL_MARGIN_WIDTH = 3; // Cell margin for 'day' format
  4375. var WEEK_CELL_MARGIN_WIDTH = 3; // Cell margin for 'week' format
  4376. var MONTH_CELL_MARGIN_WIDTH = 3; // Cell margin for 'month' format
  4377. var QUARTER_CELL_MARGIN_WIDTH = 3; // Cell margin for 'quarter' format
  4378. var HOUR_CELL_MARGIN_WIDTH = 3; // Cell margin for 'hour' format
  4379. var vMonthDaysArr = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
  4380. var curTaskStart = new Date(pStartDate.getTime());
  4381. var curTaskEnd = new Date(pEndDate.getTime());
  4382. var vTaskRightPx = 0;
  4383. // Length of task in hours
  4384. var oneHour = 3600000;
  4385. var vTaskRight = exports.calculateCurrentDateOffset(curTaskStart, curTaskEnd) / oneHour;
  4386. var vPosTmpDate;
  4387. if (pFormat == 'day') {
  4388. if (!pShowWeekends) {
  4389. var start = curTaskStart;
  4390. var end = curTaskEnd;
  4391. var countWeekends = 0;
  4392. while (start < end) {
  4393. var day = start.getDay();
  4394. if (day === 6 || day == 0) {
  4395. countWeekends++;
  4396. }
  4397. start = new Date(start.getTime() + 24 * oneHour);
  4398. }
  4399. vTaskRight -= countWeekends * 24;
  4400. }
  4401. vTaskRightPx = Math.ceil((vTaskRight / 24) * (pColWidth + DAY_CELL_MARGIN_WIDTH) - 1);
  4402. }
  4403. else if (pFormat == 'week') {
  4404. vTaskRightPx = Math.ceil((vTaskRight / (24 * 7)) * (pColWidth + WEEK_CELL_MARGIN_WIDTH) - 1);
  4405. }
  4406. else if (pFormat == 'month') {
  4407. var vMonthsDiff = (12 * (curTaskEnd.getFullYear() - curTaskStart.getFullYear())) + (curTaskEnd.getMonth() - curTaskStart.getMonth());
  4408. vPosTmpDate = new Date(curTaskEnd.getTime());
  4409. vPosTmpDate.setDate(curTaskStart.getDate());
  4410. var vDaysCrctn = (curTaskEnd.getTime() - vPosTmpDate.getTime()) / (86400000);
  4411. vTaskRightPx = Math.ceil((vMonthsDiff * (pColWidth + MONTH_CELL_MARGIN_WIDTH)) + (vDaysCrctn * (pColWidth / vMonthDaysArr[curTaskEnd.getMonth()])) - 1);
  4412. }
  4413. else if (pFormat == 'quarter') {
  4414. var vMonthsDiff = (12 * (curTaskEnd.getFullYear() - curTaskStart.getFullYear())) + (curTaskEnd.getMonth() - curTaskStart.getMonth());
  4415. vPosTmpDate = new Date(curTaskEnd.getTime());
  4416. vPosTmpDate.setDate(curTaskStart.getDate());
  4417. var vDaysCrctn = (curTaskEnd.getTime() - vPosTmpDate.getTime()) / (86400000);
  4418. vTaskRightPx = Math.ceil((vMonthsDiff * ((pColWidth + QUARTER_CELL_MARGIN_WIDTH) / 3)) + (vDaysCrctn * (pColWidth / 90)) - 1);
  4419. }
  4420. else if (pFormat == 'hour') {
  4421. // can't just calculate sum because of daylight savings changes
  4422. vPosTmpDate = new Date(curTaskEnd.getTime());
  4423. vPosTmpDate.setMinutes(curTaskStart.getMinutes(), 0);
  4424. var vMinsCrctn = (curTaskEnd.getTime() - vPosTmpDate.getTime()) / (3600000);
  4425. vTaskRightPx = Math.ceil((vTaskRight * (pColWidth + HOUR_CELL_MARGIN_WIDTH)) + (vMinsCrctn * (pColWidth)));
  4426. }
  4427. return vTaskRightPx;
  4428. };
  4429. exports.isIE = function () {
  4430. if (typeof document.all != 'undefined') {
  4431. if ('pageXOffset' in window)
  4432. return false; // give IE9 and above the benefit of the doubt!
  4433. else
  4434. return true;
  4435. }
  4436. else
  4437. return false;
  4438. };
  4439. exports.hideToolTip = function (pGanttChartObj, pTool, pTimer) {
  4440. if (pGanttChartObj.getUseFade()) {
  4441. clearInterval(pTool.fadeInterval);
  4442. pTool.fadeInterval = setInterval(function () { exports.fadeToolTip(-1, pTool, 0); }, pTimer);
  4443. }
  4444. else {
  4445. pTool.style.opacity = 0;
  4446. pTool.style.filter = 'alpha(opacity=0)';
  4447. pTool.style.visibility = 'hidden';
  4448. pTool.vToolCont.setAttribute("showing", null);
  4449. }
  4450. };
  4451. exports.fadeToolTip = function (pDirection, pTool, pMaxAlpha) {
  4452. var vIncrement = parseInt(pTool.getAttribute('fadeIncrement'));
  4453. var vAlpha = pTool.getAttribute('currentOpacity');
  4454. var vCurAlpha = parseInt(vAlpha);
  4455. if ((vCurAlpha != pMaxAlpha && pDirection == 1) || (vCurAlpha != 0 && pDirection == -1)) {
  4456. var i = vIncrement;
  4457. if (pMaxAlpha - vCurAlpha < vIncrement && pDirection == 1) {
  4458. i = pMaxAlpha - vCurAlpha;
  4459. }
  4460. else if (vAlpha < vIncrement && pDirection == -1) {
  4461. i = vCurAlpha;
  4462. }
  4463. vAlpha = vCurAlpha + (i * pDirection);
  4464. pTool.style.opacity = vAlpha * 0.01;
  4465. pTool.style.filter = 'alpha(opacity=' + vAlpha + ')';
  4466. pTool.setAttribute('currentOpacity', vAlpha);
  4467. }
  4468. else {
  4469. clearInterval(pTool.fadeInterval);
  4470. if (pDirection == -1) {
  4471. pTool.style.opacity = 0;
  4472. pTool.style.filter = 'alpha(opacity=0)';
  4473. pTool.style.visibility = 'hidden';
  4474. pTool.vToolCont.setAttribute("showing", null);
  4475. }
  4476. }
  4477. };
  4478. exports.hashString = function (key) {
  4479. if (!key) {
  4480. key = 'default';
  4481. }
  4482. key += '';
  4483. var hash = 5381;
  4484. for (var i = 0; i < key.length; i++) {
  4485. if (key.charCodeAt) {
  4486. // tslint:disable-next-line:no-bitwise
  4487. hash = (hash << 5) + hash + key.charCodeAt(i);
  4488. }
  4489. // tslint:disable-next-line:no-bitwise
  4490. hash = hash & hash;
  4491. }
  4492. // tslint:disable-next-line:no-bitwise
  4493. return hash >>> 0;
  4494. };
  4495. exports.hashKey = function (key) {
  4496. return this.hashString(key);
  4497. };
  4498. exports.criticalPath = function (tasks) {
  4499. var path = {};
  4500. // calculate duration
  4501. tasks.forEach(function (task) {
  4502. task.duration = new Date(task.pEnd).getTime() - new Date(task.pStart).getTime();
  4503. });
  4504. tasks.forEach(function (task) {
  4505. if (!path[task.pID]) {
  4506. path[task.pID] = task;
  4507. }
  4508. if (!path[task.pParent]) {
  4509. path[task.pParent] = {
  4510. childrens: []
  4511. };
  4512. }
  4513. if (!path[task.pID].childrens) {
  4514. path[task.pID].childrens = [];
  4515. }
  4516. path[task.pParent].childrens.push(task);
  4517. var max = path[task.pParent].childrens[0].duration;
  4518. path[task.pParent].childrens.forEach(function (t) {
  4519. if (t.duration > max) {
  4520. max = t.duration;
  4521. }
  4522. });
  4523. path[task.pParent].duration = max;
  4524. });
  4525. var finalNodes = { 0: path[0] };
  4526. var node = path[0];
  4527. var _loop_1 = function () {
  4528. if (node.childrens.length > 0) {
  4529. var found_1 = node.childrens[0];
  4530. var max_1 = found_1.duration;
  4531. node.childrens.forEach(function (c) {
  4532. if (c.duration > max_1) {
  4533. found_1 = c;
  4534. max_1 = c.duration;
  4535. }
  4536. });
  4537. finalNodes[found_1.pID] = found_1;
  4538. node = found_1;
  4539. }
  4540. else {
  4541. node = null;
  4542. }
  4543. };
  4544. while (node) {
  4545. _loop_1();
  4546. }
  4547. };
  4548. function isParentElementOrSelf(child, parent) {
  4549. while (child) {
  4550. if (child === parent)
  4551. return true;
  4552. child = child.parentElement;
  4553. }
  4554. }
  4555. exports.isParentElementOrSelf = isParentElementOrSelf;
  4556. exports.updateFlyingObj = function (e, pGanttChartObj, pTimer) {
  4557. var vCurTopBuf = 3;
  4558. var vCurLeftBuf = 5;
  4559. var vCurBotBuf = 3;
  4560. var vCurRightBuf = 15;
  4561. var vMouseX = (e) ? e.clientX : window.event.clientX;
  4562. var vMouseY = (e) ? e.clientY : window.event.clientY;
  4563. var vViewportX = document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
  4564. var vViewportY = document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight;
  4565. var vNewX = vMouseX;
  4566. var vNewY = vMouseY;
  4567. var screenX = screen.availWidth || window.innerWidth;
  4568. var screenY = screen.availHeight || window.innerHeight;
  4569. var vOldX = parseInt(pGanttChartObj.vTool.style.left);
  4570. var vOldY = parseInt(pGanttChartObj.vTool.style.top);
  4571. if (navigator.appName.toLowerCase() == 'microsoft internet explorer') {
  4572. // the clientX and clientY properties include the left and top borders of the client area
  4573. vMouseX -= document.documentElement.clientLeft;
  4574. vMouseY -= document.documentElement.clientTop;
  4575. var vZoomFactor = exports.getZoomFactor();
  4576. if (vZoomFactor != 1) { // IE 7 at non-default zoom level
  4577. vMouseX = Math.round(vMouseX / vZoomFactor);
  4578. vMouseY = Math.round(vMouseY / vZoomFactor);
  4579. }
  4580. }
  4581. var vScrollPos = exports.getScrollPositions();
  4582. /* Code for positioned right of the mouse by default*/
  4583. /*
  4584. if (vMouseX+vCurRightBuf+pGanttChartObj.vTool.offsetWidth>vViewportX)
  4585. {
  4586. if (vMouseX-vCurLeftBuf-pGanttChartObj.vTool.offsetWidth<0) vNewX=vScrollPos.x;
  4587. else vNewX=vMouseX+vScrollPos.x-vCurLeftBuf-pGanttChartObj.vTool.offsetWidth;
  4588. }
  4589. else vNewX=vMouseX+vScrollPos.x+vCurRightBuf;
  4590. */
  4591. /* Code for positioned left of the mouse by default */
  4592. if (vMouseX - vCurLeftBuf - pGanttChartObj.vTool.offsetWidth < 0) {
  4593. if (vMouseX + vCurRightBuf + pGanttChartObj.vTool.offsetWidth > vViewportX)
  4594. vNewX = vScrollPos.x;
  4595. else
  4596. vNewX = vMouseX + vScrollPos.x + vCurRightBuf;
  4597. }
  4598. else
  4599. vNewX = vMouseX + vScrollPos.x - vCurLeftBuf - pGanttChartObj.vTool.offsetWidth;
  4600. /* Code for positioned below the mouse by default */
  4601. if (vMouseY + vCurBotBuf + pGanttChartObj.vTool.offsetHeight > vViewportY) {
  4602. if (vMouseY - vCurTopBuf - pGanttChartObj.vTool.offsetHeight < 0)
  4603. vNewY = vScrollPos.y;
  4604. else
  4605. vNewY = vMouseY + vScrollPos.y - vCurTopBuf - pGanttChartObj.vTool.offsetHeight;
  4606. }
  4607. else
  4608. vNewY = vMouseY + vScrollPos.y + vCurBotBuf;
  4609. /* Code for positioned above the mouse by default */
  4610. /*
  4611. if (vMouseY-vCurTopBuf-pGanttChartObj.vTool.offsetHeight<0)
  4612. {
  4613. if (vMouseY+vCurBotBuf+pGanttChartObj.vTool.offsetHeight>vViewportY) vNewY=vScrollPos.y;
  4614. else vNewY=vMouseY+vScrollPos.y+vCurBotBuf;
  4615. }
  4616. else vNewY=vMouseY+vScrollPos.y-vCurTopBuf-pGanttChartObj.vTool.offsetHeight;
  4617. */
  4618. var outViewport = Math.abs(vOldX - vNewX) > screenX || Math.abs(vOldY - vNewY) > screenY;
  4619. if (pGanttChartObj.getUseMove() && !outViewport) {
  4620. clearInterval(pGanttChartObj.vTool.moveInterval);
  4621. pGanttChartObj.vTool.moveInterval = setInterval(function () { exports.moveToolTip(vNewX, vNewY, pGanttChartObj.vTool, pTimer); }, pTimer);
  4622. }
  4623. else {
  4624. pGanttChartObj.vTool.style.left = vNewX + 'px';
  4625. pGanttChartObj.vTool.style.top = vNewY + 'px';
  4626. }
  4627. };
  4628. exports.moveToolTip = function (pNewX, pNewY, pTool, timer) {
  4629. var vSpeed = parseInt(pTool.getAttribute('moveSpeed'));
  4630. var vOldX = parseInt(pTool.style.left);
  4631. var vOldY = parseInt(pTool.style.top);
  4632. if (pTool.style.visibility != 'visible') {
  4633. pTool.style.left = pNewX + 'px';
  4634. pTool.style.top = pNewY + 'px';
  4635. clearInterval(pTool.moveInterval);
  4636. }
  4637. else {
  4638. if (pNewX != vOldX && pNewY != vOldY) {
  4639. vOldX += Math.ceil((pNewX - vOldX) / vSpeed);
  4640. vOldY += Math.ceil((pNewY - vOldY) / vSpeed);
  4641. pTool.style.left = vOldX + 'px';
  4642. pTool.style.top = vOldY + 'px';
  4643. }
  4644. else {
  4645. clearInterval(pTool.moveInterval);
  4646. }
  4647. }
  4648. };
  4649. exports.makeRequest = function (pFile, json, vDebug) {
  4650. if (json === void 0) { json = true; }
  4651. if (vDebug === void 0) { vDebug = false; }
  4652. if (window.fetch) {
  4653. var f = fetch(pFile);
  4654. if (json) {
  4655. return f.then(function (res) { return res.json(); });
  4656. }
  4657. else {
  4658. return f;
  4659. }
  4660. }
  4661. else {
  4662. return exports.makeRequestOldBrowsers(pFile, vDebug)
  4663. .then(function (xhttp) {
  4664. if (json) {
  4665. var jsonObj = JSON.parse(xhttp.response);
  4666. return jsonObj;
  4667. }
  4668. else {
  4669. var xmlDoc = xhttp.responseXML;
  4670. return xmlDoc;
  4671. }
  4672. });
  4673. }
  4674. };
  4675. exports.makeRequestOldBrowsers = function (pFile, vDebug) {
  4676. if (vDebug === void 0) { vDebug = false; }
  4677. return new Promise(function (resolve, reject) {
  4678. var bd;
  4679. if (vDebug) {
  4680. bd = new Date();
  4681. console.info('before jsonparse', bd);
  4682. }
  4683. var xhttp;
  4684. if (window.XMLHttpRequest) {
  4685. xhttp = new XMLHttpRequest();
  4686. }
  4687. else { // IE 5/6
  4688. xhttp = new window.ActiveXObject('Microsoft.XMLHTTP');
  4689. }
  4690. xhttp.open('GET', pFile, true);
  4691. xhttp.send(null);
  4692. xhttp.onload = function (e) {
  4693. if (xhttp.readyState === 4) {
  4694. if (xhttp.status === 200) {
  4695. // resolve(xhttp.responseText);
  4696. }
  4697. else {
  4698. console.error(xhttp.statusText);
  4699. }
  4700. if (vDebug) {
  4701. bd = new Date();
  4702. console.info('before jsonparse', bd);
  4703. }
  4704. resolve(xhttp);
  4705. }
  4706. };
  4707. xhttp.onerror = function (e) {
  4708. reject(xhttp.statusText);
  4709. };
  4710. });
  4711. };
  4712. exports.calculateStartEndFromDepend = function (tasksList) {
  4713. };
  4714. },{}],14:[function(require,module,exports){
  4715. "use strict";
  4716. Object.defineProperty(exports, "__esModule", { value: true });
  4717. var task_1 = require("./task");
  4718. var date_utils_1 = require("./utils/date_utils");
  4719. var draw_utils_1 = require("./utils/draw_utils");
  4720. var general_utils_1 = require("./utils/general_utils");
  4721. exports.parseXML = function (pFile, pGanttVar) {
  4722. return general_utils_1.makeRequest(pFile, false, false)
  4723. .then(function (xmlDoc) {
  4724. exports.AddXMLTask(pGanttVar, xmlDoc);
  4725. });
  4726. };
  4727. exports.parseXMLString = function (pStr, pGanttVar) {
  4728. var xmlDoc;
  4729. if (typeof window.DOMParser != 'undefined') {
  4730. xmlDoc = (new window.DOMParser()).parseFromString(pStr, 'text/xml');
  4731. }
  4732. else if (typeof window.ActiveXObject != 'undefined' &&
  4733. new window.ActiveXObject('Microsoft.XMLDOM')) {
  4734. xmlDoc = new window.ActiveXObject('Microsoft.XMLDOM');
  4735. xmlDoc.async = 'false';
  4736. xmlDoc.loadXML(pStr);
  4737. }
  4738. exports.AddXMLTask(pGanttVar, xmlDoc);
  4739. };
  4740. exports.findXMLNode = function (pRoot, pNodeName) {
  4741. var vRetValue;
  4742. try {
  4743. vRetValue = pRoot.getElementsByTagName(pNodeName);
  4744. }
  4745. catch (error) {
  4746. ;
  4747. } // do nothing, we'll return undefined
  4748. return vRetValue;
  4749. };
  4750. // pType can be 1=numeric, 2=String, all other values just return raw data
  4751. exports.getXMLNodeValue = function (pRoot, pNodeName, pType, pDefault) {
  4752. var vRetValue;
  4753. try {
  4754. vRetValue = pRoot.getElementsByTagName(pNodeName)[0].childNodes[0].nodeValue;
  4755. }
  4756. catch (error) {
  4757. if (typeof pDefault != 'undefined')
  4758. vRetValue = pDefault;
  4759. }
  4760. if (typeof vRetValue != 'undefined' && vRetValue != null) {
  4761. if (pType == 1)
  4762. vRetValue *= 1;
  4763. else if (pType == 2)
  4764. vRetValue = vRetValue.toString();
  4765. }
  4766. return vRetValue;
  4767. };
  4768. exports.AddXMLTask = function (pGanttVar, pXmlDoc) {
  4769. var project = '';
  4770. var Task;
  4771. var n = 0;
  4772. var m = 0;
  4773. var i = 0;
  4774. var j = 0;
  4775. var k = 0;
  4776. var maxPID = 0;
  4777. var ass = new Array();
  4778. var assRes = new Array();
  4779. var res = new Array();
  4780. var pars = new Array();
  4781. var projNode = exports.findXMLNode(pXmlDoc, 'Project');
  4782. if (typeof projNode != 'undefined' && projNode.length > 0) {
  4783. project = projNode[0].getAttribute('xmlns');
  4784. }
  4785. if (project == 'http://schemas.microsoft.com/project') {
  4786. pGanttVar.setDateInputFormat('yyyy-mm-dd');
  4787. Task = exports.findXMLNode(pXmlDoc, 'Task');
  4788. if (typeof Task == 'undefined')
  4789. n = 0;
  4790. else
  4791. n = Task.length;
  4792. var resources = exports.findXMLNode(pXmlDoc, 'Resource');
  4793. if (typeof resources == 'undefined') {
  4794. n = 0;
  4795. m = 0;
  4796. }
  4797. else
  4798. m = resources.length;
  4799. for (i = 0; i < m; i++) {
  4800. var resname = exports.getXMLNodeValue(resources[i], 'Name', 2, '');
  4801. var uid = exports.getXMLNodeValue(resources[i], 'UID', 1, -1);
  4802. if (resname.length > 0 && uid > 0)
  4803. res[uid] = resname;
  4804. }
  4805. var assignments = exports.findXMLNode(pXmlDoc, 'Assignment');
  4806. if (typeof assignments == 'undefined')
  4807. j = 0;
  4808. else
  4809. j = assignments.length;
  4810. for (i = 0; i < j; i++) {
  4811. var uid = void 0;
  4812. var resUID = exports.getXMLNodeValue(assignments[i], 'ResourceUID', 1, -1);
  4813. uid = exports.getXMLNodeValue(assignments[i], 'TaskUID', 1, -1);
  4814. if (uid > 0) {
  4815. if (resUID > 0)
  4816. assRes[uid] = res[resUID];
  4817. ass[uid] = assignments[i];
  4818. }
  4819. }
  4820. // Store information about parent UIDs in an easily searchable form
  4821. for (i = 0; i < n; i++) {
  4822. var uid = void 0;
  4823. uid = exports.getXMLNodeValue(Task[i], 'UID', 1, 0);
  4824. var vOutlineNumber = void 0;
  4825. if (uid != 0)
  4826. vOutlineNumber = exports.getXMLNodeValue(Task[i], 'OutlineNumber', 2, '0');
  4827. if (uid > 0)
  4828. pars[vOutlineNumber] = uid;
  4829. if (uid > maxPID)
  4830. maxPID = uid;
  4831. }
  4832. for (i = 0; i < n; i++) {
  4833. // optional parameters may not have an entry
  4834. // Task ID must NOT be zero otherwise it will be skipped
  4835. var pID = exports.getXMLNodeValue(Task[i], 'UID', 1, 0);
  4836. if (pID != 0) {
  4837. var pName = exports.getXMLNodeValue(Task[i], 'Name', 2, 'No Task Name');
  4838. var pStart = exports.getXMLNodeValue(Task[i], 'Start', 2, '');
  4839. var pEnd = exports.getXMLNodeValue(Task[i], 'Finish', 2, '');
  4840. var pPlanStart = exports.getXMLNodeValue(Task[i], 'PlanStart', 2, '');
  4841. var pPlanEnd = exports.getXMLNodeValue(Task[i], 'PlanFinish', 2, '');
  4842. var pDuration = exports.getXMLNodeValue(Task[i], 'Duration', 2, '');
  4843. var pLink = exports.getXMLNodeValue(Task[i], 'HyperlinkAddress', 2, '');
  4844. var pMile = exports.getXMLNodeValue(Task[i], 'Milestone', 1, 0);
  4845. var pComp = exports.getXMLNodeValue(Task[i], 'PercentWorkComplete', 1, 0);
  4846. var pCost = exports.getXMLNodeValue(Task[i], 'Cost', 2, 0);
  4847. var pGroup = exports.getXMLNodeValue(Task[i], 'Summary', 1, 0);
  4848. var pParent = 0;
  4849. var vOutlineLevel = exports.getXMLNodeValue(Task[i], 'OutlineLevel', 1, 0);
  4850. var vOutlineNumber = void 0;
  4851. if (vOutlineLevel > 1) {
  4852. vOutlineNumber = exports.getXMLNodeValue(Task[i], 'OutlineNumber', 2, '0');
  4853. pParent = pars[vOutlineNumber.substr(0, vOutlineNumber.lastIndexOf('.'))];
  4854. }
  4855. var pNotes = void 0;
  4856. try {
  4857. pNotes = Task[i].getElementsByTagName('Notes')[0].childNodes[1].nodeValue; //this should be a CDATA node
  4858. }
  4859. catch (error) {
  4860. pNotes = '';
  4861. }
  4862. var pRes = void 0;
  4863. if (typeof assRes[pID] != 'undefined')
  4864. pRes = assRes[pID];
  4865. else
  4866. pRes = '';
  4867. var predecessors = exports.findXMLNode(Task[i], 'PredecessorLink');
  4868. if (typeof predecessors == 'undefined')
  4869. j = 0;
  4870. else
  4871. j = predecessors.length;
  4872. var pDepend = '';
  4873. for (k = 0; k < j; k++) {
  4874. var depUID = exports.getXMLNodeValue(predecessors[k], 'PredecessorUID', 1, -1);
  4875. var depType = exports.getXMLNodeValue(predecessors[k], 'Type', 1, 1);
  4876. if (depUID > 0) {
  4877. if (pDepend.length > 0)
  4878. pDepend += ',';
  4879. switch (depType) {
  4880. case 0:
  4881. pDepend += depUID + 'FF';
  4882. break;
  4883. case 1:
  4884. pDepend += depUID + 'FS';
  4885. break;
  4886. case 2:
  4887. pDepend += depUID + 'SF';
  4888. break;
  4889. case 3:
  4890. pDepend += depUID + 'SS';
  4891. break;
  4892. default:
  4893. pDepend += depUID + 'FS';
  4894. break;
  4895. }
  4896. }
  4897. }
  4898. var pOpen = 1;
  4899. var pCaption = '';
  4900. var pClass = void 0;
  4901. if (pGroup > 0)
  4902. pClass = 'ggroupblack';
  4903. else if (pMile > 0)
  4904. pClass = 'gmilestone';
  4905. else
  4906. pClass = 'gtaskblue';
  4907. // check for split tasks
  4908. var splits = exports.findXMLNode(ass[pID], 'TimephasedData');
  4909. if (typeof splits == 'undefined')
  4910. j = 0;
  4911. else
  4912. j = splits.length;
  4913. var vSplitStart = pStart;
  4914. var vSplitEnd = pEnd;
  4915. var vSubCreated = false;
  4916. var vDepend = pDepend.replace(/,*[0-9]+[FS]F/g, '');
  4917. for (k = 0; k < j; k++) {
  4918. var vDuration = exports.getXMLNodeValue(splits[k], 'Value', 2, '0');
  4919. //remove all text
  4920. vDuration = '0' + vDuration.replace(/\D/g, '');
  4921. vDuration *= 1;
  4922. if ((vDuration == 0 && !vSubCreated) || (k + 1 == j && pGroup == 2)) {
  4923. // No time booked in the given period (or last entry)
  4924. // Make sure the parent task is set as a combined group
  4925. pGroup = 2;
  4926. // Handle last loop
  4927. if (k + 1 == j)
  4928. vDepend = pDepend.replace(/,*[0-9]+[FS]S/g, '');
  4929. // Now create a subtask
  4930. maxPID++;
  4931. vSplitEnd = exports.getXMLNodeValue(splits[k], (k + 1 == j) ? 'Finish' : 'Start', 2, '');
  4932. pGanttVar.AddTaskItem(new task_1.TaskItem(maxPID, pName, vSplitStart, vSplitEnd, 'gtaskblue', pLink, pMile, pRes, pComp, 0, pID, pOpen, vDepend, pCaption, pNotes, pGanttVar, pCost, pPlanStart, pPlanEnd, pDuration));
  4933. vSubCreated = true;
  4934. vDepend = '';
  4935. }
  4936. else if (vDuration != 0 && vSubCreated) {
  4937. vSplitStart = exports.getXMLNodeValue(splits[k], 'Start', 2, '');
  4938. vSubCreated = false;
  4939. }
  4940. }
  4941. if (vSubCreated)
  4942. pDepend = '';
  4943. // Finally add the task
  4944. pGanttVar.AddTaskItem(new task_1.TaskItem(pID, pName, pStart, pEnd, pClass, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGanttVar, pCost, pPlanStart, pPlanEnd, pDuration));
  4945. }
  4946. }
  4947. }
  4948. else {
  4949. Task = pXmlDoc.getElementsByTagName('task');
  4950. n = Task.length;
  4951. for (i = 0; i < n; i++) {
  4952. // optional parameters may not have an entry
  4953. // Task ID must NOT be zero otherwise it will be skipped
  4954. var pID = exports.getXMLNodeValue(Task[i], 'pID', 1, 0);
  4955. if (pID != 0) {
  4956. var pName = exports.getXMLNodeValue(Task[i], 'pName', 2, 'No Task Name');
  4957. var pStart = exports.getXMLNodeValue(Task[i], 'pStart', 2, '');
  4958. var pEnd = exports.getXMLNodeValue(Task[i], 'pEnd', 2, '');
  4959. var pPlanStart = exports.getXMLNodeValue(Task[i], 'pPlanStart', 2, '');
  4960. var pPlanEnd = exports.getXMLNodeValue(Task[i], 'pPlanEnd', 2, '');
  4961. var pDuration = exports.getXMLNodeValue(Task[i], 'pDuration', 2, '');
  4962. var pLink = exports.getXMLNodeValue(Task[i], 'pLink', 2, '');
  4963. var pMile = exports.getXMLNodeValue(Task[i], 'pMile', 1, 0);
  4964. var pComp = exports.getXMLNodeValue(Task[i], 'pComp', 1, 0);
  4965. var pCost = exports.getXMLNodeValue(Task[i], 'pCost', 2, 0);
  4966. var pGroup = exports.getXMLNodeValue(Task[i], 'pGroup', 1, 0);
  4967. var pParent = exports.getXMLNodeValue(Task[i], 'pParent', 1, 0);
  4968. var pRes = exports.getXMLNodeValue(Task[i], 'pRes', 2, '');
  4969. var pOpen = exports.getXMLNodeValue(Task[i], 'pOpen', 1, 1);
  4970. var pDepend = exports.getXMLNodeValue(Task[i], 'pDepend', 2, '');
  4971. var pCaption = exports.getXMLNodeValue(Task[i], 'pCaption', 2, '');
  4972. var pNotes = exports.getXMLNodeValue(Task[i], 'pNotes', 2, '');
  4973. var pClass = exports.getXMLNodeValue(Task[i], 'pClass', 2, '');
  4974. if (typeof pClass == 'undefined') {
  4975. if (pGroup > 0)
  4976. pClass = 'ggroupblack';
  4977. else if (pMile > 0)
  4978. pClass = 'gmilestone';
  4979. else
  4980. pClass = 'gtaskblue';
  4981. }
  4982. // Finally add the task
  4983. pGanttVar.AddTaskItem(new task_1.TaskItem(pID, pName, pStart, pEnd, pClass, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend, pCaption, pNotes, pGanttVar, pCost, pPlanStart, pPlanEnd, pDuration));
  4984. }
  4985. }
  4986. }
  4987. };
  4988. exports.getXMLProject = function () {
  4989. var vProject = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
  4990. for (var i = 0; i < this.vTaskList.length; i++) {
  4991. vProject += this.getXMLTask(i, true);
  4992. }
  4993. vProject += '</project>';
  4994. return vProject;
  4995. };
  4996. exports.getXMLTask = function (pID, pIdx) {
  4997. var i = 0;
  4998. var vIdx = -1;
  4999. var vTask = '';
  5000. var vOutFrmt = date_utils_1.parseDateFormatStr(this.getDateInputFormat() + ' HH:MI:SS');
  5001. if (pIdx === true)
  5002. vIdx = pID;
  5003. else {
  5004. for (i = 0; i < this.vTaskList.length; i++) {
  5005. if (this.vTaskList[i].getID() == pID) {
  5006. vIdx = i;
  5007. break;
  5008. }
  5009. }
  5010. }
  5011. if (vIdx >= 0 && vIdx < this.vTaskList.length) {
  5012. /* Simplest way to return case sensitive node names is to just build a string */
  5013. vTask = '<task>';
  5014. vTask += '<pID>' + this.vTaskList[vIdx].getID() + '</pID>';
  5015. vTask += '<pName>' + this.vTaskList[vIdx].getName() + '</pName>';
  5016. vTask += '<pStart>' + date_utils_1.formatDateStr(this.vTaskList[vIdx].getStart(), vOutFrmt, this.vLangs[this.vLang]) + '</pStart>';
  5017. vTask += '<pEnd>' + date_utils_1.formatDateStr(this.vTaskList[vIdx].getEnd(), vOutFrmt, this.vLangs[this.vLang]) + '</pEnd>';
  5018. vTask += '<pPlanStart>' + date_utils_1.formatDateStr(this.vTaskList[vIdx].getPlanStart(), vOutFrmt, this.vLangs[this.vLang]) + '</pPlanStart>';
  5019. vTask += '<pPlanEnd>' + date_utils_1.formatDateStr(this.vTaskList[vIdx].getPlanEnd(), vOutFrmt, this.vLangs[this.vLang]) + '</pPlanEnd>';
  5020. vTask += '<pDuration>' + this.vTaskList[vIdx].getDuration() + '</pDuration>';
  5021. vTask += '<pClass>' + this.vTaskList[vIdx].getClass() + '</pClass>';
  5022. vTask += '<pLink>' + this.vTaskList[vIdx].getLink() + '</pLink>';
  5023. vTask += '<pMile>' + this.vTaskList[vIdx].getMile() + '</pMile>';
  5024. if (this.vTaskList[vIdx].getResource() != '\u00A0')
  5025. vTask += '<pRes>' + this.vTaskList[vIdx].getResource() + '</pRes>';
  5026. vTask += '<pComp>' + this.vTaskList[vIdx].getCompVal() + '</pComp>';
  5027. vTask += '<pCost>' + this.vTaskList[vIdx].getCost() + '</pCost>';
  5028. vTask += '<pGroup>' + this.vTaskList[vIdx].getGroup() + '</pGroup>';
  5029. vTask += '<pParent>' + this.vTaskList[vIdx].getParent() + '</pParent>';
  5030. vTask += '<pOpen>' + this.vTaskList[vIdx].getOpen() + '</pOpen>';
  5031. vTask += '<pDepend>';
  5032. var vDepList = this.vTaskList[vIdx].getDepend();
  5033. for (i = 0; i < vDepList.length; i++) {
  5034. if (i > 0)
  5035. vTask += ',';
  5036. if (vDepList[i] > 0)
  5037. vTask += vDepList[i] + this.vTaskList[vIdx].getDepType()[i];
  5038. }
  5039. vTask += '</pDepend>';
  5040. vTask += '<pCaption>' + this.vTaskList[vIdx].getCaption() + '</pCaption>';
  5041. var vTmpFrag = document.createDocumentFragment();
  5042. var vTmpDiv = draw_utils_1.newNode(vTmpFrag, 'div', null, null, this.vTaskList[vIdx].getNotes().innerHTML);
  5043. vTask += '<pNotes>' + vTmpDiv.innerHTML + '</pNotes>';
  5044. vTask += '</task>';
  5045. }
  5046. return vTask;
  5047. };
  5048. },{"./task":10,"./utils/date_utils":11,"./utils/draw_utils":12,"./utils/general_utils":13}]},{},[1])(1)
  5049. });