@anglr/datetime 8.1.0 → 9.0.0-beta.20241007050425
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 +68 -1
- package/date-fns/src/services/dateFnsDateApi.service.d.ts +62 -130
- package/date-fns/src/services/dateFnsDateApi.service.d.ts.map +1 -1
- package/es2022/date-fns/src/services/dateFnsDateApi.service.js +71 -143
- package/es2022/date-fns/src/services/dateFnsDateApi.service.js.map +1 -1
- package/es2022/moment/src/services/momentDateApi.service.js +64 -140
- package/es2022/moment/src/services/momentDateApi.service.js.map +1 -1
- package/es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js +17 -30
- package/es2022/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.js.map +1 -1
- package/es2022/src/directives/datePickerInput/datePickerInput.directive.js +9 -9
- package/es2022/src/directives/datePickerInput/datePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js +16 -26
- package/es2022/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.js.map +1 -1
- package/es2022/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js +8 -8
- package/es2022/src/directives/dateTimePickerInput/dateTimePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js +9 -9
- package/es2022/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js +7 -11
- package/es2022/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.js.map +1 -1
- package/es2022/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js +8 -8
- package/es2022/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.js.map +1 -1
- package/es2022/src/directives/withNow/withNow.directive.js +11 -11
- package/es2022/src/directives/withNow/withNow.directive.js.map +1 -1
- package/es2022/src/directives/withTime/withTime.directive.js +10 -10
- package/es2022/src/directives/withTime/withTime.directive.js.map +1 -1
- package/es2022/src/directives/withToday/withToday.directive.js +11 -11
- package/es2022/src/directives/withToday/withToday.directive.js.map +1 -1
- package/es2022/src/interfaces/dateTimeInput/dateTimeInput.interface.js.map +1 -1
- package/es2022/src/misc/enums.js +8 -4
- package/es2022/src/misc/enums.js.map +1 -1
- package/es2022/src/misc/utils.js +7 -6
- package/es2022/src/misc/utils.js.map +1 -1
- package/es2022/src/misc/validators.js.map +1 -1
- package/es2022/src/modules/calendar/components/monthCalendar/monthCalendar.component.js +40 -68
- package/es2022/src/modules/calendar/components/monthCalendar/monthCalendar.component.js.map +1 -1
- package/es2022/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js +5 -5
- package/es2022/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js.map +1 -1
- package/es2022/src/modules/calendar/modules/monthCalendar.module.js +7 -11
- package/es2022/src/modules/calendar/modules/monthCalendar.module.js.map +1 -1
- package/es2022/src/modules/calendar/services/eventParser/eventParser.service.js +3 -4
- package/es2022/src/modules/calendar/services/eventParser/eventParser.service.js.map +1 -1
- package/es2022/src/modules/datePipes.module.js +6 -6
- package/es2022/src/modules/datePipes.module.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTime/dateTime.directive.js +41 -72
- package/es2022/src/modules/dateTime/directives/dateTime/dateTime.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeBase.js +21 -25
- package/es2022/src/modules/dateTime/directives/dateTimeBase.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js +36 -16
- package/es2022/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js +18 -26
- package/es2022/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js +12 -13
- package/es2022/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js +12 -13
- package/es2022/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js +12 -13
- package/es2022/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.js.map +1 -1
- package/es2022/src/modules/dateTime/modules/dateTime.module.js +27 -27
- package/es2022/src/modules/dateTime/modules/dateTime.module.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js +39 -58
- package/es2022/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +21 -57
- package/es2022/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +17 -20
- package/es2022/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js +6 -10
- package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js +31 -29
- package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js +13 -13
- package/es2022/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +11 -40
- package/es2022/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js +40 -55
- package/es2022/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js +8 -14
- package/es2022/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/interfaces/periodData/periodData.interface.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/modules/dateTimePicker.module.js +9 -10
- package/es2022/src/modules/dateTimePicker/modules/dateTimePicker.module.js.map +1 -1
- package/es2022/src/pipes/dateConvert.pipe.js +4 -5
- package/es2022/src/pipes/dateConvert.pipe.js.map +1 -1
- package/es2022/src/pipes/dateFormat.pipe.js +4 -6
- package/es2022/src/pipes/dateFormat.pipe.js.map +1 -1
- package/es2022/src/services/dateApi/dateApi.interface.js.map +1 -1
- package/es2022/src/services/datePositionParser/datePositionParser.service.js +16 -17
- package/es2022/src/services/datePositionParser/datePositionParser.service.js.map +1 -1
- package/es2022/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js +3 -9
- package/es2022/src/services/dateTimeRelativeParser/dateTimeRelativeParser.service.js.map +1 -1
- package/es2022/src/services/dateValueProvider/dateValueProvider.service.js +3 -5
- package/es2022/src/services/dateValueProvider/dateValueProvider.service.js.map +1 -1
- package/lerna.json +4 -0
- package/moment/src/services/momentDateApi.service.d.ts +63 -132
- package/moment/src/services/momentDateApi.service.d.ts.map +1 -1
- package/package.json +41 -43
- package/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.d.ts +3 -3
- package/src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.d.ts.map +1 -1
- package/src/directives/datePickerInput/datePickerInput.directive.d.ts +3 -3
- package/src/directives/datePickerInput/datePickerInput.directive.d.ts.map +1 -1
- package/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.d.ts +7 -7
- package/src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.d.ts.map +1 -1
- package/src/directives/dateTimePickerInput/dateTimePickerInput.directive.d.ts +3 -3
- package/src/directives/dateTimePickerInput/dateTimePickerInput.directive.d.ts.map +1 -1
- package/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.d.ts +3 -3
- package/src/directives/simpleDatePickerInput/simpleDatePickerInput.directive.d.ts.map +1 -1
- package/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.d.ts +7 -7
- package/src/directives/simpleDateTimeInputHandler/simpleDateTimeInputHandler.directive.d.ts.map +1 -1
- package/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.d.ts +3 -3
- package/src/directives/simpleDateTimePickerInput/simpleDateTimePickerInput.directive.d.ts.map +1 -1
- package/src/directives/withNow/withNow.directive.d.ts +5 -5
- package/src/directives/withNow/withNow.directive.d.ts.map +1 -1
- package/src/directives/withTime/withTime.directive.d.ts +5 -5
- package/src/directives/withTime/withTime.directive.d.ts.map +1 -1
- package/src/directives/withToday/withToday.directive.d.ts +5 -5
- package/src/directives/withToday/withToday.directive.d.ts.map +1 -1
- package/src/interfaces/dateTimeInput/dateTimeInput.interface.d.ts +1 -1
- package/src/misc/enums.d.ts +8 -4
- package/src/misc/enums.d.ts.map +1 -1
- package/src/misc/utils.d.ts +3 -3
- package/src/misc/utils.d.ts.map +1 -1
- package/src/modules/calendar/components/monthCalendar/monthCalendar.component.d.ts +1 -1
- package/src/modules/calendar/components/monthCalendar/monthCalendar.component.d.ts.map +1 -1
- package/src/modules/calendar/components/monthCalendar/monthCalendar.component.html +17 -9
- package/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.d.ts +1 -1
- package/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.d.ts.map +1 -1
- package/src/modules/calendar/modules/monthCalendar.module.d.ts +3 -4
- package/src/modules/calendar/modules/monthCalendar.module.d.ts.map +1 -1
- package/src/modules/datePipes.module.d.ts +1 -1
- package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts +3 -3
- package/src/modules/dateTime/directives/dateTime/dateTime.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeBase.d.ts +3 -3
- package/src/modules/dateTime/directives/dateTimeBase.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.d.ts +6 -4
- package/src/modules/dateTime/directives/dateTimeControlValueAccessor/dateTimeControlValueAccessor.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts +3 -3
- package/src/modules/dateTime/directives/dateTimeInput/dateTimeInput.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts +3 -3
- package/src/modules/dateTime/directives/dateTimeMaxValidator/dateTimeMaxValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts +3 -3
- package/src/modules/dateTime/directives/dateTimeMinValidator/dateTimeMinValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts +3 -3
- package/src/modules/dateTime/directives/dateTimeValidator/dateTimeValidator.directive.d.ts.map +1 -1
- package/src/modules/dateTime/modules/dateTime.module.d.ts +1 -1
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts +4 -4
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.html +1 -1
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts +3 -3
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.html +21 -12
- package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.d.ts +3 -3
- package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.html +7 -5
- package/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.d.ts +3 -3
- package/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.html +41 -29
- package/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.d.ts +3 -3
- package/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.html +7 -5
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts +5 -5
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.d.ts +7 -7
- package/src/modules/dateTimePicker/directives/loopScroll/loopScroll.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.d.ts +3 -3
- package/src/modules/dateTimePicker/directives/loopScrollData/loopScrollData.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/interfaces/periodData/periodData.interface.d.ts.map +1 -1
- package/src/modules/dateTimePicker/modules/dateTimePicker.module.d.ts +3 -3
- package/src/modules/dateTimePicker/modules/dateTimePicker.module.d.ts.map +1 -1
- package/src/pipes/dateConvert.pipe.d.ts +1 -1
- package/src/pipes/dateFormat.pipe.d.ts +1 -1
- package/src/services/dateApi/dateApi.interface.d.ts +11 -1
- package/src/services/dateApi/dateApi.interface.d.ts.map +1 -1
- package/src/services/dateValueProvider/dateValueProvider.service.d.ts.map +1 -1
- package/version.bak +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"momentDateApi.service.js","sourceRoot":"","sources":["../../../../moment/src/services/momentDateApi.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAgB,MAA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CAAC,iBAAiB,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;IACjF,CAAC;IAED;;OAEG;IACI,GAAG;QAEN,OAAO,IAAI,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,CAAC,CAAC;IAChD,CAAC;IAED;;;OAGG;IACI,SAAS,CAAC,YAAoB;QAEjC,IAAG,yBAAyB,CAAC,IAAI,CAAC,YAAY,CAAC,EAC/C;YACI,OAAO,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,cAAc,CAAC,GAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SACrH;QAED,OAAO,YAAY,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,kBAAkB;QAErB,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,aAAa;QAEhB,OAAO,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAc;QAExB,OAAO,KAAK,YAAY,MAAM,CAAC;IACnC,CAAC;uGAhEQ,aAAa,wDAIF,oBAAoB;2GAJ/B,aAAa;;2FAAb,aAAa;kBADzB,UAAU;;0BAKM,MAAM;2BAAC,oBAAoB;;AA+D5C;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA0D,mBAAmB,CAAC;AAElH;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACxC;IACI,OAAO,EAAE,oBAAoB;IAC7B,QAAQ,EAAE,uBAAuB;CACpC,CAAC","sourcesContent":["import {Inject, Injectable, ValueProvider} from '@angular/core';\nimport {DateApi, DateValue, DateApiObject, DateTimeRelativeParser, DateApiObjectCtor, DATE_API_OBJECT_TYPE, DateObject} from '@anglr/datetime';\nimport {isBlank, isPresent} from '@jscrpt/common';\nimport moment, {LongDateFormatKey} from 'moment';\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nexport class MomentDateApiObject implements DateApiObject<moment.Moment>\n{\n //######################### protected fields #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n protected _originalValue: moment.Moment;\n\n /**\n * Instance of date\n */\n protected _value: moment.Moment;\n\n //######################### public properties - implementation of DateApiObject #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n public get originalValue(): moment.Moment\n {\n return this._originalValue;\n }\n\n /**\n * Instance of date\n */\n public get value(): moment.Moment\n {\n return this._value;\n }\n\n //######################### constructor #########################\n constructor(value: DateValue|moment.Moment, format?: string)\n {\n this._value = this._originalValue = moment(value, format);\n }\n\n //######################### public methods - implementation of DateApiObject #########################\n\n /**\n * Gets indication whether provided instance of date is valid\n */\n public isValid(): boolean\n {\n return this._value.isValid();\n }\n\n /**\n * Gets indication whether provided instance of date is weekend day\n */\n public isWeekend(): boolean\n {\n const weekday = this._value.isoWeekday();\n\n return weekday == 6 || weekday == 7;\n }\n\n /**\n * Formats date value\n * @param format - Format token used for creating formatted string\n */\n public format(format: string): string\n {\n return this._value.format(format.replace(/y/g, 'Y').replace(/d/g, 'D'));\n }\n\n /**\n * @inheritdoc\n */\n public formatISO(): string\n {\n return this._value.format();\n }\n\n /**\n * @inheritdoc\n */\n public unixTimestamp(): number\n {\n return this._value.unix();\n }\n\n /**\n * Updates value to start date and time of current decade\n * @returns Itself for fluent API\n */\n public startOfDecade(): DateApiObject<moment.Moment>\n {\n const diff = (this._value.year() % 10);\n\n this._value = moment(this._value).subtract(diff, 'years').startOf('year');\n \n return this;\n }\n\n /**\n * Updates value to end date and time of current decade\n * @returns Itself for fluent API\n */\n public endOfDecade(): DateApiObject<moment.Moment>\n {\n const diff = 9 - (this._value.year() % 10);\n\n this._value = moment(this._value).add(diff, 'years').endOf('year');\n \n return this;\n }\n\n /**\n * Updates value to start date and time of current year\n * @returns Itself for fluent API\n */\n public startOfYear(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('year');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current year\n * @returns Itself for fluent API\n */\n public endOfYear(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('year');\n\n return this;\n }\n\n /**\n * Add years, if count not specified adds 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public addYears(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'years');\n\n return this;\n }\n\n /**\n * Subtract years, if count not specified subtract 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public subtractYears(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'years');\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current month\n * @returns Itself for fluent API\n */\n public startOfMonth(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('month');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current month\n * @returns Itself for fluent API\n */\n public endOfMonth(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('month');\n\n return this;\n }\n\n /**\n * Add months, if count not specified adds 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public addMonths(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'months');\n\n return this;\n }\n\n /**\n * Subtract months, if count not specified subtract 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public subtractMonths(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'months');\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current week\n * @returns Itself for fluent API\n */\n public startOfWeek(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('week');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current week\n * @returns Itself for fluent API\n */\n public endOfWeek(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('week');\n\n return this;\n }\n\n /**\n * Add weeks, if count not specified adds 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public addWeeks(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'weeks');\n\n return this;\n }\n\n /**\n * Subtract weeks, if count not specified subtract 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public subtractWeeks(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'weeks');\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current day\n * @returns Itself for fluent API\n */\n public startOfDay(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('day');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current day\n * @returns Itself for fluent API\n */\n public endOfDay(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('day');\n\n return this;\n }\n\n /**\n * Add days, if count not specified adds 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public addDays(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'days');\n\n return this;\n }\n\n /**\n * Subtract days, if count not specified subtract 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public subtractDays(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'days');\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current hour\n * @returns Itself for fluent API\n */\n public startOfHour(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('hour');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current hour\n * @returns Itself for fluent API\n */\n public endOfHour(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('hour');\n\n return this;\n }\n\n /**\n * Add hours, if count not specified adds 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n public addHours(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'hours');\n\n return this;\n }\n\n /**\n * Subtract hours, if count not specified subtract 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n public subtractHours(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'hours');\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current minute\n * @returns Itself for fluent API\n */\n public startOfMinute(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('minute');\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current minute\n * @returns Itself for fluent API\n */\n public endOfMinute(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('minute');\n\n return this;\n }\n\n /**\n * Add minutes, if count not specified adds 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public addMinutes(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'minutes');\n\n return this;\n }\n\n /**\n * Subtract minutes, if count not specified subtract 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public subtractMinutes(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'minutes');\n\n return this;\n }\n\n /**\n * Gets number of days in month\n */\n public daysInMonth(): number\n {\n return this._value.daysInMonth();\n }\n\n /**\n * Gets year\n */\n public year(): number;\n /**\n * Sets year\n * @param year - Year to be set\n */\n public year(year: number): DateApiObject<moment.Moment>;\n /**\n * Gets or sets year\n * @param year - If specified, sets year\n */\n public year(year?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(year))\n {\n this._value = moment(this._value).year(year);\n\n return this;\n }\n\n return this._value.year();\n }\n\n /**\n * Gets month\n */\n public month(): number\n /**\n * Sets month\n * @param month - Month to be set\n */\n public month(month: number): DateApiObject<moment.Moment>\n /**\n * Gets or sets month\n * @param month - If specified, sets month\n */\n public month(month?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(month))\n {\n this._value = moment(this._value).month(month);\n\n return this;\n }\n\n return this._value.month();\n }\n\n /**\n * Gets day of month one based\n */\n public dayOfMonth(): number;\n /**\n * Sets day of month one based\n * @param day - Day of month to be set\n */\n public dayOfMonth(day: number): DateApiObject<moment.Moment>;\n /**\n * Gets or sets day of month one based\n * @param day - If specified, sets day of month\n */\n public dayOfMonth(day?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(day))\n {\n this._value = moment(this._value).date(day);\n\n return this;\n }\n\n return this._value.date();\n }\n\n /**\n * Gets day of week zero based, first is monday\n */\n public dayOfWeek(): number;\n /**\n * Sets day of week zero based, first is monday\n * @param day - Day of week to be set\n */\n public dayOfWeek(day: number): DateApiObject<moment.Moment>;\n /**\n * Gets or sets day of week zero based, first is monday\n * @param day - If specified, sets day of week\n */\n public dayOfWeek(day?: number): number|DateApiObject<moment.Moment>\n {\n if(isPresent(day))\n {\n this._value = moment(this._value).weekday(day);\n\n return this;\n }\n\n return this._value.weekday();\n }\n\n /**\n * Gets hours zero based\n */\n public hour(): number;\n /**\n * Sets hours zero\n * @param hour - hour to be set\n */\n public hour(hour: number): DateApiObject<moment.Moment>;\n /**\n * Gets or sets hours zero\n * @param hour - If specified, sets hour\n */\n public hour(hour?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(hour))\n {\n this._value = moment(this._value).hours(hour);\n\n return this;\n }\n\n return this._value.hours();\n }\n\n /**\n * Gets minutes zero based\n */\n public minute(): number;\n /**\n * Sets minutes zero based\n * @param minute - minutes to be set\n */\n public minute(minute: number): DateApiObject<moment.Moment>;\n /**\n * Gets or sets minutes zero based\n * @param minute - If specified, sets minutes\n */\n public minute(minute?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(minute))\n {\n this._value = moment(this._value).minutes(minute);\n\n return this;\n }\n\n return this._value.minutes();\n }\n\n /**\n * Gets indication whether current value is before 'date'\n * @param date - Date which is this date compared to\n */\n public isBefore(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n return this._value.isBefore(date);\n }\n\n /**\n * Gets indication whether current value is after 'date'\n * @param date - Date which is this date compared to\n */\n public isAfter(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n return this._value.isAfter(date);\n }\n\n /**\n * Gets number of days between this and provided date\n * @param date - Date which is used for computation of diff against\n */\n public diffDays(date: DateObject<moment.Moment>): number\n {\n date = this.getDate(date);\n\n return moment(this._value).startOf('day').diff(moment(date).startOf('day'), 'days');\n }\n\n /**\n * Compares whether this date is same week as provided date\n * @param date - Date which is used for comparison of same week\n */\n public isSameWeek(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n return this._value.isSame(date, 'week');\n }\n\n /**\n * Compares whether this date is same decade as provided date\n * @param date - Date which is used for comparison of same decade\n */\n public isSameDecade(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n const year = this._value.year();\n const start = year - (year % 10);\n const end = start + 10;\n\n return date.year() >= start && date.year() < end;\n }\n\n /**\n * Compares whether this date is same year as provided date\n * @param date - Date which is used for comparison of same year\n */\n public isSameYear(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n return this._value.isSame(date, 'year');\n }\n\n /**\n * Compares whether this date is same month as provided date\n * @param date - Date which is used for comparison of same month\n */\n public isSameMonth(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n return this._value.isSame(date, 'month');\n }\n\n /**\n * Compares whether this date is same day as provided date\n * @param date - Date which is used for comparison of same day\n */\n public isSameDay(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n return this._value.isSame(date, 'day');\n }\n\n /**\n * @inheritdoc\n */\n public isSame(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n return this._value.isSame(date);\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from value\n */\n public clone(): DateApiObject<moment.Moment>\n {\n return new MomentDateApiObject(moment(this._value));\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue\n */\n public cloneOriginal(): DateApiObject<moment.Moment>\n {\n return new MomentDateApiObject(moment(this._originalValue));\n }\n\n /**\n * Updates originalValue, if value is not provided originalValue is set to value\n * @param value - Value to be set as original, or null (value will be used as value)\n * @returns Itself for fluent API\n */\n public updateOriginal(value?: moment.Moment): DateApiObject<moment.Moment>\n {\n if(isBlank(value))\n {\n this._originalValue = this._value;\n }\n else\n {\n this._value = this._originalValue = value!;\n }\n\n return this;\n }\n\n /**\n * Changes value to same value as originalValue\n * @returns Itself for fluent API\n */\n public resetOriginal(): DateApiObject<moment.Moment>\n {\n this._value = this._originalValue;\n\n return this;\n }\n\n //######################### protected methods #########################\n\n /**\n * Converts date object to date\n * @param value - Value to be converted to date\n */\n protected getDate(value: DateObject<moment.Moment>): moment.Moment\n {\n if(value instanceof moment)\n {\n return value as moment.Moment;\n }\n\n return (value as DateApiObject<moment.Moment>).value;\n }\n}\n\n/**\n * Date api using MomentJS, used for obtaining DateApi wrapper object\n */\n@Injectable()\nexport class MomentDateApi implements DateApi<moment.Moment>\n{\n //######################### constructor #########################\n constructor(protected _relativeParser: DateTimeRelativeParser<moment.Moment>,\n @Inject(DATE_API_OBJECT_TYPE) protected _dateApiObjecType: DateApiObjectCtor<moment.Moment, MomentDateApiObject>)\n {\n }\n\n //######################### public methods #########################\n\n /**\n * Gets wrapping object used for manipulation\n * @param value - Value to be converted (parsed) and used for manipulation\n * @param format - Format string used for parsing string value\n */\n public getValue(value: DateValue|moment.Moment, format?: string): DateApiObject<moment.Moment>\n {\n return new this._dateApiObjecType(this._relativeParser.parse(value), format);\n }\n\n /**\n * Gets wrapping object used for manipulation instantiated to current date and time\n */\n public now(): DateApiObject<moment.Moment>\n {\n return new this._dateApiObjecType(moment());\n }\n\n /**\n * Gets format string using pseudo format\n * @param pseudoFormat - Pseudo format token, used for obtaining 'date' or 'time' format string\n */\n public getFormat(pseudoFormat: string): string\n {\n if(/^((LT|LTS|L+|l+)\\s*)*$/g.test(pseudoFormat))\n {\n return pseudoFormat.split(' ').map(itm => moment.localeData().longDateFormat(itm as LongDateFormatKey)).join(' ');\n }\n\n return pseudoFormat;\n }\n\n /**\n * Gets information \n */\n public weekStartsOnMonday(): boolean\n {\n return moment.localeData().firstDayOfWeek() === 1;\n }\n\n /**\n * Gets array of weekday names in short format, order of days is dependent on locale\n */\n public weekdaysShort(): string[]\n {\n return moment.weekdaysShort(true);\n }\n\n /**\n * @inheritdoc\n */\n public isDate(value: unknown): value is moment.Moment\n {\n return value instanceof moment;\n }\n}\n\n/**\n * Type that represents creation of DateApiObject for moment\n */\nexport const momentDateApiObjectType: DateApiObjectCtor<moment.Moment, MomentDateApiObject> = MomentDateApiObject;\n\n/**\n * Injection token used for injecting type that creates instance of DateApiObject for moment\n */\nexport const MOMENT_DATE_API_OBJECT_TYPE: ValueProvider =\n{\n provide: DATE_API_OBJECT_TYPE,\n useValue: momentDateApiObjectType\n};\n"]}
|
|
1
|
+
{"version":3,"file":"momentDateApi.service.js","sourceRoot":"","sources":["../../../../moment/src/services/momentDateApi.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAgB,MAAM,eAAe,CAAC;AAChE,OAAO,EAAoC,sBAAsB,EAAqB,oBAAoB,EAAa,MAAM,iBAAiB,CAAC;AAC/I,OAAO,EAAC,OAAO,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,MAA2B,MAAM,QAAQ,CAAC;;;AAEjD;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAc5B,yGAAyG;IAEzG;;OAEG;IACH,IAAW,aAAa;QAEpB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QAEZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,iEAAiE;IACjE,YAAY,KAA8B,EAAE,MAAe;QAEvD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IAED,sGAAs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AAE,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IAED;;OAEG;IACI,QAAQ,CAAC,KAAe;QAE3B,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtE,CAAC;IAED;;OAEG;IACI,aAAa;QAEhB,OAAO,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,KAAc;QAExB,OAAO,KAAK,YAAY,MAAM,CAAC;IACnC,CAAC;8GArEQ,aAAa,wDAIF,oBAAoB;kHAJ/B,aAAa;;2FAAb,aAAa;kBADzB,UAAU;;0BAKM,MAAM;2BAAC,oBAAoB;;AAoE5C;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA0D,mBAAmB,CAAC;AAElH;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GACxC;IACI,OAAO,EAAE,oBAAoB;IAC7B,QAAQ,EAAE,uBAAuB;CACpC,CAAC","sourcesContent":["import {Inject, Injectable, ValueProvider} from '@angular/core';\nimport {DateApi, DateValue, DateApiObject, DateTimeRelativeParser, DateApiObjectCtor, DATE_API_OBJECT_TYPE, DateObject} from '@anglr/datetime';\nimport {isBlank, isPresent} from '@jscrpt/common';\nimport moment, {LongDateFormatKey} from 'moment';\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nexport class MomentDateApiObject implements DateApiObject<moment.Moment>\n{\n //######################### protected fields #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n protected _originalValue: moment.Moment;\n\n /**\n * Instance of date\n */\n protected _value: moment.Moment;\n\n //######################### public properties - implementation of DateApiObject #########################\n\n /**\n * @inheritdoc\n */\n public get originalValue(): moment.Moment\n {\n return this._originalValue;\n }\n\n /**\n * @inheritdoc\n */\n public get value(): moment.Moment\n {\n return this._value;\n }\n\n //######################### constructor #########################\n constructor(value: DateValue|moment.Moment, format?: string)\n {\n this._value = this._originalValue = moment(value, format);\n }\n\n //######################### public methods - implementation of DateApiObject #########################\n\n /**\n * @inheritdoc\n */\n public isValid(): boolean\n {\n return this._value.isValid();\n }\n\n /**\n * @inheritdoc\n */\n public isWeekend(): boolean\n {\n const weekday = this._value.isoWeekday();\n\n return weekday == 6 || weekday == 7;\n }\n\n /**\n * @inheritdoc\n */\n public format(format: string): string\n {\n return this._value.format(format.replace(/y/g, 'Y').replace(/d/g, 'D'));\n }\n\n /**\n * @inheritdoc\n */\n public formatISO(): string\n {\n return this._value.format();\n }\n\n /**\n * @inheritdoc\n */\n public unixTimestamp(): number\n {\n return this._value.unix();\n }\n\n /**\n * @inheritdoc\n */\n public timestamp(): number\n {\n return this._value.valueOf();\n }\n\n /**\n * @inheritdoc\n */\n public startOfDecade(): DateApiObject<moment.Moment>\n {\n const diff = (this._value.year() % 10);\n\n this._value = moment(this._value).subtract(diff, 'years').startOf('year');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public endOfDecade(): DateApiObject<moment.Moment>\n {\n const diff = 9 - (this._value.year() % 10);\n\n this._value = moment(this._value).add(diff, 'years').endOf('year');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public startOfYear(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('year');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public endOfYear(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('year');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public addYears(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'years');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public subtractYears(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'years');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public startOfMonth(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('month');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public endOfMonth(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('month');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public addMonths(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'months');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public subtractMonths(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'months');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public startOfWeek(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('week');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public endOfWeek(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('week');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public addWeeks(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'weeks');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public subtractWeeks(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'weeks');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public startOfDay(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('day');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public endOfDay(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('day');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public addDays(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'days');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public subtractDays(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'days');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public startOfHour(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('hour');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public endOfHour(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('hour');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public addHours(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'hours');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public subtractHours(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'hours');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public startOfMinute(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).startOf('minute');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public endOfMinute(): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).endOf('minute');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public addMinutes(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).add(count ?? 1, 'minutes');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public subtractMinutes(count?: number): DateApiObject<moment.Moment>\n {\n this._value = moment(this._value).subtract(count ?? 1, 'minutes');\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public daysInMonth(): number\n {\n return this._value.daysInMonth();\n }\n\n /**\n * @inheritdoc\n */\n public year(): number;\n public year(year: number): DateApiObject<moment.Moment>;\n public year(year?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(year))\n {\n this._value = moment(this._value).year(year);\n\n return this;\n }\n\n return this._value.year();\n }\n\n /**\n * @inheritdoc\n */\n public month(): number\n public month(month: number): DateApiObject<moment.Moment>\n public month(month?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(month))\n {\n this._value = moment(this._value).month(month);\n\n return this;\n }\n\n return this._value.month();\n }\n\n /**\n * @inheritdoc\n */\n public dayOfMonth(): number;\n public dayOfMonth(day: number): DateApiObject<moment.Moment>;\n public dayOfMonth(day?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(day))\n {\n this._value = moment(this._value).date(day);\n\n return this;\n }\n\n return this._value.date();\n }\n\n /**\n * @inheritdoc\n */\n public dayOfWeek(): number;\n public dayOfWeek(day: number): DateApiObject<moment.Moment>;\n public dayOfWeek(day?: number): number|DateApiObject<moment.Moment>\n {\n if(isPresent(day))\n {\n this._value = moment(this._value).weekday(day);\n\n return this;\n }\n\n return this._value.weekday();\n }\n\n /**\n * @inheritdoc\n */\n public hour(): number;\n public hour(hour: number): DateApiObject<moment.Moment>;\n public hour(hour?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(hour))\n {\n this._value = moment(this._value).hours(hour);\n\n return this;\n }\n\n return this._value.hours();\n }\n\n /**\n * @inheritdoc\n */\n public minute(): number;\n public minute(minute: number): DateApiObject<moment.Moment>;\n public minute(minute?: number): DateApiObject<moment.Moment>|number\n {\n if(isPresent(minute))\n {\n this._value = moment(this._value).minutes(minute);\n\n return this;\n }\n\n return this._value.minutes();\n }\n\n /**\n * @inheritdoc\n */\n public isBefore(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n return this._value.isBefore(date);\n }\n\n /**\n * @inheritdoc\n */\n public isAfter(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n return this._value.isAfter(date);\n }\n\n /**\n * @inheritdoc\n */\n public diffDays(date: DateObject<moment.Moment>): number\n {\n date = this.getDate(date);\n\n return moment(this._value).startOf('day').diff(moment(date).startOf('day'), 'days');\n }\n\n /**\n * @inheritdoc\n */\n public isSameWeek(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n return this._value.isSame(date, 'week');\n }\n\n /**\n * @inheritdoc\n */\n public isSameDecade(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n const year = this._value.year();\n const start = year - (year % 10);\n const end = start + 10;\n\n return date.year() >= start && date.year() < end;\n }\n\n /**\n * @inheritdoc\n */\n public isSameYear(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n return this._value.isSame(date, 'year');\n }\n\n /**\n * @inheritdoc\n */\n public isSameMonth(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n return this._value.isSame(date, 'month');\n }\n\n /**\n * @inheritdoc\n */\n public isSameDay(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n return this._value.isSame(date, 'day');\n }\n\n /**\n * @inheritdoc\n */\n public isSame(date: DateObject<moment.Moment>): boolean\n {\n date = this.getDate(date);\n\n return this._value.isSame(date);\n }\n\n /**\n * @inheritdoc\n */\n public clone(): DateApiObject<moment.Moment>\n {\n return new MomentDateApiObject(moment(this._value));\n }\n\n /**\n * @inheritdoc\n */\n public cloneOriginal(): DateApiObject<moment.Moment>\n {\n return new MomentDateApiObject(moment(this._originalValue));\n }\n\n /**\n * @inheritdoc\n */\n public updateOriginal(value?: moment.Moment): DateApiObject<moment.Moment>\n {\n if(isBlank(value))\n {\n this._originalValue = this._value;\n }\n else\n {\n this._value = this._originalValue = value!;\n }\n\n return this;\n }\n\n /**\n * @inheritdoc\n */\n public resetOriginal(): DateApiObject<moment.Moment>\n {\n this._value = this._originalValue;\n\n return this;\n }\n\n //######################### protected methods #########################\n\n /**\n * Converts date object to date\n * @param value - Value to be converted to date\n */\n protected getDate(value: DateObject<moment.Moment>): moment.Moment\n {\n if(value instanceof moment)\n {\n return value as moment.Moment;\n }\n\n return (value as DateApiObject<moment.Moment>).value;\n }\n}\n\n/**\n * Date api using MomentJS, used for obtaining DateApi wrapper object\n */\n@Injectable()\nexport class MomentDateApi implements DateApi<moment.Moment>\n{\n //######################### constructor #########################\n constructor(protected _relativeParser: DateTimeRelativeParser<moment.Moment>,\n @Inject(DATE_API_OBJECT_TYPE) protected _dateApiObjecType: DateApiObjectCtor<moment.Moment, MomentDateApiObject>)\n {\n }\n\n //######################### public methods #########################\n\n /**\n * @inheritdoc\n */\n public getValue(value: DateValue|moment.Moment, format?: string): DateApiObject<moment.Moment>\n {\n return new this._dateApiObjecType(this._relativeParser.parse(value), format);\n }\n\n /**\n * @inheritdoc\n */\n public now(): DateApiObject<moment.Moment>\n {\n return new this._dateApiObjecType(moment());\n }\n\n /**\n * @inheritdoc\n */\n public getFormat(pseudoFormat: string): string\n {\n if(/^((LT|LTS|L+|l+)\\s*)*$/g.test(pseudoFormat))\n {\n return pseudoFormat.split(' ').map(itm => moment.localeData().longDateFormat(itm as LongDateFormatKey)).join(' ');\n }\n\n return pseudoFormat;\n }\n\n /**\n * @inheritdoc\n */\n public weekStartsOnMonday(): boolean\n {\n return moment.localeData().firstDayOfWeek() === 1;\n }\n\n /**\n * @inheritdoc\n */\n public weekdays(short?: boolean): string[]\n {\n return short ? moment.weekdaysShort(true) : moment.weekdays(true);\n }\n\n /**\n * @inheritdoc\n */\n public weekdaysShort(): string[]\n {\n return moment.weekdaysShort(true);\n }\n\n /**\n * @inheritdoc\n */\n public isDate(value: unknown): value is moment.Moment\n {\n return value instanceof moment;\n }\n}\n\n/**\n * Type that represents creation of DateApiObject for moment\n */\nexport const momentDateApiObjectType: DateApiObjectCtor<moment.Moment, MomentDateApiObject> = MomentDateApiObject;\n\n/**\n * Injection token used for injecting type that creates instance of DateApiObject for moment\n */\nexport const MOMENT_DATE_API_OBJECT_TYPE: ValueProvider =\n{\n provide: DATE_API_OBJECT_TYPE,\n useValue: momentDateApiObjectType\n};\n"]}
|
|
@@ -10,20 +10,7 @@ import * as i1 from "../../services";
|
|
|
10
10
|
/**
|
|
11
11
|
* Directive that is used for setting up date time input for button
|
|
12
12
|
*/
|
|
13
|
-
export class
|
|
14
|
-
elementRef;
|
|
15
|
-
dateApi;
|
|
16
|
-
valueProvider;
|
|
17
|
-
//######################### protected properties #########################
|
|
18
|
-
/**
|
|
19
|
-
* Internal representation of current date time value
|
|
20
|
-
*/
|
|
21
|
-
internalValue;
|
|
22
|
-
//######################### public properties - implementation of DateTimeInput #########################
|
|
23
|
-
/**
|
|
24
|
-
* @inheritdoc
|
|
25
|
-
*/
|
|
26
|
-
rawValue;
|
|
13
|
+
export class ButtonDateTimeInputDirective extends DateTimeBase {
|
|
27
14
|
/**
|
|
28
15
|
* @inheritdoc
|
|
29
16
|
*/
|
|
@@ -59,20 +46,20 @@ export class ButtonDateTimeInputSADirective extends DateTimeBase {
|
|
|
59
46
|
get element() {
|
|
60
47
|
return this.elementRef.nativeElement;
|
|
61
48
|
}
|
|
62
|
-
/**
|
|
63
|
-
* @inheritdoc
|
|
64
|
-
*/
|
|
65
|
-
focus = new EventEmitter();
|
|
66
|
-
/**
|
|
67
|
-
* @inheritdoc
|
|
68
|
-
*/
|
|
69
|
-
blur = new EventEmitter();
|
|
70
49
|
//######################### constructors #########################
|
|
71
50
|
constructor(elementRef, dateApi, valueProvider) {
|
|
72
51
|
super();
|
|
73
52
|
this.elementRef = elementRef;
|
|
74
53
|
this.dateApi = dateApi;
|
|
75
54
|
this.valueProvider = valueProvider;
|
|
55
|
+
/**
|
|
56
|
+
* @inheritdoc
|
|
57
|
+
*/
|
|
58
|
+
this.focus = new EventEmitter();
|
|
59
|
+
/**
|
|
60
|
+
* @inheritdoc
|
|
61
|
+
*/
|
|
62
|
+
this.blur = new EventEmitter();
|
|
76
63
|
this.elementRef.nativeElement.addEventListener('click', this.handleClick);
|
|
77
64
|
this.elementRef.nativeElement.addEventListener('blur', this.handleBlur);
|
|
78
65
|
}
|
|
@@ -107,34 +94,34 @@ export class ButtonDateTimeInputSADirective extends DateTimeBase {
|
|
|
107
94
|
handleBlur(event) {
|
|
108
95
|
this.blur.emit(event);
|
|
109
96
|
}
|
|
110
|
-
static
|
|
111
|
-
static
|
|
97
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: ButtonDateTimeInputDirective, deps: [{ token: i0.ElementRef }, { token: DATE_API }, { token: i1.DateValueProvider }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
98
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: ButtonDateTimeInputDirective, isStandalone: true, selector: "button[dateTime][dateTimeInput],a[dateTime][dateTimeInput]", inputs: { value: "value" }, providers: [
|
|
112
99
|
{
|
|
113
100
|
provide: DATE_TIME_INPUT,
|
|
114
|
-
useExisting: forwardRef(() =>
|
|
101
|
+
useExisting: forwardRef(() => ButtonDateTimeInputDirective),
|
|
115
102
|
},
|
|
116
|
-
], exportAs: ["dateTime"], usesInheritance: true, ngImport: i0 });
|
|
103
|
+
], exportAs: ["dateTime"], usesInheritance: true, ngImport: i0 }); }
|
|
117
104
|
}
|
|
118
105
|
__decorate([
|
|
119
106
|
BindThis,
|
|
120
107
|
__metadata("design:type", Function),
|
|
121
108
|
__metadata("design:paramtypes", [FocusEvent]),
|
|
122
109
|
__metadata("design:returntype", void 0)
|
|
123
|
-
],
|
|
110
|
+
], ButtonDateTimeInputDirective.prototype, "handleClick", null);
|
|
124
111
|
__decorate([
|
|
125
112
|
BindThis,
|
|
126
113
|
__metadata("design:type", Function),
|
|
127
114
|
__metadata("design:paramtypes", [FocusEvent]),
|
|
128
115
|
__metadata("design:returntype", void 0)
|
|
129
|
-
],
|
|
130
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
116
|
+
], ButtonDateTimeInputDirective.prototype, "handleBlur", null);
|
|
117
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: ButtonDateTimeInputDirective, decorators: [{
|
|
131
118
|
type: Directive,
|
|
132
119
|
args: [{
|
|
133
120
|
selector: 'button[dateTime][dateTimeInput],a[dateTime][dateTimeInput]',
|
|
134
121
|
providers: [
|
|
135
122
|
{
|
|
136
123
|
provide: DATE_TIME_INPUT,
|
|
137
|
-
useExisting: forwardRef(() =>
|
|
124
|
+
useExisting: forwardRef(() => ButtonDateTimeInputDirective),
|
|
138
125
|
},
|
|
139
126
|
],
|
|
140
127
|
standalone: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buttonDateTimeInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAoB,UAAU,EAAE,MAAM,EAAE,KAAK,EAAY,MAAM,eAAe,CAAC;AAC1H,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAC,YAAY,EAAC,MAAM,gDAAgD,CAAC;AAG5E,OAAO,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAU,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;;;AAE1D;;GAEG;AAeH,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"buttonDateTimeInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/buttonDateTimeInput/buttonDateTimeInput.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAoB,UAAU,EAAE,MAAM,EAAE,KAAK,EAAY,MAAM,eAAe,CAAC;AAC1H,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAC,YAAY,EAAC,MAAM,gDAAgD,CAAC;AAG5E,OAAO,EAAC,cAAc,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAU,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;;;AAE1D;;GAEG;AAeH,MAAM,OAAO,4BAA8C,SAAQ,YAAmB;IAgBlF;;OAEG;IACH,IACoB,KAAK;QAErB,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IACD,IAAoB,KAAK,CAAC,KAAqD;QAE3E,+BAA+B;QAC/B,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC7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qBACJ;oBACD,UAAU,EAAE,IAAI;oBAChB,QAAQ,EAAE,UAAU;iBACvB;;0BA6EgB,MAAM;2BAAC,QAAQ;yEAxDR,KAAK;sBADxB,KAAK;gBA+FI,WAAW,MAUX,UAAU","sourcesContent":["import {Directive, ElementRef, EventEmitter, ExistingProvider, forwardRef, Inject, Input, OnDestroy} from '@angular/core';\nimport {BindThis} from '@jscrpt/common';\n\nimport {DATE_API, DATE_TIME_INPUT} from '../../misc/tokens';\nimport {DateTimeBase} from '../../modules/dateTime/directives/dateTimeBase';\nimport {DateTimeInput} from '../../interfaces';\nimport {DateTimeInputOutputValue, DateTimeObjectValue} from '../../misc/types';\nimport {formatDateTime, getInternalValue} from '../../misc/utils';\nimport {DateApi, DateValueProvider} from '../../services';\n\n/**\n * Directive that is used for setting up date time input for button\n */\n@Directive(\n{\n selector: 'button[dateTime][dateTimeInput],a[dateTime][dateTimeInput]',\n providers:\n [\n <ExistingProvider>\n {\n provide: DATE_TIME_INPUT,\n useExisting: forwardRef(() => ButtonDateTimeInputDirective),\n },\n ],\n standalone: true,\n exportAs: 'dateTime',\n})\nexport class ButtonDateTimeInputDirective<TDate = unknown> extends DateTimeBase<TDate> implements DateTimeInput, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Internal representation of current date time value\n */\n protected internalValue: DateTimeObjectValue<TDate>|undefined|null;\n\n //######################### public properties - implementation of DateTimeInput #########################\n\n /**\n * @inheritdoc\n */\n public rawValue: string|undefined|null;\n\n /**\n * @inheritdoc\n */\n @Input()\n public override get value(): DateTimeInputOutputValue<TDate>|undefined|null\n {\n return this.ɵValue;\n }\n public override set value(value: DateTimeInputOutputValue<TDate>|undefined|null)\n {\n //accepts all available formats\n this.setInternalValue(value);\n this.ɵValue = formatDateTime(this.internalValue, this.dateTimeData.valueFormat, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);\n \n //not range value\n if(!Array.isArray(this.internalValue))\n {\n this.rawValue = this.internalValue?.format(this.dateTimeData.customFormat);\n }\n else\n {\n //TODO: add support for ranges\n }\n\n this.valueSet.next();\n }\n\n /**\n * @inheritdoc\n */\n public get disabled(): boolean\n {\n //TODO: check if anchor\n return this.elementRef.nativeElement.disabled;\n }\n public set disabled(value: boolean)\n {\n this.elementRef.nativeElement.disabled = value;\n }\n\n /**\n * @inheritdoc\n */\n public get element(): HTMLElement\n {\n return this.elementRef.nativeElement;\n }\n\n /**\n * @inheritdoc\n */\n public focus: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();\n\n /**\n * @inheritdoc\n */\n public blur: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();\n\n //######################### constructors #########################\n constructor(protected elementRef: ElementRef<HTMLButtonElement>,\n @Inject(DATE_API) protected dateApi: DateApi<TDate>,\n protected valueProvider: DateValueProvider<TDate>,)\n {\n super();\n\n this.elementRef.nativeElement.addEventListener('click', this.handleClick);\n this.elementRef.nativeElement.addEventListener('blur', this.handleBlur);\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public override ngOnDestroy(): void\n {\n super.ngOnDestroy();\n\n this.elementRef.nativeElement.removeEventListener('click', this.handleClick);\n this.elementRef.nativeElement.removeEventListener('blur', this.handleBlur);\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets internal value and fix lowest time difference\n * @param value - Value to be set\n */\n protected setInternalValue(value: DateTimeInputOutputValue<TDate>|undefined|null): void\n {\n this.internalValue = getInternalValue(value, this.dateApi, this.dateTimeData, this.valueProvider);\n }\n\n /**\n * Handles focus event on input\n * @param event - Event that occured\n */\n @BindThis\n protected handleClick(event: FocusEvent): void\n {\n this.focus.emit(event);\n }\n\n /**\n * Handles blur event on input\n * @param event - Event that occured\n */\n @BindThis\n protected handleBlur(event: FocusEvent): void\n {\n this.blur.emit(event);\n }\n}"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Directive } from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { DateTimeInputDirective, DateTimePickerDirective } from '../../modules';
|
|
3
|
+
import { DateTimeInputHandlerDirective } from '../dateTimeInputHandler/dateTimeInputHandler.directive';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
import * as i1 from "../../modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive";
|
|
6
6
|
import * as i2 from "../../modules/dateTime/directives/dateTimeInput/dateTimeInput.directive";
|
|
@@ -8,28 +8,28 @@ import * as i3 from "../dateTimeInputHandler/dateTimeInputHandler.directive";
|
|
|
8
8
|
/**
|
|
9
9
|
* Directive that combines date picker with date input
|
|
10
10
|
*/
|
|
11
|
-
export class
|
|
12
|
-
static
|
|
13
|
-
static
|
|
11
|
+
export class DatePickerInputDirective {
|
|
12
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DatePickerInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
13
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: DatePickerInputDirective, isStandalone: true, selector: "input[dateTime][datePickerInput]", hostDirectives: [{ directive: i1.DateTimePickerDirective, inputs: ["withPickerOptions", "withPickerOptions", "pickerOptions", "pickerOptions"] }, { directive: i2.DateTimeInputDirective }, { directive: i3.DateTimeInputHandlerDirective }], ngImport: i0 }); }
|
|
14
14
|
}
|
|
15
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DatePickerInputDirective, decorators: [{
|
|
16
16
|
type: Directive,
|
|
17
17
|
args: [{
|
|
18
18
|
selector: 'input[dateTime][datePickerInput]',
|
|
19
19
|
standalone: true,
|
|
20
20
|
hostDirectives: [
|
|
21
21
|
{
|
|
22
|
-
directive:
|
|
22
|
+
directive: DateTimePickerDirective,
|
|
23
23
|
inputs: [
|
|
24
24
|
'withPickerOptions',
|
|
25
25
|
'pickerOptions',
|
|
26
26
|
]
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
directive:
|
|
29
|
+
directive: DateTimeInputDirective,
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
directive:
|
|
32
|
+
directive: DateTimeInputHandlerDirective,
|
|
33
33
|
},
|
|
34
34
|
],
|
|
35
35
|
}]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/datePickerInput/datePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"datePickerInput.directive.js","sourceRoot":"","sources":["../../../../src/directives/datePickerInput/datePickerInput.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,sBAAsB,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAC,6BAA6B,EAAC,MAAM,wDAAwD,CAAC;;;;;AAErG;;GAEG;AAuBH,MAAM,OAAO,wBAAwB;8GAAxB,wBAAwB;kGAAxB,wBAAwB;;2FAAxB,wBAAwB;kBAtBpC,SAAS;mBACV;oBACI,QAAQ,EAAE,kCAAkC;oBAC5C,UAAU,EAAE,IAAI;oBAChB,cAAc,EACd;wBACI;4BACI,SAAS,EAAE,uBAAuB;4BAClC,MAAM,EACN;gCACI,mBAAmB;gCACnB,eAAe;6BAClB;yBACJ;wBACD;4BACI,SAAS,EAAE,sBAAsB;yBACpC;wBACD;4BACI,SAAS,EAAE,6BAA6B;yBAC3C;qBACJ;iBACJ","sourcesContent":["import {Directive} from '@angular/core';\n\nimport {DateTimeInputDirective, DateTimePickerDirective} from '../../modules';\nimport {DateTimeInputHandlerDirective} from '../dateTimeInputHandler/dateTimeInputHandler.directive';\n\n/**\n * Directive that combines date picker with date input\n */\n@Directive(\n{\n selector: 'input[dateTime][datePickerInput]',\n standalone: true,\n hostDirectives:\n [\n {\n directive: DateTimePickerDirective,\n inputs:\n [\n 'withPickerOptions',\n 'pickerOptions',\n ]\n },\n {\n directive: DateTimeInputDirective,\n },\n {\n directive: DateTimeInputHandlerDirective,\n },\n ],\n})\nexport class DatePickerInputDirective\n{\n}"]}
|
|
@@ -4,7 +4,7 @@ import { BindThis } from '@jscrpt/common';
|
|
|
4
4
|
import { Subscription } from 'rxjs';
|
|
5
5
|
import { DATE_API, DATE_TIME_INPUT } from '../../misc/tokens';
|
|
6
6
|
import { parseDateTime, parseRawInput } from '../../misc/utils';
|
|
7
|
-
import {
|
|
7
|
+
import { DateTimePickerDirective, DateTimeDirective } from '../../modules';
|
|
8
8
|
import { DatePositionParserService, DateValueProvider } from '../../services';
|
|
9
9
|
import * as i0 from "@angular/core";
|
|
10
10
|
import * as i1 from "../../modules";
|
|
@@ -12,22 +12,7 @@ import * as i2 from "../../services";
|
|
|
12
12
|
/**
|
|
13
13
|
* Directive that adds handler for date time input, which allows navigation using keyboard and checking restriction of value
|
|
14
14
|
*/
|
|
15
|
-
export class
|
|
16
|
-
input;
|
|
17
|
-
dateApi;
|
|
18
|
-
dateTimeData;
|
|
19
|
-
parserSvc;
|
|
20
|
-
valueProvider;
|
|
21
|
-
picker;
|
|
22
|
-
//######################### protected properties #########################
|
|
23
|
-
/**
|
|
24
|
-
* Subscriptions created during initialization
|
|
25
|
-
*/
|
|
26
|
-
initSubscriptions = new Subscription();
|
|
27
|
-
/**
|
|
28
|
-
* Instance of parser created for specific format
|
|
29
|
-
*/
|
|
30
|
-
parser;
|
|
15
|
+
export class DateTimeInputHandlerDirective {
|
|
31
16
|
/**
|
|
32
17
|
* Gets input element as html input
|
|
33
18
|
*/
|
|
@@ -35,7 +20,7 @@ export class DateTimeInputHandlerSADirective {
|
|
|
35
20
|
if (this.input.element.nodeName == 'INPUT') {
|
|
36
21
|
return this.input.element;
|
|
37
22
|
}
|
|
38
|
-
throw new Error('You cant use
|
|
23
|
+
throw new Error('You cant use DateTimeInputHandlerDirective without input element!');
|
|
39
24
|
}
|
|
40
25
|
//######################### constructor #########################
|
|
41
26
|
constructor(input, dateApi, dateTimeData, parserSvc, valueProvider, picker) {
|
|
@@ -45,6 +30,11 @@ export class DateTimeInputHandlerSADirective {
|
|
|
45
30
|
this.parserSvc = parserSvc;
|
|
46
31
|
this.valueProvider = valueProvider;
|
|
47
32
|
this.picker = picker;
|
|
33
|
+
//######################### protected properties #########################
|
|
34
|
+
/**
|
|
35
|
+
* Subscriptions created during initialization
|
|
36
|
+
*/
|
|
37
|
+
this.initSubscriptions = new Subscription();
|
|
48
38
|
this.parser = parserSvc.createParser(this.dateTimeData.customFormat);
|
|
49
39
|
this.initSubscriptions.add(this.dateTimeData.customFormatChanges.subscribe(() => this.parser = parserSvc.createParser(this.dateTimeData.customFormat)));
|
|
50
40
|
}
|
|
@@ -287,34 +277,34 @@ export class DateTimeInputHandlerSADirective {
|
|
|
287
277
|
}
|
|
288
278
|
}
|
|
289
279
|
}
|
|
290
|
-
static
|
|
291
|
-
static
|
|
280
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeInputHandlerDirective, deps: [{ token: DATE_TIME_INPUT }, { token: DATE_API }, { token: i1.DateTimeDirective }, { token: i2.DatePositionParserService }, { token: i2.DateValueProvider }, { token: i1.DateTimePickerDirective, optional: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
281
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: DateTimeInputHandlerDirective, isStandalone: true, selector: "[dateTime][withHandler]", ngImport: i0 }); }
|
|
292
282
|
}
|
|
293
283
|
__decorate([
|
|
294
284
|
BindThis,
|
|
295
285
|
__metadata("design:type", Function),
|
|
296
286
|
__metadata("design:paramtypes", []),
|
|
297
287
|
__metadata("design:returntype", void 0)
|
|
298
|
-
],
|
|
288
|
+
], DateTimeInputHandlerDirective.prototype, "handleSelect", null);
|
|
299
289
|
__decorate([
|
|
300
290
|
BindThis,
|
|
301
291
|
__metadata("design:type", Function),
|
|
302
292
|
__metadata("design:paramtypes", []),
|
|
303
293
|
__metadata("design:returntype", void 0)
|
|
304
|
-
],
|
|
294
|
+
], DateTimeInputHandlerDirective.prototype, "handleClick", null);
|
|
305
295
|
__decorate([
|
|
306
296
|
BindThis,
|
|
307
297
|
__metadata("design:type", Function),
|
|
308
298
|
__metadata("design:paramtypes", [KeyboardEvent]),
|
|
309
299
|
__metadata("design:returntype", void 0)
|
|
310
|
-
],
|
|
300
|
+
], DateTimeInputHandlerDirective.prototype, "handleKeypress", null);
|
|
311
301
|
__decorate([
|
|
312
302
|
BindThis,
|
|
313
303
|
__metadata("design:type", Function),
|
|
314
304
|
__metadata("design:paramtypes", [KeyboardEvent]),
|
|
315
305
|
__metadata("design:returntype", void 0)
|
|
316
|
-
],
|
|
317
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
306
|
+
], DateTimeInputHandlerDirective.prototype, "handleKeyboard", null);
|
|
307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeInputHandlerDirective, decorators: [{
|
|
318
308
|
type: Directive,
|
|
319
309
|
args: [{
|
|
320
310
|
selector: '[dateTime][withHandler]',
|
|
@@ -326,7 +316,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.1", ngImpor
|
|
|
326
316
|
}] }, { type: undefined, decorators: [{
|
|
327
317
|
type: Inject,
|
|
328
318
|
args: [DATE_API]
|
|
329
|
-
}] }, { type: i1.
|
|
319
|
+
}] }, { type: i1.DateTimeDirective }, { type: i2.DatePositionParserService }, { type: i2.DateValueProvider }, { type: i1.DateTimePickerDirective, decorators: [{
|
|
330
320
|
type: Optional
|
|
331
321
|
}] }], propDecorators: { handleSelect: [], handleClick: [], handleKeypress: [], handleKeyboard: [] } });
|
|
332
322
|
//# sourceMappingURL=dateTimeInputHandler.directive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimeInputHandler.directive.js","sourceRoot":"","sources":["../../../../src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAqB,QAAQ,EAAC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAU,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAGlC,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAC,yBAAyB,EAAE,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAA6C,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;;;;AAExH;;GAEG;AAMH,MAAM,OAAO,+BAA+B;IA4BO;IACP;IAClB;IACA;IACA;IACY;IA/BlC,0EAA0E;IAE1E;;OAEG;IACO,iBAAiB,GAAiB,IAAI,YAAY,EAAE,CAAC;IAE/D;;OAEG;IACO,MAAM,CAAqB;IAErC;;OAEG;IACH,IAAc,YAAY;QAEtB,IAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,EACzC;YACI,OAAO,IAAI,CAAC,KAAK,CAAC,OAA2B,CAAC;SACjD;QAED,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IAC3F,CAAC;IAED,iEAAiE;IACjE,YAA+C,KAA2B,EAClC,OAAuB,EACzC,YAAwC,EACxC,SAAoC,EACpC,aAAuC,EAC3B,MAAyC;QAL5B,UAAK,GAAL,KAAK,CAAsB;QAClC,YAAO,GAAP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C;oBAE/F,MAAM;iBACT;YACD,KAAK,GAAG;gBACR;oBACI,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;oBAEnG,MAAM;iBACT;SACJ;IACL,CAAC;uGA1WQ,+BAA+B,kBA4BpB,eAAe,aACf,QAAQ;2FA7BnB,+BAA+B;;AAwE9B;IADT,QAAQ;;;;mEAkBR;AAMS;IADT,QAAQ;;;;kEAcR;AAOS;IADT,QAAQ;;qCACuB,aAAa;;qEAwB5C;AAOS;IADT,QAAQ;;qCACuB,aAAa;;qEA+F5C;2FAjPQ,+BAA+B;kBAL3C,SAAS;mBACV;oBACI,QAAQ,EAAE,yBAAyB;oBACnC,UAAU,EAAE,IAAI;iBACnB;;0BA6BgB,MAAM;2BAAC,eAAe;;0BACtB,MAAM;2BAAC,QAAQ;;0BAIf,QAAQ;yCAuCX,YAAY,MAuBZ,WAAW,MAoBX,cAAc,MA+Bd,cAAc","sourcesContent":["import {Directive, Inject, OnDestroy, OnInit, Optional} from '@angular/core';\nimport {Action1, BindThis} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {DateTimeInput} from '../../interfaces';\nimport {DATE_API, DATE_TIME_INPUT} from '../../misc/tokens';\nimport {DateTimeObjectValue} from '../../misc/types';\nimport {parseDateTime, parseRawInput} from '../../misc/utils';\nimport {DateTimePickerSADirective, DateTimeSADirective} from '../../modules';\nimport {DateApi, DateApiObject, DatePositionParser, DatePositionParserService, DateValueProvider} from '../../services';\n\n/**\n * Directive that adds handler for date time input, which allows navigation using keyboard and checking restriction of value\n */\n@Directive(\n{\n selector: '[dateTime][withHandler]',\n standalone: true,\n})\nexport class DateTimeInputHandlerSADirective<TDate = unknown> implements OnInit, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected initSubscriptions: Subscription = new Subscription();\n\n /**\n * Instance of parser created for specific format\n */\n protected parser: DatePositionParser;\n\n /**\n * Gets input element as html input\n */\n protected get inputElement(): HTMLInputElement\n {\n if(this.input.element.nodeName == 'INPUT')\n {\n return this.input.element as HTMLInputElement;\n }\n\n throw new Error('You cant use DateTimeInputHandlerSADirective without input element!');\n }\n\n //######################### constructor #########################\n constructor(@Inject(DATE_TIME_INPUT) protected input: DateTimeInput<TDate>,\n @Inject(DATE_API) protected dateApi: DateApi<TDate>,\n protected dateTimeData: DateTimeSADirective<TDate>,\n protected parserSvc: DatePositionParserService,\n protected valueProvider: DateValueProvider<TDate>,\n @Optional() protected picker?: DateTimePickerSADirective<TDate>,)\n {\n this.parser = parserSvc.createParser(this.dateTimeData.customFormat);\n this.initSubscriptions.add(this.dateTimeData.customFormatChanges.subscribe(() => this.parser = parserSvc.createParser(this.dateTimeData.customFormat)));\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.input.element.addEventListener('keydown', this.handleKeyboard);\n this.input.element.addEventListener('keypress', this.handleKeypress);\n this.input.element.addEventListener('select', this.handleSelect);\n this.input.element.addEventListener('click', this.handleClick);\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 this.input.element.removeEventListener('keydown', this.handleKeyboard);\n this.input.element.removeEventListener('keypress', this.handleKeypress);\n this.input.element.removeEventListener('select', this.handleSelect);\n this.input.element.removeEventListener('click', this.handleClick);\n }\n\n //######################### protected methods #########################\n\n /**\n * Handles selection of text inside of input\n */\n @BindThis\n protected handleSelect(): void\n {\n this.runWithValue(() =>\n {\n //handles when all text is selected\n if(this.inputElement.selectionStart == 0 && this.inputElement.selectionEnd == this.inputElement.value.length)\n {\n const result = this.parser.parse(this.inputElement.value, this.inputElement.selectionStart);\n \n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n }\n },\n () =>\n {\n //TODO: add support for ranges\n });\n }\n\n /**\n * Handles click event inside of input\n */\n @BindThis\n protected handleClick(): void\n {\n this.runWithValue(() =>\n {\n const result = this.parser.parse(this.inputElement.value, this.inputElement.selectionStart ?? 0);\n \n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n },\n () =>\n {\n //TODO: add support for ranges\n });\n }\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n */\n @BindThis\n protected handleKeypress(event: KeyboardEvent): void\n {\n const selectionStart = this.inputElement.selectionStart ?? 0;\n const selectionEnd = this.inputElement.selectionEnd ?? 0;\n const newRawValueArray = this.inputElement.value.split('');\n newRawValueArray.splice(selectionStart , selectionEnd - selectionStart);\n newRawValueArray.splice(selectionStart, 0, ...event.key);\n const newRawValue = newRawValueArray.join('');\n\n const [parsedValue] = parseRawInput(newRawValue, this.dateApi, this.dateTimeData, this.valueProvider);\n\n this.runWithValue(parsedValue =>\n {\n if(this.minMaxConstraintTest(parsedValue))\n {\n event.preventDefault();\n event.stopPropagation();\n }\n },\n () =>\n {\n //TODO: add support for ranges\n },\n parsedValue);\n }\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n */\n @BindThis\n protected handleKeyboard(event: KeyboardEvent): void\n {\n this.runWithValue(parsedValue =>\n {\n const selectionStart = this.inputElement.selectionStart ?? 0;\n\n switch(event.key)\n {\n case 'ArrowRight':\n case 'ArrowLeft':\n {\n event.preventDefault();\n event.stopPropagation();\n \n const result = event.key == 'ArrowLeft' ? this.parser.previous(this.inputElement.value, selectionStart) : this.parser.next(this.inputElement.value, selectionStart);\n \n if(result)\n {\n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n }\n \n break;\n }\n case 'ArrowUp':\n case 'ArrowDown':\n {\n event.preventDefault();\n event.stopPropagation();\n \n let result = this.parser.parse(this.inputElement.value, selectionStart);\n const selectionStartNew = result.positionFrom;\n \n this.stepChangeValue(parsedValue, result.part, event.key == 'ArrowUp');\n \n result = this.parser.parse(this.inputElement.value, selectionStartNew);\n \n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n \n break;\n }\n case 'Tab':\n {\n const result = event.shiftKey ? this.parser.previous(this.inputElement.value, selectionStart) : this.parser.next(this.inputElement.value, selectionStart);\n \n if(result)\n {\n event.preventDefault();\n event.stopPropagation();\n \n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n }\n \n break;\n }\n case 'a':\n {\n if(event.ctrlKey)\n {\n event.preventDefault();\n event.stopPropagation();\n }\n \n break;\n }\n case 'Backspace':\n {\n this.input.value = null;\n this.input.valueChange.next();\n \n break;\n }\n case 'Escape':\n {\n this.picker?.hidePicker();\n \n break;\n }\n case ' ':\n {\n if(event.ctrlKey)\n {\n this.picker?.showPicker();\n }\n \n break;\n }\n }\n },\n () =>\n {\n //TODO: add support for ranges\n });\n }\n\n /**\n * Tests whether are min or max constraint broken, returns true if constraint is broken\n * @param value - Value to be tested\n */\n protected minMaxConstraintTest(value: DateApiObject<TDate>): boolean\n {\n return (!!this.dateTimeData.minDateTime && value.isBefore(this.dateTimeData.minDateTime)) ||\n (!!this.dateTimeData.maxDateTime && value.isAfter(this.dateTimeData.maxDateTime));\n }\n\n /**\n * Runs code with check whether min max constrains was broken\n * @param value - Value to be used checked for constrains\n * @param code - Code that should be executed which can change current value\n */\n protected withMinMaxConstraint(value: DateApiObject<TDate>, code: () => void): void\n {\n value.updateOriginal();\n\n code();\n\n //min value constraint failure\n if(this.minMaxConstraintTest(value))\n {\n value.resetOriginal();\n }\n\n //value has changed, change input value\n if(!value.isSame(value.originalValue))\n {\n this.input.value = value.value;\n this.input.valueChange.next();\n }\n }\n\n /**\n * Runs code for existing and valid value of date time\n * @param singleValueCode - Code to be run when only single value can be inside of date time\n * @param rangeValueCode - Code to be run when range value can be inside of date time\n * @param parsedValueDefault - Default parsed value to be used\n */\n protected runWithValue(singleValueCode: Action1<DateApiObject<TDate>>, rangeValueCode: Action1<[DateApiObject<TDate> | null, DateApiObject<TDate> | null]>, parsedValueDefault?: DateTimeObjectValue<TDate>|undefined|null): void\n {\n const parsedValue = parsedValueDefault ?? parseDateTime(this.input.value, this.dateApi, null, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);\n\n if(!parsedValue)\n {\n return;\n }\n\n if(Array.isArray(parsedValue))\n {\n rangeValueCode(parsedValue);\n }\n else\n {\n //do nothing for invalid value\n if(!parsedValue.isValid())\n {\n return;\n }\n\n singleValueCode(parsedValue);\n }\n }\n\n /**\n * Changes current value of date for for specified part by single step\n * @param value - Value to be used checked for constrains\n * @param part - Part of date that should be changed\n * @param increment - Indication whether value should be incremented or decremented\n */\n protected stepChangeValue(value: DateApiObject<TDate>, part: string, increment: boolean): void\n {\n switch(part)\n {\n case 'y':\n case 'Y':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addYears(1) : value.subtractYears(1));\n\n break;\n }\n case 'Q':\n {\n break;\n }\n case 'M':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addMonths(1) : value.subtractMonths(1));\n\n break;\n }\n case 'w':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addWeeks(1) : value.subtractWeeks(1));\n\n break;\n }\n case 'd':\n case 'D':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addDays(1) : value.subtractDays(1));\n\n break;\n }\n case 'H':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addHours(1) : value.subtractHours(1));\n\n break;\n }\n case 'm':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addMinutes(1) : value.subtractMinutes(1));\n\n break;\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dateTimeInputHandler.directive.js","sourceRoot":"","sources":["../../../../src/directives/dateTimeInputHandler/dateTimeInputHandler.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAE,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,MAAM;gBACV,CAAC;YACD,KAAK,GAAG;gBACR,CAAC;oBACG,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;oBAEnG,MAAM;gBACV,CAAC;QACL,CAAC;IACL,CAAC;8GA1WQ,6BAA6B,kBA4BlB,eAAe,aACf,QAAQ;kGA7BnB,6BAA6B;;AAwE5B;IADT,QAAQ;;;;iEAkBR;AAMS;IADT,QAAQ;;;;gEAcR;AAOS;IADT,QAAQ;;qCACuB,aAAa;;mEAwB5C;AAOS;IADT,QAAQ;;qCACuB,aAAa;;mEA+F5C;2FAjPQ,6BAA6B;kBALzC,SAAS;mBACV;oBACI,QAAQ,EAAE,yBAAyB;oBACnC,UAAU,EAAE,IAAI;iBACnB;;0BA6BgB,MAAM;2BAAC,eAAe;;0BACtB,MAAM;2BAAC,QAAQ;;0BAIf,QAAQ;yCAuCX,YAAY,MAuBZ,WAAW,MAoBX,cAAc,MA+Bd,cAAc","sourcesContent":["import {Directive, Inject, OnDestroy, OnInit, Optional} from '@angular/core';\nimport {Action1, BindThis} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {DateTimeInput} from '../../interfaces';\nimport {DATE_API, DATE_TIME_INPUT} from '../../misc/tokens';\nimport {DateTimeObjectValue} from '../../misc/types';\nimport {parseDateTime, parseRawInput} from '../../misc/utils';\nimport {DateTimePickerDirective, DateTimeDirective} from '../../modules';\nimport {DateApi, DateApiObject, DatePositionParser, DatePositionParserService, DateValueProvider} from '../../services';\n\n/**\n * Directive that adds handler for date time input, which allows navigation using keyboard and checking restriction of value\n */\n@Directive(\n{\n selector: '[dateTime][withHandler]',\n standalone: true,\n})\nexport class DateTimeInputHandlerDirective<TDate = unknown> implements OnInit, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Subscriptions created during initialization\n */\n protected initSubscriptions: Subscription = new Subscription();\n\n /**\n * Instance of parser created for specific format\n */\n protected parser: DatePositionParser;\n\n /**\n * Gets input element as html input\n */\n protected get inputElement(): HTMLInputElement\n {\n if(this.input.element.nodeName == 'INPUT')\n {\n return this.input.element as HTMLInputElement;\n }\n\n throw new Error('You cant use DateTimeInputHandlerDirective without input element!');\n }\n\n //######################### constructor #########################\n constructor(@Inject(DATE_TIME_INPUT) protected input: DateTimeInput<TDate>,\n @Inject(DATE_API) protected dateApi: DateApi<TDate>,\n protected dateTimeData: DateTimeDirective<TDate>,\n protected parserSvc: DatePositionParserService,\n protected valueProvider: DateValueProvider<TDate>,\n @Optional() protected picker?: DateTimePickerDirective<TDate>,)\n {\n this.parser = parserSvc.createParser(this.dateTimeData.customFormat);\n this.initSubscriptions.add(this.dateTimeData.customFormatChanges.subscribe(() => this.parser = parserSvc.createParser(this.dateTimeData.customFormat)));\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.input.element.addEventListener('keydown', this.handleKeyboard);\n this.input.element.addEventListener('keypress', this.handleKeypress);\n this.input.element.addEventListener('select', this.handleSelect);\n this.input.element.addEventListener('click', this.handleClick);\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 this.input.element.removeEventListener('keydown', this.handleKeyboard);\n this.input.element.removeEventListener('keypress', this.handleKeypress);\n this.input.element.removeEventListener('select', this.handleSelect);\n this.input.element.removeEventListener('click', this.handleClick);\n }\n\n //######################### protected methods #########################\n\n /**\n * Handles selection of text inside of input\n */\n @BindThis\n protected handleSelect(): void\n {\n this.runWithValue(() =>\n {\n //handles when all text is selected\n if(this.inputElement.selectionStart == 0 && this.inputElement.selectionEnd == this.inputElement.value.length)\n {\n const result = this.parser.parse(this.inputElement.value, this.inputElement.selectionStart);\n \n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n }\n },\n () =>\n {\n //TODO: add support for ranges\n });\n }\n\n /**\n * Handles click event inside of input\n */\n @BindThis\n protected handleClick(): void\n {\n this.runWithValue(() =>\n {\n const result = this.parser.parse(this.inputElement.value, this.inputElement.selectionStart ?? 0);\n \n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n },\n () =>\n {\n //TODO: add support for ranges\n });\n }\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n */\n @BindThis\n protected handleKeypress(event: KeyboardEvent): void\n {\n const selectionStart = this.inputElement.selectionStart ?? 0;\n const selectionEnd = this.inputElement.selectionEnd ?? 0;\n const newRawValueArray = this.inputElement.value.split('');\n newRawValueArray.splice(selectionStart , selectionEnd - selectionStart);\n newRawValueArray.splice(selectionStart, 0, ...event.key);\n const newRawValue = newRawValueArray.join('');\n\n const [parsedValue] = parseRawInput(newRawValue, this.dateApi, this.dateTimeData, this.valueProvider);\n\n this.runWithValue(parsedValue =>\n {\n if(this.minMaxConstraintTest(parsedValue))\n {\n event.preventDefault();\n event.stopPropagation();\n }\n },\n () =>\n {\n //TODO: add support for ranges\n },\n parsedValue);\n }\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n */\n @BindThis\n protected handleKeyboard(event: KeyboardEvent): void\n {\n this.runWithValue(parsedValue =>\n {\n const selectionStart = this.inputElement.selectionStart ?? 0;\n\n switch(event.key)\n {\n case 'ArrowRight':\n case 'ArrowLeft':\n {\n event.preventDefault();\n event.stopPropagation();\n \n const result = event.key == 'ArrowLeft' ? this.parser.previous(this.inputElement.value, selectionStart) : this.parser.next(this.inputElement.value, selectionStart);\n \n if(result)\n {\n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n }\n \n break;\n }\n case 'ArrowUp':\n case 'ArrowDown':\n {\n event.preventDefault();\n event.stopPropagation();\n \n let result = this.parser.parse(this.inputElement.value, selectionStart);\n const selectionStartNew = result.positionFrom;\n \n this.stepChangeValue(parsedValue, result.part, event.key == 'ArrowUp');\n \n result = this.parser.parse(this.inputElement.value, selectionStartNew);\n \n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n \n break;\n }\n case 'Tab':\n {\n const result = event.shiftKey ? this.parser.previous(this.inputElement.value, selectionStart) : this.parser.next(this.inputElement.value, selectionStart);\n \n if(result)\n {\n event.preventDefault();\n event.stopPropagation();\n \n this.inputElement.selectionStart = result.positionFrom;\n this.inputElement.selectionEnd = result.positionTo;\n }\n \n break;\n }\n case 'a':\n {\n if(event.ctrlKey)\n {\n event.preventDefault();\n event.stopPropagation();\n }\n \n break;\n }\n case 'Backspace':\n {\n this.input.value = null;\n this.input.valueChange.next();\n \n break;\n }\n case 'Escape':\n {\n this.picker?.hidePicker();\n \n break;\n }\n case ' ':\n {\n if(event.ctrlKey)\n {\n this.picker?.showPicker();\n }\n \n break;\n }\n }\n },\n () =>\n {\n //TODO: add support for ranges\n });\n }\n\n /**\n * Tests whether are min or max constraint broken, returns true if constraint is broken\n * @param value - Value to be tested\n */\n protected minMaxConstraintTest(value: DateApiObject<TDate>): boolean\n {\n return (!!this.dateTimeData.minDateTime && value.isBefore(this.dateTimeData.minDateTime)) ||\n (!!this.dateTimeData.maxDateTime && value.isAfter(this.dateTimeData.maxDateTime));\n }\n\n /**\n * Runs code with check whether min max constrains was broken\n * @param value - Value to be used checked for constrains\n * @param code - Code that should be executed which can change current value\n */\n protected withMinMaxConstraint(value: DateApiObject<TDate>, code: () => void): void\n {\n value.updateOriginal();\n\n code();\n\n //min value constraint failure\n if(this.minMaxConstraintTest(value))\n {\n value.resetOriginal();\n }\n\n //value has changed, change input value\n if(!value.isSame(value.originalValue))\n {\n this.input.value = value.value;\n this.input.valueChange.next();\n }\n }\n\n /**\n * Runs code for existing and valid value of date time\n * @param singleValueCode - Code to be run when only single value can be inside of date time\n * @param rangeValueCode - Code to be run when range value can be inside of date time\n * @param parsedValueDefault - Default parsed value to be used\n */\n protected runWithValue(singleValueCode: Action1<DateApiObject<TDate>>, rangeValueCode: Action1<[DateApiObject<TDate> | null, DateApiObject<TDate> | null]>, parsedValueDefault?: DateTimeObjectValue<TDate>|undefined|null): void\n {\n const parsedValue = parsedValueDefault ?? parseDateTime(this.input.value, this.dateApi, null, this.dateTimeData.customFormat, this.dateTimeData.dataFormat);\n\n if(!parsedValue)\n {\n return;\n }\n\n if(Array.isArray(parsedValue))\n {\n rangeValueCode(parsedValue);\n }\n else\n {\n //do nothing for invalid value\n if(!parsedValue.isValid())\n {\n return;\n }\n\n singleValueCode(parsedValue);\n }\n }\n\n /**\n * Changes current value of date for for specified part by single step\n * @param value - Value to be used checked for constrains\n * @param part - Part of date that should be changed\n * @param increment - Indication whether value should be incremented or decremented\n */\n protected stepChangeValue(value: DateApiObject<TDate>, part: string, increment: boolean): void\n {\n switch(part)\n {\n case 'y':\n case 'Y':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addYears(1) : value.subtractYears(1));\n\n break;\n }\n case 'Q':\n {\n break;\n }\n case 'M':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addMonths(1) : value.subtractMonths(1));\n\n break;\n }\n case 'w':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addWeeks(1) : value.subtractWeeks(1));\n\n break;\n }\n case 'd':\n case 'D':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addDays(1) : value.subtractDays(1));\n\n break;\n }\n case 'H':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addHours(1) : value.subtractHours(1));\n\n break;\n }\n case 'm':\n {\n this.withMinMaxConstraint(value, () => increment ? value.addMinutes(1) : value.subtractMinutes(1));\n\n break;\n }\n }\n }\n}\n"]}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { Directive } from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { DatePickerInputDirective } from '../datePickerInput/datePickerInput.directive';
|
|
3
|
+
import { WithTimeDirective } from '../withTime/withTime.directive';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
import * as i1 from "../datePickerInput/datePickerInput.directive";
|
|
6
6
|
import * as i2 from "../withTime/withTime.directive";
|
|
7
7
|
/**
|
|
8
8
|
* Directive that combines date time picker with date time input
|
|
9
9
|
*/
|
|
10
|
-
export class
|
|
11
|
-
static
|
|
12
|
-
static
|
|
10
|
+
export class DateTimePickerInputDirective {
|
|
11
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimePickerInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
12
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: DateTimePickerInputDirective, isStandalone: true, selector: "input[dateTime][dateTimePickerInput]", hostDirectives: [{ directive: i1.DatePickerInputDirective }, { directive: i2.WithTimeDirective }], ngImport: i0 }); }
|
|
13
13
|
}
|
|
14
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimePickerInputDirective, decorators: [{
|
|
15
15
|
type: Directive,
|
|
16
16
|
args: [{
|
|
17
17
|
selector: 'input[dateTime][dateTimePickerInput]',
|
|
18
18
|
standalone: true,
|
|
19
19
|
hostDirectives: [
|
|
20
20
|
{
|
|
21
|
-
directive:
|
|
21
|
+
directive: DatePickerInputDirective,
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
directive:
|
|
24
|
+
directive: WithTimeDirective,
|
|
25
25
|
},
|
|
26
26
|
],
|
|
27
27
|
}]
|