ngx-bootstrap-datepicker.umd.js 231 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs/operators'), require('ngx-bootstrap/chronos'), require('rxjs'), require('ngx-bootstrap/mini-ngrx'), require('ngx-bootstrap/positioning'), require('@angular/animations'), require('ngx-bootstrap/component-loader'), require('@angular/forms'), require('@angular/common'), require('ngx-bootstrap/utils')) :
  3. typeof define === 'function' && define.amd ? define('ngx-bootstrap/datepicker', ['exports', '@angular/core', 'rxjs/operators', 'ngx-bootstrap/chronos', 'rxjs', 'ngx-bootstrap/mini-ngrx', 'ngx-bootstrap/positioning', '@angular/animations', 'ngx-bootstrap/component-loader', '@angular/forms', '@angular/common', 'ngx-bootstrap/utils'], factory) :
  4. (global = global || self, factory((global['ngx-bootstrap'] = global['ngx-bootstrap'] || {}, global['ngx-bootstrap'].datepicker = {}), global.ng.core, global.rxjs.operators, global.chronos, global.rxjs, global.miniNgrx, global.positioning, global.ng.animations, global.componentLoader, global.ng.forms, global.ng.common, global.utils));
  5. }(this, function (exports, core, operators, chronos, rxjs, miniNgrx, positioning, animations, componentLoader, forms, common, utils) { 'use strict';
  6. /*! *****************************************************************************
  7. Copyright (c) Microsoft Corporation. All rights reserved.
  8. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  9. this file except in compliance with the License. You may obtain a copy of the
  10. License at http://www.apache.org/licenses/LICENSE-2.0
  11. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  12. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  13. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  14. MERCHANTABLITY OR NON-INFRINGEMENT.
  15. See the Apache Version 2.0 License for specific language governing permissions
  16. and limitations under the License.
  17. ***************************************************************************** */
  18. /* global Reflect, Promise */
  19. var extendStatics = function(d, b) {
  20. extendStatics = Object.setPrototypeOf ||
  21. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  22. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  23. return extendStatics(d, b);
  24. };
  25. function __extends(d, b) {
  26. extendStatics(d, b);
  27. function __() { this.constructor = d; }
  28. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  29. }
  30. function __values(o) {
  31. var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
  32. if (m) return m.call(o);
  33. return {
  34. next: function () {
  35. if (o && i >= o.length) o = void 0;
  36. return { value: o && o[i++], done: !o };
  37. }
  38. };
  39. }
  40. function __read(o, n) {
  41. var m = typeof Symbol === "function" && o[Symbol.iterator];
  42. if (!m) return o;
  43. var i = m.call(o), r, ar = [], e;
  44. try {
  45. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  46. }
  47. catch (error) { e = { error: error }; }
  48. finally {
  49. try {
  50. if (r && !r.done && (m = i["return"])) m.call(i);
  51. }
  52. finally { if (e) throw e.error; }
  53. }
  54. return ar;
  55. }
  56. function __spread() {
  57. for (var ar = [], i = 0; i < arguments.length; i++)
  58. ar = ar.concat(__read(arguments[i]));
  59. return ar;
  60. }
  61. /**
  62. * @fileoverview added by tsickle
  63. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  64. */
  65. /**
  66. * For date range picker there are `BsDaterangepickerConfig` which inherits all properties,
  67. * except `displayMonths`, for range picker it default to `2`
  68. */
  69. var BsDatepickerConfig = /** @class */ (function () {
  70. function BsDatepickerConfig() {
  71. /**
  72. * sets use adaptive position
  73. */
  74. this.adaptivePosition = false;
  75. /**
  76. * sets use UTC date time format
  77. */
  78. this.useUtc = false;
  79. /**
  80. * turn on/off animation
  81. */
  82. this.isAnimated = false;
  83. /**
  84. * CSS class which will be applied to datepicker container,
  85. * usually used to set color theme
  86. */
  87. this.containerClass = 'theme-green';
  88. // DatepickerRenderOptions
  89. this.displayMonths = 1;
  90. /**
  91. * Allows to hide week numbers in datepicker
  92. */
  93. this.showWeekNumbers = true;
  94. this.dateInputFormat = 'L';
  95. // range picker
  96. this.rangeSeparator = ' - ';
  97. /**
  98. * Date format for date range input field
  99. */
  100. this.rangeInputFormat = 'L';
  101. // DatepickerFormatOptions
  102. this.monthTitle = 'MMMM';
  103. this.yearTitle = 'YYYY';
  104. this.dayLabel = 'D';
  105. this.monthLabel = 'MMMM';
  106. this.yearLabel = 'YYYY';
  107. this.weekNumbers = 'w';
  108. }
  109. BsDatepickerConfig.decorators = [
  110. { type: core.Injectable }
  111. ];
  112. return BsDatepickerConfig;
  113. }());
  114. /**
  115. * @fileoverview added by tsickle
  116. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  117. */
  118. /**
  119. * @abstract
  120. */
  121. var /**
  122. * @abstract
  123. */
  124. BsDatepickerAbstractComponent = /** @class */ (function () {
  125. function BsDatepickerAbstractComponent() {
  126. this._customRangesFish = [];
  127. }
  128. Object.defineProperty(BsDatepickerAbstractComponent.prototype, "minDate", {
  129. set: /**
  130. * @param {?} value
  131. * @return {?}
  132. */
  133. function (value) {
  134. this._effects.setMinDate(value);
  135. },
  136. enumerable: true,
  137. configurable: true
  138. });
  139. Object.defineProperty(BsDatepickerAbstractComponent.prototype, "maxDate", {
  140. set: /**
  141. * @param {?} value
  142. * @return {?}
  143. */
  144. function (value) {
  145. this._effects.setMaxDate(value);
  146. },
  147. enumerable: true,
  148. configurable: true
  149. });
  150. Object.defineProperty(BsDatepickerAbstractComponent.prototype, "daysDisabled", {
  151. set: /**
  152. * @param {?} value
  153. * @return {?}
  154. */
  155. function (value) {
  156. this._effects.setDaysDisabled(value);
  157. },
  158. enumerable: true,
  159. configurable: true
  160. });
  161. Object.defineProperty(BsDatepickerAbstractComponent.prototype, "datesDisabled", {
  162. set: /**
  163. * @param {?} value
  164. * @return {?}
  165. */
  166. function (value) {
  167. this._effects.setDatesDisabled(value);
  168. },
  169. enumerable: true,
  170. configurable: true
  171. });
  172. Object.defineProperty(BsDatepickerAbstractComponent.prototype, "isDisabled", {
  173. set: /**
  174. * @param {?} value
  175. * @return {?}
  176. */
  177. function (value) {
  178. this._effects.setDisabled(value);
  179. },
  180. enumerable: true,
  181. configurable: true
  182. });
  183. Object.defineProperty(BsDatepickerAbstractComponent.prototype, "dateCustomClasses", {
  184. set: /**
  185. * @param {?} value
  186. * @return {?}
  187. */
  188. function (value) {
  189. this._effects.setDateCustomClasses(value);
  190. },
  191. enumerable: true,
  192. configurable: true
  193. });
  194. /**
  195. * @param {?} event
  196. * @return {?}
  197. */
  198. BsDatepickerAbstractComponent.prototype.setViewMode = /**
  199. * @param {?} event
  200. * @return {?}
  201. */
  202. function (event) { };
  203. /**
  204. * @param {?} event
  205. * @return {?}
  206. */
  207. BsDatepickerAbstractComponent.prototype.navigateTo = /**
  208. * @param {?} event
  209. * @return {?}
  210. */
  211. function (event) { };
  212. /**
  213. * @param {?} event
  214. * @return {?}
  215. */
  216. BsDatepickerAbstractComponent.prototype.dayHoverHandler = /**
  217. * @param {?} event
  218. * @return {?}
  219. */
  220. function (event) { };
  221. /**
  222. * @param {?} event
  223. * @return {?}
  224. */
  225. BsDatepickerAbstractComponent.prototype.weekHoverHandler = /**
  226. * @param {?} event
  227. * @return {?}
  228. */
  229. function (event) { };
  230. /**
  231. * @param {?} event
  232. * @return {?}
  233. */
  234. BsDatepickerAbstractComponent.prototype.monthHoverHandler = /**
  235. * @param {?} event
  236. * @return {?}
  237. */
  238. function (event) { };
  239. /**
  240. * @param {?} event
  241. * @return {?}
  242. */
  243. BsDatepickerAbstractComponent.prototype.yearHoverHandler = /**
  244. * @param {?} event
  245. * @return {?}
  246. */
  247. function (event) { };
  248. /**
  249. * @param {?} day
  250. * @return {?}
  251. */
  252. BsDatepickerAbstractComponent.prototype.daySelectHandler = /**
  253. * @param {?} day
  254. * @return {?}
  255. */
  256. function (day) { };
  257. /**
  258. * @param {?} event
  259. * @return {?}
  260. */
  261. BsDatepickerAbstractComponent.prototype.monthSelectHandler = /**
  262. * @param {?} event
  263. * @return {?}
  264. */
  265. function (event) { };
  266. /**
  267. * @param {?} event
  268. * @return {?}
  269. */
  270. BsDatepickerAbstractComponent.prototype.yearSelectHandler = /**
  271. * @param {?} event
  272. * @return {?}
  273. */
  274. function (event) { };
  275. /* tslint:disable-next-line: no-any */
  276. /* tslint:disable-next-line: no-any */
  277. /**
  278. * @param {?} event
  279. * @return {?}
  280. */
  281. BsDatepickerAbstractComponent.prototype._stopPropagation = /* tslint:disable-next-line: no-any */
  282. /**
  283. * @param {?} event
  284. * @return {?}
  285. */
  286. function (event) {
  287. event.stopPropagation();
  288. };
  289. return BsDatepickerAbstractComponent;
  290. }());
  291. /**
  292. * @fileoverview added by tsickle
  293. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  294. */
  295. var BsDatepickerActions = /** @class */ (function () {
  296. function BsDatepickerActions() {
  297. }
  298. /**
  299. * @return {?}
  300. */
  301. BsDatepickerActions.prototype.calculate = /**
  302. * @return {?}
  303. */
  304. function () {
  305. return { type: BsDatepickerActions.CALCULATE };
  306. };
  307. /**
  308. * @return {?}
  309. */
  310. BsDatepickerActions.prototype.format = /**
  311. * @return {?}
  312. */
  313. function () {
  314. return { type: BsDatepickerActions.FORMAT };
  315. };
  316. /**
  317. * @return {?}
  318. */
  319. BsDatepickerActions.prototype.flag = /**
  320. * @return {?}
  321. */
  322. function () {
  323. return { type: BsDatepickerActions.FLAG };
  324. };
  325. /**
  326. * @param {?} date
  327. * @return {?}
  328. */
  329. BsDatepickerActions.prototype.select = /**
  330. * @param {?} date
  331. * @return {?}
  332. */
  333. function (date) {
  334. return {
  335. type: BsDatepickerActions.SELECT,
  336. payload: date
  337. };
  338. };
  339. /**
  340. * @param {?} event
  341. * @return {?}
  342. */
  343. BsDatepickerActions.prototype.changeViewMode = /**
  344. * @param {?} event
  345. * @return {?}
  346. */
  347. function (event) {
  348. return {
  349. type: BsDatepickerActions.CHANGE_VIEWMODE,
  350. payload: event
  351. };
  352. };
  353. /**
  354. * @param {?} event
  355. * @return {?}
  356. */
  357. BsDatepickerActions.prototype.navigateTo = /**
  358. * @param {?} event
  359. * @return {?}
  360. */
  361. function (event) {
  362. return {
  363. type: BsDatepickerActions.NAVIGATE_TO,
  364. payload: event
  365. };
  366. };
  367. /**
  368. * @param {?} step
  369. * @return {?}
  370. */
  371. BsDatepickerActions.prototype.navigateStep = /**
  372. * @param {?} step
  373. * @return {?}
  374. */
  375. function (step) {
  376. return {
  377. type: BsDatepickerActions.NAVIGATE_OFFSET,
  378. payload: step
  379. };
  380. };
  381. /**
  382. * @param {?} options
  383. * @return {?}
  384. */
  385. BsDatepickerActions.prototype.setOptions = /**
  386. * @param {?} options
  387. * @return {?}
  388. */
  389. function (options) {
  390. return {
  391. type: BsDatepickerActions.SET_OPTIONS,
  392. payload: options
  393. };
  394. };
  395. // date range picker
  396. // date range picker
  397. /**
  398. * @param {?} value
  399. * @return {?}
  400. */
  401. BsDatepickerActions.prototype.selectRange =
  402. // date range picker
  403. /**
  404. * @param {?} value
  405. * @return {?}
  406. */
  407. function (value) {
  408. return {
  409. type: BsDatepickerActions.SELECT_RANGE,
  410. payload: value
  411. };
  412. };
  413. /**
  414. * @param {?} event
  415. * @return {?}
  416. */
  417. BsDatepickerActions.prototype.hoverDay = /**
  418. * @param {?} event
  419. * @return {?}
  420. */
  421. function (event) {
  422. return {
  423. type: BsDatepickerActions.HOVER,
  424. payload: event.isHovered ? event.cell.date : null
  425. };
  426. };
  427. /**
  428. * @param {?} date
  429. * @return {?}
  430. */
  431. BsDatepickerActions.prototype.minDate = /**
  432. * @param {?} date
  433. * @return {?}
  434. */
  435. function (date) {
  436. return {
  437. type: BsDatepickerActions.SET_MIN_DATE,
  438. payload: date
  439. };
  440. };
  441. /**
  442. * @param {?} date
  443. * @return {?}
  444. */
  445. BsDatepickerActions.prototype.maxDate = /**
  446. * @param {?} date
  447. * @return {?}
  448. */
  449. function (date) {
  450. return {
  451. type: BsDatepickerActions.SET_MAX_DATE,
  452. payload: date
  453. };
  454. };
  455. /**
  456. * @param {?} days
  457. * @return {?}
  458. */
  459. BsDatepickerActions.prototype.daysDisabled = /**
  460. * @param {?} days
  461. * @return {?}
  462. */
  463. function (days) {
  464. return {
  465. type: BsDatepickerActions.SET_DAYSDISABLED,
  466. payload: days
  467. };
  468. };
  469. /**
  470. * @param {?} dates
  471. * @return {?}
  472. */
  473. BsDatepickerActions.prototype.datesDisabled = /**
  474. * @param {?} dates
  475. * @return {?}
  476. */
  477. function (dates) {
  478. return {
  479. type: BsDatepickerActions.SET_DATESDISABLED,
  480. payload: dates
  481. };
  482. };
  483. /**
  484. * @param {?} value
  485. * @return {?}
  486. */
  487. BsDatepickerActions.prototype.isDisabled = /**
  488. * @param {?} value
  489. * @return {?}
  490. */
  491. function (value) {
  492. return {
  493. type: BsDatepickerActions.SET_IS_DISABLED,
  494. payload: value
  495. };
  496. };
  497. /**
  498. * @param {?} value
  499. * @return {?}
  500. */
  501. BsDatepickerActions.prototype.setDateCustomClasses = /**
  502. * @param {?} value
  503. * @return {?}
  504. */
  505. function (value) {
  506. return {
  507. type: BsDatepickerActions.SET_DATE_CUSTOM_CLASSES,
  508. payload: value
  509. };
  510. };
  511. /**
  512. * @param {?} locale
  513. * @return {?}
  514. */
  515. BsDatepickerActions.prototype.setLocale = /**
  516. * @param {?} locale
  517. * @return {?}
  518. */
  519. function (locale) {
  520. return {
  521. type: BsDatepickerActions.SET_LOCALE,
  522. payload: locale
  523. };
  524. };
  525. BsDatepickerActions.CALCULATE = '[datepicker] calculate dates matrix';
  526. BsDatepickerActions.FORMAT = '[datepicker] format datepicker values';
  527. BsDatepickerActions.FLAG = '[datepicker] set flags';
  528. BsDatepickerActions.SELECT = '[datepicker] select date';
  529. BsDatepickerActions.NAVIGATE_OFFSET = '[datepicker] shift view date';
  530. BsDatepickerActions.NAVIGATE_TO = '[datepicker] change view date';
  531. BsDatepickerActions.SET_OPTIONS = '[datepicker] update render options';
  532. BsDatepickerActions.HOVER = '[datepicker] hover date';
  533. BsDatepickerActions.CHANGE_VIEWMODE = '[datepicker] switch view mode';
  534. BsDatepickerActions.SET_MIN_DATE = '[datepicker] set min date';
  535. BsDatepickerActions.SET_MAX_DATE = '[datepicker] set max date';
  536. BsDatepickerActions.SET_DAYSDISABLED = '[datepicker] set days disabled';
  537. BsDatepickerActions.SET_DATESDISABLED = '[datepicker] set dates disabled';
  538. BsDatepickerActions.SET_IS_DISABLED = '[datepicker] set is disabled';
  539. BsDatepickerActions.SET_DATE_CUSTOM_CLASSES = '[datepicker] set date custom classes';
  540. BsDatepickerActions.SET_LOCALE = '[datepicker] set datepicker locale';
  541. BsDatepickerActions.SELECT_RANGE = '[daterangepicker] select dates range';
  542. BsDatepickerActions.decorators = [
  543. { type: core.Injectable }
  544. ];
  545. return BsDatepickerActions;
  546. }());
  547. /**
  548. * @fileoverview added by tsickle
  549. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  550. */
  551. var BsLocaleService = /** @class */ (function () {
  552. function BsLocaleService() {
  553. this._defaultLocale = 'en';
  554. this._locale = new rxjs.BehaviorSubject(this._defaultLocale);
  555. this._localeChange = this._locale.asObservable();
  556. }
  557. Object.defineProperty(BsLocaleService.prototype, "locale", {
  558. get: /**
  559. * @return {?}
  560. */
  561. function () {
  562. return this._locale;
  563. },
  564. enumerable: true,
  565. configurable: true
  566. });
  567. Object.defineProperty(BsLocaleService.prototype, "localeChange", {
  568. get: /**
  569. * @return {?}
  570. */
  571. function () {
  572. return this._localeChange;
  573. },
  574. enumerable: true,
  575. configurable: true
  576. });
  577. Object.defineProperty(BsLocaleService.prototype, "currentLocale", {
  578. get: /**
  579. * @return {?}
  580. */
  581. function () {
  582. return this._locale.getValue();
  583. },
  584. enumerable: true,
  585. configurable: true
  586. });
  587. /**
  588. * @param {?} locale
  589. * @return {?}
  590. */
  591. BsLocaleService.prototype.use = /**
  592. * @param {?} locale
  593. * @return {?}
  594. */
  595. function (locale) {
  596. if (locale === this.currentLocale) {
  597. return;
  598. }
  599. this._locale.next(locale);
  600. };
  601. BsLocaleService.decorators = [
  602. { type: core.Injectable }
  603. ];
  604. return BsLocaleService;
  605. }());
  606. /**
  607. * @fileoverview added by tsickle
  608. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  609. */
  610. var BsDatepickerEffects = /** @class */ (function () {
  611. function BsDatepickerEffects(_actions, _localeService) {
  612. this._actions = _actions;
  613. this._localeService = _localeService;
  614. this._subs = [];
  615. }
  616. /**
  617. * @param {?} _bsDatepickerStore
  618. * @return {?}
  619. */
  620. BsDatepickerEffects.prototype.init = /**
  621. * @param {?} _bsDatepickerStore
  622. * @return {?}
  623. */
  624. function (_bsDatepickerStore) {
  625. this._store = _bsDatepickerStore;
  626. return this;
  627. };
  628. /** setters */
  629. /**
  630. * setters
  631. * @param {?} value
  632. * @return {?}
  633. */
  634. BsDatepickerEffects.prototype.setValue = /**
  635. * setters
  636. * @param {?} value
  637. * @return {?}
  638. */
  639. function (value) {
  640. this._store.dispatch(this._actions.select(value));
  641. };
  642. /**
  643. * @param {?} value
  644. * @return {?}
  645. */
  646. BsDatepickerEffects.prototype.setRangeValue = /**
  647. * @param {?} value
  648. * @return {?}
  649. */
  650. function (value) {
  651. this._store.dispatch(this._actions.selectRange(value));
  652. };
  653. /**
  654. * @param {?} value
  655. * @return {?}
  656. */
  657. BsDatepickerEffects.prototype.setMinDate = /**
  658. * @param {?} value
  659. * @return {?}
  660. */
  661. function (value) {
  662. this._store.dispatch(this._actions.minDate(value));
  663. return this;
  664. };
  665. /**
  666. * @param {?} value
  667. * @return {?}
  668. */
  669. BsDatepickerEffects.prototype.setMaxDate = /**
  670. * @param {?} value
  671. * @return {?}
  672. */
  673. function (value) {
  674. this._store.dispatch(this._actions.maxDate(value));
  675. return this;
  676. };
  677. /**
  678. * @template THIS
  679. * @this {THIS}
  680. * @param {?} value
  681. * @return {THIS}
  682. */
  683. BsDatepickerEffects.prototype.setDaysDisabled = /**
  684. * @template THIS
  685. * @this {THIS}
  686. * @param {?} value
  687. * @return {THIS}
  688. */
  689. function (value) {
  690. (/** @type {?} */ (this))._store.dispatch((/** @type {?} */ (this))._actions.daysDisabled(value));
  691. return (/** @type {?} */ (this));
  692. };
  693. /**
  694. * @template THIS
  695. * @this {THIS}
  696. * @param {?} value
  697. * @return {THIS}
  698. */
  699. BsDatepickerEffects.prototype.setDatesDisabled = /**
  700. * @template THIS
  701. * @this {THIS}
  702. * @param {?} value
  703. * @return {THIS}
  704. */
  705. function (value) {
  706. (/** @type {?} */ (this))._store.dispatch((/** @type {?} */ (this))._actions.datesDisabled(value));
  707. return (/** @type {?} */ (this));
  708. };
  709. /**
  710. * @param {?} value
  711. * @return {?}
  712. */
  713. BsDatepickerEffects.prototype.setDisabled = /**
  714. * @param {?} value
  715. * @return {?}
  716. */
  717. function (value) {
  718. this._store.dispatch(this._actions.isDisabled(value));
  719. return this;
  720. };
  721. /**
  722. * @param {?} value
  723. * @return {?}
  724. */
  725. BsDatepickerEffects.prototype.setDateCustomClasses = /**
  726. * @param {?} value
  727. * @return {?}
  728. */
  729. function (value) {
  730. this._store.dispatch(this._actions.setDateCustomClasses(value));
  731. return this;
  732. };
  733. /* Set rendering options */
  734. /* Set rendering options */
  735. /**
  736. * @param {?} _config
  737. * @return {?}
  738. */
  739. BsDatepickerEffects.prototype.setOptions = /* Set rendering options */
  740. /**
  741. * @param {?} _config
  742. * @return {?}
  743. */
  744. function (_config) {
  745. /** @type {?} */
  746. var _options = Object.assign({ locale: this._localeService.currentLocale }, _config);
  747. this._store.dispatch(this._actions.setOptions(_options));
  748. return this;
  749. };
  750. /** view to mode bindings */
  751. /**
  752. * view to mode bindings
  753. * @param {?} container
  754. * @return {?}
  755. */
  756. BsDatepickerEffects.prototype.setBindings = /**
  757. * view to mode bindings
  758. * @param {?} container
  759. * @return {?}
  760. */
  761. function (container) {
  762. container.daysCalendar = this._store
  763. .select((/**
  764. * @param {?} state
  765. * @return {?}
  766. */
  767. function (state) { return state.flaggedMonths; }))
  768. .pipe(operators.filter((/**
  769. * @param {?} months
  770. * @return {?}
  771. */
  772. function (months) { return !!months; })));
  773. // month calendar
  774. container.monthsCalendar = this._store
  775. .select((/**
  776. * @param {?} state
  777. * @return {?}
  778. */
  779. function (state) { return state.flaggedMonthsCalendar; }))
  780. .pipe(operators.filter((/**
  781. * @param {?} months
  782. * @return {?}
  783. */
  784. function (months) { return !!months; })));
  785. // year calendar
  786. container.yearsCalendar = this._store
  787. .select((/**
  788. * @param {?} state
  789. * @return {?}
  790. */
  791. function (state) { return state.yearsCalendarFlagged; }))
  792. .pipe(operators.filter((/**
  793. * @param {?} years
  794. * @return {?}
  795. */
  796. function (years) { return !!years; })));
  797. container.viewMode = this._store.select((/**
  798. * @param {?} state
  799. * @return {?}
  800. */
  801. function (state) { return state.view.mode; }));
  802. container.options = this._store
  803. .select((/**
  804. * @param {?} state
  805. * @return {?}
  806. */
  807. function (state) { return state.showWeekNumbers; }))
  808. .pipe(operators.map((/**
  809. * @param {?} showWeekNumbers
  810. * @return {?}
  811. */
  812. function (showWeekNumbers) { return ({ showWeekNumbers: showWeekNumbers }); })));
  813. return this;
  814. };
  815. /** event handlers */
  816. /**
  817. * event handlers
  818. * @param {?} container
  819. * @return {?}
  820. */
  821. BsDatepickerEffects.prototype.setEventHandlers = /**
  822. * event handlers
  823. * @param {?} container
  824. * @return {?}
  825. */
  826. function (container) {
  827. var _this = this;
  828. container.setViewMode = (/**
  829. * @param {?} event
  830. * @return {?}
  831. */
  832. function (event) {
  833. _this._store.dispatch(_this._actions.changeViewMode(event));
  834. });
  835. container.navigateTo = (/**
  836. * @param {?} event
  837. * @return {?}
  838. */
  839. function (event) {
  840. _this._store.dispatch(_this._actions.navigateStep(event.step));
  841. });
  842. container.dayHoverHandler = (/**
  843. * @param {?} event
  844. * @return {?}
  845. */
  846. function (event) {
  847. /** @type {?} */
  848. var _cell = (/** @type {?} */ (event.cell));
  849. if (_cell.isOtherMonth || _cell.isDisabled) {
  850. return;
  851. }
  852. _this._store.dispatch(_this._actions.hoverDay(event));
  853. _cell.isHovered = event.isHovered;
  854. });
  855. container.monthHoverHandler = (/**
  856. * @param {?} event
  857. * @return {?}
  858. */
  859. function (event) {
  860. event.cell.isHovered = event.isHovered;
  861. });
  862. container.yearHoverHandler = (/**
  863. * @param {?} event
  864. * @return {?}
  865. */
  866. function (event) {
  867. event.cell.isHovered = event.isHovered;
  868. });
  869. container.monthSelectHandler = (/**
  870. * @param {?} event
  871. * @return {?}
  872. */
  873. function (event) {
  874. if (event.isDisabled) {
  875. return;
  876. }
  877. _this._store.dispatch(_this._actions.navigateTo({
  878. unit: {
  879. month: chronos.getMonth(event.date),
  880. year: chronos.getFullYear(event.date)
  881. },
  882. viewMode: 'day'
  883. }));
  884. });
  885. container.yearSelectHandler = (/**
  886. * @param {?} event
  887. * @return {?}
  888. */
  889. function (event) {
  890. if (event.isDisabled) {
  891. return;
  892. }
  893. _this._store.dispatch(_this._actions.navigateTo({
  894. unit: {
  895. year: chronos.getFullYear(event.date)
  896. },
  897. viewMode: 'month'
  898. }));
  899. });
  900. return this;
  901. };
  902. /**
  903. * @return {?}
  904. */
  905. BsDatepickerEffects.prototype.registerDatepickerSideEffects = /**
  906. * @return {?}
  907. */
  908. function () {
  909. var _this = this;
  910. this._subs.push(this._store.select((/**
  911. * @param {?} state
  912. * @return {?}
  913. */
  914. function (state) { return state.view; })).subscribe((/**
  915. * @param {?} view
  916. * @return {?}
  917. */
  918. function (view) {
  919. _this._store.dispatch(_this._actions.calculate());
  920. })));
  921. // format calendar values on month model change
  922. this._subs.push(this._store
  923. .select((/**
  924. * @param {?} state
  925. * @return {?}
  926. */
  927. function (state) { return state.monthsModel; }))
  928. .pipe(operators.filter((/**
  929. * @param {?} monthModel
  930. * @return {?}
  931. */
  932. function (monthModel) { return !!monthModel; })))
  933. .subscribe((/**
  934. * @param {?} month
  935. * @return {?}
  936. */
  937. function (month) { return _this._store.dispatch(_this._actions.format()); })));
  938. // flag day values
  939. this._subs.push(this._store
  940. .select((/**
  941. * @param {?} state
  942. * @return {?}
  943. */
  944. function (state) { return state.formattedMonths; }))
  945. .pipe(operators.filter((/**
  946. * @param {?} month
  947. * @return {?}
  948. */
  949. function (month) { return !!month; })))
  950. .subscribe((/**
  951. * @param {?} month
  952. * @return {?}
  953. */
  954. function (month) { return _this._store.dispatch(_this._actions.flag()); })));
  955. // flag day values
  956. this._subs.push(this._store
  957. .select((/**
  958. * @param {?} state
  959. * @return {?}
  960. */
  961. function (state) { return state.selectedDate; }))
  962. .pipe(operators.filter((/**
  963. * @param {?} selectedDate
  964. * @return {?}
  965. */
  966. function (selectedDate) { return !!selectedDate; })))
  967. .subscribe((/**
  968. * @param {?} selectedDate
  969. * @return {?}
  970. */
  971. function (selectedDate) { return _this._store.dispatch(_this._actions.flag()); })));
  972. // flag for date range picker
  973. this._subs.push(this._store
  974. .select((/**
  975. * @param {?} state
  976. * @return {?}
  977. */
  978. function (state) { return state.selectedRange; }))
  979. .pipe(operators.filter((/**
  980. * @param {?} selectedRange
  981. * @return {?}
  982. */
  983. function (selectedRange) { return !!selectedRange; })))
  984. .subscribe((/**
  985. * @param {?} selectedRange
  986. * @return {?}
  987. */
  988. function (selectedRange) { return _this._store.dispatch(_this._actions.flag()); })));
  989. // monthsCalendar
  990. this._subs.push(this._store
  991. .select((/**
  992. * @param {?} state
  993. * @return {?}
  994. */
  995. function (state) { return state.monthsCalendar; }))
  996. .subscribe((/**
  997. * @return {?}
  998. */
  999. function () { return _this._store.dispatch(_this._actions.flag()); })));
  1000. // years calendar
  1001. this._subs.push(this._store
  1002. .select((/**
  1003. * @param {?} state
  1004. * @return {?}
  1005. */
  1006. function (state) { return state.yearsCalendarModel; }))
  1007. .pipe(operators.filter((/**
  1008. * @param {?} state
  1009. * @return {?}
  1010. */
  1011. function (state) { return !!state; })))
  1012. .subscribe((/**
  1013. * @return {?}
  1014. */
  1015. function () { return _this._store.dispatch(_this._actions.flag()); })));
  1016. // on hover
  1017. this._subs.push(this._store
  1018. .select((/**
  1019. * @param {?} state
  1020. * @return {?}
  1021. */
  1022. function (state) { return state.hoveredDate; }))
  1023. .pipe(operators.filter((/**
  1024. * @param {?} hoveredDate
  1025. * @return {?}
  1026. */
  1027. function (hoveredDate) { return !!hoveredDate; })))
  1028. .subscribe((/**
  1029. * @param {?} hoveredDate
  1030. * @return {?}
  1031. */
  1032. function (hoveredDate) { return _this._store.dispatch(_this._actions.flag()); })));
  1033. // date custom classes
  1034. this._subs.push(this._store
  1035. .select((/**
  1036. * @param {?} state
  1037. * @return {?}
  1038. */
  1039. function (state) { return state.dateCustomClasses; }))
  1040. .pipe(operators.filter((/**
  1041. * @param {?} dateCustomClasses
  1042. * @return {?}
  1043. */
  1044. function (dateCustomClasses) { return !!dateCustomClasses; })))
  1045. .subscribe((/**
  1046. * @param {?} dateCustomClasses
  1047. * @return {?}
  1048. */
  1049. function (dateCustomClasses) { return _this._store.dispatch(_this._actions.flag()); })));
  1050. // on locale change
  1051. this._subs.push(this._localeService.localeChange
  1052. .subscribe((/**
  1053. * @param {?} locale
  1054. * @return {?}
  1055. */
  1056. function (locale) { return _this._store.dispatch(_this._actions.setLocale(locale)); })));
  1057. return this;
  1058. };
  1059. /**
  1060. * @return {?}
  1061. */
  1062. BsDatepickerEffects.prototype.destroy = /**
  1063. * @return {?}
  1064. */
  1065. function () {
  1066. var e_1, _a;
  1067. try {
  1068. for (var _b = __values(this._subs), _c = _b.next(); !_c.done; _c = _b.next()) {
  1069. var sub = _c.value;
  1070. sub.unsubscribe();
  1071. }
  1072. }
  1073. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  1074. finally {
  1075. try {
  1076. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  1077. }
  1078. finally { if (e_1) throw e_1.error; }
  1079. }
  1080. };
  1081. BsDatepickerEffects.decorators = [
  1082. { type: core.Injectable }
  1083. ];
  1084. /** @nocollapse */
  1085. BsDatepickerEffects.ctorParameters = function () { return [
  1086. { type: BsDatepickerActions },
  1087. { type: BsLocaleService }
  1088. ]; };
  1089. return BsDatepickerEffects;
  1090. }());
  1091. /**
  1092. * @fileoverview added by tsickle
  1093. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1094. */
  1095. /** @type {?} */
  1096. var defaultMonthOptions = {
  1097. width: 7,
  1098. height: 6
  1099. };
  1100. /**
  1101. * @fileoverview added by tsickle
  1102. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1103. */
  1104. /** @type {?} */
  1105. var _initialView = { date: new Date(), mode: 'day' };
  1106. /** @type {?} */
  1107. var initialDatepickerState = Object.assign(new BsDatepickerConfig(), {
  1108. locale: 'en',
  1109. view: _initialView,
  1110. selectedRange: [],
  1111. monthViewOptions: defaultMonthOptions
  1112. });
  1113. /**
  1114. * @fileoverview added by tsickle
  1115. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1116. */
  1117. /**
  1118. * @param {?} date
  1119. * @param {?} options
  1120. * @return {?}
  1121. */
  1122. function getStartingDayOfCalendar(date, options) {
  1123. if (chronos.isFirstDayOfWeek(date, options.firstDayOfWeek)) {
  1124. return date;
  1125. }
  1126. /** @type {?} */
  1127. var weekDay = chronos.getDay(date);
  1128. /** @type {?} */
  1129. var offset = calculateDateOffset(weekDay, options.firstDayOfWeek);
  1130. return chronos.shiftDate(date, { day: -offset });
  1131. }
  1132. /**
  1133. * @param {?} weekday
  1134. * @param {?} startingDayOffset
  1135. * @return {?}
  1136. */
  1137. function calculateDateOffset(weekday, startingDayOffset) {
  1138. if (startingDayOffset === 0) {
  1139. return weekday;
  1140. }
  1141. /** @type {?} */
  1142. var offset = weekday - startingDayOffset % 7;
  1143. return offset < 0 ? offset + 7 : offset;
  1144. }
  1145. /**
  1146. * @param {?} date
  1147. * @param {?} min
  1148. * @param {?} max
  1149. * @return {?}
  1150. */
  1151. function isMonthDisabled(date, min, max) {
  1152. /** @type {?} */
  1153. var minBound = min && chronos.isBefore(chronos.endOf(date, 'month'), min, 'day');
  1154. /** @type {?} */
  1155. var maxBound = max && chronos.isAfter(chronos.startOf(date, 'month'), max, 'day');
  1156. return minBound || maxBound;
  1157. }
  1158. /**
  1159. * @param {?} date
  1160. * @param {?} min
  1161. * @param {?} max
  1162. * @return {?}
  1163. */
  1164. function isYearDisabled(date, min, max) {
  1165. /** @type {?} */
  1166. var minBound = min && chronos.isBefore(chronos.endOf(date, 'year'), min, 'day');
  1167. /** @type {?} */
  1168. var maxBound = max && chronos.isAfter(chronos.startOf(date, 'year'), max, 'day');
  1169. return minBound || maxBound;
  1170. }
  1171. /**
  1172. * @param {?} date
  1173. * @param {?} datesDisabled
  1174. * @return {?}
  1175. */
  1176. function isDisabledDate(date, datesDisabled) {
  1177. if (datesDisabled === undefined || !datesDisabled || !datesDisabled.length) {
  1178. return false;
  1179. }
  1180. return datesDisabled.some((/**
  1181. * @param {?} dateDisabled
  1182. * @return {?}
  1183. */
  1184. function (dateDisabled) { return chronos.isSame(date, dateDisabled, 'date'); }));
  1185. }
  1186. /**
  1187. * @param {?} state
  1188. * @param {?=} calendarIndex
  1189. * @return {?}
  1190. */
  1191. function getYearsCalendarInitialDate(state, calendarIndex) {
  1192. if (calendarIndex === void 0) { calendarIndex = 0; }
  1193. /** @type {?} */
  1194. var model = state && state.yearsCalendarModel && state.yearsCalendarModel[calendarIndex];
  1195. return model && model.years && model.years[0] && model.years[0][0] && model.years[0][0].date;
  1196. }
  1197. /**
  1198. * @fileoverview added by tsickle
  1199. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1200. */
  1201. /**
  1202. * @template T
  1203. * @param {?} options
  1204. * @param {?} fn
  1205. * @return {?}
  1206. */
  1207. function createMatrix(options, fn) {
  1208. /** @type {?} */
  1209. var prevValue = options.initialDate;
  1210. /** @type {?} */
  1211. var matrix = new Array(options.height);
  1212. for (var i = 0; i < options.height; i++) {
  1213. matrix[i] = new Array(options.width);
  1214. for (var j = 0; j < options.width; j++) {
  1215. matrix[i][j] = fn(prevValue);
  1216. prevValue = chronos.shiftDate(prevValue, options.shift);
  1217. }
  1218. }
  1219. return matrix;
  1220. }
  1221. /**
  1222. * @fileoverview added by tsickle
  1223. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1224. */
  1225. /**
  1226. * @param {?} startingDate
  1227. * @param {?} options
  1228. * @return {?}
  1229. */
  1230. function calcDaysCalendar(startingDate, options) {
  1231. /** @type {?} */
  1232. var firstDay = chronos.getFirstDayOfMonth(startingDate);
  1233. /** @type {?} */
  1234. var initialDate = getStartingDayOfCalendar(firstDay, options);
  1235. /** @type {?} */
  1236. var matrixOptions = {
  1237. width: options.width,
  1238. height: options.height,
  1239. initialDate: initialDate,
  1240. shift: { day: 1 }
  1241. };
  1242. /** @type {?} */
  1243. var daysMatrix = createMatrix(matrixOptions, (/**
  1244. * @param {?} date
  1245. * @return {?}
  1246. */
  1247. function (date) { return date; }));
  1248. return {
  1249. daysMatrix: daysMatrix,
  1250. month: firstDay
  1251. };
  1252. }
  1253. /**
  1254. * @fileoverview added by tsickle
  1255. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1256. */
  1257. /**
  1258. * @param {?} daysCalendar
  1259. * @param {?} formatOptions
  1260. * @param {?} monthIndex
  1261. * @return {?}
  1262. */
  1263. function formatDaysCalendar(daysCalendar, formatOptions, monthIndex) {
  1264. return {
  1265. month: daysCalendar.month,
  1266. monthTitle: chronos.formatDate(daysCalendar.month, formatOptions.monthTitle, formatOptions.locale),
  1267. yearTitle: chronos.formatDate(daysCalendar.month, formatOptions.yearTitle, formatOptions.locale),
  1268. weekNumbers: getWeekNumbers(daysCalendar.daysMatrix, formatOptions.weekNumbers, formatOptions.locale),
  1269. weekdays: getShiftedWeekdays(formatOptions.locale),
  1270. weeks: daysCalendar.daysMatrix.map((/**
  1271. * @param {?} week
  1272. * @param {?} weekIndex
  1273. * @return {?}
  1274. */
  1275. function (week, weekIndex) { return ({
  1276. days: week.map((/**
  1277. * @param {?} date
  1278. * @param {?} dayIndex
  1279. * @return {?}
  1280. */
  1281. function (date, dayIndex) { return ({
  1282. date: date,
  1283. label: chronos.formatDate(date, formatOptions.dayLabel, formatOptions.locale),
  1284. monthIndex: monthIndex,
  1285. weekIndex: weekIndex,
  1286. dayIndex: dayIndex
  1287. }); }))
  1288. }); }))
  1289. };
  1290. }
  1291. /**
  1292. * @param {?} daysMatrix
  1293. * @param {?} format
  1294. * @param {?} locale
  1295. * @return {?}
  1296. */
  1297. function getWeekNumbers(daysMatrix, format, locale) {
  1298. return daysMatrix.map((/**
  1299. * @param {?} days
  1300. * @return {?}
  1301. */
  1302. function (days) { return (days[0] ? chronos.formatDate(days[0], format, locale) : ''); }));
  1303. }
  1304. /**
  1305. * @param {?} locale
  1306. * @return {?}
  1307. */
  1308. function getShiftedWeekdays(locale) {
  1309. /** @type {?} */
  1310. var _locale = chronos.getLocale(locale);
  1311. /** @type {?} */
  1312. var weekdays = (/** @type {?} */ (_locale.weekdaysShort()));
  1313. /** @type {?} */
  1314. var firstDayOfWeek = _locale.firstDayOfWeek();
  1315. return __spread(weekdays.slice(firstDayOfWeek), weekdays.slice(0, firstDayOfWeek));
  1316. }
  1317. /**
  1318. * @fileoverview added by tsickle
  1319. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1320. */
  1321. /**
  1322. * @param {?} formattedMonth
  1323. * @param {?} options
  1324. * @return {?}
  1325. */
  1326. function flagDaysCalendar(formattedMonth, options) {
  1327. formattedMonth.weeks.forEach((/**
  1328. * @param {?} week
  1329. * @return {?}
  1330. */
  1331. function (week) {
  1332. /* tslint:disable-next-line: cyclomatic-complexity */
  1333. week.days.forEach((/**
  1334. * @param {?} day
  1335. * @param {?} dayIndex
  1336. * @return {?}
  1337. */
  1338. function (day, dayIndex) {
  1339. // datepicker
  1340. /** @type {?} */
  1341. var isOtherMonth = !chronos.isSameMonth(day.date, formattedMonth.month);
  1342. /** @type {?} */
  1343. var isHovered = !isOtherMonth && chronos.isSameDay(day.date, options.hoveredDate);
  1344. // date range picker
  1345. /** @type {?} */
  1346. var isSelectionStart = !isOtherMonth &&
  1347. options.selectedRange &&
  1348. chronos.isSameDay(day.date, options.selectedRange[0]);
  1349. /** @type {?} */
  1350. var isSelectionEnd = !isOtherMonth &&
  1351. options.selectedRange &&
  1352. chronos.isSameDay(day.date, options.selectedRange[1]);
  1353. /** @type {?} */
  1354. var isSelected = (!isOtherMonth && chronos.isSameDay(day.date, options.selectedDate)) ||
  1355. isSelectionStart ||
  1356. isSelectionEnd;
  1357. /** @type {?} */
  1358. var isInRange = !isOtherMonth &&
  1359. options.selectedRange &&
  1360. isDateInRange(day.date, options.selectedRange, options.hoveredDate);
  1361. /** @type {?} */
  1362. var isDisabled = options.isDisabled ||
  1363. chronos.isBefore(day.date, options.minDate, 'day') ||
  1364. chronos.isAfter(day.date, options.maxDate, 'day') ||
  1365. chronos.isDisabledDay(day.date, options.daysDisabled) ||
  1366. isDisabledDate(day.date, options.datesDisabled);
  1367. /** @type {?} */
  1368. var currentDate = new Date();
  1369. /** @type {?} */
  1370. var isToday = !isOtherMonth && chronos.isSameDay(day.date, currentDate);
  1371. /** @type {?} */
  1372. var customClasses = options.dateCustomClasses && options.dateCustomClasses
  1373. .map((/**
  1374. * @param {?} dcc
  1375. * @return {?}
  1376. */
  1377. function (dcc) { return chronos.isSameDay(day.date, dcc.date) ? dcc.classes : []; }))
  1378. .reduce((/**
  1379. * @param {?} previousValue
  1380. * @param {?} currentValue
  1381. * @return {?}
  1382. */
  1383. function (previousValue, currentValue) { return previousValue.concat(currentValue); }), [])
  1384. .join(' ')
  1385. || '';
  1386. // decide update or not
  1387. /** @type {?} */
  1388. var newDay = Object.assign({}, day, {
  1389. isOtherMonth: isOtherMonth,
  1390. isHovered: isHovered,
  1391. isSelected: isSelected,
  1392. isSelectionStart: isSelectionStart,
  1393. isSelectionEnd: isSelectionEnd,
  1394. isInRange: isInRange,
  1395. isDisabled: isDisabled,
  1396. isToday: isToday,
  1397. customClasses: customClasses
  1398. });
  1399. if (day.isOtherMonth !== newDay.isOtherMonth ||
  1400. day.isHovered !== newDay.isHovered ||
  1401. day.isSelected !== newDay.isSelected ||
  1402. day.isSelectionStart !== newDay.isSelectionStart ||
  1403. day.isSelectionEnd !== newDay.isSelectionEnd ||
  1404. day.isDisabled !== newDay.isDisabled ||
  1405. day.isInRange !== newDay.isInRange ||
  1406. day.customClasses !== newDay.customClasses) {
  1407. week.days[dayIndex] = newDay;
  1408. }
  1409. }));
  1410. }));
  1411. // todo: add check for linked calendars
  1412. formattedMonth.hideLeftArrow =
  1413. options.isDisabled ||
  1414. (options.monthIndex > 0 && options.monthIndex !== options.displayMonths);
  1415. formattedMonth.hideRightArrow =
  1416. options.isDisabled ||
  1417. (options.monthIndex < options.displayMonths &&
  1418. options.monthIndex + 1 !== options.displayMonths);
  1419. formattedMonth.disableLeftArrow = isMonthDisabled(chronos.shiftDate(formattedMonth.month, { month: -1 }), options.minDate, options.maxDate);
  1420. formattedMonth.disableRightArrow = isMonthDisabled(chronos.shiftDate(formattedMonth.month, { month: 1 }), options.minDate, options.maxDate);
  1421. return formattedMonth;
  1422. }
  1423. /**
  1424. * @param {?} date
  1425. * @param {?} selectedRange
  1426. * @param {?} hoveredDate
  1427. * @return {?}
  1428. */
  1429. function isDateInRange(date, selectedRange, hoveredDate) {
  1430. if (!date || !selectedRange[0]) {
  1431. return false;
  1432. }
  1433. if (selectedRange[1]) {
  1434. return date > selectedRange[0] && date <= selectedRange[1];
  1435. }
  1436. if (hoveredDate) {
  1437. return date > selectedRange[0] && date <= hoveredDate;
  1438. }
  1439. return false;
  1440. }
  1441. /**
  1442. * @fileoverview added by tsickle
  1443. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1444. */
  1445. /**
  1446. * @param {?} mode
  1447. * @param {?=} minMode
  1448. * @return {?}
  1449. */
  1450. function canSwitchMode(mode, minMode) {
  1451. return minMode ? mode >= minMode : true;
  1452. }
  1453. /**
  1454. * @fileoverview added by tsickle
  1455. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1456. */
  1457. /** @type {?} */
  1458. var height = 4;
  1459. /** @type {?} */
  1460. var width = 3;
  1461. /** @type {?} */
  1462. var shift = { month: 1 };
  1463. /**
  1464. * @param {?} viewDate
  1465. * @param {?} formatOptions
  1466. * @return {?}
  1467. */
  1468. function formatMonthsCalendar(viewDate, formatOptions) {
  1469. /** @type {?} */
  1470. var initialDate = chronos.startOf(viewDate, 'year');
  1471. /** @type {?} */
  1472. var matrixOptions = { width: width, height: height, initialDate: initialDate, shift: shift };
  1473. /** @type {?} */
  1474. var monthMatrix = createMatrix(matrixOptions, (/**
  1475. * @param {?} date
  1476. * @return {?}
  1477. */
  1478. function (date) { return ({
  1479. date: date,
  1480. label: chronos.formatDate(date, formatOptions.monthLabel, formatOptions.locale)
  1481. }); }));
  1482. return {
  1483. months: monthMatrix,
  1484. monthTitle: '',
  1485. yearTitle: chronos.formatDate(viewDate, formatOptions.yearTitle, formatOptions.locale)
  1486. };
  1487. }
  1488. /**
  1489. * @fileoverview added by tsickle
  1490. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1491. */
  1492. /**
  1493. * @param {?} monthCalendar
  1494. * @param {?} options
  1495. * @return {?}
  1496. */
  1497. function flagMonthsCalendar(monthCalendar, options) {
  1498. monthCalendar.months.forEach((/**
  1499. * @param {?} months
  1500. * @param {?} rowIndex
  1501. * @return {?}
  1502. */
  1503. function (months, rowIndex) {
  1504. months.forEach((/**
  1505. * @param {?} month
  1506. * @param {?} monthIndex
  1507. * @return {?}
  1508. */
  1509. function (month, monthIndex) {
  1510. /** @type {?} */
  1511. var isHovered = chronos.isSameMonth(month.date, options.hoveredMonth);
  1512. /** @type {?} */
  1513. var isDisabled = options.isDisabled ||
  1514. isMonthDisabled(month.date, options.minDate, options.maxDate);
  1515. /** @type {?} */
  1516. var isSelected = chronos.isSameMonth(month.date, options.selectedDate);
  1517. /** @type {?} */
  1518. var newMonth = Object.assign(/*{},*/ month, {
  1519. isHovered: isHovered,
  1520. isDisabled: isDisabled,
  1521. isSelected: isSelected
  1522. });
  1523. if (month.isHovered !== newMonth.isHovered ||
  1524. month.isDisabled !== newMonth.isDisabled ||
  1525. month.isSelected !== newMonth.isSelected) {
  1526. monthCalendar.months[rowIndex][monthIndex] = newMonth;
  1527. }
  1528. }));
  1529. }));
  1530. // todo: add check for linked calendars
  1531. monthCalendar.hideLeftArrow =
  1532. options.monthIndex > 0 && options.monthIndex !== options.displayMonths;
  1533. monthCalendar.hideRightArrow =
  1534. options.monthIndex < options.displayMonths &&
  1535. options.monthIndex + 1 !== options.displayMonths;
  1536. monthCalendar.disableLeftArrow = isYearDisabled(chronos.shiftDate(monthCalendar.months[0][0].date, { year: -1 }), options.minDate, options.maxDate);
  1537. monthCalendar.disableRightArrow = isYearDisabled(chronos.shiftDate(monthCalendar.months[0][0].date, { year: 1 }), options.minDate, options.maxDate);
  1538. return monthCalendar;
  1539. }
  1540. /**
  1541. * @fileoverview added by tsickle
  1542. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1543. */
  1544. /** @type {?} */
  1545. var height$1 = 4;
  1546. /** @type {?} */
  1547. var width$1 = 4;
  1548. /** @type {?} */
  1549. var yearsPerCalendar = height$1 * width$1;
  1550. /** @type {?} */
  1551. var initialYearShift = (Math.floor(yearsPerCalendar / 2) - 1) * -1;
  1552. /** @type {?} */
  1553. var shift$1 = { year: 1 };
  1554. /**
  1555. * @param {?} viewDate
  1556. * @param {?} formatOptions
  1557. * @param {?=} previousInitialDate
  1558. * @return {?}
  1559. */
  1560. function formatYearsCalendar(viewDate, formatOptions, previousInitialDate) {
  1561. /** @type {?} */
  1562. var initialDate = calculateInitialDate(viewDate, previousInitialDate);
  1563. /** @type {?} */
  1564. var matrixOptions = { width: width$1, height: height$1, initialDate: initialDate, shift: shift$1 };
  1565. /** @type {?} */
  1566. var yearsMatrix = createMatrix(matrixOptions, (/**
  1567. * @param {?} date
  1568. * @return {?}
  1569. */
  1570. function (date) { return ({
  1571. date: date,
  1572. label: chronos.formatDate(date, formatOptions.yearLabel, formatOptions.locale)
  1573. }); }));
  1574. /** @type {?} */
  1575. var yearTitle = formatYearRangeTitle(yearsMatrix, formatOptions);
  1576. return {
  1577. years: yearsMatrix,
  1578. monthTitle: '',
  1579. yearTitle: yearTitle
  1580. };
  1581. }
  1582. /**
  1583. * @param {?} viewDate
  1584. * @param {?=} previousInitialDate
  1585. * @return {?}
  1586. */
  1587. function calculateInitialDate(viewDate, previousInitialDate) {
  1588. if (previousInitialDate
  1589. && viewDate.getFullYear() >= previousInitialDate.getFullYear()
  1590. && viewDate.getFullYear() < previousInitialDate.getFullYear() + yearsPerCalendar) {
  1591. return previousInitialDate;
  1592. }
  1593. return chronos.shiftDate(viewDate, { year: initialYearShift });
  1594. }
  1595. /**
  1596. * @param {?} yearsMatrix
  1597. * @param {?} formatOptions
  1598. * @return {?}
  1599. */
  1600. function formatYearRangeTitle(yearsMatrix, formatOptions) {
  1601. /** @type {?} */
  1602. var from = chronos.formatDate(yearsMatrix[0][0].date, formatOptions.yearTitle, formatOptions.locale);
  1603. /** @type {?} */
  1604. var to = chronos.formatDate(yearsMatrix[height$1 - 1][width$1 - 1].date, formatOptions.yearTitle, formatOptions.locale);
  1605. return from + " - " + to;
  1606. }
  1607. /**
  1608. * @fileoverview added by tsickle
  1609. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1610. */
  1611. /**
  1612. * @param {?} yearsCalendar
  1613. * @param {?} options
  1614. * @return {?}
  1615. */
  1616. function flagYearsCalendar(yearsCalendar, options) {
  1617. yearsCalendar.years.forEach((/**
  1618. * @param {?} years
  1619. * @param {?} rowIndex
  1620. * @return {?}
  1621. */
  1622. function (years, rowIndex) {
  1623. years.forEach((/**
  1624. * @param {?} year
  1625. * @param {?} yearIndex
  1626. * @return {?}
  1627. */
  1628. function (year, yearIndex) {
  1629. /** @type {?} */
  1630. var isHovered = chronos.isSameYear(year.date, options.hoveredYear);
  1631. /** @type {?} */
  1632. var isDisabled = options.isDisabled ||
  1633. isYearDisabled(year.date, options.minDate, options.maxDate);
  1634. /** @type {?} */
  1635. var isSelected = chronos.isSameYear(year.date, options.selectedDate);
  1636. /** @type {?} */
  1637. var newMonth = Object.assign(/*{},*/ year, { isHovered: isHovered, isDisabled: isDisabled, isSelected: isSelected });
  1638. if (year.isHovered !== newMonth.isHovered ||
  1639. year.isDisabled !== newMonth.isDisabled ||
  1640. year.isSelected !== newMonth.isSelected) {
  1641. yearsCalendar.years[rowIndex][yearIndex] = newMonth;
  1642. }
  1643. }));
  1644. }));
  1645. // todo: add check for linked calendars
  1646. yearsCalendar.hideLeftArrow =
  1647. options.yearIndex > 0 && options.yearIndex !== options.displayMonths;
  1648. yearsCalendar.hideRightArrow =
  1649. options.yearIndex < options.displayMonths &&
  1650. options.yearIndex + 1 !== options.displayMonths;
  1651. yearsCalendar.disableLeftArrow = isYearDisabled(chronos.shiftDate(yearsCalendar.years[0][0].date, { year: -1 }), options.minDate, options.maxDate);
  1652. /** @type {?} */
  1653. var i = yearsCalendar.years.length - 1;
  1654. /** @type {?} */
  1655. var j = yearsCalendar.years[i].length - 1;
  1656. yearsCalendar.disableRightArrow = isYearDisabled(chronos.shiftDate(yearsCalendar.years[i][j].date, { year: 1 }), options.minDate, options.maxDate);
  1657. return yearsCalendar;
  1658. }
  1659. /**
  1660. * @fileoverview added by tsickle
  1661. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1662. */
  1663. /* tslint:disable-next-line: cyclomatic-complexity */
  1664. /**
  1665. * @param {?=} state
  1666. * @param {?=} action
  1667. * @return {?}
  1668. */
  1669. function bsDatepickerReducer(state, action) {
  1670. if (state === void 0) { state = initialDatepickerState; }
  1671. switch (action.type) {
  1672. case BsDatepickerActions.CALCULATE: {
  1673. return calculateReducer(state);
  1674. }
  1675. case BsDatepickerActions.FORMAT: {
  1676. return formatReducer(state);
  1677. }
  1678. case BsDatepickerActions.FLAG: {
  1679. return flagReducer(state);
  1680. }
  1681. case BsDatepickerActions.NAVIGATE_OFFSET: {
  1682. return navigateOffsetReducer(state, action);
  1683. }
  1684. case BsDatepickerActions.NAVIGATE_TO: {
  1685. /** @type {?} */
  1686. var payload = action.payload;
  1687. /** @type {?} */
  1688. var date = chronos.setFullDate(state.view.date, payload.unit);
  1689. /** @type {?} */
  1690. var newState = void 0;
  1691. /** @type {?} */
  1692. var mode = void 0;
  1693. if (canSwitchMode(payload.viewMode, state.minMode)) {
  1694. mode = payload.viewMode;
  1695. newState = { view: { date: date, mode: mode } };
  1696. }
  1697. else {
  1698. mode = state.view.mode;
  1699. newState = { selectedDate: date, view: { date: date, mode: mode } };
  1700. }
  1701. return Object.assign({}, state, newState);
  1702. }
  1703. case BsDatepickerActions.CHANGE_VIEWMODE: {
  1704. if (!canSwitchMode(action.payload, state.minMode)) {
  1705. return state;
  1706. }
  1707. /** @type {?} */
  1708. var date = state.view.date;
  1709. /** @type {?} */
  1710. var mode = action.payload;
  1711. /** @type {?} */
  1712. var newState = { view: { date: date, mode: mode } };
  1713. return Object.assign({}, state, newState);
  1714. }
  1715. case BsDatepickerActions.HOVER: {
  1716. return Object.assign({}, state, { hoveredDate: action.payload });
  1717. }
  1718. case BsDatepickerActions.SELECT: {
  1719. /** @type {?} */
  1720. var newState = {
  1721. selectedDate: action.payload,
  1722. view: state.view
  1723. };
  1724. /** @type {?} */
  1725. var mode = state.view.mode;
  1726. /** @type {?} */
  1727. var _date = action.payload || state.view.date;
  1728. /** @type {?} */
  1729. var date = getViewDate(_date, state.minDate, state.maxDate);
  1730. newState.view = { mode: mode, date: date };
  1731. return Object.assign({}, state, newState);
  1732. }
  1733. case BsDatepickerActions.SET_OPTIONS: {
  1734. /** @type {?} */
  1735. var newState = action.payload;
  1736. // preserve view mode
  1737. /** @type {?} */
  1738. var mode = newState.minMode ? newState.minMode : state.view.mode;
  1739. /** @type {?} */
  1740. var _viewDate = chronos.isDateValid(newState.value) && newState.value
  1741. || chronos.isArray(newState.value) && chronos.isDateValid(newState.value[0]) && newState.value[0]
  1742. || state.view.date;
  1743. /** @type {?} */
  1744. var date = getViewDate(_viewDate, newState.minDate, newState.maxDate);
  1745. newState.view = { mode: mode, date: date };
  1746. // update selected value
  1747. if (newState.value) {
  1748. // if new value is array we work with date range
  1749. if (chronos.isArray(newState.value)) {
  1750. newState.selectedRange = newState.value;
  1751. }
  1752. // if new value is a date -> datepicker
  1753. if (newState.value instanceof Date) {
  1754. newState.selectedDate = newState.value;
  1755. }
  1756. // provided value is not supported :)
  1757. // need to report it somehow
  1758. }
  1759. return Object.assign({}, state, newState);
  1760. }
  1761. // date range picker
  1762. case BsDatepickerActions.SELECT_RANGE: {
  1763. /** @type {?} */
  1764. var newState = {
  1765. selectedRange: action.payload,
  1766. view: state.view
  1767. };
  1768. /** @type {?} */
  1769. var mode = state.view.mode;
  1770. /** @type {?} */
  1771. var _date = action.payload && action.payload[0] || state.view.date;
  1772. /** @type {?} */
  1773. var date = getViewDate(_date, state.minDate, state.maxDate);
  1774. newState.view = { mode: mode, date: date };
  1775. return Object.assign({}, state, newState);
  1776. }
  1777. case BsDatepickerActions.SET_MIN_DATE: {
  1778. return Object.assign({}, state, {
  1779. minDate: action.payload
  1780. });
  1781. }
  1782. case BsDatepickerActions.SET_MAX_DATE: {
  1783. return Object.assign({}, state, {
  1784. maxDate: action.payload
  1785. });
  1786. }
  1787. case BsDatepickerActions.SET_IS_DISABLED: {
  1788. return Object.assign({}, state, {
  1789. isDisabled: action.payload
  1790. });
  1791. }
  1792. case BsDatepickerActions.SET_DATE_CUSTOM_CLASSES: {
  1793. return Object.assign({}, state, {
  1794. dateCustomClasses: action.payload
  1795. });
  1796. }
  1797. default:
  1798. return state;
  1799. }
  1800. }
  1801. /**
  1802. * @param {?} state
  1803. * @return {?}
  1804. */
  1805. function calculateReducer(state) {
  1806. // how many calendars
  1807. /** @type {?} */
  1808. var displayMonths = state.displayMonths;
  1809. // use selected date on initial rendering if set
  1810. /** @type {?} */
  1811. var viewDate = state.view.date;
  1812. if (state.view.mode === 'day') {
  1813. state.monthViewOptions.firstDayOfWeek = chronos.getLocale(state.locale).firstDayOfWeek();
  1814. /** @type {?} */
  1815. var monthsModel = new Array(displayMonths);
  1816. for (var monthIndex = 0; monthIndex < displayMonths; monthIndex++) {
  1817. // todo: for unlinked calendars it will be harder
  1818. monthsModel[monthIndex] = calcDaysCalendar(viewDate, state.monthViewOptions);
  1819. viewDate = chronos.shiftDate(viewDate, { month: 1 });
  1820. }
  1821. return Object.assign({}, state, { monthsModel: monthsModel });
  1822. }
  1823. if (state.view.mode === 'month') {
  1824. /** @type {?} */
  1825. var monthsCalendar = new Array(displayMonths);
  1826. for (var calendarIndex = 0; calendarIndex < displayMonths; calendarIndex++) {
  1827. // todo: for unlinked calendars it will be harder
  1828. monthsCalendar[calendarIndex] = formatMonthsCalendar(viewDate, getFormatOptions(state));
  1829. viewDate = chronos.shiftDate(viewDate, { year: 1 });
  1830. }
  1831. return Object.assign({}, state, { monthsCalendar: monthsCalendar });
  1832. }
  1833. if (state.view.mode === 'year') {
  1834. /** @type {?} */
  1835. var yearsCalendarModel = new Array(displayMonths);
  1836. for (var calendarIndex = 0; calendarIndex < displayMonths; calendarIndex++) {
  1837. // todo: for unlinked calendars it will be harder
  1838. yearsCalendarModel[calendarIndex] = formatYearsCalendar(viewDate, getFormatOptions(state), state.minMode === 'year' ? getYearsCalendarInitialDate(state, calendarIndex) : undefined);
  1839. viewDate = chronos.shiftDate(viewDate, { year: yearsPerCalendar });
  1840. }
  1841. return Object.assign({}, state, { yearsCalendarModel: yearsCalendarModel });
  1842. }
  1843. return state;
  1844. }
  1845. /**
  1846. * @param {?} state
  1847. * @param {?} action
  1848. * @return {?}
  1849. */
  1850. function formatReducer(state, action) {
  1851. if (state.view.mode === 'day') {
  1852. /** @type {?} */
  1853. var formattedMonths = state.monthsModel.map((/**
  1854. * @param {?} month
  1855. * @param {?} monthIndex
  1856. * @return {?}
  1857. */
  1858. function (month, monthIndex) {
  1859. return formatDaysCalendar(month, getFormatOptions(state), monthIndex);
  1860. }));
  1861. return Object.assign({}, state, { formattedMonths: formattedMonths });
  1862. }
  1863. // how many calendars
  1864. /** @type {?} */
  1865. var displayMonths = state.displayMonths;
  1866. // check initial rendering
  1867. // use selected date on initial rendering if set
  1868. /** @type {?} */
  1869. var viewDate = state.view.date;
  1870. if (state.view.mode === 'month') {
  1871. /** @type {?} */
  1872. var monthsCalendar = new Array(displayMonths);
  1873. for (var calendarIndex = 0; calendarIndex < displayMonths; calendarIndex++) {
  1874. // todo: for unlinked calendars it will be harder
  1875. monthsCalendar[calendarIndex] = formatMonthsCalendar(viewDate, getFormatOptions(state));
  1876. viewDate = chronos.shiftDate(viewDate, { year: 1 });
  1877. }
  1878. return Object.assign({}, state, { monthsCalendar: monthsCalendar });
  1879. }
  1880. if (state.view.mode === 'year') {
  1881. /** @type {?} */
  1882. var yearsCalendarModel = new Array(displayMonths);
  1883. for (var calendarIndex = 0; calendarIndex < displayMonths; calendarIndex++) {
  1884. // todo: for unlinked calendars it will be harder
  1885. yearsCalendarModel[calendarIndex] = formatYearsCalendar(viewDate, getFormatOptions(state));
  1886. viewDate = chronos.shiftDate(viewDate, { year: 16 });
  1887. }
  1888. return Object.assign({}, state, { yearsCalendarModel: yearsCalendarModel });
  1889. }
  1890. return state;
  1891. }
  1892. /**
  1893. * @param {?} state
  1894. * @param {?} action
  1895. * @return {?}
  1896. */
  1897. function flagReducer(state, action) {
  1898. if (state.view.mode === 'day') {
  1899. /** @type {?} */
  1900. var flaggedMonths = state.formattedMonths.map((/**
  1901. * @param {?} formattedMonth
  1902. * @param {?} monthIndex
  1903. * @return {?}
  1904. */
  1905. function (formattedMonth, monthIndex) {
  1906. return flagDaysCalendar(formattedMonth, {
  1907. isDisabled: state.isDisabled,
  1908. minDate: state.minDate,
  1909. maxDate: state.maxDate,
  1910. daysDisabled: state.daysDisabled,
  1911. datesDisabled: state.datesDisabled,
  1912. hoveredDate: state.hoveredDate,
  1913. selectedDate: state.selectedDate,
  1914. selectedRange: state.selectedRange,
  1915. displayMonths: state.displayMonths,
  1916. dateCustomClasses: state.dateCustomClasses,
  1917. monthIndex: monthIndex
  1918. });
  1919. }));
  1920. return Object.assign({}, state, { flaggedMonths: flaggedMonths });
  1921. }
  1922. if (state.view.mode === 'month') {
  1923. /** @type {?} */
  1924. var flaggedMonthsCalendar = state.monthsCalendar.map((/**
  1925. * @param {?} formattedMonth
  1926. * @param {?} monthIndex
  1927. * @return {?}
  1928. */
  1929. function (formattedMonth, monthIndex) {
  1930. return flagMonthsCalendar(formattedMonth, {
  1931. isDisabled: state.isDisabled,
  1932. minDate: state.minDate,
  1933. maxDate: state.maxDate,
  1934. hoveredMonth: state.hoveredMonth,
  1935. selectedDate: state.selectedDate,
  1936. displayMonths: state.displayMonths,
  1937. monthIndex: monthIndex
  1938. });
  1939. }));
  1940. return Object.assign({}, state, { flaggedMonthsCalendar: flaggedMonthsCalendar });
  1941. }
  1942. if (state.view.mode === 'year') {
  1943. /** @type {?} */
  1944. var yearsCalendarFlagged = state.yearsCalendarModel.map((/**
  1945. * @param {?} formattedMonth
  1946. * @param {?} yearIndex
  1947. * @return {?}
  1948. */
  1949. function (formattedMonth, yearIndex) {
  1950. return flagYearsCalendar(formattedMonth, {
  1951. isDisabled: state.isDisabled,
  1952. minDate: state.minDate,
  1953. maxDate: state.maxDate,
  1954. hoveredYear: state.hoveredYear,
  1955. selectedDate: state.selectedDate,
  1956. displayMonths: state.displayMonths,
  1957. yearIndex: yearIndex
  1958. });
  1959. }));
  1960. return Object.assign({}, state, { yearsCalendarFlagged: yearsCalendarFlagged });
  1961. }
  1962. return state;
  1963. }
  1964. /**
  1965. * @param {?} state
  1966. * @param {?} action
  1967. * @return {?}
  1968. */
  1969. function navigateOffsetReducer(state, action) {
  1970. /** @type {?} */
  1971. var newState = {
  1972. view: {
  1973. mode: state.view.mode,
  1974. date: shiftViewDate(state, action)
  1975. }
  1976. };
  1977. return Object.assign({}, state, newState);
  1978. }
  1979. /**
  1980. * @param {?} state
  1981. * @param {?} action
  1982. * @return {?}
  1983. */
  1984. function shiftViewDate(state, action) {
  1985. if (state.view.mode === 'year' && state.minMode === 'year') {
  1986. /** @type {?} */
  1987. var initialDate = getYearsCalendarInitialDate(state, 0);
  1988. /** @type {?} */
  1989. var middleDate = chronos.shiftDate(initialDate, { year: -initialYearShift });
  1990. return chronos.shiftDate(middleDate, action.payload);
  1991. }
  1992. return chronos.shiftDate(chronos.startOf(state.view.date, 'month'), action.payload);
  1993. }
  1994. /**
  1995. * @param {?} state
  1996. * @return {?}
  1997. */
  1998. function getFormatOptions(state) {
  1999. return {
  2000. locale: state.locale,
  2001. monthTitle: state.monthTitle,
  2002. yearTitle: state.yearTitle,
  2003. dayLabel: state.dayLabel,
  2004. monthLabel: state.monthLabel,
  2005. yearLabel: state.yearLabel,
  2006. weekNumbers: state.weekNumbers
  2007. };
  2008. }
  2009. /**
  2010. * if view date is provided (bsValue|ngModel) it should be shown
  2011. * if view date is not provider:
  2012. * if minDate>currentDate (default view value), show minDate
  2013. * if maxDate<currentDate(default view value) show maxDate
  2014. * @param {?} viewDate
  2015. * @param {?} minDate
  2016. * @param {?} maxDate
  2017. * @return {?}
  2018. */
  2019. function getViewDate(viewDate, minDate, maxDate) {
  2020. /** @type {?} */
  2021. var _date = Array.isArray(viewDate) ? viewDate[0] : viewDate;
  2022. if (minDate && chronos.isAfter(minDate, _date, 'day')) {
  2023. return minDate;
  2024. }
  2025. if (maxDate && chronos.isBefore(maxDate, _date, 'day')) {
  2026. return maxDate;
  2027. }
  2028. return _date;
  2029. }
  2030. /**
  2031. * @fileoverview added by tsickle
  2032. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2033. */
  2034. var BsDatepickerStore = /** @class */ (function (_super) {
  2035. __extends(BsDatepickerStore, _super);
  2036. function BsDatepickerStore() {
  2037. var _this = this;
  2038. /** @type {?} */
  2039. var _dispatcher = new rxjs.BehaviorSubject({
  2040. type: '[datepicker] dispatcher init'
  2041. });
  2042. /** @type {?} */
  2043. var state = new miniNgrx.MiniState(initialDatepickerState, _dispatcher, bsDatepickerReducer);
  2044. _this = _super.call(this, _dispatcher, bsDatepickerReducer, state) || this;
  2045. return _this;
  2046. }
  2047. BsDatepickerStore.decorators = [
  2048. { type: core.Injectable }
  2049. ];
  2050. /** @nocollapse */
  2051. BsDatepickerStore.ctorParameters = function () { return []; };
  2052. return BsDatepickerStore;
  2053. }(miniNgrx.MiniStore));
  2054. /**
  2055. * @fileoverview added by tsickle
  2056. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2057. */
  2058. /** @type {?} */
  2059. var DATEPICKER_ANIMATION_TIMING = '220ms cubic-bezier(0, 0, 0.2, 1)';
  2060. /** @type {?} */
  2061. var datepickerAnimation = animations.trigger('datepickerAnimation', [
  2062. animations.state('animated-down', animations.style({ height: '*', overflow: 'hidden' })),
  2063. animations.transition('* => animated-down', [
  2064. animations.style({ height: 0, overflow: 'hidden' }),
  2065. animations.animate(DATEPICKER_ANIMATION_TIMING)
  2066. ]),
  2067. animations.state('animated-up', animations.style({ height: '*', overflow: 'hidden' })),
  2068. animations.transition('* => animated-up', [
  2069. animations.style({ height: '*', overflow: 'hidden' }),
  2070. animations.animate(DATEPICKER_ANIMATION_TIMING)
  2071. ]),
  2072. animations.transition('* => unanimated', animations.animate('0s'))
  2073. ]);
  2074. /**
  2075. * @fileoverview added by tsickle
  2076. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2077. */
  2078. var BsDatepickerContainerComponent = /** @class */ (function (_super) {
  2079. __extends(BsDatepickerContainerComponent, _super);
  2080. function BsDatepickerContainerComponent(_renderer, _config, _store, _element, _actions, _effects, _positionService) {
  2081. var _this = _super.call(this) || this;
  2082. _this._config = _config;
  2083. _this._store = _store;
  2084. _this._element = _element;
  2085. _this._actions = _actions;
  2086. _this._positionService = _positionService;
  2087. _this.valueChange = new core.EventEmitter();
  2088. _this.animationState = 'void';
  2089. _this._subs = [];
  2090. _this._effects = _effects;
  2091. _renderer.setStyle(_element.nativeElement, 'display', 'block');
  2092. _renderer.setStyle(_element.nativeElement, 'position', 'absolute');
  2093. return _this;
  2094. }
  2095. Object.defineProperty(BsDatepickerContainerComponent.prototype, "value", {
  2096. set: /**
  2097. * @param {?} value
  2098. * @return {?}
  2099. */
  2100. function (value) {
  2101. this._effects.setValue(value);
  2102. },
  2103. enumerable: true,
  2104. configurable: true
  2105. });
  2106. /**
  2107. * @return {?}
  2108. */
  2109. BsDatepickerContainerComponent.prototype.ngOnInit = /**
  2110. * @return {?}
  2111. */
  2112. function () {
  2113. var _this = this;
  2114. this._positionService.setOptions({
  2115. modifiers: { flip: { enabled: this._config.adaptivePosition } },
  2116. allowedPositions: ['top', 'bottom']
  2117. });
  2118. this._positionService.event$
  2119. .pipe(operators.take(1))
  2120. .subscribe((/**
  2121. * @return {?}
  2122. */
  2123. function () {
  2124. _this._positionService.disable();
  2125. if (_this._config.isAnimated) {
  2126. _this.animationState = _this.isTopPosition ? 'animated-up' : 'animated-down';
  2127. return;
  2128. }
  2129. _this.animationState = 'unanimated';
  2130. }));
  2131. this.isOtherMonthsActive = this._config.selectFromOtherMonth;
  2132. this.containerClass = this._config.containerClass;
  2133. this._effects
  2134. .init(this._store)
  2135. // intial state options
  2136. .setOptions(this._config)
  2137. // data binding view --> model
  2138. .setBindings(this)
  2139. // set event handlers
  2140. .setEventHandlers(this)
  2141. .registerDatepickerSideEffects();
  2142. // todo: move it somewhere else
  2143. // on selected date change
  2144. this._subs.push(this._store
  2145. /* tslint:disable-next-line: no-any */
  2146. .select((/**
  2147. * @param {?} state
  2148. * @return {?}
  2149. */
  2150. function (state) { return state.selectedDate; }))
  2151. /* tslint:disable-next-line: no-any */
  2152. .subscribe((/**
  2153. * @param {?} date
  2154. * @return {?}
  2155. */
  2156. function (date) { return _this.valueChange.emit(date); })));
  2157. };
  2158. Object.defineProperty(BsDatepickerContainerComponent.prototype, "isTopPosition", {
  2159. get: /**
  2160. * @return {?}
  2161. */
  2162. function () {
  2163. return this._element.nativeElement.classList.contains('top');
  2164. },
  2165. enumerable: true,
  2166. configurable: true
  2167. });
  2168. /**
  2169. * @return {?}
  2170. */
  2171. BsDatepickerContainerComponent.prototype.positionServiceEnable = /**
  2172. * @return {?}
  2173. */
  2174. function () {
  2175. this._positionService.enable();
  2176. };
  2177. /**
  2178. * @param {?} day
  2179. * @return {?}
  2180. */
  2181. BsDatepickerContainerComponent.prototype.daySelectHandler = /**
  2182. * @param {?} day
  2183. * @return {?}
  2184. */
  2185. function (day) {
  2186. /** @type {?} */
  2187. var isDisabled = this.isOtherMonthsActive ? day.isDisabled : (day.isOtherMonth || day.isDisabled);
  2188. if (isDisabled) {
  2189. return;
  2190. }
  2191. this._store.dispatch(this._actions.select(day.date));
  2192. };
  2193. /**
  2194. * @return {?}
  2195. */
  2196. BsDatepickerContainerComponent.prototype.ngOnDestroy = /**
  2197. * @return {?}
  2198. */
  2199. function () {
  2200. var e_1, _a;
  2201. try {
  2202. for (var _b = __values(this._subs), _c = _b.next(); !_c.done; _c = _b.next()) {
  2203. var sub = _c.value;
  2204. sub.unsubscribe();
  2205. }
  2206. }
  2207. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  2208. finally {
  2209. try {
  2210. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  2211. }
  2212. finally { if (e_1) throw e_1.error; }
  2213. }
  2214. this._effects.destroy();
  2215. };
  2216. BsDatepickerContainerComponent.decorators = [
  2217. { type: core.Component, args: [{
  2218. selector: 'bs-datepicker-container',
  2219. providers: [BsDatepickerStore, BsDatepickerEffects],
  2220. 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",
  2221. host: {
  2222. class: 'bottom',
  2223. '(click)': '_stopPropagation($event)',
  2224. role: 'dialog',
  2225. 'aria-label': 'calendar'
  2226. },
  2227. animations: [datepickerAnimation]
  2228. }] }
  2229. ];
  2230. /** @nocollapse */
  2231. BsDatepickerContainerComponent.ctorParameters = function () { return [
  2232. { type: core.Renderer2 },
  2233. { type: BsDatepickerConfig },
  2234. { type: BsDatepickerStore },
  2235. { type: core.ElementRef },
  2236. { type: BsDatepickerActions },
  2237. { type: BsDatepickerEffects },
  2238. { type: positioning.PositioningService }
  2239. ]; };
  2240. return BsDatepickerContainerComponent;
  2241. }(BsDatepickerAbstractComponent));
  2242. /**
  2243. * @fileoverview added by tsickle
  2244. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2245. */
  2246. var BsDatepickerDirective = /** @class */ (function () {
  2247. function BsDatepickerDirective(_config, _elementRef, _renderer, _viewContainerRef, cis) {
  2248. this._config = _config;
  2249. /**
  2250. * Placement of a datepicker. Accepts: "top", "bottom", "left", "right"
  2251. */
  2252. this.placement = 'bottom';
  2253. /**
  2254. * Specifies events that should trigger. Supports a space separated list of
  2255. * event names.
  2256. */
  2257. this.triggers = 'click';
  2258. /**
  2259. * Close datepicker on outside click
  2260. */
  2261. this.outsideClick = true;
  2262. /**
  2263. * A selector specifying the element the datepicker should be appended to.
  2264. */
  2265. this.container = 'body';
  2266. this.outsideEsc = true;
  2267. /**
  2268. * Emits when datepicker value has been changed
  2269. */
  2270. this.bsValueChange = new core.EventEmitter();
  2271. this._subs = [];
  2272. // todo: assign only subset of fields
  2273. Object.assign(this, this._config);
  2274. this._datepicker = cis.createLoader(_elementRef, _viewContainerRef, _renderer);
  2275. this.onShown = this._datepicker.onShown;
  2276. this.onHidden = this._datepicker.onHidden;
  2277. }
  2278. Object.defineProperty(BsDatepickerDirective.prototype, "isOpen", {
  2279. /**
  2280. * Returns whether or not the datepicker is currently being shown
  2281. */
  2282. get: /**
  2283. * Returns whether or not the datepicker is currently being shown
  2284. * @return {?}
  2285. */
  2286. function () {
  2287. return this._datepicker.isShown;
  2288. },
  2289. set: /**
  2290. * @param {?} value
  2291. * @return {?}
  2292. */
  2293. function (value) {
  2294. if (value) {
  2295. this.show();
  2296. }
  2297. else {
  2298. this.hide();
  2299. }
  2300. },
  2301. enumerable: true,
  2302. configurable: true
  2303. });
  2304. Object.defineProperty(BsDatepickerDirective.prototype, "bsValue", {
  2305. /**
  2306. * Initial value of datepicker
  2307. */
  2308. set: /**
  2309. * Initial value of datepicker
  2310. * @param {?} value
  2311. * @return {?}
  2312. */
  2313. function (value) {
  2314. if (this._bsValue === value) {
  2315. return;
  2316. }
  2317. this._bsValue = value;
  2318. this.bsValueChange.emit(value);
  2319. },
  2320. enumerable: true,
  2321. configurable: true
  2322. });
  2323. /**
  2324. * @return {?}
  2325. */
  2326. BsDatepickerDirective.prototype.ngOnInit = /**
  2327. * @return {?}
  2328. */
  2329. function () {
  2330. var _this = this;
  2331. this._datepicker.listen({
  2332. outsideClick: this.outsideClick,
  2333. outsideEsc: this.outsideEsc,
  2334. triggers: this.triggers,
  2335. show: (/**
  2336. * @return {?}
  2337. */
  2338. function () { return _this.show(); })
  2339. });
  2340. this.setConfig();
  2341. };
  2342. /**
  2343. * @param {?} changes
  2344. * @return {?}
  2345. */
  2346. BsDatepickerDirective.prototype.ngOnChanges = /**
  2347. * @param {?} changes
  2348. * @return {?}
  2349. */
  2350. function (changes) {
  2351. if (!this._datepickerRef || !this._datepickerRef.instance) {
  2352. return;
  2353. }
  2354. if (changes.minDate) {
  2355. this._datepickerRef.instance.minDate = this.minDate;
  2356. }
  2357. if (changes.maxDate) {
  2358. this._datepickerRef.instance.maxDate = this.maxDate;
  2359. }
  2360. if (changes.daysDisabled) {
  2361. this._datepickerRef.instance.daysDisabled = this.daysDisabled;
  2362. }
  2363. if (changes.datesDisabled) {
  2364. this._datepickerRef.instance.datesDisabled = this.datesDisabled;
  2365. }
  2366. if (changes.isDisabled) {
  2367. this._datepickerRef.instance.isDisabled = this.isDisabled;
  2368. }
  2369. if (changes.dateCustomClasses) {
  2370. this._datepickerRef.instance.dateCustomClasses = this.dateCustomClasses;
  2371. }
  2372. };
  2373. /**
  2374. * Opens an element’s datepicker. This is considered a “manual” triggering of
  2375. * the datepicker.
  2376. */
  2377. /**
  2378. * Opens an element’s datepicker. This is considered a “manual” triggering of
  2379. * the datepicker.
  2380. * @return {?}
  2381. */
  2382. BsDatepickerDirective.prototype.show = /**
  2383. * Opens an element’s datepicker. This is considered a “manual” triggering of
  2384. * the datepicker.
  2385. * @return {?}
  2386. */
  2387. function () {
  2388. var _this = this;
  2389. if (this._datepicker.isShown) {
  2390. return;
  2391. }
  2392. this.setConfig();
  2393. this._datepickerRef = this._datepicker
  2394. .provide({ provide: BsDatepickerConfig, useValue: this._config })
  2395. .attach(BsDatepickerContainerComponent)
  2396. .to(this.container)
  2397. .position({ attachment: this.placement })
  2398. .show({ placement: this.placement });
  2399. // if date changes from external source (model -> view)
  2400. this._subs.push(this.bsValueChange.subscribe((/**
  2401. * @param {?} value
  2402. * @return {?}
  2403. */
  2404. function (value) {
  2405. _this._datepickerRef.instance.value = value;
  2406. })));
  2407. // if date changes from picker (view -> model)
  2408. this._subs.push(this._datepickerRef.instance.valueChange.subscribe((/**
  2409. * @param {?} value
  2410. * @return {?}
  2411. */
  2412. function (value) {
  2413. _this.bsValue = value;
  2414. _this.hide();
  2415. })));
  2416. };
  2417. /**
  2418. * Closes an element’s datepicker. This is considered a “manual” triggering of
  2419. * the datepicker.
  2420. */
  2421. /**
  2422. * Closes an element’s datepicker. This is considered a “manual” triggering of
  2423. * the datepicker.
  2424. * @return {?}
  2425. */
  2426. BsDatepickerDirective.prototype.hide = /**
  2427. * Closes an element’s datepicker. This is considered a “manual” triggering of
  2428. * the datepicker.
  2429. * @return {?}
  2430. */
  2431. function () {
  2432. var e_1, _a;
  2433. if (this.isOpen) {
  2434. this._datepicker.hide();
  2435. }
  2436. try {
  2437. for (var _b = __values(this._subs), _c = _b.next(); !_c.done; _c = _b.next()) {
  2438. var sub = _c.value;
  2439. sub.unsubscribe();
  2440. }
  2441. }
  2442. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  2443. finally {
  2444. try {
  2445. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  2446. }
  2447. finally { if (e_1) throw e_1.error; }
  2448. }
  2449. };
  2450. /**
  2451. * Toggles an element’s datepicker. This is considered a “manual” triggering
  2452. * of the datepicker.
  2453. */
  2454. /**
  2455. * Toggles an element’s datepicker. This is considered a “manual” triggering
  2456. * of the datepicker.
  2457. * @return {?}
  2458. */
  2459. BsDatepickerDirective.prototype.toggle = /**
  2460. * Toggles an element’s datepicker. This is considered a “manual” triggering
  2461. * of the datepicker.
  2462. * @return {?}
  2463. */
  2464. function () {
  2465. if (this.isOpen) {
  2466. return this.hide();
  2467. }
  2468. this.show();
  2469. };
  2470. /**
  2471. * Set config for datepicker
  2472. */
  2473. /**
  2474. * Set config for datepicker
  2475. * @return {?}
  2476. */
  2477. BsDatepickerDirective.prototype.setConfig = /**
  2478. * Set config for datepicker
  2479. * @return {?}
  2480. */
  2481. function () {
  2482. this._config = Object.assign({}, this._config, this.bsConfig, {
  2483. value: this._bsValue,
  2484. isDisabled: this.isDisabled,
  2485. minDate: this.minDate || this.bsConfig && this.bsConfig.minDate,
  2486. maxDate: this.maxDate || this.bsConfig && this.bsConfig.maxDate,
  2487. daysDisabled: this.daysDisabled || this.bsConfig && this.bsConfig.daysDisabled,
  2488. dateCustomClasses: this.dateCustomClasses || this.bsConfig && this.bsConfig.dateCustomClasses,
  2489. datesDisabled: this.datesDisabled || this.bsConfig && this.bsConfig.datesDisabled,
  2490. minMode: this.minMode || this.bsConfig && this.bsConfig.minMode
  2491. });
  2492. };
  2493. /**
  2494. * @return {?}
  2495. */
  2496. BsDatepickerDirective.prototype.ngOnDestroy = /**
  2497. * @return {?}
  2498. */
  2499. function () {
  2500. this._datepicker.dispose();
  2501. };
  2502. BsDatepickerDirective.decorators = [
  2503. { type: core.Directive, args: [{
  2504. selector: '[bsDatepicker]',
  2505. exportAs: 'bsDatepicker'
  2506. },] }
  2507. ];
  2508. /** @nocollapse */
  2509. BsDatepickerDirective.ctorParameters = function () { return [
  2510. { type: BsDatepickerConfig },
  2511. { type: core.ElementRef },
  2512. { type: core.Renderer2 },
  2513. { type: core.ViewContainerRef },
  2514. { type: componentLoader.ComponentLoaderFactory }
  2515. ]; };
  2516. BsDatepickerDirective.propDecorators = {
  2517. placement: [{ type: core.Input }],
  2518. triggers: [{ type: core.Input }],
  2519. outsideClick: [{ type: core.Input }],
  2520. container: [{ type: core.Input }],
  2521. outsideEsc: [{ type: core.Input }],
  2522. isOpen: [{ type: core.Input }],
  2523. onShown: [{ type: core.Output }],
  2524. onHidden: [{ type: core.Output }],
  2525. bsValue: [{ type: core.Input }],
  2526. bsConfig: [{ type: core.Input }],
  2527. isDisabled: [{ type: core.Input }],
  2528. minDate: [{ type: core.Input }],
  2529. maxDate: [{ type: core.Input }],
  2530. minMode: [{ type: core.Input }],
  2531. daysDisabled: [{ type: core.Input }],
  2532. datesDisabled: [{ type: core.Input }],
  2533. dateCustomClasses: [{ type: core.Input }],
  2534. bsValueChange: [{ type: core.Output }]
  2535. };
  2536. return BsDatepickerDirective;
  2537. }());
  2538. /**
  2539. * @fileoverview added by tsickle
  2540. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2541. */
  2542. var BsDatepickerInlineConfig = /** @class */ (function (_super) {
  2543. __extends(BsDatepickerInlineConfig, _super);
  2544. function BsDatepickerInlineConfig() {
  2545. return _super !== null && _super.apply(this, arguments) || this;
  2546. }
  2547. BsDatepickerInlineConfig.decorators = [
  2548. { type: core.Injectable }
  2549. ];
  2550. return BsDatepickerInlineConfig;
  2551. }(BsDatepickerConfig));
  2552. /**
  2553. * @fileoverview added by tsickle
  2554. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2555. */
  2556. var BsDatepickerInlineContainerComponent = /** @class */ (function (_super) {
  2557. __extends(BsDatepickerInlineContainerComponent, _super);
  2558. function BsDatepickerInlineContainerComponent(_renderer, _config, _store, _element, _actions, _effects, _positioningService) {
  2559. var _this = _super.call(this, _renderer, _config, _store, _element, _actions, _effects, _positioningService) || this;
  2560. _renderer.setStyle(_element.nativeElement, 'display', 'inline-block');
  2561. _renderer.setStyle(_element.nativeElement, 'position', 'static');
  2562. return _this;
  2563. }
  2564. BsDatepickerInlineContainerComponent.decorators = [
  2565. { type: core.Component, args: [{
  2566. selector: 'bs-datepicker-inline-container',
  2567. providers: [BsDatepickerStore, BsDatepickerEffects],
  2568. 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",
  2569. host: {
  2570. '(click)': '_stopPropagation($event)'
  2571. },
  2572. animations: [datepickerAnimation]
  2573. }] }
  2574. ];
  2575. /** @nocollapse */
  2576. BsDatepickerInlineContainerComponent.ctorParameters = function () { return [
  2577. { type: core.Renderer2 },
  2578. { type: BsDatepickerConfig },
  2579. { type: BsDatepickerStore },
  2580. { type: core.ElementRef },
  2581. { type: BsDatepickerActions },
  2582. { type: BsDatepickerEffects },
  2583. { type: positioning.PositioningService }
  2584. ]; };
  2585. return BsDatepickerInlineContainerComponent;
  2586. }(BsDatepickerContainerComponent));
  2587. /**
  2588. * @fileoverview added by tsickle
  2589. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2590. */
  2591. var BsDatepickerInlineDirective = /** @class */ (function () {
  2592. function BsDatepickerInlineDirective(_config, _elementRef, _renderer, _viewContainerRef, cis) {
  2593. this._config = _config;
  2594. this._elementRef = _elementRef;
  2595. /**
  2596. * Emits when datepicker value has been changed
  2597. */
  2598. this.bsValueChange = new core.EventEmitter();
  2599. this._subs = [];
  2600. // todo: assign only subset of fields
  2601. Object.assign(this, this._config);
  2602. this._datepicker = cis.createLoader(_elementRef, _viewContainerRef, _renderer);
  2603. }
  2604. Object.defineProperty(BsDatepickerInlineDirective.prototype, "bsValue", {
  2605. /**
  2606. * Initial value of datepicker
  2607. */
  2608. set: /**
  2609. * Initial value of datepicker
  2610. * @param {?} value
  2611. * @return {?}
  2612. */
  2613. function (value) {
  2614. if (this._bsValue === value) {
  2615. return;
  2616. }
  2617. this._bsValue = value;
  2618. this.bsValueChange.emit(value);
  2619. },
  2620. enumerable: true,
  2621. configurable: true
  2622. });
  2623. /**
  2624. * @return {?}
  2625. */
  2626. BsDatepickerInlineDirective.prototype.ngOnInit = /**
  2627. * @return {?}
  2628. */
  2629. function () {
  2630. var _this = this;
  2631. this.setConfig();
  2632. this._datepickerRef = this._datepicker
  2633. .provide({ provide: BsDatepickerConfig, useValue: this._config })
  2634. .attach(BsDatepickerInlineContainerComponent)
  2635. .to(this._elementRef)
  2636. .show();
  2637. // if date changes from external source (model -> view)
  2638. this._subs.push(this.bsValueChange.subscribe((/**
  2639. * @param {?} value
  2640. * @return {?}
  2641. */
  2642. function (value) {
  2643. _this._datepickerRef.instance.value = value;
  2644. })));
  2645. // if date changes from picker (view -> model)
  2646. this._subs.push(this._datepickerRef.instance.valueChange.subscribe((/**
  2647. * @param {?} value
  2648. * @return {?}
  2649. */
  2650. function (value) {
  2651. _this.bsValue = value;
  2652. })));
  2653. };
  2654. /**
  2655. * @param {?} changes
  2656. * @return {?}
  2657. */
  2658. BsDatepickerInlineDirective.prototype.ngOnChanges = /**
  2659. * @param {?} changes
  2660. * @return {?}
  2661. */
  2662. function (changes) {
  2663. if (!this._datepickerRef || !this._datepickerRef.instance) {
  2664. return;
  2665. }
  2666. if (changes.minDate) {
  2667. this._datepickerRef.instance.minDate = this.minDate;
  2668. this._datepickerRef.instance.value = this._bsValue;
  2669. }
  2670. if (changes.maxDate) {
  2671. this._datepickerRef.instance.maxDate = this.maxDate;
  2672. this._datepickerRef.instance.value = this._bsValue;
  2673. }
  2674. if (changes.datesDisabled) {
  2675. this._datepickerRef.instance.datesDisabled = this.datesDisabled;
  2676. this._datepickerRef.instance.value = this._bsValue;
  2677. }
  2678. if (changes.isDisabled) {
  2679. this._datepickerRef.instance.isDisabled = this.isDisabled;
  2680. }
  2681. if (changes.dateCustomClasses) {
  2682. this._datepickerRef.instance.dateCustomClasses = this.dateCustomClasses;
  2683. }
  2684. };
  2685. /**
  2686. * Set config for datepicker
  2687. */
  2688. /**
  2689. * Set config for datepicker
  2690. * @return {?}
  2691. */
  2692. BsDatepickerInlineDirective.prototype.setConfig = /**
  2693. * Set config for datepicker
  2694. * @return {?}
  2695. */
  2696. function () {
  2697. this._config = Object.assign({}, this._config, this.bsConfig, {
  2698. value: this._bsValue,
  2699. isDisabled: this.isDisabled,
  2700. minDate: this.minDate || this.bsConfig && this.bsConfig.minDate,
  2701. maxDate: this.maxDate || this.bsConfig && this.bsConfig.maxDate,
  2702. dateCustomClasses: this.dateCustomClasses || this.bsConfig && this.bsConfig.dateCustomClasses,
  2703. datesDisabled: this.datesDisabled || this.bsConfig && this.bsConfig.datesDisabled
  2704. });
  2705. };
  2706. /**
  2707. * @return {?}
  2708. */
  2709. BsDatepickerInlineDirective.prototype.ngOnDestroy = /**
  2710. * @return {?}
  2711. */
  2712. function () {
  2713. this._datepicker.dispose();
  2714. };
  2715. BsDatepickerInlineDirective.decorators = [
  2716. { type: core.Directive, args: [{
  2717. selector: 'bs-datepicker-inline',
  2718. exportAs: 'bsDatepickerInline'
  2719. },] }
  2720. ];
  2721. /** @nocollapse */
  2722. BsDatepickerInlineDirective.ctorParameters = function () { return [
  2723. { type: BsDatepickerInlineConfig },
  2724. { type: core.ElementRef },
  2725. { type: core.Renderer2 },
  2726. { type: core.ViewContainerRef },
  2727. { type: componentLoader.ComponentLoaderFactory }
  2728. ]; };
  2729. BsDatepickerInlineDirective.propDecorators = {
  2730. bsValue: [{ type: core.Input }],
  2731. bsConfig: [{ type: core.Input }],
  2732. isDisabled: [{ type: core.Input }],
  2733. minDate: [{ type: core.Input }],
  2734. maxDate: [{ type: core.Input }],
  2735. dateCustomClasses: [{ type: core.Input }],
  2736. datesDisabled: [{ type: core.Input }],
  2737. bsValueChange: [{ type: core.Output }]
  2738. };
  2739. return BsDatepickerInlineDirective;
  2740. }());
  2741. /**
  2742. * @fileoverview added by tsickle
  2743. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2744. */
  2745. var BsDaterangepickerInlineConfig = /** @class */ (function (_super) {
  2746. __extends(BsDaterangepickerInlineConfig, _super);
  2747. function BsDaterangepickerInlineConfig() {
  2748. var _this = _super !== null && _super.apply(this, arguments) || this;
  2749. // DatepickerRenderOptions
  2750. _this.displayMonths = 2;
  2751. /**
  2752. * turn on/off animation
  2753. */
  2754. _this.isAnimated = false;
  2755. return _this;
  2756. }
  2757. BsDaterangepickerInlineConfig.decorators = [
  2758. { type: core.Injectable }
  2759. ];
  2760. return BsDaterangepickerInlineConfig;
  2761. }(BsDatepickerConfig));
  2762. /**
  2763. * @fileoverview added by tsickle
  2764. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2765. */
  2766. var BsDaterangepickerContainerComponent = /** @class */ (function (_super) {
  2767. __extends(BsDaterangepickerContainerComponent, _super);
  2768. function BsDaterangepickerContainerComponent(_renderer, _config, _store, _element, _actions, _effects, _positionService) {
  2769. var _this = _super.call(this) || this;
  2770. _this._config = _config;
  2771. _this._store = _store;
  2772. _this._element = _element;
  2773. _this._actions = _actions;
  2774. _this._positionService = _positionService;
  2775. _this.valueChange = new core.EventEmitter();
  2776. _this.animationState = 'void';
  2777. _this._rangeStack = [];
  2778. _this._subs = [];
  2779. _this._effects = _effects;
  2780. _renderer.setStyle(_element.nativeElement, 'display', 'block');
  2781. _renderer.setStyle(_element.nativeElement, 'position', 'absolute');
  2782. return _this;
  2783. }
  2784. Object.defineProperty(BsDaterangepickerContainerComponent.prototype, "value", {
  2785. set: /**
  2786. * @param {?} value
  2787. * @return {?}
  2788. */
  2789. function (value) {
  2790. this._effects.setRangeValue(value);
  2791. },
  2792. enumerable: true,
  2793. configurable: true
  2794. });
  2795. /**
  2796. * @return {?}
  2797. */
  2798. BsDaterangepickerContainerComponent.prototype.ngOnInit = /**
  2799. * @return {?}
  2800. */
  2801. function () {
  2802. var _this = this;
  2803. this._positionService.setOptions({
  2804. modifiers: { flip: { enabled: this._config.adaptivePosition } },
  2805. allowedPositions: ['top', 'bottom']
  2806. });
  2807. this._positionService.event$
  2808. .pipe(operators.take(1))
  2809. .subscribe((/**
  2810. * @return {?}
  2811. */
  2812. function () {
  2813. _this._positionService.disable();
  2814. if (_this._config.isAnimated) {
  2815. _this.animationState = _this.isTopPosition ? 'animated-up' : 'animated-down';
  2816. return;
  2817. }
  2818. _this.animationState = 'unanimated';
  2819. }));
  2820. this.containerClass = this._config.containerClass;
  2821. this.isOtherMonthsActive = this._config.selectFromOtherMonth;
  2822. this._effects
  2823. .init(this._store)
  2824. // intial state options
  2825. // todo: fix this, split configs
  2826. .setOptions(this._config)
  2827. // data binding view --> model
  2828. .setBindings(this)
  2829. // set event handlers
  2830. .setEventHandlers(this)
  2831. .registerDatepickerSideEffects();
  2832. // todo: move it somewhere else
  2833. // on selected date change
  2834. this._subs.push(this._store
  2835. .select((/**
  2836. * @param {?} state
  2837. * @return {?}
  2838. */
  2839. function (state) { return state.selectedRange; }))
  2840. .subscribe((/**
  2841. * @param {?} date
  2842. * @return {?}
  2843. */
  2844. function (date) { return _this.valueChange.emit(date); })));
  2845. };
  2846. Object.defineProperty(BsDaterangepickerContainerComponent.prototype, "isTopPosition", {
  2847. get: /**
  2848. * @return {?}
  2849. */
  2850. function () {
  2851. return this._element.nativeElement.classList.contains('top');
  2852. },
  2853. enumerable: true,
  2854. configurable: true
  2855. });
  2856. /**
  2857. * @return {?}
  2858. */
  2859. BsDaterangepickerContainerComponent.prototype.positionServiceEnable = /**
  2860. * @return {?}
  2861. */
  2862. function () {
  2863. this._positionService.enable();
  2864. };
  2865. /**
  2866. * @param {?} day
  2867. * @return {?}
  2868. */
  2869. BsDaterangepickerContainerComponent.prototype.daySelectHandler = /**
  2870. * @param {?} day
  2871. * @return {?}
  2872. */
  2873. function (day) {
  2874. /** @type {?} */
  2875. var isDisabled = this.isOtherMonthsActive ? day.isDisabled : (day.isOtherMonth || day.isDisabled);
  2876. if (isDisabled) {
  2877. return;
  2878. }
  2879. // if only one date is already selected
  2880. // and user clicks on previous date
  2881. // start selection from new date
  2882. // but if new date is after initial one
  2883. // than finish selection
  2884. if (this._rangeStack.length === 1) {
  2885. this._rangeStack =
  2886. day.date >= this._rangeStack[0]
  2887. ? [this._rangeStack[0], day.date]
  2888. : [day.date];
  2889. }
  2890. if (this._rangeStack.length === 0) {
  2891. this._rangeStack = [day.date];
  2892. }
  2893. this._store.dispatch(this._actions.selectRange(this._rangeStack));
  2894. if (this._rangeStack.length === 2) {
  2895. this._rangeStack = [];
  2896. }
  2897. };
  2898. /**
  2899. * @return {?}
  2900. */
  2901. BsDaterangepickerContainerComponent.prototype.ngOnDestroy = /**
  2902. * @return {?}
  2903. */
  2904. function () {
  2905. var e_1, _a;
  2906. try {
  2907. for (var _b = __values(this._subs), _c = _b.next(); !_c.done; _c = _b.next()) {
  2908. var sub = _c.value;
  2909. sub.unsubscribe();
  2910. }
  2911. }
  2912. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  2913. finally {
  2914. try {
  2915. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  2916. }
  2917. finally { if (e_1) throw e_1.error; }
  2918. }
  2919. this._effects.destroy();
  2920. };
  2921. BsDaterangepickerContainerComponent.decorators = [
  2922. { type: core.Component, args: [{
  2923. selector: 'bs-daterangepicker-container',
  2924. providers: [BsDatepickerStore, BsDatepickerEffects],
  2925. 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",
  2926. host: {
  2927. class: 'bottom',
  2928. '(click)': '_stopPropagation($event)',
  2929. role: 'dialog',
  2930. 'aria-label': 'calendar'
  2931. },
  2932. animations: [datepickerAnimation]
  2933. }] }
  2934. ];
  2935. /** @nocollapse */
  2936. BsDaterangepickerContainerComponent.ctorParameters = function () { return [
  2937. { type: core.Renderer2 },
  2938. { type: BsDatepickerConfig },
  2939. { type: BsDatepickerStore },
  2940. { type: core.ElementRef },
  2941. { type: BsDatepickerActions },
  2942. { type: BsDatepickerEffects },
  2943. { type: positioning.PositioningService }
  2944. ]; };
  2945. return BsDaterangepickerContainerComponent;
  2946. }(BsDatepickerAbstractComponent));
  2947. /**
  2948. * @fileoverview added by tsickle
  2949. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2950. */
  2951. var BsDaterangepickerInlineContainerComponent = /** @class */ (function (_super) {
  2952. __extends(BsDaterangepickerInlineContainerComponent, _super);
  2953. function BsDaterangepickerInlineContainerComponent(_renderer, _config, _store, _element, _actions, _effects, _positioningService) {
  2954. var _this = _super.call(this, _renderer, _config, _store, _element, _actions, _effects, _positioningService) || this;
  2955. _renderer.setStyle(_element.nativeElement, 'display', 'inline-block');
  2956. _renderer.setStyle(_element.nativeElement, 'position', 'static');
  2957. return _this;
  2958. }
  2959. BsDaterangepickerInlineContainerComponent.decorators = [
  2960. { type: core.Component, args: [{
  2961. selector: 'bs-daterangepicker-inline-container',
  2962. providers: [BsDatepickerStore, BsDatepickerEffects],
  2963. 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",
  2964. host: {
  2965. '(click)': '_stopPropagation($event)'
  2966. },
  2967. animations: [datepickerAnimation]
  2968. }] }
  2969. ];
  2970. /** @nocollapse */
  2971. BsDaterangepickerInlineContainerComponent.ctorParameters = function () { return [
  2972. { type: core.Renderer2 },
  2973. { type: BsDatepickerConfig },
  2974. { type: BsDatepickerStore },
  2975. { type: core.ElementRef },
  2976. { type: BsDatepickerActions },
  2977. { type: BsDatepickerEffects },
  2978. { type: positioning.PositioningService }
  2979. ]; };
  2980. return BsDaterangepickerInlineContainerComponent;
  2981. }(BsDaterangepickerContainerComponent));
  2982. /**
  2983. * @fileoverview added by tsickle
  2984. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2985. */
  2986. var BsDaterangepickerInlineDirective = /** @class */ (function () {
  2987. function BsDaterangepickerInlineDirective(_config, _elementRef, _renderer, _viewContainerRef, cis) {
  2988. this._config = _config;
  2989. this._elementRef = _elementRef;
  2990. /**
  2991. * Emits when daterangepicker value has been changed
  2992. */
  2993. this.bsValueChange = new core.EventEmitter();
  2994. this._subs = [];
  2995. // todo: assign only subset of fields
  2996. Object.assign(this, this._config);
  2997. this._datepicker = cis.createLoader(_elementRef, _viewContainerRef, _renderer);
  2998. }
  2999. Object.defineProperty(BsDaterangepickerInlineDirective.prototype, "bsValue", {
  3000. /**
  3001. * Initial value of datepicker
  3002. */
  3003. set: /**
  3004. * Initial value of datepicker
  3005. * @param {?} value
  3006. * @return {?}
  3007. */
  3008. function (value) {
  3009. if (this._bsValue === value) {
  3010. return;
  3011. }
  3012. this._bsValue = value;
  3013. this.bsValueChange.emit(value);
  3014. },
  3015. enumerable: true,
  3016. configurable: true
  3017. });
  3018. /**
  3019. * @return {?}
  3020. */
  3021. BsDaterangepickerInlineDirective.prototype.ngOnInit = /**
  3022. * @return {?}
  3023. */
  3024. function () {
  3025. var _this = this;
  3026. this.setConfig();
  3027. this._datepickerRef = this._datepicker
  3028. .provide({ provide: BsDatepickerConfig, useValue: this._config })
  3029. .attach(BsDaterangepickerInlineContainerComponent)
  3030. .to(this._elementRef)
  3031. .show();
  3032. // if date changes from external source (model -> view)
  3033. this._subs.push(this.bsValueChange.subscribe((/**
  3034. * @param {?} value
  3035. * @return {?}
  3036. */
  3037. function (value) {
  3038. _this._datepickerRef.instance.value = value;
  3039. })));
  3040. // if date changes from picker (view -> model)
  3041. this._subs.push(this._datepickerRef.instance.valueChange
  3042. .pipe(operators.filter((/**
  3043. * @param {?} range
  3044. * @return {?}
  3045. */
  3046. function (range) { return range && range[0] && !!range[1]; })))
  3047. .subscribe((/**
  3048. * @param {?} value
  3049. * @return {?}
  3050. */
  3051. function (value) {
  3052. _this.bsValue = value;
  3053. })));
  3054. };
  3055. /**
  3056. * @param {?} changes
  3057. * @return {?}
  3058. */
  3059. BsDaterangepickerInlineDirective.prototype.ngOnChanges = /**
  3060. * @param {?} changes
  3061. * @return {?}
  3062. */
  3063. function (changes) {
  3064. if (!this._datepickerRef || !this._datepickerRef.instance) {
  3065. return;
  3066. }
  3067. if (changes.minDate) {
  3068. this._datepickerRef.instance.minDate = this.minDate;
  3069. }
  3070. if (changes.maxDate) {
  3071. this._datepickerRef.instance.maxDate = this.maxDate;
  3072. }
  3073. if (changes.datesDisabled) {
  3074. this._datepickerRef.instance.datesDisabled = this.datesDisabled;
  3075. }
  3076. if (changes.isDisabled) {
  3077. this._datepickerRef.instance.isDisabled = this.isDisabled;
  3078. }
  3079. if (changes.dateCustomClasses) {
  3080. this._datepickerRef.instance.dateCustomClasses = this.dateCustomClasses;
  3081. }
  3082. };
  3083. /**
  3084. * Set config for datepicker
  3085. */
  3086. /**
  3087. * Set config for datepicker
  3088. * @return {?}
  3089. */
  3090. BsDaterangepickerInlineDirective.prototype.setConfig = /**
  3091. * Set config for datepicker
  3092. * @return {?}
  3093. */
  3094. function () {
  3095. this._config = Object.assign({}, this._config, this.bsConfig, {
  3096. value: this._bsValue,
  3097. isDisabled: this.isDisabled,
  3098. minDate: this.minDate || this.bsConfig && this.bsConfig.minDate,
  3099. maxDate: this.maxDate || this.bsConfig && this.bsConfig.maxDate,
  3100. dateCustomClasses: this.dateCustomClasses || this.bsConfig && this.bsConfig.dateCustomClasses,
  3101. datesDisabled: this.datesDisabled || this.bsConfig && this.bsConfig.datesDisabled
  3102. });
  3103. };
  3104. /**
  3105. * @return {?}
  3106. */
  3107. BsDaterangepickerInlineDirective.prototype.ngOnDestroy = /**
  3108. * @return {?}
  3109. */
  3110. function () {
  3111. this._datepicker.dispose();
  3112. };
  3113. BsDaterangepickerInlineDirective.decorators = [
  3114. { type: core.Directive, args: [{
  3115. selector: 'bs-daterangepicker-inline',
  3116. exportAs: 'bsDaterangepickerInline'
  3117. },] }
  3118. ];
  3119. /** @nocollapse */
  3120. BsDaterangepickerInlineDirective.ctorParameters = function () { return [
  3121. { type: BsDaterangepickerInlineConfig },
  3122. { type: core.ElementRef },
  3123. { type: core.Renderer2 },
  3124. { type: core.ViewContainerRef },
  3125. { type: componentLoader.ComponentLoaderFactory }
  3126. ]; };
  3127. BsDaterangepickerInlineDirective.propDecorators = {
  3128. bsValue: [{ type: core.Input }],
  3129. bsConfig: [{ type: core.Input }],
  3130. isDisabled: [{ type: core.Input }],
  3131. minDate: [{ type: core.Input }],
  3132. maxDate: [{ type: core.Input }],
  3133. dateCustomClasses: [{ type: core.Input }],
  3134. datesDisabled: [{ type: core.Input }],
  3135. bsValueChange: [{ type: core.Output }]
  3136. };
  3137. return BsDaterangepickerInlineDirective;
  3138. }());
  3139. /**
  3140. * @fileoverview added by tsickle
  3141. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3142. */
  3143. /** @type {?} */
  3144. var BS_DATEPICKER_VALUE_ACCESSOR = {
  3145. provide: forms.NG_VALUE_ACCESSOR,
  3146. /* tslint:disable-next-line: no-use-before-declare */
  3147. useExisting: core.forwardRef((/**
  3148. * @return {?}
  3149. */
  3150. function () { return BsDatepickerInputDirective; })),
  3151. multi: true
  3152. };
  3153. /** @type {?} */
  3154. var BS_DATEPICKER_VALIDATOR = {
  3155. provide: forms.NG_VALIDATORS,
  3156. /* tslint:disable-next-line: no-use-before-declare */
  3157. useExisting: core.forwardRef((/**
  3158. * @return {?}
  3159. */
  3160. function () { return BsDatepickerInputDirective; })),
  3161. multi: true
  3162. };
  3163. var BsDatepickerInputDirective = /** @class */ (function () {
  3164. function BsDatepickerInputDirective(_picker, _localeService, _renderer, _elRef, changeDetection) {
  3165. var _this = this;
  3166. this._picker = _picker;
  3167. this._localeService = _localeService;
  3168. this._renderer = _renderer;
  3169. this._elRef = _elRef;
  3170. this.changeDetection = changeDetection;
  3171. this._onChange = Function.prototype;
  3172. this._onTouched = Function.prototype;
  3173. /* tslint:disable-next-line: no-unused-variable */
  3174. this._validatorChange = Function.prototype;
  3175. // update input value on datepicker value update
  3176. this._picker.bsValueChange.subscribe((/**
  3177. * @param {?} value
  3178. * @return {?}
  3179. */
  3180. function (value) {
  3181. _this._setInputValue(value);
  3182. if (_this._value !== value) {
  3183. _this._value = value;
  3184. _this._onChange(value);
  3185. _this._onTouched();
  3186. }
  3187. _this.changeDetection.markForCheck();
  3188. }));
  3189. // update input value on locale change
  3190. this._localeService.localeChange.subscribe((/**
  3191. * @return {?}
  3192. */
  3193. function () {
  3194. _this._setInputValue(_this._value);
  3195. }));
  3196. }
  3197. /**
  3198. * @param {?} value
  3199. * @return {?}
  3200. */
  3201. BsDatepickerInputDirective.prototype._setInputValue = /**
  3202. * @param {?} value
  3203. * @return {?}
  3204. */
  3205. function (value) {
  3206. /** @type {?} */
  3207. var initialDate = !value ? ''
  3208. : chronos.formatDate(value, this._picker._config.dateInputFormat, this._localeService.currentLocale);
  3209. this._renderer.setProperty(this._elRef.nativeElement, 'value', initialDate);
  3210. };
  3211. /**
  3212. * @param {?} event
  3213. * @return {?}
  3214. */
  3215. BsDatepickerInputDirective.prototype.onChange = /**
  3216. * @param {?} event
  3217. * @return {?}
  3218. */
  3219. function (event) {
  3220. /* tslint:disable-next-line: no-any*/
  3221. this.writeValue(((/** @type {?} */ (event.target))).value);
  3222. this._onChange(this._value);
  3223. this._onTouched();
  3224. };
  3225. /**
  3226. * @param {?} c
  3227. * @return {?}
  3228. */
  3229. BsDatepickerInputDirective.prototype.validate = /**
  3230. * @param {?} c
  3231. * @return {?}
  3232. */
  3233. function (c) {
  3234. /** @type {?} */
  3235. var _value = c.value;
  3236. /* tslint:disable-next-line: prefer-switch */
  3237. if (_value === null || _value === undefined || _value === '') {
  3238. return null;
  3239. }
  3240. if (chronos.isDate(_value)) {
  3241. /** @type {?} */
  3242. var _isDateValid = chronos.isDateValid(_value);
  3243. if (!_isDateValid) {
  3244. return { bsDate: { invalid: _value } };
  3245. }
  3246. if (this._picker && this._picker.minDate && chronos.isBefore(_value, this._picker.minDate, 'date')) {
  3247. return { bsDate: { minDate: this._picker.minDate } };
  3248. }
  3249. if (this._picker && this._picker.maxDate && chronos.isAfter(_value, this._picker.maxDate, 'date')) {
  3250. return { bsDate: { maxDate: this._picker.maxDate } };
  3251. }
  3252. }
  3253. };
  3254. /**
  3255. * @param {?} fn
  3256. * @return {?}
  3257. */
  3258. BsDatepickerInputDirective.prototype.registerOnValidatorChange = /**
  3259. * @param {?} fn
  3260. * @return {?}
  3261. */
  3262. function (fn) {
  3263. this._validatorChange = fn;
  3264. };
  3265. /**
  3266. * @param {?} value
  3267. * @return {?}
  3268. */
  3269. BsDatepickerInputDirective.prototype.writeValue = /**
  3270. * @param {?} value
  3271. * @return {?}
  3272. */
  3273. function (value) {
  3274. if (!value) {
  3275. this._value = null;
  3276. }
  3277. else {
  3278. /** @type {?} */
  3279. var _localeKey = this._localeService.currentLocale;
  3280. /** @type {?} */
  3281. var _locale = chronos.getLocale(_localeKey);
  3282. if (!_locale) {
  3283. throw new Error("Locale \"" + _localeKey + "\" is not defined, please add it with \"defineLocale(...)\"");
  3284. }
  3285. this._value = chronos.parseDate(value, this._picker._config.dateInputFormat, this._localeService.currentLocale);
  3286. if (this._picker._config.useUtc) {
  3287. this._value = chronos.utcAsLocal(this._value);
  3288. }
  3289. }
  3290. this._picker.bsValue = this._value;
  3291. };
  3292. /**
  3293. * @param {?} isDisabled
  3294. * @return {?}
  3295. */
  3296. BsDatepickerInputDirective.prototype.setDisabledState = /**
  3297. * @param {?} isDisabled
  3298. * @return {?}
  3299. */
  3300. function (isDisabled) {
  3301. this._picker.isDisabled = isDisabled;
  3302. if (isDisabled) {
  3303. this._renderer.setAttribute(this._elRef.nativeElement, 'disabled', 'disabled');
  3304. return;
  3305. }
  3306. this._renderer.removeAttribute(this._elRef.nativeElement, 'disabled');
  3307. };
  3308. /**
  3309. * @param {?} fn
  3310. * @return {?}
  3311. */
  3312. BsDatepickerInputDirective.prototype.registerOnChange = /**
  3313. * @param {?} fn
  3314. * @return {?}
  3315. */
  3316. function (fn) {
  3317. this._onChange = fn;
  3318. };
  3319. /**
  3320. * @param {?} fn
  3321. * @return {?}
  3322. */
  3323. BsDatepickerInputDirective.prototype.registerOnTouched = /**
  3324. * @param {?} fn
  3325. * @return {?}
  3326. */
  3327. function (fn) {
  3328. this._onTouched = fn;
  3329. };
  3330. /**
  3331. * @return {?}
  3332. */
  3333. BsDatepickerInputDirective.prototype.onBlur = /**
  3334. * @return {?}
  3335. */
  3336. function () {
  3337. this._onTouched();
  3338. };
  3339. /**
  3340. * @return {?}
  3341. */
  3342. BsDatepickerInputDirective.prototype.hide = /**
  3343. * @return {?}
  3344. */
  3345. function () {
  3346. this._picker.hide();
  3347. this._renderer.selectRootElement(this._elRef.nativeElement).blur();
  3348. };
  3349. BsDatepickerInputDirective.decorators = [
  3350. { type: core.Directive, args: [{
  3351. selector: "input[bsDatepicker]",
  3352. host: {
  3353. '(change)': 'onChange($event)',
  3354. '(keyup.esc)': 'hide()',
  3355. '(blur)': 'onBlur()'
  3356. },
  3357. providers: [BS_DATEPICKER_VALUE_ACCESSOR, BS_DATEPICKER_VALIDATOR]
  3358. },] }
  3359. ];
  3360. /** @nocollapse */
  3361. BsDatepickerInputDirective.ctorParameters = function () { return [
  3362. { type: BsDatepickerDirective, decorators: [{ type: core.Host }] },
  3363. { type: BsLocaleService },
  3364. { type: core.Renderer2 },
  3365. { type: core.ElementRef },
  3366. { type: core.ChangeDetectorRef }
  3367. ]; };
  3368. return BsDatepickerInputDirective;
  3369. }());
  3370. /**
  3371. * @fileoverview added by tsickle
  3372. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3373. */
  3374. var BsDaterangepickerConfig = /** @class */ (function (_super) {
  3375. __extends(BsDaterangepickerConfig, _super);
  3376. function BsDaterangepickerConfig() {
  3377. var _this = _super !== null && _super.apply(this, arguments) || this;
  3378. // DatepickerRenderOptions
  3379. _this.displayMonths = 2;
  3380. return _this;
  3381. }
  3382. BsDaterangepickerConfig.decorators = [
  3383. { type: core.Injectable }
  3384. ];
  3385. return BsDaterangepickerConfig;
  3386. }(BsDatepickerConfig));
  3387. /**
  3388. * @fileoverview added by tsickle
  3389. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3390. */
  3391. var BsDaterangepickerDirective = /** @class */ (function () {
  3392. function BsDaterangepickerDirective(_config, _elementRef, _renderer, _viewContainerRef, cis) {
  3393. this._config = _config;
  3394. /**
  3395. * Placement of a daterangepicker. Accepts: "top", "bottom", "left", "right"
  3396. */
  3397. this.placement = 'bottom';
  3398. /**
  3399. * Specifies events that should trigger. Supports a space separated list of
  3400. * event names.
  3401. */
  3402. this.triggers = 'click';
  3403. /**
  3404. * Close daterangepicker on outside click
  3405. */
  3406. this.outsideClick = true;
  3407. /**
  3408. * A selector specifying the element the daterangepicker should be appended to.
  3409. */
  3410. this.container = 'body';
  3411. this.outsideEsc = true;
  3412. /**
  3413. * Emits when daterangepicker value has been changed
  3414. */
  3415. this.bsValueChange = new core.EventEmitter();
  3416. this._subs = [];
  3417. this._datepicker = cis.createLoader(_elementRef, _viewContainerRef, _renderer);
  3418. Object.assign(this, _config);
  3419. this.onShown = this._datepicker.onShown;
  3420. this.onHidden = this._datepicker.onHidden;
  3421. }
  3422. Object.defineProperty(BsDaterangepickerDirective.prototype, "isOpen", {
  3423. /**
  3424. * Returns whether or not the daterangepicker is currently being shown
  3425. */
  3426. get: /**
  3427. * Returns whether or not the daterangepicker is currently being shown
  3428. * @return {?}
  3429. */
  3430. function () {
  3431. return this._datepicker.isShown;
  3432. },
  3433. set: /**
  3434. * @param {?} value
  3435. * @return {?}
  3436. */
  3437. function (value) {
  3438. if (value) {
  3439. this.show();
  3440. }
  3441. else {
  3442. this.hide();
  3443. }
  3444. },
  3445. enumerable: true,
  3446. configurable: true
  3447. });
  3448. Object.defineProperty(BsDaterangepickerDirective.prototype, "bsValue", {
  3449. /**
  3450. * Initial value of daterangepicker
  3451. */
  3452. set: /**
  3453. * Initial value of daterangepicker
  3454. * @param {?} value
  3455. * @return {?}
  3456. */
  3457. function (value) {
  3458. if (this._bsValue === value) {
  3459. return;
  3460. }
  3461. this._bsValue = value;
  3462. this.bsValueChange.emit(value);
  3463. },
  3464. enumerable: true,
  3465. configurable: true
  3466. });
  3467. /**
  3468. * @return {?}
  3469. */
  3470. BsDaterangepickerDirective.prototype.ngOnInit = /**
  3471. * @return {?}
  3472. */
  3473. function () {
  3474. var _this = this;
  3475. this._datepicker.listen({
  3476. outsideClick: this.outsideClick,
  3477. outsideEsc: this.outsideEsc,
  3478. triggers: this.triggers,
  3479. show: (/**
  3480. * @return {?}
  3481. */
  3482. function () { return _this.show(); })
  3483. });
  3484. this.setConfig();
  3485. };
  3486. /**
  3487. * @param {?} changes
  3488. * @return {?}
  3489. */
  3490. BsDaterangepickerDirective.prototype.ngOnChanges = /**
  3491. * @param {?} changes
  3492. * @return {?}
  3493. */
  3494. function (changes) {
  3495. if (!this._datepickerRef || !this._datepickerRef.instance) {
  3496. return;
  3497. }
  3498. if (changes.minDate) {
  3499. this._datepickerRef.instance.minDate = this.minDate;
  3500. }
  3501. if (changes.maxDate) {
  3502. this._datepickerRef.instance.maxDate = this.maxDate;
  3503. }
  3504. if (changes.datesDisabled) {
  3505. this._datepickerRef.instance.datesDisabled = this.datesDisabled;
  3506. }
  3507. if (changes.isDisabled) {
  3508. this._datepickerRef.instance.isDisabled = this.isDisabled;
  3509. }
  3510. if (changes.dateCustomClasses) {
  3511. this._datepickerRef.instance.dateCustomClasses = this.dateCustomClasses;
  3512. }
  3513. };
  3514. /**
  3515. * Opens an element’s datepicker. This is considered a “manual” triggering of
  3516. * the datepicker.
  3517. */
  3518. /**
  3519. * Opens an element’s datepicker. This is considered a “manual” triggering of
  3520. * the datepicker.
  3521. * @return {?}
  3522. */
  3523. BsDaterangepickerDirective.prototype.show = /**
  3524. * Opens an element’s datepicker. This is considered a “manual” triggering of
  3525. * the datepicker.
  3526. * @return {?}
  3527. */
  3528. function () {
  3529. var _this = this;
  3530. if (this._datepicker.isShown) {
  3531. return;
  3532. }
  3533. this.setConfig();
  3534. this._datepickerRef = this._datepicker
  3535. .provide({ provide: BsDatepickerConfig, useValue: this._config })
  3536. .attach(BsDaterangepickerContainerComponent)
  3537. .to(this.container)
  3538. .position({ attachment: this.placement })
  3539. .show({ placement: this.placement });
  3540. // if date changes from external source (model -> view)
  3541. this._subs.push(this.bsValueChange.subscribe((/**
  3542. * @param {?} value
  3543. * @return {?}
  3544. */
  3545. function (value) {
  3546. _this._datepickerRef.instance.value = value;
  3547. })));
  3548. // if date changes from picker (view -> model)
  3549. this._subs.push(this._datepickerRef.instance.valueChange
  3550. .pipe(operators.filter((/**
  3551. * @param {?} range
  3552. * @return {?}
  3553. */
  3554. function (range) { return range && range[0] && !!range[1]; })))
  3555. .subscribe((/**
  3556. * @param {?} value
  3557. * @return {?}
  3558. */
  3559. function (value) {
  3560. _this.bsValue = value;
  3561. _this.hide();
  3562. })));
  3563. };
  3564. /**
  3565. * Set config for daterangepicker
  3566. */
  3567. /**
  3568. * Set config for daterangepicker
  3569. * @return {?}
  3570. */
  3571. BsDaterangepickerDirective.prototype.setConfig = /**
  3572. * Set config for daterangepicker
  3573. * @return {?}
  3574. */
  3575. function () {
  3576. this._config = Object.assign({}, this._config, this.bsConfig, {
  3577. value: this._bsValue,
  3578. isDisabled: this.isDisabled,
  3579. minDate: this.minDate || this.bsConfig && this.bsConfig.minDate,
  3580. maxDate: this.maxDate || this.bsConfig && this.bsConfig.maxDate,
  3581. dateCustomClasses: this.dateCustomClasses || this.bsConfig && this.bsConfig.dateCustomClasses,
  3582. datesDisabled: this.datesDisabled || this.bsConfig && this.bsConfig.datesDisabled
  3583. });
  3584. };
  3585. /**
  3586. * Closes an element’s datepicker. This is considered a “manual” triggering of
  3587. * the datepicker.
  3588. */
  3589. /**
  3590. * Closes an element’s datepicker. This is considered a “manual” triggering of
  3591. * the datepicker.
  3592. * @return {?}
  3593. */
  3594. BsDaterangepickerDirective.prototype.hide = /**
  3595. * Closes an element’s datepicker. This is considered a “manual” triggering of
  3596. * the datepicker.
  3597. * @return {?}
  3598. */
  3599. function () {
  3600. var e_1, _a;
  3601. if (this.isOpen) {
  3602. this._datepicker.hide();
  3603. }
  3604. try {
  3605. for (var _b = __values(this._subs), _c = _b.next(); !_c.done; _c = _b.next()) {
  3606. var sub = _c.value;
  3607. sub.unsubscribe();
  3608. }
  3609. }
  3610. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  3611. finally {
  3612. try {
  3613. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  3614. }
  3615. finally { if (e_1) throw e_1.error; }
  3616. }
  3617. };
  3618. /**
  3619. * Toggles an element’s datepicker. This is considered a “manual” triggering
  3620. * of the datepicker.
  3621. */
  3622. /**
  3623. * Toggles an element’s datepicker. This is considered a “manual” triggering
  3624. * of the datepicker.
  3625. * @return {?}
  3626. */
  3627. BsDaterangepickerDirective.prototype.toggle = /**
  3628. * Toggles an element’s datepicker. This is considered a “manual” triggering
  3629. * of the datepicker.
  3630. * @return {?}
  3631. */
  3632. function () {
  3633. if (this.isOpen) {
  3634. return this.hide();
  3635. }
  3636. this.show();
  3637. };
  3638. /**
  3639. * @return {?}
  3640. */
  3641. BsDaterangepickerDirective.prototype.ngOnDestroy = /**
  3642. * @return {?}
  3643. */
  3644. function () {
  3645. this._datepicker.dispose();
  3646. };
  3647. BsDaterangepickerDirective.decorators = [
  3648. { type: core.Directive, args: [{
  3649. selector: '[bsDaterangepicker]',
  3650. exportAs: 'bsDaterangepicker'
  3651. },] }
  3652. ];
  3653. /** @nocollapse */
  3654. BsDaterangepickerDirective.ctorParameters = function () { return [
  3655. { type: BsDaterangepickerConfig },
  3656. { type: core.ElementRef },
  3657. { type: core.Renderer2 },
  3658. { type: core.ViewContainerRef },
  3659. { type: componentLoader.ComponentLoaderFactory }
  3660. ]; };
  3661. BsDaterangepickerDirective.propDecorators = {
  3662. placement: [{ type: core.Input }],
  3663. triggers: [{ type: core.Input }],
  3664. outsideClick: [{ type: core.Input }],
  3665. container: [{ type: core.Input }],
  3666. outsideEsc: [{ type: core.Input }],
  3667. isOpen: [{ type: core.Input }],
  3668. onShown: [{ type: core.Output }],
  3669. onHidden: [{ type: core.Output }],
  3670. bsValue: [{ type: core.Input }],
  3671. bsConfig: [{ type: core.Input }],
  3672. isDisabled: [{ type: core.Input }],
  3673. minDate: [{ type: core.Input }],
  3674. maxDate: [{ type: core.Input }],
  3675. dateCustomClasses: [{ type: core.Input }],
  3676. datesDisabled: [{ type: core.Input }],
  3677. bsValueChange: [{ type: core.Output }]
  3678. };
  3679. return BsDaterangepickerDirective;
  3680. }());
  3681. /**
  3682. * @fileoverview added by tsickle
  3683. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3684. */
  3685. /** @type {?} */
  3686. var BS_DATERANGEPICKER_VALUE_ACCESSOR = {
  3687. provide: forms.NG_VALUE_ACCESSOR,
  3688. /* tslint:disable-next-line: no-use-before-declare */
  3689. useExisting: core.forwardRef((/**
  3690. * @return {?}
  3691. */
  3692. function () { return BsDaterangepickerInputDirective; })),
  3693. multi: true
  3694. };
  3695. /** @type {?} */
  3696. var BS_DATERANGEPICKER_VALIDATOR = {
  3697. provide: forms.NG_VALIDATORS,
  3698. /* tslint:disable-next-line: no-use-before-declare */
  3699. useExisting: core.forwardRef((/**
  3700. * @return {?}
  3701. */
  3702. function () { return BsDaterangepickerInputDirective; })),
  3703. multi: true
  3704. };
  3705. var BsDaterangepickerInputDirective = /** @class */ (function () {
  3706. function BsDaterangepickerInputDirective(_picker, _localeService, _renderer, _elRef, changeDetection) {
  3707. var _this = this;
  3708. this._picker = _picker;
  3709. this._localeService = _localeService;
  3710. this._renderer = _renderer;
  3711. this._elRef = _elRef;
  3712. this.changeDetection = changeDetection;
  3713. this._onChange = Function.prototype;
  3714. this._onTouched = Function.prototype;
  3715. /* tslint:disable-next-line: no-unused-variable */
  3716. this._validatorChange = Function.prototype;
  3717. // update input value on datepicker value update
  3718. this._picker.bsValueChange.subscribe((/**
  3719. * @param {?} value
  3720. * @return {?}
  3721. */
  3722. function (value) {
  3723. _this._setInputValue(value);
  3724. if (_this._value !== value) {
  3725. _this._value = value;
  3726. _this._onChange(value);
  3727. _this._onTouched();
  3728. }
  3729. _this.changeDetection.markForCheck();
  3730. }));
  3731. // update input value on locale change
  3732. this._localeService.localeChange.subscribe((/**
  3733. * @return {?}
  3734. */
  3735. function () {
  3736. _this._setInputValue(_this._value);
  3737. }));
  3738. }
  3739. /**
  3740. * @param {?} date
  3741. * @return {?}
  3742. */
  3743. BsDaterangepickerInputDirective.prototype._setInputValue = /**
  3744. * @param {?} date
  3745. * @return {?}
  3746. */
  3747. function (date) {
  3748. /** @type {?} */
  3749. var range = '';
  3750. if (date) {
  3751. /** @type {?} */
  3752. var start = !date[0] ? ''
  3753. : chronos.formatDate(date[0], this._picker._config.rangeInputFormat, this._localeService.currentLocale);
  3754. /** @type {?} */
  3755. var end = !date[1] ? ''
  3756. : chronos.formatDate(date[1], this._picker._config.rangeInputFormat, this._localeService.currentLocale);
  3757. range = (start && end) ? start + this._picker._config.rangeSeparator + end : '';
  3758. }
  3759. this._renderer.setProperty(this._elRef.nativeElement, 'value', range);
  3760. };
  3761. /**
  3762. * @param {?} event
  3763. * @return {?}
  3764. */
  3765. BsDaterangepickerInputDirective.prototype.onChange = /**
  3766. * @param {?} event
  3767. * @return {?}
  3768. */
  3769. function (event) {
  3770. /* tslint:disable-next-line: no-any*/
  3771. this.writeValue(((/** @type {?} */ (event.target))).value);
  3772. this._onChange(this._value);
  3773. this._onTouched();
  3774. };
  3775. /**
  3776. * @param {?} c
  3777. * @return {?}
  3778. */
  3779. BsDaterangepickerInputDirective.prototype.validate = /**
  3780. * @param {?} c
  3781. * @return {?}
  3782. */
  3783. function (c) {
  3784. /** @type {?} */
  3785. var _value = c.value;
  3786. if (_value === null || _value === undefined || !chronos.isArray(_value)) {
  3787. return null;
  3788. }
  3789. /** @type {?} */
  3790. var _isFirstDateValid = chronos.isDateValid(_value[0]);
  3791. /** @type {?} */
  3792. var _isSecondDateValid = chronos.isDateValid(_value[1]);
  3793. if (!_isFirstDateValid) {
  3794. return { bsDate: { invalid: _value[0] } };
  3795. }
  3796. if (!_isSecondDateValid) {
  3797. return { bsDate: { invalid: _value[1] } };
  3798. }
  3799. if (this._picker && this._picker.minDate && chronos.isBefore(_value[0], this._picker.minDate, 'date')) {
  3800. return { bsDate: { minDate: this._picker.minDate } };
  3801. }
  3802. if (this._picker && this._picker.maxDate && chronos.isAfter(_value[1], this._picker.maxDate, 'date')) {
  3803. return { bsDate: { maxDate: this._picker.maxDate } };
  3804. }
  3805. };
  3806. /**
  3807. * @param {?} fn
  3808. * @return {?}
  3809. */
  3810. BsDaterangepickerInputDirective.prototype.registerOnValidatorChange = /**
  3811. * @param {?} fn
  3812. * @return {?}
  3813. */
  3814. function (fn) {
  3815. this._validatorChange = fn;
  3816. };
  3817. /**
  3818. * @param {?} value
  3819. * @return {?}
  3820. */
  3821. BsDaterangepickerInputDirective.prototype.writeValue = /**
  3822. * @param {?} value
  3823. * @return {?}
  3824. */
  3825. function (value) {
  3826. var _this = this;
  3827. if (!value) {
  3828. this._value = null;
  3829. }
  3830. else {
  3831. /** @type {?} */
  3832. var _localeKey = this._localeService.currentLocale;
  3833. /** @type {?} */
  3834. var _locale = chronos.getLocale(_localeKey);
  3835. if (!_locale) {
  3836. throw new Error("Locale \"" + _localeKey + "\" is not defined, please add it with \"defineLocale(...)\"");
  3837. }
  3838. /** @type {?} */
  3839. var _input = [];
  3840. if (typeof value === 'string') {
  3841. _input = value.split(this._picker._config.rangeSeparator);
  3842. }
  3843. if (Array.isArray(value)) {
  3844. _input = value;
  3845. }
  3846. this._value = ((/** @type {?} */ (_input)))
  3847. .map((/**
  3848. * @param {?} _val
  3849. * @return {?}
  3850. */
  3851. function (_val) {
  3852. if (_this._picker._config.useUtc) {
  3853. return chronos.utcAsLocal(chronos.parseDate(_val, _this._picker._config.dateInputFormat, _this._localeService.currentLocale));
  3854. }
  3855. return chronos.parseDate(_val, _this._picker._config.dateInputFormat, _this._localeService.currentLocale);
  3856. }))
  3857. .map((/**
  3858. * @param {?} date
  3859. * @return {?}
  3860. */
  3861. function (date) { return (isNaN(date.valueOf()) ? null : date); }));
  3862. }
  3863. this._picker.bsValue = this._value;
  3864. };
  3865. /**
  3866. * @param {?} isDisabled
  3867. * @return {?}
  3868. */
  3869. BsDaterangepickerInputDirective.prototype.setDisabledState = /**
  3870. * @param {?} isDisabled
  3871. * @return {?}
  3872. */
  3873. function (isDisabled) {
  3874. this._picker.isDisabled = isDisabled;
  3875. if (isDisabled) {
  3876. this._renderer.setAttribute(this._elRef.nativeElement, 'disabled', 'disabled');
  3877. return;
  3878. }
  3879. this._renderer.removeAttribute(this._elRef.nativeElement, 'disabled');
  3880. };
  3881. /* tslint:disable-next-line: no-any*/
  3882. /* tslint:disable-next-line: no-any*/
  3883. /**
  3884. * @param {?} fn
  3885. * @return {?}
  3886. */
  3887. BsDaterangepickerInputDirective.prototype.registerOnChange = /* tslint:disable-next-line: no-any*/
  3888. /**
  3889. * @param {?} fn
  3890. * @return {?}
  3891. */
  3892. function (fn) {
  3893. this._onChange = fn;
  3894. };
  3895. /* tslint:disable-next-line: no-any*/
  3896. /* tslint:disable-next-line: no-any*/
  3897. /**
  3898. * @param {?} fn
  3899. * @return {?}
  3900. */
  3901. BsDaterangepickerInputDirective.prototype.registerOnTouched = /* tslint:disable-next-line: no-any*/
  3902. /**
  3903. * @param {?} fn
  3904. * @return {?}
  3905. */
  3906. function (fn) {
  3907. this._onTouched = fn;
  3908. };
  3909. /**
  3910. * @return {?}
  3911. */
  3912. BsDaterangepickerInputDirective.prototype.onBlur = /**
  3913. * @return {?}
  3914. */
  3915. function () {
  3916. this._onTouched();
  3917. };
  3918. /**
  3919. * @return {?}
  3920. */
  3921. BsDaterangepickerInputDirective.prototype.hide = /**
  3922. * @return {?}
  3923. */
  3924. function () {
  3925. this._picker.hide();
  3926. this._renderer.selectRootElement(this._elRef.nativeElement).blur();
  3927. };
  3928. BsDaterangepickerInputDirective.decorators = [
  3929. { type: core.Directive, args: [{
  3930. selector: "input[bsDaterangepicker]",
  3931. host: {
  3932. '(change)': 'onChange($event)',
  3933. '(keyup.esc)': 'hide()',
  3934. '(blur)': 'onBlur()'
  3935. },
  3936. providers: [BS_DATERANGEPICKER_VALUE_ACCESSOR, BS_DATERANGEPICKER_VALIDATOR]
  3937. },] }
  3938. ];
  3939. /** @nocollapse */
  3940. BsDaterangepickerInputDirective.ctorParameters = function () { return [
  3941. { type: BsDaterangepickerDirective, decorators: [{ type: core.Host }] },
  3942. { type: BsLocaleService },
  3943. { type: core.Renderer2 },
  3944. { type: core.ElementRef },
  3945. { type: core.ChangeDetectorRef }
  3946. ]; };
  3947. return BsDaterangepickerInputDirective;
  3948. }());
  3949. /**
  3950. * @fileoverview added by tsickle
  3951. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3952. */
  3953. var BsCalendarLayoutComponent = /** @class */ (function () {
  3954. function BsCalendarLayoutComponent() {
  3955. }
  3956. BsCalendarLayoutComponent.decorators = [
  3957. { type: core.Component, args: [{
  3958. selector: 'bs-calendar-layout',
  3959. 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 "
  3960. }] }
  3961. ];
  3962. return BsCalendarLayoutComponent;
  3963. }());
  3964. /**
  3965. * @fileoverview added by tsickle
  3966. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3967. */
  3968. var BsCurrentDateViewComponent = /** @class */ (function () {
  3969. function BsCurrentDateViewComponent() {
  3970. }
  3971. BsCurrentDateViewComponent.decorators = [
  3972. { type: core.Component, args: [{
  3973. selector: 'bs-current-date',
  3974. template: "<div class=\"current-timedate\"><span>{{ title }}</span></div>"
  3975. }] }
  3976. ];
  3977. BsCurrentDateViewComponent.propDecorators = {
  3978. title: [{ type: core.Input }]
  3979. };
  3980. return BsCurrentDateViewComponent;
  3981. }());
  3982. /**
  3983. * @fileoverview added by tsickle
  3984. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3985. */
  3986. var BsCustomDatesViewComponent = /** @class */ (function () {
  3987. function BsCustomDatesViewComponent() {
  3988. }
  3989. BsCustomDatesViewComponent.decorators = [
  3990. { type: core.Component, args: [{
  3991. selector: 'bs-custom-date-view',
  3992. 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 ",
  3993. changeDetection: core.ChangeDetectionStrategy.OnPush
  3994. }] }
  3995. ];
  3996. BsCustomDatesViewComponent.propDecorators = {
  3997. isCustomRangeShown: [{ type: core.Input }],
  3998. ranges: [{ type: core.Input }]
  3999. };
  4000. return BsCustomDatesViewComponent;
  4001. }());
  4002. /**
  4003. * @fileoverview added by tsickle
  4004. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4005. */
  4006. var BsDatepickerDayDecoratorComponent = /** @class */ (function () {
  4007. function BsDatepickerDayDecoratorComponent(_config, _elRef, _renderer) {
  4008. this._config = _config;
  4009. this._elRef = _elRef;
  4010. this._renderer = _renderer;
  4011. }
  4012. /**
  4013. * @return {?}
  4014. */
  4015. BsDatepickerDayDecoratorComponent.prototype.ngOnInit = /**
  4016. * @return {?}
  4017. */
  4018. function () {
  4019. var _this = this;
  4020. if (this.day.isToday && this._config && this._config.customTodayClass) {
  4021. this._renderer.addClass(this._elRef.nativeElement, this._config.customTodayClass);
  4022. }
  4023. if (typeof this.day.customClasses === 'string') {
  4024. this.day.customClasses.split(' ')
  4025. .filter((/**
  4026. * @param {?} className
  4027. * @return {?}
  4028. */
  4029. function (className) { return className; }))
  4030. .forEach((/**
  4031. * @param {?} className
  4032. * @return {?}
  4033. */
  4034. function (className) {
  4035. _this._renderer.addClass(_this._elRef.nativeElement, className);
  4036. }));
  4037. }
  4038. };
  4039. BsDatepickerDayDecoratorComponent.decorators = [
  4040. { type: core.Component, args: [{
  4041. selector: '[bsDatepickerDayDecorator]',
  4042. changeDetection: core.ChangeDetectionStrategy.OnPush,
  4043. host: {
  4044. '[class.disabled]': 'day.isDisabled',
  4045. '[class.is-highlighted]': 'day.isHovered',
  4046. '[class.is-other-month]': 'day.isOtherMonth',
  4047. '[class.is-active-other-month]': 'day.isOtherMonthHovered',
  4048. '[class.in-range]': 'day.isInRange',
  4049. '[class.select-start]': 'day.isSelectionStart',
  4050. '[class.select-end]': 'day.isSelectionEnd',
  4051. '[class.selected]': 'day.isSelected'
  4052. },
  4053. template: "{{ day.label }}"
  4054. }] }
  4055. ];
  4056. /** @nocollapse */
  4057. BsDatepickerDayDecoratorComponent.ctorParameters = function () { return [
  4058. { type: BsDatepickerConfig },
  4059. { type: core.ElementRef },
  4060. { type: core.Renderer2 }
  4061. ]; };
  4062. BsDatepickerDayDecoratorComponent.propDecorators = {
  4063. day: [{ type: core.Input }]
  4064. };
  4065. return BsDatepickerDayDecoratorComponent;
  4066. }());
  4067. /**
  4068. * @fileoverview added by tsickle
  4069. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4070. */
  4071. /** @enum {number} */
  4072. var BsNavigationDirection = {
  4073. UP: 0,
  4074. DOWN: 1,
  4075. };
  4076. BsNavigationDirection[BsNavigationDirection.UP] = 'UP';
  4077. BsNavigationDirection[BsNavigationDirection.DOWN] = 'DOWN';
  4078. /**
  4079. * @fileoverview added by tsickle
  4080. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4081. */
  4082. var BsDatepickerNavigationViewComponent = /** @class */ (function () {
  4083. function BsDatepickerNavigationViewComponent() {
  4084. this.onNavigate = new core.EventEmitter();
  4085. this.onViewMode = new core.EventEmitter();
  4086. }
  4087. /**
  4088. * @param {?} down
  4089. * @return {?}
  4090. */
  4091. BsDatepickerNavigationViewComponent.prototype.navTo = /**
  4092. * @param {?} down
  4093. * @return {?}
  4094. */
  4095. function (down) {
  4096. this.onNavigate.emit(down ? BsNavigationDirection.DOWN : BsNavigationDirection.UP);
  4097. };
  4098. /**
  4099. * @param {?} viewMode
  4100. * @return {?}
  4101. */
  4102. BsDatepickerNavigationViewComponent.prototype.view = /**
  4103. * @param {?} viewMode
  4104. * @return {?}
  4105. */
  4106. function (viewMode) {
  4107. this.onViewMode.emit(viewMode);
  4108. };
  4109. BsDatepickerNavigationViewComponent.decorators = [
  4110. { type: core.Component, args: [{
  4111. selector: 'bs-datepicker-navigation-view',
  4112. changeDetection: core.ChangeDetectionStrategy.OnPush,
  4113. 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>&lsaquo;</span>\n </button>\n\n &#8203; <!-- 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 &#8203; <!-- 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 &#8203; <!-- 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>&rsaquo;</span>\n </button>\n "
  4114. }] }
  4115. ];
  4116. BsDatepickerNavigationViewComponent.propDecorators = {
  4117. calendar: [{ type: core.Input }],
  4118. onNavigate: [{ type: core.Output }],
  4119. onViewMode: [{ type: core.Output }]
  4120. };
  4121. return BsDatepickerNavigationViewComponent;
  4122. }());
  4123. /**
  4124. * @fileoverview added by tsickle
  4125. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4126. */
  4127. var BsDaysCalendarViewComponent = /** @class */ (function () {
  4128. function BsDaysCalendarViewComponent(_config) {
  4129. this._config = _config;
  4130. this.onNavigate = new core.EventEmitter();
  4131. this.onViewMode = new core.EventEmitter();
  4132. this.onSelect = new core.EventEmitter();
  4133. this.onHover = new core.EventEmitter();
  4134. this.onHoverWeek = new core.EventEmitter();
  4135. }
  4136. /**
  4137. * @param {?} event
  4138. * @return {?}
  4139. */
  4140. BsDaysCalendarViewComponent.prototype.navigateTo = /**
  4141. * @param {?} event
  4142. * @return {?}
  4143. */
  4144. function (event) {
  4145. /** @type {?} */
  4146. var step = BsNavigationDirection.DOWN === event ? -1 : 1;
  4147. this.onNavigate.emit({ step: { month: step } });
  4148. };
  4149. /**
  4150. * @param {?} event
  4151. * @return {?}
  4152. */
  4153. BsDaysCalendarViewComponent.prototype.changeViewMode = /**
  4154. * @param {?} event
  4155. * @return {?}
  4156. */
  4157. function (event) {
  4158. this.onViewMode.emit(event);
  4159. };
  4160. /**
  4161. * @param {?} event
  4162. * @return {?}
  4163. */
  4164. BsDaysCalendarViewComponent.prototype.selectDay = /**
  4165. * @param {?} event
  4166. * @return {?}
  4167. */
  4168. function (event) {
  4169. this.onSelect.emit(event);
  4170. };
  4171. /**
  4172. * @param {?} week
  4173. * @return {?}
  4174. */
  4175. BsDaysCalendarViewComponent.prototype.selectWeek = /**
  4176. * @param {?} week
  4177. * @return {?}
  4178. */
  4179. function (week) {
  4180. var _this = this;
  4181. if (!this._config.selectWeek) {
  4182. return;
  4183. }
  4184. if (week.days
  4185. && week.days[0]
  4186. && !week.days[0].isDisabled
  4187. && this._config.selectFromOtherMonth) {
  4188. this.onSelect.emit(week.days[0]);
  4189. return;
  4190. }
  4191. if (week.days.length === 0) {
  4192. return;
  4193. }
  4194. /** @type {?} */
  4195. var selectedDay = week.days.find((/**
  4196. * @param {?} day
  4197. * @return {?}
  4198. */
  4199. function (day) {
  4200. return _this._config.selectFromOtherMonth
  4201. ? !day.isDisabled
  4202. : !day.isOtherMonth && !day.isDisabled;
  4203. }));
  4204. this.onSelect.emit(selectedDay);
  4205. };
  4206. /**
  4207. * @param {?} cell
  4208. * @param {?} isHovered
  4209. * @return {?}
  4210. */
  4211. BsDaysCalendarViewComponent.prototype.weekHoverHandler = /**
  4212. * @param {?} cell
  4213. * @param {?} isHovered
  4214. * @return {?}
  4215. */
  4216. function (cell, isHovered) {
  4217. var _this = this;
  4218. if (!this._config.selectWeek) {
  4219. return;
  4220. }
  4221. /** @type {?} */
  4222. var hasActiveDays = cell.days.find((/**
  4223. * @param {?} day
  4224. * @return {?}
  4225. */
  4226. function (day) {
  4227. return _this._config.selectFromOtherMonth
  4228. ? !day.isDisabled
  4229. : !day.isOtherMonth && !day.isDisabled;
  4230. }));
  4231. if (hasActiveDays) {
  4232. cell.isHovered = isHovered;
  4233. this.isWeekHovered = isHovered;
  4234. this.onHoverWeek.emit(cell);
  4235. }
  4236. };
  4237. /**
  4238. * @param {?} cell
  4239. * @param {?} isHovered
  4240. * @return {?}
  4241. */
  4242. BsDaysCalendarViewComponent.prototype.hoverDay = /**
  4243. * @param {?} cell
  4244. * @param {?} isHovered
  4245. * @return {?}
  4246. */
  4247. function (cell, isHovered) {
  4248. if (this._config.selectFromOtherMonth && cell.isOtherMonth) {
  4249. cell.isOtherMonthHovered = isHovered;
  4250. }
  4251. this.onHover.emit({ cell: cell, isHovered: isHovered });
  4252. };
  4253. BsDaysCalendarViewComponent.decorators = [
  4254. { type: core.Component, args: [{
  4255. selector: 'bs-days-calendar-view',
  4256. // changeDetection: ChangeDetectionStrategy.OnPush,
  4257. 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 "
  4258. }] }
  4259. ];
  4260. /** @nocollapse */
  4261. BsDaysCalendarViewComponent.ctorParameters = function () { return [
  4262. { type: BsDatepickerConfig }
  4263. ]; };
  4264. BsDaysCalendarViewComponent.propDecorators = {
  4265. calendar: [{ type: core.Input }],
  4266. options: [{ type: core.Input }],
  4267. onNavigate: [{ type: core.Output }],
  4268. onViewMode: [{ type: core.Output }],
  4269. onSelect: [{ type: core.Output }],
  4270. onHover: [{ type: core.Output }],
  4271. onHoverWeek: [{ type: core.Output }]
  4272. };
  4273. return BsDaysCalendarViewComponent;
  4274. }());
  4275. /**
  4276. * @fileoverview added by tsickle
  4277. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4278. */
  4279. var BsMonthCalendarViewComponent = /** @class */ (function () {
  4280. function BsMonthCalendarViewComponent() {
  4281. this.onNavigate = new core.EventEmitter();
  4282. this.onViewMode = new core.EventEmitter();
  4283. this.onSelect = new core.EventEmitter();
  4284. this.onHover = new core.EventEmitter();
  4285. }
  4286. /**
  4287. * @param {?} event
  4288. * @return {?}
  4289. */
  4290. BsMonthCalendarViewComponent.prototype.navigateTo = /**
  4291. * @param {?} event
  4292. * @return {?}
  4293. */
  4294. function (event) {
  4295. /** @type {?} */
  4296. var step = BsNavigationDirection.DOWN === event ? -1 : 1;
  4297. this.onNavigate.emit({ step: { year: step } });
  4298. };
  4299. /**
  4300. * @param {?} month
  4301. * @return {?}
  4302. */
  4303. BsMonthCalendarViewComponent.prototype.viewMonth = /**
  4304. * @param {?} month
  4305. * @return {?}
  4306. */
  4307. function (month) {
  4308. this.onSelect.emit(month);
  4309. };
  4310. /**
  4311. * @param {?} cell
  4312. * @param {?} isHovered
  4313. * @return {?}
  4314. */
  4315. BsMonthCalendarViewComponent.prototype.hoverMonth = /**
  4316. * @param {?} cell
  4317. * @param {?} isHovered
  4318. * @return {?}
  4319. */
  4320. function (cell, isHovered) {
  4321. this.onHover.emit({ cell: cell, isHovered: isHovered });
  4322. };
  4323. /**
  4324. * @param {?} event
  4325. * @return {?}
  4326. */
  4327. BsMonthCalendarViewComponent.prototype.changeViewMode = /**
  4328. * @param {?} event
  4329. * @return {?}
  4330. */
  4331. function (event) {
  4332. this.onViewMode.emit(event);
  4333. };
  4334. BsMonthCalendarViewComponent.decorators = [
  4335. { type: core.Component, args: [{
  4336. selector: 'bs-month-calendar-view',
  4337. 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 "
  4338. }] }
  4339. ];
  4340. BsMonthCalendarViewComponent.propDecorators = {
  4341. calendar: [{ type: core.Input }],
  4342. onNavigate: [{ type: core.Output }],
  4343. onViewMode: [{ type: core.Output }],
  4344. onSelect: [{ type: core.Output }],
  4345. onHover: [{ type: core.Output }]
  4346. };
  4347. return BsMonthCalendarViewComponent;
  4348. }());
  4349. /**
  4350. * @fileoverview added by tsickle
  4351. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4352. */
  4353. var BsTimepickerViewComponent = /** @class */ (function () {
  4354. function BsTimepickerViewComponent() {
  4355. this.ampm = 'ok';
  4356. this.hours = 0;
  4357. this.minutes = 0;
  4358. }
  4359. BsTimepickerViewComponent.decorators = [
  4360. { type: core.Component, args: [{
  4361. selector: 'bs-timepicker',
  4362. 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 "
  4363. }] }
  4364. ];
  4365. return BsTimepickerViewComponent;
  4366. }());
  4367. /**
  4368. * @fileoverview added by tsickle
  4369. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4370. */
  4371. var BsYearsCalendarViewComponent = /** @class */ (function () {
  4372. function BsYearsCalendarViewComponent() {
  4373. this.onNavigate = new core.EventEmitter();
  4374. this.onViewMode = new core.EventEmitter();
  4375. this.onSelect = new core.EventEmitter();
  4376. this.onHover = new core.EventEmitter();
  4377. }
  4378. /**
  4379. * @param {?} event
  4380. * @return {?}
  4381. */
  4382. BsYearsCalendarViewComponent.prototype.navigateTo = /**
  4383. * @param {?} event
  4384. * @return {?}
  4385. */
  4386. function (event) {
  4387. /** @type {?} */
  4388. var step = BsNavigationDirection.DOWN === event ? -1 : 1;
  4389. this.onNavigate.emit({ step: { year: step * yearsPerCalendar } });
  4390. };
  4391. /**
  4392. * @param {?} year
  4393. * @return {?}
  4394. */
  4395. BsYearsCalendarViewComponent.prototype.viewYear = /**
  4396. * @param {?} year
  4397. * @return {?}
  4398. */
  4399. function (year) {
  4400. this.onSelect.emit(year);
  4401. };
  4402. /**
  4403. * @param {?} cell
  4404. * @param {?} isHovered
  4405. * @return {?}
  4406. */
  4407. BsYearsCalendarViewComponent.prototype.hoverYear = /**
  4408. * @param {?} cell
  4409. * @param {?} isHovered
  4410. * @return {?}
  4411. */
  4412. function (cell, isHovered) {
  4413. this.onHover.emit({ cell: cell, isHovered: isHovered });
  4414. };
  4415. /**
  4416. * @param {?} event
  4417. * @return {?}
  4418. */
  4419. BsYearsCalendarViewComponent.prototype.changeViewMode = /**
  4420. * @param {?} event
  4421. * @return {?}
  4422. */
  4423. function (event) {
  4424. this.onViewMode.emit(event);
  4425. };
  4426. BsYearsCalendarViewComponent.decorators = [
  4427. { type: core.Component, args: [{
  4428. selector: 'bs-years-calendar-view',
  4429. 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 "
  4430. }] }
  4431. ];
  4432. BsYearsCalendarViewComponent.propDecorators = {
  4433. calendar: [{ type: core.Input }],
  4434. onNavigate: [{ type: core.Output }],
  4435. onViewMode: [{ type: core.Output }],
  4436. onSelect: [{ type: core.Output }],
  4437. onHover: [{ type: core.Output }]
  4438. };
  4439. return BsYearsCalendarViewComponent;
  4440. }());
  4441. /**
  4442. * @fileoverview added by tsickle
  4443. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4444. */
  4445. /** @type {?} */
  4446. var _exports = [
  4447. BsDatepickerContainerComponent,
  4448. BsDatepickerDirective,
  4449. BsDatepickerInlineContainerComponent,
  4450. BsDatepickerInlineDirective,
  4451. BsDatepickerInputDirective,
  4452. BsDaterangepickerContainerComponent,
  4453. BsDaterangepickerDirective,
  4454. BsDaterangepickerInlineContainerComponent,
  4455. BsDaterangepickerInlineDirective,
  4456. BsDaterangepickerInputDirective
  4457. ];
  4458. var BsDatepickerModule = /** @class */ (function () {
  4459. function BsDatepickerModule() {
  4460. }
  4461. /**
  4462. * @return {?}
  4463. */
  4464. BsDatepickerModule.forRoot = /**
  4465. * @return {?}
  4466. */
  4467. function () {
  4468. return {
  4469. ngModule: BsDatepickerModule,
  4470. providers: [
  4471. componentLoader.ComponentLoaderFactory,
  4472. positioning.PositioningService,
  4473. BsDatepickerStore,
  4474. BsDatepickerActions,
  4475. BsDatepickerConfig,
  4476. BsDaterangepickerConfig,
  4477. BsDatepickerInlineConfig,
  4478. BsDaterangepickerInlineConfig,
  4479. BsDatepickerEffects,
  4480. BsLocaleService
  4481. ]
  4482. };
  4483. };
  4484. BsDatepickerModule.decorators = [
  4485. { type: core.NgModule, args: [{
  4486. imports: [common.CommonModule],
  4487. declarations: __spread([
  4488. BsCalendarLayoutComponent,
  4489. BsCurrentDateViewComponent,
  4490. BsCustomDatesViewComponent,
  4491. BsDatepickerDayDecoratorComponent,
  4492. BsDatepickerNavigationViewComponent,
  4493. BsDaysCalendarViewComponent,
  4494. BsMonthCalendarViewComponent,
  4495. BsTimepickerViewComponent,
  4496. BsYearsCalendarViewComponent
  4497. ], _exports),
  4498. entryComponents: [
  4499. BsDatepickerContainerComponent,
  4500. BsDaterangepickerContainerComponent,
  4501. BsDatepickerInlineContainerComponent,
  4502. BsDaterangepickerInlineContainerComponent
  4503. ],
  4504. exports: _exports
  4505. },] }
  4506. ];
  4507. return BsDatepickerModule;
  4508. }());
  4509. /**
  4510. * @fileoverview added by tsickle
  4511. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4512. */
  4513. var DateFormatter = /** @class */ (function () {
  4514. function DateFormatter() {
  4515. }
  4516. /**
  4517. * @param {?} date
  4518. * @param {?} format
  4519. * @param {?} locale
  4520. * @return {?}
  4521. */
  4522. DateFormatter.prototype.format = /**
  4523. * @param {?} date
  4524. * @param {?} format
  4525. * @param {?} locale
  4526. * @return {?}
  4527. */
  4528. function (date, format, locale) {
  4529. return chronos.formatDate(date, format, locale);
  4530. };
  4531. return DateFormatter;
  4532. }());
  4533. /**
  4534. * @fileoverview added by tsickle
  4535. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4536. */
  4537. var DatePickerInnerComponent = /** @class */ (function () {
  4538. function DatePickerInnerComponent() {
  4539. this.selectionDone = new core.EventEmitter(undefined);
  4540. this.update = new core.EventEmitter(false);
  4541. this.activeDateChange = new core.EventEmitter(undefined);
  4542. /* tslint:disable-next-line: no-any*/
  4543. this.stepDay = {};
  4544. /* tslint:disable-next-line: no-any*/
  4545. this.stepMonth = {};
  4546. /* tslint:disable-next-line: no-any*/
  4547. this.stepYear = {};
  4548. this.modes = ['day', 'month', 'year'];
  4549. this.dateFormatter = new DateFormatter();
  4550. }
  4551. Object.defineProperty(DatePickerInnerComponent.prototype, "activeDate", {
  4552. get: /**
  4553. * @return {?}
  4554. */
  4555. function () {
  4556. return this._activeDate;
  4557. },
  4558. set: /**
  4559. * @param {?} value
  4560. * @return {?}
  4561. */
  4562. function (value) {
  4563. this._activeDate = value;
  4564. },
  4565. enumerable: true,
  4566. configurable: true
  4567. });
  4568. // todo: add formatter value to Date object
  4569. // todo: add formatter value to Date object
  4570. /**
  4571. * @return {?}
  4572. */
  4573. DatePickerInnerComponent.prototype.ngOnInit =
  4574. // todo: add formatter value to Date object
  4575. /**
  4576. * @return {?}
  4577. */
  4578. function () {
  4579. // todo: use date for unique value
  4580. this.uniqueId = "datepicker--" + Math.floor(Math.random() * 10000);
  4581. if (this.initDate) {
  4582. this.activeDate = this.initDate;
  4583. this.selectedDate = new Date(this.activeDate.valueOf());
  4584. this.update.emit(this.activeDate);
  4585. }
  4586. else if (this.activeDate === undefined) {
  4587. this.activeDate = new Date();
  4588. }
  4589. };
  4590. // this.refreshView should be called here to reflect the changes on the fly
  4591. // tslint:disable-next-line:no-unused-variable
  4592. // this.refreshView should be called here to reflect the changes on the fly
  4593. // tslint:disable-next-line:no-unused-variable
  4594. /**
  4595. * @param {?} changes
  4596. * @return {?}
  4597. */
  4598. DatePickerInnerComponent.prototype.ngOnChanges =
  4599. // this.refreshView should be called here to reflect the changes on the fly
  4600. // tslint:disable-next-line:no-unused-variable
  4601. /**
  4602. * @param {?} changes
  4603. * @return {?}
  4604. */
  4605. function (changes) {
  4606. this.refreshView();
  4607. this.checkIfActiveDateGotUpdated(changes.activeDate);
  4608. };
  4609. // Check if activeDate has been update and then emit the activeDateChange with the new date
  4610. /* tslint:disable-next-line: no-any */
  4611. // Check if activeDate has been update and then emit the activeDateChange with the new date
  4612. /* tslint:disable-next-line: no-any */
  4613. /**
  4614. * @param {?} activeDate
  4615. * @return {?}
  4616. */
  4617. DatePickerInnerComponent.prototype.checkIfActiveDateGotUpdated =
  4618. // Check if activeDate has been update and then emit the activeDateChange with the new date
  4619. /* tslint:disable-next-line: no-any */
  4620. /**
  4621. * @param {?} activeDate
  4622. * @return {?}
  4623. */
  4624. function (activeDate) {
  4625. if (activeDate && !activeDate.firstChange) {
  4626. /** @type {?} */
  4627. var previousValue = activeDate.previousValue;
  4628. if (previousValue &&
  4629. previousValue instanceof Date &&
  4630. previousValue.getTime() !== activeDate.currentValue.getTime()) {
  4631. this.activeDateChange.emit(this.activeDate);
  4632. }
  4633. }
  4634. };
  4635. /**
  4636. * @param {?} handler
  4637. * @param {?} type
  4638. * @return {?}
  4639. */
  4640. DatePickerInnerComponent.prototype.setCompareHandler = /**
  4641. * @param {?} handler
  4642. * @param {?} type
  4643. * @return {?}
  4644. */
  4645. function (handler, type) {
  4646. if (type === 'day') {
  4647. this.compareHandlerDay = handler;
  4648. }
  4649. if (type === 'month') {
  4650. this.compareHandlerMonth = handler;
  4651. }
  4652. if (type === 'year') {
  4653. this.compareHandlerYear = handler;
  4654. }
  4655. };
  4656. /**
  4657. * @param {?} date1
  4658. * @param {?} date2
  4659. * @return {?}
  4660. */
  4661. DatePickerInnerComponent.prototype.compare = /**
  4662. * @param {?} date1
  4663. * @param {?} date2
  4664. * @return {?}
  4665. */
  4666. function (date1, date2) {
  4667. if (date1 === undefined || date2 === undefined) {
  4668. return undefined;
  4669. }
  4670. if (this.datepickerMode === 'day' && this.compareHandlerDay) {
  4671. return this.compareHandlerDay(date1, date2);
  4672. }
  4673. if (this.datepickerMode === 'month' && this.compareHandlerMonth) {
  4674. return this.compareHandlerMonth(date1, date2);
  4675. }
  4676. if (this.datepickerMode === 'year' && this.compareHandlerYear) {
  4677. return this.compareHandlerYear(date1, date2);
  4678. }
  4679. return void 0;
  4680. };
  4681. /**
  4682. * @param {?} handler
  4683. * @param {?} type
  4684. * @return {?}
  4685. */
  4686. DatePickerInnerComponent.prototype.setRefreshViewHandler = /**
  4687. * @param {?} handler
  4688. * @param {?} type
  4689. * @return {?}
  4690. */
  4691. function (handler, type) {
  4692. if (type === 'day') {
  4693. this.refreshViewHandlerDay = handler;
  4694. }
  4695. if (type === 'month') {
  4696. this.refreshViewHandlerMonth = handler;
  4697. }
  4698. if (type === 'year') {
  4699. this.refreshViewHandlerYear = handler;
  4700. }
  4701. };
  4702. /**
  4703. * @return {?}
  4704. */
  4705. DatePickerInnerComponent.prototype.refreshView = /**
  4706. * @return {?}
  4707. */
  4708. function () {
  4709. if (this.datepickerMode === 'day' && this.refreshViewHandlerDay) {
  4710. this.refreshViewHandlerDay();
  4711. }
  4712. if (this.datepickerMode === 'month' && this.refreshViewHandlerMonth) {
  4713. this.refreshViewHandlerMonth();
  4714. }
  4715. if (this.datepickerMode === 'year' && this.refreshViewHandlerYear) {
  4716. this.refreshViewHandlerYear();
  4717. }
  4718. };
  4719. /**
  4720. * @param {?} date
  4721. * @param {?} format
  4722. * @return {?}
  4723. */
  4724. DatePickerInnerComponent.prototype.dateFilter = /**
  4725. * @param {?} date
  4726. * @param {?} format
  4727. * @return {?}
  4728. */
  4729. function (date, format) {
  4730. return this.dateFormatter.format(date, format, this.locale);
  4731. };
  4732. /* tslint:disable-next-line: no-any*/
  4733. /* tslint:disable-next-line: no-any*/
  4734. /**
  4735. * @param {?} dateObject
  4736. * @return {?}
  4737. */
  4738. DatePickerInnerComponent.prototype.isActive = /* tslint:disable-next-line: no-any*/
  4739. /**
  4740. * @param {?} dateObject
  4741. * @return {?}
  4742. */
  4743. function (dateObject) {
  4744. if (this.compare(dateObject.date, this.activeDate) === 0) {
  4745. this.activeDateId = dateObject.uid;
  4746. return true;
  4747. }
  4748. return false;
  4749. };
  4750. /* tslint:disable-next-line: no-any*/
  4751. /* tslint:disable-next-line: no-any*/
  4752. /**
  4753. * @param {?} date
  4754. * @param {?} format
  4755. * @return {?}
  4756. */
  4757. DatePickerInnerComponent.prototype.createDateObject = /* tslint:disable-next-line: no-any*/
  4758. /**
  4759. * @param {?} date
  4760. * @param {?} format
  4761. * @return {?}
  4762. */
  4763. function (date, format) {
  4764. /* tslint:disable-next-line: no-any*/
  4765. /** @type {?} */
  4766. var dateObject = {};
  4767. dateObject.date = new Date(date.getFullYear(), date.getMonth(), date.getDate());
  4768. dateObject.date = this.fixTimeZone(dateObject.date);
  4769. dateObject.label = this.dateFilter(date, format);
  4770. dateObject.selected = this.compare(date, this.selectedDate) === 0;
  4771. dateObject.disabled = this.isDisabled(date);
  4772. dateObject.current = this.compare(date, new Date()) === 0;
  4773. dateObject.customClass = this.getCustomClassForDate(dateObject.date);
  4774. return dateObject;
  4775. };
  4776. /* tslint:disable-next-line: no-any*/
  4777. /* tslint:disable-next-line: no-any*/
  4778. /**
  4779. * @param {?} arr
  4780. * @param {?} size
  4781. * @return {?}
  4782. */
  4783. DatePickerInnerComponent.prototype.split = /* tslint:disable-next-line: no-any*/
  4784. /**
  4785. * @param {?} arr
  4786. * @param {?} size
  4787. * @return {?}
  4788. */
  4789. function (arr, size) {
  4790. /* tslint:disable-next-line: no-any*/
  4791. /** @type {?} */
  4792. var arrays = [];
  4793. while (arr.length > 0) {
  4794. arrays.push(arr.splice(0, size));
  4795. }
  4796. return arrays;
  4797. };
  4798. // Fix a hard-reproducible bug with timezones
  4799. // The bug depends on OS, browser, current timezone and current date
  4800. // i.e.
  4801. // var date = new Date(2014, 0, 1);
  4802. // console.log(date.getFullYear(), date.getMonth(), date.getDate(),
  4803. // date.getHours()); can result in "2013 11 31 23" because of the bug.
  4804. // Fix a hard-reproducible bug with timezones
  4805. // The bug depends on OS, browser, current timezone and current date
  4806. // i.e.
  4807. // var date = new Date(2014, 0, 1);
  4808. // console.log(date.getFullYear(), date.getMonth(), date.getDate(),
  4809. // date.getHours()); can result in "2013 11 31 23" because of the bug.
  4810. /**
  4811. * @param {?} date
  4812. * @return {?}
  4813. */
  4814. DatePickerInnerComponent.prototype.fixTimeZone =
  4815. // Fix a hard-reproducible bug with timezones
  4816. // The bug depends on OS, browser, current timezone and current date
  4817. // i.e.
  4818. // var date = new Date(2014, 0, 1);
  4819. // console.log(date.getFullYear(), date.getMonth(), date.getDate(),
  4820. // date.getHours()); can result in "2013 11 31 23" because of the bug.
  4821. /**
  4822. * @param {?} date
  4823. * @return {?}
  4824. */
  4825. function (date) {
  4826. /** @type {?} */
  4827. var hours = date.getHours();
  4828. return new Date(date.getFullYear(), date.getMonth(), date.getDate(), hours === 23 ? hours + 2 : 0);
  4829. };
  4830. /**
  4831. * @param {?} date
  4832. * @param {?=} isManual
  4833. * @return {?}
  4834. */
  4835. DatePickerInnerComponent.prototype.select = /**
  4836. * @param {?} date
  4837. * @param {?=} isManual
  4838. * @return {?}
  4839. */
  4840. function (date, isManual) {
  4841. if (isManual === void 0) { isManual = true; }
  4842. if (this.datepickerMode === this.minMode) {
  4843. if (!this.activeDate) {
  4844. this.activeDate = new Date(0, 0, 0, 0, 0, 0, 0);
  4845. }
  4846. this.activeDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
  4847. this.activeDate = this.fixTimeZone(this.activeDate);
  4848. if (isManual) {
  4849. this.selectionDone.emit(this.activeDate);
  4850. }
  4851. }
  4852. else {
  4853. this.activeDate = new Date(date.getFullYear(), date.getMonth(), date.getDate());
  4854. this.activeDate = this.fixTimeZone(this.activeDate);
  4855. if (isManual) {
  4856. this.datepickerMode = this.modes[this.modes.indexOf(this.datepickerMode) - 1];
  4857. }
  4858. }
  4859. this.selectedDate = new Date(this.activeDate.valueOf());
  4860. this.update.emit(this.activeDate);
  4861. this.refreshView();
  4862. };
  4863. /**
  4864. * @param {?} direction
  4865. * @return {?}
  4866. */
  4867. DatePickerInnerComponent.prototype.move = /**
  4868. * @param {?} direction
  4869. * @return {?}
  4870. */
  4871. function (direction) {
  4872. /* tslint:disable-next-line: no-any*/
  4873. /** @type {?} */
  4874. var expectedStep;
  4875. if (this.datepickerMode === 'day') {
  4876. expectedStep = this.stepDay;
  4877. }
  4878. if (this.datepickerMode === 'month') {
  4879. expectedStep = this.stepMonth;
  4880. }
  4881. if (this.datepickerMode === 'year') {
  4882. expectedStep = this.stepYear;
  4883. }
  4884. if (expectedStep) {
  4885. /** @type {?} */
  4886. var year = this.activeDate.getFullYear() + direction * (expectedStep.years || 0);
  4887. /** @type {?} */
  4888. var month = this.activeDate.getMonth() + direction * (expectedStep.months || 0);
  4889. this.activeDate = new Date(year, month, 1);
  4890. this.refreshView();
  4891. this.activeDateChange.emit(this.activeDate);
  4892. }
  4893. };
  4894. /**
  4895. * @param {?} _direction
  4896. * @return {?}
  4897. */
  4898. DatePickerInnerComponent.prototype.toggleMode = /**
  4899. * @param {?} _direction
  4900. * @return {?}
  4901. */
  4902. function (_direction) {
  4903. /** @type {?} */
  4904. var direction = _direction || 1;
  4905. if ((this.datepickerMode === this.maxMode && direction === 1) ||
  4906. (this.datepickerMode === this.minMode && direction === -1)) {
  4907. return;
  4908. }
  4909. this.datepickerMode = this.modes[this.modes.indexOf(this.datepickerMode) + direction];
  4910. this.refreshView();
  4911. };
  4912. /**
  4913. * @protected
  4914. * @param {?} date
  4915. * @return {?}
  4916. */
  4917. DatePickerInnerComponent.prototype.getCustomClassForDate = /**
  4918. * @protected
  4919. * @param {?} date
  4920. * @return {?}
  4921. */
  4922. function (date) {
  4923. var _this = this;
  4924. if (!this.customClass) {
  4925. return '';
  4926. }
  4927. // todo: build a hash of custom classes, it will work faster
  4928. /** @type {?} */
  4929. var customClassObject = this.customClass.find((/**
  4930. * @param {?} customClass
  4931. * @return {?}
  4932. */
  4933. function (customClass) {
  4934. return (customClass.date.valueOf() === date.valueOf() &&
  4935. customClass.mode === _this.datepickerMode);
  4936. }), this);
  4937. return customClassObject === undefined ? '' : customClassObject.clazz;
  4938. };
  4939. /**
  4940. * @protected
  4941. * @param {?} date1Disabled
  4942. * @param {?} date2
  4943. * @return {?}
  4944. */
  4945. DatePickerInnerComponent.prototype.compareDateDisabled = /**
  4946. * @protected
  4947. * @param {?} date1Disabled
  4948. * @param {?} date2
  4949. * @return {?}
  4950. */
  4951. function (date1Disabled, date2) {
  4952. if (date1Disabled === undefined || date2 === undefined) {
  4953. return undefined;
  4954. }
  4955. if (date1Disabled.mode === 'day' && this.compareHandlerDay) {
  4956. return this.compareHandlerDay(date1Disabled.date, date2);
  4957. }
  4958. if (date1Disabled.mode === 'month' && this.compareHandlerMonth) {
  4959. return this.compareHandlerMonth(date1Disabled.date, date2);
  4960. }
  4961. if (date1Disabled.mode === 'year' && this.compareHandlerYear) {
  4962. return this.compareHandlerYear(date1Disabled.date, date2);
  4963. }
  4964. return undefined;
  4965. };
  4966. /**
  4967. * @protected
  4968. * @param {?} date
  4969. * @return {?}
  4970. */
  4971. DatePickerInnerComponent.prototype.isDisabled = /**
  4972. * @protected
  4973. * @param {?} date
  4974. * @return {?}
  4975. */
  4976. function (date) {
  4977. var _this = this;
  4978. /** @type {?} */
  4979. var isDateDisabled = false;
  4980. if (this.dateDisabled) {
  4981. this.dateDisabled.forEach((/**
  4982. * @param {?} disabledDate
  4983. * @return {?}
  4984. */
  4985. function (disabledDate) {
  4986. if (_this.compareDateDisabled(disabledDate, date) === 0) {
  4987. isDateDisabled = true;
  4988. }
  4989. }));
  4990. }
  4991. if (this.dayDisabled) {
  4992. isDateDisabled =
  4993. isDateDisabled ||
  4994. this.dayDisabled.indexOf(date.getDay()) > -1;
  4995. }
  4996. return (isDateDisabled ||
  4997. (this.minDate && this.compare(date, this.minDate) < 0) ||
  4998. (this.maxDate && this.compare(date, this.maxDate) > 0));
  4999. };
  5000. DatePickerInnerComponent.decorators = [
  5001. { type: core.Component, args: [{
  5002. selector: 'datepicker-inner',
  5003. template: "\n <!--&lt;!&ndash;ng-keydown=\"keydown($event)\"&ndash;&gt;-->\n <div *ngIf=\"datepickerMode\" class=\"well well-sm bg-faded p-a card\" role=\"application\" >\n <ng-content></ng-content>\n </div>\n "
  5004. }] }
  5005. ];
  5006. DatePickerInnerComponent.propDecorators = {
  5007. locale: [{ type: core.Input }],
  5008. datepickerMode: [{ type: core.Input }],
  5009. startingDay: [{ type: core.Input }],
  5010. yearRange: [{ type: core.Input }],
  5011. minDate: [{ type: core.Input }],
  5012. maxDate: [{ type: core.Input }],
  5013. minMode: [{ type: core.Input }],
  5014. maxMode: [{ type: core.Input }],
  5015. showWeeks: [{ type: core.Input }],
  5016. formatDay: [{ type: core.Input }],
  5017. formatMonth: [{ type: core.Input }],
  5018. formatYear: [{ type: core.Input }],
  5019. formatDayHeader: [{ type: core.Input }],
  5020. formatDayTitle: [{ type: core.Input }],
  5021. formatMonthTitle: [{ type: core.Input }],
  5022. onlyCurrentMonth: [{ type: core.Input }],
  5023. shortcutPropagation: [{ type: core.Input }],
  5024. customClass: [{ type: core.Input }],
  5025. monthColLimit: [{ type: core.Input }],
  5026. yearColLimit: [{ type: core.Input }],
  5027. dateDisabled: [{ type: core.Input }],
  5028. dayDisabled: [{ type: core.Input }],
  5029. initDate: [{ type: core.Input }],
  5030. selectionDone: [{ type: core.Output }],
  5031. update: [{ type: core.Output }],
  5032. activeDateChange: [{ type: core.Output }],
  5033. activeDate: [{ type: core.Input }]
  5034. };
  5035. return DatePickerInnerComponent;
  5036. }());
  5037. /**
  5038. * @fileoverview added by tsickle
  5039. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5040. */
  5041. var DatepickerConfig = /** @class */ (function () {
  5042. function DatepickerConfig() {
  5043. this.locale = 'en';
  5044. this.datepickerMode = 'day';
  5045. this.startingDay = 0;
  5046. this.yearRange = 20;
  5047. this.minMode = 'day';
  5048. this.maxMode = 'year';
  5049. this.showWeeks = true;
  5050. this.formatDay = 'DD';
  5051. this.formatMonth = 'MMMM';
  5052. this.formatYear = 'YYYY';
  5053. this.formatDayHeader = 'dd';
  5054. this.formatDayTitle = 'MMMM YYYY';
  5055. this.formatMonthTitle = 'YYYY';
  5056. this.onlyCurrentMonth = false;
  5057. this.monthColLimit = 3;
  5058. this.yearColLimit = 5;
  5059. this.shortcutPropagation = false;
  5060. }
  5061. DatepickerConfig.decorators = [
  5062. { type: core.Injectable }
  5063. ];
  5064. return DatepickerConfig;
  5065. }());
  5066. /**
  5067. * @fileoverview added by tsickle
  5068. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5069. */
  5070. /** @type {?} */
  5071. var DATEPICKER_CONTROL_VALUE_ACCESSOR = {
  5072. provide: forms.NG_VALUE_ACCESSOR,
  5073. /* tslint:disable-next-line: no-use-before-declare */
  5074. useExisting: core.forwardRef((/**
  5075. * @return {?}
  5076. */
  5077. function () { return DatePickerComponent; })),
  5078. multi: true
  5079. };
  5080. /* tslint:disable:component-selector-name component-selector-type */
  5081. var DatePickerComponent = /** @class */ (function () {
  5082. function DatePickerComponent(config) {
  5083. /**
  5084. * sets datepicker mode, supports: `day`, `month`, `year`
  5085. */
  5086. this.datepickerMode = 'day';
  5087. /**
  5088. * if false week numbers will be hidden
  5089. */
  5090. this.showWeeks = true;
  5091. this.selectionDone = new core.EventEmitter(undefined);
  5092. /**
  5093. * callback to invoke when the activeDate is changed.
  5094. */
  5095. this.activeDateChange = new core.EventEmitter(undefined);
  5096. /* tslint:disable-next-line: no-any*/
  5097. this.onChange = Function.prototype;
  5098. /* tslint:disable-next-line: no-any*/
  5099. this.onTouched = Function.prototype;
  5100. this._now = new Date();
  5101. this.config = config;
  5102. this.configureOptions();
  5103. }
  5104. Object.defineProperty(DatePickerComponent.prototype, "activeDate", {
  5105. /** currently active date */
  5106. get: /**
  5107. * currently active date
  5108. * @return {?}
  5109. */
  5110. function () {
  5111. return this._activeDate || this._now;
  5112. },
  5113. set: /**
  5114. * @param {?} value
  5115. * @return {?}
  5116. */
  5117. function (value) {
  5118. this._activeDate = value;
  5119. },
  5120. enumerable: true,
  5121. configurable: true
  5122. });
  5123. /**
  5124. * @return {?}
  5125. */
  5126. DatePickerComponent.prototype.configureOptions = /**
  5127. * @return {?}
  5128. */
  5129. function () {
  5130. Object.assign(this, this.config);
  5131. };
  5132. /**
  5133. * @param {?} event
  5134. * @return {?}
  5135. */
  5136. DatePickerComponent.prototype.onUpdate = /**
  5137. * @param {?} event
  5138. * @return {?}
  5139. */
  5140. function (event) {
  5141. this.activeDate = event;
  5142. this.onChange(event);
  5143. };
  5144. /**
  5145. * @param {?} event
  5146. * @return {?}
  5147. */
  5148. DatePickerComponent.prototype.onSelectionDone = /**
  5149. * @param {?} event
  5150. * @return {?}
  5151. */
  5152. function (event) {
  5153. this.selectionDone.emit(event);
  5154. };
  5155. /**
  5156. * @param {?} event
  5157. * @return {?}
  5158. */
  5159. DatePickerComponent.prototype.onActiveDateChange = /**
  5160. * @param {?} event
  5161. * @return {?}
  5162. */
  5163. function (event) {
  5164. this.activeDateChange.emit(event);
  5165. };
  5166. // todo: support null value
  5167. /* tslint:disable-next-line: no-any*/
  5168. // todo: support null value
  5169. /* tslint:disable-next-line: no-any*/
  5170. /**
  5171. * @param {?} value
  5172. * @return {?}
  5173. */
  5174. DatePickerComponent.prototype.writeValue =
  5175. // todo: support null value
  5176. /* tslint:disable-next-line: no-any*/
  5177. /**
  5178. * @param {?} value
  5179. * @return {?}
  5180. */
  5181. function (value) {
  5182. if (this._datePicker.compare(value, this._activeDate) === 0) {
  5183. return;
  5184. }
  5185. if (value && value instanceof Date) {
  5186. this.activeDate = value;
  5187. this._datePicker.select(value, false);
  5188. return;
  5189. }
  5190. this.activeDate = value ? new Date(value) : void 0;
  5191. };
  5192. /**
  5193. * @param {?} fn
  5194. * @return {?}
  5195. */
  5196. DatePickerComponent.prototype.registerOnChange = /**
  5197. * @param {?} fn
  5198. * @return {?}
  5199. */
  5200. function (fn) {
  5201. this.onChange = fn;
  5202. };
  5203. /**
  5204. * @param {?} fn
  5205. * @return {?}
  5206. */
  5207. DatePickerComponent.prototype.registerOnTouched = /**
  5208. * @param {?} fn
  5209. * @return {?}
  5210. */
  5211. function (fn) {
  5212. this.onTouched = fn;
  5213. };
  5214. DatePickerComponent.decorators = [
  5215. { type: core.Component, args: [{
  5216. selector: 'datepicker',
  5217. 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 ",
  5218. providers: [DATEPICKER_CONTROL_VALUE_ACCESSOR]
  5219. }] }
  5220. ];
  5221. /** @nocollapse */
  5222. DatePickerComponent.ctorParameters = function () { return [
  5223. { type: DatepickerConfig }
  5224. ]; };
  5225. DatePickerComponent.propDecorators = {
  5226. datepickerMode: [{ type: core.Input }],
  5227. initDate: [{ type: core.Input }],
  5228. minDate: [{ type: core.Input }],
  5229. maxDate: [{ type: core.Input }],
  5230. minMode: [{ type: core.Input }],
  5231. maxMode: [{ type: core.Input }],
  5232. showWeeks: [{ type: core.Input }],
  5233. formatDay: [{ type: core.Input }],
  5234. formatMonth: [{ type: core.Input }],
  5235. formatYear: [{ type: core.Input }],
  5236. formatDayHeader: [{ type: core.Input }],
  5237. formatDayTitle: [{ type: core.Input }],
  5238. formatMonthTitle: [{ type: core.Input }],
  5239. startingDay: [{ type: core.Input }],
  5240. yearRange: [{ type: core.Input }],
  5241. onlyCurrentMonth: [{ type: core.Input }],
  5242. shortcutPropagation: [{ type: core.Input }],
  5243. monthColLimit: [{ type: core.Input }],
  5244. yearColLimit: [{ type: core.Input }],
  5245. customClass: [{ type: core.Input }],
  5246. dateDisabled: [{ type: core.Input }],
  5247. dayDisabled: [{ type: core.Input }],
  5248. activeDate: [{ type: core.Input }],
  5249. selectionDone: [{ type: core.Output }],
  5250. activeDateChange: [{ type: core.Output }],
  5251. _datePicker: [{ type: core.ViewChild, args: [DatePickerInnerComponent, { static: true },] }]
  5252. };
  5253. return DatePickerComponent;
  5254. }());
  5255. /**
  5256. * @fileoverview added by tsickle
  5257. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5258. */
  5259. var DayPickerComponent = /** @class */ (function () {
  5260. function DayPickerComponent(datePicker) {
  5261. this.labels = [];
  5262. this.rows = [];
  5263. this.weekNumbers = [];
  5264. this.datePicker = datePicker;
  5265. }
  5266. Object.defineProperty(DayPickerComponent.prototype, "isBs4", {
  5267. get: /**
  5268. * @return {?}
  5269. */
  5270. function () {
  5271. return !utils.isBs3();
  5272. },
  5273. enumerable: true,
  5274. configurable: true
  5275. });
  5276. /*protected getDaysInMonth(year:number, month:number) {
  5277. return ((month === 1) && (year % 4 === 0) &&
  5278. ((year % 100 !== 0) || (year % 400 === 0))) ? 29 : DAYS_IN_MONTH[month];
  5279. }*/
  5280. /*protected getDaysInMonth(year:number, month:number) {
  5281. return ((month === 1) && (year % 4 === 0) &&
  5282. ((year % 100 !== 0) || (year % 400 === 0))) ? 29 : DAYS_IN_MONTH[month];
  5283. }*/
  5284. /**
  5285. * @return {?}
  5286. */
  5287. DayPickerComponent.prototype.ngOnInit = /*protected getDaysInMonth(year:number, month:number) {
  5288. return ((month === 1) && (year % 4 === 0) &&
  5289. ((year % 100 !== 0) || (year % 400 === 0))) ? 29 : DAYS_IN_MONTH[month];
  5290. }*/
  5291. /**
  5292. * @return {?}
  5293. */
  5294. function () {
  5295. /** @type {?} */
  5296. var self = this;
  5297. this.datePicker.stepDay = { months: 1 };
  5298. this.datePicker.setRefreshViewHandler((/**
  5299. * @return {?}
  5300. */
  5301. function () {
  5302. /** @type {?} */
  5303. var year = this.activeDate.getFullYear();
  5304. /** @type {?} */
  5305. var month = this.activeDate.getMonth();
  5306. /** @type {?} */
  5307. var firstDayOfMonth = new Date(year, month, 1);
  5308. /** @type {?} */
  5309. var difference = this.startingDay - firstDayOfMonth.getDay();
  5310. /** @type {?} */
  5311. var numDisplayedFromPreviousMonth = difference > 0 ? 7 - difference : -difference;
  5312. /** @type {?} */
  5313. var firstDate = new Date(firstDayOfMonth.getTime());
  5314. if (numDisplayedFromPreviousMonth > 0) {
  5315. firstDate.setDate(-numDisplayedFromPreviousMonth + 1);
  5316. }
  5317. // 42 is the number of days on a six-week calendar
  5318. /** @type {?} */
  5319. var _days = self.getDates(firstDate, 42);
  5320. /** @type {?} */
  5321. var days = [];
  5322. for (var i = 0; i < 42; i++) {
  5323. /** @type {?} */
  5324. var _dateObject = this.createDateObject(_days[i], this.formatDay);
  5325. _dateObject.secondary = _days[i].getMonth() !== month;
  5326. _dateObject.uid = this.uniqueId + '-' + i;
  5327. days[i] = _dateObject;
  5328. }
  5329. self.labels = [];
  5330. for (var j = 0; j < 7; j++) {
  5331. self.labels[j] = {};
  5332. self.labels[j].abbr = this.dateFilter(days[j].date, this.formatDayHeader);
  5333. self.labels[j].full = this.dateFilter(days[j].date, 'EEEE');
  5334. }
  5335. self.title = this.dateFilter(this.activeDate, this.formatDayTitle);
  5336. self.rows = this.split(days, 7);
  5337. if (this.showWeeks) {
  5338. self.weekNumbers = [];
  5339. /** @type {?} */
  5340. var thursdayIndex = (4 + 7 - this.startingDay) % 7;
  5341. /** @type {?} */
  5342. var numWeeks = self.rows.length;
  5343. for (var curWeek = 0; curWeek < numWeeks; curWeek++) {
  5344. self.weekNumbers.push(self.getISO8601WeekNumber(self.rows[curWeek][thursdayIndex].date));
  5345. }
  5346. }
  5347. }), 'day');
  5348. this.datePicker.setCompareHandler((/**
  5349. * @param {?} date1
  5350. * @param {?} date2
  5351. * @return {?}
  5352. */
  5353. function (date1, date2) {
  5354. /** @type {?} */
  5355. var d1 = new Date(date1.getFullYear(), date1.getMonth(), date1.getDate());
  5356. /** @type {?} */
  5357. var d2 = new Date(date2.getFullYear(), date2.getMonth(), date2.getDate());
  5358. return d1.getTime() - d2.getTime();
  5359. }), 'day');
  5360. this.datePicker.refreshView();
  5361. };
  5362. /**
  5363. * @protected
  5364. * @param {?} startDate
  5365. * @param {?} n
  5366. * @return {?}
  5367. */
  5368. DayPickerComponent.prototype.getDates = /**
  5369. * @protected
  5370. * @param {?} startDate
  5371. * @param {?} n
  5372. * @return {?}
  5373. */
  5374. function (startDate, n) {
  5375. /** @type {?} */
  5376. var dates = new Array(n);
  5377. /** @type {?} */
  5378. var current = new Date(startDate.getTime());
  5379. /** @type {?} */
  5380. var i = 0;
  5381. /** @type {?} */
  5382. var date;
  5383. while (i < n) {
  5384. date = new Date(current.getTime());
  5385. date = this.datePicker.fixTimeZone(date);
  5386. dates[i++] = date;
  5387. current = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1);
  5388. }
  5389. return dates;
  5390. };
  5391. /**
  5392. * @protected
  5393. * @param {?} date
  5394. * @return {?}
  5395. */
  5396. DayPickerComponent.prototype.getISO8601WeekNumber = /**
  5397. * @protected
  5398. * @param {?} date
  5399. * @return {?}
  5400. */
  5401. function (date) {
  5402. /** @type {?} */
  5403. var checkDate = new Date(date.getTime());
  5404. // Thursday
  5405. checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
  5406. /** @type {?} */
  5407. var time = checkDate.getTime();
  5408. // Compare with Jan 1
  5409. checkDate.setMonth(0);
  5410. checkDate.setDate(1);
  5411. return (Math.floor(Math.round((time - checkDate.getTime()) / 86400000) / 7) + 1);
  5412. };
  5413. DayPickerComponent.decorators = [
  5414. { type: core.Component, args: [{
  5415. selector: 'daypicker',
  5416. 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\">&lt;</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\">&gt;\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 ",
  5417. 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 "]
  5418. }] }
  5419. ];
  5420. /** @nocollapse */
  5421. DayPickerComponent.ctorParameters = function () { return [
  5422. { type: DatePickerInnerComponent }
  5423. ]; };
  5424. return DayPickerComponent;
  5425. }());
  5426. /**
  5427. * @fileoverview added by tsickle
  5428. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5429. */
  5430. var MonthPickerComponent = /** @class */ (function () {
  5431. function MonthPickerComponent(datePicker) {
  5432. this.rows = [];
  5433. this.datePicker = datePicker;
  5434. }
  5435. Object.defineProperty(MonthPickerComponent.prototype, "isBs4", {
  5436. get: /**
  5437. * @return {?}
  5438. */
  5439. function () {
  5440. return !utils.isBs3();
  5441. },
  5442. enumerable: true,
  5443. configurable: true
  5444. });
  5445. /**
  5446. * @return {?}
  5447. */
  5448. MonthPickerComponent.prototype.ngOnInit = /**
  5449. * @return {?}
  5450. */
  5451. function () {
  5452. /** @type {?} */
  5453. var self = this;
  5454. this.datePicker.stepMonth = { years: 1 };
  5455. this.datePicker.setRefreshViewHandler((/**
  5456. * @return {?}
  5457. */
  5458. function () {
  5459. /** @type {?} */
  5460. var months = new Array(12);
  5461. /** @type {?} */
  5462. var year = this.activeDate.getFullYear();
  5463. /** @type {?} */
  5464. var date;
  5465. for (var i = 0; i < 12; i++) {
  5466. date = new Date(year, i, 1);
  5467. date = this.fixTimeZone(date);
  5468. months[i] = this.createDateObject(date, this.formatMonth);
  5469. months[i].uid = this.uniqueId + '-' + i;
  5470. }
  5471. self.title = this.dateFilter(this.activeDate, this.formatMonthTitle);
  5472. self.rows = this.split(months, self.datePicker.monthColLimit);
  5473. }), 'month');
  5474. this.datePicker.setCompareHandler((/**
  5475. * @param {?} date1
  5476. * @param {?} date2
  5477. * @return {?}
  5478. */
  5479. function (date1, date2) {
  5480. /** @type {?} */
  5481. var d1 = new Date(date1.getFullYear(), date1.getMonth());
  5482. /** @type {?} */
  5483. var d2 = new Date(date2.getFullYear(), date2.getMonth());
  5484. return d1.getTime() - d2.getTime();
  5485. }), 'month');
  5486. this.datePicker.refreshView();
  5487. };
  5488. MonthPickerComponent.decorators = [
  5489. { type: core.Component, args: [{
  5490. selector: 'monthpicker',
  5491. 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 ",
  5492. styles: ["\n :host .btn-info .text-success {\n color: #fff !important;\n }\n "]
  5493. }] }
  5494. ];
  5495. /** @nocollapse */
  5496. MonthPickerComponent.ctorParameters = function () { return [
  5497. { type: DatePickerInnerComponent }
  5498. ]; };
  5499. return MonthPickerComponent;
  5500. }());
  5501. /**
  5502. * @fileoverview added by tsickle
  5503. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5504. */
  5505. var YearPickerComponent = /** @class */ (function () {
  5506. function YearPickerComponent(datePicker) {
  5507. this.rows = [];
  5508. this.datePicker = datePicker;
  5509. }
  5510. Object.defineProperty(YearPickerComponent.prototype, "isBs4", {
  5511. get: /**
  5512. * @return {?}
  5513. */
  5514. function () {
  5515. return !utils.isBs3();
  5516. },
  5517. enumerable: true,
  5518. configurable: true
  5519. });
  5520. /**
  5521. * @return {?}
  5522. */
  5523. YearPickerComponent.prototype.ngOnInit = /**
  5524. * @return {?}
  5525. */
  5526. function () {
  5527. /** @type {?} */
  5528. var self = this;
  5529. this.datePicker.stepYear = { years: this.datePicker.yearRange };
  5530. this.datePicker.setRefreshViewHandler((/**
  5531. * @return {?}
  5532. */
  5533. function () {
  5534. /** @type {?} */
  5535. var years = new Array(this.yearRange);
  5536. /** @type {?} */
  5537. var date;
  5538. /** @type {?} */
  5539. var start = self.getStartingYear(this.activeDate.getFullYear());
  5540. for (var i = 0; i < this.yearRange; i++) {
  5541. date = new Date(start + i, 0, 1);
  5542. date = this.fixTimeZone(date);
  5543. years[i] = this.createDateObject(date, this.formatYear);
  5544. years[i].uid = this.uniqueId + '-' + i;
  5545. }
  5546. self.title = [years[0].label, years[this.yearRange - 1].label].join(' - ');
  5547. self.rows = this.split(years, self.datePicker.yearColLimit);
  5548. }), 'year');
  5549. this.datePicker.setCompareHandler((/**
  5550. * @param {?} date1
  5551. * @param {?} date2
  5552. * @return {?}
  5553. */
  5554. function (date1, date2) {
  5555. return date1.getFullYear() - date2.getFullYear();
  5556. }), 'year');
  5557. this.datePicker.refreshView();
  5558. };
  5559. /**
  5560. * @protected
  5561. * @param {?} year
  5562. * @return {?}
  5563. */
  5564. YearPickerComponent.prototype.getStartingYear = /**
  5565. * @protected
  5566. * @param {?} year
  5567. * @return {?}
  5568. */
  5569. function (year) {
  5570. // todo: parseInt
  5571. return ((year - 1) / this.datePicker.yearRange * this.datePicker.yearRange + 1);
  5572. };
  5573. YearPickerComponent.decorators = [
  5574. { type: core.Component, args: [{
  5575. selector: 'yearpicker',
  5576. 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 ",
  5577. styles: ["\n :host .btn-info .text-success {\n color: #fff !important;\n }\n "]
  5578. }] }
  5579. ];
  5580. /** @nocollapse */
  5581. YearPickerComponent.ctorParameters = function () { return [
  5582. { type: DatePickerInnerComponent }
  5583. ]; };
  5584. return YearPickerComponent;
  5585. }());
  5586. /**
  5587. * @fileoverview added by tsickle
  5588. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5589. */
  5590. var DatepickerModule = /** @class */ (function () {
  5591. function DatepickerModule() {
  5592. }
  5593. /**
  5594. * @return {?}
  5595. */
  5596. DatepickerModule.forRoot = /**
  5597. * @return {?}
  5598. */
  5599. function () {
  5600. return { ngModule: DatepickerModule, providers: [DatepickerConfig] };
  5601. };
  5602. DatepickerModule.decorators = [
  5603. { type: core.NgModule, args: [{
  5604. imports: [common.CommonModule, forms.FormsModule],
  5605. declarations: [
  5606. DatePickerComponent,
  5607. DatePickerInnerComponent,
  5608. DayPickerComponent,
  5609. MonthPickerComponent,
  5610. YearPickerComponent
  5611. ],
  5612. exports: [
  5613. DatePickerComponent,
  5614. DatePickerInnerComponent,
  5615. DayPickerComponent,
  5616. MonthPickerComponent,
  5617. YearPickerComponent
  5618. ],
  5619. entryComponents: [DatePickerComponent]
  5620. },] }
  5621. ];
  5622. return DatepickerModule;
  5623. }());
  5624. exports.BsDatepickerConfig = BsDatepickerConfig;
  5625. exports.BsDatepickerContainerComponent = BsDatepickerContainerComponent;
  5626. exports.BsDatepickerDirective = BsDatepickerDirective;
  5627. exports.BsDatepickerInlineConfig = BsDatepickerInlineConfig;
  5628. exports.BsDatepickerInlineContainerComponent = BsDatepickerInlineContainerComponent;
  5629. exports.BsDatepickerInlineDirective = BsDatepickerInlineDirective;
  5630. exports.BsDatepickerInputDirective = BsDatepickerInputDirective;
  5631. exports.BsDatepickerModule = BsDatepickerModule;
  5632. exports.BsDaterangepickerConfig = BsDaterangepickerConfig;
  5633. exports.BsDaterangepickerContainerComponent = BsDaterangepickerContainerComponent;
  5634. exports.BsDaterangepickerDirective = BsDaterangepickerDirective;
  5635. exports.BsDaterangepickerInlineConfig = BsDaterangepickerInlineConfig;
  5636. exports.BsDaterangepickerInlineContainerComponent = BsDaterangepickerInlineContainerComponent;
  5637. exports.BsDaterangepickerInlineDirective = BsDaterangepickerInlineDirective;
  5638. exports.BsDaterangepickerInputDirective = BsDaterangepickerInputDirective;
  5639. exports.BsLocaleService = BsLocaleService;
  5640. exports.DateFormatter = DateFormatter;
  5641. exports.DatePickerComponent = DatePickerComponent;
  5642. exports.DatePickerInnerComponent = DatePickerInnerComponent;
  5643. exports.DatepickerConfig = DatepickerConfig;
  5644. exports.DatepickerModule = DatepickerModule;
  5645. exports.DayPickerComponent = DayPickerComponent;
  5646. exports.MonthPickerComponent = MonthPickerComponent;
  5647. exports.YearPickerComponent = YearPickerComponent;
  5648. exports.ɵa = DATEPICKER_CONTROL_VALUE_ACCESSOR;
  5649. exports.ɵb = BsDatepickerAbstractComponent;
  5650. exports.ɵc = BsDatepickerStore;
  5651. exports.ɵd = BsDatepickerEffects;
  5652. exports.ɵe = BsDatepickerActions;
  5653. exports.ɵf = datepickerAnimation;
  5654. exports.ɵg = BsCalendarLayoutComponent;
  5655. exports.ɵh = BsCurrentDateViewComponent;
  5656. exports.ɵi = BsCustomDatesViewComponent;
  5657. exports.ɵj = BsDatepickerDayDecoratorComponent;
  5658. exports.ɵk = BsDatepickerNavigationViewComponent;
  5659. exports.ɵl = BsDaysCalendarViewComponent;
  5660. exports.ɵm = BsMonthCalendarViewComponent;
  5661. exports.ɵn = BsTimepickerViewComponent;
  5662. exports.ɵo = BsYearsCalendarViewComponent;
  5663. Object.defineProperty(exports, '__esModule', { value: true });
  5664. }));
  5665. //# sourceMappingURL=ngx-bootstrap-datepicker.umd.js.map