@anglr/datetime 8.1.0 → 9.0.0-beta.20241004120552
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 +61 -1
- package/date-fns/src/services/dateFnsDateApi.service.d.ts +58 -130
- package/date-fns/src/services/dateFnsDateApi.service.d.ts.map +1 -1
- package/es2022/date-fns/src/services/dateFnsDateApi.service.js +60 -143
- package/es2022/date-fns/src/services/dateFnsDateApi.service.js.map +1 -1
- package/es2022/moment/src/services/momentDateApi.service.js +58 -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 +36 -59
- 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 +14 -14
- package/es2022/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js +4 -5
- package/es2022/src/modules/dateTimePicker/components/monthPicker/monthPicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js +27 -24
- package/es2022/src/modules/dateTimePicker/components/rollerTimePicker/rollerTimePicker.component.js.map +1 -1
- package/es2022/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.js +12 -9
- 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 +59 -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/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/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/yearPicker/yearPicker.component.d.ts +3 -3
- package/src/modules/dateTimePicker/components/yearPicker/yearPicker.component.d.ts.map +1 -1
- 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 +5 -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":"validators.js","sourceRoot":"","sources":["../../../src/misc/validators.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAC,sBAAsB,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AAG9D,OAAO,EAAC,YAAY,EAAC,MAAM,6CAA6C,CAAC;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["import {AbstractControl, ValidationErrors, ValidatorFn} from '@angular/forms';\nimport {ModelPropertyMetadata, ValidatorFnFactory} from '@anglr/common/forms';\nimport {isBlank, isNumber, isString} from '@jscrpt/common';\n\nimport {DateApi, DateValue} from '../services';\nimport {getSingleDateTimeValue, parseDateTime} from './utils';\nimport {DateTimeValueFormat} from './enums';\nimport {DateTimeInputOutputValue} from './types';\nimport {DateTimeBase} from '../modules/dateTime/directives/dateTimeBase';\nimport {DATE_API} from './tokens';\n\n//TODO: add decorators for min and max date time\n\n/**\n * Validations arguments for date time validators for model based forms\n */\nexport interface DateTimeValidationArgs<TDate = unknown>\n{\n /**\n * Format of validated value\n */\n valueFormat?: DateTimeValueFormat|null;\n\n /**\n * Format of string value\n */\n stringFormat?: string|null;\n\n /**\n * Format of data string value\n */\n dataFormat?: string|null;\n\n /**\n * Max allowed value\n */\n maxValue?: DateValue|TDate|DateTimeBase<TDate>;\n\n /**\n * Min allowed value\n */\n minValue?: DateValue|TDate|DateTimeBase<TDate>;\n}\n\n/**\n * Date time validator factory function, creates validator for checking validity of datetime\n * @param dateApi - Date api used for parsing date time\n * @param valueFormat - Optional required format\n * @param stringFormat - Optional string format of value\n * @param dataFormat - Optional string data format of value\n */\nexport function datetimeValidator<TDate = unknown>(dateApi: DateApi<TDate>,\n valueFormat: DateTimeValueFormat|undefined|null,\n stringFormat: string|undefined|null,\n dataFormat: string|undefined|null,): ValidatorFn\n{\n return (control: AbstractControl<DateTimeInputOutputValue<TDate>>): ValidationErrors|null =>\n {\n if(isBlank(control.value))\n {\n return null;\n }\n\n const parsedValue = parseDateTime(control.value, dateApi, valueFormat, stringFormat, dataFormat);\n\n if(!parsedValue)\n {\n return null;\n }\n\n if(!Array.isArray(parsedValue))\n {\n if(!parsedValue.isValid())\n {\n return {\n 'datetime': stringFormat\n };\n }\n }\n else\n {\n //TODO: support for ranges\n }\n\n return null;\n };\n}\n\n/**\n * Factory function that creates validator function factory\n * @param args - Static arguments for date time validator\n */\nexport function dateTimeModelValidatorFactory<TDate = unknown>(args: DateTimeValidationArgs<TDate>): ValidatorFnFactory<DateTimeValidationArgs<TDate>>\n{\n return new ValidatorFnFactory<DateTimeValidationArgs<TDate>>(args =>\n {\n const dateApi = args.injector?.get(DATE_API, null);\n\n if(!dateApi)\n {\n throw new Error('DateTime: missing DateApi! Please provide one.');\n }\n\n return datetimeValidator(dateApi, args.valueFormat, args.stringFormat, args.dataFormat);\n }, args);\n}\n\n/**\n * Sets date time validator, with default formats\n */\nexport function DateTime(): PropertyDecorator\n/**\n * Sets date time validator, with default string format\n * @param valueFormat - Format of validated value\n */\nexport function DateTime(valueFormat: DateTimeValueFormat): PropertyDecorator\n/**\n * Sets date time validator, with default value format\n * @param stringFormat - Format of string value\n */\nexport function DateTime(stringFormat: string|null): PropertyDecorator\n/**\n * Sets date time validator\n * @param valueFormat - Format of validated value\n * @param stringFormat - Format of string value\n */\nexport function DateTime(valueFormat: DateTimeValueFormat, stringFormat: string): PropertyDecorator\n/**\n * Sets date time validator\n * @param valueFormat - Format of validated value\n * @param stringFormat - Format of string value\n * @param dataFormat - Format of data string value\n */\nexport function DateTime(valueFormat: DateTimeValueFormat, stringFormat: string|undefined|null, dataFormat: string): PropertyDecorator\n/**\n * Sets date time validator to property on which is used\n */\nexport function DateTime(valueFormatOrStringFormat?: DateTimeValueFormat|string|null, stringFormat?: string|undefined|null, dataFormat?: string|undefined|null): PropertyDecorator\n{\n let valueFormat: DateTimeValueFormat|undefined|null;\n\n if(isNumber(valueFormatOrStringFormat))\n {\n valueFormat = valueFormatOrStringFormat;\n }\n\n if(isString(valueFormatOrStringFormat))\n {\n stringFormat = valueFormatOrStringFormat;\n }\n\n return ModelPropertyMetadata(\n {\n validators: [dateTimeModelValidatorFactory(\n {\n stringFormat,\n valueFormat,\n dataFormat,\n })]\n });\n}\n\n/**\n * Date time validator factory function, creates validator for checking validity of datetime max value\n * @param dateApi - Date api used for parsing date time\n * @param maxValue - Maximal date time value that should be used for validation against\n * @param valueFormat - Optional required format\n * @param stringFormat - Optional string format of value\n * @param dataFormat - Optional string data format of value\n */\nexport function datetimeMaxValidator<TDate = unknown>(dateApi: DateApi<TDate>,\n maxValue: DateValue|TDate|DateTimeBase<TDate>|undefined|null,\n valueFormat: DateTimeValueFormat|undefined|null,\n stringFormat: string|undefined|null,\n dataFormat: string|undefined|null,): ValidatorFn\n{\n return (control: AbstractControl<DateTimeInputOutputValue<TDate>>): ValidationErrors|null =>\n {\n if(isBlank(control.value) || isBlank(maxValue))\n {\n return null;\n }\n\n if(maxValue instanceof DateTimeBase)\n {\n const value = getSingleDateTimeValue(maxValue.value);\n\n //no validation\n if(isBlank(value))\n {\n return null;\n }\n\n maxValue = value;\n }\n\n const parsedValue = parseDateTime(control.value, dateApi, valueFormat, stringFormat, dataFormat);\n\n if(!parsedValue)\n {\n return null;\n }\n\n const maxDateTime = dateApi.getValue(maxValue, stringFormat ?? undefined);\n\n if(!Array.isArray(parsedValue))\n {\n if(parsedValue.isValid() && !parsedValue.isBefore(maxDateTime.value))\n {\n return {\n 'datetimemax': maxDateTime.value\n };\n }\n }\n else\n {\n //TODO: support for ranges\n }\n\n return null;\n };\n}\n\n/**\n * Date time validator factory function, creates validator for checking validity of datetime min value\n * @param dateApi - Date api used for parsing date time\n * @param minValue - Minimal date time value that should be used for validation against\n * @param valueFormat - Optional required format\n * @param stringFormat - Optional string format of value\n * @param dataFormat - Optional string data format of value\n */\nexport function datetimeMinValidator<TDate = unknown>(dateApi: DateApi<TDate>,\n minValue: DateValue|TDate|DateTimeBase<TDate>|undefined|null,\n valueFormat: DateTimeValueFormat|undefined|null,\n stringFormat: string|undefined|null,\n dataFormat: string|undefined|null,): ValidatorFn\n{\n return (control: AbstractControl<DateTimeInputOutputValue<TDate>>): ValidationErrors|null =>\n {\n if(isBlank(control.value) || isBlank(minValue))\n {\n return null;\n }\n\n if(minValue instanceof DateTimeBase)\n {\n const value = getSingleDateTimeValue(minValue.value);\n\n //no validation\n if(isBlank(value))\n {\n return null;\n }\n\n minValue = value;\n }\n\n const parsedValue = parseDateTime(control.value, dateApi, valueFormat, stringFormat, dataFormat);\n\n if(!parsedValue)\n {\n return null;\n }\n\n const minDateTime = dateApi.getValue(minValue, stringFormat ?? undefined);\n\n if(!Array.isArray(parsedValue))\n {\n if(parsedValue.isValid() && !parsedValue.isAfter(minDateTime.value))\n {\n return {\n 'datetimemin': minDateTime.value\n };\n }\n }\n else\n {\n //TODO: support for ranges\n }\n\n return null;\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../src/misc/validators.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,qBAAqB,EAAE,kBAAkB,EAAC,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAC,sBAAsB,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AAG9D,OAAO,EAAC,YAAY,EAAC,MAAM,6CAA6C,CAAC;AACzE,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAC;AAmClC;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAkB,OAAuB,EACvB,WAA+C,EAC/C,YAAmC,EACnC,UAAiC;IAEhF,OAAO,CAAC,OAAyD,EAAyB,EAAE;QAExF,IAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EACzB,CAAC;YACG,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,WAAW,GAAG,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;QAEjG,IAAG,CAAC,WAAW,EACf,CAAC;YACG,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAG,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAC9B,CAAC;YACG,IAAG,CAAC,WAAW,CAAC,OAAO,EAAE,EACzB,CAAC;gB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ACG,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAG,QAAQ,YAAY,YAAY,EACnC,CAAC;YACG,MAAM,KAAK,GAAG,sBAAsB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAErD,eAAe;YACf,IAAG,OAAO,CAAC,KAAK,CAAC,EACjB,CAAC;gBACG,OAAO,IAAI,CAAC;YAChB,CAAC;YAED,QAAQ,GAAG,KAAK,CAAC;QACrB,CAAC;QAED,MAAM,WAAW,GAAG,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;QAEjG,IAAG,CAAC,WAAW,EACf,CAAC;YACG,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,YAAY,IAAI,SAAS,CAAC,CAAC;QAE1E,IAAG,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAC9B,CAAC;YACG,IAAG,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,EACnE,CAAC;gBACG,OAAO;oBACH,aAAa,EAAE,WAAW,CAAC,KAAK;iBACnC,CAAC;YACN,CAAC;QACL,CAAC;aAED,CAAC;YACG,0BAA0B;QAC9B,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;AACN,CAAC","sourcesContent":["import {AbstractControl, ValidationErrors, ValidatorFn} from '@angular/forms';\nimport {ModelPropertyMetadata, ValidatorFnFactory} from '@anglr/common/forms';\nimport {isBlank, isNumber, isString} from '@jscrpt/common';\n\nimport {DateApi, DateValue} from '../services';\nimport {getSingleDateTimeValue, parseDateTime} from './utils';\nimport {DateTimeValueFormat} from './enums';\nimport {DateTimeInputOutputValue} from './types';\nimport {DateTimeBase} from '../modules/dateTime/directives/dateTimeBase';\nimport {DATE_API} from './tokens';\n\n//TODO: add decorators for min and max date time\n\n/**\n * Validations arguments for date time validators for model based forms\n */\nexport interface DateTimeValidationArgs<TDate = unknown>\n{\n /**\n * Format of validated value\n */\n valueFormat?: DateTimeValueFormat|null;\n\n /**\n * Format of string value\n */\n stringFormat?: string|null;\n\n /**\n * Format of data string value\n */\n dataFormat?: string|null;\n\n /**\n * Max allowed value\n */\n maxValue?: DateValue|TDate|DateTimeBase<TDate>;\n\n /**\n * Min allowed value\n */\n minValue?: DateValue|TDate|DateTimeBase<TDate>;\n}\n\n/**\n * Date time validator factory function, creates validator for checking validity of datetime\n * @param dateApi - Date api used for parsing date time\n * @param valueFormat - Optional required format\n * @param stringFormat - Optional string format of value\n * @param dataFormat - Optional string data format of value\n */\nexport function datetimeValidator<TDate = unknown>(dateApi: DateApi<TDate>,\n valueFormat: DateTimeValueFormat|undefined|null,\n stringFormat: string|undefined|null,\n dataFormat: string|undefined|null,): ValidatorFn\n{\n return (control: AbstractControl<DateTimeInputOutputValue<TDate>>): ValidationErrors|null =>\n {\n if(isBlank(control.value))\n {\n return null;\n }\n\n const parsedValue = parseDateTime(control.value, dateApi, valueFormat, stringFormat, dataFormat);\n\n if(!parsedValue)\n {\n return null;\n }\n\n if(!Array.isArray(parsedValue))\n {\n if(!parsedValue.isValid())\n {\n return {\n 'datetime': stringFormat\n };\n }\n }\n else\n {\n //TODO: support for ranges\n }\n\n return null;\n };\n}\n\n/**\n * Factory function that creates validator function factory\n * @param args - Static arguments for date time validator\n */\nexport function dateTimeModelValidatorFactory<TDate = unknown>(args: DateTimeValidationArgs<TDate>): ValidatorFnFactory<DateTimeValidationArgs<TDate>>\n{\n return new ValidatorFnFactory<DateTimeValidationArgs<TDate>>(args =>\n {\n const dateApi = args.injector?.get(DATE_API, null);\n\n if(!dateApi)\n {\n throw new Error('DateTime: missing DateApi! Please provide one.');\n }\n\n return datetimeValidator(dateApi, args.valueFormat, args.stringFormat, args.dataFormat);\n }, args);\n}\n\n/**\n * Sets date time validator, with default formats\n */\nexport function DateTime(): PropertyDecorator\n/**\n * Sets date time validator, with default string format\n * @param valueFormat - Format of validated value\n */\nexport function DateTime(valueFormat: DateTimeValueFormat): PropertyDecorator\n/**\n * Sets date time validator, with default value format\n * @param stringFormat - Format of string value\n */\nexport function DateTime(stringFormat: string|null): PropertyDecorator\n/**\n * Sets date time validator\n * @param valueFormat - Format of validated value\n * @param stringFormat - Format of string value\n */\nexport function DateTime(valueFormat: DateTimeValueFormat, stringFormat: string): PropertyDecorator\n/**\n * Sets date time validator\n * @param valueFormat - Format of validated value\n * @param stringFormat - Format of string value\n * @param dataFormat - Format of data string value\n */\nexport function DateTime(valueFormat: DateTimeValueFormat, stringFormat: string|undefined|null, dataFormat: string): PropertyDecorator\n/**\n * Sets date time validator to property on which is used\n */\nexport function DateTime(valueFormatOrStringFormat?: DateTimeValueFormat|string|null, stringFormat?: string|undefined|null, dataFormat?: string|undefined|null): PropertyDecorator\n{\n let valueFormat: DateTimeValueFormat|undefined|null;\n\n if(isNumber(valueFormatOrStringFormat))\n {\n valueFormat = valueFormatOrStringFormat;\n }\n\n if(isString(valueFormatOrStringFormat))\n {\n stringFormat = valueFormatOrStringFormat;\n }\n\n return ModelPropertyMetadata(\n {\n validators: [dateTimeModelValidatorFactory(\n {\n stringFormat,\n valueFormat,\n dataFormat,\n })]\n });\n}\n\n/**\n * Date time validator factory function, creates validator for checking validity of datetime max value\n * @param dateApi - Date api used for parsing date time\n * @param maxValue - Maximal date time value that should be used for validation against\n * @param valueFormat - Optional required format\n * @param stringFormat - Optional string format of value\n * @param dataFormat - Optional string data format of value\n */\nexport function datetimeMaxValidator<TDate = unknown>(dateApi: DateApi<TDate>,\n maxValue: DateValue|TDate|DateTimeBase<TDate>|undefined|null,\n valueFormat: DateTimeValueFormat|undefined|null,\n stringFormat: string|undefined|null,\n dataFormat: string|undefined|null,): ValidatorFn\n{\n return (control: AbstractControl<DateTimeInputOutputValue<TDate>>): ValidationErrors|null =>\n {\n if(isBlank(control.value) || isBlank(maxValue))\n {\n return null;\n }\n\n if(maxValue instanceof DateTimeBase)\n {\n const value = getSingleDateTimeValue(maxValue.value);\n\n //no validation\n if(isBlank(value))\n {\n return null;\n }\n\n maxValue = value;\n }\n\n const parsedValue = parseDateTime(control.value, dateApi, valueFormat, stringFormat, dataFormat);\n\n if(!parsedValue)\n {\n return null;\n }\n\n const maxDateTime = dateApi.getValue(maxValue, stringFormat ?? undefined);\n\n if(!Array.isArray(parsedValue))\n {\n if(parsedValue.isValid() && !parsedValue.isBefore(maxDateTime.value))\n {\n return {\n 'datetimemax': maxDateTime.value\n };\n }\n }\n else\n {\n //TODO: support for ranges\n }\n\n return null;\n };\n}\n\n/**\n * Date time validator factory function, creates validator for checking validity of datetime min value\n * @param dateApi - Date api used for parsing date time\n * @param minValue - Minimal date time value that should be used for validation against\n * @param valueFormat - Optional required format\n * @param stringFormat - Optional string format of value\n * @param dataFormat - Optional string data format of value\n */\nexport function datetimeMinValidator<TDate = unknown>(dateApi: DateApi<TDate>,\n minValue: DateValue|TDate|DateTimeBase<TDate>|undefined|null,\n valueFormat: DateTimeValueFormat|undefined|null,\n stringFormat: string|undefined|null,\n dataFormat: string|undefined|null,): ValidatorFn\n{\n return (control: AbstractControl<DateTimeInputOutputValue<TDate>>): ValidationErrors|null =>\n {\n if(isBlank(control.value) || isBlank(minValue))\n {\n return null;\n }\n\n if(minValue instanceof DateTimeBase)\n {\n const value = getSingleDateTimeValue(minValue.value);\n\n //no validation\n if(isBlank(value))\n {\n return null;\n }\n\n minValue = value;\n }\n\n const parsedValue = parseDateTime(control.value, dateApi, valueFormat, stringFormat, dataFormat);\n\n if(!parsedValue)\n {\n return null;\n }\n\n const minDateTime = dateApi.getValue(minValue, stringFormat ?? undefined);\n\n if(!Array.isArray(parsedValue))\n {\n if(parsedValue.isValid() && !parsedValue.isAfter(minDateTime.value))\n {\n return {\n 'datetimemin': minDateTime.value\n };\n }\n }\n else\n {\n //TODO: support for ranges\n }\n\n return null;\n };\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Component, ChangeDetectionStrategy, Input, Inject, ViewChild, TemplateRef, ContentChild } from '@angular/core';
|
|
2
|
+
import { KeyValuePipe } from '@angular/common';
|
|
2
3
|
import { isString, nameof } from '@jscrpt/common';
|
|
3
4
|
import { CalendarDayTemplateDirective } from '../../directives';
|
|
4
5
|
import { MonthCalendarDayFormat, CalendarDayAspectRatio } from '../../misc';
|
|
@@ -6,56 +7,16 @@ import { EventParser } from '../../services';
|
|
|
6
7
|
import { DATE_API, FORMAT_PROVIDER } from '../../../../misc/tokens';
|
|
7
8
|
import * as i0 from "@angular/core";
|
|
8
9
|
import * as i1 from "../../services";
|
|
9
|
-
import * as i2 from "@angular/common";
|
|
10
|
-
import * as i3 from "../../directives/calendarDayTemplate/calendarDayTemplate.directive";
|
|
11
10
|
/**
|
|
12
11
|
* Component used for displaying month calendar
|
|
13
12
|
*/
|
|
14
13
|
export class MonthCalendarComponent {
|
|
15
|
-
dateApi;
|
|
16
|
-
formatProvider;
|
|
17
|
-
eventParser;
|
|
18
|
-
//######################### protected properties - template bindings #########################
|
|
19
|
-
/**
|
|
20
|
-
* Aspect ratio for displayed calendar day cell
|
|
21
|
-
*/
|
|
22
|
-
dayAspectRatioValue = CalendarDayAspectRatio.ThreeToTwo;
|
|
23
|
-
/**
|
|
24
|
-
* Data that represents calendar data
|
|
25
|
-
*/
|
|
26
|
-
calendarData = {};
|
|
27
14
|
/**
|
|
28
15
|
* Calendar day template to be used
|
|
29
16
|
*/
|
|
30
17
|
get calendarDayTemplate() {
|
|
31
18
|
return this.customCalendarDayTemplate ?? this.defaultCalendarDayTemplate;
|
|
32
19
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Array of weekday names
|
|
35
|
-
*/
|
|
36
|
-
weekDayNames = [];
|
|
37
|
-
//######################### protected properties - children #########################
|
|
38
|
-
/**
|
|
39
|
-
* Default calendar day template
|
|
40
|
-
*/
|
|
41
|
-
defaultCalendarDayTemplate;
|
|
42
|
-
/**
|
|
43
|
-
* Custom calendar day template
|
|
44
|
-
*/
|
|
45
|
-
customCalendarDayTemplate;
|
|
46
|
-
//######################### public properties - inputs #########################
|
|
47
|
-
/**
|
|
48
|
-
* Indication that week number should be displayed
|
|
49
|
-
*/
|
|
50
|
-
showWeekNumber = false;
|
|
51
|
-
/**
|
|
52
|
-
* Date that should be displayed in month calendar
|
|
53
|
-
*/
|
|
54
|
-
display;
|
|
55
|
-
/**
|
|
56
|
-
* Format for displaying week day names
|
|
57
|
-
*/
|
|
58
|
-
weekDayName = MonthCalendarDayFormat.Short;
|
|
59
20
|
/**
|
|
60
21
|
* Aspect ratio for displayed calendar day cell
|
|
61
22
|
*/
|
|
@@ -69,15 +30,37 @@ export class MonthCalendarComponent {
|
|
|
69
30
|
}
|
|
70
31
|
this.dayAspectRatioValue = value;
|
|
71
32
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Array of events that should be displayed
|
|
74
|
-
*/
|
|
75
|
-
events = [];
|
|
76
33
|
//######################### constructor #########################
|
|
77
34
|
constructor(dateApi, formatProvider, eventParser) {
|
|
78
35
|
this.dateApi = dateApi;
|
|
79
36
|
this.formatProvider = formatProvider;
|
|
80
37
|
this.eventParser = eventParser;
|
|
38
|
+
//######################### protected properties - template bindings #########################
|
|
39
|
+
/**
|
|
40
|
+
* Aspect ratio for displayed calendar day cell
|
|
41
|
+
*/
|
|
42
|
+
this.dayAspectRatioValue = CalendarDayAspectRatio.ThreeToTwo;
|
|
43
|
+
/**
|
|
44
|
+
* Data that represents calendar data
|
|
45
|
+
*/
|
|
46
|
+
this.calendarData = {};
|
|
47
|
+
/**
|
|
48
|
+
* Array of weekday names
|
|
49
|
+
*/
|
|
50
|
+
this.weekDayNames = [];
|
|
51
|
+
//######################### public properties - inputs #########################
|
|
52
|
+
/**
|
|
53
|
+
* Indication that week number should be displayed
|
|
54
|
+
*/
|
|
55
|
+
this.showWeekNumber = false;
|
|
56
|
+
/**
|
|
57
|
+
* Format for displaying week day names
|
|
58
|
+
*/
|
|
59
|
+
this.weekDayName = MonthCalendarDayFormat.Short;
|
|
60
|
+
/**
|
|
61
|
+
* Array of events that should be displayed
|
|
62
|
+
*/
|
|
63
|
+
this.events = [];
|
|
81
64
|
}
|
|
82
65
|
//######################### public methods - implementation of OnInit #########################
|
|
83
66
|
/**
|
|
@@ -175,25 +158,19 @@ export class MonthCalendarComponent {
|
|
|
175
158
|
}
|
|
176
159
|
}
|
|
177
160
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
* Custom input type for `weekDayName` input
|
|
181
|
-
*/
|
|
182
|
-
static ngAcceptInputType_weekDayName;
|
|
183
|
-
/**
|
|
184
|
-
* Custom input type for `dayAspectRatio` input
|
|
185
|
-
*/
|
|
186
|
-
static ngAcceptInputType_dayAspectRatio;
|
|
187
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: MonthCalendarComponent, deps: [{ token: DATE_API }, { token: FORMAT_PROVIDER }, { token: i1.EventParser }], target: i0.ɵɵFactoryTarget.Component });
|
|
188
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.1.1", type: MonthCalendarComponent, selector: "month-calendar", inputs: { showWeekNumber: "showWeekNumber", display: "display", weekDayName: "weekDayName", dayAspectRatio: "dayAspectRatio", events: "events" }, providers: [
|
|
161
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: MonthCalendarComponent, deps: [{ token: DATE_API }, { token: FORMAT_PROVIDER }, { token: i1.EventParser }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
162
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.7", type: MonthCalendarComponent, isStandalone: true, selector: "month-calendar", inputs: { showWeekNumber: "showWeekNumber", display: "display", weekDayName: "weekDayName", dayAspectRatio: "dayAspectRatio", events: "events" }, providers: [
|
|
189
163
|
EventParser,
|
|
190
|
-
], queries: [{ propertyName: "customCalendarDayTemplate", first: true, predicate: CalendarDayTemplateDirective, descendants: true, read: TemplateRef, static: true }], viewQueries: [{ propertyName: "defaultCalendarDayTemplate", first: true, predicate: CalendarDayTemplateDirective, descendants: true, read: TemplateRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<div *calendarDayTemplate=\"let data\" class=\"default-calendar-day\" [class.is-weekend]=\"data.isWeekend\" [class.is-other-month]=\"!data.isCurrentMonth\">{{data.day}}</div>\n\n
|
|
164
|
+
], queries: [{ propertyName: "customCalendarDayTemplate", first: true, predicate: CalendarDayTemplateDirective, descendants: true, read: TemplateRef, static: true }], viewQueries: [{ propertyName: "defaultCalendarDayTemplate", first: true, predicate: CalendarDayTemplateDirective, descendants: true, read: TemplateRef, static: true }], usesOnChanges: true, ngImport: i0, template: "<div *calendarDayTemplate=\"let data\" class=\"default-calendar-day\" [class.is-weekend]=\"data.isWeekend\" [class.is-other-month]=\"!data.isCurrentMonth\">{{data.day}}</div>\n\n@for(dayName of weekDayNames; track dayName)\n{\n <div [class.week-day-name]=\"dayName\">{{dayName}}</div>\n}\n\n@for(weekData of calendarData | keyvalue; track weekData)\n{\n <div class=\"week-number\">\n @if(showWeekNumber)\n {\n {{weekData.key}}\n }\n </div>\n \n @for(dayData of weekData.value; track dayData)\n {\n <div [style.padding-bottom.%]=\"dayAspectRatioValue\" class=\"day-wrapper\">\n <div class=\"day-content\"><ng-container *ngTemplateOutlet=\"calendarDayTemplate; context: {$implicit: dayData}\"/></div>\n </div>\n }\n}\n", dependencies: [{ kind: "directive", type: CalendarDayTemplateDirective, selector: "[calendarDayTemplate]" }, { kind: "pipe", type: KeyValuePipe, name: "keyvalue" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
191
165
|
}
|
|
192
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
166
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: MonthCalendarComponent, decorators: [{
|
|
193
167
|
type: Component,
|
|
194
|
-
args: [{ selector: 'month-calendar',
|
|
168
|
+
args: [{ selector: 'month-calendar', standalone: true, imports: [
|
|
169
|
+
CalendarDayTemplateDirective,
|
|
170
|
+
KeyValuePipe,
|
|
171
|
+
], providers: [
|
|
195
172
|
EventParser,
|
|
196
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *calendarDayTemplate=\"let data\" class=\"default-calendar-day\" [class.is-weekend]=\"data.isWeekend\" [class.is-other-month]=\"!data.isCurrentMonth\">{{data.day}}</div>\n\n
|
|
173
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *calendarDayTemplate=\"let data\" class=\"default-calendar-day\" [class.is-weekend]=\"data.isWeekend\" [class.is-other-month]=\"!data.isCurrentMonth\">{{data.day}}</div>\n\n@for(dayName of weekDayNames; track dayName)\n{\n <div [class.week-day-name]=\"dayName\">{{dayName}}</div>\n}\n\n@for(weekData of calendarData | keyvalue; track weekData)\n{\n <div class=\"week-number\">\n @if(showWeekNumber)\n {\n {{weekData.key}}\n }\n </div>\n \n @for(dayData of weekData.value; track dayData)\n {\n <div [style.padding-bottom.%]=\"dayAspectRatioValue\" class=\"day-wrapper\">\n <div class=\"day-content\"><ng-container *ngTemplateOutlet=\"calendarDayTemplate; context: {$implicit: dayData}\"/></div>\n </div>\n }\n}\n" }]
|
|
197
174
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
198
175
|
type: Inject,
|
|
199
176
|
args: [DATE_API]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monthCalendar.component.js","sourceRoot":"","sources":["../../../../../../src/modules/calendar/components/monthCalendar/monthCalendar.component.ts","../../../../../../src/modules/calendar/components/monthCalendar/monthCalendar.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,EAAU,SAAS,EAAE,WAAW,EAAE,YAA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4B,2BAAuB,WAAW,gECxD7E,qxBAeA;;2FDSa,sBAAsB;kBAVlC,SAAS;+BAEI,gBAAgB,aAG1B;wBACI,WAAW;qBACd,mBACgB,uBAAuB,CAAC,MAAM;;0BA0FlC,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,eAAe;mEAxDzB,0BAA0B;sBADnC,SAAS;uBAAC,4BAA4B,EAAE,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAC;gBAOhE,yBAAyB;sBADlC,YAAY;uBAAC,4BAA4B,EAAE,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAC;gBAStE,cAAc;sBADpB,KAAK;gBAOC,OAAO;sBADb,KAAK;gBAOC,WAAW;sBADjB,KAAK;gBAOK,cAAc;sBADxB,KAAK;gBAqBC,MAAM;sBADZ,KAAK","sourcesContent":["import {Component, ChangeDetectionStrategy, Input, Inject, OnInit, ViewChild, TemplateRef, ContentChild, OnChanges, SimpleChanges} from '@angular/core';\nimport {Dictionary, isString, nameof} from '@jscrpt/common';\n\nimport {CalendarDayData, EventData} from '../../interfaces';\nimport {CalendarDayTemplateDirective, CalendarDayTemplateContext} from '../../directives';\nimport {MonthCalendarDayFormat, CalendarDayAspectRatio} from '../../misc';\nimport {EventParser} from '../../services';\nimport {DATE_API, FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {DateApi} from '../../../../services';\nimport {FormatProvider} from '../../../../interfaces';\n\n/**\n * Component used for displaying month calendar\n */\n@Component(\n{\n selector: 'month-calendar',\n templateUrl: 'monthCalendar.component.html',\n providers:\n [\n EventParser,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class MonthCalendarComponent<TDate = unknown, TEvent = unknown> implements OnInit, OnChanges\n{\n //######################### protected properties - template bindings #########################\n\n /**\n * Aspect ratio for displayed calendar day cell\n */\n protected dayAspectRatioValue: number = CalendarDayAspectRatio.ThreeToTwo;\n\n /**\n * Data that represents calendar data\n */\n protected calendarData: Dictionary<CalendarDayData<TDate, TEvent>[]> = {};\n\n /**\n * Calendar day template to be used\n */\n protected get calendarDayTemplate(): TemplateRef<CalendarDayTemplateContext>\n {\n return this.customCalendarDayTemplate ?? this.defaultCalendarDayTemplate;\n }\n\n /**\n * Array of weekday names\n */\n protected weekDayNames: string[] = [];\n\n //######################### protected properties - children #########################\n\n /**\n * Default calendar day template\n */\n @ViewChild(CalendarDayTemplateDirective, {static: true, read: TemplateRef})\n protected defaultCalendarDayTemplate!: TemplateRef<CalendarDayTemplateContext>;\n\n /**\n * Custom calendar day template\n */\n @ContentChild(CalendarDayTemplateDirective, {static: true, read: TemplateRef})\n protected customCalendarDayTemplate: TemplateRef<CalendarDayTemplateContext>|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * Indication that week number should be displayed\n */\n @Input()\n public showWeekNumber: boolean = false;\n\n /**\n * Date that should be displayed in month calendar\n */\n @Input()\n public display: TDate|undefined|null;\n\n /**\n * Format for displaying week day names\n */\n @Input()\n public weekDayName: MonthCalendarDayFormat = MonthCalendarDayFormat.Short;\n\n /**\n * Aspect ratio for displayed calendar day cell\n */\n @Input()\n public get dayAspectRatio(): number\n {\n return this.dayAspectRatioValue;\n }\n public set dayAspectRatio(value: number)\n {\n if(isString(value))\n {\n this.dayAspectRatioValue = CalendarDayAspectRatio[value] as unknown as number;\n\n return;\n }\n\n this.dayAspectRatioValue = value;\n }\n\n /**\n * Array of events that should be displayed\n */\n @Input()\n public events: EventData<TDate, TEvent>[] = [];\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected dateApi: DateApi<TDate>,\n @Inject(FORMAT_PROVIDER) protected formatProvider: FormatProvider,\n protected eventParser: EventParser<TDate, TEvent>,)\n {\n }\n\n //######################### public methods - implementation of OnInit #########################\n\n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.initWeekdayNames();\n this.initializeDisplayCalendar();\n }\n\n //######################### public methods - implementation of OnChanges #########################\n\n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(nameof<MonthCalendarComponent>('weekDayName') in changes)\n {\n this.initWeekdayNames();\n }\n\n if(nameof<MonthCalendarComponent>('display') in changes)\n {\n this.initializeDisplayCalendar();\n }\n\n if(nameof<MonthCalendarComponent>('events') in changes && !(nameof<MonthCalendarComponent>('display') in changes))\n {\n this.initAndAttachEventData();\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Initialize weekday names\n */\n protected initWeekdayNames(): void\n {\n this.weekDayNames = [];\n const dateApi = this.dateApi.now().startOfWeek();\n\n switch(this.weekDayName)\n {\n default:\n // case MonthCalendarDayFormat.None:\n {\n for(let x = 0; x < 7; x++)\n {\n this.weekDayNames.push('');\n }\n\n break;\n }\n case MonthCalendarDayFormat.Short:\n {\n for(let x = 0; x < 7; x++)\n {\n this.weekDayNames.push(dateApi.format(this.formatProvider.dayNameShort));\n dateApi.addDays(1);\n }\n\n break;\n }\n case MonthCalendarDayFormat.Full:\n {\n for(let x = 0; x < 7; x++)\n {\n this.weekDayNames.push(dateApi.format(this.formatProvider.dayName));\n dateApi.addDays(1);\n }\n\n break;\n }\n }\n }\n\n /**\n * Initialize date for calendar that should be displayed\n */\n protected initializeDisplayCalendar(): void\n {\n this.display ??= this.dateApi.now().value;\n\n const workDate = this.dateApi.getValue(this.display);\n\n workDate.startOfMonth()\n .startOfWeek();\n\n this.calendarData = {};\n\n do\n {\n const weekData: CalendarDayData<TDate, TEvent>[] = this.calendarData[workDate.format(this.formatProvider.week)] = [];\n\n for(let x = 0; x < 7; x++)\n {\n weekData.push(\n {\n date: workDate.value,\n day: workDate.dayOfMonth(),\n events: [],\n isCurrentMonth: workDate.isSameMonth(this.display),\n isWeekend: workDate.isWeekend(),\n week: +workDate.format(this.formatProvider.week),\n });\n\n workDate.addDays(1);\n }\n\n workDate.startOfWeek();\n }\n while(workDate.isSameMonth(this.display));\n\n this.initAndAttachEventData();\n }\n\n /**\n * Initialize and attaches event data\n */\n protected initAndAttachEventData(): void\n {\n const events = this.eventParser.getEventsPerDay(this.events);\n\n for(const week in this.calendarData)\n {\n const weekData = this.calendarData[week];\n\n for(const day of weekData)\n {\n const found = events.find(itm => this.dateApi.getValue(itm[0]).isSame(day.date));\n day.events = found?.[1] ?? [];\n }\n }\n }\n\n //######################### ng language server #########################\n\n /**\n * Custom input type for `weekDayName` input\n */\n public static ngAcceptInputType_weekDayName: keyof typeof MonthCalendarDayFormat;\n\n /**\n * Custom input type for `dayAspectRatio` input\n */\n public static ngAcceptInputType_dayAspectRatio: keyof typeof CalendarDayAspectRatio|number;\n}","<div *calendarDayTemplate=\"let data\" class=\"default-calendar-day\" [class.is-weekend]=\"data.isWeekend\" [class.is-other-month]=\"!data.isCurrentMonth\">{{data.day}}</div>\n\n<div></div>\n\n<div *ngFor=\"let dayName of weekDayNames\" [class.week-day-name]=\"dayName\">{{dayName}}</div>\n\n<ng-container *ngFor=\"let weekData of calendarData | keyvalue\">\n <div class=\"week-number\">\n <ng-container *ngIf=\"showWeekNumber\">{{weekData.key}}</ng-container>\n </div>\n \n <div *ngFor=\"let dayData of weekData.value\" [style.padding-bottom.%]=\"dayAspectRatioValue\" class=\"day-wrapper\">\n <div class=\"day-content\"><ng-container *ngTemplateOutlet=\"calendarDayTemplate; context: {$implicit: dayData}\"></ng-container></div>\n </div>\n</ng-container>\n"]}
|
|
1
|
+
{"version":3,"file":"monthCalendar.component.js","sourceRoot":"","sources":["../../../../../../src/modules/calendar/components/monthCalendar/monthCalendar.component.ts","../../../../../../src/modules/calendar/components/monthCalendar/monthCalendar.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,EAAU,SAAS,EAAE,WAAW,EAAE,YAAY,EAA2B,MAAM,eAAe,CAAC;AACxJ,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAa,QAAQ,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAG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BAC5B,YAAY;qBACf,aAED;wBACI,WAAW;qBACd,mBACgB,uBAAuB,CAAC,MAAM;;0BA0FlC,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,eAAe;mEAxDzB,0BAA0B;sBADnC,SAAS;uBAAC,4BAA4B,EAAE,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAC;gBAOhE,yBAAyB;sBADlC,YAAY;uBAAC,4BAA4B,EAAE,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAC;gBAStE,cAAc;sBADpB,KAAK;gBAOC,OAAO;sBADb,KAAK;gBAOC,WAAW;sBADjB,KAAK;gBAOK,cAAc;sBADxB,KAAK;gBAqBC,MAAM;sBADZ,KAAK","sourcesContent":["import {Component, ChangeDetectionStrategy, Input, Inject, OnInit, ViewChild, TemplateRef, ContentChild, OnChanges, SimpleChanges} from '@angular/core';\nimport {KeyValuePipe} from '@angular/common';\nimport {Dictionary, isString, nameof} from '@jscrpt/common';\n\nimport {CalendarDayData, EventData} from '../../interfaces';\nimport {CalendarDayTemplateDirective, CalendarDayTemplateContext} from '../../directives';\nimport {MonthCalendarDayFormat, CalendarDayAspectRatio} from '../../misc';\nimport {EventParser} from '../../services';\nimport {DATE_API, FORMAT_PROVIDER} from '../../../../misc/tokens';\nimport {DateApi} from '../../../../services';\nimport {FormatProvider} from '../../../../interfaces';\n\n/**\n * Component used for displaying month calendar\n */\n@Component(\n{\n selector: 'month-calendar',\n templateUrl: 'monthCalendar.component.html',\n standalone: true,\n imports:\n [\n CalendarDayTemplateDirective,\n KeyValuePipe,\n ],\n providers:\n [\n EventParser,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class MonthCalendarComponent<TDate = unknown, TEvent = unknown> implements OnInit, OnChanges\n{\n //######################### protected properties - template bindings #########################\n\n /**\n * Aspect ratio for displayed calendar day cell\n */\n protected dayAspectRatioValue: number = CalendarDayAspectRatio.ThreeToTwo;\n\n /**\n * Data that represents calendar data\n */\n protected calendarData: Dictionary<CalendarDayData<TDate, TEvent>[]> = {};\n\n /**\n * Calendar day template to be used\n */\n protected get calendarDayTemplate(): TemplateRef<CalendarDayTemplateContext>\n {\n return this.customCalendarDayTemplate ?? this.defaultCalendarDayTemplate;\n }\n\n /**\n * Array of weekday names\n */\n protected weekDayNames: string[] = [];\n\n //######################### protected properties - children #########################\n\n /**\n * Default calendar day template\n */\n @ViewChild(CalendarDayTemplateDirective, {static: true, read: TemplateRef})\n protected defaultCalendarDayTemplate!: TemplateRef<CalendarDayTemplateContext>;\n\n /**\n * Custom calendar day template\n */\n @ContentChild(CalendarDayTemplateDirective, {static: true, read: TemplateRef})\n protected customCalendarDayTemplate: TemplateRef<CalendarDayTemplateContext>|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * Indication that week number should be displayed\n */\n @Input()\n public showWeekNumber: boolean = false;\n\n /**\n * Date that should be displayed in month calendar\n */\n @Input()\n public display: TDate|undefined|null;\n\n /**\n * Format for displaying week day names\n */\n @Input()\n public weekDayName: MonthCalendarDayFormat = MonthCalendarDayFormat.Short;\n\n /**\n * Aspect ratio for displayed calendar day cell\n */\n @Input()\n public get dayAspectRatio(): number\n {\n return this.dayAspectRatioValue;\n }\n public set dayAspectRatio(value: number)\n {\n if(isString(value))\n {\n this.dayAspectRatioValue = CalendarDayAspectRatio[value] as unknown as number;\n\n return;\n }\n\n this.dayAspectRatioValue = value;\n }\n\n /**\n * Array of events that should be displayed\n */\n @Input()\n public events: EventData<TDate, TEvent>[] = [];\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected dateApi: DateApi<TDate>,\n @Inject(FORMAT_PROVIDER) protected formatProvider: FormatProvider,\n protected eventParser: EventParser<TDate, TEvent>,)\n {\n }\n\n //######################### public methods - implementation of OnInit #########################\n\n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n this.initWeekdayNames();\n this.initializeDisplayCalendar();\n }\n\n //######################### public methods - implementation of OnChanges #########################\n\n /**\n * Called when input value changes\n */\n public ngOnChanges(changes: SimpleChanges): void\n {\n if(nameof<MonthCalendarComponent>('weekDayName') in changes)\n {\n this.initWeekdayNames();\n }\n\n if(nameof<MonthCalendarComponent>('display') in changes)\n {\n this.initializeDisplayCalendar();\n }\n\n if(nameof<MonthCalendarComponent>('events') in changes && !(nameof<MonthCalendarComponent>('display') in changes))\n {\n this.initAndAttachEventData();\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Initialize weekday names\n */\n protected initWeekdayNames(): void\n {\n this.weekDayNames = [];\n const dateApi = this.dateApi.now().startOfWeek();\n\n switch(this.weekDayName)\n {\n default:\n // case MonthCalendarDayFormat.None:\n {\n for(let x = 0; x < 7; x++)\n {\n this.weekDayNames.push('');\n }\n\n break;\n }\n case MonthCalendarDayFormat.Short:\n {\n for(let x = 0; x < 7; x++)\n {\n this.weekDayNames.push(dateApi.format(this.formatProvider.dayNameShort));\n dateApi.addDays(1);\n }\n\n break;\n }\n case MonthCalendarDayFormat.Full:\n {\n for(let x = 0; x < 7; x++)\n {\n this.weekDayNames.push(dateApi.format(this.formatProvider.dayName));\n dateApi.addDays(1);\n }\n\n break;\n }\n }\n }\n\n /**\n * Initialize date for calendar that should be displayed\n */\n protected initializeDisplayCalendar(): void\n {\n this.display ??= this.dateApi.now().value;\n\n const workDate = this.dateApi.getValue(this.display);\n\n workDate.startOfMonth()\n .startOfWeek();\n\n this.calendarData = {};\n\n do\n {\n const weekData: CalendarDayData<TDate, TEvent>[] = this.calendarData[workDate.format(this.formatProvider.week)] = [];\n\n for(let x = 0; x < 7; x++)\n {\n weekData.push(\n {\n date: workDate.value,\n day: workDate.dayOfMonth(),\n events: [],\n isCurrentMonth: workDate.isSameMonth(this.display),\n isWeekend: workDate.isWeekend(),\n week: +workDate.format(this.formatProvider.week),\n });\n\n workDate.addDays(1);\n }\n\n workDate.startOfWeek();\n }\n while(workDate.isSameMonth(this.display));\n\n this.initAndAttachEventData();\n }\n\n /**\n * Initialize and attaches event data\n */\n protected initAndAttachEventData(): void\n {\n const events = this.eventParser.getEventsPerDay(this.events);\n\n for(const week in this.calendarData)\n {\n const weekData = this.calendarData[week];\n\n for(const day of weekData)\n {\n const found = events.find(itm => this.dateApi.getValue(itm[0]).isSame(day.date));\n day.events = found?.[1] ?? [];\n }\n }\n }\n\n //######################### ng language server #########################\n\n /**\n * Custom input type for `weekDayName` input\n */\n public static ngAcceptInputType_weekDayName: keyof typeof MonthCalendarDayFormat;\n\n /**\n * Custom input type for `dayAspectRatio` input\n */\n public static ngAcceptInputType_dayAspectRatio: keyof typeof CalendarDayAspectRatio|number;\n}","<div *calendarDayTemplate=\"let data\" class=\"default-calendar-day\" [class.is-weekend]=\"data.isWeekend\" [class.is-other-month]=\"!data.isCurrentMonth\">{{data.day}}</div>\n\n@for(dayName of weekDayNames; track dayName)\n{\n <div [class.week-day-name]=\"dayName\">{{dayName}}</div>\n}\n\n@for(weekData of calendarData | keyvalue; track weekData)\n{\n <div class=\"week-number\">\n @if(showWeekNumber)\n {\n {{weekData.key}}\n }\n </div>\n \n @for(dayData of weekData.value; track dayData)\n {\n <div [style.padding-bottom.%]=\"dayAspectRatioValue\" class=\"day-wrapper\">\n <div class=\"day-content\"><ng-container *ngTemplateOutlet=\"calendarDayTemplate; context: {$implicit: dayData}\"/></div>\n </div>\n }\n}\n"]}
|
package/es2022/src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.js
CHANGED
|
@@ -4,7 +4,6 @@ import * as i0 from "@angular/core";
|
|
|
4
4
|
* Directive used for obtaining custom calendar day template
|
|
5
5
|
*/
|
|
6
6
|
export class CalendarDayTemplateDirective {
|
|
7
|
-
template;
|
|
8
7
|
//######################### constructor #########################
|
|
9
8
|
constructor(template) {
|
|
10
9
|
this.template = template;
|
|
@@ -16,13 +15,14 @@ export class CalendarDayTemplateDirective {
|
|
|
16
15
|
static ngTemplateContextGuard(_dir, _ctx) {
|
|
17
16
|
return true;
|
|
18
17
|
}
|
|
19
|
-
static
|
|
20
|
-
static
|
|
18
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: CalendarDayTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
19
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: CalendarDayTemplateDirective, isStandalone: true, selector: "[calendarDayTemplate]", ngImport: i0 }); }
|
|
21
20
|
}
|
|
22
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
21
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: CalendarDayTemplateDirective, decorators: [{
|
|
23
22
|
type: Directive,
|
|
24
23
|
args: [{
|
|
25
|
-
selector: '[calendarDayTemplate]'
|
|
24
|
+
selector: '[calendarDayTemplate]',
|
|
25
|
+
standalone: true,
|
|
26
26
|
}]
|
|
27
27
|
}], ctorParameters: () => [{ type: i0.TemplateRef }] });
|
|
28
28
|
//# sourceMappingURL=calendarDayTemplate.directive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendarDayTemplate.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;;AAIrD;;GAEG;
|
|
1
|
+
{"version":3,"file":"calendarDayTemplate.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/calendar/directives/calendarDayTemplate/calendarDayTemplate.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;;AAIrD;;GAEG;AAMH,MAAM,OAAO,4BAA4B;IAErC,iEAAiE;IACjE,YAAmB,QAAgE;QAAhE,aAAQ,GAAR,QAAQ,CAAwD;IAEnF,CAAC;IAED,wEAAwE;IAExE;;OAEG;IACH,MAAM,CAAC,sBAAsB,CAAC,IAAkC,EAAE,IAAa;QAE3E,OAAO,IAAI,CAAC;IAChB,CAAC;8GAfQ,4BAA4B;kGAA5B,4BAA4B;;2FAA5B,4BAA4B;kBALxC,SAAS;mBACV;oBACI,QAAQ,EAAE,uBAAuB;oBACjC,UAAU,EAAE,IAAI;iBACnB","sourcesContent":["import {Directive, TemplateRef} from '@angular/core';\n\nimport {CalendarDayTemplateContext} from './calendarDayTemplate.context';\n\n/**\n * Directive used for obtaining custom calendar day template\n */\n@Directive(\n{\n selector: '[calendarDayTemplate]',\n standalone: true,\n})\nexport class CalendarDayTemplateDirective<TDate = unknown, TEvent = unknown>\n{\n //######################### constructor #########################\n constructor(public template: TemplateRef<CalendarDayTemplateContext<TDate, TEvent>>)\n {\n }\n\n //######################### ng language server #########################\n \n /**\n * Allows typechecking for template\n */\n static ngTemplateContextGuard(_dir: CalendarDayTemplateDirective, _ctx: unknown): _ctx is CalendarDayTemplateContext\n {\n return true;\n }\n}"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
2
|
import { MonthCalendarComponent } from '../components';
|
|
4
3
|
import { CalendarDayTemplateDirective } from '../directives';
|
|
5
4
|
import * as i0 from "@angular/core";
|
|
@@ -7,21 +6,18 @@ import * as i0 from "@angular/core";
|
|
|
7
6
|
* Module used for calendar displaying month
|
|
8
7
|
*/
|
|
9
8
|
export class MonthCalendarModule {
|
|
10
|
-
static
|
|
11
|
-
static
|
|
12
|
-
|
|
13
|
-
CalendarDayTemplateDirective] });
|
|
14
|
-
static
|
|
9
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: MonthCalendarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
10
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.7", ngImport: i0, type: MonthCalendarModule, imports: [CalendarDayTemplateDirective,
|
|
11
|
+
MonthCalendarComponent], exports: [MonthCalendarComponent,
|
|
12
|
+
CalendarDayTemplateDirective] }); }
|
|
13
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: MonthCalendarModule }); }
|
|
15
14
|
}
|
|
16
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: MonthCalendarModule, decorators: [{
|
|
17
16
|
type: NgModule,
|
|
18
17
|
args: [{
|
|
19
18
|
imports: [
|
|
20
|
-
CommonModule,
|
|
21
|
-
],
|
|
22
|
-
declarations: [
|
|
23
|
-
MonthCalendarComponent,
|
|
24
19
|
CalendarDayTemplateDirective,
|
|
20
|
+
MonthCalendarComponent,
|
|
25
21
|
],
|
|
26
22
|
exports: [
|
|
27
23
|
MonthCalendarComponent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monthCalendar.module.js","sourceRoot":"","sources":["../../../../../src/modules/calendar/modules/monthCalendar.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"monthCalendar.module.js","sourceRoot":"","sources":["../../../../../src/modules/calendar/modules/monthCalendar.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,sBAAsB,EAAC,MAAM,eAAe,CAAC;AACrD,OAAO,EAAC,4BAA4B,EAAC,MAAM,eAAe,CAAC;;AAE3D;;GAEG;AAcH,MAAM,OAAO,mBAAmB;8GAAnB,mBAAmB;+GAAnB,mBAAmB,YATxB,4BAA4B;YAC5B,sBAAsB,aAItB,sBAAsB;YACtB,4BAA4B;+GAGvB,mBAAmB;;2FAAnB,mBAAmB;kBAb/B,QAAQ;mBACT;oBACI,OAAO,EACP;wBACI,4BAA4B;wBAC5B,sBAAsB;qBACzB;oBACD,OAAO,EACP;wBACI,sBAAsB;wBACtB,4BAA4B;qBAC/B;iBACJ","sourcesContent":["import {NgModule} from '@angular/core';\n\nimport {MonthCalendarComponent} from '../components';\nimport {CalendarDayTemplateDirective} from '../directives';\n\n/**\n * Module used for calendar displaying month\n */\n@NgModule(\n{\n imports:\n [\n CalendarDayTemplateDirective,\n MonthCalendarComponent,\n ],\n exports:\n [\n MonthCalendarComponent,\n CalendarDayTemplateDirective,\n ],\n})\nexport class MonthCalendarModule\n{\n}"]}
|
|
@@ -5,7 +5,6 @@ import * as i0 from "@angular/core";
|
|
|
5
5
|
* Service used for parsing events into events to requested period
|
|
6
6
|
*/
|
|
7
7
|
export class EventParser {
|
|
8
|
-
dateApi;
|
|
9
8
|
//######################### constructor #########################
|
|
10
9
|
constructor(dateApi) {
|
|
11
10
|
this.dateApi = dateApi;
|
|
@@ -63,10 +62,10 @@ export class EventParser {
|
|
|
63
62
|
}
|
|
64
63
|
return result;
|
|
65
64
|
}
|
|
66
|
-
static
|
|
67
|
-
static
|
|
65
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: EventParser, deps: [{ token: DATE_API }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
66
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: EventParser }); }
|
|
68
67
|
}
|
|
69
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: EventParser, decorators: [{
|
|
70
69
|
type: Injectable
|
|
71
70
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
72
71
|
type: Inject,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventParser.service.js","sourceRoot":"","sources":["../../../../../../src/modules/calendar/services/eventParser/eventParser.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;;AAIjD;;GAEG;AAEH,MAAM,OAAO,WAAW;
|
|
1
|
+
{"version":3,"file":"eventParser.service.js","sourceRoot":"","sources":["../../../../../../src/modules/calendar/services/eventParser/eventParser.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;;AAIjD;;GAEG;AAEH,MAAM,OAAO,WAAW;IAEpB,iEAAiE;IACjE,YAAwC,OAAuB;QAAvB,YAAO,GAAP,OAAO,CAAgB;IAE/D,CAAC;IAED,oEAAoE;IAEpE;;;OAGG;IACI,eAAe,CAAC,MAAkC;QAErD,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YAEjC,OACA;gBACI,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,QAAQ,EAAE,GAAG,CAAC,QAAQ;gBACtB,MAAM,EAAE,GAAG,CAAC,MAAM;gBAClB,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;gBAChD,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI;aACnE,CAAC;QACN,CAAC,CAAC,CAAC;QAEH,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YAEtB,IAAG,CAAC,CAAC,WAAW,CAAC,OAAO,C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C,QAAQ;wBACxB,MAAM,EAAE,KAAK,CAAC,MAAM;wBACpB,WAAW,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC;wBAC7D,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;4BAC3E,CAAC,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;wBAChH,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC;qBACrE,CAAC;gBAEF,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;YACrC,CAAC,QACK,CAAC,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE;QAC5G,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;8GAhFQ,WAAW,kBAGA,QAAQ;kHAHnB,WAAW;;2FAAX,WAAW;kBADvB,UAAU;;0BAIM,MAAM;2BAAC,QAAQ","sourcesContent":["import {Inject, Injectable} from '@angular/core';\n\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi} from '../../../../services';\nimport {CalendarEventDayMetadata, EventData, ɵEventData} from '../../interfaces';\n\n/**\n * Service used for parsing events into events to requested period\n */\n@Injectable()\nexport class EventParser<TDate = unknown, TEvent = unknown>\n{\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected dateApi: DateApi<TDate>,)\n {\n }\n\n //######################### public methods #########################\n\n /**\n * Gets events parsed per day\n * @param events - Array of events to be parsed\n */\n public getEventsPerDay(events: EventData<TDate, TEvent>[]): [TDate, CalendarEventDayMetadata<TDate, TEvent>[]][]\n {\n const eventsLocal = events.map(itm =>\n {\n return <ɵEventData<TDate, TEvent>>\n {\n data: itm.data,\n dateFrom: itm.dateFrom,\n dateTo: itm.dateTo,\n dateApiFrom: this.dateApi.getValue(itm.dateFrom),\n dateApiTo: itm.dateTo ? this.dateApi.getValue(itm.dateTo) : null,\n };\n });\n\n eventsLocal.sort((a, b) =>\n {\n if(a.dateApiFrom.isAfter(b.dateApiFrom.value))\n {\n return 1;\n }\n\n if(a.dateApiFrom.isBefore(b.dateApiFrom.value))\n {\n return -1;\n }\n\n return 0;\n });\n\n const result: [TDate, CalendarEventDayMetadata<TDate, TEvent>[]][] = [];\n\n for(const event of eventsLocal)\n {\n const workDate = event.dateApiFrom.clone().startOfDay();\n const data: CalendarEventDayMetadata<TDate, TEvent>[] = result.find(itm => workDate.isSameDay(itm[0]))?.[1] ?? [];\n const index = data.length;\n\n do\n {\n let data: [TDate, CalendarEventDayMetadata<TDate, TEvent>[]]|undefined = result.find(itm => workDate.isSameDay(itm[0]));\n\n if(!data)\n {\n data = [workDate.value, []];\n result.push(data);\n }\n\n const evnts: CalendarEventDayMetadata<TDate, TEvent>[] = data[1];\n evnts[index] =\n {\n data: event.data,\n dateApiFrom: event.dateApiFrom,\n dateApiTo: event.dateApiTo,\n dateFrom: event.dateFrom,\n dateTo: event.dateTo,\n onGoingFrom: workDate.startOfDay().isAfter(event.dateApiFrom),\n allDay: (workDate.isSame(event.dateApiFrom) || workDate.isAfter(event.dateApiFrom)) &&\n !!event.dateApiTo && (workDate.endOfDay().isSame(event.dateApiTo) || workDate.isBefore(event.dateApiTo)),\n onGoingTo: !!event.dateApiTo && workDate.isBefore(event.dateApiTo),\n };\n \n workDate.addDays(1).startOfDay();\n }\n while(!!event.dateApiTo && (workDate.isBefore(event.dateApiTo) || workDate.isSameDay(event.dateApiTo)));\n }\n\n return result;\n }\n}"]}
|
|
@@ -6,16 +6,16 @@ import * as i0 from "@angular/core";
|
|
|
6
6
|
* Module used for exporting date pipes
|
|
7
7
|
*/
|
|
8
8
|
export class DatePipesModule {
|
|
9
|
-
static
|
|
10
|
-
static
|
|
9
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DatePipesModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
10
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.7", ngImport: i0, type: DatePipesModule, imports: [DateFormatPipe,
|
|
11
11
|
DateConvertPipe], exports: [DateFormatPipe,
|
|
12
|
-
DateConvertPipe] });
|
|
13
|
-
static
|
|
12
|
+
DateConvertPipe] }); }
|
|
13
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DatePipesModule }); }
|
|
14
14
|
}
|
|
15
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DatePipesModule, decorators: [{
|
|
16
16
|
type: NgModule,
|
|
17
17
|
args: [{
|
|
18
|
-
|
|
18
|
+
imports: [
|
|
19
19
|
DateFormatPipe,
|
|
20
20
|
DateConvertPipe,
|
|
21
21
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datePipes.module.js","sourceRoot":"","sources":["../../../src/modules/datePipes.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;;AAExD;;GAEG;AAcH,MAAM,OAAO,eAAe;
|
|
1
|
+
{"version":3,"file":"datePipes.module.js","sourceRoot":"","sources":["../../../src/modules/datePipes.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,cAAc,EAAC,MAAM,0BAA0B,CAAC;;AAExD;;GAEG;AAcH,MAAM,OAAO,eAAe;8GAAf,eAAe;+GAAf,eAAe,YATpB,cAAc;YACd,eAAe,aAIf,cAAc;YACd,eAAe;+GAGV,eAAe;;2FAAf,eAAe;kBAb3B,QAAQ;mBACT;oBACI,OAAO,EACP;wBACI,cAAc;wBACd,eAAe;qBAClB;oBACD,OAAO,EACP;wBACI,cAAc;wBACd,eAAe;qBAClB;iBACJ","sourcesContent":["import {NgModule} from '@angular/core';\n\nimport {DateConvertPipe} from '../pipes/dateConvert.pipe';\nimport {DateFormatPipe} from '../pipes/dateFormat.pipe';\n\n/**\n * Module used for exporting date pipes\n */\n@NgModule(\n{\n imports:\n [\n DateFormatPipe,\n DateConvertPipe,\n ],\n exports:\n [\n DateFormatPipe,\n DateConvertPipe,\n ]\n})\nexport class DatePipesModule\n{\n}"]}
|
|
@@ -10,56 +10,42 @@ import * as i0 from "@angular/core";
|
|
|
10
10
|
/**
|
|
11
11
|
* Directive that holds shared data for date time, like formats, restrictions
|
|
12
12
|
*/
|
|
13
|
-
export class
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*/
|
|
50
|
-
ɵformat = 'date';
|
|
51
|
-
/**
|
|
52
|
-
* Date api instance, used for date time manipulation
|
|
53
|
-
*/
|
|
54
|
-
dateApi = inject(DATE_API);
|
|
55
|
-
/**
|
|
56
|
-
* Provider for available formats
|
|
57
|
-
*/
|
|
58
|
-
formatProvider = inject(FORMAT_PROVIDER);
|
|
59
|
-
/**
|
|
60
|
-
* Custom format string representation of date
|
|
61
|
-
*/
|
|
62
|
-
ɵcustomFormat = this.dateApi.getFormat(this.formatProvider[this.ɵformat]);
|
|
13
|
+
export class DateTimeDirective {
|
|
14
|
+
constructor() {
|
|
15
|
+
//######################### protected properties #########################
|
|
16
|
+
/**
|
|
17
|
+
* Subject used for emitting changes in max date time value
|
|
18
|
+
*/
|
|
19
|
+
this.maxDateTimeChangesSubject = new Subject();
|
|
20
|
+
/**
|
|
21
|
+
* Subject used for emitting changes in min date time value
|
|
22
|
+
*/
|
|
23
|
+
this.minDateTimeChangesSubject = new Subject();
|
|
24
|
+
/**
|
|
25
|
+
* Subject used for emitting changes in custom format value
|
|
26
|
+
*/
|
|
27
|
+
this.customFormatChangesSubject = new Subject();
|
|
28
|
+
/**
|
|
29
|
+
* Date time value format which is being worked with in this date time
|
|
30
|
+
*/
|
|
31
|
+
this.ɵvalueFormat = DateTimeValueFormat.DateInstance;
|
|
32
|
+
/**
|
|
33
|
+
* Format of string representation of date
|
|
34
|
+
*/
|
|
35
|
+
this.ɵformat = 'date';
|
|
36
|
+
/**
|
|
37
|
+
* Date api instance, used for date time manipulation
|
|
38
|
+
*/
|
|
39
|
+
this.dateApi = inject(DATE_API);
|
|
40
|
+
/**
|
|
41
|
+
* Provider for available formats
|
|
42
|
+
*/
|
|
43
|
+
this.formatProvider = inject(FORMAT_PROVIDER);
|
|
44
|
+
/**
|
|
45
|
+
* Custom format string representation of date
|
|
46
|
+
*/
|
|
47
|
+
this.ɵcustomFormat = this.dateApi.getFormat(this.formatProvider[this.ɵformat]);
|
|
48
|
+
}
|
|
63
49
|
//######################### public properties #########################
|
|
64
50
|
/**
|
|
65
51
|
* Occurs when there are changes in max date time value
|
|
@@ -113,10 +99,6 @@ export class DateTimeSADirective {
|
|
|
113
99
|
this.ɵcustomFormat = value;
|
|
114
100
|
this.customFormatChangesSubject.next();
|
|
115
101
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Represents data format that is used as value of date time when `DateTimeValueFormat.DataString` is set to `valueFormat`
|
|
118
|
-
*/
|
|
119
|
-
dataFormat;
|
|
120
102
|
/**
|
|
121
103
|
* Gets or sets max allowed date for date time
|
|
122
104
|
*/
|
|
@@ -238,35 +220,22 @@ export class DateTimeSADirective {
|
|
|
238
220
|
*/
|
|
239
221
|
onMinDateTimeChange() {
|
|
240
222
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
* Custom input type for `valueFormat` input
|
|
244
|
-
*/
|
|
245
|
-
static ngAcceptInputType_valueFormat;
|
|
246
|
-
/**
|
|
247
|
-
* Custom input type for `maxDateTime` input
|
|
248
|
-
*/
|
|
249
|
-
static ngAcceptInputType_maxDateTime;
|
|
250
|
-
/**
|
|
251
|
-
* Custom input type for `minDateTime` input
|
|
252
|
-
*/
|
|
253
|
-
static ngAcceptInputType_minDateTime;
|
|
254
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.1", ngImport: i0, type: DateTimeSADirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
255
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.1", type: DateTimeSADirective, isStandalone: true, selector: "[dateTime]", inputs: { valueFormat: "valueFormat", format: "format", customFormat: "customFormat", dataFormat: "dataFormat", maxDateTime: "maxDateTime", minDateTime: "minDateTime" }, ngImport: i0 });
|
|
223
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
224
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.7", type: DateTimeDirective, isStandalone: true, selector: "[dateTime]", inputs: { valueFormat: "valueFormat", format: "format", customFormat: "customFormat", dataFormat: "dataFormat", maxDateTime: "maxDateTime", minDateTime: "minDateTime" }, ngImport: i0 }); }
|
|
256
225
|
}
|
|
257
226
|
__decorate([
|
|
258
227
|
BindThis,
|
|
259
228
|
__metadata("design:type", Function),
|
|
260
229
|
__metadata("design:paramtypes", [Object]),
|
|
261
230
|
__metadata("design:returntype", void 0)
|
|
262
|
-
],
|
|
231
|
+
], DateTimeDirective.prototype, "minDateSet", null);
|
|
263
232
|
__decorate([
|
|
264
233
|
BindThis,
|
|
265
234
|
__metadata("design:type", Function),
|
|
266
235
|
__metadata("design:paramtypes", [Object]),
|
|
267
236
|
__metadata("design:returntype", void 0)
|
|
268
|
-
],
|
|
269
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
237
|
+
], DateTimeDirective.prototype, "maxDateSet", null);
|
|
238
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: DateTimeDirective, decorators: [{
|
|
270
239
|
type: Directive,
|
|
271
240
|
args: [{
|
|
272
241
|
selector: '[dateTime]',
|