UNPKG

11 kBSource Map (JSON)View Raw
1{"version":3,"file":"datepicker.component.js","sourceRoot":"","sources":["../../src/datepicker/datepicker.component.ts"],"names":[],"mappings":"OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe;OACtF,EAAwB,iBAAiB,EAAE,MAAM,gBAAgB;OACjE,EAAE,wBAAwB,EAAE,MAAM,8BAA8B;OAChE,EAAE,gBAAgB,EAAE,MAAM,qBAAqB;AAEtD,OAAO,IAAM,iCAAiC,GAAQ;IACpD,OAAO,EAAE,iBAAiB;IAC1B,WAAW,EAAE,UAAU,CAAC,cAAM,OAAA,mBAAmB,EAAnB,CAAmB,CAAC;IAClD,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,oEAAoE;AAEpE,mEAAmE;AACnE;IAoEE,6BAAmB,MAAwB;QAnE3C,6DAA6D;QACrD,mBAAc,GAAW,KAAK,CAAC;QAWvC,2CAA2C;QACnC,cAAS,GAAY,IAAI,CAAC;QAwC1B,kBAAa,GAAuB,IAAI,YAAY,CAAO,SAAS,CAAC,CAAC;QAE9E,yDAAyD;QACjD,qBAAgB,GAAuB,IAAI,YAAY,CAAO,SAAS,CAAC,CAAC;QAI1E,aAAQ,GAAQ,QAAQ,CAAC,SAAS,CAAC;QACnC,cAAS,GAAQ,QAAQ,CAAC,SAAS,CAAC;QAEjC,SAAI,GAAS,IAAI,IAAI,EAAE,CAAC;QAKhC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAzBD,sBAAW,2CAAU;QAFrB,4BAA4B;aAE5B;YACE,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,CAAC;QACvC,CAAC;aAED,UAAsB,KAAW;YAC/B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,CAAC;;;OAJA;IAyBM,8CAAgB,G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ACtC,qBAAqB,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACzC,eAAe,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACnC,cAAc,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QAClC,aAAa,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACjC,cAAc,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QAClC,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QAChC,eAAe,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACpC,kBAAkB,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACvC,aAAa,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,wBAAwB,EAAG,EAAE,EAAE;KACxE,CAAC;IACF,0BAAC;AAAD,CAAC,AAlLD,IAkLC","sourcesContent":["import { Component, EventEmitter, Input, Output, ViewChild, forwardRef } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { DatePickerInnerComponent } from './datepicker-inner.component';\nimport { DatepickerConfig } from './datepicker.config';\n\nexport const DATEPICKER_CONTROL_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => DatePickerComponent),\n multi: true\n};\n\n/* tslint:disable:component-selector-name component-selector-type */\n\n/* tslint:enable:component-selector-name component-selector-type */\nexport class DatePickerComponent implements ControlValueAccessor {\n /** sets datepicker mode, supports: `day`, `month`, `year` */\n public datepickerMode: string = 'day';\n /** default date to show if `ng-model` value is not specified */\n public initDate: Date;\n /** oldest selectable date */\n public minDate: Date;\n /** latest selectable date */\n public maxDate: Date;\n /** set lower datepicker mode, supports: `day`, `month`, `year` */\n public minMode: string;\n /** sets upper datepicker mode, supports: `day`, `month`, `year` */\n public maxMode: string;\n /** if false week numbers will be hidden */\n public showWeeks: boolean = true;\n /** format of day in month */\n public formatDay: string;\n /** format of month in year */\n public formatMonth: string;\n /** format of year in year range */\n public formatYear: string;\n /** format of day in week header */\n public formatDayHeader: string;\n /** format of title when selecting day */\n public formatDayTitle: string;\n /** format of title when selecting month */\n public formatMonthTitle: string;\n /** starting day of the week from 0-6 (0=Sunday, ..., 6=Saturday) */\n public startingDay: number;\n /** number of years displayed in year selection */\n public yearRange: number;\n /** if true only dates from the currently displayed month will be shown */\n public onlyCurrentMonth: boolean;\n /** if true shortcut`s event propagation will be disabled */\n public shortcutPropagation: boolean;\n /** number of months displayed in a single row of month picker */\n public monthColLimit: number;\n /** number of years displayed in a single row of year picker */\n public yearColLimit: number;\n /** array of custom css classes to be applied to targeted dates */\n public customClass: { date: Date, mode: string, clazz: string }[];\n /** array of disabled dates */\n public dateDisabled: { date: Date, mode: string }[];\n\n /** currently active date */\n \n public get activeDate(): Date {\n return this._activeDate || this._now;\n }\n\n public set activeDate(value: Date) {\n this._activeDate = value;\n }\n\n public selectionDone: EventEmitter<Date> = new EventEmitter<Date>(undefined);\n\n /** callback to invoke when the activeDate is changed. */\n public activeDateChange: EventEmitter<Date> = new EventEmitter<Date>(undefined);\n\n public _datePicker: DatePickerInnerComponent;\n\n public onChange: any = Function.prototype;\n public onTouched: any = Function.prototype;\n\n protected _now: Date = new Date();\n protected _activeDate: Date;\n protected config: DatepickerConfig;\n\n public constructor(config: DatepickerConfig) {\n this.config = config;\n this.configureOptions();\n }\n\n public configureOptions(): void {\n Object.assign(this, this.config);\n }\n\n public onUpdate(event: any): void {\n this.activeDate = event;\n this.onChange(event);\n }\n\n public onSelectionDone(event: Date): void {\n this.selectionDone.emit(event);\n }\n\n public onActiveDateChange(event: Date): void {\n this.activeDateChange.emit(event);\n }\n // todo: support null value\n public writeValue(value: any): void {\n if (this._datePicker.compare(value, this._activeDate) === 0) {\n return;\n }\n if (value && value instanceof Date) {\n this.activeDate = value;\n this._datePicker.select(value, false);\n return;\n }\n\n this.activeDate = value ? new Date(value) : void 0;\n }\n\n public registerOnChange(fn: (_: any) => {}): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: () => {}): void {\n this.onTouched = fn;\n }\nstatic decorators: DecoratorInvocation[] = [\n{ type: Component, args: [{\n selector: 'datepicker',\n template: `\n <datepicker-inner [activeDate]=\"activeDate\"\n (update)=\"onUpdate($event)\"\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 [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 `,\n providers: [DATEPICKER_CONTROL_VALUE_ACCESSOR]\n}, ] },\n];\n/** @nocollapse */\nstatic ctorParameters: () => ({type: any, decorators?: DecoratorInvocation[]}|null)[] = () => [\n{type: DatepickerConfig, },\n];\nstatic propDecorators: {[key: string]: DecoratorInvocation[]} = {\n'datepickerMode': [{ type: Input },],\n'initDate': [{ type: Input },],\n'minDate': [{ type: Input },],\n'maxDate': [{ type: Input },],\n'minMode': [{ type: Input },],\n'maxMode': [{ type: Input },],\n'showWeeks': [{ type: Input },],\n'formatDay': [{ type: Input },],\n'formatMonth': [{ type: Input },],\n'formatYear': [{ type: Input },],\n'formatDayHeader': [{ type: Input },],\n'formatDayTitle': [{ type: Input },],\n'formatMonthTitle': [{ type: Input },],\n'startingDay': [{ type: Input },],\n'yearRange': [{ type: Input },],\n'onlyCurrentMonth': [{ type: Input },],\n'shortcutPropagation': [{ type: Input },],\n'monthColLimit': [{ type: Input },],\n'yearColLimit': [{ type: Input },],\n'customClass': [{ type: Input },],\n'dateDisabled': [{ type: Input },],\n'activeDate': [{ type: Input },],\n'selectionDone': [{ type: Output },],\n'activeDateChange': [{ type: Output },],\n'_datePicker': [{ type: ViewChild, args: [DatePickerInnerComponent, ] },],\n};\n}\n\ninterface DecoratorInvocation {\n type: Function;\n args?: any[];\n}\n"]}
\No newline at end of file