@anglr/datetime 7.0.0-beta.20230815120707 → 7.0.0-beta.20230817095054
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +40 -9
- package/date-fns/package.json +3 -4
- package/{es2020 → es2022}/date-fns/src/services/dateFnsDateApi.service.js +31 -17
- package/es2022/date-fns/src/services/dateFnsDateApi.service.js.map +1 -0
- package/{es2020 → es2022}/moment/src/services/momentDateApi.service.js +20 -8
- package/es2022/moment/src/services/momentDateApi.service.js.map +1 -0
- package/{es2015/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js → es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js} +56 -73
- package/es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js.map +1 -0
- package/{es2015 → es2022}/src/directives/datePickerInput/datePickerInput.directive.js +5 -4
- package/es2022/src/directives/datePickerInput/datePickerInput.directive.js.map +1 -0
- package/{es2020 → es2022}/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js +29 -18
- package/{es2015 → es2022}/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js.map +1 -1
- package/{es2020 → es2022}/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js +5 -4
- package/es2022/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js.map +1 -0
- package/{es2020 → es2022}/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js +5 -4
- package/es2022/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js.map +1 -0
- package/{es2020 → es2022}/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js +9 -4
- package/es2022/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js.map +1 -0
- package/{es2020 → es2022}/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js +5 -4
- package/es2022/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js.map +1 -0
- package/{es2020 → es2022}/src/directives/withNow/withNow.directive.js +10 -9
- package/es2022/src/directives/withNow/withNow.directive.js.map +1 -0
- package/{es2015 → es2022}/src/directives/withTime/withTime.directive.js +5 -4
- package/es2022/src/directives/withTime/withTime.directive.js.map +1 -0
- package/{es2020 → es2022}/src/directives/withToday/withToday.directive.js +10 -9
- package/es2022/src/directives/withToday/withToday.directive.js.map +1 -0
- package/{es2020 → es2022}/src/misc/validators.js +2 -2
- package/es2022/src/misc/validators.js.map +1 -0
- package/{es2020 → es2022}/src/modules/calendar/components/monthCalendar/monthCalendar.component.js +65 -39
- package/es2022/src/modules/calendar/components/monthCalendar/monthCalendar.component.js.map +1 -0
- package/{es2020 → es2022}/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js +6 -4
- package/es2022/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js.map +1 -0
- package/{es2015 → es2022}/src/modules/calendar/modules/monthCalendar.module.js +8 -7
- package/es2022/src/modules/calendar/modules/monthCalendar.module.js.map +1 -0
- package/{es2020 → es2022}/src/modules/calendar/services/eventParser/eventParser.service.js +6 -4
- package/es2022/src/modules/calendar/services/eventParser/eventParser.service.js.map +1 -0
- package/es2022/src/modules/datePipes.module.js +29 -0
- package/es2022/src/modules/datePipes.module.js.map +1 -0
- package/{es2020 → es2022}/src/modules/dateTime/directives/dateTime/dateTime.directive.js +69 -41
- package/es2022/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +1 -0
- package/{es2015 → es2022}/src/modules/dateTime/directives/dateTimeBase.js +27 -22
- package/es2022/src/modules/dateTime/directives/dateTimeBase.js.map +1 -0
- package/{es2020 → es2022}/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js +17 -15
- package/es2022/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js.map +1 -0
- package/{es2020 → es2022}/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +36 -27
- package/es2022/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -0
- package/{es2015 → es2022}/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js +17 -15
- package/es2022/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js.map +1 -0
- package/{es2020 → es2022}/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js +17 -15
- package/es2022/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js.map +1 -0
- package/{es2020 → es2022}/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js +17 -15
- package/es2022/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map +1 -0
- package/{es2015 → es2022}/src/modules/dateTime/modules/dateTime.module.js +16 -15
- package/es2022/src/modules/dateTime/modules/dateTime.module.js.map +1 -0
- package/{es2020 → es2022}/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js +58 -39
- package/es2022/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js.map +1 -0
- package/{es2020 → es2022}/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +61 -24
- package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -0
- package/{es2020 → es2022}/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +15 -14
- package/es2022/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -0
- package/{es2020 → es2022}/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js +6 -4
- package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js.map +1 -0
- package/{es2020 → es2022}/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js +24 -27
- package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js.map +1 -0
- package/{es2020 → es2022}/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js +10 -12
- package/es2022/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js.map +1 -0
- package/{es2020 → es2022}/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +52 -21
- package/es2022/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +1 -0
- package/{es2020 → es2022}/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.js.map +1 -1
- package/{es2020 → es2022}/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js +57 -41
- package/es2022/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js.map +1 -0
- package/es2022/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js +37 -0
- package/es2022/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js.map +1 -0
- package/{es2015 → es2022}/src/modules/dateTimePicker/modules/dateTimePicker.module.js +7 -6
- package/es2022/src/modules/dateTimePicker/modules/dateTimePicker.module.js.map +1 -0
- package/{es2015 → es2022}/src/pipes/dateConvert.pipe.js +6 -4
- package/es2022/src/pipes/dateConvert.pipe.js.map +1 -0
- package/{es2015 → es2022}/src/pipes/dateFormat.pipe.js +7 -4
- package/es2022/src/pipes/dateFormat.pipe.js.map +1 -0
- package/{es2020 → es2022}/src/services/datePositionParser/datePositionParser.service.js +19 -17
- package/es2022/src/services/datePositionParser/datePositionParser.service.js.map +1 -0
- package/{es2020 → es2022}/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js +11 -4
- package/es2022/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js.map +1 -0
- package/{es2020 → es2022}/src/services/dateValueProvider/dateValueProvider.service.js +6 -4
- package/es2022/src/services/dateValueProvider/dateValueProvider.service.js.map +1 -0
- package/moment/package.json +3 -4
- package/package.json +50 -58
- package/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.d.ts +67 -0
- package/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.d.ts.map +1 -0
- package/src/misc/types.d.ts +2 -2
- package/src/misc/types.d.ts.map +1 -1
- package/src/modules/calendar/components/monthCalendar/monthCalendar.component.d.ts +1 -1
- package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts +1 -1
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts +1 -1
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts +1 -1
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.d.ts +6 -0
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.d.ts +1 -1
- package/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.d.ts +1 -1
- package/src/services/dateApi/dateApi.interface.d.ts +2 -2
- package/src/services/dateApi/dateApi.interface.d.ts.map +1 -1
- package/version.bak +1 -1
- package/es2015/date-fns/src/services/dateFnsDateApi.service.js +0 -590
- package/es2015/date-fns/src/services/dateFnsDateApi.service.js.map +0 -1
- package/es2015/moment/src/services/momentDateApi.service.js +0 -547
- package/es2015/moment/src/services/momentDateApi.service.js.map +0 -1
- package/es2015/src/directives/datePickerInput/datePickerInput.directive.js.map +0 -1
- package/es2015/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js +0 -325
- package/es2015/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js +0 -29
- package/es2015/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js.map +0 -1
- package/es2015/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js +0 -37
- package/es2015/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js.map +0 -1
- package/es2015/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js +0 -137
- package/es2015/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js.map +0 -1
- package/es2015/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js +0 -29
- package/es2015/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js.map +0 -1
- package/es2015/src/directives/withNow/withNow.directive.js +0 -44
- package/es2015/src/directives/withNow/withNow.directive.js.map +0 -1
- package/es2015/src/directives/withTime/withTime.directive.js.map +0 -1
- package/es2015/src/directives/withToday/withToday.directive.js +0 -44
- package/es2015/src/directives/withToday/withToday.directive.js.map +0 -1
- package/es2015/src/misc/utils.js +0 -164
- package/es2015/src/misc/utils.js.map +0 -1
- package/es2015/src/misc/validators.js +0 -142
- package/es2015/src/misc/validators.js.map +0 -1
- package/es2015/src/modules/calendar/components/monthCalendar/monthCalendar.component.js +0 -198
- package/es2015/src/modules/calendar/components/monthCalendar/monthCalendar.component.js.map +0 -1
- package/es2015/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js +0 -27
- package/es2015/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js.map +0 -1
- package/es2015/src/modules/calendar/modules/monthCalendar.module.js.map +0 -1
- package/es2015/src/modules/calendar/services/eventParser/eventParser.service.js +0 -75
- package/es2015/src/modules/calendar/services/eventParser/eventParser.service.js.map +0 -1
- package/es2015/src/modules/datePipes.module.js +0 -28
- package/es2015/src/modules/datePipes.module.js.map +0 -1
- package/es2015/src/modules/dateTime/directives/dateTime/dateTime.directive.js +0 -254
- package/es2015/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +0 -1
- package/es2015/src/modules/dateTime/directives/dateTimeBase.js.map +0 -1
- package/es2015/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js +0 -77
- package/es2015/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js.map +0 -1
- package/es2015/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +0 -1
- package/es2015/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js.map +0 -1
- package/es2015/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js +0 -70
- package/es2015/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js.map +0 -1
- package/es2015/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js +0 -63
- package/es2015/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map +0 -1
- package/es2015/src/modules/dateTime/modules/dateTime.module.js.map +0 -1
- package/es2015/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js +0 -186
- package/es2015/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js.map +0 -1
- package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +0 -299
- package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +0 -1
- package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +0 -151
- package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +0 -1
- package/es2015/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js +0 -123
- package/es2015/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js.map +0 -1
- package/es2015/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js +0 -137
- package/es2015/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js.map +0 -1
- package/es2015/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js +0 -126
- package/es2015/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js.map +0 -1
- package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +0 -261
- package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +0 -1
- package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.js.map +0 -1
- package/es2015/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js +0 -222
- package/es2015/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js.map +0 -1
- package/es2015/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js +0 -30
- package/es2015/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js.map +0 -1
- package/es2015/src/modules/dateTimePicker/modules/dateTimePicker.module.js.map +0 -1
- package/es2015/src/pipes/dateConvert.pipe.js.map +0 -1
- package/es2015/src/pipes/dateFormat.pipe.js.map +0 -1
- package/es2015/src/services/datePositionParser/datePositionParser.service.js +0 -243
- package/es2015/src/services/datePositionParser/datePositionParser.service.js.map +0 -1
- package/es2015/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js +0 -81
- package/es2015/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js.map +0 -1
- package/es2015/src/services/dateValueProvider/dateValueProvider.service.js +0 -69
- package/es2015/src/services/dateValueProvider/dateValueProvider.service.js.map +0 -1
- package/es2020/date-fns/src/index.js +0 -4
- package/es2020/date-fns/src/index.js.map +0 -1
- package/es2020/date-fns/src/misc/tokens.js +0 -31
- package/es2020/date-fns/src/misc/tokens.js.map +0 -1
- package/es2020/date-fns/src/services/dateFnsDateApi.service.js.map +0 -1
- package/es2020/date-fns/src/services/dateFnsLocale.service.js +0 -2
- package/es2020/date-fns/src/services/dateFnsLocale.service.js.map +0 -1
- package/es2020/moment/src/index.js +0 -3
- package/es2020/moment/src/index.js.map +0 -1
- package/es2020/moment/src/misc/tokens.js +0 -26
- package/es2020/moment/src/misc/tokens.js.map +0 -1
- package/es2020/moment/src/services/momentDateApi.service.js.map +0 -1
- package/es2020/src/directives/datePickerInput/datePickerInput.directive.js +0 -37
- package/es2020/src/directives/datePickerInput/datePickerInput.directive.js.map +0 -1
- package/es2020/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js.map +0 -1
- package/es2020/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js.map +0 -1
- package/es2020/src/directives/index.js +0 -10
- package/es2020/src/directives/index.js.map +0 -1
- package/es2020/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js.map +0 -1
- package/es2020/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js.map +0 -1
- package/es2020/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js.map +0 -1
- package/es2020/src/directives/withNow/withNow.directive.js.map +0 -1
- package/es2020/src/directives/withTime/withTime.directive.js +0 -32
- package/es2020/src/directives/withTime/withTime.directive.js.map +0 -1
- package/es2020/src/directives/withToday/withToday.directive.js.map +0 -1
- package/es2020/src/index.js +0 -13
- package/es2020/src/index.js.map +0 -1
- package/es2020/src/interfaces/dateTime/datetime.interface.js +0 -2
- package/es2020/src/interfaces/dateTime/datetime.interface.js.map +0 -1
- package/es2020/src/interfaces/dateTimeInput/dateTimeInput.interface.js +0 -2
- package/es2020/src/interfaces/dateTimeInput/dateTimeInput.interface.js.map +0 -1
- package/es2020/src/interfaces/formatProvider/formatProvider.interface.js +0 -2
- package/es2020/src/interfaces/formatProvider/formatProvider.interface.js.map +0 -1
- package/es2020/src/interfaces/index.js +0 -4
- package/es2020/src/interfaces/index.js.map +0 -1
- package/es2020/src/legacy/picker/components/picker/picker.component.animations.js +0 -94
- package/es2020/src/legacy/picker/components/picker/picker.component.animations.js.map +0 -1
- package/es2020/src/misc/constants.js +0 -33
- package/es2020/src/misc/constants.js.map +0 -1
- package/es2020/src/misc/enums.js +0 -23
- package/es2020/src/misc/enums.js.map +0 -1
- package/es2020/src/misc/tokens.js +0 -38
- package/es2020/src/misc/tokens.js.map +0 -1
- package/es2020/src/misc/types.js +0 -2
- package/es2020/src/misc/types.js.map +0 -1
- package/es2020/src/misc/validators.js.map +0 -1
- package/es2020/src/modules/calendar/components/index.js +0 -2
- package/es2020/src/modules/calendar/components/index.js.map +0 -1
- package/es2020/src/modules/calendar/components/monthCalendar/monthCalendar.component.js.map +0 -1
- package/es2020/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.context.js +0 -2
- package/es2020/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.context.js.map +0 -1
- package/es2020/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js.map +0 -1
- package/es2020/src/modules/calendar/directives/index.js +0 -3
- package/es2020/src/modules/calendar/directives/index.js.map +0 -1
- package/es2020/src/modules/calendar/index.js +0 -7
- package/es2020/src/modules/calendar/index.js.map +0 -1
- package/es2020/src/modules/calendar/interfaces/calendarDayData.interface.js +0 -2
- package/es2020/src/modules/calendar/interfaces/calendarDayData.interface.js.map +0 -1
- package/es2020/src/modules/calendar/interfaces/calendarEventDayMetadata.interface.js +0 -2
- package/es2020/src/modules/calendar/interfaces/calendarEventDayMetadata.interface.js.map +0 -1
- package/es2020/src/modules/calendar/interfaces/eventData.interface.js +0 -2
- package/es2020/src/modules/calendar/interfaces/eventData.interface.js.map +0 -1
- package/es2020/src/modules/calendar/interfaces/index.js +0 -4
- package/es2020/src/modules/calendar/interfaces/index.js.map +0 -1
- package/es2020/src/modules/calendar/misc/enums/calendarDayAspectRatio.enum.js +0 -27
- package/es2020/src/modules/calendar/misc/enums/calendarDayAspectRatio.enum.js.map +0 -1
- package/es2020/src/modules/calendar/misc/enums/index.js +0 -3
- package/es2020/src/modules/calendar/misc/enums/index.js.map +0 -1
- package/es2020/src/modules/calendar/misc/enums/monthCalendarDayFormat.enum.js +0 -19
- package/es2020/src/modules/calendar/misc/enums/monthCalendarDayFormat.enum.js.map +0 -1
- package/es2020/src/modules/calendar/misc/index.js +0 -2
- package/es2020/src/modules/calendar/misc/index.js.map +0 -1
- package/es2020/src/modules/calendar/modules/index.js +0 -2
- package/es2020/src/modules/calendar/modules/index.js.map +0 -1
- package/es2020/src/modules/calendar/modules/monthCalendar.module.js +0 -32
- package/es2020/src/modules/calendar/modules/monthCalendar.module.js.map +0 -1
- package/es2020/src/modules/calendar/services/eventParser/eventParser.service.js.map +0 -1
- package/es2020/src/modules/calendar/services/index.js +0 -2
- package/es2020/src/modules/calendar/services/index.js.map +0 -1
- package/es2020/src/modules/datePipes.module.js +0 -28
- package/es2020/src/modules/datePipes.module.js.map +0 -1
- package/es2020/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +0 -1
- package/es2020/src/modules/dateTime/directives/dateTimeBase.js +0 -61
- package/es2020/src/modules/dateTime/directives/dateTimeBase.js.map +0 -1
- package/es2020/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js.map +0 -1
- package/es2020/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +0 -1
- package/es2020/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js +0 -70
- package/es2020/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js.map +0 -1
- package/es2020/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js.map +0 -1
- package/es2020/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map +0 -1
- package/es2020/src/modules/dateTime/directives/index.js +0 -8
- package/es2020/src/modules/dateTime/directives/index.js.map +0 -1
- package/es2020/src/modules/dateTime/index.js +0 -3
- package/es2020/src/modules/dateTime/index.js.map +0 -1
- package/es2020/src/modules/dateTime/modules/dateTime.module.js +0 -43
- package/es2020/src/modules/dateTime/modules/dateTime.module.js.map +0 -1
- package/es2020/src/modules/dateTime/modules/index.js +0 -2
- package/es2020/src/modules/dateTime/modules/index.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.interface.js +0 -2
- package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.interface.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/components/index.js +0 -9
- package/es2020/src/modules/dateTimePicker/components/index.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.data.js +0 -347
- package/es2020/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.data.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.js +0 -2
- package/es2020/src/modules/dateTimePicker/directives/index.js +0 -6
- package/es2020/src/modules/dateTimePicker/directives/index.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/directives/loopScroll/loopScroll.interface.js +0 -2
- package/es2020/src/modules/dateTimePicker/directives/loopScroll/loopScroll.interface.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js +0 -30
- package/es2020/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/index.js +0 -6
- package/es2020/src/modules/dateTimePicker/index.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.js +0 -2
- package/es2020/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/interfaces/index.js +0 -3
- package/es2020/src/modules/dateTimePicker/interfaces/index.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/interfaces/periodData/periodData.interface.js +0 -2
- package/es2020/src/modules/dateTimePicker/interfaces/periodData/periodData.interface.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/misc/tokens.js +0 -10
- package/es2020/src/modules/dateTimePicker/misc/tokens.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/modules/dateTimePicker.module.js +0 -29
- package/es2020/src/modules/dateTimePicker/modules/dateTimePicker.module.js.map +0 -1
- package/es2020/src/modules/dateTimePicker/modules/index.js +0 -2
- package/es2020/src/modules/dateTimePicker/modules/index.js.map +0 -1
- package/es2020/src/modules/index.js +0 -5
- package/es2020/src/modules/index.js.map +0 -1
- package/es2020/src/pipes/dateConvert.pipe.js +0 -35
- package/es2020/src/pipes/dateConvert.pipe.js.map +0 -1
- package/es2020/src/pipes/dateFormat.pipe.js +0 -39
- package/es2020/src/pipes/dateFormat.pipe.js.map +0 -1
- package/es2020/src/services/dateApi/dateApi.interface.js +0 -2
- package/es2020/src/services/dateApi/dateApi.interface.js.map +0 -1
- package/es2020/src/services/datePositionParser/datePositionParser.interface.js +0 -2
- package/es2020/src/services/datePositionParser/datePositionParser.interface.js.map +0 -1
- package/es2020/src/services/datePositionParser/datePositionParser.service.js.map +0 -1
- package/es2020/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js.map +0 -1
- package/es2020/src/services/dateValueProvider/dateValueProvider.service.js.map +0 -1
- package/es2020/src/services/index.js +0 -6
- package/es2020/src/services/index.js.map +0 -1
- package/src/dark.scss +0 -38
- package/src/default.scss +0 -33
- package/src/theme.scss +0 -80
- /package/{es2015 → es2022}/date-fns/src/index.js +0 -0
- /package/{es2015 → es2022}/date-fns/src/index.js.map +0 -0
- /package/{es2015 → es2022}/date-fns/src/misc/tokens.js +0 -0
- /package/{es2015 → es2022}/date-fns/src/misc/tokens.js.map +0 -0
- /package/{es2015 → es2022}/date-fns/src/services/dateFnsLocale.service.js +0 -0
- /package/{es2015 → es2022}/date-fns/src/services/dateFnsLocale.service.js.map +0 -0
- /package/{es2015 → es2022}/moment/src/index.js +0 -0
- /package/{es2015 → es2022}/moment/src/index.js.map +0 -0
- /package/{es2015 → es2022}/moment/src/misc/tokens.js +0 -0
- /package/{es2015 → es2022}/moment/src/misc/tokens.js.map +0 -0
- /package/{es2015 → es2022}/src/directives/index.js +0 -0
- /package/{es2015 → es2022}/src/directives/index.js.map +0 -0
- /package/{es2015 → es2022}/src/index.js +0 -0
- /package/{es2015 → es2022}/src/index.js.map +0 -0
- /package/{es2015 → es2022}/src/interfaces/dateTime/datetime.interface.js +0 -0
- /package/{es2015 → es2022}/src/interfaces/dateTime/datetime.interface.js.map +0 -0
- /package/{es2015 → es2022}/src/interfaces/dateTimeInput/dateTimeInput.interface.js +0 -0
- /package/{es2015 → es2022}/src/interfaces/dateTimeInput/dateTimeInput.interface.js.map +0 -0
- /package/{es2015 → es2022}/src/interfaces/formatProvider/formatProvider.interface.js +0 -0
- /package/{es2015 → es2022}/src/interfaces/formatProvider/formatProvider.interface.js.map +0 -0
- /package/{es2015 → es2022}/src/interfaces/index.js +0 -0
- /package/{es2015 → es2022}/src/interfaces/index.js.map +0 -0
- /package/{es2015 → es2022}/src/legacy/picker/components/picker/picker.component.animations.js +0 -0
- /package/{es2015 → es2022}/src/legacy/picker/components/picker/picker.component.animations.js.map +0 -0
- /package/{es2015 → es2022}/src/misc/constants.js +0 -0
- /package/{es2015 → es2022}/src/misc/constants.js.map +0 -0
- /package/{es2015 → es2022}/src/misc/enums.js +0 -0
- /package/{es2015 → es2022}/src/misc/enums.js.map +0 -0
- /package/{es2015 → es2022}/src/misc/tokens.js +0 -0
- /package/{es2015 → es2022}/src/misc/tokens.js.map +0 -0
- /package/{es2015 → es2022}/src/misc/types.js +0 -0
- /package/{es2015 → es2022}/src/misc/types.js.map +0 -0
- /package/{es2020 → es2022}/src/misc/utils.js +0 -0
- /package/{es2020 → es2022}/src/misc/utils.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/components/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/components/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.context.js +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.context.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/directives/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/directives/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/interfaces/calendarDayData.interface.js +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/interfaces/calendarDayData.interface.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/interfaces/calendarEventDayMetadata.interface.js +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/interfaces/calendarEventDayMetadata.interface.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/interfaces/eventData.interface.js +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/interfaces/eventData.interface.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/interfaces/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/interfaces/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/misc/enums/calendarDayAspectRatio.enum.js +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/misc/enums/calendarDayAspectRatio.enum.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/misc/enums/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/misc/enums/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/misc/enums/monthCalendarDayFormat.enum.js +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/misc/enums/monthCalendarDayFormat.enum.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/misc/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/misc/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/modules/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/modules/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/services/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/calendar/services/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/dateTime/directives/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/dateTime/directives/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/dateTime/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/dateTime/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/dateTime/modules/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/dateTime/modules/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.interface.js +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.interface.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/components/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/components/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.data.js +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.data.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.js +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/directives/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/directives/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/directives/loopScroll/loopScroll.interface.js +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/directives/loopScroll/loopScroll.interface.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.js +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/interfaces/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/interfaces/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/interfaces/periodData/periodData.interface.js +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/interfaces/periodData/periodData.interface.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/misc/tokens.js +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/misc/tokens.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/modules/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/dateTimePicker/modules/index.js.map +0 -0
- /package/{es2015 → es2022}/src/modules/index.js +0 -0
- /package/{es2015 → es2022}/src/modules/index.js.map +0 -0
- /package/{es2015 → es2022}/src/services/dateApi/dateApi.interface.js +0 -0
- /package/{es2015 → es2022}/src/services/dateApi/dateApi.interface.js.map +0 -0
- /package/{es2015 → es2022}/src/services/datePositionParser/datePositionParser.interface.js +0 -0
- /package/{es2015 → es2022}/src/services/datePositionParser/datePositionParser.interface.js.map +0 -0
- /package/{es2015 → es2022}/src/services/index.js +0 -0
- /package/{es2015 → es2022}/src/services/index.js.map +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withTime.directive.js","sourceRoot":"","sources":["../../../../src/directives/withTime/withTime.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,2BAA2B,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,mBAAmB,EAAC,MAAM,eAAe,CAAC;;;AAE/K;;GAEG;AAMH,MAAM,OAAO,mBAAmB;IAE5B,iEAAiE;IACjE,YAAY,MAAwC,EACxC,QAAoC;QAE5C,MAAM,CAAC,aAAa;YACpB;gBACI,iBAAiB,EACjB;oBACI,MAAM,EAAE,2BAA2B;oBACnC,KAAK,EAAE,oBAAoB;oBAC3B,OAAO,EAAE,sBAAsB;oBAC/B,MAAM,EAAE,qBAAqB;iBAChC;aACJ,CAAC;QAEF,QAAQ,CAAC,MAAM,GAAG,UAAU,CAAC;IACjC,CAAC;;gHAlBQ,mBAAmB;oGAAnB,mBAAmB;2FAAnB,mBAAmB;kBAL/B,SAAS;mBACV;oBACI,QAAQ,EAAE,kCAAkC;oBAC5C,UAAU,EAAE,IAAI;iBACnB","sourcesContent":["import {Directive} from '@angular/core';\n\nimport {RollerTimePickerSAComponent, DateTimePickerSADirective, DayPickerSAComponent, MonthPickerSAComponent, YearPickerSAComponent, DateTimeSADirective} from '../../modules';\n\n/**\n * Directive that sets up usage of date time picker to use time format and time picker\n */\n@Directive(\n{\n selector: '[dateTime][withPicker][withTime]',\n standalone: true,\n})\nexport class WithTimeSADirective<TDate = unknown>\n{\n //######################### constructor #########################\n constructor(picker: DateTimePickerSADirective<TDate>,\n dateTime: DateTimeSADirective<TDate>,)\n {\n picker.pickerOptions = \n {\n periodsDefinition:\n {\n 'time': RollerTimePickerSAComponent,\n 'day': DayPickerSAComponent,\n 'month': MonthPickerSAComponent,\n 'year': YearPickerSAComponent,\n },\n };\n\n dateTime.format = 'dateTime';\n }\n}"]}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Directive, Inject } from '@angular/core';
|
|
2
|
-
import { Subscription } from 'rxjs';
|
|
3
|
-
import { DATE_API } from '../../misc/tokens';
|
|
4
|
-
import { DateTimeInputSADirective } from '../../modules';
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
import * as i1 from "../../modules";
|
|
7
|
-
/**
|
|
8
|
-
* Directive that sets today (start of a day) as day for empty date time on focus
|
|
9
|
-
*/
|
|
10
|
-
export class WithTodaySADirective {
|
|
11
|
-
//######################### constructor #########################
|
|
12
|
-
constructor(input, dateApi) {
|
|
13
|
-
//######################### protected fields #########################
|
|
14
|
-
/**
|
|
15
|
-
* Subscriptions created during initialization
|
|
16
|
-
*/
|
|
17
|
-
this.initSubscriptions = new Subscription();
|
|
18
|
-
this.initSubscriptions.add(input.focus.subscribe(() => {
|
|
19
|
-
if (!input.value) {
|
|
20
|
-
input.value = dateApi.now().startOfDay().value;
|
|
21
|
-
}
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
//######################### public methods - implementation of OnDestroy #########################
|
|
25
|
-
/**
|
|
26
|
-
* Called when component is destroyed
|
|
27
|
-
*/
|
|
28
|
-
ngOnDestroy() {
|
|
29
|
-
this.initSubscriptions.unsubscribe();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
WithTodaySADirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: WithTodaySADirective, deps: [{ token: i1.DateTimeInputSADirective }, { token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive });
|
|
33
|
-
WithTodaySADirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.4", type: WithTodaySADirective, isStandalone: true, selector: "[dateTime][withToday]", ngImport: i0 });
|
|
34
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: WithTodaySADirective, decorators: [{
|
|
35
|
-
type: Directive,
|
|
36
|
-
args: [{
|
|
37
|
-
selector: '[dateTime][withToday]',
|
|
38
|
-
standalone: true,
|
|
39
|
-
}]
|
|
40
|
-
}], ctorParameters: function () { return [{ type: i1.DateTimeInputSADirective }, { type: undefined, decorators: [{
|
|
41
|
-
type: Inject,
|
|
42
|
-
args: [DATE_API]
|
|
43
|
-
}] }]; } });
|
|
44
|
-
//# sourceMappingURL=withToday.directive.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"withToday.directive.js","sourceRoot":"","sources":["../../../../src/directives/withToday/withToday.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAY,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,wBAAwB,EAAC,MAAM,eAAe,CAAC;;;AAGvD;;GAEG;AAMH,MAAM,OAAO,oBAAoB;IAS7B,iEAAiE;IACjE,YAAY,KAAsC,EACpB,OAAuB;QATrD,sEAAsE;QAEtE;;WAEG;QACO,sBAAiB,GAAiB,IAAI,YAAY,EAAE,CAAC;QAM3D,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YAElD,IAAG,CAAC,KAAK,CAAC,KAAK,EACf;gBACI,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC;aAClD;QACL,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;IAED,kGAAkG;IAElG;;OAEG;IACI,WAAW;QAEd,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,CAAC;IACzC,CAAC;;iHA9BQ,oBAAoB,0DAWT,QAAQ;qGAXnB,oBAAoB;2FAApB,oBAAoB;kBALhC,SAAS;mBACV;oBACI,QAAQ,EAAE,uBAAuB;oBACjC,UAAU,EAAE,IAAI;iBACnB;;0BAYgB,MAAM;2BAAC,QAAQ","sourcesContent":["import {Directive, Inject, OnDestroy} from '@angular/core';\nimport {Subscription} from 'rxjs';\n\nimport {DATE_API} from '../../misc/tokens';\nimport {DateTimeInputSADirective} from '../../modules';\nimport {DateApi} from '../../services';\n\n/**\n * Directive that sets today (start of a day) as day for empty date time on focus\n */\n@Directive(\n{\n selector: '[dateTime][withToday]',\n standalone: true,\n})\nexport class WithTodaySADirective<TDate = unknown> implements OnDestroy\n{\n //######################### protected fields #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected initSubscriptions: Subscription = new Subscription();\n\n //######################### constructor #########################\n constructor(input: DateTimeInputSADirective<TDate>,\n @Inject(DATE_API) dateApi: DateApi<TDate>,)\n {\n this.initSubscriptions.add(input.focus.subscribe(() =>\n {\n if(!input.value)\n {\n input.value = dateApi.now().startOfDay().value;\n }\n }));\n }\n \n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.initSubscriptions.unsubscribe();\n }\n}"]}
|
package/es2015/src/misc/utils.js
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import { isBlank, isJsObject, isPresent, isString, nameof } from '@jscrpt/common';
|
|
2
|
-
import { DateTimeValueFormat } from './enums';
|
|
3
|
-
/**
|
|
4
|
-
* Parses date time input output value
|
|
5
|
-
* @param value - Value to be parsed
|
|
6
|
-
* @param dateApi - Date api used for obtaining result
|
|
7
|
-
* @param dateTimeFormat - Date time format type, optional, if not specified autodetection of format will be used
|
|
8
|
-
* @param stringFormat - String format for parsing string dates, required only for string dates
|
|
9
|
-
*/
|
|
10
|
-
export function parseDateTime(value, dateApi, dateTimeFormat, stringFormat) {
|
|
11
|
-
if (isBlank(value)) {
|
|
12
|
-
return value;
|
|
13
|
-
}
|
|
14
|
-
//format is specified
|
|
15
|
-
if (isPresent(dateTimeFormat)) {
|
|
16
|
-
//string format required, but format string was not provided
|
|
17
|
-
if (dateTimeFormat == DateTimeValueFormat.FormattedString && isBlank(stringFormat)) {
|
|
18
|
-
throw new Error('DateTime: unable to parse string date, because format is missing!');
|
|
19
|
-
}
|
|
20
|
-
//value is range
|
|
21
|
-
if (isDateTimeValue(value)) {
|
|
22
|
-
//requirested format is different
|
|
23
|
-
if (dateTimeFormat != DateTimeValueFormat.RangeOfDateInstances) {
|
|
24
|
-
throw new Error('DateTime: requested datetime format is not range, but value is range!');
|
|
25
|
-
}
|
|
26
|
-
return [
|
|
27
|
-
isBlank(value.from) ? null : parseDateTime(value.from, dateApi, DateTimeValueFormat.DateInstance, null),
|
|
28
|
-
isBlank(value.to) ? null : parseDateTime(value.to, dateApi, DateTimeValueFormat.DateInstance, null),
|
|
29
|
-
];
|
|
30
|
-
}
|
|
31
|
-
//value should be date instance, or number, or string, but it is not
|
|
32
|
-
if (dateTimeFormat != DateTimeValueFormat.DateInstance &&
|
|
33
|
-
dateTimeFormat != DateTimeValueFormat.FormattedString &&
|
|
34
|
-
dateTimeFormat != DateTimeValueFormat.UnixTimestamp) {
|
|
35
|
-
throw new Error('DateTime: unable to get date time value, should be date instance, or string, or number!');
|
|
36
|
-
}
|
|
37
|
-
//value is string, instance of date or unix timestamp
|
|
38
|
-
return dateApi.getValue(value, stringFormat !== null && stringFormat !== void 0 ? stringFormat : undefined);
|
|
39
|
-
}
|
|
40
|
-
//value is range
|
|
41
|
-
if (isDateTimeValue(value)) {
|
|
42
|
-
return [
|
|
43
|
-
isBlank(value.from) ? null : parseDateTime(value.from, dateApi, DateTimeValueFormat.DateInstance, null),
|
|
44
|
-
isBlank(value.to) ? null : parseDateTime(value.to, dateApi, DateTimeValueFormat.DateInstance, null),
|
|
45
|
-
];
|
|
46
|
-
}
|
|
47
|
-
//string format, but format string was not provided
|
|
48
|
-
if (isString(value) && isBlank(stringFormat)) {
|
|
49
|
-
throw new Error('DateTime: unable to parse string date, because format is missing!');
|
|
50
|
-
}
|
|
51
|
-
//value is string, instance of date or unix timestamp
|
|
52
|
-
return dateApi.getValue(value, stringFormat !== null && stringFormat !== void 0 ? stringFormat : undefined);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Formats value into specified format of date time
|
|
56
|
-
* @param value - Value that should be converted to input output date time value
|
|
57
|
-
* @param dateTimeFormat - Date time format type
|
|
58
|
-
* @param stringFormat - String format for parsing string dates, required only for string dates
|
|
59
|
-
*/
|
|
60
|
-
export function formatDateTime(value, dateTimeFormat, stringFormat) {
|
|
61
|
-
var _a, _b, _c, _d;
|
|
62
|
-
if (isBlank(value)) {
|
|
63
|
-
return value;
|
|
64
|
-
}
|
|
65
|
-
//value is range
|
|
66
|
-
if (Array.isArray(value)) {
|
|
67
|
-
//range is expected
|
|
68
|
-
if (dateTimeFormat != DateTimeValueFormat.RangeOfDateInstances) {
|
|
69
|
-
throw new Error('DateTime: value is array of values, but format is not range!');
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
from: (_b = (_a = value[0]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : null,
|
|
73
|
-
to: (_d = (_c = value[1]) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : null,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
//range is not expected
|
|
77
|
-
if (dateTimeFormat == DateTimeValueFormat.RangeOfDateInstances) {
|
|
78
|
-
throw new Error('DateTime: value is not array of values, but format is range!');
|
|
79
|
-
}
|
|
80
|
-
//string date time
|
|
81
|
-
if (dateTimeFormat == DateTimeValueFormat.FormattedString) {
|
|
82
|
-
//string format is missing for string date time
|
|
83
|
-
if (isBlank(stringFormat)) {
|
|
84
|
-
throw new Error('DateTime: missing string format for string date time!');
|
|
85
|
-
}
|
|
86
|
-
return value.format(stringFormat);
|
|
87
|
-
}
|
|
88
|
-
if (dateTimeFormat == DateTimeValueFormat.UnixTimestamp) {
|
|
89
|
-
value.unixTimestamp();
|
|
90
|
-
}
|
|
91
|
-
return value.value;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Tests whether value is `DateTimeValue`
|
|
95
|
-
* @param value - Value that is tested
|
|
96
|
-
*/
|
|
97
|
-
export function isDateTimeValue(value) {
|
|
98
|
-
return isJsObject(value) &&
|
|
99
|
-
nameof('from') in value &&
|
|
100
|
-
nameof('to') in value;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Gets single date time value, use in places where ranged date time can not be used
|
|
104
|
-
* @param value - Value to be examined
|
|
105
|
-
*/
|
|
106
|
-
export function getSingleDateTimeValue(value) {
|
|
107
|
-
if (isDateTimeValue(value)) {
|
|
108
|
-
throw new Error('DateTime: Unable to apply ranged date time input as value restriction!');
|
|
109
|
-
}
|
|
110
|
-
return value;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Parses raw value into internal value and value
|
|
114
|
-
* @param rawValue - Raw value to be parsed
|
|
115
|
-
* @param dateApi - Date api for manipulation with date
|
|
116
|
-
* @param dateTimeData - Object storing information about format
|
|
117
|
-
* @param valueProvider - Provider used for obtaining rounded value according format
|
|
118
|
-
*/
|
|
119
|
-
export function parseRawInput(rawValue, dateApi, dateTimeData, valueProvider) {
|
|
120
|
-
if (!rawValue) {
|
|
121
|
-
return [null, null];
|
|
122
|
-
}
|
|
123
|
-
const internalValue = getInternalValue(rawValue, dateApi, dateTimeData, valueProvider);
|
|
124
|
-
const value = formatDateTime(internalValue, dateTimeData.valueFormat, dateTimeData.customFormat);
|
|
125
|
-
return [internalValue, value];
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Gets internal value and fix lowest time difference
|
|
129
|
-
* @param value - Value to be get as internal value
|
|
130
|
-
* @param dateApi - Date api for manipulation with date
|
|
131
|
-
* @param dateTimeData - Object storing information about format
|
|
132
|
-
* @param valueProvider - Provider used for obtaining rounded value according format
|
|
133
|
-
*/
|
|
134
|
-
export function getInternalValue(value, dateApi, dateTimeData, valueProvider) {
|
|
135
|
-
let internalValue = parseDateTime(value, dateApi, null, dateTimeData.customFormat);
|
|
136
|
-
if (isBlank(internalValue)) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
//update for specified format, round value
|
|
140
|
-
//ranged value
|
|
141
|
-
if (Array.isArray(internalValue)) {
|
|
142
|
-
const [from, to] = internalValue;
|
|
143
|
-
if (from) {
|
|
144
|
-
const val = valueProvider.getValue(from.value, dateTimeData.customFormat).from;
|
|
145
|
-
if (val) {
|
|
146
|
-
internalValue[0] = dateApi.getValue(val, dateTimeData.customFormat);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
if (to) {
|
|
150
|
-
const val = valueProvider.getValue(to.value, dateTimeData.customFormat).to;
|
|
151
|
-
if (val) {
|
|
152
|
-
internalValue[1] = dateApi.getValue(val, dateTimeData.customFormat);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
const val = valueProvider.getValue(internalValue.value, dateTimeData.customFormat).from;
|
|
158
|
-
if (val) {
|
|
159
|
-
internalValue = dateApi.getValue(val, dateTimeData.customFormat);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return internalValue;
|
|
163
|
-
}
|
|
164
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/misc/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAKhF,OAAO,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAG5C;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAkB,KAAqD,EACrD,OAAuB,EACvB,cAAkD,EAClD,YAAmC;IAE9E,IAAG,OAAO,CAAC,KAAK,CAAC,EACjB;QACI,OAAO,KAAK,CAAC;KAChB;IAED,qBAAqB;IACrB,IAAG,SAAS,CAAC,cAAc,CAAC,EAC5B;QACI,4DAA4D;QAC5D,IAAG,cAAc,IAAI,mBAAmB,CAAC,eAAe,IAAI,OAAO,CAAC,YAAY,CAAC,EACjF;YACI,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;SACxF;QAED,gBAAgB;QAChB,IAAG,eAAe,CAAC,KAAK,CAAC,EACzB;YACI,iCAAiC;YACjC,IAAG,cAAc,IAAI,mBAAmB,CAAC,oBAAoB,EAC7D;gBACI,MAAM,IAAI,KAAK,CAAC,uEAAuE,CAAC,CAAC;aAC5F;YAED,OAAO;gBACH,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,mBAAmB,CAAC,YAAY,EAAE,IAAI,CAAyB;gBAC/H,OAA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YAAY,CAAC,CAAC;aACvE;SACJ;QAED,IAAG,EAAE,EACL;YACI,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;YAE3E,IAAG,GAAG,EACN;gBACI,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;aACvE;SACJ;KACJ;SAED;QACI,MAAM,GAAG,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC;QAExF,IAAG,GAAG,EACN;YACI,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;SACpE;KACJ;IAED,OAAO,aAAa,CAAC;AACzB,CAAC","sourcesContent":["import {isBlank, isJsObject, isPresent, isString, nameof} from '@jscrpt/common';\n\nimport {DateTimeValue} from '../interfaces';\nimport type {DateTimeSADirective} from '../modules/dateTime/directives/dateTime/dateTime.directive';\nimport {DateApi, DateApiObject, DateValue, DateValueProvider} from '../services';\nimport {DateTimeValueFormat} from './enums';\nimport {DateTimeInputOutputValue, DateTimeObjectValue} from './types';\n\n/**\n * Parses date time input output value\n * @param value - Value to be parsed\n * @param dateApi - Date api used for obtaining result\n * @param dateTimeFormat - Date time format type, optional, if not specified autodetection of format will be used\n * @param stringFormat - String format for parsing string dates, required only for string dates\n */\nexport function parseDateTime<TDate = unknown>(value: DateTimeInputOutputValue<TDate>|undefined|null,\n dateApi: DateApi<TDate>,\n dateTimeFormat: DateTimeValueFormat|undefined|null,\n stringFormat: string|undefined|null,): DateTimeObjectValue<TDate>|undefined|null\n{\n if(isBlank(value))\n {\n return value;\n }\n\n //format is specified\n if(isPresent(dateTimeFormat))\n {\n //string format required, but format string was not provided\n if(dateTimeFormat == DateTimeValueFormat.FormattedString && isBlank(stringFormat))\n {\n throw new Error('DateTime: unable to parse string date, because format is missing!');\n }\n\n //value is range\n if(isDateTimeValue(value))\n {\n //requirested format is different\n if(dateTimeFormat != DateTimeValueFormat.RangeOfDateInstances)\n {\n throw new Error('DateTime: requested datetime format is not range, but value is range!');\n }\n\n return [\n isBlank(value.from) ? null : parseDateTime(value.from, dateApi, DateTimeValueFormat.DateInstance, null) as DateApiObject<TDate>,\n isBlank(value.to) ? null : parseDateTime(value.to, dateApi, DateTimeValueFormat.DateInstance, null) as DateApiObject<TDate>,\n ];\n }\n\n //value should be date instance, or number, or string, but it is not\n if(dateTimeFormat != DateTimeValueFormat.DateInstance &&\n dateTimeFormat != DateTimeValueFormat.FormattedString &&\n dateTimeFormat != DateTimeValueFormat.UnixTimestamp)\n {\n throw new Error('DateTime: unable to get date time value, should be date instance, or string, or number!');\n }\n\n //value is string, instance of date or unix timestamp\n return dateApi.getValue(value, stringFormat ?? undefined);\n }\n\n //value is range\n if(isDateTimeValue(value))\n {\n return [\n isBlank(value.from) ? null : parseDateTime(value.from, dateApi, DateTimeValueFormat.DateInstance, null) as DateApiObject<TDate>,\n isBlank(value.to) ? null : parseDateTime(value.to, dateApi, DateTimeValueFormat.DateInstance , null) as DateApiObject<TDate>,\n ];\n }\n\n //string format, but format string was not provided\n if(isString(value) && isBlank(stringFormat))\n {\n throw new Error('DateTime: unable to parse string date, because format is missing!');\n }\n\n //value is string, instance of date or unix timestamp\n return dateApi.getValue(value, stringFormat ?? undefined);\n}\n\n/**\n * Formats value into specified format of date time\n * @param value - Value that should be converted to input output date time value\n * @param dateTimeFormat - Date time format type\n * @param stringFormat - String format for parsing string dates, required only for string dates\n */\nexport function formatDateTime<TDate = unknown>(value: DateTimeObjectValue<TDate>|undefined|null,\n dateTimeFormat: DateTimeValueFormat,\n stringFormat: string|undefined|null): DateTimeInputOutputValue<TDate>|undefined|null\n{\n if(isBlank(value))\n {\n return value;\n }\n\n //value is range\n if(Array.isArray(value))\n {\n //range is expected\n if(dateTimeFormat != DateTimeValueFormat.RangeOfDateInstances)\n {\n throw new Error('DateTime: value is array of values, but format is not range!');\n }\n\n return {\n from: value[0]?.value ?? null,\n to: value[1]?.value ?? null,\n };\n }\n\n //range is not expected\n if(dateTimeFormat == DateTimeValueFormat.RangeOfDateInstances)\n {\n throw new Error('DateTime: value is not array of values, but format is range!');\n }\n\n //string date time\n if(dateTimeFormat == DateTimeValueFormat.FormattedString)\n {\n //string format is missing for string date time\n if(isBlank(stringFormat))\n {\n throw new Error('DateTime: missing string format for string date time!');\n }\n\n return value.format(stringFormat);\n }\n\n if(dateTimeFormat == DateTimeValueFormat.UnixTimestamp)\n {\n value.unixTimestamp();\n }\n\n return value.value;\n}\n\n/**\n * Tests whether value is `DateTimeValue`\n * @param value - Value that is tested\n */\nexport function isDateTimeValue<TDate = unknown>(value: unknown): value is DateTimeValue<TDate>\n{\n return isJsObject(value) &&\n nameof<DateTimeValue>('from') in value &&\n nameof<DateTimeValue>('to') in value;\n}\n\n/**\n * Gets single date time value, use in places where ranged date time can not be used\n * @param value - Value to be examined\n */\nexport function getSingleDateTimeValue<TDate>(value: DateTimeInputOutputValue<TDate>|undefined|null): DateValue|TDate|null|undefined\n{\n if(isDateTimeValue(value))\n {\n throw new Error('DateTime: Unable to apply ranged date time input as value restriction!');\n }\n\n return value;\n}\n\n/**\n * Parses raw value into internal value and value\n * @param rawValue - Raw value to be parsed\n * @param dateApi - Date api for manipulation with date\n * @param dateTimeData - Object storing information about format\n * @param valueProvider - Provider used for obtaining rounded value according format\n */\nexport function parseRawInput<TDate>(rawValue: string, \n dateApi: DateApi<TDate>,\n dateTimeData: DateTimeSADirective<TDate>,\n valueProvider: DateValueProvider<TDate>,): [DateTimeObjectValue<TDate>|undefined|null, DateTimeInputOutputValue<TDate>|undefined|null]\n{\n if(!rawValue)\n {\n return [null, null];\n }\n\n const internalValue = getInternalValue(rawValue, dateApi, dateTimeData, valueProvider);\n const value = formatDateTime(internalValue, dateTimeData.valueFormat, dateTimeData.customFormat);\n\n return [internalValue, value];\n}\n\n/**\n * Gets internal value and fix lowest time difference\n * @param value - Value to be get as internal value\n * @param dateApi - Date api for manipulation with date\n * @param dateTimeData - Object storing information about format\n * @param valueProvider - Provider used for obtaining rounded value according format\n */\nexport function getInternalValue<TDate>(value: DateTimeInputOutputValue<TDate>|undefined|null,\n dateApi: DateApi<TDate>,\n dateTimeData: DateTimeSADirective<TDate>,\n valueProvider: DateValueProvider<TDate>,): DateTimeObjectValue<TDate>|undefined|null\n{\n let internalValue = parseDateTime(value, dateApi, null, dateTimeData.customFormat);\n\n if(isBlank(internalValue))\n {\n return;\n }\n\n //update for specified format, round value\n\n //ranged value\n if(Array.isArray(internalValue))\n {\n const [from, to] = internalValue;\n\n if(from)\n {\n const val = valueProvider.getValue(from.value, dateTimeData.customFormat).from;\n\n if(val)\n {\n internalValue[0] = dateApi.getValue(val, dateTimeData.customFormat);\n }\n }\n\n if(to)\n {\n const val = valueProvider.getValue(to.value, dateTimeData.customFormat).to;\n\n if(val)\n {\n internalValue[1] = dateApi.getValue(val, dateTimeData.customFormat);\n }\n }\n }\n else\n {\n const val = valueProvider.getValue(internalValue.value, dateTimeData.customFormat).from;\n\n if(val)\n {\n internalValue = dateApi.getValue(val, dateTimeData.customFormat);\n }\n }\n\n return internalValue;\n}"]}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { ModelPropertyMetadata, ValidatorFnFactory } from '@anglr/common/forms';
|
|
2
|
-
import { isBlank, isNumber, isString } from '@jscrpt/common';
|
|
3
|
-
import { getSingleDateTimeValue, parseDateTime } from './utils';
|
|
4
|
-
import { DateTimeBase } from '../modules/dateTime/directives/dateTimeBase';
|
|
5
|
-
import { DATE_API } from './tokens';
|
|
6
|
-
/**
|
|
7
|
-
* Date time validator factory function, creates validator for checking validity of datetime
|
|
8
|
-
* @param dateApi - Date api used for parsing date time
|
|
9
|
-
* @param valueFormat - Optional required format
|
|
10
|
-
* @param stringFormat - Optional string format of value
|
|
11
|
-
*/
|
|
12
|
-
export function datetimeValidator(dateApi, valueFormat, stringFormat) {
|
|
13
|
-
return (control) => {
|
|
14
|
-
if (isBlank(control.value)) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
const parsedValue = parseDateTime(control.value, dateApi, valueFormat, stringFormat);
|
|
18
|
-
if (!parsedValue) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
if (!Array.isArray(parsedValue)) {
|
|
22
|
-
if (!parsedValue.isValid()) {
|
|
23
|
-
return {
|
|
24
|
-
'datetime': stringFormat
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
//TODO: support for ranges
|
|
30
|
-
}
|
|
31
|
-
return null;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Factory function that creates validator function factory
|
|
36
|
-
* @param args - Static arguments for date time validator
|
|
37
|
-
*/
|
|
38
|
-
export function dateTimeModelValidatorFactory(args) {
|
|
39
|
-
return new ValidatorFnFactory(args => {
|
|
40
|
-
var _a;
|
|
41
|
-
const dateApi = (_a = args.injector) === null || _a === void 0 ? void 0 : _a.get(DATE_API, null);
|
|
42
|
-
if (!dateApi) {
|
|
43
|
-
throw new Error('DateTime: missing DateApi! Please provide one.');
|
|
44
|
-
}
|
|
45
|
-
return datetimeValidator(dateApi, args.valueFormat, args.stringFormat);
|
|
46
|
-
}, args);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Sets date time validator to property on which is used
|
|
50
|
-
*/
|
|
51
|
-
export function DateTime(valueFormatOrStringFormat, stringFormat) {
|
|
52
|
-
let valueFormat;
|
|
53
|
-
if (isNumber(valueFormatOrStringFormat)) {
|
|
54
|
-
valueFormat = valueFormatOrStringFormat;
|
|
55
|
-
}
|
|
56
|
-
if (isString(valueFormatOrStringFormat)) {
|
|
57
|
-
stringFormat = valueFormatOrStringFormat;
|
|
58
|
-
}
|
|
59
|
-
return ModelPropertyMetadata({
|
|
60
|
-
validators: [dateTimeModelValidatorFactory({
|
|
61
|
-
stringFormat,
|
|
62
|
-
valueFormat,
|
|
63
|
-
})]
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Date time validator factory function, creates validator for checking validity of datetime max value
|
|
68
|
-
* @param dateApi - Date api used for parsing date time
|
|
69
|
-
* @param maxValue - Maximal date time value that should be used for validation against
|
|
70
|
-
* @param valueFormat - Optional required format
|
|
71
|
-
* @param stringFormat - Optional string format of value
|
|
72
|
-
*/
|
|
73
|
-
export function datetimeMaxValidator(dateApi, maxValue, valueFormat, stringFormat) {
|
|
74
|
-
return (control) => {
|
|
75
|
-
if (isBlank(control.value) || isBlank(maxValue)) {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
if (maxValue instanceof (DateTimeBase)) {
|
|
79
|
-
const value = getSingleDateTimeValue(maxValue.value);
|
|
80
|
-
//no validation
|
|
81
|
-
if (isBlank(value)) {
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
maxValue = value;
|
|
85
|
-
}
|
|
86
|
-
const parsedValue = parseDateTime(control.value, dateApi, valueFormat, stringFormat);
|
|
87
|
-
if (!parsedValue) {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
const maxDateTime = dateApi.getValue(maxValue, stringFormat !== null && stringFormat !== void 0 ? stringFormat : undefined);
|
|
91
|
-
if (!Array.isArray(parsedValue)) {
|
|
92
|
-
if (parsedValue.isValid() && !parsedValue.isBefore(maxDateTime.value)) {
|
|
93
|
-
return {
|
|
94
|
-
'datetimemax': maxDateTime.value
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
//TODO: support for ranges
|
|
100
|
-
}
|
|
101
|
-
return null;
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Date time validator factory function, creates validator for checking validity of datetime min value
|
|
106
|
-
* @param dateApi - Date api used for parsing date time
|
|
107
|
-
* @param minValue - Minimal date time value that should be used for validation against
|
|
108
|
-
* @param valueFormat - Optional required format
|
|
109
|
-
* @param stringFormat - Optional string format of value
|
|
110
|
-
*/
|
|
111
|
-
export function datetimeMinValidator(dateApi, minValue, valueFormat, stringFormat) {
|
|
112
|
-
return (control) => {
|
|
113
|
-
if (isBlank(control.value) || isBlank(minValue)) {
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
if (minValue instanceof (DateTimeBase)) {
|
|
117
|
-
const value = getSingleDateTimeValue(minValue.value);
|
|
118
|
-
//no validation
|
|
119
|
-
if (isBlank(value)) {
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
minValue = value;
|
|
123
|
-
}
|
|
124
|
-
const parsedValue = parseDateTime(control.value, dateApi, valueFormat, stringFormat);
|
|
125
|
-
if (!parsedValue) {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
const minDateTime = dateApi.getValue(minValue, stringFormat !== null && stringFormat !== void 0 ? stringFormat : undefined);
|
|
129
|
-
if (!Array.isArray(parsedValue)) {
|
|
130
|
-
if (parsedValue.isValid() && !parsedValue.isAfter(minDateTime.value)) {
|
|
131
|
-
return {
|
|
132
|
-
'datetimemin': minDateTime.value
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
//TODO: support for ranges
|
|
138
|
-
}
|
|
139
|
-
return null;
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
//# sourceMappingURL=validators.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../src/misc/validators.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC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QAED,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;AACN,CAAC","sourcesContent":["import {AbstractControl, ValidationErrors, ValidatorFn} from '@angular/forms';\nimport {ModelPropertyMetadata, ValidatorFnFactory} from '@anglr/common/forms';\nimport {isBlank, isNumber, isString} from '@jscrpt/common';\n\nimport {DateApi, DateValue} from '../services';\nimport {getSingleDateTimeValue, parseDateTime} from './utils';\nimport {DateTimeValueFormat} from './enums';\nimport {DateTimeInputOutputValue} from './types';\nimport {DateTimeBase} from '../modules/dateTime/directives/dateTimeBase';\nimport {DATE_API} from './tokens';\n\n//TODO: add decorators for min and max date time\n\n/**\n * Validations arguments for date time validators for model based forms\n */\nexport interface DateTimeValidationArgs<TDate = unknown>\n{\n /**\n * Format of validated value\n */\n valueFormat?: DateTimeValueFormat|null;\n\n /**\n * Format of string value\n */\n stringFormat?: string|null;\n\n /**\n * Max allowed value\n */\n maxValue?: DateValue|TDate|DateTimeBase<TDate>;\n\n /**\n * Min allowed value\n */\n minValue?: DateValue|TDate|DateTimeBase<TDate>;\n}\n\n/**\n * Date time validator factory function, creates validator for checking validity of datetime\n * @param dateApi - Date api used for parsing date time\n * @param valueFormat - Optional required format\n * @param stringFormat - Optional string format of value\n */\nexport function datetimeValidator<TDate = unknown>(dateApi: DateApi<TDate>,\n valueFormat: DateTimeValueFormat|undefined|null,\n stringFormat: string|undefined|null,): ValidatorFn\n{\n return (control: AbstractControl<DateTimeInputOutputValue<TDate>>): ValidationErrors|null =>\n {\n if(isBlank(control.value))\n {\n return null;\n }\n\n const parsedValue = parseDateTime(control.value, dateApi, valueFormat, stringFormat);\n\n if(!parsedValue)\n {\n return null;\n }\n\n if(!Array.isArray(parsedValue))\n {\n if(!parsedValue.isValid())\n {\n return {\n 'datetime': stringFormat\n };\n }\n }\n else\n {\n //TODO: support for ranges\n }\n\n return null;\n };\n}\n\n/**\n * Factory function that creates validator function factory\n * @param args - Static arguments for date time validator\n */\nexport function dateTimeModelValidatorFactory<TDate = unknown>(args: DateTimeValidationArgs<TDate>): ValidatorFnFactory<DateTimeValidationArgs<TDate>>\n{\n return new ValidatorFnFactory<DateTimeValidationArgs<TDate>>(args =>\n {\n const dateApi = args.injector?.get(DATE_API, null);\n\n if(!dateApi)\n {\n throw new Error('DateTime: missing DateApi! Please provide one.');\n }\n\n return datetimeValidator(dateApi, args.valueFormat, args.stringFormat);\n }, args);\n}\n\n/**\n * Sets date time validator, with default formats\n */\nexport function DateTime(): PropertyDecorator\n/**\n * Sets date time validator, with default string format\n * @param valueFormat - Format of validated value\n */\nexport function DateTime(valueFormat: DateTimeValueFormat): PropertyDecorator\n/**\n * Sets date time validator, with default value format\n * @param stringFormat - Format of string value\n */\nexport function DateTime(stringFormat: string|null): PropertyDecorator\n/**\n * Sets date time validator\n * @param valueFormat - Format of validated value\n * @param stringFormat - Format of string value\n */\nexport function DateTime(valueFormat: DateTimeValueFormat, stringFormat: string): PropertyDecorator\n/**\n * Sets date time validator to property on which is used\n */\nexport function DateTime(valueFormatOrStringFormat?: DateTimeValueFormat|string|null, stringFormat?: string|undefined|null): PropertyDecorator\n{\n let valueFormat: DateTimeValueFormat|undefined|null;\n\n if(isNumber(valueFormatOrStringFormat))\n {\n valueFormat = valueFormatOrStringFormat;\n }\n\n if(isString(valueFormatOrStringFormat))\n {\n stringFormat = valueFormatOrStringFormat;\n }\n\n return ModelPropertyMetadata(\n {\n validators: [dateTimeModelValidatorFactory(\n {\n stringFormat,\n valueFormat,\n })]\n });\n}\n\n/**\n * Date time validator factory function, creates validator for checking validity of datetime max value\n * @param dateApi - Date api used for parsing date time\n * @param maxValue - Maximal date time value that should be used for validation against\n * @param valueFormat - Optional required format\n * @param stringFormat - Optional string format of value\n */\nexport function datetimeMaxValidator<TDate = unknown>(dateApi: DateApi<TDate>,\n maxValue: DateValue|TDate|DateTimeBase<TDate>|undefined|null,\n valueFormat: DateTimeValueFormat|undefined|null,\n stringFormat: string|undefined|null,): ValidatorFn\n{\n return (control: AbstractControl<DateTimeInputOutputValue<TDate>>): ValidationErrors|null =>\n {\n if(isBlank(control.value) || isBlank(maxValue))\n {\n return null;\n }\n\n if(maxValue instanceof DateTimeBase<TDate>)\n {\n const value = getSingleDateTimeValue(maxValue.value);\n\n //no validation\n if(isBlank(value))\n {\n return null;\n }\n\n maxValue = value;\n }\n\n const parsedValue = parseDateTime(control.value, dateApi, valueFormat, stringFormat);\n\n if(!parsedValue)\n {\n return null;\n }\n\n const maxDateTime = dateApi.getValue(maxValue, stringFormat ?? undefined);\n\n if(!Array.isArray(parsedValue))\n {\n if(parsedValue.isValid() && !parsedValue.isBefore(maxDateTime.value))\n {\n return {\n 'datetimemax': maxDateTime.value\n };\n }\n }\n else\n {\n //TODO: support for ranges\n }\n\n return null;\n };\n}\n\n/**\n * Date time validator factory function, creates validator for checking validity of datetime min value\n * @param dateApi - Date api used for parsing date time\n * @param minValue - Minimal date time value that should be used for validation against\n * @param valueFormat - Optional required format\n * @param stringFormat - Optional string format of value\n */\nexport function datetimeMinValidator<TDate = unknown>(dateApi: DateApi<TDate>,\n minValue: DateValue|TDate|DateTimeBase<TDate>|undefined|null,\n valueFormat: DateTimeValueFormat|undefined|null,\n stringFormat: string|undefined|null,): ValidatorFn\n{\n return (control: AbstractControl<DateTimeInputOutputValue<TDate>>): ValidationErrors|null =>\n {\n if(isBlank(control.value) || isBlank(minValue))\n {\n return null;\n }\n\n if(minValue instanceof DateTimeBase<TDate>)\n {\n const value = getSingleDateTimeValue(minValue.value);\n\n //no validation\n if(isBlank(value))\n {\n return null;\n }\n\n minValue = value;\n }\n\n const parsedValue = parseDateTime(control.value, dateApi, valueFormat, stringFormat);\n\n if(!parsedValue)\n {\n return null;\n }\n\n const minDateTime = dateApi.getValue(minValue, stringFormat ?? undefined);\n\n if(!Array.isArray(parsedValue))\n {\n if(parsedValue.isValid() && !parsedValue.isAfter(minDateTime.value))\n {\n return {\n 'datetimemin': minDateTime.value\n };\n }\n }\n else\n {\n //TODO: support for ranges\n }\n\n return null;\n };\n}\n"]}
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy, Input, Inject, ViewChild, TemplateRef, ContentChild } from '@angular/core';
|
|
2
|
-
import { isString, nameof } from '@jscrpt/common';
|
|
3
|
-
import { CalendarDayTemplateDirective } from '../../directives';
|
|
4
|
-
import { MonthCalendarDayFormat, CalendarDayAspectRatio } from '../../misc';
|
|
5
|
-
import { EventParser } from '../../services';
|
|
6
|
-
import { DATE_API, FORMAT_PROVIDER } from '../../../../misc/tokens';
|
|
7
|
-
import * as i0 from "@angular/core";
|
|
8
|
-
import * as i1 from "../../services";
|
|
9
|
-
import * as i2 from "@angular/common";
|
|
10
|
-
import * as i3 from "../../directives/calendarDayTemplate/calendarDayTemplate.directive";
|
|
11
|
-
/**
|
|
12
|
-
* Component used for displaying month calendar
|
|
13
|
-
*/
|
|
14
|
-
export class MonthCalendarComponent {
|
|
15
|
-
//######################### constructor #########################
|
|
16
|
-
constructor(dateApi, formatProvider, eventParser) {
|
|
17
|
-
this.dateApi = dateApi;
|
|
18
|
-
this.formatProvider = formatProvider;
|
|
19
|
-
this.eventParser = eventParser;
|
|
20
|
-
//######################### protected properties - template bindings #########################
|
|
21
|
-
/**
|
|
22
|
-
* Aspect ratio for displayed calendar day cell
|
|
23
|
-
*/
|
|
24
|
-
this.dayAspectRatioValue = CalendarDayAspectRatio.ThreeToTwo;
|
|
25
|
-
/**
|
|
26
|
-
* Data that represents calendar data
|
|
27
|
-
*/
|
|
28
|
-
this.calendarData = {};
|
|
29
|
-
/**
|
|
30
|
-
* Array of weekday names
|
|
31
|
-
*/
|
|
32
|
-
this.weekDayNames = [];
|
|
33
|
-
//######################### public properties - inputs #########################
|
|
34
|
-
/**
|
|
35
|
-
* Indication that week number should be displayed
|
|
36
|
-
*/
|
|
37
|
-
this.showWeekNumber = false;
|
|
38
|
-
/**
|
|
39
|
-
* Format for displaying week day names
|
|
40
|
-
*/
|
|
41
|
-
this.weekDayName = MonthCalendarDayFormat.Short;
|
|
42
|
-
/**
|
|
43
|
-
* Array of events that should be displayed
|
|
44
|
-
*/
|
|
45
|
-
this.events = [];
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Calendar day template to be used
|
|
49
|
-
*/
|
|
50
|
-
get calendarDayTemplate() {
|
|
51
|
-
var _a;
|
|
52
|
-
return (_a = this.customCalendarDayTemplate) !== null && _a !== void 0 ? _a : this.defaultCalendarDayTemplate;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Aspect ratio for displayed calendar day cell
|
|
56
|
-
*/
|
|
57
|
-
get dayAspectRatio() {
|
|
58
|
-
return this.dayAspectRatioValue;
|
|
59
|
-
}
|
|
60
|
-
set dayAspectRatio(value) {
|
|
61
|
-
if (isString(value)) {
|
|
62
|
-
this.dayAspectRatioValue = CalendarDayAspectRatio[value];
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
this.dayAspectRatioValue = value;
|
|
66
|
-
}
|
|
67
|
-
//######################### public methods - implementation of OnInit #########################
|
|
68
|
-
/**
|
|
69
|
-
* Initialize component
|
|
70
|
-
*/
|
|
71
|
-
ngOnInit() {
|
|
72
|
-
this.initWeekdayNames();
|
|
73
|
-
this.initializeDisplayCalendar();
|
|
74
|
-
}
|
|
75
|
-
//######################### public methods - implementation of OnChanges #########################
|
|
76
|
-
/**
|
|
77
|
-
* Called when input value changes
|
|
78
|
-
*/
|
|
79
|
-
ngOnChanges(changes) {
|
|
80
|
-
if (nameof('weekDayName') in changes) {
|
|
81
|
-
this.initWeekdayNames();
|
|
82
|
-
}
|
|
83
|
-
if (nameof('display') in changes) {
|
|
84
|
-
this.initializeDisplayCalendar();
|
|
85
|
-
}
|
|
86
|
-
if (nameof('events') in changes && !(nameof('display') in changes)) {
|
|
87
|
-
this.initAndAttachEventData();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
//######################### protected methods #########################
|
|
91
|
-
/**
|
|
92
|
-
* Initialize weekday names
|
|
93
|
-
*/
|
|
94
|
-
initWeekdayNames() {
|
|
95
|
-
this.weekDayNames = [];
|
|
96
|
-
const dateApi = this.dateApi.now().startOfWeek();
|
|
97
|
-
switch (this.weekDayName) {
|
|
98
|
-
default:
|
|
99
|
-
// case MonthCalendarDayFormat.None:
|
|
100
|
-
{
|
|
101
|
-
for (let x = 0; x < 7; x++) {
|
|
102
|
-
this.weekDayNames.push('');
|
|
103
|
-
}
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
case MonthCalendarDayFormat.Short:
|
|
107
|
-
{
|
|
108
|
-
for (let x = 0; x < 7; x++) {
|
|
109
|
-
this.weekDayNames.push(dateApi.format(this.formatProvider.dayNameShort));
|
|
110
|
-
dateApi.addDays(1);
|
|
111
|
-
}
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
case MonthCalendarDayFormat.Full:
|
|
115
|
-
{
|
|
116
|
-
for (let x = 0; x < 7; x++) {
|
|
117
|
-
this.weekDayNames.push(dateApi.format(this.formatProvider.dayName));
|
|
118
|
-
dateApi.addDays(1);
|
|
119
|
-
}
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Initialize date for calendar that should be displayed
|
|
126
|
-
*/
|
|
127
|
-
initializeDisplayCalendar() {
|
|
128
|
-
var _a;
|
|
129
|
-
(_a = this.display) !== null && _a !== void 0 ? _a : (this.display = this.dateApi.now().value);
|
|
130
|
-
const workDate = this.dateApi.getValue(this.display);
|
|
131
|
-
workDate.startOfMonth()
|
|
132
|
-
.startOfWeek();
|
|
133
|
-
this.calendarData = {};
|
|
134
|
-
do {
|
|
135
|
-
const weekData = this.calendarData[workDate.format(this.formatProvider.week)] = [];
|
|
136
|
-
for (let x = 0; x < 7; x++) {
|
|
137
|
-
weekData.push({
|
|
138
|
-
date: workDate.value,
|
|
139
|
-
day: workDate.dayOfMonth(),
|
|
140
|
-
events: [],
|
|
141
|
-
isCurrentMonth: workDate.isSameMonth(this.display),
|
|
142
|
-
isWeekend: workDate.isWeekend(),
|
|
143
|
-
week: +workDate.format(this.formatProvider.week),
|
|
144
|
-
});
|
|
145
|
-
workDate.addDays(1);
|
|
146
|
-
}
|
|
147
|
-
workDate.startOfWeek();
|
|
148
|
-
} while (workDate.isSameMonth(this.display));
|
|
149
|
-
this.initAndAttachEventData();
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Initialize and attaches event data
|
|
153
|
-
*/
|
|
154
|
-
initAndAttachEventData() {
|
|
155
|
-
var _a;
|
|
156
|
-
const events = this.eventParser.getEventsPerDay(this.events);
|
|
157
|
-
for (const week in this.calendarData) {
|
|
158
|
-
const weekData = this.calendarData[week];
|
|
159
|
-
for (const day of weekData) {
|
|
160
|
-
const found = events.find(itm => this.dateApi.getValue(itm[0]).isSame(day.date));
|
|
161
|
-
day.events = (_a = found === null || found === void 0 ? void 0 : found[1]) !== null && _a !== void 0 ? _a : [];
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
MonthCalendarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: MonthCalendarComponent, deps: [{ token: DATE_API }, { token: FORMAT_PROVIDER }, { token: i1.EventParser }], target: i0.ɵɵFactoryTarget.Component });
|
|
167
|
-
MonthCalendarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: MonthCalendarComponent, selector: "month-calendar", inputs: { showWeekNumber: "showWeekNumber", display: "display", weekDayName: "weekDayName", dayAspectRatio: "dayAspectRatio", events: "events" }, providers: [
|
|
168
|
-
EventParser,
|
|
169
|
-
], queries: [{ propertyName: "customCalendarDayTemplate", first: true, predicate: CalendarDayTemplateDirective, descendants: true, read: TemplateRef, static: true }], viewQueries: [{ propertyName: "defaultCalendarDayTemplate", first: true, predicate: CalendarDayTemplateDirective, descendants: true, read: TemplateRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<div *calendarDayTemplate=\"let data\" class=\"default-calendar-day\" [class.is-weekend]=\"data.isWeekend\" [class.is-other-month]=\"!data.isCurrentMonth\">{{data.day}}</div>\n\n<div></div>\n\n<div *ngFor=\"let dayName of weekDayNames\" [class.week-day-name]=\"dayName\">{{dayName}}</div>\n\n<ng-container *ngFor=\"let weekData of calendarData | keyvalue\">\n <div class=\"week-number\">\n <ng-container *ngIf=\"showWeekNumber\">{{weekData.key}}</ng-container>\n </div>\n \n <div *ngFor=\"let dayData of weekData.value\" [style.padding-bottom.%]=\"dayAspectRatioValue\" class=\"day-wrapper\">\n <div class=\"day-content\"><ng-container *ngTemplateOutlet=\"calendarDayTemplate; context: {$implicit: dayData}\"></ng-container></div>\n </div>\n</ng-container>\n", dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i3.CalendarDayTemplateDirective, selector: "[calendarDayTemplate]" }, { kind: "pipe", type: i2.KeyValuePipe, name: "keyvalue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
170
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: MonthCalendarComponent, decorators: [{
|
|
171
|
-
type: Component,
|
|
172
|
-
args: [{ selector: 'month-calendar', providers: [
|
|
173
|
-
EventParser,
|
|
174
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *calendarDayTemplate=\"let data\" class=\"default-calendar-day\" [class.is-weekend]=\"data.isWeekend\" [class.is-other-month]=\"!data.isCurrentMonth\">{{data.day}}</div>\n\n<div></div>\n\n<div *ngFor=\"let dayName of weekDayNames\" [class.week-day-name]=\"dayName\">{{dayName}}</div>\n\n<ng-container *ngFor=\"let weekData of calendarData | keyvalue\">\n <div class=\"week-number\">\n <ng-container *ngIf=\"showWeekNumber\">{{weekData.key}}</ng-container>\n </div>\n \n <div *ngFor=\"let dayData of weekData.value\" [style.padding-bottom.%]=\"dayAspectRatioValue\" class=\"day-wrapper\">\n <div class=\"day-content\"><ng-container *ngTemplateOutlet=\"calendarDayTemplate; context: {$implicit: dayData}\"></ng-container></div>\n </div>\n</ng-container>\n" }]
|
|
175
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
176
|
-
type: Inject,
|
|
177
|
-
args: [DATE_API]
|
|
178
|
-
}] }, { type: undefined, decorators: [{
|
|
179
|
-
type: Inject,
|
|
180
|
-
args: [FORMAT_PROVIDER]
|
|
181
|
-
}] }, { type: i1.EventParser }]; }, propDecorators: { defaultCalendarDayTemplate: [{
|
|
182
|
-
type: ViewChild,
|
|
183
|
-
args: [CalendarDayTemplateDirective, { static: true, read: TemplateRef }]
|
|
184
|
-
}], customCalendarDayTemplate: [{
|
|
185
|
-
type: ContentChild,
|
|
186
|
-
args: [CalendarDayTemplateDirective, { static: true, read: TemplateRef }]
|
|
187
|
-
}], showWeekNumber: [{
|
|
188
|
-
type: Input
|
|
189
|
-
}], display: [{
|
|
190
|
-
type: Input
|
|
191
|
-
}], weekDayName: [{
|
|
192
|
-
type: Input
|
|
193
|
-
}], dayAspectRatio: [{
|
|
194
|
-
type: Input
|
|
195
|
-
}], events: [{
|
|
196
|
-
type: Input
|
|
197
|
-
}] } });
|
|
198
|
-
//# sourceMappingURL=monthCalendar.component.js.map
|