@nodro7/angular-mydatepicker
Version:
Angular datepicker
1 lines • 256 kB
Source Map (JSON)
{"version":3,"file":"nodro7-angular-mydatepicker.mjs","sources":["../../../projects/angular-mydatepicker/src/lib/enums/key-code.enum.ts","../../../projects/angular-mydatepicker/src/lib/enums/key-name.enum.ts","../../../projects/angular-mydatepicker/src/lib/constants/constants.ts","../../../projects/angular-mydatepicker/src/lib/services/angular-mydatepicker.util.service.ts","../../../projects/angular-mydatepicker/src/lib/enums/month-id.enum.ts","../../../projects/angular-mydatepicker/src/lib/enums/default-view.enum.ts","../../../projects/angular-mydatepicker/src/lib/enums/cal-animation.enum.ts","../../../projects/angular-mydatepicker/src/lib/enums/header-action.enum.ts","../../../projects/angular-mydatepicker/src/lib/components/selection-bar/selection-bar.component.ts","../../../projects/angular-mydatepicker/src/lib/components/selection-bar/selection-bar.component.html","../../../projects/angular-mydatepicker/src/lib/enums/active-view.enum.ts","../../../projects/angular-mydatepicker/src/lib/components/day-view/day-view.component.ts","../../../projects/angular-mydatepicker/src/lib/components/day-view/day-view.component.html","../../../projects/angular-mydatepicker/src/lib/components/month-view/month-view.component.ts","../../../projects/angular-mydatepicker/src/lib/components/month-view/month-view.component.html","../../../projects/angular-mydatepicker/src/lib/components/year-view/year-view.component.ts","../../../projects/angular-mydatepicker/src/lib/components/year-view/year-view.component.html","../../../projects/angular-mydatepicker/src/lib/components/footer-bar/footer-bar.component.ts","../../../projects/angular-mydatepicker/src/lib/components/footer-bar/footer-bar.component.html","../../../projects/angular-mydatepicker/src/lib/directives/angular-mydatepicker-calendar.directive.ts","../../../projects/angular-mydatepicker/src/lib/components/calendar/calendar.component.ts","../../../projects/angular-mydatepicker/src/lib/components/calendar/calendar.component.html","../../../projects/angular-mydatepicker/src/lib/services/angular-mydatepicker.locale.service.ts","../../../projects/angular-mydatepicker/src/lib/enums/year.enum.ts","../../../projects/angular-mydatepicker/src/lib/services/angular-mydatepicker.config.service.ts","../../../projects/angular-mydatepicker/src/lib/enums/cal-toggle.enum.ts","../../../projects/angular-mydatepicker/src/lib/angular-mydatepicker.input.ts","../../../projects/angular-mydatepicker/src/lib/angular-mydatepicker.module.ts","../../../projects/angular-mydatepicker/src/public-api.ts","../../../projects/angular-mydatepicker/src/nodro7-angular-mydatepicker.ts"],"sourcesContent":["/**\n * Event key codes\n */\nexport enum KeyCode {\n enter = 13, \n esc = 27, \n space = 32, \n leftArrow = 37, \n upArrow = 38, \n rightArrow = 39, \n downArrow = 40, \n tab = 9, \n shift = 16\n}\n","/**\n * Event key names\n */\nexport enum KeyName {\n enter = \"Enter\", \n esc = \"Escape|Esc\", \n space = \" |Spacebar\", \n leftArrow = \"ArrowLeft|Left\", \n upArrow = \"ArrowUp|Up\", \n rightArrow = \"ArrowRight|Right\", \n downArrow = \"ArrowDown|Down\", \n tab = \"Tab\", \n shift = \"Shift\"\n}\n","/**\n * Constants\n */\nconst D = \"d\";\nconst DD = \"dd\";\nconst M = \"m\";\nconst MM = \"mm\";\nconst MMM = \"mmm\";\nconst Y = \"y\";\nconst YYYY = \"yyyy\";\nconst ORDINAL = \"##\";\n\nconst ST = 'st';\nconst ND = \"nd\";\nconst RD = \"rd\";\n\nconst DATE_ROW_COUNT = 5;\nconst DATE_COL_COUNT = 6;\nconst MONTH_ROW_COUNT = 3;\nconst MONTH_COL_COUNT = 2;\nconst YEAR_ROW_COUNT = 4;\nconst YEAR_COL_COUNT = 4;\n\nconst DOT = \".\";\nconst UNDER_LINE = \"_\";\nconst PIPE = \"|\";\nconst YEAR_SEPARATOR = \" - \";\n\nconst SU = \"su\";\nconst MO = \"mo\";\nconst TU = \"tu\";\nconst WE = \"we\";\nconst TH = \"th\";\nconst FR = \"fr\";\nconst SA = \"sa\";\n\nconst DEFAULT_LOCALE = \"en\";\n\nconst ZERO_STR = \"0\";\nconst EMPTY_STR = \"\";\nconst SPACE_STR = \" \";\n\nconst CLICK = \"click\";\nconst KEYUP = \"keyup\";\nconst BLUR = \"blur\";\nconst DISABLED = \"disabled\";\nconst BODY = \"body\";\nconst VALUE = \"value\";\nconst OPTIONS = \"options\";\nconst DEFAULT_MONTH = \"defaultMonth\";\nconst LOCALE = \"locale\";\nconst OBJECT = \"object\";\nconst PX = \"px\";\nconst STYLE = \"style\";\nconst INNER_HTML = \"innerHTML\";\n\nconst OPTS = \"opts\";\nconst YEARS_DURATION = \"yearsDuration\";\nconst YEARS = \"years\";\nconst VISIBLE_MONTH = \"visibleMonth\";\nconst SELECT_MONTH = \"selectMonth\";\nconst SELECT_YEAR = \"selectYear\";\nconst PREV_VIEW_DISABLED = \"prevViewDisabled\";\nconst NEXT_VIEW_DISABLED = \"nextViewDisabled\";\nconst DATES = \"dates\";\nconst WEEK_DAYS = \"weekDays\";\nconst SELECTED_DATE = \"selectedDate\";\nconst SELECTED_DATE_RANGE = \"selectedDateRange\";\nconst MONTHS = \"months\";\n\nconst ANIMATION_END = \"animationend\";\nconst ANIMATION_TIMEOUT = 550;\nconst MY_DP_ANIMATION = \"myDpAnimation\";\nconst ANIMATION_NAMES = [\"Fade\", \"ScaleTop\", \"ScaleCenter\", \"Rotate\", \"FlipDiagonal\", \"Own\"];\nconst IN = \"In\";\nconst OUT = \"Out\";\n\nconst TABINDEX = \"tabindex\";\nconst TD_SELECTOR = \"table tbody tr td:not(.myDpDaycellWeekNbr)\";\n\nconst PREVENT_CLOSE_TIMEOUT = 50;\n\nexport {\n D,\n DD,\n M,\n MM,\n MMM,\n Y,\n YYYY,\n ORDINAL,\n ST,\n ND,\n RD,\n DATE_ROW_COUNT,\n DATE_COL_COUNT,\n MONTH_ROW_COUNT,\n MONTH_COL_COUNT,\n YEAR_ROW_COUNT,\n YEAR_COL_COUNT,\n DOT,\n UNDER_LINE,\n PIPE,\n YEAR_SEPARATOR,\n SU,\n MO,\n TU,\n WE,\n TH,\n FR,\n SA,\n DEFAULT_LOCALE,\n ZERO_STR,\n EMPTY_STR,\n SPACE_STR,\n CLICK,\n KEYUP,\n BLUR,\n DISABLED,\n BODY,\n VALUE,\n OPTIONS,\n DEFAULT_MONTH,\n LOCALE,\n OBJECT,\n PX,\n STYLE,\n INNER_HTML,\n OPTS,\n YEARS_DURATION,\n YEARS,\n VISIBLE_MONTH,\n SELECT_MONTH,\n SELECT_YEAR,\n PREV_VIEW_DISABLED,\n NEXT_VIEW_DISABLED,\n DATES,\n WEEK_DAYS,\n SELECTED_DATE,\n SELECTED_DATE_RANGE,\n MONTHS,\n ANIMATION_END,\n ANIMATION_TIMEOUT,\n MY_DP_ANIMATION,\n ANIMATION_NAMES,\n IN,\n OUT,\n TABINDEX,\n TD_SELECTOR,\n PREVENT_CLOSE_TIMEOUT\n};\n","import {Injectable} from \"@angular/core\";\nimport {IMyDateModel} from \"../interfaces/my-date-model.interface\";\nimport {IMySingleDateModel} from \"../interfaces/my-single-date-model.interface\";\nimport {IMyDateRangeModel} from \"../interfaces/my-date-range-model.interface\";\nimport {IMyDate} from \"../interfaces/my-date.interface\";\nimport {IMyDateRange} from \"../interfaces/my-date-range.interface\";\nimport {IMyMonth} from \"../interfaces/my-month.interface\";\nimport {IMyMonthLabels} from \"../interfaces/my-month-labels.interface\";\nimport {IMyMarkedDate} from \"../interfaces/my-marked-date.interface\";\nimport {IMyDisabledDate} from \"../interfaces/my-disabled-date.interface\";\nimport {IMyDateFormat} from \"../interfaces/my-date-format.interface\";\nimport {IMyValidateOptions} from \"../interfaces/my-validate-options.interface\";\nimport {IMyOptions} from \"../interfaces/my-options.interface\";\nimport {KeyCode} from \"../enums/key-code.enum\";\nimport {KeyName} from \"../enums/key-name.enum\";\nimport {D, DD, M, MM, MMM, YYYY, ORDINAL, ST, ND, RD, SU, MO, TU, WE, TH, FR, SA, ZERO_STR, EMPTY_STR, PIPE} from \"../constants/constants\";\n\n@Injectable()\nexport class UtilService {\n weekDays: Array<string> = [SU, MO, TU, WE, TH, FR, SA];\n\n isDateValid(dateStr: string, options: IMyOptions, validateOpts: IMyValidateOptions): IMyDate {\n const {dateFormat, minYear, maxYear, monthLabels} = options;\n\n const returnDate: IMyDate = this.resetDate();\n const datesInMonth: Array<number> = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n const isMonthStr: boolean = dateFormat.indexOf(MMM) !== -1;\n const delimeters: Array<string> = dateFormat.match(/[^(d#my)]{1,}/g);\n\n if (!dateStr || dateStr === EMPTY_STR) {\n return returnDate;\n }\n\n const dateValues: Array<IMyDateFormat> = this.getDateValue(dateStr, dateFormat, delimeters);\n\n let year: number = 0;\n let month: number = 0;\n let day: number = 0;\n\n for(let dv of dateValues) {\n if (dv.format.indexOf(ORDINAL) != -1) {\n const dayNumber: number = parseInt(dv.value.replace(/\\D/g, ''));\n const ordinalStr: string = dv.value.replace(/[0-9]/g, '');\n const ordinal: string = this.getOrdinal(dayNumber);\n\n if (ordinal !== ordinalStr) {\n return returnDate;\n }\n\n dv.value = dv.value.replace(ST, EMPTY_STR).replace(ND, EMPTY_STR).replace(RD, EMPTY_STR).replace(TH, EMPTY_STR);\n dv.format = dv.format.replace(ORDINAL, EMPTY_STR);\n }\n\n const {value, format} = dv;\n\n if (value && /^\\d+$/.test(value) && Number(value) === 0) {\n return returnDate;\n }\n \n if (format.indexOf(YYYY) !== -1) {\n year = this.getNumberByValue(dv);\n }\n else if (format.indexOf(M) !== -1) {\n month = isMonthStr ? this.getMonthNumberByMonthName(dv, monthLabels) : this.getNumberByValue(dv);\n }\n else if (format.indexOf(D) !== -1) {\n day = this.getNumberByValue(dv);\n }\n }\n\n const {validateDisabledDates, selectedValue} = validateOpts;\n\n year = year === 0 && selectedValue ? selectedValue.year : year;\n month = month === 0 && selectedValue ? selectedValue.month : month;\n day = day === 0 && selectedValue ? selectedValue.day : day;\n\n const today: IMyDate = this.getToday();\n if (year === 0 && (month !== 0 || day !== 0)) {\n year = today.year;\n }\n\n if (month === 0 && (year !== 0 || day !== 0)) {\n month = today.month;\n }\n\n if (day === 0 && (year !== 0 || month !== 0)) {\n day = today.day;\n }\n\n if (month !== -1 && day !== -1 && year !== -1) {\n if (year < minYear || year > maxYear || month < 1 || month > 12) {\n return returnDate;\n }\n\n const date: IMyDate = {year, month, day};\n\n if (validateDisabledDates && this.isDisabledDate(date, options).disabled) {\n return returnDate;\n }\n\n if (year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0)) {\n datesInMonth[1] = 29;\n }\n\n if (day < 1 || day > datesInMonth[month - 1]) {\n return returnDate;\n }\n\n // Valid date\n return date;\n }\n return returnDate;\n }\n\n isDateValidDateRange(dateRangeStr: string, options: IMyOptions, validateOpts: IMyValidateOptions): IMyDateRange {\n let dateRange: IMyDateRange = {begin: this.resetDate(), end: this.resetDate()};\n if (dateRangeStr && dateRangeStr.length) {\n const dates: Array<string> = dateRangeStr.split(options.dateRangeDatesDelimiter);\n if (dates && dates.length === 2) {\n const [beginDate, endDate] = dates;\n let {selectedValue} = validateOpts;\n\n if (selectedValue) {\n validateOpts.selectedValue = selectedValue.begin;\n }\n \n const begin: IMyDate = this.isDateValid(beginDate, options, validateOpts);\n\n if (this.isInitializedDate(begin)) {\n if (selectedValue) {\n validateOpts.selectedValue = selectedValue.end;\n }\n \n const end: IMyDate = this.isDateValid(endDate, options, validateOpts);\n\n if (this.isInitializedDate(end) && this.isDateSameOrEarlier(begin, end)) {\n dateRange = {begin, end};\n }\n }\n }\n }\n return dateRange;\n }\n\n getDateValue(dateStr: string, dateFormat: string, delimeters: Array<string>): Array<IMyDateFormat> {\n let del: string = EMPTY_STR;\n \n if (delimeters) {\n for(const d of delimeters) {\n if (del.indexOf(d) === -1) {\n del += d;\n }\n }\n }\n\n const re: any = new RegExp(\"[\" + del + \"]\");\n const ds: Array<string> = dateStr.split(re);\n const df: Array<string> = dateFormat.split(re);\n const da: Array<IMyDateFormat> = [];\n\n for (let i = 0; i < df.length; i++) {\n if (df[i].indexOf(YYYY) !== -1) {\n da.push({value: ds[i], format: df[i]});\n }\n if (df[i].indexOf(M) !== -1) {\n da.push({value: ds[i], format: df[i]});\n }\n if (df[i].indexOf(D) !== -1) {\n da.push({value: ds[i], format: df[i]});\n }\n }\n return da;\n }\n\n getMonthNumberByMonthName(df: IMyDateFormat, monthLabels: IMyMonthLabels): number {\n if (df.value) {\n for (let key = 1; key <= 12; key++) {\n if (df.value.toLowerCase() === monthLabels[key].toLowerCase()) {\n return key;\n }\n }\n }\n return -1;\n }\n\n getNumberByValue(df: IMyDateFormat): number {\n if (!/^\\d+$/.test(df.value)) {\n return -1;\n }\n\n let nbr: number = Number(df.value);\n if (df.format.length === 1 && df.value.length !== 1 && nbr < 10 || df.format.length === 1 && df.value.length !== 2 && nbr >= 10) {\n nbr = -1;\n }\n else if (df.format.length === 2 && df.value.length > 2) {\n nbr = -1;\n }\n return nbr;\n }\n\n parseDefaultMonth(monthString: string): IMyMonth {\n const month: IMyMonth = {monthTxt: EMPTY_STR, monthNbr: 0, year: 0};\n if (monthString !== EMPTY_STR) {\n const split = monthString.split(monthString.match(/[^0-9]/)[0]);\n month.monthNbr = split[0].length === 2 ? Number(split[0]) : Number(split[1]);\n month.year = split[0].length === 2 ? Number(split[1]) : Number(split[0]);\n }\n return month;\n }\n\n isDisabledDate(date: IMyDate, options: IMyOptions): IMyDisabledDate {\n const {minYear, maxYear, disableUntil, disableSince, disableWeekends, disableDates, disableDateRanges, disableWeekdays, enableDates} = options;\n\n if (this.dateMatchToDates(date, enableDates)) {\n return this.getDisabledValue(false, EMPTY_STR);\n }\n\n if (date.year < minYear && date.month === 12 || date.year > maxYear && date.month === 1) {\n return this.getDisabledValue(true, EMPTY_STR);\n }\n\n const inputDates: any = disableDates as any;\n const result = inputDates.find((d) => {\n return d.dates;\n });\n\n if (!result) {\n if (this.dateMatchToDates(date, inputDates)) {\n return this.getDisabledValue(true, EMPTY_STR);\n }\n }\n else {\n for (const dd of inputDates) {\n if (this.dateMatchToDates(date, dd.dates)) {\n return this.getDisabledValue(true, dd.styleClass);\n }\n }\n }\n\n if (this.isDisabledByDisableUntil(date, disableUntil)) {\n return this.getDisabledValue(true, EMPTY_STR);\n }\n\n if (this.isDisabledByDisableSince(date, disableSince)) {\n return this.getDisabledValue(true, EMPTY_STR);\n }\n\n if (disableWeekends) {\n const dayNbr = this.getDayNumber(date);\n if (dayNbr === 0 || dayNbr === 6) {\n return this.getDisabledValue(true, EMPTY_STR);\n }\n }\n\n const dn = this.getDayNumber(date);\n if (disableWeekdays.length > 0) {\n for (const wd of disableWeekdays) {\n if (dn === this.getWeekdayIndex(wd)) {\n return this.getDisabledValue(true, EMPTY_STR);\n }\n }\n }\n\n if (this.isDisabledByDisableDateRange(date, date, disableDateRanges)) {\n return this.getDisabledValue(true, EMPTY_STR);\n }\n\n return this.getDisabledValue(false, EMPTY_STR);\n }\n\n getDisabledValue(disabled: boolean, styleClass: string): IMyDisabledDate {\n return {disabled, styleClass};\n }\n\n dateMatchToDates(date: IMyDate, dates: Array<IMyDate>): boolean {\n for (const d of dates) {\n if ((d.year === 0 || d.year === date.year) && (d.month === 0 || d.month === date.month) && d.day === date.day) {\n return true;\n }\n }\n return false;\n }\n\n isDisabledMonth(year: number, month: number, options: IMyOptions): boolean {\n const {disableUntil, disableSince, disableDateRanges, enableDates} = options;\n\n const dateEnd: IMyDate = {year, month, day: this.datesInMonth(month, year)};\n const dateBegin: IMyDate = {year, month, day: 1};\n\n if (this.isDatesEnabled(dateBegin, dateEnd, enableDates)) {\n return false;\n }\n\n if (this.isDisabledByDisableUntil(dateEnd, disableUntil)) {\n return true;\n }\n\n if (this.isDisabledByDisableSince(dateBegin, disableSince)) {\n return true;\n }\n\n if (this.isDisabledByDisableDateRange(dateBegin, dateEnd, disableDateRanges)) {\n return true;\n }\n\n return false;\n }\n\n isDisabledYear(year: number, options: IMyOptions): boolean {\n const {disableUntil, disableSince, disableDateRanges, enableDates, minYear, maxYear} = options;\n\n const dateEnd: IMyDate = {year, month: 12, day: 31};\n const dateBegin: IMyDate = {year, month: 1, day: 1};\n\n if (this.isDatesEnabled(dateBegin, dateEnd, enableDates)) {\n return false;\n }\n\n if (this.isDisabledByDisableUntil(dateEnd, disableUntil)) {\n return true;\n }\n\n if (this.isDisabledByDisableSince(dateBegin, disableSince)) {\n return true;\n }\n\n if (this.isDisabledByDisableDateRange(dateBegin, dateEnd, disableDateRanges)) {\n return true;\n }\n\n if (year < minYear || year > maxYear) {\n return true;\n }\n\n return false;\n }\n\n isDisabledByDisableUntil(date: IMyDate, disableUntil: IMyDate): boolean {\n return this.isInitializedDate(disableUntil) && this.getTimeInMilliseconds(date) <= this.getTimeInMilliseconds(disableUntil);\n }\n\n isDisabledByDisableSince(date: IMyDate, disableSince: IMyDate): boolean {\n return this.isInitializedDate(disableSince) && this.getTimeInMilliseconds(date) >= this.getTimeInMilliseconds(disableSince);\n }\n\n isPastDatesEnabled(date: IMyDate, enableDates: Array<IMyDate>): boolean {\n for(const d of enableDates) {\n if (this.getTimeInMilliseconds(d) <= this.getTimeInMilliseconds(date)) {\n return true;\n }\n }\n return false;\n }\n\n isFutureDatesEnabled(date: IMyDate, enableDates: Array<IMyDate>): boolean {\n for(const d of enableDates) {\n if (this.getTimeInMilliseconds(d) >= this.getTimeInMilliseconds(date)) {\n return true;\n }\n }\n return false;\n }\n\n isDatesEnabled(dateBegin: IMyDate, dateEnd: IMyDate, enableDates: Array<IMyDate>): boolean {\n for(const d of enableDates) {\n if (this.getTimeInMilliseconds(d) >= this.getTimeInMilliseconds(dateBegin) \n && this.getTimeInMilliseconds(d) <= this.getTimeInMilliseconds(dateEnd)) {\n return true;\n }\n }\n return false;\n }\n\n isDisabledByDisableDateRange(dateBegin: IMyDate, dateEnd: IMyDate, disableDateRanges: Array<IMyDateRange>): boolean {\n const dateMsBegin: number = this.getTimeInMilliseconds(dateBegin);\n const dateMsEnd: number = this.getTimeInMilliseconds(dateEnd);\n\n for (const d of disableDateRanges) {\n if (this.isInitializedDate(d.begin) && this.isInitializedDate(d.end) \n && dateMsBegin >= this.getTimeInMilliseconds(d.begin) && dateMsEnd <= this.getTimeInMilliseconds(d.end)) {\n return true;\n }\n }\n return false;\n }\n\n isMarkedDate(date: IMyDate, options: IMyOptions): IMyMarkedDate {\n const {markDates, markWeekends} = options;\n\n for (const md of markDates) {\n if (this.dateMatchToDates(date, md.dates)) {\n return this.getMarkedValue(true, md.color, md.styleClass);\n }\n }\n if (markWeekends && markWeekends.marked) {\n const dayNbr = this.getDayNumber(date);\n if (dayNbr === 0 || dayNbr === 6) {\n return this.getMarkedValue(true, markWeekends.color, EMPTY_STR);\n }\n }\n return this.getMarkedValue(false, EMPTY_STR, EMPTY_STR);\n }\n\n getMarkedValue(marked: boolean, color: string, styleClass: string): IMyMarkedDate {\n return {marked, color: color ? color : EMPTY_STR, styleClass: styleClass ? styleClass : EMPTY_STR};\n }\n\n isHighlightedDate(date: IMyDate, options: IMyOptions): boolean {\n const {sunHighlight, satHighlight, highlightDates} = options;\n\n const dayNbr: number = this.getDayNumber(date);\n if (sunHighlight && dayNbr === 0 || satHighlight && dayNbr === 6) {\n return true;\n }\n\n if (this.dateMatchToDates(date, highlightDates)) {\n return true;\n }\n\n return false;\n }\n\n getWeekNumber(date: IMyDate): number {\n const d: Date = new Date(date.year, date.month - 1, date.day, 0, 0, 0, 0);\n d.setDate(d.getDate() + (d.getDay() === 0 ? -3 : 4 - d.getDay()));\n return Math.round(((d.getTime() - new Date(d.getFullYear(), 0, 4).getTime()) / 86400000) / 7) + 1;\n }\n\n getDateModel(date: IMyDate, dateRange: IMyDateRange, dateFormat: string, monthLabels: IMyMonthLabels, rangeDelimiter: string, dateStr: string = EMPTY_STR): IMyDateModel {\n let singleDateModel: IMySingleDateModel = null;\n let dateRangeModel: IMyDateRangeModel = null;\n\n if (date) {\n singleDateModel = {\n date,\n jsDate: this.myDateToJsDate(date),\n formatted: dateStr.length ? dateStr : this.formatDate(date, dateFormat, monthLabels),\n epoc: this.getEpocTime(date)\n };\n }\n else {\n dateRangeModel = {\n beginDate: dateRange.begin,\n beginJsDate: this.myDateToJsDate(dateRange.begin),\n beginEpoc: this.getEpocTime(dateRange.begin),\n endDate: dateRange.end,\n endJsDate: this.myDateToJsDate(dateRange.end),\n endEpoc: this.getEpocTime(dateRange.end),\n formatted: this.formatDate(dateRange.begin, dateFormat, monthLabels) + rangeDelimiter + this.formatDate(dateRange.end, dateFormat, monthLabels)\n };\n }\n\n return {\n isRange: date === null,\n singleDate: singleDateModel,\n dateRange: dateRangeModel\n };\n }\n\n formatDate(date: IMyDate, dateFormat: string, monthLabels: IMyMonthLabels): string {\n let formatted: string = dateFormat.replace(YYYY, String(date.year));\n\n if (dateFormat.indexOf(MMM) !== -1) {\n formatted = formatted.replace(MMM, monthLabels[date.month]);\n }\n else if (dateFormat.indexOf(MM) !== -1) {\n formatted = formatted.replace(MM, this.preZero(date.month));\n }\n else {\n formatted = formatted.replace(M, String(date.month));\n }\n\n if (dateFormat.indexOf(DD) !== -1) {\n formatted = formatted.replace(DD, this.preZero(date.day));\n }\n else {\n formatted = formatted.replace(D, String(date.day));\n }\n\n if (dateFormat.indexOf(ORDINAL) !== -1) {\n formatted = formatted.replace(ORDINAL, this.getOrdinal(date.day));\n }\n\n return formatted;\n }\n\n getOrdinal(date: number): string {\n if (date > 3 && date < 21) {\n return TH;\n }\n\n switch (date % 10) {\n case 1:\n return ST;\n case 2:\n return ND;\n case 3:\n return RD;\n default:\n return TH;\n }\n }\n\n getFormattedDate(model: IMyDateModel): string {\n return !model.isRange ? model.singleDate.formatted : model.dateRange.formatted;\n }\n\n preZero(val: number): string {\n return val < 10 ? ZERO_STR + val : String(val);\n }\n\n isInitializedDate(date: IMyDate): boolean {\n return date.year !== 0 && date.month !== 0 && date.day !== 0;\n }\n\n isDateEarlier(firstDate: IMyDate, secondDate: IMyDate): boolean {\n return this.getTimeInMilliseconds(firstDate) < this.getTimeInMilliseconds(secondDate);\n }\n\n isDateSameOrEarlier(firstDate: IMyDate, secondDate: IMyDate): boolean {\n return this.getTimeInMilliseconds(firstDate) <= this.getTimeInMilliseconds(secondDate);\n }\n\n isDateSame(firstDate: IMyDate, secondDate: IMyDate): boolean {\n return this.getTimeInMilliseconds(firstDate) === this.getTimeInMilliseconds(secondDate);\n }\n\n isDateRangeBeginOrEndSame(dateRange: IMyDateRange, date: IMyDate): boolean {\n const dateMs: number = this.getTimeInMilliseconds(date);\n return this.getTimeInMilliseconds(dateRange.begin) === dateMs || this.getTimeInMilliseconds(dateRange.end) === dateMs;\n }\n\n isDateRangeBegin(dateRange: IMyDateRange, date: IMyDate): boolean {\n const dateMs: number = this.getTimeInMilliseconds(date);\n return this.getTimeInMilliseconds(dateRange.begin) === dateMs;\n }\n\n isDateRangeEnd(dateRange: IMyDateRange, date: IMyDate): boolean {\n const dateMs: number = this.getTimeInMilliseconds(date);\n return this.getTimeInMilliseconds(dateRange.end) === dateMs;\n }\n\n isDateInRange(date: IMyDate, dateRange: IMyDateRange): boolean {\n if (!this.isInitializedDate(dateRange.begin) || !this.isInitializedDate(dateRange.end)) {\n return false;\n }\n return this.isDateSameOrEarlier(dateRange.begin, date) && this.isDateSameOrEarlier(date, dateRange.end);\n }\n\n resetDate(): IMyDate {\n return {year: 0, month: 0, day: 0};\n }\n\n getTimeInMilliseconds(date: IMyDate): number {\n return this.myDateToJsDate(date).getTime();\n }\n\n getToday(): IMyDate {\n const date: Date = new Date();\n return {year: date.getFullYear(), month: date.getMonth() + 1, day: date.getDate()};\n }\n\n getDayNumber(date: IMyDate): number {\n return new Date(date.year, date.month - 1, date.day, 0, 0, 0, 0).getDay();\n }\n\n getWeekdayIndex(wd: string) {\n return this.weekDays.indexOf(wd);\n }\n\n getEpocTime(date: IMyDate): number {\n return Math.round(this.getTimeInMilliseconds(date) / 1000.0);\n }\n\n jsDateToMyDate(date: Date): IMyDate {\n return {year: date.getFullYear(), month: date.getMonth() + 1, day: date.getDate()};\n }\n\n myDateToJsDate(date: IMyDate): Date {\n const {year, month, day} = date;\n return new Date(year, month - 1, day, 0, 0, 0, 0);\n }\n\n datesInMonth(m: number, y: number): number {\n return new Date(y, m, 0).getDate();\n }\n\n datesInPrevMonth(m: number, y: number): number {\n const d: Date = this.getJsDate(y, m, 1);\n d.setMonth(d.getMonth() - 1);\n return this.datesInMonth(d.getMonth() + 1, d.getFullYear());\n }\n\n getJsDate(year: number, month: number, day: number): Date {\n return new Date(year, month - 1, day, 0, 0, 0, 0);\n }\n\n getSelectedValue(selectedValue: any, dateRange: boolean): any {\n if (!selectedValue) {\n return null;\n }\n\n if (!dateRange) {\n return selectedValue.date;\n }\n else {\n const {beginDate, endDate} = selectedValue;\n return {begin: beginDate, end: endDate};\n }\n }\n\n getKeyCodeFromEvent(event: any): number {\n let key: any = event.key || event.keyCode || event.which;\n\n if (this.checkKeyName(key, KeyName.enter) || key === KeyCode.enter) {\n return KeyCode.enter;\n }\n else if (this.checkKeyName(key, KeyName.esc) || key === KeyCode.esc) {\n return KeyCode.esc;\n }\n else if (this.checkKeyName(key, KeyName.space) || key === KeyCode.space) {\n return KeyCode.space;\n }\n else if (this.checkKeyName(key, KeyName.leftArrow) || key === KeyCode.leftArrow) {\n return KeyCode.leftArrow;\n }\n else if (this.checkKeyName(key, KeyName.upArrow) || key === KeyCode.upArrow) {\n return KeyCode.upArrow;\n }\n else if (this.checkKeyName(key, KeyName.rightArrow) || key === KeyCode.rightArrow) {\n return KeyCode.rightArrow;\n }\n else if (this.checkKeyName(key, KeyName.downArrow)|| key === KeyCode.downArrow) {\n return KeyCode.downArrow;\n }\n else if (this.checkKeyName(key, KeyName.tab) || key === KeyCode.tab) {\n return KeyCode.tab;\n }\n else if (this.checkKeyName(key, KeyName.shift) || key === KeyCode.shift) {\n return KeyCode.shift;\n }\n else {\n return null;\n }\n }\n\n checkKeyName(key: string, keyName: string): boolean {\n const arr: Array<string> = keyName.split(PIPE);\n return arr.indexOf(key) !== -1;\n }\n}\n","export enum MonthId {\n prev = 1, \n curr = 2, \n next = 3\n}\n","export enum DefaultView {\n Date = 1, \n Month = 2, \n Year = 3\n}\n","export enum CalAnimation {\n None = 0, \n Fade = 1, \n ScaleTop = 2, \n ScaleCenter = 3, \n Rotate = 4, \n FlipDiagonal = 5,\n Own = 6\n}\n","export enum HeaderAction { \n PrevBtnClick = 1, \n NextBtnClick = 2, \n MonthBtnClick = 3, \n YearBtnClick = 4\n}\n","import {Component, EventEmitter, Input, OnChanges, Output, ViewEncapsulation, SimpleChanges} from \"@angular/core\";\nimport {IMyMonth} from \"../../interfaces/my-month.interface\";\nimport {IMyOptions} from \"../../interfaces/my-options.interface\";\nimport {OPTS, YEARS_DURATION, VISIBLE_MONTH, SELECT_MONTH, SELECT_YEAR, PREV_VIEW_DISABLED, NEXT_VIEW_DISABLED} from \"../../constants/constants\"\n\n@Component({\n selector: \"lib-selection-bar\",\n templateUrl: \"./selection-bar.component.html\",\n encapsulation: ViewEncapsulation.None,\n standalone: false\n})\nexport class SelectionBarComponent implements OnChanges {\n @Input() opts: IMyOptions;\n @Input() yearsDuration: string;\n @Input() visibleMonth: IMyMonth;\n @Input() selectMonth: boolean;\n @Input() selectYear: boolean;\n @Input() prevViewDisabled: boolean;\n @Input() nextViewDisabled: boolean;\n\n @Output() prevNavigateBtnClicked: EventEmitter<void> = new EventEmitter<void>();\n @Output() nextNavigateBtnClicked: EventEmitter<void> = new EventEmitter<void>();\n @Output() monthViewBtnClicked: EventEmitter<void> = new EventEmitter<void>();\n @Output() yearViewBtnClicked: EventEmitter<void> = new EventEmitter<void>();\n\n constructor() { }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.hasOwnProperty(OPTS)) {\n this.opts = changes[OPTS].currentValue;\n }\n if (changes.hasOwnProperty(YEARS_DURATION)) {\n this.yearsDuration = changes[YEARS_DURATION].currentValue;\n }\n if (changes.hasOwnProperty(VISIBLE_MONTH)) {\n this.visibleMonth = changes[VISIBLE_MONTH].currentValue;\n }\n if (changes.hasOwnProperty(SELECT_MONTH)) {\n this.selectMonth = changes[SELECT_MONTH].currentValue;\n }\n if (changes.hasOwnProperty(SELECT_YEAR)) {\n this.selectYear = changes[SELECT_YEAR].currentValue;\n }\n if (changes.hasOwnProperty(PREV_VIEW_DISABLED)) {\n this.prevViewDisabled = changes[PREV_VIEW_DISABLED].currentValue;\n }\n if (changes.hasOwnProperty(NEXT_VIEW_DISABLED)) {\n this.nextViewDisabled = changes[NEXT_VIEW_DISABLED].currentValue;\n }\n }\n\n onPrevNavigateBtnClicked(event: any): void {\n event.stopPropagation();\n this.opts.rtl ? this.nextNavigateBtnClicked.emit() : this.prevNavigateBtnClicked.emit();\n }\n\n onNextNavigateBtnClicked(event: any): void {\n event.stopPropagation();\n this.opts.rtl ? this.prevNavigateBtnClicked.emit() : this.nextNavigateBtnClicked.emit();\n }\n\n onMonthViewBtnClicked(event: any): void {\n event.stopPropagation();\n this.monthViewBtnClicked.emit();\n }\n\n onYearViewBtnClicked(event: any): void {\n event.stopPropagation();\n this.yearViewBtnClicked.emit();\n }\n}\n","<div class=\"myDpMonthYearSelBar\">\n <div class=\"myDpPrevBtn\">\n <button type=\"button\" [attr.aria-label]=\"opts.ariaLabelPrevMonth\" class=\"myDpHeaderBtn myDpIcon myDpIconLeftArrow myDpHeaderBtnEnabled\" (click)=\"onPrevNavigateBtnClicked($event)\" tabindex=\"{{!prevViewDisabled ? '0':'-1'}}\" [disabled]=\"prevViewDisabled\" [ngClass]=\"{'myDpHeaderBtnDisabled': prevViewDisabled}\"></button>\n </div>\n <div class=\"myDpMonthYearText\">\n @if (!selectYear) {\n <button type=\"button\" class=\"myDpHeaderBtn myDpMonthBtn\" (click)=\"opts.monthSelector && onMonthViewBtnClicked($event)\" tabindex=\"{{opts.monthSelector ? '0':'-1'}}\" [ngClass]=\"{'myDpMonthLabel': opts.monthSelector, 'myDpHeaderLabelBtnNotEdit': !opts.monthSelector}\">{{visibleMonth.monthTxt}}</button>\n }\n <button type=\"button\" class=\"myDpHeaderBtn myDpYearBtn\" (click)=\"opts.yearSelector && onYearViewBtnClicked($event)\" tabindex=\"{{opts.yearSelector ? '0':'-1'}}\" [ngClass]=\"{'myDpYearLabel': opts.yearSelector, 'myDpHeaderLabelBtnNotEdit': !opts.yearSelector}\">{{!selectYear ? visibleMonth.year : yearsDuration}}</button>\n </div>\n <div class=\"myDpNextBtn\">\n <button type=\"button\" [attr.aria-label]=\"opts.ariaLabelNextMonth\" class=\"myDpHeaderBtn myDpIcon myDpIconRightArrow myDpHeaderBtnEnabled\" (click)=\"onNextNavigateBtnClicked($event)\" tabindex=\"{{!nextViewDisabled ? '0':'-1'}}\" [disabled]=\"nextViewDisabled\" [ngClass]=\"{'myDpHeaderBtnDisabled': nextViewDisabled}\"></button>\n </div>\n</div>\n","export enum ActiveView {\n Date = 1, \n Month = 2, \n Year = 3\n}\n","import {Component, EventEmitter, Input, OnChanges, AfterViewInit, Output, ViewEncapsulation, SimpleChanges} from \"@angular/core\";\nimport {IMyCalendarDay} from \"../../interfaces/my-calendar-day.interface\";\nimport {IMyDate} from \"../../interfaces/my-date.interface\";\nimport {IMyDateRange} from \"../../interfaces/my-date-range.interface\";\nimport {IMyOptions} from \"../../interfaces/my-options.interface\";\nimport {IMyWeek} from \"../../interfaces/my-week.interface\";\nimport {UtilService} from \"../../services/angular-mydatepicker.util.service\";\nimport {KeyCode} from \"../../enums/key-code.enum\";\nimport {MonthId} from \"../../enums/month-id.enum\";\nimport {ActiveView} from \"../../enums/active-view.enum\";\nimport {OPTS, DATES, WEEK_DAYS, SELECTED_DATE, SELECTED_DATE_RANGE} from \"../../constants/constants\";\n\n@Component({\n selector: \"lib-day-view\",\n templateUrl: \"./day-view.component.html\",\n providers: [UtilService],\n encapsulation: ViewEncapsulation.None,\n standalone: false\n})\nexport class DayViewComponent implements OnChanges, AfterViewInit {\n @Input() opts: IMyOptions;\n @Input() dates: Array<IMyWeek>;\n @Input() weekDays: Array<string>;\n @Input() selectedDate: IMyDate;\n @Input() selectedDateRange: IMyDateRange;\n @Input() viewChanged: boolean;\n\n @Output() dayCellClicked: EventEmitter<IMyCalendarDay> = new EventEmitter<IMyCalendarDay>();\n @Output() dayCellKeyDown: EventEmitter<any> = new EventEmitter<any>();\n @Output() viewActivated: EventEmitter<ActiveView> = new EventEmitter<ActiveView>();\n\n prevMonthId: number = MonthId.prev;\n currMonthId: number = MonthId.curr;\n nextMonthId: number = MonthId.next;\n\n constructor(private utilService: UtilService) { }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.hasOwnProperty(OPTS)) {\n this.opts = changes[OPTS].currentValue;\n }\n if (changes.hasOwnProperty(DATES)) {\n this.dates = changes[DATES].currentValue;\n }\n if (changes.hasOwnProperty(WEEK_DAYS)) {\n this.weekDays = changes[WEEK_DAYS].currentValue;\n }\n if (changes.hasOwnProperty(SELECTED_DATE)) {\n this.selectedDate = changes[SELECTED_DATE].currentValue;\n }\n if (changes.hasOwnProperty(SELECTED_DATE_RANGE)) {\n this.selectedDateRange = changes[SELECTED_DATE_RANGE].currentValue;\n }\n }\n\n ngAfterViewInit(): void {\n this.viewActivated.emit(ActiveView.Date);\n }\n\n onDayCellClicked(event: any, cell: IMyCalendarDay): void {\n event.stopPropagation();\n\n if (cell.disabledDate.disabled) {\n return;\n }\n\n this.dayCellClicked.emit(cell);\n }\n\n onDayCellKeyDown(event: any, cell: IMyCalendarDay) {\n const keyCode: number = this.utilService.getKeyCodeFromEvent(event);\n if (keyCode !== KeyCode.tab) {\n event.preventDefault();\n\n if (keyCode === KeyCode.enter || keyCode === KeyCode.space) {\n this.onDayCellClicked(event, cell);\n }\n else if (this.opts.moveFocusByArrowKeys) {\n this.dayCellKeyDown.emit(event)\n }\n }\n }\n\n onDayCellMouseEnter(cell: any): void {\n if (this.utilService.isInitializedDate(this.selectedDateRange.begin) && !this.utilService.isInitializedDate(this.selectedDateRange.end)) {\n for (const w of this.dates) {\n for (const day of w.week) {\n day.range = this.utilService.isDateSameOrEarlier(this.selectedDateRange.begin, day.dateObj) && this.utilService.isDateSameOrEarlier(day.dateObj, cell.dateObj);\n }\n }\n }\n }\n\n onDayCellMouseLeave(): void {\n for (const w of this.dates) {\n for (const day of w.week) {\n day.range = false;\n }\n }\n }\n\n isDateInRange(date: IMyDate): boolean {\n return this.utilService.isDateInRange(date, this.selectedDateRange);\n }\n\n isDateSame(date: IMyDate): boolean {\n return this.utilService.isDateSame(this.selectedDate, date);\n }\n\n isDateRangeBeginOrEndSame(date: IMyDate): boolean {\n return this.utilService.isDateRangeBeginOrEndSame(this.selectedDateRange, date);\n }\n\n isDateRangeBegin(date: IMyDate): boolean {\n return this.utilService.isDateRangeBegin(this.selectedDateRange, date);\n }\n\n isDateRangeEnd(date: IMyDate): boolean {\n return this.utilService.isDateRangeEnd(this.selectedDateRange, date);\n }\n\n isDaySelected(day: IMyCalendarDay) {\n return !this.opts.dateRange && this.isDateSame(day.dateObj) || this.opts.dateRange && this.isDateRangeBeginOrEndSame(day.dateObj);\n }\n}\n","<table class=\"myDpCalTable\" [ngClass]=\"{'ng-myrtl': opts.rtl, 'myDpFooter': opts.showFooterToday, 'myDpNoFooter': !opts.showFooterToday, 'myDpViewChangeAnimation': opts.viewChangeAnimation && viewChanged}\">\n <thead>\n <tr>\n @if (opts.showWeekNumbers && opts.firstDayOfWeek==='mo') {\n <th class=\"myDpWeekDayTitle myDpWeekDayTitleWeekNbr\">#</th>\n }\n @for (d of weekDays; track $index) {\n <th class=\"myDpWeekDayTitle\" scope=\"col\">{{d}}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (w of dates; track $index) {\n <tr>\n @if (opts.showWeekNumbers && opts.firstDayOfWeek==='mo') {\n <td class=\"myDpDaycellWeekNbr\">{{w.weekNbr}}</td>\n }\n @for (d of w.week; track $index) {\n <td\n id=\"d_{{d.row}}_{{d.col}}\"\n class=\"d_{{d.row}}_{{d.col}} myDpDaycell {{d.markedDate.styleClass}} {{d.disabledDate.styleClass}}\"\n [ngClass]=\"{'myDpRangeColor': isDateInRange(d.dateObj) || d.range,\n 'myDpPrevMonth': d.cmo === prevMonthId,\n 'myDpCurrMonth':d.cmo === currMonthId && !d.disabledDate.disabled,\n 'myDpNextMonth': d.cmo === nextMonthId,\n 'myDpSelectedDay':isDaySelected(d),\n 'myDpRangeBegin':this.opts.dateRange && isDateRangeBegin(d.dateObj),\n 'myDpRangeEnd':this.opts.dateRange && isDateRangeEnd(d.dateObj),\n 'myDpDisabled': d.disabledDate.disabled && !d.disabledDate.styleClass.length,\n 'myDpTableSingleDay': !d.disabledDate.disabled}\"\n [attr.aria-current]=\"d.currDay ? 'date' : null\"\n [attr.aria-disabled]=\"d.disabledDate.disabled || null\"\n [attr.aria-selected]=\"isDaySelected(d) || null\"\n [attr.tabindex]=\"!d.disabledDate.disabled ? 0 : -1\"\n (click)=\"onDayCellClicked($event, d)\"\n (keydown)=\"onDayCellKeyDown($event, d)\"\n (mouseenter)=\"onDayCellMouseEnter(d)\"\n (mouseleave)=\"onDayCellMouseLeave()\">\n @if (d.markedDate.marked && d.markedDate.color.length) {\n <span class=\"myDpMarkDate\" [ngStyle]=\"{'border-top': '8px solid ' + d.markedDate.color}\"></span>\n }\n <span class=\"myDpDayValue\"\n [attr.aria-label]=\"[(d.dateObj.month + '/' + d.dateObj.day + '/' + d.dateObj.year | date:'fullDate')]\"\n [ngClass]=\"{'myDpMarkCurrDay': d.currDay && opts.markCurrentDay, 'myDpDimDay': d.highlight && (d.cmo===prevMonthId || d.cmo===nextMonthId || d.disabledDate.disabled), 'myDpHighlight': d.highlight}\">{{d.dateObj.day}}</span>\n </td>\n }\n </tr>\n }\n </tbody>\n</table>\n","import {Component, EventEmitter, Input, OnChanges, AfterViewInit, Output, SimpleChanges, ViewEncapsulation} from \"@angular/core\";\nimport {IMyCalendarMonth} from \"../../interfaces/my-calendar-month.interface\";\nimport {IMyOptions} from \"../../interfaces/my-options.interface\";\nimport {KeyCode} from \"../../enums/key-code.enum\";\nimport {ActiveView} from \"../../enums/active-view.enum\";\nimport {UtilService} from \"../../services/angular-mydatepicker.util.service\";\nimport {OPTS, MONTHS} from \"../../constants/constants\";\n\n@Component({\n selector: \"lib-month-view\",\n templateUrl: \"./month-view.component.html\",\n providers: [UtilService],\n encapsulation: ViewEncapsulation.None,\n standalone: false\n})\nexport class MonthViewComponent implements OnChanges, AfterViewInit {\n @Input() opts: IMyOptions;\n @Input() months: Array<Array<IMyCalendarMonth>>;\n @Input() viewChanged: boolean;\n\n @Output() monthCellClicked: EventEmitter<IMyCalendarMonth> = new EventEmitter<IMyCalendarMonth>();\n @Output() monthCellKeyDown: EventEmitter<any> = new EventEmitter<any>();\n @Output() viewActivated: EventEmitter<ActiveView> = new EventEmitter<ActiveView>();\n\n constructor(private utilService: UtilService) { }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.hasOwnProperty(OPTS)) {\n this.opts = changes[OPTS].currentValue;\n }\n if (changes.hasOwnProperty(MONTHS)) {\n this.months = changes[MONTHS].currentValue;\n }\n }\n\n ngAfterViewInit(): void {\n this.viewActivated.emit(ActiveView.Month);\n }\n\n onMonthCellClicked(event: any, cell: IMyCalendarMonth): void {\n event.stopPropagation();\n\n if (cell.disabled) {\n return;\n }\n\n this.monthCellClicked.emit(cell);\n }\n\n onMonthCellKeyDown(event: any, cell: IMyCalendarMonth) {\n const keyCode: number = this.utilService.getKeyCodeFromEvent(event);\n if (keyCode !== KeyCode.tab) {\n event.preventDefault();\n\n if (keyCode === KeyCode.enter || keyCode === KeyCode.space) {\n this.onMonthCellClicked(event, cell);\n }\n else if (this.opts.moveFocusByArrowKeys) {\n this.monthCellKeyDown.emit(event)\n }\n }\n }\n}\n","<table class=\"myDpMonthTable\" [ngClass]=\"{'ng-myrtl': opts.rtl, 'myDpFooter': opts.showFooterToday, 'myDpNoFooter': !opts.showFooterToday, 'myDpViewChangeAnimation': opts.viewChangeAnimation && viewChanged}\">\n <tbody>\n @for (mr of months; track $index) {\n <tr>\n @for (m of mr; track $index) {\n <td\n id=\"m_{{m.row}}_{{m.col}}\"\n class=\"m_{{m.row}}_{{m.col}} myDpMonthcell\"\n [ngClass]=\"{'myDpSelectedMonth': m.selected, 'myDpDisabled': m.disabled, 'myDpTableSingleMonth': !m.disabled}\"\n [attr.aria-current]=\"m.currMonth ? 'date' : null\"\n [attr.aria-disabled]=\"m.disabled || null\"\n [attr.aria-selected]=\"m.selected || null\"\n [attr.tabindex]=\"!m.disabled ? 0 : -1\"\n (click)=\"onMonthCellClicked($event, m)\"\n (keydown)=\"onMonthCellKeyDown($event, m)\">\n @if (opts.showMonthNumber) {\n <span class=\"myDpMonthNbr\" aria-hidden=\"true\">{{m.nbr}}</span>\n }\n <span class=\"myDpMonthValue\"\n [attr.aria-label]=\"[(m.nbr + '/' + 1 + '/' + m.year | date:'MMMM yyyy')]\"\n [ngClass]=\"{'myDpMarkCurrMonth': m.currMonth && opts.markCurrentMonth}\">{{m.name}}</span>\n </td>\n }\n </tr>\n }\n </tbody>\n</table>\n","import {Component, EventEmitter, Input, OnChanges, AfterViewInit, Output, SimpleChanges, ViewEncapsulation} from \"@angular/core\";\nimport {IMyCalendarYear} from \"../../interfaces/my-calendar-year.interface\";\nimport {IMyOptions} from \"../../interfaces/my-options.interface\";\nimport {KeyCode} from \"../../enums/key-code.enum\";\nimport {ActiveView} from \"../../enums/active-view.enum\";\nimport {UtilService} from \"../../services/angular-mydatepicker.util.service\";\nimport {YEARS, OPTS} from \"../../constants/constants\";\n\n@Component({\n selector: \"lib-year-view\",\n templateUrl: \"./year-view.component.html\",\n providers: [UtilService],\n encapsulation: ViewEncapsulation.None,\n standalone: false\n})\nexport class YearViewComponent implements OnChanges, AfterViewInit {\n @Input() opts: IMyOptions;\n @Input() years: Array<Array<IMyCalendarYear>>;\n @Input() viewChanged: boolean;\n\n @Output() yearCellClicked: EventEmitter<IMyCalendarYear> = new EventEmitter<IMyCalendarYear>();\n @Output() yearCellKeyDown: EventEmitter<any> = new EventEmitter<any>();\n @Output() viewActivated: EventEmitter<ActiveView> = new EventEmitter<ActiveView>();\n\n constructor(private utilService: UtilService) { }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.hasOwnProperty(OPTS)) {\n this.opts = changes[OPTS].currentValue;\n }\n if (changes.hasOwnProperty(YEARS)) {\n this.years = changes[YEARS].currentValue;\n }\n }\n\n ngAfterViewInit(): void {\n this.viewActivated.emit(ActiveView.Year);\n }\n\n onYearCellClicked(event: any, cell: IMyCalendarYear): void {\n event.stopPropagation();\n\n if (cell.disabled) {\n return;\n }\n\n this.yearCellClicked.emit(cell);\n }\n\n onYearCellKeyDown(event: any, cell: IMyCalendarYear) {\n const keyCode: number = this.utilService.getKeyCodeFromEvent(event);\n if (keyCode !== KeyCode.tab) {\n event.preventDefault();\n\n if (keyCode === KeyCode.enter || keyCode === KeyCode.space) {\n this.onYearCellClicked(event, cell);\n }\n else if (this.opts.moveFocusByArrowKeys) {\n this.yearCellKeyDown.emit(event)\n }\n }\n }\n}\n","<table class=\"myDpYearTable\" [ngClass]=\"{'ng-myrtl': opts.rtl, 'myDpFooter': opts.showFooterToday, 'myDpNoFooter': !opts.showFooterToday, 'myDpViewChangeAnimation': opts.viewChangeAnimation && viewChanged}\">\n <tbody>\n @for (yr of years; track $index) {\n <tr>\n @for (y of yr; track $index) {\n <td\n id=\"y_{{y.row}}_{{y.col}}\"\n class=\"y_{{y.row}}_{{y.col}} myDpYearcell\"\n [ngClass]=\"{'myDpSelectedYear': y.selected, 'myDpDisabled': y.disabled, 'myDpTableSingleYear': !y.disabled}\"\n [attr.aria-current]=\"y.currYear ? 'date' : null\"\n [attr.aria-disabled]=\"y.disabled || null\"\n [attr.aria-selected]=\"y.selected || null\"\n [attr.tabindex]=\"!y.disabled ? 0 : -1\"\n (click)=\"onYearCellClicked($event, y)\"\n (keydown)=\"onYearCellKeyDown($event, y)\">\n <span class=\"myDpYearValue\"\n [attr.aria-label]=\"[(1 + '/' + 1 + '/' + y.year | date:'yyyy')]\"\n [ngClass]=\"{'myDpMarkCurrYear': y.currYear && opts.markCurrentYear}\">{{y.year}}</span>\n </td>\n }\n </tr>\n }\n </tbody>\n</table>\n","import {Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewEncapsulation} from \"@angular/core\";\nimport {IMyOptions} from \"../../interfaces/my-options.interface\";\nimport {UtilService} from \"../../services/angular-mydatepicker.util.service\";\nimport {OPTS, SPACE_STR, EMPTY_STR} from \"../../constants/constants\";\n\n@Component({\n selector: \"lib-footer-bar\",\n templateUrl: \"./footer-bar.component.html\",\n providers: [UtilService],\n encapsulation: ViewEncapsulation.None,\n standalone: false\n})\nexport class FooterBarComponent implements OnChanges {\n @Input() opts: IMyOptions;\n @Output() footerBarTxtClicked: EventEmitter<void> = new EventEmitter<void>();\n\n footerBarTxt: string = EMPTY_STR;\n\n constructor(private utilService: UtilService) { }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes.hasOwnProperty(OPTS)) {\n this.opts = changes[OPTS].currentValue;\n\n const {dateFormat, monthLabels, todayTxt} = this.opts;\n\n const today = this.utilService.getToday();\n this.footerBarTxt = todayTxt + (todayTxt.length > 0 ? SPACE_STR : EMPTY_STR) + \n this.utilService.formatDate(today, dateFormat, monthLabels);\n }\n }\n\n onFooterBarTxtClicked(): void {\n this.footerBarTxtClicked.emit()\n }\n}","<div class=\"myDpFooterBar\">\n <button type=\"button\" class=\"myDpHeaderBtn myDpFooterBtn\" (click)=\"onFooterBarTxtClicked()\">{{footerBarTxt}}</button>\n</div>","import {Directive, ElementRef, AfterViewInit, Input} from \"@angular/core\";\n\n@Directive({\n selector: \"[libAngularMyDatePickerCalendar]\",\n standalone: false\n})\nexport class AngularMyDatePickerCalendarDirective implements AfterViewInit {\n @Input() libAngularMyDatePickerCalendar: any;\n\n constructor(private el: ElementRef) { }\n\n ngAfterViewInit(): void {\n const {inline, selectorHeight, selectorWidth, selectorPos} = this.libAngularMyDatePickerCalendar;\n const {style} = this.el.nativeElement;\n \n style.height = selectorHeight;\n style.width = selectorWidth;\n style.top = !inline ? selectorPos.top : \"0\";\n style.left = !inline ? selectorPos.left : \"0\";\n }\n}\n","import {Component, ElementRef, ViewEncapsulation, ViewChild, Renderer2, ChangeDetectorRef, AfterViewInit, OnDestroy, HostBinding} from \"@angular/core\";\nimport {IMyDate} from \"../../interfaces/my-date.interface\";\nimport {IMyDateRange} from \"../../interfaces/my-date-range.interface\";\nimport {IMyMonth} from \"../../interfaces/my-month.interface\";\nimport {IMyCalendarDay} from \"../../interfaces/my-calendar-day.interface\";\nimport {IMyCalendarMonth} from \"../../interfaces/my-calendar-month.interface\";\nimport {IMyCalendarYear} from \"../../interfaces/my-calendar-year.interface\";\nimport {IMyWeek} from \"../../interfaces/my-week.interface\";\nimport {IMyOptions} from \"../../interfaces/my-options.interface\";\nimport {IMySelectorPosition} from \"../../interfaces/my-selector-pos.interface\";\nimport {IMyCale