| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630 |
- import { Injectable, EventEmitter, Component, Renderer2, ElementRef, Directive, ViewContainerRef, Input, Output, forwardRef, Host, ChangeDetectorRef, ChangeDetectionStrategy, NgModule, ViewChild } from '@angular/core';
- import { __values, __spread, __extends } from 'tslib';
- import { filter, map, take } from 'rxjs/operators';
- import { getMonth, getFullYear, isFirstDayOfWeek, getDay, shiftDate, isBefore, endOf, isAfter, startOf, isSame, getFirstDayOfMonth, formatDate, getLocale, isSameMonth, isSameDay, isDisabledDay, isSameYear, setFullDate, isDateValid, isArray, isDate, parseDate, utcAsLocal } from 'ngx-bootstrap/chronos';
- import { BehaviorSubject } from 'rxjs';
- import { MiniState, MiniStore } from 'ngx-bootstrap/mini-ngrx';
- import { PositioningService } from 'ngx-bootstrap/positioning';
- import { trigger, state, style, transition, animate } from '@angular/animations';
- import { ComponentLoaderFactory } from 'ngx-bootstrap/component-loader';
- import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormsModule } from '@angular/forms';
- import { CommonModule } from '@angular/common';
- import { isBs3 } from 'ngx-bootstrap/utils';
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * For date range picker there are `BsDaterangepickerConfig` which inherits all properties,
- * except `displayMonths`, for range picker it default to `2`
- */
- var BsDatepickerConfig = /** @class */ (function () {
- function BsDatepickerConfig() {
- /**
- * sets use adaptive position
- */
- this.adaptivePosition = false;
- /**
- * sets use UTC date time format
- */
- this.useUtc = false;
- /**
- * turn on/off animation
- */
- this.isAnimated = false;
- /**
- * CSS class which will be applied to datepicker container,
- * usually used to set color theme
- */
- this.containerClass = 'theme-green';
- // DatepickerRenderOptions
- this.displayMonths = 1;
- /**
- * Allows to hide week numbers in datepicker
- */
- this.showWeekNumbers = true;
- this.dateInputFormat = 'L';
- // range picker
- this.rangeSeparator = ' - ';
- /**
- * Date format for date range input field
- */
- this.rangeInputFormat = 'L';
- // DatepickerFormatOptions
- this.monthTitle = 'MMMM';
- this.yearTitle = 'YYYY';
- this.dayLabel = 'D';
- this.monthLabel = 'MMMM';
- this.yearLabel = 'YYYY';
- this.weekNumbers = 'w';
- }
- BsDatepickerConfig.decorators = [
- { type: Injectable }
- ];
- return BsDatepickerConfig;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @abstract
- */
- var /**
- * @abstract
- */
- BsDatepickerAbstractComponent = /** @class */ (function () {
- function BsDatepickerAbstractComponent() {
- this._customRangesFish = [];
- }
- Object.defineProperty(BsDatepickerAbstractComponent.prototype, "minDate", {
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._effects.setMinDate(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(BsDatepickerAbstractComponent.prototype, "maxDate", {
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._effects.setMaxDate(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(BsDatepickerAbstractComponent.prototype, "daysDisabled", {
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._effects.setDaysDisabled(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(BsDatepickerAbstractComponent.prototype, "datesDisabled", {
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._effects.setDatesDisabled(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(BsDatepickerAbstractComponent.prototype, "isDisabled", {
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._effects.setDisabled(value);
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(BsDatepickerAbstractComponent.prototype, "dateCustomClasses", {
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._effects.setDateCustomClasses(value);
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} event
- * @return {?}
- */
- BsDatepickerAbstractComponent.prototype.setViewMode = /**
- * @param {?} event
- * @return {?}
- */
- function (event) { };
- /**
- * @param {?} event
- * @return {?}
- */
- BsDatepickerAbstractComponent.prototype.navigateTo = /**
- * @param {?} event
- * @return {?}
- */
- function (event) { };
- /**
- * @param {?} event
- * @return {?}
- */
- BsDatepickerAbstractComponent.prototype.dayHoverHandler = /**
- * @param {?} event
- * @return {?}
- */
- function (event) { };
- /**
- * @param {?} event
- * @return {?}
- */
- BsDatepickerAbstractComponent.prototype.weekHoverHandler = /**
- * @param {?} event
- * @return {?}
- */
- function (event) { };
- /**
- * @param {?} event
- * @return {?}
- */
- BsDatepickerAbstractComponent.prototype.monthHoverHandler = /**
- * @param {?} event
- * @return {?}
- */
- function (event) { };
- /**
- * @param {?} event
- * @return {?}
- */
- BsDatepickerAbstractComponent.prototype.yearHoverHandler = /**
- * @param {?} event
- * @return {?}
- */
- function (event) { };
- /**
- * @param {?} day
- * @return {?}
- */
- BsDatepickerAbstractComponent.prototype.daySelectHandler = /**
- * @param {?} day
- * @return {?}
- */
- function (day) { };
- /**
- * @param {?} event
- * @return {?}
- */
- BsDatepickerAbstractComponent.prototype.monthSelectHandler = /**
- * @param {?} event
- * @return {?}
- */
- function (event) { };
- /**
- * @param {?} event
- * @return {?}
- */
- BsDatepickerAbstractComponent.prototype.yearSelectHandler = /**
- * @param {?} event
- * @return {?}
- */
- function (event) { };
- /* tslint:disable-next-line: no-any */
- /* tslint:disable-next-line: no-any */
- /**
- * @param {?} event
- * @return {?}
- */
- BsDatepickerAbstractComponent.prototype._stopPropagation = /* tslint:disable-next-line: no-any */
- /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- event.stopPropagation();
- };
- return BsDatepickerAbstractComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDatepickerActions = /** @class */ (function () {
- function BsDatepickerActions() {
- }
- /**
- * @return {?}
- */
- BsDatepickerActions.prototype.calculate = /**
- * @return {?}
- */
- function () {
- return { type: BsDatepickerActions.CALCULATE };
- };
- /**
- * @return {?}
- */
- BsDatepickerActions.prototype.format = /**
- * @return {?}
- */
- function () {
- return { type: BsDatepickerActions.FORMAT };
- };
- /**
- * @return {?}
- */
- BsDatepickerActions.prototype.flag = /**
- * @return {?}
- */
- function () {
- return { type: BsDatepickerActions.FLAG };
- };
- /**
- * @param {?} date
- * @return {?}
- */
- BsDatepickerActions.prototype.select = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return {
- type: BsDatepickerActions.SELECT,
- payload: date
- };
- };
- /**
- * @param {?} event
- * @return {?}
- */
- BsDatepickerActions.prototype.changeViewMode = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- return {
- type: BsDatepickerActions.CHANGE_VIEWMODE,
- payload: event
- };
- };
- /**
- * @param {?} event
- * @return {?}
- */
- BsDatepickerActions.prototype.navigateTo = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- return {
- type: BsDatepickerActions.NAVIGATE_TO,
- payload: event
- };
- };
- /**
- * @param {?} step
- * @return {?}
- */
- BsDatepickerActions.prototype.navigateStep = /**
- * @param {?} step
- * @return {?}
- */
- function (step) {
- return {
- type: BsDatepickerActions.NAVIGATE_OFFSET,
- payload: step
- };
- };
- /**
- * @param {?} options
- * @return {?}
- */
- BsDatepickerActions.prototype.setOptions = /**
- * @param {?} options
- * @return {?}
- */
- function (options) {
- return {
- type: BsDatepickerActions.SET_OPTIONS,
- payload: options
- };
- };
- // date range picker
- // date range picker
- /**
- * @param {?} value
- * @return {?}
- */
- BsDatepickerActions.prototype.selectRange =
- // date range picker
- /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- return {
- type: BsDatepickerActions.SELECT_RANGE,
- payload: value
- };
- };
- /**
- * @param {?} event
- * @return {?}
- */
- BsDatepickerActions.prototype.hoverDay = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- return {
- type: BsDatepickerActions.HOVER,
- payload: event.isHovered ? event.cell.date : null
- };
- };
- /**
- * @param {?} date
- * @return {?}
- */
- BsDatepickerActions.prototype.minDate = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return {
- type: BsDatepickerActions.SET_MIN_DATE,
- payload: date
- };
- };
- /**
- * @param {?} date
- * @return {?}
- */
- BsDatepickerActions.prototype.maxDate = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- return {
- type: BsDatepickerActions.SET_MAX_DATE,
- payload: date
- };
- };
- /**
- * @param {?} days
- * @return {?}
- */
- BsDatepickerActions.prototype.daysDisabled = /**
- * @param {?} days
- * @return {?}
- */
- function (days) {
- return {
- type: BsDatepickerActions.SET_DAYSDISABLED,
- payload: days
- };
- };
- /**
- * @param {?} dates
- * @return {?}
- */
- BsDatepickerActions.prototype.datesDisabled = /**
- * @param {?} dates
- * @return {?}
- */
- function (dates) {
- return {
- type: BsDatepickerActions.SET_DATESDISABLED,
- payload: dates
- };
- };
- /**
- * @param {?} value
- * @return {?}
- */
- BsDatepickerActions.prototype.isDisabled = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- return {
- type: BsDatepickerActions.SET_IS_DISABLED,
- payload: value
- };
- };
- /**
- * @param {?} value
- * @return {?}
- */
- BsDatepickerActions.prototype.setDateCustomClasses = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- return {
- type: BsDatepickerActions.SET_DATE_CUSTOM_CLASSES,
- payload: value
- };
- };
- /**
- * @param {?} locale
- * @return {?}
- */
- BsDatepickerActions.prototype.setLocale = /**
- * @param {?} locale
- * @return {?}
- */
- function (locale) {
- return {
- type: BsDatepickerActions.SET_LOCALE,
- payload: locale
- };
- };
- BsDatepickerActions.CALCULATE = '[datepicker] calculate dates matrix';
- BsDatepickerActions.FORMAT = '[datepicker] format datepicker values';
- BsDatepickerActions.FLAG = '[datepicker] set flags';
- BsDatepickerActions.SELECT = '[datepicker] select date';
- BsDatepickerActions.NAVIGATE_OFFSET = '[datepicker] shift view date';
- BsDatepickerActions.NAVIGATE_TO = '[datepicker] change view date';
- BsDatepickerActions.SET_OPTIONS = '[datepicker] update render options';
- BsDatepickerActions.HOVER = '[datepicker] hover date';
- BsDatepickerActions.CHANGE_VIEWMODE = '[datepicker] switch view mode';
- BsDatepickerActions.SET_MIN_DATE = '[datepicker] set min date';
- BsDatepickerActions.SET_MAX_DATE = '[datepicker] set max date';
- BsDatepickerActions.SET_DAYSDISABLED = '[datepicker] set days disabled';
- BsDatepickerActions.SET_DATESDISABLED = '[datepicker] set dates disabled';
- BsDatepickerActions.SET_IS_DISABLED = '[datepicker] set is disabled';
- BsDatepickerActions.SET_DATE_CUSTOM_CLASSES = '[datepicker] set date custom classes';
- BsDatepickerActions.SET_LOCALE = '[datepicker] set datepicker locale';
- BsDatepickerActions.SELECT_RANGE = '[daterangepicker] select dates range';
- BsDatepickerActions.decorators = [
- { type: Injectable }
- ];
- return BsDatepickerActions;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsLocaleService = /** @class */ (function () {
- function BsLocaleService() {
- this._defaultLocale = 'en';
- this._locale = new BehaviorSubject(this._defaultLocale);
- this._localeChange = this._locale.asObservable();
- }
- Object.defineProperty(BsLocaleService.prototype, "locale", {
- get: /**
- * @return {?}
- */
- function () {
- return this._locale;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(BsLocaleService.prototype, "localeChange", {
- get: /**
- * @return {?}
- */
- function () {
- return this._localeChange;
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(BsLocaleService.prototype, "currentLocale", {
- get: /**
- * @return {?}
- */
- function () {
- return this._locale.getValue();
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @param {?} locale
- * @return {?}
- */
- BsLocaleService.prototype.use = /**
- * @param {?} locale
- * @return {?}
- */
- function (locale) {
- if (locale === this.currentLocale) {
- return;
- }
- this._locale.next(locale);
- };
- BsLocaleService.decorators = [
- { type: Injectable }
- ];
- return BsLocaleService;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDatepickerEffects = /** @class */ (function () {
- function BsDatepickerEffects(_actions, _localeService) {
- this._actions = _actions;
- this._localeService = _localeService;
- this._subs = [];
- }
- /**
- * @param {?} _bsDatepickerStore
- * @return {?}
- */
- BsDatepickerEffects.prototype.init = /**
- * @param {?} _bsDatepickerStore
- * @return {?}
- */
- function (_bsDatepickerStore) {
- this._store = _bsDatepickerStore;
- return this;
- };
- /** setters */
- /**
- * setters
- * @param {?} value
- * @return {?}
- */
- BsDatepickerEffects.prototype.setValue = /**
- * setters
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._store.dispatch(this._actions.select(value));
- };
- /**
- * @param {?} value
- * @return {?}
- */
- BsDatepickerEffects.prototype.setRangeValue = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._store.dispatch(this._actions.selectRange(value));
- };
- /**
- * @param {?} value
- * @return {?}
- */
- BsDatepickerEffects.prototype.setMinDate = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._store.dispatch(this._actions.minDate(value));
- return this;
- };
- /**
- * @param {?} value
- * @return {?}
- */
- BsDatepickerEffects.prototype.setMaxDate = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._store.dispatch(this._actions.maxDate(value));
- return this;
- };
- /**
- * @template THIS
- * @this {THIS}
- * @param {?} value
- * @return {THIS}
- */
- BsDatepickerEffects.prototype.setDaysDisabled = /**
- * @template THIS
- * @this {THIS}
- * @param {?} value
- * @return {THIS}
- */
- function (value) {
- (/** @type {?} */ (this))._store.dispatch((/** @type {?} */ (this))._actions.daysDisabled(value));
- return (/** @type {?} */ (this));
- };
- /**
- * @template THIS
- * @this {THIS}
- * @param {?} value
- * @return {THIS}
- */
- BsDatepickerEffects.prototype.setDatesDisabled = /**
- * @template THIS
- * @this {THIS}
- * @param {?} value
- * @return {THIS}
- */
- function (value) {
- (/** @type {?} */ (this))._store.dispatch((/** @type {?} */ (this))._actions.datesDisabled(value));
- return (/** @type {?} */ (this));
- };
- /**
- * @param {?} value
- * @return {?}
- */
- BsDatepickerEffects.prototype.setDisabled = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._store.dispatch(this._actions.isDisabled(value));
- return this;
- };
- /**
- * @param {?} value
- * @return {?}
- */
- BsDatepickerEffects.prototype.setDateCustomClasses = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._store.dispatch(this._actions.setDateCustomClasses(value));
- return this;
- };
- /* Set rendering options */
- /* Set rendering options */
- /**
- * @param {?} _config
- * @return {?}
- */
- BsDatepickerEffects.prototype.setOptions = /* Set rendering options */
- /**
- * @param {?} _config
- * @return {?}
- */
- function (_config) {
- /** @type {?} */
- var _options = Object.assign({ locale: this._localeService.currentLocale }, _config);
- this._store.dispatch(this._actions.setOptions(_options));
- return this;
- };
- /** view to mode bindings */
- /**
- * view to mode bindings
- * @param {?} container
- * @return {?}
- */
- BsDatepickerEffects.prototype.setBindings = /**
- * view to mode bindings
- * @param {?} container
- * @return {?}
- */
- function (container) {
- container.daysCalendar = this._store
- .select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.flaggedMonths; }))
- .pipe(filter((/**
- * @param {?} months
- * @return {?}
- */
- function (months) { return !!months; })));
- // month calendar
- container.monthsCalendar = this._store
- .select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.flaggedMonthsCalendar; }))
- .pipe(filter((/**
- * @param {?} months
- * @return {?}
- */
- function (months) { return !!months; })));
- // year calendar
- container.yearsCalendar = this._store
- .select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.yearsCalendarFlagged; }))
- .pipe(filter((/**
- * @param {?} years
- * @return {?}
- */
- function (years) { return !!years; })));
- container.viewMode = this._store.select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.view.mode; }));
- container.options = this._store
- .select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.showWeekNumbers; }))
- .pipe(map((/**
- * @param {?} showWeekNumbers
- * @return {?}
- */
- function (showWeekNumbers) { return ({ showWeekNumbers: showWeekNumbers }); })));
- return this;
- };
- /** event handlers */
- /**
- * event handlers
- * @param {?} container
- * @return {?}
- */
- BsDatepickerEffects.prototype.setEventHandlers = /**
- * event handlers
- * @param {?} container
- * @return {?}
- */
- function (container) {
- var _this = this;
- container.setViewMode = (/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- _this._store.dispatch(_this._actions.changeViewMode(event));
- });
- container.navigateTo = (/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- _this._store.dispatch(_this._actions.navigateStep(event.step));
- });
- container.dayHoverHandler = (/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var _cell = (/** @type {?} */ (event.cell));
- if (_cell.isOtherMonth || _cell.isDisabled) {
- return;
- }
- _this._store.dispatch(_this._actions.hoverDay(event));
- _cell.isHovered = event.isHovered;
- });
- container.monthHoverHandler = (/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- event.cell.isHovered = event.isHovered;
- });
- container.yearHoverHandler = (/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- event.cell.isHovered = event.isHovered;
- });
- container.monthSelectHandler = (/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (event.isDisabled) {
- return;
- }
- _this._store.dispatch(_this._actions.navigateTo({
- unit: {
- month: getMonth(event.date),
- year: getFullYear(event.date)
- },
- viewMode: 'day'
- }));
- });
- container.yearSelectHandler = (/**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- if (event.isDisabled) {
- return;
- }
- _this._store.dispatch(_this._actions.navigateTo({
- unit: {
- year: getFullYear(event.date)
- },
- viewMode: 'month'
- }));
- });
- return this;
- };
- /**
- * @return {?}
- */
- BsDatepickerEffects.prototype.registerDatepickerSideEffects = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._subs.push(this._store.select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.view; })).subscribe((/**
- * @param {?} view
- * @return {?}
- */
- function (view) {
- _this._store.dispatch(_this._actions.calculate());
- })));
- // format calendar values on month model change
- this._subs.push(this._store
- .select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.monthsModel; }))
- .pipe(filter((/**
- * @param {?} monthModel
- * @return {?}
- */
- function (monthModel) { return !!monthModel; })))
- .subscribe((/**
- * @param {?} month
- * @return {?}
- */
- function (month) { return _this._store.dispatch(_this._actions.format()); })));
- // flag day values
- this._subs.push(this._store
- .select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.formattedMonths; }))
- .pipe(filter((/**
- * @param {?} month
- * @return {?}
- */
- function (month) { return !!month; })))
- .subscribe((/**
- * @param {?} month
- * @return {?}
- */
- function (month) { return _this._store.dispatch(_this._actions.flag()); })));
- // flag day values
- this._subs.push(this._store
- .select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.selectedDate; }))
- .pipe(filter((/**
- * @param {?} selectedDate
- * @return {?}
- */
- function (selectedDate) { return !!selectedDate; })))
- .subscribe((/**
- * @param {?} selectedDate
- * @return {?}
- */
- function (selectedDate) { return _this._store.dispatch(_this._actions.flag()); })));
- // flag for date range picker
- this._subs.push(this._store
- .select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.selectedRange; }))
- .pipe(filter((/**
- * @param {?} selectedRange
- * @return {?}
- */
- function (selectedRange) { return !!selectedRange; })))
- .subscribe((/**
- * @param {?} selectedRange
- * @return {?}
- */
- function (selectedRange) { return _this._store.dispatch(_this._actions.flag()); })));
- // monthsCalendar
- this._subs.push(this._store
- .select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.monthsCalendar; }))
- .subscribe((/**
- * @return {?}
- */
- function () { return _this._store.dispatch(_this._actions.flag()); })));
- // years calendar
- this._subs.push(this._store
- .select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.yearsCalendarModel; }))
- .pipe(filter((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return !!state; })))
- .subscribe((/**
- * @return {?}
- */
- function () { return _this._store.dispatch(_this._actions.flag()); })));
- // on hover
- this._subs.push(this._store
- .select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.hoveredDate; }))
- .pipe(filter((/**
- * @param {?} hoveredDate
- * @return {?}
- */
- function (hoveredDate) { return !!hoveredDate; })))
- .subscribe((/**
- * @param {?} hoveredDate
- * @return {?}
- */
- function (hoveredDate) { return _this._store.dispatch(_this._actions.flag()); })));
- // date custom classes
- this._subs.push(this._store
- .select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.dateCustomClasses; }))
- .pipe(filter((/**
- * @param {?} dateCustomClasses
- * @return {?}
- */
- function (dateCustomClasses) { return !!dateCustomClasses; })))
- .subscribe((/**
- * @param {?} dateCustomClasses
- * @return {?}
- */
- function (dateCustomClasses) { return _this._store.dispatch(_this._actions.flag()); })));
- // on locale change
- this._subs.push(this._localeService.localeChange
- .subscribe((/**
- * @param {?} locale
- * @return {?}
- */
- function (locale) { return _this._store.dispatch(_this._actions.setLocale(locale)); })));
- return this;
- };
- /**
- * @return {?}
- */
- BsDatepickerEffects.prototype.destroy = /**
- * @return {?}
- */
- function () {
- var e_1, _a;
- try {
- for (var _b = __values(this._subs), _c = _b.next(); !_c.done; _c = _b.next()) {
- var sub = _c.value;
- sub.unsubscribe();
- }
- }
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
- finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- }
- finally { if (e_1) throw e_1.error; }
- }
- };
- BsDatepickerEffects.decorators = [
- { type: Injectable }
- ];
- /** @nocollapse */
- BsDatepickerEffects.ctorParameters = function () { return [
- { type: BsDatepickerActions },
- { type: BsLocaleService }
- ]; };
- return BsDatepickerEffects;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var defaultMonthOptions = {
- width: 7,
- height: 6
- };
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var _initialView = { date: new Date(), mode: 'day' };
- /** @type {?} */
- var initialDatepickerState = Object.assign(new BsDatepickerConfig(), {
- locale: 'en',
- view: _initialView,
- selectedRange: [],
- monthViewOptions: defaultMonthOptions
- });
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @param {?} date
- * @param {?} options
- * @return {?}
- */
- function getStartingDayOfCalendar(date, options) {
- if (isFirstDayOfWeek(date, options.firstDayOfWeek)) {
- return date;
- }
- /** @type {?} */
- var weekDay = getDay(date);
- /** @type {?} */
- var offset = calculateDateOffset(weekDay, options.firstDayOfWeek);
- return shiftDate(date, { day: -offset });
- }
- /**
- * @param {?} weekday
- * @param {?} startingDayOffset
- * @return {?}
- */
- function calculateDateOffset(weekday, startingDayOffset) {
- if (startingDayOffset === 0) {
- return weekday;
- }
- /** @type {?} */
- var offset = weekday - startingDayOffset % 7;
- return offset < 0 ? offset + 7 : offset;
- }
- /**
- * @param {?} date
- * @param {?} min
- * @param {?} max
- * @return {?}
- */
- function isMonthDisabled(date, min, max) {
- /** @type {?} */
- var minBound = min && isBefore(endOf(date, 'month'), min, 'day');
- /** @type {?} */
- var maxBound = max && isAfter(startOf(date, 'month'), max, 'day');
- return minBound || maxBound;
- }
- /**
- * @param {?} date
- * @param {?} min
- * @param {?} max
- * @return {?}
- */
- function isYearDisabled(date, min, max) {
- /** @type {?} */
- var minBound = min && isBefore(endOf(date, 'year'), min, 'day');
- /** @type {?} */
- var maxBound = max && isAfter(startOf(date, 'year'), max, 'day');
- return minBound || maxBound;
- }
- /**
- * @param {?} date
- * @param {?} datesDisabled
- * @return {?}
- */
- function isDisabledDate(date, datesDisabled) {
- if (datesDisabled === undefined || !datesDisabled || !datesDisabled.length) {
- return false;
- }
- return datesDisabled.some((/**
- * @param {?} dateDisabled
- * @return {?}
- */
- function (dateDisabled) { return isSame(date, dateDisabled, 'date'); }));
- }
- /**
- * @param {?} state
- * @param {?=} calendarIndex
- * @return {?}
- */
- function getYearsCalendarInitialDate(state, calendarIndex) {
- if (calendarIndex === void 0) { calendarIndex = 0; }
- /** @type {?} */
- var model = state && state.yearsCalendarModel && state.yearsCalendarModel[calendarIndex];
- return model && model.years && model.years[0] && model.years[0][0] && model.years[0][0].date;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @template T
- * @param {?} options
- * @param {?} fn
- * @return {?}
- */
- function createMatrix(options, fn) {
- /** @type {?} */
- var prevValue = options.initialDate;
- /** @type {?} */
- var matrix = new Array(options.height);
- for (var i = 0; i < options.height; i++) {
- matrix[i] = new Array(options.width);
- for (var j = 0; j < options.width; j++) {
- matrix[i][j] = fn(prevValue);
- prevValue = shiftDate(prevValue, options.shift);
- }
- }
- return matrix;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @param {?} startingDate
- * @param {?} options
- * @return {?}
- */
- function calcDaysCalendar(startingDate, options) {
- /** @type {?} */
- var firstDay = getFirstDayOfMonth(startingDate);
- /** @type {?} */
- var initialDate = getStartingDayOfCalendar(firstDay, options);
- /** @type {?} */
- var matrixOptions = {
- width: options.width,
- height: options.height,
- initialDate: initialDate,
- shift: { day: 1 }
- };
- /** @type {?} */
- var daysMatrix = createMatrix(matrixOptions, (/**
- * @param {?} date
- * @return {?}
- */
- function (date) { return date; }));
- return {
- daysMatrix: daysMatrix,
- month: firstDay
- };
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @param {?} daysCalendar
- * @param {?} formatOptions
- * @param {?} monthIndex
- * @return {?}
- */
- function formatDaysCalendar(daysCalendar, formatOptions, monthIndex) {
- return {
- month: daysCalendar.month,
- monthTitle: formatDate(daysCalendar.month, formatOptions.monthTitle, formatOptions.locale),
- yearTitle: formatDate(daysCalendar.month, formatOptions.yearTitle, formatOptions.locale),
- weekNumbers: getWeekNumbers(daysCalendar.daysMatrix, formatOptions.weekNumbers, formatOptions.locale),
- weekdays: getShiftedWeekdays(formatOptions.locale),
- weeks: daysCalendar.daysMatrix.map((/**
- * @param {?} week
- * @param {?} weekIndex
- * @return {?}
- */
- function (week, weekIndex) { return ({
- days: week.map((/**
- * @param {?} date
- * @param {?} dayIndex
- * @return {?}
- */
- function (date, dayIndex) { return ({
- date: date,
- label: formatDate(date, formatOptions.dayLabel, formatOptions.locale),
- monthIndex: monthIndex,
- weekIndex: weekIndex,
- dayIndex: dayIndex
- }); }))
- }); }))
- };
- }
- /**
- * @param {?} daysMatrix
- * @param {?} format
- * @param {?} locale
- * @return {?}
- */
- function getWeekNumbers(daysMatrix, format, locale) {
- return daysMatrix.map((/**
- * @param {?} days
- * @return {?}
- */
- function (days) { return (days[0] ? formatDate(days[0], format, locale) : ''); }));
- }
- /**
- * @param {?} locale
- * @return {?}
- */
- function getShiftedWeekdays(locale) {
- /** @type {?} */
- var _locale = getLocale(locale);
- /** @type {?} */
- var weekdays = (/** @type {?} */ (_locale.weekdaysShort()));
- /** @type {?} */
- var firstDayOfWeek = _locale.firstDayOfWeek();
- return __spread(weekdays.slice(firstDayOfWeek), weekdays.slice(0, firstDayOfWeek));
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @param {?} formattedMonth
- * @param {?} options
- * @return {?}
- */
- function flagDaysCalendar(formattedMonth, options) {
- formattedMonth.weeks.forEach((/**
- * @param {?} week
- * @return {?}
- */
- function (week) {
- /* tslint:disable-next-line: cyclomatic-complexity */
- week.days.forEach((/**
- * @param {?} day
- * @param {?} dayIndex
- * @return {?}
- */
- function (day, dayIndex) {
- // datepicker
- /** @type {?} */
- var isOtherMonth = !isSameMonth(day.date, formattedMonth.month);
- /** @type {?} */
- var isHovered = !isOtherMonth && isSameDay(day.date, options.hoveredDate);
- // date range picker
- /** @type {?} */
- var isSelectionStart = !isOtherMonth &&
- options.selectedRange &&
- isSameDay(day.date, options.selectedRange[0]);
- /** @type {?} */
- var isSelectionEnd = !isOtherMonth &&
- options.selectedRange &&
- isSameDay(day.date, options.selectedRange[1]);
- /** @type {?} */
- var isSelected = (!isOtherMonth && isSameDay(day.date, options.selectedDate)) ||
- isSelectionStart ||
- isSelectionEnd;
- /** @type {?} */
- var isInRange = !isOtherMonth &&
- options.selectedRange &&
- isDateInRange(day.date, options.selectedRange, options.hoveredDate);
- /** @type {?} */
- var isDisabled = options.isDisabled ||
- isBefore(day.date, options.minDate, 'day') ||
- isAfter(day.date, options.maxDate, 'day') ||
- isDisabledDay(day.date, options.daysDisabled) ||
- isDisabledDate(day.date, options.datesDisabled);
- /** @type {?} */
- var currentDate = new Date();
- /** @type {?} */
- var isToday = !isOtherMonth && isSameDay(day.date, currentDate);
- /** @type {?} */
- var customClasses = options.dateCustomClasses && options.dateCustomClasses
- .map((/**
- * @param {?} dcc
- * @return {?}
- */
- function (dcc) { return isSameDay(day.date, dcc.date) ? dcc.classes : []; }))
- .reduce((/**
- * @param {?} previousValue
- * @param {?} currentValue
- * @return {?}
- */
- function (previousValue, currentValue) { return previousValue.concat(currentValue); }), [])
- .join(' ')
- || '';
- // decide update or not
- /** @type {?} */
- var newDay = Object.assign({}, day, {
- isOtherMonth: isOtherMonth,
- isHovered: isHovered,
- isSelected: isSelected,
- isSelectionStart: isSelectionStart,
- isSelectionEnd: isSelectionEnd,
- isInRange: isInRange,
- isDisabled: isDisabled,
- isToday: isToday,
- customClasses: customClasses
- });
- if (day.isOtherMonth !== newDay.isOtherMonth ||
- day.isHovered !== newDay.isHovered ||
- day.isSelected !== newDay.isSelected ||
- day.isSelectionStart !== newDay.isSelectionStart ||
- day.isSelectionEnd !== newDay.isSelectionEnd ||
- day.isDisabled !== newDay.isDisabled ||
- day.isInRange !== newDay.isInRange ||
- day.customClasses !== newDay.customClasses) {
- week.days[dayIndex] = newDay;
- }
- }));
- }));
- // todo: add check for linked calendars
- formattedMonth.hideLeftArrow =
- options.isDisabled ||
- (options.monthIndex > 0 && options.monthIndex !== options.displayMonths);
- formattedMonth.hideRightArrow =
- options.isDisabled ||
- (options.monthIndex < options.displayMonths &&
- options.monthIndex + 1 !== options.displayMonths);
- formattedMonth.disableLeftArrow = isMonthDisabled(shiftDate(formattedMonth.month, { month: -1 }), options.minDate, options.maxDate);
- formattedMonth.disableRightArrow = isMonthDisabled(shiftDate(formattedMonth.month, { month: 1 }), options.minDate, options.maxDate);
- return formattedMonth;
- }
- /**
- * @param {?} date
- * @param {?} selectedRange
- * @param {?} hoveredDate
- * @return {?}
- */
- function isDateInRange(date, selectedRange, hoveredDate) {
- if (!date || !selectedRange[0]) {
- return false;
- }
- if (selectedRange[1]) {
- return date > selectedRange[0] && date <= selectedRange[1];
- }
- if (hoveredDate) {
- return date > selectedRange[0] && date <= hoveredDate;
- }
- return false;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @param {?} mode
- * @param {?=} minMode
- * @return {?}
- */
- function canSwitchMode(mode, minMode) {
- return minMode ? mode >= minMode : true;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var height = 4;
- /** @type {?} */
- var width = 3;
- /** @type {?} */
- var shift = { month: 1 };
- /**
- * @param {?} viewDate
- * @param {?} formatOptions
- * @return {?}
- */
- function formatMonthsCalendar(viewDate, formatOptions) {
- /** @type {?} */
- var initialDate = startOf(viewDate, 'year');
- /** @type {?} */
- var matrixOptions = { width: width, height: height, initialDate: initialDate, shift: shift };
- /** @type {?} */
- var monthMatrix = createMatrix(matrixOptions, (/**
- * @param {?} date
- * @return {?}
- */
- function (date) { return ({
- date: date,
- label: formatDate(date, formatOptions.monthLabel, formatOptions.locale)
- }); }));
- return {
- months: monthMatrix,
- monthTitle: '',
- yearTitle: formatDate(viewDate, formatOptions.yearTitle, formatOptions.locale)
- };
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @param {?} monthCalendar
- * @param {?} options
- * @return {?}
- */
- function flagMonthsCalendar(monthCalendar, options) {
- monthCalendar.months.forEach((/**
- * @param {?} months
- * @param {?} rowIndex
- * @return {?}
- */
- function (months, rowIndex) {
- months.forEach((/**
- * @param {?} month
- * @param {?} monthIndex
- * @return {?}
- */
- function (month, monthIndex) {
- /** @type {?} */
- var isHovered = isSameMonth(month.date, options.hoveredMonth);
- /** @type {?} */
- var isDisabled = options.isDisabled ||
- isMonthDisabled(month.date, options.minDate, options.maxDate);
- /** @type {?} */
- var isSelected = isSameMonth(month.date, options.selectedDate);
- /** @type {?} */
- var newMonth = Object.assign(/*{},*/ month, {
- isHovered: isHovered,
- isDisabled: isDisabled,
- isSelected: isSelected
- });
- if (month.isHovered !== newMonth.isHovered ||
- month.isDisabled !== newMonth.isDisabled ||
- month.isSelected !== newMonth.isSelected) {
- monthCalendar.months[rowIndex][monthIndex] = newMonth;
- }
- }));
- }));
- // todo: add check for linked calendars
- monthCalendar.hideLeftArrow =
- options.monthIndex > 0 && options.monthIndex !== options.displayMonths;
- monthCalendar.hideRightArrow =
- options.monthIndex < options.displayMonths &&
- options.monthIndex + 1 !== options.displayMonths;
- monthCalendar.disableLeftArrow = isYearDisabled(shiftDate(monthCalendar.months[0][0].date, { year: -1 }), options.minDate, options.maxDate);
- monthCalendar.disableRightArrow = isYearDisabled(shiftDate(monthCalendar.months[0][0].date, { year: 1 }), options.minDate, options.maxDate);
- return monthCalendar;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var height$1 = 4;
- /** @type {?} */
- var width$1 = 4;
- /** @type {?} */
- var yearsPerCalendar = height$1 * width$1;
- /** @type {?} */
- var initialYearShift = (Math.floor(yearsPerCalendar / 2) - 1) * -1;
- /** @type {?} */
- var shift$1 = { year: 1 };
- /**
- * @param {?} viewDate
- * @param {?} formatOptions
- * @param {?=} previousInitialDate
- * @return {?}
- */
- function formatYearsCalendar(viewDate, formatOptions, previousInitialDate) {
- /** @type {?} */
- var initialDate = calculateInitialDate(viewDate, previousInitialDate);
- /** @type {?} */
- var matrixOptions = { width: width$1, height: height$1, initialDate: initialDate, shift: shift$1 };
- /** @type {?} */
- var yearsMatrix = createMatrix(matrixOptions, (/**
- * @param {?} date
- * @return {?}
- */
- function (date) { return ({
- date: date,
- label: formatDate(date, formatOptions.yearLabel, formatOptions.locale)
- }); }));
- /** @type {?} */
- var yearTitle = formatYearRangeTitle(yearsMatrix, formatOptions);
- return {
- years: yearsMatrix,
- monthTitle: '',
- yearTitle: yearTitle
- };
- }
- /**
- * @param {?} viewDate
- * @param {?=} previousInitialDate
- * @return {?}
- */
- function calculateInitialDate(viewDate, previousInitialDate) {
- if (previousInitialDate
- && viewDate.getFullYear() >= previousInitialDate.getFullYear()
- && viewDate.getFullYear() < previousInitialDate.getFullYear() + yearsPerCalendar) {
- return previousInitialDate;
- }
- return shiftDate(viewDate, { year: initialYearShift });
- }
- /**
- * @param {?} yearsMatrix
- * @param {?} formatOptions
- * @return {?}
- */
- function formatYearRangeTitle(yearsMatrix, formatOptions) {
- /** @type {?} */
- var from = formatDate(yearsMatrix[0][0].date, formatOptions.yearTitle, formatOptions.locale);
- /** @type {?} */
- var to = formatDate(yearsMatrix[height$1 - 1][width$1 - 1].date, formatOptions.yearTitle, formatOptions.locale);
- return from + " - " + to;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /**
- * @param {?} yearsCalendar
- * @param {?} options
- * @return {?}
- */
- function flagYearsCalendar(yearsCalendar, options) {
- yearsCalendar.years.forEach((/**
- * @param {?} years
- * @param {?} rowIndex
- * @return {?}
- */
- function (years, rowIndex) {
- years.forEach((/**
- * @param {?} year
- * @param {?} yearIndex
- * @return {?}
- */
- function (year, yearIndex) {
- /** @type {?} */
- var isHovered = isSameYear(year.date, options.hoveredYear);
- /** @type {?} */
- var isDisabled = options.isDisabled ||
- isYearDisabled(year.date, options.minDate, options.maxDate);
- /** @type {?} */
- var isSelected = isSameYear(year.date, options.selectedDate);
- /** @type {?} */
- var newMonth = Object.assign(/*{},*/ year, { isHovered: isHovered, isDisabled: isDisabled, isSelected: isSelected });
- if (year.isHovered !== newMonth.isHovered ||
- year.isDisabled !== newMonth.isDisabled ||
- year.isSelected !== newMonth.isSelected) {
- yearsCalendar.years[rowIndex][yearIndex] = newMonth;
- }
- }));
- }));
- // todo: add check for linked calendars
- yearsCalendar.hideLeftArrow =
- options.yearIndex > 0 && options.yearIndex !== options.displayMonths;
- yearsCalendar.hideRightArrow =
- options.yearIndex < options.displayMonths &&
- options.yearIndex + 1 !== options.displayMonths;
- yearsCalendar.disableLeftArrow = isYearDisabled(shiftDate(yearsCalendar.years[0][0].date, { year: -1 }), options.minDate, options.maxDate);
- /** @type {?} */
- var i = yearsCalendar.years.length - 1;
- /** @type {?} */
- var j = yearsCalendar.years[i].length - 1;
- yearsCalendar.disableRightArrow = isYearDisabled(shiftDate(yearsCalendar.years[i][j].date, { year: 1 }), options.minDate, options.maxDate);
- return yearsCalendar;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /* tslint:disable-next-line: cyclomatic-complexity */
- /**
- * @param {?=} state
- * @param {?=} action
- * @return {?}
- */
- function bsDatepickerReducer(state, action) {
- if (state === void 0) { state = initialDatepickerState; }
- switch (action.type) {
- case BsDatepickerActions.CALCULATE: {
- return calculateReducer(state);
- }
- case BsDatepickerActions.FORMAT: {
- return formatReducer(state);
- }
- case BsDatepickerActions.FLAG: {
- return flagReducer(state);
- }
- case BsDatepickerActions.NAVIGATE_OFFSET: {
- return navigateOffsetReducer(state, action);
- }
- case BsDatepickerActions.NAVIGATE_TO: {
- /** @type {?} */
- var payload = action.payload;
- /** @type {?} */
- var date = setFullDate(state.view.date, payload.unit);
- /** @type {?} */
- var newState = void 0;
- /** @type {?} */
- var mode = void 0;
- if (canSwitchMode(payload.viewMode, state.minMode)) {
- mode = payload.viewMode;
- newState = { view: { date: date, mode: mode } };
- }
- else {
- mode = state.view.mode;
- newState = { selectedDate: date, view: { date: date, mode: mode } };
- }
- return Object.assign({}, state, newState);
- }
- case BsDatepickerActions.CHANGE_VIEWMODE: {
- if (!canSwitchMode(action.payload, state.minMode)) {
- return state;
- }
- /** @type {?} */
- var date = state.view.date;
- /** @type {?} */
- var mode = action.payload;
- /** @type {?} */
- var newState = { view: { date: date, mode: mode } };
- return Object.assign({}, state, newState);
- }
- case BsDatepickerActions.HOVER: {
- return Object.assign({}, state, { hoveredDate: action.payload });
- }
- case BsDatepickerActions.SELECT: {
- /** @type {?} */
- var newState = {
- selectedDate: action.payload,
- view: state.view
- };
- /** @type {?} */
- var mode = state.view.mode;
- /** @type {?} */
- var _date = action.payload || state.view.date;
- /** @type {?} */
- var date = getViewDate(_date, state.minDate, state.maxDate);
- newState.view = { mode: mode, date: date };
- return Object.assign({}, state, newState);
- }
- case BsDatepickerActions.SET_OPTIONS: {
- /** @type {?} */
- var newState = action.payload;
- // preserve view mode
- /** @type {?} */
- var mode = newState.minMode ? newState.minMode : state.view.mode;
- /** @type {?} */
- var _viewDate = isDateValid(newState.value) && newState.value
- || isArray(newState.value) && isDateValid(newState.value[0]) && newState.value[0]
- || state.view.date;
- /** @type {?} */
- var date = getViewDate(_viewDate, newState.minDate, newState.maxDate);
- newState.view = { mode: mode, date: date };
- // update selected value
- if (newState.value) {
- // if new value is array we work with date range
- if (isArray(newState.value)) {
- newState.selectedRange = newState.value;
- }
- // if new value is a date -> datepicker
- if (newState.value instanceof Date) {
- newState.selectedDate = newState.value;
- }
- // provided value is not supported :)
- // need to report it somehow
- }
- return Object.assign({}, state, newState);
- }
- // date range picker
- case BsDatepickerActions.SELECT_RANGE: {
- /** @type {?} */
- var newState = {
- selectedRange: action.payload,
- view: state.view
- };
- /** @type {?} */
- var mode = state.view.mode;
- /** @type {?} */
- var _date = action.payload && action.payload[0] || state.view.date;
- /** @type {?} */
- var date = getViewDate(_date, state.minDate, state.maxDate);
- newState.view = { mode: mode, date: date };
- return Object.assign({}, state, newState);
- }
- case BsDatepickerActions.SET_MIN_DATE: {
- return Object.assign({}, state, {
- minDate: action.payload
- });
- }
- case BsDatepickerActions.SET_MAX_DATE: {
- return Object.assign({}, state, {
- maxDate: action.payload
- });
- }
- case BsDatepickerActions.SET_IS_DISABLED: {
- return Object.assign({}, state, {
- isDisabled: action.payload
- });
- }
- case BsDatepickerActions.SET_DATE_CUSTOM_CLASSES: {
- return Object.assign({}, state, {
- dateCustomClasses: action.payload
- });
- }
- default:
- return state;
- }
- }
- /**
- * @param {?} state
- * @return {?}
- */
- function calculateReducer(state) {
- // how many calendars
- /** @type {?} */
- var displayMonths = state.displayMonths;
- // use selected date on initial rendering if set
- /** @type {?} */
- var viewDate = state.view.date;
- if (state.view.mode === 'day') {
- state.monthViewOptions.firstDayOfWeek = getLocale(state.locale).firstDayOfWeek();
- /** @type {?} */
- var monthsModel = new Array(displayMonths);
- for (var monthIndex = 0; monthIndex < displayMonths; monthIndex++) {
- // todo: for unlinked calendars it will be harder
- monthsModel[monthIndex] = calcDaysCalendar(viewDate, state.monthViewOptions);
- viewDate = shiftDate(viewDate, { month: 1 });
- }
- return Object.assign({}, state, { monthsModel: monthsModel });
- }
- if (state.view.mode === 'month') {
- /** @type {?} */
- var monthsCalendar = new Array(displayMonths);
- for (var calendarIndex = 0; calendarIndex < displayMonths; calendarIndex++) {
- // todo: for unlinked calendars it will be harder
- monthsCalendar[calendarIndex] = formatMonthsCalendar(viewDate, getFormatOptions(state));
- viewDate = shiftDate(viewDate, { year: 1 });
- }
- return Object.assign({}, state, { monthsCalendar: monthsCalendar });
- }
- if (state.view.mode === 'year') {
- /** @type {?} */
- var yearsCalendarModel = new Array(displayMonths);
- for (var calendarIndex = 0; calendarIndex < displayMonths; calendarIndex++) {
- // todo: for unlinked calendars it will be harder
- yearsCalendarModel[calendarIndex] = formatYearsCalendar(viewDate, getFormatOptions(state), state.minMode === 'year' ? getYearsCalendarInitialDate(state, calendarIndex) : undefined);
- viewDate = shiftDate(viewDate, { year: yearsPerCalendar });
- }
- return Object.assign({}, state, { yearsCalendarModel: yearsCalendarModel });
- }
- return state;
- }
- /**
- * @param {?} state
- * @param {?} action
- * @return {?}
- */
- function formatReducer(state, action) {
- if (state.view.mode === 'day') {
- /** @type {?} */
- var formattedMonths = state.monthsModel.map((/**
- * @param {?} month
- * @param {?} monthIndex
- * @return {?}
- */
- function (month, monthIndex) {
- return formatDaysCalendar(month, getFormatOptions(state), monthIndex);
- }));
- return Object.assign({}, state, { formattedMonths: formattedMonths });
- }
- // how many calendars
- /** @type {?} */
- var displayMonths = state.displayMonths;
- // check initial rendering
- // use selected date on initial rendering if set
- /** @type {?} */
- var viewDate = state.view.date;
- if (state.view.mode === 'month') {
- /** @type {?} */
- var monthsCalendar = new Array(displayMonths);
- for (var calendarIndex = 0; calendarIndex < displayMonths; calendarIndex++) {
- // todo: for unlinked calendars it will be harder
- monthsCalendar[calendarIndex] = formatMonthsCalendar(viewDate, getFormatOptions(state));
- viewDate = shiftDate(viewDate, { year: 1 });
- }
- return Object.assign({}, state, { monthsCalendar: monthsCalendar });
- }
- if (state.view.mode === 'year') {
- /** @type {?} */
- var yearsCalendarModel = new Array(displayMonths);
- for (var calendarIndex = 0; calendarIndex < displayMonths; calendarIndex++) {
- // todo: for unlinked calendars it will be harder
- yearsCalendarModel[calendarIndex] = formatYearsCalendar(viewDate, getFormatOptions(state));
- viewDate = shiftDate(viewDate, { year: 16 });
- }
- return Object.assign({}, state, { yearsCalendarModel: yearsCalendarModel });
- }
- return state;
- }
- /**
- * @param {?} state
- * @param {?} action
- * @return {?}
- */
- function flagReducer(state, action) {
- if (state.view.mode === 'day') {
- /** @type {?} */
- var flaggedMonths = state.formattedMonths.map((/**
- * @param {?} formattedMonth
- * @param {?} monthIndex
- * @return {?}
- */
- function (formattedMonth, monthIndex) {
- return flagDaysCalendar(formattedMonth, {
- isDisabled: state.isDisabled,
- minDate: state.minDate,
- maxDate: state.maxDate,
- daysDisabled: state.daysDisabled,
- datesDisabled: state.datesDisabled,
- hoveredDate: state.hoveredDate,
- selectedDate: state.selectedDate,
- selectedRange: state.selectedRange,
- displayMonths: state.displayMonths,
- dateCustomClasses: state.dateCustomClasses,
- monthIndex: monthIndex
- });
- }));
- return Object.assign({}, state, { flaggedMonths: flaggedMonths });
- }
- if (state.view.mode === 'month') {
- /** @type {?} */
- var flaggedMonthsCalendar = state.monthsCalendar.map((/**
- * @param {?} formattedMonth
- * @param {?} monthIndex
- * @return {?}
- */
- function (formattedMonth, monthIndex) {
- return flagMonthsCalendar(formattedMonth, {
- isDisabled: state.isDisabled,
- minDate: state.minDate,
- maxDate: state.maxDate,
- hoveredMonth: state.hoveredMonth,
- selectedDate: state.selectedDate,
- displayMonths: state.displayMonths,
- monthIndex: monthIndex
- });
- }));
- return Object.assign({}, state, { flaggedMonthsCalendar: flaggedMonthsCalendar });
- }
- if (state.view.mode === 'year') {
- /** @type {?} */
- var yearsCalendarFlagged = state.yearsCalendarModel.map((/**
- * @param {?} formattedMonth
- * @param {?} yearIndex
- * @return {?}
- */
- function (formattedMonth, yearIndex) {
- return flagYearsCalendar(formattedMonth, {
- isDisabled: state.isDisabled,
- minDate: state.minDate,
- maxDate: state.maxDate,
- hoveredYear: state.hoveredYear,
- selectedDate: state.selectedDate,
- displayMonths: state.displayMonths,
- yearIndex: yearIndex
- });
- }));
- return Object.assign({}, state, { yearsCalendarFlagged: yearsCalendarFlagged });
- }
- return state;
- }
- /**
- * @param {?} state
- * @param {?} action
- * @return {?}
- */
- function navigateOffsetReducer(state, action) {
- /** @type {?} */
- var newState = {
- view: {
- mode: state.view.mode,
- date: shiftViewDate(state, action)
- }
- };
- return Object.assign({}, state, newState);
- }
- /**
- * @param {?} state
- * @param {?} action
- * @return {?}
- */
- function shiftViewDate(state, action) {
- if (state.view.mode === 'year' && state.minMode === 'year') {
- /** @type {?} */
- var initialDate = getYearsCalendarInitialDate(state, 0);
- /** @type {?} */
- var middleDate = shiftDate(initialDate, { year: -initialYearShift });
- return shiftDate(middleDate, action.payload);
- }
- return shiftDate(startOf(state.view.date, 'month'), action.payload);
- }
- /**
- * @param {?} state
- * @return {?}
- */
- function getFormatOptions(state) {
- return {
- locale: state.locale,
- monthTitle: state.monthTitle,
- yearTitle: state.yearTitle,
- dayLabel: state.dayLabel,
- monthLabel: state.monthLabel,
- yearLabel: state.yearLabel,
- weekNumbers: state.weekNumbers
- };
- }
- /**
- * if view date is provided (bsValue|ngModel) it should be shown
- * if view date is not provider:
- * if minDate>currentDate (default view value), show minDate
- * if maxDate<currentDate(default view value) show maxDate
- * @param {?} viewDate
- * @param {?} minDate
- * @param {?} maxDate
- * @return {?}
- */
- function getViewDate(viewDate, minDate, maxDate) {
- /** @type {?} */
- var _date = Array.isArray(viewDate) ? viewDate[0] : viewDate;
- if (minDate && isAfter(minDate, _date, 'day')) {
- return minDate;
- }
- if (maxDate && isBefore(maxDate, _date, 'day')) {
- return maxDate;
- }
- return _date;
- }
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDatepickerStore = /** @class */ (function (_super) {
- __extends(BsDatepickerStore, _super);
- function BsDatepickerStore() {
- var _this = this;
- /** @type {?} */
- var _dispatcher = new BehaviorSubject({
- type: '[datepicker] dispatcher init'
- });
- /** @type {?} */
- var state = new MiniState(initialDatepickerState, _dispatcher, bsDatepickerReducer);
- _this = _super.call(this, _dispatcher, bsDatepickerReducer, state) || this;
- return _this;
- }
- BsDatepickerStore.decorators = [
- { type: Injectable }
- ];
- /** @nocollapse */
- BsDatepickerStore.ctorParameters = function () { return []; };
- return BsDatepickerStore;
- }(MiniStore));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var DATEPICKER_ANIMATION_TIMING = '220ms cubic-bezier(0, 0, 0.2, 1)';
- /** @type {?} */
- var datepickerAnimation = trigger('datepickerAnimation', [
- state('animated-down', style({ height: '*', overflow: 'hidden' })),
- transition('* => animated-down', [
- style({ height: 0, overflow: 'hidden' }),
- animate(DATEPICKER_ANIMATION_TIMING)
- ]),
- state('animated-up', style({ height: '*', overflow: 'hidden' })),
- transition('* => animated-up', [
- style({ height: '*', overflow: 'hidden' }),
- animate(DATEPICKER_ANIMATION_TIMING)
- ]),
- transition('* => unanimated', animate('0s'))
- ]);
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDatepickerContainerComponent = /** @class */ (function (_super) {
- __extends(BsDatepickerContainerComponent, _super);
- function BsDatepickerContainerComponent(_renderer, _config, _store, _element, _actions, _effects, _positionService) {
- var _this = _super.call(this) || this;
- _this._config = _config;
- _this._store = _store;
- _this._element = _element;
- _this._actions = _actions;
- _this._positionService = _positionService;
- _this.valueChange = new EventEmitter();
- _this.animationState = 'void';
- _this._subs = [];
- _this._effects = _effects;
- _renderer.setStyle(_element.nativeElement, 'display', 'block');
- _renderer.setStyle(_element.nativeElement, 'position', 'absolute');
- return _this;
- }
- Object.defineProperty(BsDatepickerContainerComponent.prototype, "value", {
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._effects.setValue(value);
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- BsDatepickerContainerComponent.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._positionService.setOptions({
- modifiers: { flip: { enabled: this._config.adaptivePosition } },
- allowedPositions: ['top', 'bottom']
- });
- this._positionService.event$
- .pipe(take(1))
- .subscribe((/**
- * @return {?}
- */
- function () {
- _this._positionService.disable();
- if (_this._config.isAnimated) {
- _this.animationState = _this.isTopPosition ? 'animated-up' : 'animated-down';
- return;
- }
- _this.animationState = 'unanimated';
- }));
- this.isOtherMonthsActive = this._config.selectFromOtherMonth;
- this.containerClass = this._config.containerClass;
- this._effects
- .init(this._store)
- // intial state options
- .setOptions(this._config)
- // data binding view --> model
- .setBindings(this)
- // set event handlers
- .setEventHandlers(this)
- .registerDatepickerSideEffects();
- // todo: move it somewhere else
- // on selected date change
- this._subs.push(this._store
- /* tslint:disable-next-line: no-any */
- .select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.selectedDate; }))
- /* tslint:disable-next-line: no-any */
- .subscribe((/**
- * @param {?} date
- * @return {?}
- */
- function (date) { return _this.valueChange.emit(date); })));
- };
- Object.defineProperty(BsDatepickerContainerComponent.prototype, "isTopPosition", {
- get: /**
- * @return {?}
- */
- function () {
- return this._element.nativeElement.classList.contains('top');
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- BsDatepickerContainerComponent.prototype.positionServiceEnable = /**
- * @return {?}
- */
- function () {
- this._positionService.enable();
- };
- /**
- * @param {?} day
- * @return {?}
- */
- BsDatepickerContainerComponent.prototype.daySelectHandler = /**
- * @param {?} day
- * @return {?}
- */
- function (day) {
- /** @type {?} */
- var isDisabled = this.isOtherMonthsActive ? day.isDisabled : (day.isOtherMonth || day.isDisabled);
- if (isDisabled) {
- return;
- }
- this._store.dispatch(this._actions.select(day.date));
- };
- /**
- * @return {?}
- */
- BsDatepickerContainerComponent.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- var e_1, _a;
- try {
- for (var _b = __values(this._subs), _c = _b.next(); !_c.done; _c = _b.next()) {
- var sub = _c.value;
- sub.unsubscribe();
- }
- }
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
- finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- }
- finally { if (e_1) throw e_1.error; }
- }
- this._effects.destroy();
- };
- BsDatepickerContainerComponent.decorators = [
- { type: Component, args: [{
- selector: 'bs-datepicker-container',
- providers: [BsDatepickerStore, BsDatepickerEffects],
- template: "<!-- days calendar view mode -->\n<div class=\"bs-datepicker\" [ngClass]=\"containerClass\" *ngIf=\"viewMode | async\">\n <div class=\"bs-datepicker-container\"\n [@datepickerAnimation]=\"animationState\"\n (@datepickerAnimation.done)=\"positionServiceEnable()\">\n <!--calendars-->\n <div class=\"bs-calendar-container\" [ngSwitch]=\"viewMode | async\" role=\"application\">\n <!--days calendar-->\n <div *ngSwitchCase=\"'day'\" class=\"bs-media-container\">\n <bs-days-calendar-view\n *ngFor=\"let calendar of daysCalendar | async\"\n [class.bs-datepicker-multiple]=\"(daysCalendar | async)?.length > 1\"\n [calendar]=\"calendar\"\n [options]=\"options | async\"\n (onNavigate)=\"navigateTo($event)\"\n (onViewMode)=\"setViewMode($event)\"\n (onHover)=\"dayHoverHandler($event)\"\n (onHoverWeek)=\"weekHoverHandler($event)\"\n (onSelect)=\"daySelectHandler($event)\">\n </bs-days-calendar-view>\n </div>\n\n <!--months calendar-->\n <div *ngSwitchCase=\"'month'\" class=\"bs-media-container\">\n <bs-month-calendar-view\n *ngFor=\"let calendar of monthsCalendar | async\"\n [class.bs-datepicker-multiple]=\"(daysCalendar | async)?.length > 1\"\n [calendar]=\"calendar\"\n (onNavigate)=\"navigateTo($event)\"\n (onViewMode)=\"setViewMode($event)\"\n (onHover)=\"monthHoverHandler($event)\"\n (onSelect)=\"monthSelectHandler($event)\">\n </bs-month-calendar-view>\n </div>\n\n <!--years calendar-->\n <div *ngSwitchCase=\"'year'\" class=\"bs-media-container\">\n <bs-years-calendar-view\n *ngFor=\"let calendar of yearsCalendar | async\"\n [class.bs-datepicker-multiple]=\"(daysCalendar | async)?.length > 1\"\n [calendar]=\"calendar\"\n (onNavigate)=\"navigateTo($event)\"\n (onViewMode)=\"setViewMode($event)\"\n (onHover)=\"yearHoverHandler($event)\"\n (onSelect)=\"yearSelectHandler($event)\">\n </bs-years-calendar-view>\n </div>\n </div>\n\n <!--applycancel buttons-->\n <div class=\"bs-datepicker-buttons\" *ngIf=\"false\">\n <button class=\"btn btn-success\" type=\"button\">Apply</button>\n <button class=\"btn btn-default\" type=\"button\">Cancel</button>\n </div>\n </div>\n\n <!--custom dates or date ranges picker-->\n <div class=\"bs-datepicker-custom-range\" *ngIf=\"false\">\n <bs-custom-date-view [ranges]=\"_customRangesFish\"></bs-custom-date-view>\n </div>\n</div>\n",
- host: {
- class: 'bottom',
- '(click)': '_stopPropagation($event)',
- role: 'dialog',
- 'aria-label': 'calendar'
- },
- animations: [datepickerAnimation]
- }] }
- ];
- /** @nocollapse */
- BsDatepickerContainerComponent.ctorParameters = function () { return [
- { type: Renderer2 },
- { type: BsDatepickerConfig },
- { type: BsDatepickerStore },
- { type: ElementRef },
- { type: BsDatepickerActions },
- { type: BsDatepickerEffects },
- { type: PositioningService }
- ]; };
- return BsDatepickerContainerComponent;
- }(BsDatepickerAbstractComponent));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDatepickerDirective = /** @class */ (function () {
- function BsDatepickerDirective(_config, _elementRef, _renderer, _viewContainerRef, cis) {
- this._config = _config;
- /**
- * Placement of a datepicker. Accepts: "top", "bottom", "left", "right"
- */
- this.placement = 'bottom';
- /**
- * Specifies events that should trigger. Supports a space separated list of
- * event names.
- */
- this.triggers = 'click';
- /**
- * Close datepicker on outside click
- */
- this.outsideClick = true;
- /**
- * A selector specifying the element the datepicker should be appended to.
- */
- this.container = 'body';
- this.outsideEsc = true;
- /**
- * Emits when datepicker value has been changed
- */
- this.bsValueChange = new EventEmitter();
- this._subs = [];
- // todo: assign only subset of fields
- Object.assign(this, this._config);
- this._datepicker = cis.createLoader(_elementRef, _viewContainerRef, _renderer);
- this.onShown = this._datepicker.onShown;
- this.onHidden = this._datepicker.onHidden;
- }
- Object.defineProperty(BsDatepickerDirective.prototype, "isOpen", {
- /**
- * Returns whether or not the datepicker is currently being shown
- */
- get: /**
- * Returns whether or not the datepicker is currently being shown
- * @return {?}
- */
- function () {
- return this._datepicker.isShown;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (value) {
- this.show();
- }
- else {
- this.hide();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(BsDatepickerDirective.prototype, "bsValue", {
- /**
- * Initial value of datepicker
- */
- set: /**
- * Initial value of datepicker
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (this._bsValue === value) {
- return;
- }
- this._bsValue = value;
- this.bsValueChange.emit(value);
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- BsDatepickerDirective.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._datepicker.listen({
- outsideClick: this.outsideClick,
- outsideEsc: this.outsideEsc,
- triggers: this.triggers,
- show: (/**
- * @return {?}
- */
- function () { return _this.show(); })
- });
- this.setConfig();
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- BsDatepickerDirective.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- if (!this._datepickerRef || !this._datepickerRef.instance) {
- return;
- }
- if (changes.minDate) {
- this._datepickerRef.instance.minDate = this.minDate;
- }
- if (changes.maxDate) {
- this._datepickerRef.instance.maxDate = this.maxDate;
- }
- if (changes.daysDisabled) {
- this._datepickerRef.instance.daysDisabled = this.daysDisabled;
- }
- if (changes.datesDisabled) {
- this._datepickerRef.instance.datesDisabled = this.datesDisabled;
- }
- if (changes.isDisabled) {
- this._datepickerRef.instance.isDisabled = this.isDisabled;
- }
- if (changes.dateCustomClasses) {
- this._datepickerRef.instance.dateCustomClasses = this.dateCustomClasses;
- }
- };
- /**
- * Opens an element’s datepicker. This is considered a “manual” triggering of
- * the datepicker.
- */
- /**
- * Opens an element’s datepicker. This is considered a “manual” triggering of
- * the datepicker.
- * @return {?}
- */
- BsDatepickerDirective.prototype.show = /**
- * Opens an element’s datepicker. This is considered a “manual” triggering of
- * the datepicker.
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._datepicker.isShown) {
- return;
- }
- this.setConfig();
- this._datepickerRef = this._datepicker
- .provide({ provide: BsDatepickerConfig, useValue: this._config })
- .attach(BsDatepickerContainerComponent)
- .to(this.container)
- .position({ attachment: this.placement })
- .show({ placement: this.placement });
- // if date changes from external source (model -> view)
- this._subs.push(this.bsValueChange.subscribe((/**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- _this._datepickerRef.instance.value = value;
- })));
- // if date changes from picker (view -> model)
- this._subs.push(this._datepickerRef.instance.valueChange.subscribe((/**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- _this.bsValue = value;
- _this.hide();
- })));
- };
- /**
- * Closes an element’s datepicker. This is considered a “manual” triggering of
- * the datepicker.
- */
- /**
- * Closes an element’s datepicker. This is considered a “manual” triggering of
- * the datepicker.
- * @return {?}
- */
- BsDatepickerDirective.prototype.hide = /**
- * Closes an element’s datepicker. This is considered a “manual” triggering of
- * the datepicker.
- * @return {?}
- */
- function () {
- var e_1, _a;
- if (this.isOpen) {
- this._datepicker.hide();
- }
- try {
- for (var _b = __values(this._subs), _c = _b.next(); !_c.done; _c = _b.next()) {
- var sub = _c.value;
- sub.unsubscribe();
- }
- }
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
- finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- }
- finally { if (e_1) throw e_1.error; }
- }
- };
- /**
- * Toggles an element’s datepicker. This is considered a “manual” triggering
- * of the datepicker.
- */
- /**
- * Toggles an element’s datepicker. This is considered a “manual” triggering
- * of the datepicker.
- * @return {?}
- */
- BsDatepickerDirective.prototype.toggle = /**
- * Toggles an element’s datepicker. This is considered a “manual” triggering
- * of the datepicker.
- * @return {?}
- */
- function () {
- if (this.isOpen) {
- return this.hide();
- }
- this.show();
- };
- /**
- * Set config for datepicker
- */
- /**
- * Set config for datepicker
- * @return {?}
- */
- BsDatepickerDirective.prototype.setConfig = /**
- * Set config for datepicker
- * @return {?}
- */
- function () {
- this._config = Object.assign({}, this._config, this.bsConfig, {
- value: this._bsValue,
- isDisabled: this.isDisabled,
- minDate: this.minDate || this.bsConfig && this.bsConfig.minDate,
- maxDate: this.maxDate || this.bsConfig && this.bsConfig.maxDate,
- daysDisabled: this.daysDisabled || this.bsConfig && this.bsConfig.daysDisabled,
- dateCustomClasses: this.dateCustomClasses || this.bsConfig && this.bsConfig.dateCustomClasses,
- datesDisabled: this.datesDisabled || this.bsConfig && this.bsConfig.datesDisabled,
- minMode: this.minMode || this.bsConfig && this.bsConfig.minMode
- });
- };
- /**
- * @return {?}
- */
- BsDatepickerDirective.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._datepicker.dispose();
- };
- BsDatepickerDirective.decorators = [
- { type: Directive, args: [{
- selector: '[bsDatepicker]',
- exportAs: 'bsDatepicker'
- },] }
- ];
- /** @nocollapse */
- BsDatepickerDirective.ctorParameters = function () { return [
- { type: BsDatepickerConfig },
- { type: ElementRef },
- { type: Renderer2 },
- { type: ViewContainerRef },
- { type: ComponentLoaderFactory }
- ]; };
- BsDatepickerDirective.propDecorators = {
- placement: [{ type: Input }],
- triggers: [{ type: Input }],
- outsideClick: [{ type: Input }],
- container: [{ type: Input }],
- outsideEsc: [{ type: Input }],
- isOpen: [{ type: Input }],
- onShown: [{ type: Output }],
- onHidden: [{ type: Output }],
- bsValue: [{ type: Input }],
- bsConfig: [{ type: Input }],
- isDisabled: [{ type: Input }],
- minDate: [{ type: Input }],
- maxDate: [{ type: Input }],
- minMode: [{ type: Input }],
- daysDisabled: [{ type: Input }],
- datesDisabled: [{ type: Input }],
- dateCustomClasses: [{ type: Input }],
- bsValueChange: [{ type: Output }]
- };
- return BsDatepickerDirective;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDatepickerInlineConfig = /** @class */ (function (_super) {
- __extends(BsDatepickerInlineConfig, _super);
- function BsDatepickerInlineConfig() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- BsDatepickerInlineConfig.decorators = [
- { type: Injectable }
- ];
- return BsDatepickerInlineConfig;
- }(BsDatepickerConfig));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDatepickerInlineContainerComponent = /** @class */ (function (_super) {
- __extends(BsDatepickerInlineContainerComponent, _super);
- function BsDatepickerInlineContainerComponent(_renderer, _config, _store, _element, _actions, _effects, _positioningService) {
- var _this = _super.call(this, _renderer, _config, _store, _element, _actions, _effects, _positioningService) || this;
- _renderer.setStyle(_element.nativeElement, 'display', 'inline-block');
- _renderer.setStyle(_element.nativeElement, 'position', 'static');
- return _this;
- }
- BsDatepickerInlineContainerComponent.decorators = [
- { type: Component, args: [{
- selector: 'bs-datepicker-inline-container',
- providers: [BsDatepickerStore, BsDatepickerEffects],
- template: "<!-- days calendar view mode -->\n<div class=\"bs-datepicker\" [ngClass]=\"containerClass\" *ngIf=\"viewMode | async\">\n <div class=\"bs-datepicker-container\"\n [@datepickerAnimation]=\"animationState\"\n (@datepickerAnimation.done)=\"positionServiceEnable()\">\n <!--calendars-->\n <div class=\"bs-calendar-container\" [ngSwitch]=\"viewMode | async\" role=\"application\">\n <!--days calendar-->\n <div *ngSwitchCase=\"'day'\" class=\"bs-media-container\">\n <bs-days-calendar-view\n *ngFor=\"let calendar of daysCalendar | async\"\n [class.bs-datepicker-multiple]=\"(daysCalendar | async)?.length > 1\"\n [calendar]=\"calendar\"\n [options]=\"options | async\"\n (onNavigate)=\"navigateTo($event)\"\n (onViewMode)=\"setViewMode($event)\"\n (onHover)=\"dayHoverHandler($event)\"\n (onHoverWeek)=\"weekHoverHandler($event)\"\n (onSelect)=\"daySelectHandler($event)\">\n </bs-days-calendar-view>\n </div>\n\n <!--months calendar-->\n <div *ngSwitchCase=\"'month'\" class=\"bs-media-container\">\n <bs-month-calendar-view\n *ngFor=\"let calendar of monthsCalendar | async\"\n [class.bs-datepicker-multiple]=\"(daysCalendar | async)?.length > 1\"\n [calendar]=\"calendar\"\n (onNavigate)=\"navigateTo($event)\"\n (onViewMode)=\"setViewMode($event)\"\n (onHover)=\"monthHoverHandler($event)\"\n (onSelect)=\"monthSelectHandler($event)\">\n </bs-month-calendar-view>\n </div>\n\n <!--years calendar-->\n <div *ngSwitchCase=\"'year'\" class=\"bs-media-container\">\n <bs-years-calendar-view\n *ngFor=\"let calendar of yearsCalendar | async\"\n [class.bs-datepicker-multiple]=\"(daysCalendar | async)?.length > 1\"\n [calendar]=\"calendar\"\n (onNavigate)=\"navigateTo($event)\"\n (onViewMode)=\"setViewMode($event)\"\n (onHover)=\"yearHoverHandler($event)\"\n (onSelect)=\"yearSelectHandler($event)\">\n </bs-years-calendar-view>\n </div>\n </div>\n\n <!--applycancel buttons-->\n <div class=\"bs-datepicker-buttons\" *ngIf=\"false\">\n <button class=\"btn btn-success\" type=\"button\">Apply</button>\n <button class=\"btn btn-default\" type=\"button\">Cancel</button>\n </div>\n </div>\n\n <!--custom dates or date ranges picker-->\n <div class=\"bs-datepicker-custom-range\" *ngIf=\"false\">\n <bs-custom-date-view [ranges]=\"_customRangesFish\"></bs-custom-date-view>\n </div>\n</div>\n",
- host: {
- '(click)': '_stopPropagation($event)'
- },
- animations: [datepickerAnimation]
- }] }
- ];
- /** @nocollapse */
- BsDatepickerInlineContainerComponent.ctorParameters = function () { return [
- { type: Renderer2 },
- { type: BsDatepickerConfig },
- { type: BsDatepickerStore },
- { type: ElementRef },
- { type: BsDatepickerActions },
- { type: BsDatepickerEffects },
- { type: PositioningService }
- ]; };
- return BsDatepickerInlineContainerComponent;
- }(BsDatepickerContainerComponent));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDatepickerInlineDirective = /** @class */ (function () {
- function BsDatepickerInlineDirective(_config, _elementRef, _renderer, _viewContainerRef, cis) {
- this._config = _config;
- this._elementRef = _elementRef;
- /**
- * Emits when datepicker value has been changed
- */
- this.bsValueChange = new EventEmitter();
- this._subs = [];
- // todo: assign only subset of fields
- Object.assign(this, this._config);
- this._datepicker = cis.createLoader(_elementRef, _viewContainerRef, _renderer);
- }
- Object.defineProperty(BsDatepickerInlineDirective.prototype, "bsValue", {
- /**
- * Initial value of datepicker
- */
- set: /**
- * Initial value of datepicker
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (this._bsValue === value) {
- return;
- }
- this._bsValue = value;
- this.bsValueChange.emit(value);
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- BsDatepickerInlineDirective.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this.setConfig();
- this._datepickerRef = this._datepicker
- .provide({ provide: BsDatepickerConfig, useValue: this._config })
- .attach(BsDatepickerInlineContainerComponent)
- .to(this._elementRef)
- .show();
- // if date changes from external source (model -> view)
- this._subs.push(this.bsValueChange.subscribe((/**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- _this._datepickerRef.instance.value = value;
- })));
- // if date changes from picker (view -> model)
- this._subs.push(this._datepickerRef.instance.valueChange.subscribe((/**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- _this.bsValue = value;
- })));
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- BsDatepickerInlineDirective.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- if (!this._datepickerRef || !this._datepickerRef.instance) {
- return;
- }
- if (changes.minDate) {
- this._datepickerRef.instance.minDate = this.minDate;
- this._datepickerRef.instance.value = this._bsValue;
- }
- if (changes.maxDate) {
- this._datepickerRef.instance.maxDate = this.maxDate;
- this._datepickerRef.instance.value = this._bsValue;
- }
- if (changes.datesDisabled) {
- this._datepickerRef.instance.datesDisabled = this.datesDisabled;
- this._datepickerRef.instance.value = this._bsValue;
- }
- if (changes.isDisabled) {
- this._datepickerRef.instance.isDisabled = this.isDisabled;
- }
- if (changes.dateCustomClasses) {
- this._datepickerRef.instance.dateCustomClasses = this.dateCustomClasses;
- }
- };
- /**
- * Set config for datepicker
- */
- /**
- * Set config for datepicker
- * @return {?}
- */
- BsDatepickerInlineDirective.prototype.setConfig = /**
- * Set config for datepicker
- * @return {?}
- */
- function () {
- this._config = Object.assign({}, this._config, this.bsConfig, {
- value: this._bsValue,
- isDisabled: this.isDisabled,
- minDate: this.minDate || this.bsConfig && this.bsConfig.minDate,
- maxDate: this.maxDate || this.bsConfig && this.bsConfig.maxDate,
- dateCustomClasses: this.dateCustomClasses || this.bsConfig && this.bsConfig.dateCustomClasses,
- datesDisabled: this.datesDisabled || this.bsConfig && this.bsConfig.datesDisabled
- });
- };
- /**
- * @return {?}
- */
- BsDatepickerInlineDirective.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._datepicker.dispose();
- };
- BsDatepickerInlineDirective.decorators = [
- { type: Directive, args: [{
- selector: 'bs-datepicker-inline',
- exportAs: 'bsDatepickerInline'
- },] }
- ];
- /** @nocollapse */
- BsDatepickerInlineDirective.ctorParameters = function () { return [
- { type: BsDatepickerInlineConfig },
- { type: ElementRef },
- { type: Renderer2 },
- { type: ViewContainerRef },
- { type: ComponentLoaderFactory }
- ]; };
- BsDatepickerInlineDirective.propDecorators = {
- bsValue: [{ type: Input }],
- bsConfig: [{ type: Input }],
- isDisabled: [{ type: Input }],
- minDate: [{ type: Input }],
- maxDate: [{ type: Input }],
- dateCustomClasses: [{ type: Input }],
- datesDisabled: [{ type: Input }],
- bsValueChange: [{ type: Output }]
- };
- return BsDatepickerInlineDirective;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDaterangepickerInlineConfig = /** @class */ (function (_super) {
- __extends(BsDaterangepickerInlineConfig, _super);
- function BsDaterangepickerInlineConfig() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- // DatepickerRenderOptions
- _this.displayMonths = 2;
- /**
- * turn on/off animation
- */
- _this.isAnimated = false;
- return _this;
- }
- BsDaterangepickerInlineConfig.decorators = [
- { type: Injectable }
- ];
- return BsDaterangepickerInlineConfig;
- }(BsDatepickerConfig));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDaterangepickerContainerComponent = /** @class */ (function (_super) {
- __extends(BsDaterangepickerContainerComponent, _super);
- function BsDaterangepickerContainerComponent(_renderer, _config, _store, _element, _actions, _effects, _positionService) {
- var _this = _super.call(this) || this;
- _this._config = _config;
- _this._store = _store;
- _this._element = _element;
- _this._actions = _actions;
- _this._positionService = _positionService;
- _this.valueChange = new EventEmitter();
- _this.animationState = 'void';
- _this._rangeStack = [];
- _this._subs = [];
- _this._effects = _effects;
- _renderer.setStyle(_element.nativeElement, 'display', 'block');
- _renderer.setStyle(_element.nativeElement, 'position', 'absolute');
- return _this;
- }
- Object.defineProperty(BsDaterangepickerContainerComponent.prototype, "value", {
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._effects.setRangeValue(value);
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- BsDaterangepickerContainerComponent.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._positionService.setOptions({
- modifiers: { flip: { enabled: this._config.adaptivePosition } },
- allowedPositions: ['top', 'bottom']
- });
- this._positionService.event$
- .pipe(take(1))
- .subscribe((/**
- * @return {?}
- */
- function () {
- _this._positionService.disable();
- if (_this._config.isAnimated) {
- _this.animationState = _this.isTopPosition ? 'animated-up' : 'animated-down';
- return;
- }
- _this.animationState = 'unanimated';
- }));
- this.containerClass = this._config.containerClass;
- this.isOtherMonthsActive = this._config.selectFromOtherMonth;
- this._effects
- .init(this._store)
- // intial state options
- // todo: fix this, split configs
- .setOptions(this._config)
- // data binding view --> model
- .setBindings(this)
- // set event handlers
- .setEventHandlers(this)
- .registerDatepickerSideEffects();
- // todo: move it somewhere else
- // on selected date change
- this._subs.push(this._store
- .select((/**
- * @param {?} state
- * @return {?}
- */
- function (state) { return state.selectedRange; }))
- .subscribe((/**
- * @param {?} date
- * @return {?}
- */
- function (date) { return _this.valueChange.emit(date); })));
- };
- Object.defineProperty(BsDaterangepickerContainerComponent.prototype, "isTopPosition", {
- get: /**
- * @return {?}
- */
- function () {
- return this._element.nativeElement.classList.contains('top');
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- BsDaterangepickerContainerComponent.prototype.positionServiceEnable = /**
- * @return {?}
- */
- function () {
- this._positionService.enable();
- };
- /**
- * @param {?} day
- * @return {?}
- */
- BsDaterangepickerContainerComponent.prototype.daySelectHandler = /**
- * @param {?} day
- * @return {?}
- */
- function (day) {
- /** @type {?} */
- var isDisabled = this.isOtherMonthsActive ? day.isDisabled : (day.isOtherMonth || day.isDisabled);
- if (isDisabled) {
- return;
- }
- // if only one date is already selected
- // and user clicks on previous date
- // start selection from new date
- // but if new date is after initial one
- // than finish selection
- if (this._rangeStack.length === 1) {
- this._rangeStack =
- day.date >= this._rangeStack[0]
- ? [this._rangeStack[0], day.date]
- : [day.date];
- }
- if (this._rangeStack.length === 0) {
- this._rangeStack = [day.date];
- }
- this._store.dispatch(this._actions.selectRange(this._rangeStack));
- if (this._rangeStack.length === 2) {
- this._rangeStack = [];
- }
- };
- /**
- * @return {?}
- */
- BsDaterangepickerContainerComponent.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- var e_1, _a;
- try {
- for (var _b = __values(this._subs), _c = _b.next(); !_c.done; _c = _b.next()) {
- var sub = _c.value;
- sub.unsubscribe();
- }
- }
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
- finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- }
- finally { if (e_1) throw e_1.error; }
- }
- this._effects.destroy();
- };
- BsDaterangepickerContainerComponent.decorators = [
- { type: Component, args: [{
- selector: 'bs-daterangepicker-container',
- providers: [BsDatepickerStore, BsDatepickerEffects],
- template: "<!-- days calendar view mode -->\n<div class=\"bs-datepicker\" [ngClass]=\"containerClass\" *ngIf=\"viewMode | async\">\n <div class=\"bs-datepicker-container\"\n [@datepickerAnimation]=\"animationState\"\n (@datepickerAnimation.done)=\"positionServiceEnable()\">\n <!--calendars-->\n <div class=\"bs-calendar-container\" [ngSwitch]=\"viewMode | async\" role=\"application\">\n <!--days calendar-->\n <div *ngSwitchCase=\"'day'\" class=\"bs-media-container\">\n <bs-days-calendar-view\n *ngFor=\"let calendar of daysCalendar | async\"\n [class.bs-datepicker-multiple]=\"(daysCalendar | async)?.length > 1\"\n [calendar]=\"calendar\"\n [options]=\"options | async\"\n (onNavigate)=\"navigateTo($event)\"\n (onViewMode)=\"setViewMode($event)\"\n (onHover)=\"dayHoverHandler($event)\"\n (onHoverWeek)=\"weekHoverHandler($event)\"\n (onSelect)=\"daySelectHandler($event)\">\n </bs-days-calendar-view>\n </div>\n\n <!--months calendar-->\n <div *ngSwitchCase=\"'month'\" class=\"bs-media-container\">\n <bs-month-calendar-view\n *ngFor=\"let calendar of monthsCalendar | async\"\n [class.bs-datepicker-multiple]=\"(daysCalendar | async)?.length > 1\"\n [calendar]=\"calendar\"\n (onNavigate)=\"navigateTo($event)\"\n (onViewMode)=\"setViewMode($event)\"\n (onHover)=\"monthHoverHandler($event)\"\n (onSelect)=\"monthSelectHandler($event)\">\n </bs-month-calendar-view>\n </div>\n\n <!--years calendar-->\n <div *ngSwitchCase=\"'year'\" class=\"bs-media-container\">\n <bs-years-calendar-view\n *ngFor=\"let calendar of yearsCalendar | async\"\n [class.bs-datepicker-multiple]=\"(daysCalendar | async)?.length > 1\"\n [calendar]=\"calendar\"\n (onNavigate)=\"navigateTo($event)\"\n (onViewMode)=\"setViewMode($event)\"\n (onHover)=\"yearHoverHandler($event)\"\n (onSelect)=\"yearSelectHandler($event)\">\n </bs-years-calendar-view>\n </div>\n </div>\n\n <!--applycancel buttons-->\n <div class=\"bs-datepicker-buttons\" *ngIf=\"false\">\n <button class=\"btn btn-success\" type=\"button\">Apply</button>\n <button class=\"btn btn-default\" type=\"button\">Cancel</button>\n </div>\n </div>\n\n <!--custom dates or date ranges picker-->\n <div class=\"bs-datepicker-custom-range\" *ngIf=\"false\">\n <bs-custom-date-view [ranges]=\"_customRangesFish\"></bs-custom-date-view>\n </div>\n</div>\n",
- host: {
- class: 'bottom',
- '(click)': '_stopPropagation($event)',
- role: 'dialog',
- 'aria-label': 'calendar'
- },
- animations: [datepickerAnimation]
- }] }
- ];
- /** @nocollapse */
- BsDaterangepickerContainerComponent.ctorParameters = function () { return [
- { type: Renderer2 },
- { type: BsDatepickerConfig },
- { type: BsDatepickerStore },
- { type: ElementRef },
- { type: BsDatepickerActions },
- { type: BsDatepickerEffects },
- { type: PositioningService }
- ]; };
- return BsDaterangepickerContainerComponent;
- }(BsDatepickerAbstractComponent));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDaterangepickerInlineContainerComponent = /** @class */ (function (_super) {
- __extends(BsDaterangepickerInlineContainerComponent, _super);
- function BsDaterangepickerInlineContainerComponent(_renderer, _config, _store, _element, _actions, _effects, _positioningService) {
- var _this = _super.call(this, _renderer, _config, _store, _element, _actions, _effects, _positioningService) || this;
- _renderer.setStyle(_element.nativeElement, 'display', 'inline-block');
- _renderer.setStyle(_element.nativeElement, 'position', 'static');
- return _this;
- }
- BsDaterangepickerInlineContainerComponent.decorators = [
- { type: Component, args: [{
- selector: 'bs-daterangepicker-inline-container',
- providers: [BsDatepickerStore, BsDatepickerEffects],
- template: "<!-- days calendar view mode -->\n<div class=\"bs-datepicker\" [ngClass]=\"containerClass\" *ngIf=\"viewMode | async\">\n <div class=\"bs-datepicker-container\"\n [@datepickerAnimation]=\"animationState\"\n (@datepickerAnimation.done)=\"positionServiceEnable()\">\n <!--calendars-->\n <div class=\"bs-calendar-container\" [ngSwitch]=\"viewMode | async\" role=\"application\">\n <!--days calendar-->\n <div *ngSwitchCase=\"'day'\" class=\"bs-media-container\">\n <bs-days-calendar-view\n *ngFor=\"let calendar of daysCalendar | async\"\n [class.bs-datepicker-multiple]=\"(daysCalendar | async)?.length > 1\"\n [calendar]=\"calendar\"\n [options]=\"options | async\"\n (onNavigate)=\"navigateTo($event)\"\n (onViewMode)=\"setViewMode($event)\"\n (onHover)=\"dayHoverHandler($event)\"\n (onHoverWeek)=\"weekHoverHandler($event)\"\n (onSelect)=\"daySelectHandler($event)\">\n </bs-days-calendar-view>\n </div>\n\n <!--months calendar-->\n <div *ngSwitchCase=\"'month'\" class=\"bs-media-container\">\n <bs-month-calendar-view\n *ngFor=\"let calendar of monthsCalendar | async\"\n [class.bs-datepicker-multiple]=\"(daysCalendar | async)?.length > 1\"\n [calendar]=\"calendar\"\n (onNavigate)=\"navigateTo($event)\"\n (onViewMode)=\"setViewMode($event)\"\n (onHover)=\"monthHoverHandler($event)\"\n (onSelect)=\"monthSelectHandler($event)\">\n </bs-month-calendar-view>\n </div>\n\n <!--years calendar-->\n <div *ngSwitchCase=\"'year'\" class=\"bs-media-container\">\n <bs-years-calendar-view\n *ngFor=\"let calendar of yearsCalendar | async\"\n [class.bs-datepicker-multiple]=\"(daysCalendar | async)?.length > 1\"\n [calendar]=\"calendar\"\n (onNavigate)=\"navigateTo($event)\"\n (onViewMode)=\"setViewMode($event)\"\n (onHover)=\"yearHoverHandler($event)\"\n (onSelect)=\"yearSelectHandler($event)\">\n </bs-years-calendar-view>\n </div>\n </div>\n\n <!--applycancel buttons-->\n <div class=\"bs-datepicker-buttons\" *ngIf=\"false\">\n <button class=\"btn btn-success\" type=\"button\">Apply</button>\n <button class=\"btn btn-default\" type=\"button\">Cancel</button>\n </div>\n </div>\n\n <!--custom dates or date ranges picker-->\n <div class=\"bs-datepicker-custom-range\" *ngIf=\"false\">\n <bs-custom-date-view [ranges]=\"_customRangesFish\"></bs-custom-date-view>\n </div>\n</div>\n",
- host: {
- '(click)': '_stopPropagation($event)'
- },
- animations: [datepickerAnimation]
- }] }
- ];
- /** @nocollapse */
- BsDaterangepickerInlineContainerComponent.ctorParameters = function () { return [
- { type: Renderer2 },
- { type: BsDatepickerConfig },
- { type: BsDatepickerStore },
- { type: ElementRef },
- { type: BsDatepickerActions },
- { type: BsDatepickerEffects },
- { type: PositioningService }
- ]; };
- return BsDaterangepickerInlineContainerComponent;
- }(BsDaterangepickerContainerComponent));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDaterangepickerInlineDirective = /** @class */ (function () {
- function BsDaterangepickerInlineDirective(_config, _elementRef, _renderer, _viewContainerRef, cis) {
- this._config = _config;
- this._elementRef = _elementRef;
- /**
- * Emits when daterangepicker value has been changed
- */
- this.bsValueChange = new EventEmitter();
- this._subs = [];
- // todo: assign only subset of fields
- Object.assign(this, this._config);
- this._datepicker = cis.createLoader(_elementRef, _viewContainerRef, _renderer);
- }
- Object.defineProperty(BsDaterangepickerInlineDirective.prototype, "bsValue", {
- /**
- * Initial value of datepicker
- */
- set: /**
- * Initial value of datepicker
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (this._bsValue === value) {
- return;
- }
- this._bsValue = value;
- this.bsValueChange.emit(value);
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- BsDaterangepickerInlineDirective.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this.setConfig();
- this._datepickerRef = this._datepicker
- .provide({ provide: BsDatepickerConfig, useValue: this._config })
- .attach(BsDaterangepickerInlineContainerComponent)
- .to(this._elementRef)
- .show();
- // if date changes from external source (model -> view)
- this._subs.push(this.bsValueChange.subscribe((/**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- _this._datepickerRef.instance.value = value;
- })));
- // if date changes from picker (view -> model)
- this._subs.push(this._datepickerRef.instance.valueChange
- .pipe(filter((/**
- * @param {?} range
- * @return {?}
- */
- function (range) { return range && range[0] && !!range[1]; })))
- .subscribe((/**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- _this.bsValue = value;
- })));
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- BsDaterangepickerInlineDirective.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- if (!this._datepickerRef || !this._datepickerRef.instance) {
- return;
- }
- if (changes.minDate) {
- this._datepickerRef.instance.minDate = this.minDate;
- }
- if (changes.maxDate) {
- this._datepickerRef.instance.maxDate = this.maxDate;
- }
- if (changes.datesDisabled) {
- this._datepickerRef.instance.datesDisabled = this.datesDisabled;
- }
- if (changes.isDisabled) {
- this._datepickerRef.instance.isDisabled = this.isDisabled;
- }
- if (changes.dateCustomClasses) {
- this._datepickerRef.instance.dateCustomClasses = this.dateCustomClasses;
- }
- };
- /**
- * Set config for datepicker
- */
- /**
- * Set config for datepicker
- * @return {?}
- */
- BsDaterangepickerInlineDirective.prototype.setConfig = /**
- * Set config for datepicker
- * @return {?}
- */
- function () {
- this._config = Object.assign({}, this._config, this.bsConfig, {
- value: this._bsValue,
- isDisabled: this.isDisabled,
- minDate: this.minDate || this.bsConfig && this.bsConfig.minDate,
- maxDate: this.maxDate || this.bsConfig && this.bsConfig.maxDate,
- dateCustomClasses: this.dateCustomClasses || this.bsConfig && this.bsConfig.dateCustomClasses,
- datesDisabled: this.datesDisabled || this.bsConfig && this.bsConfig.datesDisabled
- });
- };
- /**
- * @return {?}
- */
- BsDaterangepickerInlineDirective.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._datepicker.dispose();
- };
- BsDaterangepickerInlineDirective.decorators = [
- { type: Directive, args: [{
- selector: 'bs-daterangepicker-inline',
- exportAs: 'bsDaterangepickerInline'
- },] }
- ];
- /** @nocollapse */
- BsDaterangepickerInlineDirective.ctorParameters = function () { return [
- { type: BsDaterangepickerInlineConfig },
- { type: ElementRef },
- { type: Renderer2 },
- { type: ViewContainerRef },
- { type: ComponentLoaderFactory }
- ]; };
- BsDaterangepickerInlineDirective.propDecorators = {
- bsValue: [{ type: Input }],
- bsConfig: [{ type: Input }],
- isDisabled: [{ type: Input }],
- minDate: [{ type: Input }],
- maxDate: [{ type: Input }],
- dateCustomClasses: [{ type: Input }],
- datesDisabled: [{ type: Input }],
- bsValueChange: [{ type: Output }]
- };
- return BsDaterangepickerInlineDirective;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var BS_DATEPICKER_VALUE_ACCESSOR = {
- provide: NG_VALUE_ACCESSOR,
- /* tslint:disable-next-line: no-use-before-declare */
- useExisting: forwardRef((/**
- * @return {?}
- */
- function () { return BsDatepickerInputDirective; })),
- multi: true
- };
- /** @type {?} */
- var BS_DATEPICKER_VALIDATOR = {
- provide: NG_VALIDATORS,
- /* tslint:disable-next-line: no-use-before-declare */
- useExisting: forwardRef((/**
- * @return {?}
- */
- function () { return BsDatepickerInputDirective; })),
- multi: true
- };
- var BsDatepickerInputDirective = /** @class */ (function () {
- function BsDatepickerInputDirective(_picker, _localeService, _renderer, _elRef, changeDetection) {
- var _this = this;
- this._picker = _picker;
- this._localeService = _localeService;
- this._renderer = _renderer;
- this._elRef = _elRef;
- this.changeDetection = changeDetection;
- this._onChange = Function.prototype;
- this._onTouched = Function.prototype;
- /* tslint:disable-next-line: no-unused-variable */
- this._validatorChange = Function.prototype;
- // update input value on datepicker value update
- this._picker.bsValueChange.subscribe((/**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- _this._setInputValue(value);
- if (_this._value !== value) {
- _this._value = value;
- _this._onChange(value);
- _this._onTouched();
- }
- _this.changeDetection.markForCheck();
- }));
- // update input value on locale change
- this._localeService.localeChange.subscribe((/**
- * @return {?}
- */
- function () {
- _this._setInputValue(_this._value);
- }));
- }
- /**
- * @param {?} value
- * @return {?}
- */
- BsDatepickerInputDirective.prototype._setInputValue = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- /** @type {?} */
- var initialDate = !value ? ''
- : formatDate(value, this._picker._config.dateInputFormat, this._localeService.currentLocale);
- this._renderer.setProperty(this._elRef.nativeElement, 'value', initialDate);
- };
- /**
- * @param {?} event
- * @return {?}
- */
- BsDatepickerInputDirective.prototype.onChange = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /* tslint:disable-next-line: no-any*/
- this.writeValue(((/** @type {?} */ (event.target))).value);
- this._onChange(this._value);
- this._onTouched();
- };
- /**
- * @param {?} c
- * @return {?}
- */
- BsDatepickerInputDirective.prototype.validate = /**
- * @param {?} c
- * @return {?}
- */
- function (c) {
- /** @type {?} */
- var _value = c.value;
- /* tslint:disable-next-line: prefer-switch */
- if (_value === null || _value === undefined || _value === '') {
- return null;
- }
- if (isDate(_value)) {
- /** @type {?} */
- var _isDateValid = isDateValid(_value);
- if (!_isDateValid) {
- return { bsDate: { invalid: _value } };
- }
- if (this._picker && this._picker.minDate && isBefore(_value, this._picker.minDate, 'date')) {
- return { bsDate: { minDate: this._picker.minDate } };
- }
- if (this._picker && this._picker.maxDate && isAfter(_value, this._picker.maxDate, 'date')) {
- return { bsDate: { maxDate: this._picker.maxDate } };
- }
- }
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- BsDatepickerInputDirective.prototype.registerOnValidatorChange = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._validatorChange = fn;
- };
- /**
- * @param {?} value
- * @return {?}
- */
- BsDatepickerInputDirective.prototype.writeValue = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (!value) {
- this._value = null;
- }
- else {
- /** @type {?} */
- var _localeKey = this._localeService.currentLocale;
- /** @type {?} */
- var _locale = getLocale(_localeKey);
- if (!_locale) {
- throw new Error("Locale \"" + _localeKey + "\" is not defined, please add it with \"defineLocale(...)\"");
- }
- this._value = parseDate(value, this._picker._config.dateInputFormat, this._localeService.currentLocale);
- if (this._picker._config.useUtc) {
- this._value = utcAsLocal(this._value);
- }
- }
- this._picker.bsValue = this._value;
- };
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- BsDatepickerInputDirective.prototype.setDisabledState = /**
- * @param {?} isDisabled
- * @return {?}
- */
- function (isDisabled) {
- this._picker.isDisabled = isDisabled;
- if (isDisabled) {
- this._renderer.setAttribute(this._elRef.nativeElement, 'disabled', 'disabled');
- return;
- }
- this._renderer.removeAttribute(this._elRef.nativeElement, 'disabled');
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- BsDatepickerInputDirective.prototype.registerOnChange = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._onChange = fn;
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- BsDatepickerInputDirective.prototype.registerOnTouched = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._onTouched = fn;
- };
- /**
- * @return {?}
- */
- BsDatepickerInputDirective.prototype.onBlur = /**
- * @return {?}
- */
- function () {
- this._onTouched();
- };
- /**
- * @return {?}
- */
- BsDatepickerInputDirective.prototype.hide = /**
- * @return {?}
- */
- function () {
- this._picker.hide();
- this._renderer.selectRootElement(this._elRef.nativeElement).blur();
- };
- BsDatepickerInputDirective.decorators = [
- { type: Directive, args: [{
- selector: "input[bsDatepicker]",
- host: {
- '(change)': 'onChange($event)',
- '(keyup.esc)': 'hide()',
- '(blur)': 'onBlur()'
- },
- providers: [BS_DATEPICKER_VALUE_ACCESSOR, BS_DATEPICKER_VALIDATOR]
- },] }
- ];
- /** @nocollapse */
- BsDatepickerInputDirective.ctorParameters = function () { return [
- { type: BsDatepickerDirective, decorators: [{ type: Host }] },
- { type: BsLocaleService },
- { type: Renderer2 },
- { type: ElementRef },
- { type: ChangeDetectorRef }
- ]; };
- return BsDatepickerInputDirective;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDaterangepickerConfig = /** @class */ (function (_super) {
- __extends(BsDaterangepickerConfig, _super);
- function BsDaterangepickerConfig() {
- var _this = _super !== null && _super.apply(this, arguments) || this;
- // DatepickerRenderOptions
- _this.displayMonths = 2;
- return _this;
- }
- BsDaterangepickerConfig.decorators = [
- { type: Injectable }
- ];
- return BsDaterangepickerConfig;
- }(BsDatepickerConfig));
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDaterangepickerDirective = /** @class */ (function () {
- function BsDaterangepickerDirective(_config, _elementRef, _renderer, _viewContainerRef, cis) {
- this._config = _config;
- /**
- * Placement of a daterangepicker. Accepts: "top", "bottom", "left", "right"
- */
- this.placement = 'bottom';
- /**
- * Specifies events that should trigger. Supports a space separated list of
- * event names.
- */
- this.triggers = 'click';
- /**
- * Close daterangepicker on outside click
- */
- this.outsideClick = true;
- /**
- * A selector specifying the element the daterangepicker should be appended to.
- */
- this.container = 'body';
- this.outsideEsc = true;
- /**
- * Emits when daterangepicker value has been changed
- */
- this.bsValueChange = new EventEmitter();
- this._subs = [];
- this._datepicker = cis.createLoader(_elementRef, _viewContainerRef, _renderer);
- Object.assign(this, _config);
- this.onShown = this._datepicker.onShown;
- this.onHidden = this._datepicker.onHidden;
- }
- Object.defineProperty(BsDaterangepickerDirective.prototype, "isOpen", {
- /**
- * Returns whether or not the daterangepicker is currently being shown
- */
- get: /**
- * Returns whether or not the daterangepicker is currently being shown
- * @return {?}
- */
- function () {
- return this._datepicker.isShown;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (value) {
- this.show();
- }
- else {
- this.hide();
- }
- },
- enumerable: true,
- configurable: true
- });
- Object.defineProperty(BsDaterangepickerDirective.prototype, "bsValue", {
- /**
- * Initial value of daterangepicker
- */
- set: /**
- * Initial value of daterangepicker
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (this._bsValue === value) {
- return;
- }
- this._bsValue = value;
- this.bsValueChange.emit(value);
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- BsDaterangepickerDirective.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- this._datepicker.listen({
- outsideClick: this.outsideClick,
- outsideEsc: this.outsideEsc,
- triggers: this.triggers,
- show: (/**
- * @return {?}
- */
- function () { return _this.show(); })
- });
- this.setConfig();
- };
- /**
- * @param {?} changes
- * @return {?}
- */
- BsDaterangepickerDirective.prototype.ngOnChanges = /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- if (!this._datepickerRef || !this._datepickerRef.instance) {
- return;
- }
- if (changes.minDate) {
- this._datepickerRef.instance.minDate = this.minDate;
- }
- if (changes.maxDate) {
- this._datepickerRef.instance.maxDate = this.maxDate;
- }
- if (changes.datesDisabled) {
- this._datepickerRef.instance.datesDisabled = this.datesDisabled;
- }
- if (changes.isDisabled) {
- this._datepickerRef.instance.isDisabled = this.isDisabled;
- }
- if (changes.dateCustomClasses) {
- this._datepickerRef.instance.dateCustomClasses = this.dateCustomClasses;
- }
- };
- /**
- * Opens an element’s datepicker. This is considered a “manual” triggering of
- * the datepicker.
- */
- /**
- * Opens an element’s datepicker. This is considered a “manual” triggering of
- * the datepicker.
- * @return {?}
- */
- BsDaterangepickerDirective.prototype.show = /**
- * Opens an element’s datepicker. This is considered a “manual” triggering of
- * the datepicker.
- * @return {?}
- */
- function () {
- var _this = this;
- if (this._datepicker.isShown) {
- return;
- }
- this.setConfig();
- this._datepickerRef = this._datepicker
- .provide({ provide: BsDatepickerConfig, useValue: this._config })
- .attach(BsDaterangepickerContainerComponent)
- .to(this.container)
- .position({ attachment: this.placement })
- .show({ placement: this.placement });
- // if date changes from external source (model -> view)
- this._subs.push(this.bsValueChange.subscribe((/**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- _this._datepickerRef.instance.value = value;
- })));
- // if date changes from picker (view -> model)
- this._subs.push(this._datepickerRef.instance.valueChange
- .pipe(filter((/**
- * @param {?} range
- * @return {?}
- */
- function (range) { return range && range[0] && !!range[1]; })))
- .subscribe((/**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- _this.bsValue = value;
- _this.hide();
- })));
- };
- /**
- * Set config for daterangepicker
- */
- /**
- * Set config for daterangepicker
- * @return {?}
- */
- BsDaterangepickerDirective.prototype.setConfig = /**
- * Set config for daterangepicker
- * @return {?}
- */
- function () {
- this._config = Object.assign({}, this._config, this.bsConfig, {
- value: this._bsValue,
- isDisabled: this.isDisabled,
- minDate: this.minDate || this.bsConfig && this.bsConfig.minDate,
- maxDate: this.maxDate || this.bsConfig && this.bsConfig.maxDate,
- dateCustomClasses: this.dateCustomClasses || this.bsConfig && this.bsConfig.dateCustomClasses,
- datesDisabled: this.datesDisabled || this.bsConfig && this.bsConfig.datesDisabled
- });
- };
- /**
- * Closes an element’s datepicker. This is considered a “manual” triggering of
- * the datepicker.
- */
- /**
- * Closes an element’s datepicker. This is considered a “manual” triggering of
- * the datepicker.
- * @return {?}
- */
- BsDaterangepickerDirective.prototype.hide = /**
- * Closes an element’s datepicker. This is considered a “manual” triggering of
- * the datepicker.
- * @return {?}
- */
- function () {
- var e_1, _a;
- if (this.isOpen) {
- this._datepicker.hide();
- }
- try {
- for (var _b = __values(this._subs), _c = _b.next(); !_c.done; _c = _b.next()) {
- var sub = _c.value;
- sub.unsubscribe();
- }
- }
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
- finally {
- try {
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
- }
- finally { if (e_1) throw e_1.error; }
- }
- };
- /**
- * Toggles an element’s datepicker. This is considered a “manual” triggering
- * of the datepicker.
- */
- /**
- * Toggles an element’s datepicker. This is considered a “manual” triggering
- * of the datepicker.
- * @return {?}
- */
- BsDaterangepickerDirective.prototype.toggle = /**
- * Toggles an element’s datepicker. This is considered a “manual” triggering
- * of the datepicker.
- * @return {?}
- */
- function () {
- if (this.isOpen) {
- return this.hide();
- }
- this.show();
- };
- /**
- * @return {?}
- */
- BsDaterangepickerDirective.prototype.ngOnDestroy = /**
- * @return {?}
- */
- function () {
- this._datepicker.dispose();
- };
- BsDaterangepickerDirective.decorators = [
- { type: Directive, args: [{
- selector: '[bsDaterangepicker]',
- exportAs: 'bsDaterangepicker'
- },] }
- ];
- /** @nocollapse */
- BsDaterangepickerDirective.ctorParameters = function () { return [
- { type: BsDaterangepickerConfig },
- { type: ElementRef },
- { type: Renderer2 },
- { type: ViewContainerRef },
- { type: ComponentLoaderFactory }
- ]; };
- BsDaterangepickerDirective.propDecorators = {
- placement: [{ type: Input }],
- triggers: [{ type: Input }],
- outsideClick: [{ type: Input }],
- container: [{ type: Input }],
- outsideEsc: [{ type: Input }],
- isOpen: [{ type: Input }],
- onShown: [{ type: Output }],
- onHidden: [{ type: Output }],
- bsValue: [{ type: Input }],
- bsConfig: [{ type: Input }],
- isDisabled: [{ type: Input }],
- minDate: [{ type: Input }],
- maxDate: [{ type: Input }],
- dateCustomClasses: [{ type: Input }],
- datesDisabled: [{ type: Input }],
- bsValueChange: [{ type: Output }]
- };
- return BsDaterangepickerDirective;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var BS_DATERANGEPICKER_VALUE_ACCESSOR = {
- provide: NG_VALUE_ACCESSOR,
- /* tslint:disable-next-line: no-use-before-declare */
- useExisting: forwardRef((/**
- * @return {?}
- */
- function () { return BsDaterangepickerInputDirective; })),
- multi: true
- };
- /** @type {?} */
- var BS_DATERANGEPICKER_VALIDATOR = {
- provide: NG_VALIDATORS,
- /* tslint:disable-next-line: no-use-before-declare */
- useExisting: forwardRef((/**
- * @return {?}
- */
- function () { return BsDaterangepickerInputDirective; })),
- multi: true
- };
- var BsDaterangepickerInputDirective = /** @class */ (function () {
- function BsDaterangepickerInputDirective(_picker, _localeService, _renderer, _elRef, changeDetection) {
- var _this = this;
- this._picker = _picker;
- this._localeService = _localeService;
- this._renderer = _renderer;
- this._elRef = _elRef;
- this.changeDetection = changeDetection;
- this._onChange = Function.prototype;
- this._onTouched = Function.prototype;
- /* tslint:disable-next-line: no-unused-variable */
- this._validatorChange = Function.prototype;
- // update input value on datepicker value update
- this._picker.bsValueChange.subscribe((/**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- _this._setInputValue(value);
- if (_this._value !== value) {
- _this._value = value;
- _this._onChange(value);
- _this._onTouched();
- }
- _this.changeDetection.markForCheck();
- }));
- // update input value on locale change
- this._localeService.localeChange.subscribe((/**
- * @return {?}
- */
- function () {
- _this._setInputValue(_this._value);
- }));
- }
- /**
- * @param {?} date
- * @return {?}
- */
- BsDaterangepickerInputDirective.prototype._setInputValue = /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- /** @type {?} */
- var range = '';
- if (date) {
- /** @type {?} */
- var start = !date[0] ? ''
- : formatDate(date[0], this._picker._config.rangeInputFormat, this._localeService.currentLocale);
- /** @type {?} */
- var end = !date[1] ? ''
- : formatDate(date[1], this._picker._config.rangeInputFormat, this._localeService.currentLocale);
- range = (start && end) ? start + this._picker._config.rangeSeparator + end : '';
- }
- this._renderer.setProperty(this._elRef.nativeElement, 'value', range);
- };
- /**
- * @param {?} event
- * @return {?}
- */
- BsDaterangepickerInputDirective.prototype.onChange = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /* tslint:disable-next-line: no-any*/
- this.writeValue(((/** @type {?} */ (event.target))).value);
- this._onChange(this._value);
- this._onTouched();
- };
- /**
- * @param {?} c
- * @return {?}
- */
- BsDaterangepickerInputDirective.prototype.validate = /**
- * @param {?} c
- * @return {?}
- */
- function (c) {
- /** @type {?} */
- var _value = c.value;
- if (_value === null || _value === undefined || !isArray(_value)) {
- return null;
- }
- /** @type {?} */
- var _isFirstDateValid = isDateValid(_value[0]);
- /** @type {?} */
- var _isSecondDateValid = isDateValid(_value[1]);
- if (!_isFirstDateValid) {
- return { bsDate: { invalid: _value[0] } };
- }
- if (!_isSecondDateValid) {
- return { bsDate: { invalid: _value[1] } };
- }
- if (this._picker && this._picker.minDate && isBefore(_value[0], this._picker.minDate, 'date')) {
- return { bsDate: { minDate: this._picker.minDate } };
- }
- if (this._picker && this._picker.maxDate && isAfter(_value[1], this._picker.maxDate, 'date')) {
- return { bsDate: { maxDate: this._picker.maxDate } };
- }
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- BsDaterangepickerInputDirective.prototype.registerOnValidatorChange = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._validatorChange = fn;
- };
- /**
- * @param {?} value
- * @return {?}
- */
- BsDaterangepickerInputDirective.prototype.writeValue = /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- var _this = this;
- if (!value) {
- this._value = null;
- }
- else {
- /** @type {?} */
- var _localeKey = this._localeService.currentLocale;
- /** @type {?} */
- var _locale = getLocale(_localeKey);
- if (!_locale) {
- throw new Error("Locale \"" + _localeKey + "\" is not defined, please add it with \"defineLocale(...)\"");
- }
- /** @type {?} */
- var _input = [];
- if (typeof value === 'string') {
- _input = value.split(this._picker._config.rangeSeparator);
- }
- if (Array.isArray(value)) {
- _input = value;
- }
- this._value = ((/** @type {?} */ (_input)))
- .map((/**
- * @param {?} _val
- * @return {?}
- */
- function (_val) {
- if (_this._picker._config.useUtc) {
- return utcAsLocal(parseDate(_val, _this._picker._config.dateInputFormat, _this._localeService.currentLocale));
- }
- return parseDate(_val, _this._picker._config.dateInputFormat, _this._localeService.currentLocale);
- }))
- .map((/**
- * @param {?} date
- * @return {?}
- */
- function (date) { return (isNaN(date.valueOf()) ? null : date); }));
- }
- this._picker.bsValue = this._value;
- };
- /**
- * @param {?} isDisabled
- * @return {?}
- */
- BsDaterangepickerInputDirective.prototype.setDisabledState = /**
- * @param {?} isDisabled
- * @return {?}
- */
- function (isDisabled) {
- this._picker.isDisabled = isDisabled;
- if (isDisabled) {
- this._renderer.setAttribute(this._elRef.nativeElement, 'disabled', 'disabled');
- return;
- }
- this._renderer.removeAttribute(this._elRef.nativeElement, 'disabled');
- };
- /* tslint:disable-next-line: no-any*/
- /* tslint:disable-next-line: no-any*/
- /**
- * @param {?} fn
- * @return {?}
- */
- BsDaterangepickerInputDirective.prototype.registerOnChange = /* tslint:disable-next-line: no-any*/
- /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._onChange = fn;
- };
- /* tslint:disable-next-line: no-any*/
- /* tslint:disable-next-line: no-any*/
- /**
- * @param {?} fn
- * @return {?}
- */
- BsDaterangepickerInputDirective.prototype.registerOnTouched = /* tslint:disable-next-line: no-any*/
- /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this._onTouched = fn;
- };
- /**
- * @return {?}
- */
- BsDaterangepickerInputDirective.prototype.onBlur = /**
- * @return {?}
- */
- function () {
- this._onTouched();
- };
- /**
- * @return {?}
- */
- BsDaterangepickerInputDirective.prototype.hide = /**
- * @return {?}
- */
- function () {
- this._picker.hide();
- this._renderer.selectRootElement(this._elRef.nativeElement).blur();
- };
- BsDaterangepickerInputDirective.decorators = [
- { type: Directive, args: [{
- selector: "input[bsDaterangepicker]",
- host: {
- '(change)': 'onChange($event)',
- '(keyup.esc)': 'hide()',
- '(blur)': 'onBlur()'
- },
- providers: [BS_DATERANGEPICKER_VALUE_ACCESSOR, BS_DATERANGEPICKER_VALIDATOR]
- },] }
- ];
- /** @nocollapse */
- BsDaterangepickerInputDirective.ctorParameters = function () { return [
- { type: BsDaterangepickerDirective, decorators: [{ type: Host }] },
- { type: BsLocaleService },
- { type: Renderer2 },
- { type: ElementRef },
- { type: ChangeDetectorRef }
- ]; };
- return BsDaterangepickerInputDirective;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsCalendarLayoutComponent = /** @class */ (function () {
- function BsCalendarLayoutComponent() {
- }
- BsCalendarLayoutComponent.decorators = [
- { type: Component, args: [{
- selector: 'bs-calendar-layout',
- template: "\n <!-- current date, will be added in nearest releases -->\n <bs-current-date title=\"hey there\" *ngIf=\"false\"></bs-current-date>\n\n <!--navigation-->\n <div class=\"bs-datepicker-head\">\n <ng-content select=\"bs-datepicker-navigation-view\"></ng-content>\n </div>\n\n <div class=\"bs-datepicker-body\">\n <ng-content></ng-content>\n </div>\n\n <!--timepicker-->\n <bs-timepicker *ngIf=\"false\"></bs-timepicker>\n "
- }] }
- ];
- return BsCalendarLayoutComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsCurrentDateViewComponent = /** @class */ (function () {
- function BsCurrentDateViewComponent() {
- }
- BsCurrentDateViewComponent.decorators = [
- { type: Component, args: [{
- selector: 'bs-current-date',
- template: "<div class=\"current-timedate\"><span>{{ title }}</span></div>"
- }] }
- ];
- BsCurrentDateViewComponent.propDecorators = {
- title: [{ type: Input }]
- };
- return BsCurrentDateViewComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsCustomDatesViewComponent = /** @class */ (function () {
- function BsCustomDatesViewComponent() {
- }
- BsCustomDatesViewComponent.decorators = [
- { type: Component, args: [{
- selector: 'bs-custom-date-view',
- template: "\n <div class=\"bs-datepicker-predefined-btns\">\n <button *ngFor=\"let range of ranges\" type=\"button\">{{ range.label }}</button>\n <button *ngIf=\"isCustomRangeShown\" type=\"button\">Custom Range</button>\n </div>\n ",
- changeDetection: ChangeDetectionStrategy.OnPush
- }] }
- ];
- BsCustomDatesViewComponent.propDecorators = {
- isCustomRangeShown: [{ type: Input }],
- ranges: [{ type: Input }]
- };
- return BsCustomDatesViewComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDatepickerDayDecoratorComponent = /** @class */ (function () {
- function BsDatepickerDayDecoratorComponent(_config, _elRef, _renderer) {
- this._config = _config;
- this._elRef = _elRef;
- this._renderer = _renderer;
- }
- /**
- * @return {?}
- */
- BsDatepickerDayDecoratorComponent.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- var _this = this;
- if (this.day.isToday && this._config && this._config.customTodayClass) {
- this._renderer.addClass(this._elRef.nativeElement, this._config.customTodayClass);
- }
- if (typeof this.day.customClasses === 'string') {
- this.day.customClasses.split(' ')
- .filter((/**
- * @param {?} className
- * @return {?}
- */
- function (className) { return className; }))
- .forEach((/**
- * @param {?} className
- * @return {?}
- */
- function (className) {
- _this._renderer.addClass(_this._elRef.nativeElement, className);
- }));
- }
- };
- BsDatepickerDayDecoratorComponent.decorators = [
- { type: Component, args: [{
- selector: '[bsDatepickerDayDecorator]',
- changeDetection: ChangeDetectionStrategy.OnPush,
- host: {
- '[class.disabled]': 'day.isDisabled',
- '[class.is-highlighted]': 'day.isHovered',
- '[class.is-other-month]': 'day.isOtherMonth',
- '[class.is-active-other-month]': 'day.isOtherMonthHovered',
- '[class.in-range]': 'day.isInRange',
- '[class.select-start]': 'day.isSelectionStart',
- '[class.select-end]': 'day.isSelectionEnd',
- '[class.selected]': 'day.isSelected'
- },
- template: "{{ day.label }}"
- }] }
- ];
- /** @nocollapse */
- BsDatepickerDayDecoratorComponent.ctorParameters = function () { return [
- { type: BsDatepickerConfig },
- { type: ElementRef },
- { type: Renderer2 }
- ]; };
- BsDatepickerDayDecoratorComponent.propDecorators = {
- day: [{ type: Input }]
- };
- return BsDatepickerDayDecoratorComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @enum {number} */
- var BsNavigationDirection = {
- UP: 0,
- DOWN: 1,
- };
- BsNavigationDirection[BsNavigationDirection.UP] = 'UP';
- BsNavigationDirection[BsNavigationDirection.DOWN] = 'DOWN';
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDatepickerNavigationViewComponent = /** @class */ (function () {
- function BsDatepickerNavigationViewComponent() {
- this.onNavigate = new EventEmitter();
- this.onViewMode = new EventEmitter();
- }
- /**
- * @param {?} down
- * @return {?}
- */
- BsDatepickerNavigationViewComponent.prototype.navTo = /**
- * @param {?} down
- * @return {?}
- */
- function (down) {
- this.onNavigate.emit(down ? BsNavigationDirection.DOWN : BsNavigationDirection.UP);
- };
- /**
- * @param {?} viewMode
- * @return {?}
- */
- BsDatepickerNavigationViewComponent.prototype.view = /**
- * @param {?} viewMode
- * @return {?}
- */
- function (viewMode) {
- this.onViewMode.emit(viewMode);
- };
- BsDatepickerNavigationViewComponent.decorators = [
- { type: Component, args: [{
- selector: 'bs-datepicker-navigation-view',
- changeDetection: ChangeDetectionStrategy.OnPush,
- template: "\n <button class=\"previous\"\n [disabled]=\"calendar.disableLeftArrow\"\n [style.visibility]=\"calendar.hideLeftArrow ? 'hidden' : 'visible'\"\n type=\"button\"\n (click)=\"navTo(true)\">\n <span>‹</span>\n </button>\n\n ​ <!-- zero-width space needed for correct alignement\n with preserveWhitespaces: false in Angular -->\n\n <button class=\"current\"\n *ngIf=\"calendar.monthTitle\"\n type=\"button\"\n (click)=\"view('month')\">\n <span>{{ calendar.monthTitle }}</span>\n </button>\n\n ​ <!-- zero-width space needed for correct alignement\n with preserveWhitespaces: false in Angular -->\n\n <button class=\"current\" (click)=\"view('year')\" type=\"button\">\n <span>{{ calendar.yearTitle }}</span>\n </button>\n\n ​ <!-- zero-width space needed for correct alignement\n with preserveWhitespaces: false in Angular -->\n\n <button class=\"next\"\n [disabled]=\"calendar.disableRightArrow\"\n [style.visibility]=\"calendar.hideRightArrow ? 'hidden' : 'visible'\"\n type=\"button\"\n (click)=\"navTo(false)\"><span>›</span>\n </button>\n "
- }] }
- ];
- BsDatepickerNavigationViewComponent.propDecorators = {
- calendar: [{ type: Input }],
- onNavigate: [{ type: Output }],
- onViewMode: [{ type: Output }]
- };
- return BsDatepickerNavigationViewComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsDaysCalendarViewComponent = /** @class */ (function () {
- function BsDaysCalendarViewComponent(_config) {
- this._config = _config;
- this.onNavigate = new EventEmitter();
- this.onViewMode = new EventEmitter();
- this.onSelect = new EventEmitter();
- this.onHover = new EventEmitter();
- this.onHoverWeek = new EventEmitter();
- }
- /**
- * @param {?} event
- * @return {?}
- */
- BsDaysCalendarViewComponent.prototype.navigateTo = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var step = BsNavigationDirection.DOWN === event ? -1 : 1;
- this.onNavigate.emit({ step: { month: step } });
- };
- /**
- * @param {?} event
- * @return {?}
- */
- BsDaysCalendarViewComponent.prototype.changeViewMode = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- this.onViewMode.emit(event);
- };
- /**
- * @param {?} event
- * @return {?}
- */
- BsDaysCalendarViewComponent.prototype.selectDay = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- this.onSelect.emit(event);
- };
- /**
- * @param {?} week
- * @return {?}
- */
- BsDaysCalendarViewComponent.prototype.selectWeek = /**
- * @param {?} week
- * @return {?}
- */
- function (week) {
- var _this = this;
- if (!this._config.selectWeek) {
- return;
- }
- if (week.days
- && week.days[0]
- && !week.days[0].isDisabled
- && this._config.selectFromOtherMonth) {
- this.onSelect.emit(week.days[0]);
- return;
- }
- if (week.days.length === 0) {
- return;
- }
- /** @type {?} */
- var selectedDay = week.days.find((/**
- * @param {?} day
- * @return {?}
- */
- function (day) {
- return _this._config.selectFromOtherMonth
- ? !day.isDisabled
- : !day.isOtherMonth && !day.isDisabled;
- }));
- this.onSelect.emit(selectedDay);
- };
- /**
- * @param {?} cell
- * @param {?} isHovered
- * @return {?}
- */
- BsDaysCalendarViewComponent.prototype.weekHoverHandler = /**
- * @param {?} cell
- * @param {?} isHovered
- * @return {?}
- */
- function (cell, isHovered) {
- var _this = this;
- if (!this._config.selectWeek) {
- return;
- }
- /** @type {?} */
- var hasActiveDays = cell.days.find((/**
- * @param {?} day
- * @return {?}
- */
- function (day) {
- return _this._config.selectFromOtherMonth
- ? !day.isDisabled
- : !day.isOtherMonth && !day.isDisabled;
- }));
- if (hasActiveDays) {
- cell.isHovered = isHovered;
- this.isWeekHovered = isHovered;
- this.onHoverWeek.emit(cell);
- }
- };
- /**
- * @param {?} cell
- * @param {?} isHovered
- * @return {?}
- */
- BsDaysCalendarViewComponent.prototype.hoverDay = /**
- * @param {?} cell
- * @param {?} isHovered
- * @return {?}
- */
- function (cell, isHovered) {
- if (this._config.selectFromOtherMonth && cell.isOtherMonth) {
- cell.isOtherMonthHovered = isHovered;
- }
- this.onHover.emit({ cell: cell, isHovered: isHovered });
- };
- BsDaysCalendarViewComponent.decorators = [
- { type: Component, args: [{
- selector: 'bs-days-calendar-view',
- // changeDetection: ChangeDetectionStrategy.OnPush,
- template: "\n <bs-calendar-layout>\n <bs-datepicker-navigation-view\n [calendar]=\"calendar\"\n (onNavigate)=\"navigateTo($event)\"\n (onViewMode)=\"changeViewMode($event)\"\n ></bs-datepicker-navigation-view>\n\n <!--days matrix-->\n <table role=\"grid\" class=\"days weeks\">\n <thead>\n <tr>\n <!--if show weeks-->\n <th *ngIf=\"options.showWeekNumbers\"></th>\n <th *ngFor=\"let weekday of calendar.weekdays; let i = index\"\n aria-label=\"weekday\">{{ calendar.weekdays[i] }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let week of calendar.weeks; let i = index\">\n <td class=\"week\" [class.active-week]=\"isWeekHovered\" *ngIf=\"options.showWeekNumbers\">\n <span\n (click)=\"selectWeek(week)\"\n (mouseenter)=\"weekHoverHandler(week, true)\"\n (mouseleave)=\"weekHoverHandler(week, false)\">{{ calendar.weekNumbers[i] }}</span>\n </td>\n <td *ngFor=\"let day of week.days\" role=\"gridcell\">\n <span bsDatepickerDayDecorator\n [day]=\"day\"\n (click)=\"selectDay(day)\"\n (mouseenter)=\"hoverDay(day, true)\"\n (mouseleave)=\"hoverDay(day, false)\">{{ day.label }}</span>\n </td>\n </tr>\n </tbody>\n </table>\n\n </bs-calendar-layout>\n "
- }] }
- ];
- /** @nocollapse */
- BsDaysCalendarViewComponent.ctorParameters = function () { return [
- { type: BsDatepickerConfig }
- ]; };
- BsDaysCalendarViewComponent.propDecorators = {
- calendar: [{ type: Input }],
- options: [{ type: Input }],
- onNavigate: [{ type: Output }],
- onViewMode: [{ type: Output }],
- onSelect: [{ type: Output }],
- onHover: [{ type: Output }],
- onHoverWeek: [{ type: Output }]
- };
- return BsDaysCalendarViewComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsMonthCalendarViewComponent = /** @class */ (function () {
- function BsMonthCalendarViewComponent() {
- this.onNavigate = new EventEmitter();
- this.onViewMode = new EventEmitter();
- this.onSelect = new EventEmitter();
- this.onHover = new EventEmitter();
- }
- /**
- * @param {?} event
- * @return {?}
- */
- BsMonthCalendarViewComponent.prototype.navigateTo = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var step = BsNavigationDirection.DOWN === event ? -1 : 1;
- this.onNavigate.emit({ step: { year: step } });
- };
- /**
- * @param {?} month
- * @return {?}
- */
- BsMonthCalendarViewComponent.prototype.viewMonth = /**
- * @param {?} month
- * @return {?}
- */
- function (month) {
- this.onSelect.emit(month);
- };
- /**
- * @param {?} cell
- * @param {?} isHovered
- * @return {?}
- */
- BsMonthCalendarViewComponent.prototype.hoverMonth = /**
- * @param {?} cell
- * @param {?} isHovered
- * @return {?}
- */
- function (cell, isHovered) {
- this.onHover.emit({ cell: cell, isHovered: isHovered });
- };
- /**
- * @param {?} event
- * @return {?}
- */
- BsMonthCalendarViewComponent.prototype.changeViewMode = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- this.onViewMode.emit(event);
- };
- BsMonthCalendarViewComponent.decorators = [
- { type: Component, args: [{
- selector: 'bs-month-calendar-view',
- template: "\n <bs-calendar-layout>\n <bs-datepicker-navigation-view\n [calendar]=\"calendar\"\n (onNavigate)=\"navigateTo($event)\"\n (onViewMode)=\"changeViewMode($event)\"\n ></bs-datepicker-navigation-view>\n\n <table role=\"grid\" class=\"months\">\n <tbody>\n <tr *ngFor=\"let row of calendar.months\">\n <td *ngFor=\"let month of row\" role=\"gridcell\"\n (click)=\"viewMonth(month)\"\n (mouseenter)=\"hoverMonth(month, true)\"\n (mouseleave)=\"hoverMonth(month, false)\"\n [class.disabled]=\"month.isDisabled\"\n [class.is-highlighted]=\"month.isHovered\">\n <span [class.selected]=\"month.isSelected\">{{ month.label }}</span>\n </td>\n </tr>\n </tbody>\n </table>\n </bs-calendar-layout>\n "
- }] }
- ];
- BsMonthCalendarViewComponent.propDecorators = {
- calendar: [{ type: Input }],
- onNavigate: [{ type: Output }],
- onViewMode: [{ type: Output }],
- onSelect: [{ type: Output }],
- onHover: [{ type: Output }]
- };
- return BsMonthCalendarViewComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsTimepickerViewComponent = /** @class */ (function () {
- function BsTimepickerViewComponent() {
- this.ampm = 'ok';
- this.hours = 0;
- this.minutes = 0;
- }
- BsTimepickerViewComponent.decorators = [
- { type: Component, args: [{
- selector: 'bs-timepicker',
- template: "\n <div class=\"bs-timepicker-container\">\n <div class=\"bs-timepicker-controls\">\n <button class=\"bs-decrease\" type=\"button\">-</button>\n <input type=\"text\" [value]=\"hours\" placeholder=\"00\">\n <button class=\"bs-increase\" type=\"button\">+</button>\n </div>\n <div class=\"bs-timepicker-controls\">\n <button class=\"bs-decrease\" type=\"button\">-</button>\n <input type=\"text\" [value]=\"minutes\" placeholder=\"00\">\n <button class=\"bs-increase\" type=\"button\">+</button>\n </div>\n <button class=\"switch-time-format\" type=\"button\">{{ ampm }}\n <img\n src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAKCAYAAABi8KSDAAABSElEQVQYV3XQPUvDUBQG4HNuagtVqc6KgouCv6GIuIntYBLB9hcIQpLStCAIV7DYmpTcRWcXqZio3Vwc/UCc/QEqfgyKGbr0I7nS1EiHeqYzPO/h5SD0jaxUZjmSLCB+OFb+UFINFwASAEAdpu9gaGXVyAHHFQBkHpKHc6a9dzECvADyY9sqlAMsK9W0jzxDXqeytr3mhQckxSji27TJJ5/rPmIpwJJq3HrtduriYOurv1a4i1p5HnhkG9OFymi0ReoO05cGwb+ayv4dysVygjeFmsP05f8wpZQ8fsdvfmuY9zjWSNqUtgYFVnOVReILYoBFzdQI5/GGFzNHhGbeZnopDGU29sZbscgldmC99w35VOATTycIMMcBXIfpSVGzZhA6C8hh00conln6VQ9TGgV32OEAKQC4DrBq7CJwd0ggR7Vq/rPrfgB+C3sGypY5DAAAAABJRU5ErkJggg==\"\n alt=\"\">\n </button>\n </div>\n "
- }] }
- ];
- return BsTimepickerViewComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var BsYearsCalendarViewComponent = /** @class */ (function () {
- function BsYearsCalendarViewComponent() {
- this.onNavigate = new EventEmitter();
- this.onViewMode = new EventEmitter();
- this.onSelect = new EventEmitter();
- this.onHover = new EventEmitter();
- }
- /**
- * @param {?} event
- * @return {?}
- */
- BsYearsCalendarViewComponent.prototype.navigateTo = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- /** @type {?} */
- var step = BsNavigationDirection.DOWN === event ? -1 : 1;
- this.onNavigate.emit({ step: { year: step * yearsPerCalendar } });
- };
- /**
- * @param {?} year
- * @return {?}
- */
- BsYearsCalendarViewComponent.prototype.viewYear = /**
- * @param {?} year
- * @return {?}
- */
- function (year) {
- this.onSelect.emit(year);
- };
- /**
- * @param {?} cell
- * @param {?} isHovered
- * @return {?}
- */
- BsYearsCalendarViewComponent.prototype.hoverYear = /**
- * @param {?} cell
- * @param {?} isHovered
- * @return {?}
- */
- function (cell, isHovered) {
- this.onHover.emit({ cell: cell, isHovered: isHovered });
- };
- /**
- * @param {?} event
- * @return {?}
- */
- BsYearsCalendarViewComponent.prototype.changeViewMode = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- this.onViewMode.emit(event);
- };
- BsYearsCalendarViewComponent.decorators = [
- { type: Component, args: [{
- selector: 'bs-years-calendar-view',
- template: "\n <bs-calendar-layout>\n <bs-datepicker-navigation-view\n [calendar]=\"calendar\"\n (onNavigate)=\"navigateTo($event)\"\n (onViewMode)=\"changeViewMode($event)\"\n ></bs-datepicker-navigation-view>\n\n <table role=\"grid\" class=\"years\">\n <tbody>\n <tr *ngFor=\"let row of calendar.years\">\n <td *ngFor=\"let year of row\" role=\"gridcell\"\n (click)=\"viewYear(year)\"\n (mouseenter)=\"hoverYear(year, true)\"\n (mouseleave)=\"hoverYear(year, false)\"\n [class.disabled]=\"year.isDisabled\"\n [class.is-highlighted]=\"year.isHovered\">\n <span [class.selected]=\"year.isSelected\">{{ year.label }}</span>\n </td>\n </tr>\n </tbody>\n </table>\n </bs-calendar-layout>\n "
- }] }
- ];
- BsYearsCalendarViewComponent.propDecorators = {
- calendar: [{ type: Input }],
- onNavigate: [{ type: Output }],
- onViewMode: [{ type: Output }],
- onSelect: [{ type: Output }],
- onHover: [{ type: Output }]
- };
- return BsYearsCalendarViewComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var _exports = [
- BsDatepickerContainerComponent,
- BsDatepickerDirective,
- BsDatepickerInlineContainerComponent,
- BsDatepickerInlineDirective,
- BsDatepickerInputDirective,
- BsDaterangepickerContainerComponent,
- BsDaterangepickerDirective,
- BsDaterangepickerInlineContainerComponent,
- BsDaterangepickerInlineDirective,
- BsDaterangepickerInputDirective
- ];
- var BsDatepickerModule = /** @class */ (function () {
- function BsDatepickerModule() {
- }
- /**
- * @return {?}
- */
- BsDatepickerModule.forRoot = /**
- * @return {?}
- */
- function () {
- return {
- ngModule: BsDatepickerModule,
- providers: [
- ComponentLoaderFactory,
- PositioningService,
- BsDatepickerStore,
- BsDatepickerActions,
- BsDatepickerConfig,
- BsDaterangepickerConfig,
- BsDatepickerInlineConfig,
- BsDaterangepickerInlineConfig,
- BsDatepickerEffects,
- BsLocaleService
- ]
- };
- };
- BsDatepickerModule.decorators = [
- { type: NgModule, args: [{
- imports: [CommonModule],
- declarations: __spread([
- BsCalendarLayoutComponent,
- BsCurrentDateViewComponent,
- BsCustomDatesViewComponent,
- BsDatepickerDayDecoratorComponent,
- BsDatepickerNavigationViewComponent,
- BsDaysCalendarViewComponent,
- BsMonthCalendarViewComponent,
- BsTimepickerViewComponent,
- BsYearsCalendarViewComponent
- ], _exports),
- entryComponents: [
- BsDatepickerContainerComponent,
- BsDaterangepickerContainerComponent,
- BsDatepickerInlineContainerComponent,
- BsDaterangepickerInlineContainerComponent
- ],
- exports: _exports
- },] }
- ];
- return BsDatepickerModule;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var DateFormatter = /** @class */ (function () {
- function DateFormatter() {
- }
- /**
- * @param {?} date
- * @param {?} format
- * @param {?} locale
- * @return {?}
- */
- DateFormatter.prototype.format = /**
- * @param {?} date
- * @param {?} format
- * @param {?} locale
- * @return {?}
- */
- function (date, format, locale) {
- return formatDate(date, format, locale);
- };
- return DateFormatter;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var DatePickerInnerComponent = /** @class */ (function () {
- function DatePickerInnerComponent() {
- this.selectionDone = new EventEmitter(undefined);
- this.update = new EventEmitter(false);
- this.activeDateChange = new EventEmitter(undefined);
- /* tslint:disable-next-line: no-any*/
- this.stepDay = {};
- /* tslint:disable-next-line: no-any*/
- this.stepMonth = {};
- /* tslint:disable-next-line: no-any*/
- this.stepYear = {};
- this.modes = ['day', 'month', 'year'];
- this.dateFormatter = new DateFormatter();
- }
- Object.defineProperty(DatePickerInnerComponent.prototype, "activeDate", {
- get: /**
- * @return {?}
- */
- function () {
- return this._activeDate;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._activeDate = value;
- },
- enumerable: true,
- configurable: true
- });
- // todo: add formatter value to Date object
- // todo: add formatter value to Date object
- /**
- * @return {?}
- */
- DatePickerInnerComponent.prototype.ngOnInit =
- // todo: add formatter value to Date object
- /**
- * @return {?}
- */
- function () {
- // todo: use date for unique value
- this.uniqueId = "datepicker--" + Math.floor(Math.random() * 10000);
- if (this.initDate) {
- this.activeDate = this.initDate;
- this.selectedDate = new Date(this.activeDate.valueOf());
- this.update.emit(this.activeDate);
- }
- else if (this.activeDate === undefined) {
- this.activeDate = new Date();
- }
- };
- // this.refreshView should be called here to reflect the changes on the fly
- // tslint:disable-next-line:no-unused-variable
- // this.refreshView should be called here to reflect the changes on the fly
- // tslint:disable-next-line:no-unused-variable
- /**
- * @param {?} changes
- * @return {?}
- */
- DatePickerInnerComponent.prototype.ngOnChanges =
- // this.refreshView should be called here to reflect the changes on the fly
- // tslint:disable-next-line:no-unused-variable
- /**
- * @param {?} changes
- * @return {?}
- */
- function (changes) {
- this.refreshView();
- this.checkIfActiveDateGotUpdated(changes.activeDate);
- };
- // Check if activeDate has been update and then emit the activeDateChange with the new date
- /* tslint:disable-next-line: no-any */
- // Check if activeDate has been update and then emit the activeDateChange with the new date
- /* tslint:disable-next-line: no-any */
- /**
- * @param {?} activeDate
- * @return {?}
- */
- DatePickerInnerComponent.prototype.checkIfActiveDateGotUpdated =
- // Check if activeDate has been update and then emit the activeDateChange with the new date
- /* tslint:disable-next-line: no-any */
- /**
- * @param {?} activeDate
- * @return {?}
- */
- function (activeDate) {
- if (activeDate && !activeDate.firstChange) {
- /** @type {?} */
- var previousValue = activeDate.previousValue;
- if (previousValue &&
- previousValue instanceof Date &&
- previousValue.getTime() !== activeDate.currentValue.getTime()) {
- this.activeDateChange.emit(this.activeDate);
- }
- }
- };
- /**
- * @param {?} handler
- * @param {?} type
- * @return {?}
- */
- DatePickerInnerComponent.prototype.setCompareHandler = /**
- * @param {?} handler
- * @param {?} type
- * @return {?}
- */
- function (handler, type) {
- if (type === 'day') {
- this.compareHandlerDay = handler;
- }
- if (type === 'month') {
- this.compareHandlerMonth = handler;
- }
- if (type === 'year') {
- this.compareHandlerYear = handler;
- }
- };
- /**
- * @param {?} date1
- * @param {?} date2
- * @return {?}
- */
- DatePickerInnerComponent.prototype.compare = /**
- * @param {?} date1
- * @param {?} date2
- * @return {?}
- */
- function (date1, date2) {
- if (date1 === undefined || date2 === undefined) {
- return undefined;
- }
- if (this.datepickerMode === 'day' && this.compareHandlerDay) {
- return this.compareHandlerDay(date1, date2);
- }
- if (this.datepickerMode === 'month' && this.compareHandlerMonth) {
- return this.compareHandlerMonth(date1, date2);
- }
- if (this.datepickerMode === 'year' && this.compareHandlerYear) {
- return this.compareHandlerYear(date1, date2);
- }
- return void 0;
- };
- /**
- * @param {?} handler
- * @param {?} type
- * @return {?}
- */
- DatePickerInnerComponent.prototype.setRefreshViewHandler = /**
- * @param {?} handler
- * @param {?} type
- * @return {?}
- */
- function (handler, type) {
- if (type === 'day') {
- this.refreshViewHandlerDay = handler;
- }
- if (type === 'month') {
- this.refreshViewHandlerMonth = handler;
- }
- if (type === 'year') {
- this.refreshViewHandlerYear = handler;
- }
- };
- /**
- * @return {?}
- */
- DatePickerInnerComponent.prototype.refreshView = /**
- * @return {?}
- */
- function () {
- if (this.datepickerMode === 'day' && this.refreshViewHandlerDay) {
- this.refreshViewHandlerDay();
- }
- if (this.datepickerMode === 'month' && this.refreshViewHandlerMonth) {
- this.refreshViewHandlerMonth();
- }
- if (this.datepickerMode === 'year' && this.refreshViewHandlerYear) {
- this.refreshViewHandlerYear();
- }
- };
- /**
- * @param {?} date
- * @param {?} format
- * @return {?}
- */
- DatePickerInnerComponent.prototype.dateFilter = /**
- * @param {?} date
- * @param {?} format
- * @return {?}
- */
- function (date, format) {
- return this.dateFormatter.format(date, format, this.locale);
- };
- /* tslint:disable-next-line: no-any*/
- /* tslint:disable-next-line: no-any*/
- /**
- * @param {?} dateObject
- * @return {?}
- */
- DatePickerInnerComponent.prototype.isActive = /* tslint:disable-next-line: no-any*/
- /**
- * @param {?} dateObject
- * @return {?}
- */
- function (dateObject) {
- if (this.compare(dateObject.date, this.activeDate) === 0) {
- this.activeDateId = dateObject.uid;
- return true;
- }
- return false;
- };
- /* tslint:disable-next-line: no-any*/
- /* tslint:disable-next-line: no-any*/
- /**
- * @param {?} date
- * @param {?} format
- * @return {?}
- */
- DatePickerInnerComponent.prototype.createDateObject = /* tslint:disable-next-line: no-any*/
- /**
- * @param {?} date
- * @param {?} format
- * @return {?}
- */
- function (date, format) {
- /* tslint:disable-next-line: no-any*/
- /** @type {?} */
- var dateObject = {};
- dateObject.date = new Date(date.getFullYear(), date.getMonth(), date.getDate());
- dateObject.date = this.fixTimeZone(dateObject.date);
- dateObject.label = this.dateFilter(date, format);
- dateObject.selected = this.compare(date, this.selectedDate) === 0;
- dateObject.disabled = this.isDisabled(date);
- dateObject.current = this.compare(date, new Date()) === 0;
- dateObject.customClass = this.getCustomClassForDate(dateObject.date);
- return dateObject;
- };
- /* tslint:disable-next-line: no-any*/
- /* tslint:disable-next-line: no-any*/
- /**
- * @param {?} arr
- * @param {?} size
- * @return {?}
- */
- DatePickerInnerComponent.prototype.split = /* tslint:disable-next-line: no-any*/
- /**
- * @param {?} arr
- * @param {?} size
- * @return {?}
- */
- function (arr, size) {
- /* tslint:disable-next-line: no-any*/
- /** @type {?} */
- var arrays = [];
- while (arr.length > 0) {
- arrays.push(arr.splice(0, size));
- }
- return arrays;
- };
- // Fix a hard-reproducible bug with timezones
- // The bug depends on OS, browser, current timezone and current date
- // i.e.
- // var date = new Date(2014, 0, 1);
- // console.log(date.getFullYear(), date.getMonth(), date.getDate(),
- // date.getHours()); can result in "2013 11 31 23" because of the bug.
- // Fix a hard-reproducible bug with timezones
- // The bug depends on OS, browser, current timezone and current date
- // i.e.
- // var date = new Date(2014, 0, 1);
- // console.log(date.getFullYear(), date.getMonth(), date.getDate(),
- // date.getHours()); can result in "2013 11 31 23" because of the bug.
- /**
- * @param {?} date
- * @return {?}
- */
- DatePickerInnerComponent.prototype.fixTimeZone =
- // Fix a hard-reproducible bug with timezones
- // The bug depends on OS, browser, current timezone and current date
- // i.e.
- // var date = new Date(2014, 0, 1);
- // console.log(date.getFullYear(), date.getMonth(), date.getDate(),
- // date.getHours()); can result in "2013 11 31 23" because of the bug.
- /**
- * @param {?} date
- * @return {?}
- */
- function (date) {
- /** @type {?} */
- var hours = date.getHours();
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), hours === 23 ? hours + 2 : 0);
- };
- /**
- * @param {?} date
- * @param {?=} isManual
- * @return {?}
- */
- DatePickerInnerComponent.prototype.select = /**
- * @param {?} date
- * @param {?=} isManual
- * @return {?}
- */
- function (date, isManual) {
- if (isManual === void 0) { isManual = true; }
- if (this.datepickerMode === this.minMode) {
- if (!this.activeDate) {
- this.activeDate = new Date(0, 0, 0, 0, 0, 0, 0);
- }
- this.activeDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
- this.activeDate = this.fixTimeZone(this.activeDate);
- if (isManual) {
- this.selectionDone.emit(this.activeDate);
- }
- }
- else {
- this.activeDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
- this.activeDate = this.fixTimeZone(this.activeDate);
- if (isManual) {
- this.datepickerMode = this.modes[this.modes.indexOf(this.datepickerMode) - 1];
- }
- }
- this.selectedDate = new Date(this.activeDate.valueOf());
- this.update.emit(this.activeDate);
- this.refreshView();
- };
- /**
- * @param {?} direction
- * @return {?}
- */
- DatePickerInnerComponent.prototype.move = /**
- * @param {?} direction
- * @return {?}
- */
- function (direction) {
- /* tslint:disable-next-line: no-any*/
- /** @type {?} */
- var expectedStep;
- if (this.datepickerMode === 'day') {
- expectedStep = this.stepDay;
- }
- if (this.datepickerMode === 'month') {
- expectedStep = this.stepMonth;
- }
- if (this.datepickerMode === 'year') {
- expectedStep = this.stepYear;
- }
- if (expectedStep) {
- /** @type {?} */
- var year = this.activeDate.getFullYear() + direction * (expectedStep.years || 0);
- /** @type {?} */
- var month = this.activeDate.getMonth() + direction * (expectedStep.months || 0);
- this.activeDate = new Date(year, month, 1);
- this.refreshView();
- this.activeDateChange.emit(this.activeDate);
- }
- };
- /**
- * @param {?} _direction
- * @return {?}
- */
- DatePickerInnerComponent.prototype.toggleMode = /**
- * @param {?} _direction
- * @return {?}
- */
- function (_direction) {
- /** @type {?} */
- var direction = _direction || 1;
- if ((this.datepickerMode === this.maxMode && direction === 1) ||
- (this.datepickerMode === this.minMode && direction === -1)) {
- return;
- }
- this.datepickerMode = this.modes[this.modes.indexOf(this.datepickerMode) + direction];
- this.refreshView();
- };
- /**
- * @protected
- * @param {?} date
- * @return {?}
- */
- DatePickerInnerComponent.prototype.getCustomClassForDate = /**
- * @protected
- * @param {?} date
- * @return {?}
- */
- function (date) {
- var _this = this;
- if (!this.customClass) {
- return '';
- }
- // todo: build a hash of custom classes, it will work faster
- /** @type {?} */
- var customClassObject = this.customClass.find((/**
- * @param {?} customClass
- * @return {?}
- */
- function (customClass) {
- return (customClass.date.valueOf() === date.valueOf() &&
- customClass.mode === _this.datepickerMode);
- }), this);
- return customClassObject === undefined ? '' : customClassObject.clazz;
- };
- /**
- * @protected
- * @param {?} date1Disabled
- * @param {?} date2
- * @return {?}
- */
- DatePickerInnerComponent.prototype.compareDateDisabled = /**
- * @protected
- * @param {?} date1Disabled
- * @param {?} date2
- * @return {?}
- */
- function (date1Disabled, date2) {
- if (date1Disabled === undefined || date2 === undefined) {
- return undefined;
- }
- if (date1Disabled.mode === 'day' && this.compareHandlerDay) {
- return this.compareHandlerDay(date1Disabled.date, date2);
- }
- if (date1Disabled.mode === 'month' && this.compareHandlerMonth) {
- return this.compareHandlerMonth(date1Disabled.date, date2);
- }
- if (date1Disabled.mode === 'year' && this.compareHandlerYear) {
- return this.compareHandlerYear(date1Disabled.date, date2);
- }
- return undefined;
- };
- /**
- * @protected
- * @param {?} date
- * @return {?}
- */
- DatePickerInnerComponent.prototype.isDisabled = /**
- * @protected
- * @param {?} date
- * @return {?}
- */
- function (date) {
- var _this = this;
- /** @type {?} */
- var isDateDisabled = false;
- if (this.dateDisabled) {
- this.dateDisabled.forEach((/**
- * @param {?} disabledDate
- * @return {?}
- */
- function (disabledDate) {
- if (_this.compareDateDisabled(disabledDate, date) === 0) {
- isDateDisabled = true;
- }
- }));
- }
- if (this.dayDisabled) {
- isDateDisabled =
- isDateDisabled ||
- this.dayDisabled.indexOf(date.getDay()) > -1;
- }
- return (isDateDisabled ||
- (this.minDate && this.compare(date, this.minDate) < 0) ||
- (this.maxDate && this.compare(date, this.maxDate) > 0));
- };
- DatePickerInnerComponent.decorators = [
- { type: Component, args: [{
- selector: 'datepicker-inner',
- template: "\n <!--<!–ng-keydown=\"keydown($event)\"–>-->\n <div *ngIf=\"datepickerMode\" class=\"well well-sm bg-faded p-a card\" role=\"application\" >\n <ng-content></ng-content>\n </div>\n "
- }] }
- ];
- DatePickerInnerComponent.propDecorators = {
- locale: [{ type: Input }],
- datepickerMode: [{ type: Input }],
- startingDay: [{ type: Input }],
- yearRange: [{ type: Input }],
- minDate: [{ type: Input }],
- maxDate: [{ type: Input }],
- minMode: [{ type: Input }],
- maxMode: [{ type: Input }],
- showWeeks: [{ type: Input }],
- formatDay: [{ type: Input }],
- formatMonth: [{ type: Input }],
- formatYear: [{ type: Input }],
- formatDayHeader: [{ type: Input }],
- formatDayTitle: [{ type: Input }],
- formatMonthTitle: [{ type: Input }],
- onlyCurrentMonth: [{ type: Input }],
- shortcutPropagation: [{ type: Input }],
- customClass: [{ type: Input }],
- monthColLimit: [{ type: Input }],
- yearColLimit: [{ type: Input }],
- dateDisabled: [{ type: Input }],
- dayDisabled: [{ type: Input }],
- initDate: [{ type: Input }],
- selectionDone: [{ type: Output }],
- update: [{ type: Output }],
- activeDateChange: [{ type: Output }],
- activeDate: [{ type: Input }]
- };
- return DatePickerInnerComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var DatepickerConfig = /** @class */ (function () {
- function DatepickerConfig() {
- this.locale = 'en';
- this.datepickerMode = 'day';
- this.startingDay = 0;
- this.yearRange = 20;
- this.minMode = 'day';
- this.maxMode = 'year';
- this.showWeeks = true;
- this.formatDay = 'DD';
- this.formatMonth = 'MMMM';
- this.formatYear = 'YYYY';
- this.formatDayHeader = 'dd';
- this.formatDayTitle = 'MMMM YYYY';
- this.formatMonthTitle = 'YYYY';
- this.onlyCurrentMonth = false;
- this.monthColLimit = 3;
- this.yearColLimit = 5;
- this.shortcutPropagation = false;
- }
- DatepickerConfig.decorators = [
- { type: Injectable }
- ];
- return DatepickerConfig;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- /** @type {?} */
- var DATEPICKER_CONTROL_VALUE_ACCESSOR = {
- provide: NG_VALUE_ACCESSOR,
- /* tslint:disable-next-line: no-use-before-declare */
- useExisting: forwardRef((/**
- * @return {?}
- */
- function () { return DatePickerComponent; })),
- multi: true
- };
- /* tslint:disable:component-selector-name component-selector-type */
- var DatePickerComponent = /** @class */ (function () {
- function DatePickerComponent(config) {
- /**
- * sets datepicker mode, supports: `day`, `month`, `year`
- */
- this.datepickerMode = 'day';
- /**
- * if false week numbers will be hidden
- */
- this.showWeeks = true;
- this.selectionDone = new EventEmitter(undefined);
- /**
- * callback to invoke when the activeDate is changed.
- */
- this.activeDateChange = new EventEmitter(undefined);
- /* tslint:disable-next-line: no-any*/
- this.onChange = Function.prototype;
- /* tslint:disable-next-line: no-any*/
- this.onTouched = Function.prototype;
- this._now = new Date();
- this.config = config;
- this.configureOptions();
- }
- Object.defineProperty(DatePickerComponent.prototype, "activeDate", {
- /** currently active date */
- get: /**
- * currently active date
- * @return {?}
- */
- function () {
- return this._activeDate || this._now;
- },
- set: /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- this._activeDate = value;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- DatePickerComponent.prototype.configureOptions = /**
- * @return {?}
- */
- function () {
- Object.assign(this, this.config);
- };
- /**
- * @param {?} event
- * @return {?}
- */
- DatePickerComponent.prototype.onUpdate = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- this.activeDate = event;
- this.onChange(event);
- };
- /**
- * @param {?} event
- * @return {?}
- */
- DatePickerComponent.prototype.onSelectionDone = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- this.selectionDone.emit(event);
- };
- /**
- * @param {?} event
- * @return {?}
- */
- DatePickerComponent.prototype.onActiveDateChange = /**
- * @param {?} event
- * @return {?}
- */
- function (event) {
- this.activeDateChange.emit(event);
- };
- // todo: support null value
- /* tslint:disable-next-line: no-any*/
- // todo: support null value
- /* tslint:disable-next-line: no-any*/
- /**
- * @param {?} value
- * @return {?}
- */
- DatePickerComponent.prototype.writeValue =
- // todo: support null value
- /* tslint:disable-next-line: no-any*/
- /**
- * @param {?} value
- * @return {?}
- */
- function (value) {
- if (this._datePicker.compare(value, this._activeDate) === 0) {
- return;
- }
- if (value && value instanceof Date) {
- this.activeDate = value;
- this._datePicker.select(value, false);
- return;
- }
- this.activeDate = value ? new Date(value) : void 0;
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- DatePickerComponent.prototype.registerOnChange = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this.onChange = fn;
- };
- /**
- * @param {?} fn
- * @return {?}
- */
- DatePickerComponent.prototype.registerOnTouched = /**
- * @param {?} fn
- * @return {?}
- */
- function (fn) {
- this.onTouched = fn;
- };
- DatePickerComponent.decorators = [
- { type: Component, args: [{
- selector: 'datepicker',
- template: "\n <datepicker-inner [activeDate]=\"activeDate\"\n (update)=\"onUpdate($event)\"\n [locale]=\"config.locale\"\n [datepickerMode]=\"datepickerMode\"\n [initDate]=\"initDate\"\n [minDate]=\"minDate\"\n [maxDate]=\"maxDate\"\n [minMode]=\"minMode\"\n [maxMode]=\"maxMode\"\n [showWeeks]=\"showWeeks\"\n [formatDay]=\"formatDay\"\n [formatMonth]=\"formatMonth\"\n [formatYear]=\"formatYear\"\n [formatDayHeader]=\"formatDayHeader\"\n [formatDayTitle]=\"formatDayTitle\"\n [formatMonthTitle]=\"formatMonthTitle\"\n [startingDay]=\"startingDay\"\n [yearRange]=\"yearRange\"\n [customClass]=\"customClass\"\n [dateDisabled]=\"dateDisabled\"\n [dayDisabled]=\"dayDisabled\"\n [onlyCurrentMonth]=\"onlyCurrentMonth\"\n [shortcutPropagation]=\"shortcutPropagation\"\n [monthColLimit]=\"monthColLimit\"\n [yearColLimit]=\"yearColLimit\"\n (selectionDone)=\"onSelectionDone($event)\"\n (activeDateChange)=\"onActiveDateChange($event)\">\n <daypicker tabindex=\"0\"></daypicker>\n <monthpicker tabindex=\"0\"></monthpicker>\n <yearpicker tabindex=\"0\"></yearpicker>\n </datepicker-inner>\n ",
- providers: [DATEPICKER_CONTROL_VALUE_ACCESSOR]
- }] }
- ];
- /** @nocollapse */
- DatePickerComponent.ctorParameters = function () { return [
- { type: DatepickerConfig }
- ]; };
- DatePickerComponent.propDecorators = {
- datepickerMode: [{ type: Input }],
- initDate: [{ type: Input }],
- minDate: [{ type: Input }],
- maxDate: [{ type: Input }],
- minMode: [{ type: Input }],
- maxMode: [{ type: Input }],
- showWeeks: [{ type: Input }],
- formatDay: [{ type: Input }],
- formatMonth: [{ type: Input }],
- formatYear: [{ type: Input }],
- formatDayHeader: [{ type: Input }],
- formatDayTitle: [{ type: Input }],
- formatMonthTitle: [{ type: Input }],
- startingDay: [{ type: Input }],
- yearRange: [{ type: Input }],
- onlyCurrentMonth: [{ type: Input }],
- shortcutPropagation: [{ type: Input }],
- monthColLimit: [{ type: Input }],
- yearColLimit: [{ type: Input }],
- customClass: [{ type: Input }],
- dateDisabled: [{ type: Input }],
- dayDisabled: [{ type: Input }],
- activeDate: [{ type: Input }],
- selectionDone: [{ type: Output }],
- activeDateChange: [{ type: Output }],
- _datePicker: [{ type: ViewChild, args: [DatePickerInnerComponent, { static: true },] }]
- };
- return DatePickerComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var DayPickerComponent = /** @class */ (function () {
- function DayPickerComponent(datePicker) {
- this.labels = [];
- this.rows = [];
- this.weekNumbers = [];
- this.datePicker = datePicker;
- }
- Object.defineProperty(DayPickerComponent.prototype, "isBs4", {
- get: /**
- * @return {?}
- */
- function () {
- return !isBs3();
- },
- enumerable: true,
- configurable: true
- });
- /*protected getDaysInMonth(year:number, month:number) {
- return ((month === 1) && (year % 4 === 0) &&
- ((year % 100 !== 0) || (year % 400 === 0))) ? 29 : DAYS_IN_MONTH[month];
- }*/
- /*protected getDaysInMonth(year:number, month:number) {
- return ((month === 1) && (year % 4 === 0) &&
- ((year % 100 !== 0) || (year % 400 === 0))) ? 29 : DAYS_IN_MONTH[month];
- }*/
- /**
- * @return {?}
- */
- DayPickerComponent.prototype.ngOnInit = /*protected getDaysInMonth(year:number, month:number) {
- return ((month === 1) && (year % 4 === 0) &&
- ((year % 100 !== 0) || (year % 400 === 0))) ? 29 : DAYS_IN_MONTH[month];
- }*/
- /**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var self = this;
- this.datePicker.stepDay = { months: 1 };
- this.datePicker.setRefreshViewHandler((/**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var year = this.activeDate.getFullYear();
- /** @type {?} */
- var month = this.activeDate.getMonth();
- /** @type {?} */
- var firstDayOfMonth = new Date(year, month, 1);
- /** @type {?} */
- var difference = this.startingDay - firstDayOfMonth.getDay();
- /** @type {?} */
- var numDisplayedFromPreviousMonth = difference > 0 ? 7 - difference : -difference;
- /** @type {?} */
- var firstDate = new Date(firstDayOfMonth.getTime());
- if (numDisplayedFromPreviousMonth > 0) {
- firstDate.setDate(-numDisplayedFromPreviousMonth + 1);
- }
- // 42 is the number of days on a six-week calendar
- /** @type {?} */
- var _days = self.getDates(firstDate, 42);
- /** @type {?} */
- var days = [];
- for (var i = 0; i < 42; i++) {
- /** @type {?} */
- var _dateObject = this.createDateObject(_days[i], this.formatDay);
- _dateObject.secondary = _days[i].getMonth() !== month;
- _dateObject.uid = this.uniqueId + '-' + i;
- days[i] = _dateObject;
- }
- self.labels = [];
- for (var j = 0; j < 7; j++) {
- self.labels[j] = {};
- self.labels[j].abbr = this.dateFilter(days[j].date, this.formatDayHeader);
- self.labels[j].full = this.dateFilter(days[j].date, 'EEEE');
- }
- self.title = this.dateFilter(this.activeDate, this.formatDayTitle);
- self.rows = this.split(days, 7);
- if (this.showWeeks) {
- self.weekNumbers = [];
- /** @type {?} */
- var thursdayIndex = (4 + 7 - this.startingDay) % 7;
- /** @type {?} */
- var numWeeks = self.rows.length;
- for (var curWeek = 0; curWeek < numWeeks; curWeek++) {
- self.weekNumbers.push(self.getISO8601WeekNumber(self.rows[curWeek][thursdayIndex].date));
- }
- }
- }), 'day');
- this.datePicker.setCompareHandler((/**
- * @param {?} date1
- * @param {?} date2
- * @return {?}
- */
- function (date1, date2) {
- /** @type {?} */
- var d1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate());
- /** @type {?} */
- var d2 = new Date(date2.getFullYear(), date2.getMonth(), date2.getDate());
- return d1.getTime() - d2.getTime();
- }), 'day');
- this.datePicker.refreshView();
- };
- /**
- * @protected
- * @param {?} startDate
- * @param {?} n
- * @return {?}
- */
- DayPickerComponent.prototype.getDates = /**
- * @protected
- * @param {?} startDate
- * @param {?} n
- * @return {?}
- */
- function (startDate, n) {
- /** @type {?} */
- var dates = new Array(n);
- /** @type {?} */
- var current = new Date(startDate.getTime());
- /** @type {?} */
- var i = 0;
- /** @type {?} */
- var date;
- while (i < n) {
- date = new Date(current.getTime());
- date = this.datePicker.fixTimeZone(date);
- dates[i++] = date;
- current = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1);
- }
- return dates;
- };
- /**
- * @protected
- * @param {?} date
- * @return {?}
- */
- DayPickerComponent.prototype.getISO8601WeekNumber = /**
- * @protected
- * @param {?} date
- * @return {?}
- */
- function (date) {
- /** @type {?} */
- var checkDate = new Date(date.getTime());
- // Thursday
- checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
- /** @type {?} */
- var time = checkDate.getTime();
- // Compare with Jan 1
- checkDate.setMonth(0);
- checkDate.setDate(1);
- return (Math.floor(Math.round((time - checkDate.getTime()) / 86400000) / 7) + 1);
- };
- DayPickerComponent.decorators = [
- { type: Component, args: [{
- selector: 'daypicker',
- template: "\n<table *ngIf=\"datePicker.datepickerMode === 'day'\" role=\"grid\" [attr.aria-labelledby]=\"datePicker.uniqueId + '-title'\" aria-activedescendant=\"activeDateId\">\n <thead>\n <tr>\n <th>\n <button *ngIf=\"!isBs4\"\n type=\"button\"\n class=\"btn btn-default btn-secondary btn-sm pull-left float-left\"\n (click)=\"datePicker.move(-1)\"\n tabindex=\"-1\">\u2039</button>\n <button *ngIf=\"isBs4\"\n type=\"button\"\n class=\"btn btn-default btn-secondary btn-sm pull-left float-left\"\n (click)=\"datePicker.move(-1)\"\n tabindex=\"-1\"><</button>\n </th>\n <th [attr.colspan]=\"5 + (datePicker.showWeeks ? 1 : 0)\">\n <button [id]=\"datePicker.uniqueId + '-title'\"\n type=\"button\" class=\"btn btn-default btn-secondary btn-sm\"\n (click)=\"datePicker.toggleMode(0)\"\n [disabled]=\"datePicker.datepickerMode === datePicker.maxMode\"\n [ngClass]=\"{disabled: datePicker.datepickerMode === datePicker.maxMode}\" tabindex=\"-1\" style=\"width:100%;\">\n <strong>{{ title }}</strong>\n </button>\n </th>\n <th>\n <button *ngIf=\"!isBs4\"\n type=\"button\"\n class=\"btn btn-default btn-secondary btn-sm pull-right float-right\"\n (click)=\"datePicker.move(1)\"\n tabindex=\"-1\">\u203A</button>\n <button *ngIf=\"isBs4\"\n type=\"button\"\n class=\"btn btn-default btn-secondary btn-sm pull-right float-right\"\n (click)=\"datePicker.move(1)\"\n tabindex=\"-1\">>\n </button>\n </th>\n </tr>\n <tr>\n <th *ngIf=\"datePicker.showWeeks\"></th>\n <th *ngFor=\"let labelz of labels\" class=\"text-center\">\n <small aria-label=\"labelz.full\"><b>{{ labelz.abbr }}</b></small>\n </th>\n </tr>\n </thead>\n <tbody>\n <ng-template ngFor [ngForOf]=\"rows\" let-rowz=\"$implicit\" let-index=\"index\">\n <tr *ngIf=\"!(datePicker.onlyCurrentMonth && rowz[0].secondary && rowz[6].secondary)\">\n <td *ngIf=\"datePicker.showWeeks\" class=\"h6\" class=\"text-center\">\n <em>{{ weekNumbers[index] }}</em>\n </td>\n <td *ngFor=\"let dtz of rowz\" class=\"text-center\" role=\"gridcell\" [id]=\"dtz.uid\">\n <button type=\"button\" style=\"min-width:100%;\" class=\"btn btn-sm {{dtz.customClass}}\"\n *ngIf=\"!(datePicker.onlyCurrentMonth && dtz.secondary)\"\n [ngClass]=\"{'btn-secondary': isBs4 && !dtz.selected && !datePicker.isActive(dtz), 'btn-info': dtz.selected, disabled: dtz.disabled, active: !isBs4 && datePicker.isActive(dtz), 'btn-default': !isBs4}\"\n [disabled]=\"dtz.disabled\"\n (click)=\"datePicker.select(dtz.date)\" tabindex=\"-1\">\n <span [ngClass]=\"{'text-muted': dtz.secondary || dtz.current, 'text-info': !isBs4 && dtz.current}\">{{ dtz.label }}</span>\n </button>\n </td>\n </tr>\n </ng-template>\n </tbody>\n</table>\n ",
- styles: ["\n :host .btn-secondary {\n color: #292b2c;\n background-color: #fff;\n border-color: #ccc;\n }\n :host .btn-info .text-muted {\n color: #292b2c !important;\n }\n "]
- }] }
- ];
- /** @nocollapse */
- DayPickerComponent.ctorParameters = function () { return [
- { type: DatePickerInnerComponent }
- ]; };
- return DayPickerComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var MonthPickerComponent = /** @class */ (function () {
- function MonthPickerComponent(datePicker) {
- this.rows = [];
- this.datePicker = datePicker;
- }
- Object.defineProperty(MonthPickerComponent.prototype, "isBs4", {
- get: /**
- * @return {?}
- */
- function () {
- return !isBs3();
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- MonthPickerComponent.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var self = this;
- this.datePicker.stepMonth = { years: 1 };
- this.datePicker.setRefreshViewHandler((/**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var months = new Array(12);
- /** @type {?} */
- var year = this.activeDate.getFullYear();
- /** @type {?} */
- var date;
- for (var i = 0; i < 12; i++) {
- date = new Date(year, i, 1);
- date = this.fixTimeZone(date);
- months[i] = this.createDateObject(date, this.formatMonth);
- months[i].uid = this.uniqueId + '-' + i;
- }
- self.title = this.dateFilter(this.activeDate, this.formatMonthTitle);
- self.rows = this.split(months, self.datePicker.monthColLimit);
- }), 'month');
- this.datePicker.setCompareHandler((/**
- * @param {?} date1
- * @param {?} date2
- * @return {?}
- */
- function (date1, date2) {
- /** @type {?} */
- var d1 = new Date(date1.getFullYear(), date1.getMonth());
- /** @type {?} */
- var d2 = new Date(date2.getFullYear(), date2.getMonth());
- return d1.getTime() - d2.getTime();
- }), 'month');
- this.datePicker.refreshView();
- };
- MonthPickerComponent.decorators = [
- { type: Component, args: [{
- selector: 'monthpicker',
- template: "\n<table *ngIf=\"datePicker.datepickerMode==='month'\" role=\"grid\">\n <thead>\n <tr>\n <th>\n <button type=\"button\" class=\"btn btn-default btn-sm pull-left float-left\"\n (click)=\"datePicker.move(-1)\" tabindex=\"-1\">\u2039</button></th>\n <th [attr.colspan]=\"((datePicker.monthColLimit - 2) <= 0) ? 1 : datePicker.monthColLimit - 2\">\n <button [id]=\"datePicker.uniqueId + '-title'\"\n type=\"button\" class=\"btn btn-default btn-sm\"\n (click)=\"datePicker.toggleMode(0)\"\n [disabled]=\"datePicker.datepickerMode === maxMode\"\n [ngClass]=\"{disabled: datePicker.datepickerMode === maxMode}\" tabindex=\"-1\" style=\"width:100%;\">\n <strong>{{ title }}</strong> \n </button>\n </th>\n <th>\n <button type=\"button\" class=\"btn btn-default btn-sm pull-right float-right\"\n (click)=\"datePicker.move(1)\" tabindex=\"-1\">\u203A</button>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let rowz of rows\">\n <td *ngFor=\"let dtz of rowz\" class=\"text-center\" role=\"gridcell\" [attr.id]=\"dtz.uid\" [ngClass]=\"dtz.customClass\">\n <button type=\"button\" style=\"min-width:100%;\" class=\"btn btn-default\"\n [ngClass]=\"{'btn-link': isBs4 && !dtz.selected && !datePicker.isActive(dtz), 'btn-info': dtz.selected || (isBs4 && !dtz.selected && datePicker.isActive(dtz)), disabled: dtz.disabled, active: !isBs4 && datePicker.isActive(dtz)}\"\n [disabled]=\"dtz.disabled\"\n (click)=\"datePicker.select(dtz.date)\" tabindex=\"-1\">\n <span [ngClass]=\"{'text-success': isBs4 && dtz.current, 'text-info': !isBs4 && dtz.current}\">{{ dtz.label }}</span>\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n ",
- styles: ["\n :host .btn-info .text-success {\n color: #fff !important;\n }\n "]
- }] }
- ];
- /** @nocollapse */
- MonthPickerComponent.ctorParameters = function () { return [
- { type: DatePickerInnerComponent }
- ]; };
- return MonthPickerComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var YearPickerComponent = /** @class */ (function () {
- function YearPickerComponent(datePicker) {
- this.rows = [];
- this.datePicker = datePicker;
- }
- Object.defineProperty(YearPickerComponent.prototype, "isBs4", {
- get: /**
- * @return {?}
- */
- function () {
- return !isBs3();
- },
- enumerable: true,
- configurable: true
- });
- /**
- * @return {?}
- */
- YearPickerComponent.prototype.ngOnInit = /**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var self = this;
- this.datePicker.stepYear = { years: this.datePicker.yearRange };
- this.datePicker.setRefreshViewHandler((/**
- * @return {?}
- */
- function () {
- /** @type {?} */
- var years = new Array(this.yearRange);
- /** @type {?} */
- var date;
- /** @type {?} */
- var start = self.getStartingYear(this.activeDate.getFullYear());
- for (var i = 0; i < this.yearRange; i++) {
- date = new Date(start + i, 0, 1);
- date = this.fixTimeZone(date);
- years[i] = this.createDateObject(date, this.formatYear);
- years[i].uid = this.uniqueId + '-' + i;
- }
- self.title = [years[0].label, years[this.yearRange - 1].label].join(' - ');
- self.rows = this.split(years, self.datePicker.yearColLimit);
- }), 'year');
- this.datePicker.setCompareHandler((/**
- * @param {?} date1
- * @param {?} date2
- * @return {?}
- */
- function (date1, date2) {
- return date1.getFullYear() - date2.getFullYear();
- }), 'year');
- this.datePicker.refreshView();
- };
- /**
- * @protected
- * @param {?} year
- * @return {?}
- */
- YearPickerComponent.prototype.getStartingYear = /**
- * @protected
- * @param {?} year
- * @return {?}
- */
- function (year) {
- // todo: parseInt
- return ((year - 1) / this.datePicker.yearRange * this.datePicker.yearRange + 1);
- };
- YearPickerComponent.decorators = [
- { type: Component, args: [{
- selector: 'yearpicker',
- template: "\n<table *ngIf=\"datePicker.datepickerMode==='year'\" role=\"grid\">\n <thead>\n <tr>\n <th>\n <button type=\"button\" class=\"btn btn-default btn-sm pull-left float-left\"\n (click)=\"datePicker.move(-1)\" tabindex=\"-1\">\u2039</button>\n </th>\n <th [attr.colspan]=\"((datePicker.yearColLimit - 2) <= 0) ? 1 : datePicker.yearColLimit - 2\">\n <button [id]=\"datePicker.uniqueId + '-title'\" role=\"heading\"\n type=\"button\" class=\"btn btn-default btn-sm\"\n (click)=\"datePicker.toggleMode(0)\"\n [disabled]=\"datePicker.datepickerMode === datePicker.maxMode\"\n [ngClass]=\"{disabled: datePicker.datepickerMode === datePicker.maxMode}\" tabindex=\"-1\" style=\"width:100%;\">\n <strong>{{ title }}</strong>\n </button>\n </th>\n <th>\n <button type=\"button\" class=\"btn btn-default btn-sm pull-right float-right\"\n (click)=\"datePicker.move(1)\" tabindex=\"-1\">\u203A</button>\n </th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let rowz of rows\">\n <td *ngFor=\"let dtz of rowz\" class=\"text-center\" role=\"gridcell\" [attr.id]=\"dtz.uid\">\n <button type=\"button\" style=\"min-width:100%;\" class=\"btn btn-default\"\n [ngClass]=\"{'btn-link': isBs4 && !dtz.selected && !datePicker.isActive(dtz), 'btn-info': dtz.selected || (isBs4 && !dtz.selected && datePicker.isActive(dtz)), disabled: dtz.disabled, active: !isBs4 && datePicker.isActive(dtz)}\"\n [disabled]=\"dtz.disabled\"\n (click)=\"datePicker.select(dtz.date)\" tabindex=\"-1\">\n <span [ngClass]=\"{'text-success': isBs4 && dtz.current, 'text-info': !isBs4 && dtz.current}\">{{ dtz.label }}</span>\n </button>\n </td>\n </tr>\n </tbody>\n</table>\n ",
- styles: ["\n :host .btn-info .text-success {\n color: #fff !important;\n }\n "]
- }] }
- ];
- /** @nocollapse */
- YearPickerComponent.ctorParameters = function () { return [
- { type: DatePickerInnerComponent }
- ]; };
- return YearPickerComponent;
- }());
- /**
- * @fileoverview added by tsickle
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
- */
- var DatepickerModule = /** @class */ (function () {
- function DatepickerModule() {
- }
- /**
- * @return {?}
- */
- DatepickerModule.forRoot = /**
- * @return {?}
- */
- function () {
- return { ngModule: DatepickerModule, providers: [DatepickerConfig] };
- };
- DatepickerModule.decorators = [
- { type: NgModule, args: [{
- imports: [CommonModule, FormsModule],
- declarations: [
- DatePickerComponent,
- DatePickerInnerComponent,
- DayPickerComponent,
- MonthPickerComponent,
- YearPickerComponent
- ],
- exports: [
- DatePickerComponent,
- DatePickerInnerComponent,
- DayPickerComponent,
- MonthPickerComponent,
- YearPickerComponent
- ],
- entryComponents: [DatePickerComponent]
- },] }
- ];
- return DatepickerModule;
- }());
- export { BsDatepickerConfig, BsDatepickerContainerComponent, BsDatepickerDirective, BsDatepickerInlineConfig, BsDatepickerInlineContainerComponent, BsDatepickerInlineDirective, BsDatepickerInputDirective, BsDatepickerModule, BsDaterangepickerConfig, BsDaterangepickerContainerComponent, BsDaterangepickerDirective, BsDaterangepickerInlineConfig, BsDaterangepickerInlineContainerComponent, BsDaterangepickerInlineDirective, BsDaterangepickerInputDirective, BsLocaleService, DateFormatter, DatePickerComponent, DatePickerInnerComponent, DatepickerConfig, DatepickerModule, DayPickerComponent, MonthPickerComponent, YearPickerComponent, DATEPICKER_CONTROL_VALUE_ACCESSOR as ɵa, BsDatepickerAbstractComponent as ɵb, BsDatepickerStore as ɵc, BsDatepickerEffects as ɵd, BsDatepickerActions as ɵe, datepickerAnimation as ɵf, BsCalendarLayoutComponent as ɵg, BsCurrentDateViewComponent as ɵh, BsCustomDatesViewComponent as ɵi, BsDatepickerDayDecoratorComponent as ɵj, BsDatepickerNavigationViewComponent as ɵk, BsDaysCalendarViewComponent as ɵl, BsMonthCalendarViewComponent as ɵm, BsTimepickerViewComponent as ɵn, BsYearsCalendarViewComponent as ɵo };
- //# sourceMappingURL=ngx-bootstrap-datepicker.js.map
|