@anglr/datetime 1.0.0 → 2.0.1-beta.20220222061608
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 +19 -0
- package/date-fns/package.json +7 -7
- package/date-fns/src/{date-fns.d.ts → index.d.ts} +4 -4
- package/date-fns/src/index.d.ts.map +1 -0
- package/date-fns/src/misc/tokens.d.ts +10 -10
- package/date-fns/src/services/dateFnsDateApi.service.d.ts +36 -33
- package/date-fns/src/services/dateFnsDateApi.service.d.ts.map +1 -1
- package/date-fns/src/services/dateFnsLocale.service.d.ts +10 -10
- package/es2015/date-fns/src/index.js +4 -0
- package/es2015/date-fns/src/index.js.map +1 -0
- package/es2015/date-fns/src/misc/tokens.js +20 -0
- package/es2015/date-fns/src/misc/tokens.js.map +1 -0
- package/es2015/date-fns/src/services/dateFnsDateApi.service.js +438 -0
- package/es2015/date-fns/src/services/dateFnsDateApi.service.js.map +1 -0
- package/es2015/date-fns/src/services/dateFnsLocale.service.js +2 -0
- package/es2015/date-fns/src/services/dateFnsLocale.service.js.map +1 -0
- package/es2015/karma.conf.js +57 -0
- package/es2015/karma.conf.js.map +1 -0
- package/{moment/src/moment.d.ts → es2015/moment/src/index.js} +3 -3
- package/es2015/moment/src/index.js.map +1 -0
- package/es2015/moment/src/misc/tokens.js +15 -0
- package/es2015/moment/src/misc/tokens.js.map +1 -0
- package/es2015/moment/src/services/momentDateApi.service.js +398 -0
- package/es2015/moment/src/services/momentDateApi.service.js.map +1 -0
- package/{src/datetime.d.ts → es2015/src/index.js} +19 -19
- package/es2015/src/index.js.map +1 -0
- package/es2015/src/misc/constants.js +33 -0
- package/es2015/src/misc/constants.js.map +1 -0
- package/es2015/src/misc/datetime.interface.js +2 -0
- package/es2015/src/misc/datetime.interface.js.map +1 -0
- package/es2015/src/misc/tokens.js +19 -0
- package/es2015/src/misc/tokens.js.map +1 -0
- package/es2015/src/misc/validators.js +58 -0
- package/es2015/src/misc/validators.js.map +1 -0
- package/es2015/src/modules/datePipes.module.js +33 -0
- package/es2015/src/modules/datePipes.module.js.map +1 -0
- package/es2015/src/picker/components/dayPicker/dayPicker.component.js +172 -0
- package/es2015/src/picker/components/dayPicker/dayPicker.component.js.map +1 -0
- package/es2015/src/picker/components/dayPicker/dayPicker.interfaces.js +2 -0
- package/es2015/src/picker/components/dayPicker/dayPicker.interfaces.js.map +1 -0
- package/es2015/src/picker/components/monthPicker/monthPicker.component.js +114 -0
- package/es2015/src/picker/components/monthPicker/monthPicker.component.js.map +1 -0
- package/es2015/src/picker/components/monthPicker/monthPicker.interfaces.js +2 -0
- package/es2015/src/picker/components/monthPicker/monthPicker.interfaces.js.map +1 -0
- package/es2015/src/picker/components/picker/picker.component.animations.js +71 -0
- package/es2015/src/picker/components/picker/picker.component.animations.js.map +1 -0
- package/es2015/src/picker/components/picker/picker.component.js +241 -0
- package/es2015/src/picker/components/picker/picker.component.js.map +1 -0
- package/es2015/src/picker/components/pickerBase.component.js +243 -0
- package/es2015/src/picker/components/pickerBase.component.js.map +1 -0
- package/es2015/src/picker/components/yearPicker/yearPicker.component.js +126 -0
- package/es2015/src/picker/components/yearPicker/yearPicker.component.js.map +1 -0
- package/es2015/src/picker/components/yearPicker/yearPicker.interfaces.js +2 -0
- package/es2015/src/picker/components/yearPicker/yearPicker.interfaces.js.map +1 -0
- package/es2015/src/picker/interfaces.js +5 -0
- package/es2015/src/picker/interfaces.js.map +1 -0
- package/es2015/src/picker/misc/datetimePicker.interface.js +2 -0
- package/es2015/src/picker/misc/datetimePicker.interface.js.map +1 -0
- package/es2015/src/picker/misc/tokens.js +6 -0
- package/es2015/src/picker/misc/tokens.js.map +1 -0
- package/es2015/src/picker/modules/picker.module.js +46 -0
- package/es2015/src/picker/modules/picker.module.js.map +1 -0
- package/es2015/src/picker/types.js +8 -0
- package/es2015/src/picker/types.js.map +1 -0
- package/es2015/src/pipes/asRequiredType.js +22 -0
- package/es2015/src/pipes/asRequiredType.js.map +1 -0
- package/es2015/src/pipes/dateConvert.pipe.js +35 -0
- package/es2015/src/pipes/dateConvert.pipe.js.map +1 -0
- package/es2015/src/pipes/dateFormat.pipe.js +45 -0
- package/es2015/src/pipes/dateFormat.pipe.js.map +1 -0
- package/es2015/src/selector/components/inputDateTime/inputDateTime.component.js +421 -0
- package/es2015/src/selector/components/inputDateTime/inputDateTime.component.js.map +1 -0
- package/es2015/src/selector/components/selector/selector.component.animations.js +15 -0
- package/es2015/src/selector/components/selector/selector.component.animations.js.map +1 -0
- package/es2015/src/selector/components/selector/selector.component.js +344 -0
- package/es2015/src/selector/components/selector/selector.component.js.map +1 -0
- package/es2015/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.js +317 -0
- package/es2015/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.js.map +1 -0
- package/es2015/src/selector/directives/datetimeMaxValidator/datetimeMaxValidator.directive.js +51 -0
- package/es2015/src/selector/directives/datetimeMaxValidator/datetimeMaxValidator.directive.js.map +1 -0
- package/es2015/src/selector/directives/datetimeMinValidator/datetimeMinValidator.directive.js +51 -0
- package/es2015/src/selector/directives/datetimeMinValidator/datetimeMinValidator.directive.js.map +1 -0
- package/es2015/src/selector/directives/datetimeValidator/datetimeValidator.directive.js +47 -0
- package/es2015/src/selector/directives/datetimeValidator/datetimeValidator.directive.js.map +1 -0
- package/es2015/src/selector/directives/selectorControlValueAccessor/selectorControlValueAccessor.directive.js +119 -0
- package/es2015/src/selector/directives/selectorControlValueAccessor/selectorControlValueAccessor.directive.js.map +1 -0
- package/es2015/src/selector/interfaces.js +2 -0
- package/es2015/src/selector/interfaces.js.map +1 -0
- package/es2015/src/selector/misc/datetimeSelector.interface.js +2 -0
- package/es2015/src/selector/misc/datetimeSelector.interface.js.map +1 -0
- package/es2015/src/selector/misc/tokens.js +6 -0
- package/es2015/src/selector/misc/tokens.js.map +1 -0
- package/es2015/src/selector/modules/basicSelector.module.js +20 -0
- package/es2015/src/selector/modules/basicSelector.module.js.map +1 -0
- package/es2015/src/selector/modules/selector.module.js +60 -0
- package/es2015/src/selector/modules/selector.module.js.map +1 -0
- package/es2015/src/selector/types.js +10 -0
- package/es2015/src/selector/types.js.map +1 -0
- package/es2015/src/services/dateApi.interface.js +2 -0
- package/es2015/src/services/dateApi.interface.js.map +1 -0
- package/es2015/src/services/datePositionParser.interface.js +2 -0
- package/es2015/src/services/datePositionParser.interface.js.map +1 -0
- package/es2015/src/services/datePositionParser.service.js +227 -0
- package/es2015/src/services/datePositionParser.service.js.map +1 -0
- package/es2015/src/services/dateTimeRelativeParser.service.js +66 -0
- package/es2015/src/services/dateTimeRelativeParser.service.js.map +1 -0
- package/es2015/src/services/dateValueProvider.service.js +58 -0
- package/es2015/src/services/dateValueProvider.service.js.map +1 -0
- package/es2015/src/services/formatProvider.interface.js +2 -0
- package/es2015/src/services/formatProvider.interface.js.map +1 -0
- package/es2015/src/services/index.js +4 -0
- package/es2015/src/services/index.js.map +1 -0
- package/es2020/date-fns/src/index.js +4 -0
- package/es2020/date-fns/src/index.js.map +1 -0
- package/es2020/date-fns/src/misc/tokens.js +20 -0
- package/es2020/date-fns/src/misc/tokens.js.map +1 -0
- package/es2020/date-fns/src/services/dateFnsDateApi.service.js +437 -0
- package/es2020/date-fns/src/services/dateFnsDateApi.service.js.map +1 -0
- package/es2020/date-fns/src/services/dateFnsLocale.service.js +2 -0
- package/es2020/date-fns/src/services/dateFnsLocale.service.js.map +1 -0
- package/es2020/karma.conf.js +57 -0
- package/es2020/karma.conf.js.map +1 -0
- package/es2020/moment/src/index.js +3 -0
- package/es2020/moment/src/index.js.map +1 -0
- package/es2020/moment/src/misc/tokens.js +15 -0
- package/es2020/moment/src/misc/tokens.js.map +1 -0
- package/es2020/moment/src/services/momentDateApi.service.js +398 -0
- package/es2020/moment/src/services/momentDateApi.service.js.map +1 -0
- package/es2020/src/index.js +19 -0
- package/es2020/src/index.js.map +1 -0
- package/es2020/src/misc/constants.js +33 -0
- package/es2020/src/misc/constants.js.map +1 -0
- package/es2020/src/misc/datetime.interface.js +2 -0
- package/es2020/src/misc/datetime.interface.js.map +1 -0
- package/es2020/src/misc/tokens.js +19 -0
- package/es2020/src/misc/tokens.js.map +1 -0
- package/es2020/src/misc/validators.js +58 -0
- package/es2020/src/misc/validators.js.map +1 -0
- package/es2020/src/modules/datePipes.module.js +33 -0
- package/es2020/src/modules/datePipes.module.js.map +1 -0
- package/es2020/src/picker/components/dayPicker/dayPicker.component.js +172 -0
- package/es2020/src/picker/components/dayPicker/dayPicker.component.js.map +1 -0
- package/es2020/src/picker/components/dayPicker/dayPicker.interfaces.js +2 -0
- package/es2020/src/picker/components/dayPicker/dayPicker.interfaces.js.map +1 -0
- package/es2020/src/picker/components/monthPicker/monthPicker.component.js +114 -0
- package/es2020/src/picker/components/monthPicker/monthPicker.component.js.map +1 -0
- package/es2020/src/picker/components/monthPicker/monthPicker.interfaces.js +2 -0
- package/es2020/src/picker/components/monthPicker/monthPicker.interfaces.js.map +1 -0
- package/es2020/src/picker/components/picker/picker.component.animations.js +71 -0
- package/es2020/src/picker/components/picker/picker.component.animations.js.map +1 -0
- package/es2020/src/picker/components/picker/picker.component.js +236 -0
- package/es2020/src/picker/components/picker/picker.component.js.map +1 -0
- package/es2020/src/picker/components/pickerBase.component.js +243 -0
- package/es2020/src/picker/components/pickerBase.component.js.map +1 -0
- package/es2020/src/picker/components/yearPicker/yearPicker.component.js +126 -0
- package/es2020/src/picker/components/yearPicker/yearPicker.component.js.map +1 -0
- package/es2020/src/picker/components/yearPicker/yearPicker.interfaces.js +2 -0
- package/es2020/src/picker/components/yearPicker/yearPicker.interfaces.js.map +1 -0
- package/es2020/src/picker/interfaces.js +5 -0
- package/es2020/src/picker/interfaces.js.map +1 -0
- package/es2020/src/picker/misc/datetimePicker.interface.js +2 -0
- package/es2020/src/picker/misc/datetimePicker.interface.js.map +1 -0
- package/es2020/src/picker/misc/tokens.js +6 -0
- package/es2020/src/picker/misc/tokens.js.map +1 -0
- package/es2020/src/picker/modules/picker.module.js +46 -0
- package/es2020/src/picker/modules/picker.module.js.map +1 -0
- package/es2020/src/picker/types.js +8 -0
- package/es2020/src/picker/types.js.map +1 -0
- package/es2020/src/pipes/asRequiredType.js +22 -0
- package/es2020/src/pipes/asRequiredType.js.map +1 -0
- package/es2020/src/pipes/dateConvert.pipe.js +35 -0
- package/es2020/src/pipes/dateConvert.pipe.js.map +1 -0
- package/es2020/src/pipes/dateFormat.pipe.js +45 -0
- package/es2020/src/pipes/dateFormat.pipe.js.map +1 -0
- package/es2020/src/selector/components/inputDateTime/inputDateTime.component.js +417 -0
- package/es2020/src/selector/components/inputDateTime/inputDateTime.component.js.map +1 -0
- package/es2020/src/selector/components/selector/selector.component.animations.js +15 -0
- package/es2020/src/selector/components/selector/selector.component.animations.js.map +1 -0
- package/es2020/src/selector/components/selector/selector.component.js +334 -0
- package/es2020/src/selector/components/selector/selector.component.js.map +1 -0
- package/es2020/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.js +314 -0
- package/es2020/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.js.map +1 -0
- package/es2020/src/selector/directives/datetimeMaxValidator/datetimeMaxValidator.directive.js +51 -0
- package/es2020/src/selector/directives/datetimeMaxValidator/datetimeMaxValidator.directive.js.map +1 -0
- package/es2020/src/selector/directives/datetimeMinValidator/datetimeMinValidator.directive.js +51 -0
- package/es2020/src/selector/directives/datetimeMinValidator/datetimeMinValidator.directive.js.map +1 -0
- package/es2020/src/selector/directives/datetimeValidator/datetimeValidator.directive.js +47 -0
- package/es2020/src/selector/directives/datetimeValidator/datetimeValidator.directive.js.map +1 -0
- package/es2020/src/selector/directives/selectorControlValueAccessor/selectorControlValueAccessor.directive.js +118 -0
- package/es2020/src/selector/directives/selectorControlValueAccessor/selectorControlValueAccessor.directive.js.map +1 -0
- package/es2020/src/selector/interfaces.js +2 -0
- package/es2020/src/selector/interfaces.js.map +1 -0
- package/es2020/src/selector/misc/datetimeSelector.interface.js +2 -0
- package/es2020/src/selector/misc/datetimeSelector.interface.js.map +1 -0
- package/es2020/src/selector/misc/tokens.js +6 -0
- package/es2020/src/selector/misc/tokens.js.map +1 -0
- package/es2020/src/selector/modules/basicSelector.module.js +20 -0
- package/es2020/src/selector/modules/basicSelector.module.js.map +1 -0
- package/es2020/src/selector/modules/selector.module.js +60 -0
- package/es2020/src/selector/modules/selector.module.js.map +1 -0
- package/es2020/src/selector/types.js +10 -0
- package/es2020/src/selector/types.js.map +1 -0
- package/es2020/src/services/dateApi.interface.js +2 -0
- package/es2020/src/services/dateApi.interface.js.map +1 -0
- package/es2020/src/services/datePositionParser.interface.js +2 -0
- package/es2020/src/services/datePositionParser.interface.js.map +1 -0
- package/es2020/src/services/datePositionParser.service.js +227 -0
- package/es2020/src/services/datePositionParser.service.js.map +1 -0
- package/es2020/src/services/dateTimeRelativeParser.service.js +65 -0
- package/es2020/src/services/dateTimeRelativeParser.service.js.map +1 -0
- package/es2020/src/services/dateValueProvider.service.js +58 -0
- package/es2020/src/services/dateValueProvider.service.js.map +1 -0
- package/es2020/src/services/formatProvider.interface.js +2 -0
- package/es2020/src/services/formatProvider.interface.js.map +1 -0
- package/es2020/src/services/index.js +4 -0
- package/es2020/src/services/index.js.map +1 -0
- package/karma.conf.d.ts +2 -0
- package/karma.conf.d.ts.map +1 -0
- package/moment/package.json +7 -7
- package/moment/src/index.d.ts +3 -0
- package/moment/src/index.d.ts.map +1 -0
- package/moment/src/misc/tokens.d.ts +5 -5
- package/moment/src/services/momentDateApi.service.d.ts +35 -32
- package/moment/src/services/momentDateApi.service.d.ts.map +1 -1
- package/package.json +100 -48
- package/src/index.d.ts +19 -0
- package/src/index.d.ts.map +1 -0
- package/src/misc/constants.d.ts +32 -32
- package/src/misc/datetime.interface.d.ts +34 -34
- package/src/misc/tokens.d.ts +10 -10
- package/src/misc/validators.d.ts +25 -25
- package/src/modules/datePipes.module.d.ts +12 -5
- package/src/modules/datePipes.module.d.ts.map +1 -1
- package/src/picker/components/dayPicker/dayPicker.component.d.ts +68 -65
- package/src/picker/components/dayPicker/dayPicker.component.d.ts.map +1 -1
- package/src/picker/components/dayPicker/dayPicker.component.html +7 -7
- package/src/picker/components/dayPicker/dayPicker.interfaces.d.ts +10 -10
- package/src/picker/components/monthPicker/monthPicker.component.d.ts +52 -49
- package/src/picker/components/monthPicker/monthPicker.component.d.ts.map +1 -1
- package/src/picker/components/monthPicker/monthPicker.component.html +6 -6
- package/src/picker/components/monthPicker/monthPicker.interfaces.d.ts +6 -6
- package/src/picker/components/picker/picker.component.animations.d.ts +4 -4
- package/src/picker/components/picker/picker.component.d.ts +104 -101
- package/src/picker/components/picker/picker.component.d.ts.map +1 -1
- package/src/picker/components/pickerBase.component.d.ts +169 -166
- package/src/picker/components/pickerBase.component.d.ts.map +1 -1
- package/src/picker/components/yearPicker/yearPicker.component.d.ts +57 -54
- package/src/picker/components/yearPicker/yearPicker.component.d.ts.map +1 -1
- package/src/picker/components/yearPicker/yearPicker.component.html +6 -6
- package/src/picker/components/yearPicker/yearPicker.interfaces.d.ts +6 -6
- package/src/picker/interfaces.d.ts +4 -4
- package/src/picker/misc/datetimePicker.interface.d.ts +188 -188
- package/src/picker/misc/tokens.d.ts +6 -6
- package/src/picker/modules/picker.module.d.ts +16 -5
- package/src/picker/modules/picker.module.d.ts.map +1 -1
- package/src/picker/types.d.ts +7 -7
- package/src/pipes/asRequiredType.d.ts +21 -0
- package/src/pipes/asRequiredType.d.ts.map +1 -0
- package/src/pipes/dateConvert.pipe.d.ts +18 -15
- package/src/pipes/dateConvert.pipe.d.ts.map +1 -1
- package/src/pipes/dateFormat.pipe.d.ts +20 -17
- package/src/pipes/dateFormat.pipe.d.ts.map +1 -1
- package/src/selector/components/inputDateTime/inputDateTime.component.d.ts +187 -184
- package/src/selector/components/inputDateTime/inputDateTime.component.d.ts.map +1 -1
- package/src/selector/components/selector/selector.component.animations.d.ts +4 -4
- package/src/selector/components/selector/selector.component.d.ts +155 -152
- package/src/selector/components/selector/selector.component.d.ts.map +1 -1
- package/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.d.ts +170 -167
- package/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.d.ts.map +1 -1
- package/src/selector/directives/datetimeMaxValidator/datetimeMaxValidator.directive.d.ts +22 -19
- package/src/selector/directives/datetimeMaxValidator/datetimeMaxValidator.directive.d.ts.map +1 -1
- package/src/selector/directives/datetimeMinValidator/datetimeMinValidator.directive.d.ts +22 -19
- package/src/selector/directives/datetimeMinValidator/datetimeMinValidator.directive.d.ts.map +1 -1
- package/src/selector/directives/datetimeValidator/datetimeValidator.directive.d.ts +21 -18
- package/src/selector/directives/datetimeValidator/datetimeValidator.directive.d.ts.map +1 -1
- package/src/selector/directives/selectorControlValueAccessor/selectorControlValueAccessor.directive.d.ts +53 -50
- package/src/selector/directives/selectorControlValueAccessor/selectorControlValueAccessor.directive.d.ts.map +1 -1
- package/src/selector/interfaces.d.ts +1 -1
- package/src/selector/misc/datetimeSelector.interface.d.ts +82 -82
- package/src/selector/misc/tokens.d.ts +6 -6
- package/src/selector/modules/basicSelector.module.d.ts +10 -5
- package/src/selector/modules/basicSelector.module.d.ts.map +1 -1
- package/src/selector/modules/selector.module.d.ts +18 -5
- package/src/selector/modules/selector.module.d.ts.map +1 -1
- package/src/selector/types.d.ts +9 -9
- package/src/services/dateApi.interface.d.ts +275 -275
- package/src/services/datePositionParser.interface.d.ts +40 -40
- package/src/services/datePositionParser.service.d.ts +60 -57
- package/src/services/datePositionParser.service.d.ts.map +1 -1
- package/src/services/dateTimeRelativeParser.service.d.ts +21 -18
- package/src/services/dateTimeRelativeParser.service.d.ts.map +1 -1
- package/src/services/dateValueProvider.service.d.ts +18 -15
- package/src/services/dateValueProvider.service.d.ts.map +1 -1
- package/src/services/formatProvider.interface.d.ts +17 -17
- package/src/services/index.d.ts +3 -3
- package/tsconfig.karma.json +5 -6
- package/version.bak +1 -1
- package/appveyor.yml +0 -70
- package/date-fns/dist/es2015/date-fns/index.js +0 -10
- package/date-fns/dist/es2015/date-fns/public_api.js +0 -7
- package/date-fns/dist/es2015/date-fns/src/date-fns.js +0 -9
- package/date-fns/dist/es2015/date-fns/src/misc/tokens.js +0 -32
- package/date-fns/dist/es2015/date-fns/src/services/dateFnsDateApi.service.js +0 -512
- package/date-fns/dist/es2015/date-fns/src/services/dateFnsLocale.service.js +0 -18
- package/date-fns/dist/es5/date-fns/index.js +0 -10
- package/date-fns/dist/es5/date-fns/public_api.js +0 -7
- package/date-fns/dist/es5/date-fns/src/date-fns.js +0 -9
- package/date-fns/dist/es5/date-fns/src/misc/tokens.js +0 -32
- package/date-fns/dist/es5/date-fns/src/services/dateFnsDateApi.service.js +0 -902
- package/date-fns/dist/es5/date-fns/src/services/dateFnsLocale.service.js +0 -18
- package/date-fns/index.d.ts +0 -5
- package/date-fns/index.d.ts.map +0 -1
- package/date-fns/index.metadata.json +0 -1
- package/date-fns/public_api.d.ts +0 -2
- package/date-fns/public_api.d.ts.map +0 -1
- package/date-fns/src/date-fns.d.ts.map +0 -1
- package/date-fns/src/services/dateFnsDateApi.service.ngfactory.d.ts.map +0 -1
- package/datetime.d.ts +0 -7
- package/datetime.d.ts.map +0 -1
- package/datetime.metadata.json +0 -1
- package/dist/es2015/datetime.js +0 -10
- package/dist/es2015/public_api.js +0 -7
- package/dist/es2015/src/datetime.js +0 -24
- package/dist/es2015/src/misc/constants.js +0 -46
- package/dist/es2015/src/misc/datetime.interface.js +0 -52
- package/dist/es2015/src/misc/tokens.js +0 -29
- package/dist/es2015/src/misc/validators.js +0 -80
- package/dist/es2015/src/modules/datePipes.module.js +0 -26
- package/dist/es2015/src/picker/components/dayPicker/dayPicker.component.js +0 -215
- package/dist/es2015/src/picker/components/dayPicker/dayPicker.interfaces.js +0 -18
- package/dist/es2015/src/picker/components/monthPicker/monthPicker.component.js +0 -138
- package/dist/es2015/src/picker/components/monthPicker/monthPicker.interfaces.js +0 -11
- package/dist/es2015/src/picker/components/picker/picker.component.animations.js +0 -77
- package/dist/es2015/src/picker/components/picker/picker.component.js +0 -386
- package/dist/es2015/src/picker/components/pickerBase.component.js +0 -406
- package/dist/es2015/src/picker/components/yearPicker/yearPicker.component.js +0 -158
- package/dist/es2015/src/picker/components/yearPicker/yearPicker.interfaces.js +0 -11
- package/dist/es2015/src/picker/interfaces.js +0 -10
- package/dist/es2015/src/picker/misc/datetimePicker.interface.js +0 -245
- package/dist/es2015/src/picker/misc/tokens.js +0 -12
- package/dist/es2015/src/picker/modules/picker.module.js +0 -35
- package/dist/es2015/src/picker/types.js +0 -13
- package/dist/es2015/src/pipes/dateConvert.pipe.js +0 -50
- package/dist/es2015/src/pipes/dateFormat.pipe.js +0 -64
- package/dist/es2015/src/selector/components/inputDateTime/inputDateTime.component.js +0 -588
- package/dist/es2015/src/selector/components/selector/selector.component.animations.js +0 -21
- package/dist/es2015/src/selector/components/selector/selector.component.js +0 -514
- package/dist/es2015/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.js +0 -456
- package/dist/es2015/src/selector/directives/datetimeMaxValidator/datetimeMaxValidator.directive.js +0 -73
- package/dist/es2015/src/selector/directives/datetimeMinValidator/datetimeMinValidator.directive.js +0 -73
- package/dist/es2015/src/selector/directives/datetimeValidator/datetimeValidator.directive.js +0 -70
- package/dist/es2015/src/selector/directives/selectorControlValueAccessor/selectorControlValueAccessor.directive.js +0 -171
- package/dist/es2015/src/selector/interfaces.js +0 -7
- package/dist/es2015/src/selector/misc/datetimeSelector.interface.js +0 -106
- package/dist/es2015/src/selector/misc/tokens.js +0 -12
- package/dist/es2015/src/selector/modules/basicSelector.module.js +0 -20
- package/dist/es2015/src/selector/modules/selector.module.js +0 -45
- package/dist/es2015/src/selector/types.js +0 -15
- package/dist/es2015/src/services/dateApi.interface.js +0 -316
- package/dist/es2015/src/services/datePositionParser.interface.js +0 -56
- package/dist/es2015/src/services/datePositionParser.service.js +0 -297
- package/dist/es2015/src/services/dateTimeRelativeParser.service.js +0 -97
- package/dist/es2015/src/services/dateValueProvider.service.js +0 -79
- package/dist/es2015/src/services/formatProvider.interface.js +0 -28
- package/dist/es2015/src/services/index.js +0 -9
- package/dist/es5/datetime.js +0 -10
- package/dist/es5/public_api.js +0 -7
- package/dist/es5/src/datetime.js +0 -24
- package/dist/es5/src/misc/constants.js +0 -46
- package/dist/es5/src/misc/datetime.interface.js +0 -52
- package/dist/es5/src/misc/tokens.js +0 -29
- package/dist/es5/src/misc/validators.js +0 -124
- package/dist/es5/src/modules/datePipes.module.js +0 -30
- package/dist/es5/src/picker/components/dayPicker/dayPicker.component.js +0 -323
- package/dist/es5/src/picker/components/dayPicker/dayPicker.interfaces.js +0 -18
- package/dist/es5/src/picker/components/monthPicker/monthPicker.component.js +0 -233
- package/dist/es5/src/picker/components/monthPicker/monthPicker.interfaces.js +0 -11
- package/dist/es5/src/picker/components/picker/picker.component.animations.js +0 -77
- package/dist/es5/src/picker/components/picker/picker.component.js +0 -460
- package/dist/es5/src/picker/components/pickerBase.component.js +0 -561
- package/dist/es5/src/picker/components/yearPicker/yearPicker.component.js +0 -253
- package/dist/es5/src/picker/components/yearPicker/yearPicker.interfaces.js +0 -11
- package/dist/es5/src/picker/interfaces.js +0 -10
- package/dist/es5/src/picker/misc/datetimePicker.interface.js +0 -245
- package/dist/es5/src/picker/misc/tokens.js +0 -12
- package/dist/es5/src/picker/modules/picker.module.js +0 -39
- package/dist/es5/src/picker/types.js +0 -13
- package/dist/es5/src/pipes/dateConvert.pipe.js +0 -63
- package/dist/es5/src/pipes/dateFormat.pipe.js +0 -79
- package/dist/es5/src/selector/components/inputDateTime/inputDateTime.component.js +0 -808
- package/dist/es5/src/selector/components/selector/selector.component.animations.js +0 -21
- package/dist/es5/src/selector/components/selector/selector.component.js +0 -653
- package/dist/es5/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.js +0 -656
- package/dist/es5/src/selector/directives/datetimeMaxValidator/datetimeMaxValidator.directive.js +0 -84
- package/dist/es5/src/selector/directives/datetimeMinValidator/datetimeMinValidator.directive.js +0 -84
- package/dist/es5/src/selector/directives/datetimeValidator/datetimeValidator.directive.js +0 -82
- package/dist/es5/src/selector/directives/selectorControlValueAccessor/selectorControlValueAccessor.directive.js +0 -230
- package/dist/es5/src/selector/interfaces.js +0 -7
- package/dist/es5/src/selector/misc/datetimeSelector.interface.js +0 -106
- package/dist/es5/src/selector/misc/tokens.js +0 -12
- package/dist/es5/src/selector/modules/basicSelector.module.js +0 -24
- package/dist/es5/src/selector/modules/selector.module.js +0 -49
- package/dist/es5/src/selector/types.js +0 -15
- package/dist/es5/src/services/dateApi.interface.js +0 -316
- package/dist/es5/src/services/datePositionParser.interface.js +0 -56
- package/dist/es5/src/services/datePositionParser.service.js +0 -366
- package/dist/es5/src/services/dateTimeRelativeParser.service.js +0 -108
- package/dist/es5/src/services/dateValueProvider.service.js +0 -92
- package/dist/es5/src/services/formatProvider.interface.js +0 -28
- package/dist/es5/src/services/index.js +0 -9
- package/moment/dist/es2015/moment/index.js +0 -10
- package/moment/dist/es2015/moment/public_api.js +0 -7
- package/moment/dist/es2015/moment/src/misc/tokens.js +0 -26
- package/moment/dist/es2015/moment/src/moment.js +0 -8
- package/moment/dist/es2015/moment/src/services/momentDateApi.service.js +0 -466
- package/moment/dist/es5/moment/index.js +0 -10
- package/moment/dist/es5/moment/public_api.js +0 -7
- package/moment/dist/es5/moment/src/misc/tokens.js +0 -26
- package/moment/dist/es5/moment/src/moment.js +0 -8
- package/moment/dist/es5/moment/src/services/momentDateApi.service.js +0 -858
- package/moment/index.d.ts +0 -5
- package/moment/index.d.ts.map +0 -1
- package/moment/index.metadata.json +0 -1
- package/moment/public_api.d.ts +0 -2
- package/moment/public_api.d.ts.map +0 -1
- package/moment/src/moment.d.ts.map +0 -1
- package/moment/src/services/momentDateApi.service.ngfactory.d.ts.map +0 -1
- package/public_api.d.ts +0 -2
- package/public_api.d.ts.map +0 -1
- package/src/datetime.d.ts.map +0 -1
- package/src/modules/datePipes.module.ngfactory.d.ts.map +0 -1
- package/src/picker/components/dayPicker/dayPicker.component.css.shim.ngstyle.d.ts.map +0 -1
- package/src/picker/components/dayPicker/dayPicker.component.ngfactory.d.ts.map +0 -1
- package/src/picker/components/monthPicker/monthPicker.component.css.shim.ngstyle.d.ts.map +0 -1
- package/src/picker/components/monthPicker/monthPicker.component.ngfactory.d.ts.map +0 -1
- package/src/picker/components/picker/picker.component.ngfactory.d.ts.map +0 -1
- package/src/picker/components/yearPicker/yearPicker.component.css.shim.ngstyle.d.ts.map +0 -1
- package/src/picker/components/yearPicker/yearPicker.component.ngfactory.d.ts.map +0 -1
- package/src/picker/modules/picker.module.ngfactory.d.ts.map +0 -1
- package/src/pipes/dateConvert.pipe.ngfactory.d.ts.map +0 -1
- package/src/pipes/dateFormat.pipe.ngfactory.d.ts.map +0 -1
- package/src/selector/components/inputDateTime/inputDateTime.component.css.shim.ngstyle.d.ts.map +0 -1
- package/src/selector/components/inputDateTime/inputDateTime.component.ngfactory.d.ts.map +0 -1
- package/src/selector/components/selector/selector.component.css.shim.ngstyle.d.ts.map +0 -1
- package/src/selector/components/selector/selector.component.ngfactory.d.ts.map +0 -1
- package/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.css.shim.ngstyle.d.ts.map +0 -1
- package/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.ngfactory.d.ts.map +0 -1
- package/src/selector/directives/datetimeMaxValidator/datetimeMaxValidator.directive.ngfactory.d.ts.map +0 -1
- package/src/selector/directives/datetimeMinValidator/datetimeMinValidator.directive.ngfactory.d.ts.map +0 -1
- package/src/selector/directives/datetimeValidator/datetimeValidator.directive.ngfactory.d.ts.map +0 -1
- package/src/selector/directives/selectorControlValueAccessor/selectorControlValueAccessor.directive.ngfactory.d.ts.map +0 -1
- package/src/selector/modules/basicSelector.module.ngfactory.d.ts.map +0 -1
- package/src/selector/modules/selector.module.ngfactory.d.ts.map +0 -1
- package/src/services/datePositionParser.service.ngfactory.d.ts.map +0 -1
- package/src/services/dateTimeRelativeParser.service.ngfactory.d.ts.map +0 -1
- package/src/services/dateValueProvider.service.ngfactory.d.ts.map +0 -1
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef, ElementRef, ViewChild } from '@angular/core';
|
|
2
|
+
import { Subject } from 'rxjs';
|
|
3
|
+
import { DATE_API } from '../../../misc/tokens';
|
|
4
|
+
import { DateValueProvider } from '../../../services/dateValueProvider.service';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
import * as i1 from "../../../services/dateValueProvider.service";
|
|
7
|
+
/**
|
|
8
|
+
* Component used as datetime selector with simple input
|
|
9
|
+
*/
|
|
10
|
+
export class SimpleInputDateTimeSelectorComponent {
|
|
11
|
+
//######################### constructor #########################
|
|
12
|
+
constructor(_dateApi, _valueProvider, _changeDetector) {
|
|
13
|
+
this._dateApi = _dateApi;
|
|
14
|
+
this._valueProvider = _valueProvider;
|
|
15
|
+
this._changeDetector = _changeDetector;
|
|
16
|
+
//######################### protected fields #########################
|
|
17
|
+
/**
|
|
18
|
+
* Occurs when value changes
|
|
19
|
+
*/
|
|
20
|
+
this._valueChange = new Subject();
|
|
21
|
+
/**
|
|
22
|
+
* Occurs when selector is touched by user
|
|
23
|
+
*/
|
|
24
|
+
this._touched = new Subject();
|
|
25
|
+
/**
|
|
26
|
+
* Occurs when selector requires picker to be displayed or hidden
|
|
27
|
+
*/
|
|
28
|
+
this._pickerRequest = new Subject();
|
|
29
|
+
/**
|
|
30
|
+
* Currently used format for displaying data
|
|
31
|
+
*/
|
|
32
|
+
this._format = '';
|
|
33
|
+
/**
|
|
34
|
+
* Current value representation as date api wrapper
|
|
35
|
+
*/
|
|
36
|
+
this._dateApiValue = null;
|
|
37
|
+
/**
|
|
38
|
+
* Indication whether is current value valid value
|
|
39
|
+
*/
|
|
40
|
+
this._isValid = true;
|
|
41
|
+
/**
|
|
42
|
+
* Minimal possible value that can be picked
|
|
43
|
+
*/
|
|
44
|
+
this._minValue = null;
|
|
45
|
+
/**
|
|
46
|
+
* Maximal possible value that can be picked
|
|
47
|
+
*/
|
|
48
|
+
this._maxValue = null;
|
|
49
|
+
//######################### public properties - template bindings #########################
|
|
50
|
+
/**
|
|
51
|
+
* Indication whether is input disabled
|
|
52
|
+
* @internal
|
|
53
|
+
*/
|
|
54
|
+
this.disabled = false;
|
|
55
|
+
}
|
|
56
|
+
//######################### public properties - implementation of DateTimeSelector #########################
|
|
57
|
+
/**
|
|
58
|
+
* Gets or sets currently used format for displaying data
|
|
59
|
+
*/
|
|
60
|
+
get format() {
|
|
61
|
+
return this._format;
|
|
62
|
+
}
|
|
63
|
+
set format(value) {
|
|
64
|
+
this._format = value;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Gets current value of datetime
|
|
68
|
+
*/
|
|
69
|
+
get value() {
|
|
70
|
+
if (!this._dateApiValue || !this._isValid) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
return this._valueProvider.getValue(this._dateApiValue.value, this._format);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Gets formatted value
|
|
77
|
+
*/
|
|
78
|
+
get formattedValue() {
|
|
79
|
+
if (!this._isValid) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return this.currentValue;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Gets indication whether is current value valid
|
|
86
|
+
*/
|
|
87
|
+
get valid() {
|
|
88
|
+
return this._isValid;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Occurs when value changes
|
|
92
|
+
*/
|
|
93
|
+
get valueChange() {
|
|
94
|
+
return this._valueChange.asObservable();
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Occurs when selector is touched by user
|
|
98
|
+
*/
|
|
99
|
+
get touched() {
|
|
100
|
+
return this._touched.asObservable();
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Occurs when selector requires picker to be displayed
|
|
104
|
+
*/
|
|
105
|
+
get pickerRequest() {
|
|
106
|
+
return this._pickerRequest.asObservable();
|
|
107
|
+
}
|
|
108
|
+
//######################### protected properties #########################
|
|
109
|
+
/**
|
|
110
|
+
* Gets or sets string representation current of value
|
|
111
|
+
*/
|
|
112
|
+
get currentValue() {
|
|
113
|
+
return this.input.value || null;
|
|
114
|
+
}
|
|
115
|
+
set currentValue(value) {
|
|
116
|
+
if (this.input) {
|
|
117
|
+
this.input.value = value !== null && value !== void 0 ? value : '';
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Gets input element used for handling date time value
|
|
122
|
+
*/
|
|
123
|
+
get input() {
|
|
124
|
+
return this.inputElement.nativeElement;
|
|
125
|
+
}
|
|
126
|
+
//######################### public methods - implementation of DateTimeSelector #########################
|
|
127
|
+
/**
|
|
128
|
+
* Sets minimal possible value for picker, that can be picked
|
|
129
|
+
* @param value - Minimal possible value that can be picked
|
|
130
|
+
*/
|
|
131
|
+
setMinValue(value) {
|
|
132
|
+
this._minValue = value;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Sets maximal possible value for picker, that can be picked
|
|
136
|
+
* @param value - Maximal possible value that can be picked
|
|
137
|
+
*/
|
|
138
|
+
setMaxValue(value) {
|
|
139
|
+
this._maxValue = value;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Sets value of datetime selector
|
|
143
|
+
* @param value - Value to be set to this selector
|
|
144
|
+
*/
|
|
145
|
+
setValue(value) {
|
|
146
|
+
if (value === null || value === void 0 ? void 0 : value.from) {
|
|
147
|
+
this._dateApiValue = this._dateApi.getValue(value === null || value === void 0 ? void 0 : value.from, this._format);
|
|
148
|
+
this._isValid = this._dateApiValue.isValid();
|
|
149
|
+
this._show();
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
this._clearValue();
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Sets as 'control' disabled
|
|
157
|
+
* @param disabled - Indication whether sets value as disabled, if omitted it is same as disabled set to true
|
|
158
|
+
*/
|
|
159
|
+
setDisabled(disabled = true) {
|
|
160
|
+
this.disabled = disabled;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Explicitly runs invalidation of content (change detection)
|
|
164
|
+
*/
|
|
165
|
+
invalidateVisuals() {
|
|
166
|
+
this._changeDetector.detectChanges();
|
|
167
|
+
}
|
|
168
|
+
//######################### public methods - template bindings #########################
|
|
169
|
+
/**
|
|
170
|
+
* Handles gaining of focus
|
|
171
|
+
* @internal
|
|
172
|
+
*/
|
|
173
|
+
handleFocus() {
|
|
174
|
+
this._pickerRequest.next(true);
|
|
175
|
+
//no value
|
|
176
|
+
if (!this._dateApiValue) {
|
|
177
|
+
this._dateApiValue = this._dateApi.now();
|
|
178
|
+
this._isValid = this._dateApiValue.isValid();
|
|
179
|
+
if (this._minMaxConstraintTest()) {
|
|
180
|
+
this._clearValue();
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
this._valueChange.next();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (!this._isValid) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
this._show();
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Handles blur on input
|
|
193
|
+
* @internal
|
|
194
|
+
*/
|
|
195
|
+
handleBlur() {
|
|
196
|
+
this._pickerRequest.next(false);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Handles user input
|
|
200
|
+
* @internal
|
|
201
|
+
*/
|
|
202
|
+
handleInput() {
|
|
203
|
+
//empty value
|
|
204
|
+
if (!this.currentValue) {
|
|
205
|
+
this._clearValue();
|
|
206
|
+
this._valueChange.next();
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
this._dateApiValue = this._dateApi.getValue(this.currentValue, this._format);
|
|
210
|
+
this._isValid = this._dateApiValue.isValid();
|
|
211
|
+
this._valueChange.next();
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Handles click event inside of input
|
|
215
|
+
* @internal
|
|
216
|
+
*/
|
|
217
|
+
handleClick() {
|
|
218
|
+
this._pickerRequest.next(true);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Handles keyboard events
|
|
222
|
+
* @param event - Keyboard event that occured
|
|
223
|
+
* @param input - Html input element that holds current value and selection
|
|
224
|
+
* @internal
|
|
225
|
+
*/
|
|
226
|
+
handleKeyboard(event) {
|
|
227
|
+
var _a;
|
|
228
|
+
if (!((_a = this._dateApiValue) === null || _a === void 0 ? void 0 : _a.isValid())) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
switch (event.key) {
|
|
232
|
+
case 'ArrowRight':
|
|
233
|
+
case 'ArrowLeft':
|
|
234
|
+
{
|
|
235
|
+
event.preventDefault();
|
|
236
|
+
event.stopPropagation();
|
|
237
|
+
this._withMinMaxConstraint(() => event.key == 'ArrowLeft' ? this._dateApiValue.subtractDays(1) : this._dateApiValue.addDays(1));
|
|
238
|
+
this._show();
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
case 'ArrowUp':
|
|
242
|
+
case 'ArrowDown':
|
|
243
|
+
{
|
|
244
|
+
event.preventDefault();
|
|
245
|
+
event.stopPropagation();
|
|
246
|
+
this._withMinMaxConstraint(() => event.key == 'ArrowUp' ? this._dateApiValue.subtractWeeks(1) : this._dateApiValue.addWeeks(1));
|
|
247
|
+
this._show();
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
case 'Escape':
|
|
251
|
+
{
|
|
252
|
+
this._pickerRequest.next(false);
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
case ' ':
|
|
256
|
+
{
|
|
257
|
+
if (event.ctrlKey) {
|
|
258
|
+
this._pickerRequest.next(true);
|
|
259
|
+
}
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
//######################### protected methods #########################
|
|
265
|
+
/**
|
|
266
|
+
* Clears current value
|
|
267
|
+
*/
|
|
268
|
+
_clearValue() {
|
|
269
|
+
this._dateApiValue = null;
|
|
270
|
+
this._isValid = true;
|
|
271
|
+
this.currentValue = null;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Tests whether are min or max constraint broken, returns true if constraint is broken
|
|
275
|
+
*/
|
|
276
|
+
_minMaxConstraintTest() {
|
|
277
|
+
return (!!this._minValue && this._dateApiValue.isBefore(this._minValue)) ||
|
|
278
|
+
(!!this._maxValue && this._dateApiValue.isAfter(this._maxValue));
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Runs code with check whether min max constrains was broken
|
|
282
|
+
* @param code - Code that should be executed which can change current value
|
|
283
|
+
*/
|
|
284
|
+
_withMinMaxConstraint(code) {
|
|
285
|
+
var _a;
|
|
286
|
+
this._dateApiValue.updateOriginal();
|
|
287
|
+
code();
|
|
288
|
+
//min value constraint failure
|
|
289
|
+
if (this._minMaxConstraintTest()) {
|
|
290
|
+
(_a = this._dateApiValue) === null || _a === void 0 ? void 0 : _a.resetOriginal();
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
this._valueChange.next();
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Shows current value in input
|
|
297
|
+
*/
|
|
298
|
+
_show() {
|
|
299
|
+
var _a, _b;
|
|
300
|
+
if (this._isValid) {
|
|
301
|
+
this.currentValue = (_b = (_a = this._dateApiValue) === null || _a === void 0 ? void 0 : _a.format(this._format)) !== null && _b !== void 0 ? _b : null;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
SimpleInputDateTimeSelectorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: SimpleInputDateTimeSelectorComponent, deps: [{ token: DATE_API }, { token: i1.DateValueProvider }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
306
|
+
SimpleInputDateTimeSelectorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.3", type: SimpleInputDateTimeSelectorComponent, selector: "simple-input-date-time-selector", viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["input"], descendants: true, static: true }], ngImport: i0, template: "<input type=\"text\"\r\n #input\r\n (focus)=\"handleFocus()\"\r\n (blur)=\"handleBlur()\"\r\n (input)=\"handleInput()\"\r\n (click)=\"handleClick()\"\r\n (keydown)=\"handleKeyboard($any($event))\"\r\n [disabled]=\"disabled\"\r\n [placeholder]=\"placeholder\">", styles: [":host\r\n{\r\n display: block;\r\n}\r\n\r\ninput\r\n{\r\n width: 100%;\r\n}"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: SimpleInputDateTimeSelectorComponent, decorators: [{
|
|
308
|
+
type: Component,
|
|
309
|
+
args: [{ selector: 'simple-input-date-time-selector', changeDetection: ChangeDetectionStrategy.OnPush, template: "<input type=\"text\"\r\n #input\r\n (focus)=\"handleFocus()\"\r\n (blur)=\"handleBlur()\"\r\n (input)=\"handleInput()\"\r\n (click)=\"handleClick()\"\r\n (keydown)=\"handleKeyboard($any($event))\"\r\n [disabled]=\"disabled\"\r\n [placeholder]=\"placeholder\">", styles: [":host\r\n{\r\n display: block;\r\n}\r\n\r\ninput\r\n{\r\n width: 100%;\r\n}"] }]
|
|
310
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
311
|
+
type: Inject,
|
|
312
|
+
args: [DATE_API]
|
|
313
|
+
}] }, { type: i1.DateValueProvider }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { inputElement: [{
|
|
314
|
+
type: ViewChild,
|
|
315
|
+
args: ['input', { static: true }]
|
|
316
|
+
}] } });
|
|
317
|
+
//# sourceMappingURL=simpleInputDateTime.component.js.map
|
package/es2015/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simpleInputDateTime.component.js","sourceRoot":"","sources":["../../../../../src/selector/components/simpleInputDateTime/simpleInputDateTime.component.ts","../../../../../src/selector/components/simpleInputDateTime/simpleInputDateTime.component.html"],"names":[],"mappings":"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","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject, ChangeDetectorRef, ElementRef, ViewChild} from '@angular/core';\nimport {Observable, Subject} from 'rxjs';\n\nimport {DateTimeValue} from '../../../misc/datetime.interface';\nimport {DATE_API} from '../../../misc/tokens';\nimport {DateApi, DateApiObject} from '../../../services';\nimport {DateValueProvider} from '../../../services/dateValueProvider.service';\nimport {DateTimeSelector} from '../../misc/datetimeSelector.interface';\n\n/**\n * Component used as datetime selector with simple input\n */\n@Component(\n{\n selector: 'simple-input-date-time-selector',\n templateUrl: 'simpleInputDateTime.component.html',\n styleUrls: ['simpleInputDateTime.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class SimpleInputDateTimeSelectorComponent<TDate = any> implements DateTimeSelector<TDate>\n{\n //######################### protected fields #########################\n\n /**\n * Occurs when value changes\n */\n protected _valueChange: Subject<void> = new Subject<void>();\n\n /**\n * Occurs when selector is touched by user\n */\n protected _touched: Subject<void> = new Subject<void>();\n\n /**\n * Occurs when selector requires picker to be displayed or hidden\n */\n protected _pickerRequest: Subject<boolean> = new Subject<boolean>();\n\n /**\n * Currently used format for displaying data\n */\n protected _format: string = '';\n\n /**\n * Current value representation as date api wrapper\n */\n protected _dateApiValue: null|DateApiObject<TDate> = null;\n\n /**\n * Indication whether is current value valid value\n */\n protected _isValid: boolean = true;\n\n /**\n * Minimal possible value that can be picked\n */\n protected _minValue: TDate|null = null;\n\n /**\n * Maximal possible value that can be picked\n */\n protected _maxValue: TDate|null = null;\n\n //######################### public properties - implementation of DateTimeSelector #########################\n\n /**\n * Gets or sets currently used format for displaying data\n */\n public get format(): string\n {\n return this._format;\n }\n public set format(value: string)\n {\n this._format = value;\n }\n\n /**\n * Gets or sets placeholder that is displayed when there is no value selected\n */\n public placeholder: string|undefined;\n\n /**\n * Gets current value of datetime\n */\n public get value(): DateTimeValue<TDate>|null\n {\n if(!this._dateApiValue || !this._isValid)\n {\n return null;\n }\n\n return this._valueProvider.getValue(this._dateApiValue.value, this._format);\n }\n\n /**\n * Gets formatted value\n */\n public get formattedValue(): string|null\n {\n if(!this._isValid)\n {\n return null;\n }\n\n return this.currentValue;\n }\n\n /**\n * Gets indication whether is current value valid\n */\n public get valid(): boolean\n {\n return this._isValid;\n }\n\n /**\n * Occurs when value changes\n */\n public get valueChange(): Observable<void>\n {\n return this._valueChange.asObservable();\n }\n\n /**\n * Occurs when selector is touched by user\n */\n public get touched(): Observable<void>\n {\n return this._touched.asObservable();\n }\n\n /**\n * Occurs when selector requires picker to be displayed\n */\n public get pickerRequest(): Observable<boolean>\n {\n return this._pickerRequest.asObservable();\n }\n\n //######################### public properties - template bindings #########################\n\n /**\n * Indication whether is input disabled\n * @internal\n */\n public disabled: boolean = false;\n\n //######################### public properties - children #########################\n\n /**\n * Instance of html input element\n * @internal\n */\n @ViewChild('input', {static: true})\n public inputElement?: ElementRef<HTMLInputElement>;\n\n //######################### protected properties #########################\n\n /**\n * Gets or sets string representation current of value\n */\n protected get currentValue(): string|null\n {\n return this.input.value || null;\n }\n protected set currentValue(value: string|null)\n {\n if(this.input)\n {\n this.input.value = value ?? '';\n }\n }\n\n /**\n * Gets input element used for handling date time value\n */\n protected get input(): HTMLInputElement\n {\n return this.inputElement!.nativeElement;\n }\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected _dateApi: DateApi<TDate>,\n protected _valueProvider: DateValueProvider<TDate>,\n protected _changeDetector: ChangeDetectorRef)\n {\n }\n\n //######################### public methods - implementation of DateTimeSelector #########################\n\n /**\n * Sets minimal possible value for picker, that can be picked\n * @param value - Minimal possible value that can be picked\n */\n public setMinValue(value: TDate|null): void\n {\n this._minValue = value;\n }\n\n /**\n * Sets maximal possible value for picker, that can be picked\n * @param value - Maximal possible value that can be picked\n */\n public setMaxValue(value: TDate|null): void\n {\n this._maxValue = value;\n }\n\n /**\n * Sets value of datetime selector\n * @param value - Value to be set to this selector\n */\n public setValue(value: DateTimeValue<TDate>|null): void\n {\n if(value?.from)\n {\n this._dateApiValue = this._dateApi.getValue(value?.from, this._format);\n this._isValid = this._dateApiValue.isValid();\n\n this._show();\n }\n else\n {\n this._clearValue();\n }\n }\n\n /**\n * Sets as 'control' disabled\n * @param disabled - Indication whether sets value as disabled, if omitted it is same as disabled set to true\n */\n public setDisabled(disabled: boolean = true): void\n {\n this.disabled = disabled;\n }\n\n /**\n * Explicitly runs invalidation of content (change detection)\n */\n public invalidateVisuals(): void\n {\n this._changeDetector.detectChanges();\n }\n\n //######################### public methods - template bindings #########################\n\n /**\n * Handles gaining of focus\n * @internal\n */\n public handleFocus()\n {\n this._pickerRequest.next(true);\n\n //no value\n if(!this._dateApiValue)\n {\n this._dateApiValue = this._dateApi.now();\n this._isValid = this._dateApiValue.isValid();\n\n if(this._minMaxConstraintTest())\n {\n this._clearValue();\n }\n else\n {\n this._valueChange.next();\n }\n }\n\n if(!this._isValid)\n {\n return;\n }\n\n this._show();\n }\n\n /**\n * Handles blur on input\n * @internal\n */\n public handleBlur()\n {\n this._pickerRequest.next(false);\n }\n\n /**\n * Handles user input\n * @internal\n */\n public handleInput()\n {\n //empty value\n if(!this.currentValue)\n {\n this._clearValue();\n this._valueChange.next();\n\n return;\n }\n\n this._dateApiValue = this._dateApi.getValue(this.currentValue, this._format);\n this._isValid = this._dateApiValue.isValid();\n this._valueChange.next();\n }\n\n /**\n * Handles click event inside of input\n * @internal\n */\n public handleClick()\n {\n this._pickerRequest.next(true);\n }\n\n /**\n * Handles keyboard events\n * @param event - Keyboard event that occured\n * @param input - Html input element that holds current value and selection\n * @internal\n */\n public handleKeyboard(event: KeyboardEvent)\n {\n if(!this._dateApiValue?.isValid())\n {\n return;\n }\n\n switch(event.key)\n {\n case 'ArrowRight':\n case 'ArrowLeft':\n {\n event.preventDefault();\n event.stopPropagation();\n\n this._withMinMaxConstraint(() => event.key == 'ArrowLeft' ? this._dateApiValue!.subtractDays(1) : this._dateApiValue!.addDays(1));\n this._show();\n\n break;\n }\n case 'ArrowUp':\n case 'ArrowDown':\n {\n event.preventDefault();\n event.stopPropagation();\n\n this._withMinMaxConstraint(() => event.key == 'ArrowUp' ? this._dateApiValue!.subtractWeeks(1) : this._dateApiValue!.addWeeks(1));\n this._show();\n\n break;\n }\n case 'Escape':\n {\n this._pickerRequest.next(false);\n\n break;\n }\n case ' ':\n {\n if(event.ctrlKey)\n {\n this._pickerRequest.next(true);\n }\n\n break;\n }\n }\n }\n\n //######################### protected methods #########################\n\n /**\n * Clears current value\n */\n protected _clearValue()\n {\n this._dateApiValue = null;\n this._isValid = true;\n this.currentValue = null;\n }\n\n /**\n * Tests whether are min or max constraint broken, returns true if constraint is broken\n */\n protected _minMaxConstraintTest(): boolean\n {\n return (!!this._minValue && this._dateApiValue!.isBefore(this._minValue)) ||\n (!!this._maxValue && this._dateApiValue!.isAfter(this._maxValue));\n }\n\n /**\n * Runs code with check whether min max constrains was broken\n * @param code - Code that should be executed which can change current value\n */\n protected _withMinMaxConstraint(code: () => void)\n {\n this._dateApiValue!.updateOriginal();\n\n code();\n\n //min value constraint failure\n if(this._minMaxConstraintTest())\n {\n this._dateApiValue?.resetOriginal();\n\n return;\n }\n\n this._valueChange.next();\n }\n\n /**\n * Shows current value in input\n */\n protected _show()\n {\n if(this._isValid)\n {\n this.currentValue = this._dateApiValue?.format(this._format) ?? null;\n }\n }\n}","<input type=\"text\"\r\n #input\r\n (focus)=\"handleFocus()\"\r\n (blur)=\"handleBlur()\"\r\n (input)=\"handleInput()\"\r\n (click)=\"handleClick()\"\r\n (keydown)=\"handleKeyboard($any($event))\"\r\n [disabled]=\"disabled\"\r\n [placeholder]=\"placeholder\">"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { forwardRef, Directive, Inject } from '@angular/core';
|
|
2
|
+
import { NG_VALIDATORS } from '@angular/forms';
|
|
3
|
+
import { Validators } from '../../../misc/validators';
|
|
4
|
+
import { DateTimeSelectorComponent } from '../../components/selector/selector.component';
|
|
5
|
+
import { DATE_API } from '../../../misc/tokens';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
import * as i1 from "../../components/selector/selector.component";
|
|
8
|
+
/**
|
|
9
|
+
* Validator that is injected with directive DatetimeMaxValidatorDirective
|
|
10
|
+
*/
|
|
11
|
+
const DATETIME_MIN_VALIDATOR = {
|
|
12
|
+
provide: NG_VALIDATORS,
|
|
13
|
+
useExisting: forwardRef(() => DatetimeMaxValidatorDirective),
|
|
14
|
+
multi: true
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Directive injecting datetime max validator, validating max datetime value
|
|
18
|
+
*/
|
|
19
|
+
export class DatetimeMaxValidatorDirective {
|
|
20
|
+
//######################### constructor #########################
|
|
21
|
+
constructor(datetimeSelector, dateApi) {
|
|
22
|
+
//######################### private fields #########################
|
|
23
|
+
/**
|
|
24
|
+
* Function used for validations
|
|
25
|
+
*/
|
|
26
|
+
this._validator = () => null;
|
|
27
|
+
this._validator = Validators.maxDatetime(datetimeSelector, dateApi);
|
|
28
|
+
}
|
|
29
|
+
//######################### public methods - implementation of Validator #########################
|
|
30
|
+
/**
|
|
31
|
+
* Validates input and returns validation result
|
|
32
|
+
* @param control - Control that is being validated
|
|
33
|
+
* @returns validation results
|
|
34
|
+
*/
|
|
35
|
+
validate(control) {
|
|
36
|
+
return this._validator(control);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
DatetimeMaxValidatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: DatetimeMaxValidatorDirective, deps: [{ token: i1.DateTimeSelectorComponent }, { token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive });
|
|
40
|
+
DatetimeMaxValidatorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: DatetimeMaxValidatorDirective, selector: "date-time-selector[validate][maxValue][formControlName]:not([range]),date-time-selector[validate][maxValue][formControl]:not([range]),date-time-selector[validate][maxValue][ngModel]:not([range])", providers: [DATETIME_MIN_VALIDATOR], ngImport: i0 });
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: DatetimeMaxValidatorDirective, decorators: [{
|
|
42
|
+
type: Directive,
|
|
43
|
+
args: [{
|
|
44
|
+
selector: 'date-time-selector[validate][maxValue][formControlName]:not([range]),date-time-selector[validate][maxValue][formControl]:not([range]),date-time-selector[validate][maxValue][ngModel]:not([range])',
|
|
45
|
+
providers: [DATETIME_MIN_VALIDATOR]
|
|
46
|
+
}]
|
|
47
|
+
}], ctorParameters: function () { return [{ type: i1.DateTimeSelectorComponent }, { type: undefined, decorators: [{
|
|
48
|
+
type: Inject,
|
|
49
|
+
args: [DATE_API]
|
|
50
|
+
}] }]; } });
|
|
51
|
+
//# sourceMappingURL=datetimeMaxValidator.directive.js.map
|
package/es2015/src/selector/directives/datetimeMaxValidator/datetimeMaxValidator.directive.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datetimeMaxValidator.directive.js","sourceRoot":"","sources":["../../../../../src/selector/directives/datetimeMaxValidator/datetimeMaxValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAC,aAAa,EAA4D,MAAM,gBAAgB,CAAC;AAExG,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,yBAAyB,EAAC,MAAM,8CAA8C,CAAC;AAEvF,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;;;AAE9C;;GAEG;AACH,MAAM,sBAAsB,GAC5B;IACI,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,6BAA6B,CAAC;IAC5D,KAAK,EAAE,IAAI;CACd,CAAC;AAEF;;GAEG;AAMH,MAAM,OAAO,6BAA6B;IAStC,iEAAiE;IACjE,YAAY,gBAAkD,EAChC,OAAuB;QATrD,oEAAoE;QAEpE;;WAEG;QACK,eAAU,GAAgB,GAAG,EAAE,CAAC,IAAI,CAAC;QAMzC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,WAAW,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACxE,CAAC;IAED,kGAAkG;IAElG;;;;OAIG;IACI,QAAQ,CAAC,OAAwB;QAEpC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;;0HA1BQ,6BAA6B,2DAWlB,QAAQ;8GAXnB,6BAA6B,6NAF3B,CAAC,sBAAsB,CAAC;2FAE1B,6BAA6B;kBALzC,SAAS;mBACV;oBACI,QAAQ,EAAE,oMAAoM;oBAC9M,SAAS,EAAE,CAAC,sBAAsB,CAAC;iBACtC;;0BAYgB,MAAM;2BAAC,QAAQ","sourcesContent":["import {ExistingProvider, forwardRef, Directive, Inject} from '@angular/core';\nimport {NG_VALIDATORS, AbstractControl, Validator, ValidatorFn, ValidationErrors} from '@angular/forms';\n\nimport {Validators} from '../../../misc/validators';\nimport {DateTimeSelectorComponent} from '../../components/selector/selector.component';\nimport {DateApi} from '../../../services/dateApi.interface';\nimport {DATE_API} from '../../../misc/tokens';\n\n/**\n * Validator that is injected with directive DatetimeMaxValidatorDirective\n */\nconst DATETIME_MIN_VALIDATOR = <ExistingProvider>\n{\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => DatetimeMaxValidatorDirective),\n multi: true\n};\n\n/**\n * Directive injecting datetime max validator, validating max datetime value \n */\n@Directive(\n{\n selector: 'date-time-selector[validate][maxValue][formControlName]:not([range]),date-time-selector[validate][maxValue][formControl]:not([range]),date-time-selector[validate][maxValue][ngModel]:not([range])',\n providers: [DATETIME_MIN_VALIDATOR]\n})\nexport class DatetimeMaxValidatorDirective<TDate = any> implements Validator\n{\n //######################### private fields #########################\n\n /**\n * Function used for validations\n */\n private _validator: ValidatorFn = () => null;\n\n //######################### constructor #########################\n constructor(datetimeSelector: DateTimeSelectorComponent<TDate>,\n @Inject(DATE_API) dateApi: DateApi<TDate>)\n {\n this._validator = Validators.maxDatetime(datetimeSelector, dateApi);\n }\n\n //######################### public methods - implementation of Validator #########################\n\n /**\n * Validates input and returns validation result\n * @param control - Control that is being validated\n * @returns validation results\n */\n public validate(control: AbstractControl): ValidationErrors|null\n {\n return this._validator(control);\n }\n}"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { forwardRef, Directive, Inject } from '@angular/core';
|
|
2
|
+
import { NG_VALIDATORS } from '@angular/forms';
|
|
3
|
+
import { Validators } from '../../../misc/validators';
|
|
4
|
+
import { DateTimeSelectorComponent } from '../../components/selector/selector.component';
|
|
5
|
+
import { DATE_API } from '../../../misc/tokens';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
import * as i1 from "../../components/selector/selector.component";
|
|
8
|
+
/**
|
|
9
|
+
* Validator that is injected with directive DatetimeMinValidatorDirective
|
|
10
|
+
*/
|
|
11
|
+
const DATETIME_MIN_VALIDATOR = {
|
|
12
|
+
provide: NG_VALIDATORS,
|
|
13
|
+
useExisting: forwardRef(() => DatetimeMinValidatorDirective),
|
|
14
|
+
multi: true
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Directive injecting datetime min validator, validating min datetime value
|
|
18
|
+
*/
|
|
19
|
+
export class DatetimeMinValidatorDirective {
|
|
20
|
+
//######################### constructor #########################
|
|
21
|
+
constructor(datetimeSelector, dateApi) {
|
|
22
|
+
//######################### private fields #########################
|
|
23
|
+
/**
|
|
24
|
+
* Function used for validations
|
|
25
|
+
*/
|
|
26
|
+
this._validator = () => null;
|
|
27
|
+
this._validator = Validators.minDatetime(datetimeSelector, dateApi);
|
|
28
|
+
}
|
|
29
|
+
//######################### public methods - implementation of Validator #########################
|
|
30
|
+
/**
|
|
31
|
+
* Validates input and returns validation result
|
|
32
|
+
* @param control - Control that is being validated
|
|
33
|
+
* @returns validation results
|
|
34
|
+
*/
|
|
35
|
+
validate(control) {
|
|
36
|
+
return this._validator(control);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
DatetimeMinValidatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: DatetimeMinValidatorDirective, deps: [{ token: i1.DateTimeSelectorComponent }, { token: DATE_API }], target: i0.ɵɵFactoryTarget.Directive });
|
|
40
|
+
DatetimeMinValidatorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: DatetimeMinValidatorDirective, selector: "date-time-selector[validate][minValue][formControlName]:not([range]),date-time-selector[validate][minValue][formControl]:not([range]),date-time-selector[validate][minValue][ngModel]:not([range])", providers: [DATETIME_MIN_VALIDATOR], ngImport: i0 });
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: DatetimeMinValidatorDirective, decorators: [{
|
|
42
|
+
type: Directive,
|
|
43
|
+
args: [{
|
|
44
|
+
selector: 'date-time-selector[validate][minValue][formControlName]:not([range]),date-time-selector[validate][minValue][formControl]:not([range]),date-time-selector[validate][minValue][ngModel]:not([range])',
|
|
45
|
+
providers: [DATETIME_MIN_VALIDATOR]
|
|
46
|
+
}]
|
|
47
|
+
}], ctorParameters: function () { return [{ type: i1.DateTimeSelectorComponent }, { type: undefined, decorators: [{
|
|
48
|
+
type: Inject,
|
|
49
|
+
args: [DATE_API]
|
|
50
|
+
}] }]; } });
|
|
51
|
+
//# sourceMappingURL=datetimeMinValidator.directive.js.map
|
package/es2015/src/selector/directives/datetimeMinValidator/datetimeMinValidator.directive.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datetimeMinValidator.directive.js","sourceRoot":"","sources":["../../../../../src/selector/directives/datetimeMinValidator/datetimeMinValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAC,aAAa,EAA4D,MAAM,gBAAgB,CAAC;AAExG,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,yBAAyB,EAAC,MAAM,8CAA8C,CAAC;AAEvF,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;;;AAE9C;;GAEG;AACH,MAAM,sBAAsB,GAC5B;IACI,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,6BAA6B,CAAC;IAC5D,KAAK,EAAE,IAAI;CACd,CAAC;AAEF;;GAEG;AAMH,MAAM,OAAO,6BAA6B;IAStC,iEAAiE;IACjE,YAAY,gBAAkD,EAChC,OAAuB;QATrD,oEAAoE;QAEpE;;WAEG;QACK,eAAU,GAAgB,GAAG,EAAE,CAAC,IAAI,CAAC;QAMzC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,WAAW,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACxE,CAAC;IAED,kGAAkG;IAElG;;;;OAIG;IACI,QAAQ,CAAC,OAAwB;QAEpC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;;0HA1BQ,6BAA6B,2DAWlB,QAAQ;8GAXnB,6BAA6B,6NAF3B,CAAC,sBAAsB,CAAC;2FAE1B,6BAA6B;kBALzC,SAAS;mBACV;oBACI,QAAQ,EAAE,oMAAoM;oBAC9M,SAAS,EAAE,CAAC,sBAAsB,CAAC;iBACtC;;0BAYgB,MAAM;2BAAC,QAAQ","sourcesContent":["import {ExistingProvider, forwardRef, Directive, Inject} from '@angular/core';\nimport {NG_VALIDATORS, AbstractControl, Validator, ValidatorFn, ValidationErrors} from '@angular/forms';\n\nimport {Validators} from '../../../misc/validators';\nimport {DateTimeSelectorComponent} from '../../components/selector/selector.component';\nimport {DateApi} from '../../../services/dateApi.interface';\nimport {DATE_API} from '../../../misc/tokens';\n\n/**\n * Validator that is injected with directive DatetimeMinValidatorDirective\n */\nconst DATETIME_MIN_VALIDATOR = <ExistingProvider>\n{\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => DatetimeMinValidatorDirective),\n multi: true\n};\n\n/**\n * Directive injecting datetime min validator, validating min datetime value \n */\n@Directive(\n{\n selector: 'date-time-selector[validate][minValue][formControlName]:not([range]),date-time-selector[validate][minValue][formControl]:not([range]),date-time-selector[validate][minValue][ngModel]:not([range])',\n providers: [DATETIME_MIN_VALIDATOR]\n})\nexport class DatetimeMinValidatorDirective<TDate = any> implements Validator\n{\n //######################### private fields #########################\n\n /**\n * Function used for validations\n */\n private _validator: ValidatorFn = () => null;\n\n //######################### constructor #########################\n constructor(datetimeSelector: DateTimeSelectorComponent<TDate>,\n @Inject(DATE_API) dateApi: DateApi<TDate>)\n {\n this._validator = Validators.minDatetime(datetimeSelector, dateApi);\n }\n\n //######################### public methods - implementation of Validator #########################\n\n /**\n * Validates input and returns validation result\n * @param control - Control that is being validated\n * @returns validation results\n */\n public validate(control: AbstractControl): ValidationErrors|null\n {\n return this._validator(control);\n }\n}"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { forwardRef, Directive } from '@angular/core';
|
|
2
|
+
import { NG_VALIDATORS } from '@angular/forms';
|
|
3
|
+
import { Validators } from '../../../misc/validators';
|
|
4
|
+
import { DateTimeSelectorComponent } from '../../components/selector/selector.component';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
import * as i1 from "../../components/selector/selector.component";
|
|
7
|
+
/**
|
|
8
|
+
* Validator that is injected with directive DatetimeValidatorDirective
|
|
9
|
+
*/
|
|
10
|
+
const DATETIME_VALIDATOR = {
|
|
11
|
+
provide: NG_VALIDATORS,
|
|
12
|
+
useExisting: forwardRef(() => DatetimeValidatorDirective),
|
|
13
|
+
multi: true
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Directive injecting datetime validator, validating datetime
|
|
17
|
+
*/
|
|
18
|
+
export class DatetimeValidatorDirective {
|
|
19
|
+
//######################### constructor #########################
|
|
20
|
+
constructor(datetimeSelector) {
|
|
21
|
+
//######################### private fields #########################
|
|
22
|
+
/**
|
|
23
|
+
* Function used for validations
|
|
24
|
+
*/
|
|
25
|
+
this._validator = () => null;
|
|
26
|
+
this._validator = Validators.datetime(datetimeSelector);
|
|
27
|
+
}
|
|
28
|
+
//######################### public methods - implementation of Validator #########################
|
|
29
|
+
/**
|
|
30
|
+
* Validates input and returns validation result
|
|
31
|
+
* @param control - Control that is being validated
|
|
32
|
+
* @returns validation results
|
|
33
|
+
*/
|
|
34
|
+
validate(control) {
|
|
35
|
+
return this._validator(control);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
DatetimeValidatorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: DatetimeValidatorDirective, deps: [{ token: i1.DateTimeSelectorComponent }], target: i0.ɵɵFactoryTarget.Directive });
|
|
39
|
+
DatetimeValidatorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: DatetimeValidatorDirective, selector: "date-time-selector[validate][formControlName]:not([range]),date-time-selector[validate][formControl]:not([range]),date-time-selector[validate][ngModel]:not([range])", providers: [DATETIME_VALIDATOR], ngImport: i0 });
|
|
40
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: DatetimeValidatorDirective, decorators: [{
|
|
41
|
+
type: Directive,
|
|
42
|
+
args: [{
|
|
43
|
+
selector: 'date-time-selector[validate][formControlName]:not([range]),date-time-selector[validate][formControl]:not([range]),date-time-selector[validate][ngModel]:not([range])',
|
|
44
|
+
providers: [DATETIME_VALIDATOR]
|
|
45
|
+
}]
|
|
46
|
+
}], ctorParameters: function () { return [{ type: i1.DateTimeSelectorComponent }]; } });
|
|
47
|
+
//# sourceMappingURL=datetimeValidator.directive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datetimeValidator.directive.js","sourceRoot":"","sources":["../../../../../src/selector/directives/datetimeValidator/datetimeValidator.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,aAAa,EAA4D,MAAM,gBAAgB,CAAC;AAExG,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAC,yBAAyB,EAAC,MAAM,8CAA8C,CAAC;;;AAEvF;;GAEG;AACH,MAAM,kBAAkB,GACxB;IACI,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC;IACzD,KAAK,EAAE,IAAI;CACd,CAAC;AAEF;;GAEG;AAMH,MAAM,OAAO,0BAA0B;IASnC,iEAAiE;IACjE,YAAY,gBAAkD;QAR9D,oEAAoE;QAEpE;;WAEG;QACK,eAAU,GAAgB,GAAG,EAAE,CAAC,IAAI,CAAC;QAKzC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;IAC5D,CAAC;IAED,kGAAkG;IAElG;;;;OAIG;IACI,QAAQ,CAAC,OAAwB;QAEpC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;;uHAzBQ,0BAA0B;2GAA1B,0BAA0B,+LAFxB,CAAC,kBAAkB,CAAC;2FAEtB,0BAA0B;kBALtC,SAAS;mBACV;oBACI,QAAQ,EAAE,sKAAsK;oBAChL,SAAS,EAAE,CAAC,kBAAkB,CAAC;iBAClC","sourcesContent":["import {ExistingProvider, forwardRef, Directive} from '@angular/core';\nimport {NG_VALIDATORS, AbstractControl, Validator, ValidatorFn, ValidationErrors} from '@angular/forms';\n\nimport {Validators} from '../../../misc/validators';\nimport {DateTimeSelectorComponent} from '../../components/selector/selector.component';\n\n/**\n * Validator that is injected with directive DatetimeValidatorDirective\n */\nconst DATETIME_VALIDATOR = <ExistingProvider>\n{\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => DatetimeValidatorDirective),\n multi: true\n};\n\n/**\n * Directive injecting datetime validator, validating datetime\n */\n@Directive(\n{\n selector: 'date-time-selector[validate][formControlName]:not([range]),date-time-selector[validate][formControl]:not([range]),date-time-selector[validate][ngModel]:not([range])',\n providers: [DATETIME_VALIDATOR]\n})\nexport class DatetimeValidatorDirective<TDate = any> implements Validator\n{\n //######################### private fields #########################\n\n /**\n * Function used for validations\n */\n private _validator: ValidatorFn = () => null;\n\n //######################### constructor #########################\n constructor(datetimeSelector: DateTimeSelectorComponent<TDate>)\n {\n this._validator = Validators.datetime(datetimeSelector);\n }\n\n //######################### public methods - implementation of Validator #########################\n\n /**\n * Validates input and returns validation result\n * @param control - Control that is being validated\n * @returns validation results\n */\n public validate(control: AbstractControl): ValidationErrors|null\n {\n return this._validator(control);\n }\n}"]}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Directive, forwardRef, Input } from '@angular/core';
|
|
2
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import { Subscription } from 'rxjs';
|
|
4
|
+
import { DateTimeSelectorComponent } from '../../components/selector/selector.component';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
import * as i1 from "../../components/selector/selector.component";
|
|
7
|
+
/**
|
|
8
|
+
* Value accessor provider for date time selector
|
|
9
|
+
*/
|
|
10
|
+
const DATE_TIME_SELECTOR_VALUE_ACCESSOR = {
|
|
11
|
+
provide: NG_VALUE_ACCESSOR,
|
|
12
|
+
useExisting: forwardRef(() => DateTimeSelectorControlValueAccessor),
|
|
13
|
+
multi: true
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Value accessor for getting and setting values for date time selector
|
|
17
|
+
*/
|
|
18
|
+
export class DateTimeSelectorControlValueAccessor {
|
|
19
|
+
//######################### constructor #########################
|
|
20
|
+
constructor(_selector) {
|
|
21
|
+
this._selector = _selector;
|
|
22
|
+
//######################### protected fields #########################
|
|
23
|
+
/**
|
|
24
|
+
* Subscriptions that are destroyed on directive destruction
|
|
25
|
+
*/
|
|
26
|
+
this._subscriptions = new Subscription();
|
|
27
|
+
//######################### public properties - inputs #########################
|
|
28
|
+
/**
|
|
29
|
+
* Indication whether value for selector is represented as range from, to
|
|
30
|
+
*/
|
|
31
|
+
this.range = false;
|
|
32
|
+
/**
|
|
33
|
+
* Indication whether value for selector is represented as formatted string value, if both 'formatted' and 'range' are set, 'range' takes precedence
|
|
34
|
+
*/
|
|
35
|
+
this.formatted = false;
|
|
36
|
+
}
|
|
37
|
+
//######################### public methods - implementation of OnDestroy #########################
|
|
38
|
+
/**
|
|
39
|
+
* Called when component is destroyed
|
|
40
|
+
*/
|
|
41
|
+
ngOnDestroy() {
|
|
42
|
+
var _a;
|
|
43
|
+
(_a = this._subscriptions) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
44
|
+
}
|
|
45
|
+
//######################### public methods - implementation of ControlValueAccessor #########################
|
|
46
|
+
/**
|
|
47
|
+
* Sets value to datetime selector
|
|
48
|
+
*/
|
|
49
|
+
writeValue(value) {
|
|
50
|
+
if (this.range) {
|
|
51
|
+
this._selector.value = value;
|
|
52
|
+
}
|
|
53
|
+
else if (this.formatted) {
|
|
54
|
+
this._selector.formattedValue = value;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this._selector.value =
|
|
58
|
+
{
|
|
59
|
+
from: value,
|
|
60
|
+
to: value
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Registers callback that is called when value of datetime selector value changes
|
|
66
|
+
*/
|
|
67
|
+
registerOnChange(fn) {
|
|
68
|
+
this._subscriptions.add(this._selector.valueChange.subscribe(() => this._emitValue(fn)));
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Registers callback that is called when datetime selector was touched by user
|
|
72
|
+
*/
|
|
73
|
+
registerOnTouched(fn) {
|
|
74
|
+
this._subscriptions.add(this._selector.touched.subscribe(() => fn()));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Used for setting control as disabled
|
|
78
|
+
* @param isDisabled - disabled status to set on the element
|
|
79
|
+
*/
|
|
80
|
+
setDisabledState(isDisabled) {
|
|
81
|
+
this._selector.setDisabled(isDisabled);
|
|
82
|
+
}
|
|
83
|
+
//######################### protected methods #########################
|
|
84
|
+
/**
|
|
85
|
+
* Used for emitting value that was changed
|
|
86
|
+
* @param fn - Function that is used for emitting changed value
|
|
87
|
+
*/
|
|
88
|
+
_emitValue(fn) {
|
|
89
|
+
if (this.range) {
|
|
90
|
+
fn(this._selector.value);
|
|
91
|
+
}
|
|
92
|
+
else if (this.formatted) {
|
|
93
|
+
fn(this._selector.formattedValue);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const value = this._selector.value;
|
|
97
|
+
if (!value) {
|
|
98
|
+
fn(null);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
fn(value.from);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
DateTimeSelectorControlValueAccessor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: DateTimeSelectorControlValueAccessor, deps: [{ token: i1.DateTimeSelectorComponent }], target: i0.ɵɵFactoryTarget.Directive });
|
|
107
|
+
DateTimeSelectorControlValueAccessor.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.3", type: DateTimeSelectorControlValueAccessor, selector: "date-time-selector[formControlName],date-time-selector[formControl],date-time-selector[ngModel]", inputs: { range: "range", formatted: "formatted" }, providers: [DATE_TIME_SELECTOR_VALUE_ACCESSOR], ngImport: i0 });
|
|
108
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.3", ngImport: i0, type: DateTimeSelectorControlValueAccessor, decorators: [{
|
|
109
|
+
type: Directive,
|
|
110
|
+
args: [{
|
|
111
|
+
selector: 'date-time-selector[formControlName],date-time-selector[formControl],date-time-selector[ngModel]',
|
|
112
|
+
providers: [DATE_TIME_SELECTOR_VALUE_ACCESSOR]
|
|
113
|
+
}]
|
|
114
|
+
}], ctorParameters: function () { return [{ type: i1.DateTimeSelectorComponent }]; }, propDecorators: { range: [{
|
|
115
|
+
type: Input
|
|
116
|
+
}], formatted: [{
|
|
117
|
+
type: Input
|
|
118
|
+
}] } });
|
|
119
|
+
//# sourceMappingURL=selectorControlValueAccessor.directive.js.map
|