@anglr/datetime 5.0.0-beta.20221020045240 → 5.0.0-beta.20221020100553
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 +7 -1
- package/es2015/src/legacy/picker/components/dayPicker/dayPicker.component.js +2 -1
- package/es2015/src/legacy/picker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2015/src/legacy/picker/components/monthPicker/monthPicker.component.js +2 -1
- package/es2015/src/legacy/picker/components/monthPicker/monthPicker.component.js.map +1 -1
- package/es2015/src/legacy/picker/components/yearPicker/yearPicker.component.js +2 -1
- package/es2015/src/legacy/picker/components/yearPicker/yearPicker.component.js.map +1 -1
- package/es2015/src/legacy/picker/misc/datetimePicker.interface.js.map +1 -1
- package/es2015/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js +87 -0
- package/es2015/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js.map +1 -1
- package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +100 -14
- package/es2015/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -1
- package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +120 -29
- package/es2015/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +69 -15
- package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +1 -1
- package/es2015/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.js.map +1 -1
- package/es2015/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.js.map +1 -1
- package/es2020/src/legacy/picker/components/dayPicker/dayPicker.component.js +2 -1
- package/es2020/src/legacy/picker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2020/src/legacy/picker/components/monthPicker/monthPicker.component.js +2 -1
- package/es2020/src/legacy/picker/components/monthPicker/monthPicker.component.js.map +1 -1
- package/es2020/src/legacy/picker/components/yearPicker/yearPicker.component.js +2 -1
- package/es2020/src/legacy/picker/components/yearPicker/yearPicker.component.js.map +1 -1
- package/es2020/src/legacy/picker/misc/datetimePicker.interface.js.map +1 -1
- package/es2020/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js +84 -0
- package/es2020/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.js.map +1 -1
- package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js +97 -13
- package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map +1 -1
- package/es2020/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js +118 -28
- package/es2020/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js +65 -11
- package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map +1 -1
- package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.js.map +1 -1
- package/es2020/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.js.map +1 -1
- package/package.json +1 -1
- package/src/legacy/picker/components/dayPicker/dayPicker.component.d.ts.map +1 -1
- package/src/legacy/picker/components/monthPicker/monthPicker.component.d.ts.map +1 -1
- package/src/legacy/picker/components/yearPicker/yearPicker.component.d.ts.map +1 -1
- package/src/legacy/picker/misc/datetimePicker.interface.d.ts +4 -0
- package/src/legacy/picker/misc/datetimePicker.interface.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.d.ts +48 -5
- package/src/modules/dateTimePicker/components/dateTimePeriodPickerBase.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts +26 -6
- package/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts +33 -11
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.d.ts.map +1 -1
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.html +5 -5
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts +21 -6
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.d.ts.map +1 -1
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.d.ts +8 -0
- package/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.d.ts.map +1 -1
- package/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.d.ts +2 -1
- package/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.d.ts.map +1 -1
- package/styles/components/_date-time-picker.scss +129 -0
- package/version.bak +1 -1
- package/src/modules/dateTimePicker/components/dayPicker/dayPicker.component.css +0 -27
package/es2020/src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimePicker.component.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.ts","../../../../../../src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,SAAS,EAAE,gBAAgB,EAAQ,YAAY,EAAE,MAAM,EAAE,KAAK,EAA4B,MAAM,EAAE,QAAQ,EAA0B,MAAM,eAAe,CAAC;AACtM,OAAO,EAAW,QAAQ,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAIlC,OAAO,EAAC,wBAAwB,EAAC,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAC,oBAAoB,EAAC,MAAM,kCA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C,mBAAmB,CAAC,CAAC;QAErF,OAAO,IAAI,CAAC,mBAAmB,CAAC;IACpC,CAAC;;oHAlOQ,uBAAuB,kBAwEZ,QAAQ,aACR,wBAAwB;wGAzEnC,uBAAuB,0OAkCD,gBAAgB,uFC3EnD,0CAAwC;2FDyC3B,uBAAuB;kBANnC,SAAS;+BAEI,kBAAkB,mBAEX,uBAAuB,CAAC,MAAM;;0BA0ElC,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,wBAAwB;;0BAAG,QAAQ;4CAtC7C,eAAe;sBADxB,SAAS;uBAAC,WAAW,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAC;gBASvD,KAAK;sBADX,KAAK;gBAOK,OAAO;sBADjB,KAAK;gBAqBC,WAAW;sBADjB,MAAM","sourcesContent":["import {Component, ChangeDetectionStrategy, ViewChild, ViewContainerRef, Type, EventEmitter, Output, Input, OnChanges, SimpleChanges, Inject, Optional, OnDestroy, ComponentRef} from '@angular/core';\nimport {Position, POSITION} from '@anglr/common';\nimport {extend, isBlank, nameof} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {DateTimeInputValue} from '../../../../interfaces';\nimport {DateTimeInputOutputValue} from '../../../../misc/types';\nimport {DATE_TIME_PICKER_OPTIONS} from '../../misc/tokens';\nimport {DayPickerSAComponent} from '../dayPicker/dayPicker.component';\nimport {DateTimePickerOptions} from './dateTimePicker.interface';\nimport {DateTimePicker} from '../../interfaces';\nimport {formatDateTime, parseDateTime} from '../../../../misc/utils';\nimport {DateTimeValueFormat} from '../../../../misc/enums';\nimport {DateTimeDirective} from '../../../dateTime/directives';\n\n/**\n * Text to be displayed when configuration, options are corrupted\n */\nconst CORRUPTED_CONFIG_TEXT = 'DateTime: Corrupted configuration for DateTimePicker!';\n\n/**\n * Default options for date time picker\n */\nconst defaultOptions: DateTimePickerOptions = \n{\n defaultPeriod: 'day',\n periodsDefinition:\n {\n 'day': DayPickerSAComponent,\n },\n};\n\n/**\n * Component used for displaying date time picker\n */\n@Component(\n{\n selector: 'date-time-picker',\n templateUrl: 'dateTimePicker.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimePickerComponent<TDate = unknown> extends DateTimeDirective<TDate> implements DateTimeInputValue<TDate>, OnChanges, OnDestroy\n{\n //######################### protected properties #########################\n \n /**\n * Subscription for changes in date time period picker\n */\n protected periodChangesSubscription: Subscription|undefined|null;\n\n /**\n * Options for date time picker\n */\n protected ɵOptions: DateTimePickerOptions<TDate>;\n\n /**\n * Currently displayed period type\n */\n protected displayedPeriodType: Type<DateTimePicker<TDate>>;\n\n /**\n * Name of period which is currently displayed\n */\n protected displayedPeriodName: string;\n\n /**\n * Instance of created date time period picker\n */\n protected component: ComponentRef<DateTimePicker<TDate>>|undefined|null;\n \n //######################### protected properties - children #########################\n\n /**\n * Container used for displaying pickers for specific date time part\n */\n @ViewChild('container', {read: ViewContainerRef, static: true})\n protected pickerContainer: ViewContainerRef|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * @inheritdoc\n */\n @Input()\n public value: DateTimeInputOutputValue<TDate>|undefined|null;\n\n /**\n * Options for date time picker\n */\n @Input()\n public get options(): Partial<DateTimePickerOptions<TDate>>\n {\n return this.ɵOptions;\n }\n public set options(value: Partial<DateTimePickerOptions<TDate>>)\n {\n this.ɵOptions = extend(true, {}, defaultOptions, value);\n\n if(value?.periodsDefinition)\n {\n this.ɵOptions.periodsDefinition = value.periodsDefinition;\n }\n }\n\n //######################### public properties - outputs #########################\n\n /**\n * @inheritdoc\n */\n @Output()\n public valueChange: EventEmitter<void> = new EventEmitter<void>();\n\n //######################### constructor #########################\n constructor(@Inject(POSITION) protected position: Position,\n @Inject(DATE_TIME_PICKER_OPTIONS) @Optional() options?: DateTimePickerOptions<TDate>,)\n {\n super();\n\n this.ɵOptions = extend(true, {}, defaultOptions, options);\n \n if(options?.periodsDefinition)\n {\n this.ɵOptions.periodsDefinition = options.periodsDefinition;\n }\n\n this.displayedPeriodName = this.ɵOptions.defaultPeriod;\n this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n\n if(!this.displayedPeriodType)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\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<DateTimePickerComponent>('value') in changes)\n {\n //empty value show now\n if(isBlank(this.value))\n {\n const now = this.dateApi.now();\n\n this.showPicker(this.displayedPeriodType, now.value);\n\n return;\n }\n\n }\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public override ngOnDestroy(): void\n {\n super.ngOnDestroy();\n\n this.component?.destroy();\n this.component = null;\n\n this.periodChangesSubscription?.unsubscribe();\n this.periodChangesSubscription = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Shows picker\n * @param type - Type of period that should be displayed\n * @param displayDate - Display date to be shown\n */\n protected showPicker(type: Type<DateTimePicker<TDate>>, displayDate: TDate): void\n {\n if(!this.pickerContainer)\n {\n return;\n }\n\n //create new component and destroy previous one\n if(!this.component || (this.component && type != this.displayedPeriodType))\n {\n this.periodChangesSubscription?.unsubscribe();\n this.periodChangesSubscription = new Subscription();\n this.component?.destroy();\n this.component = this.pickerContainer.createComponent(type);\n\n this.periodChangesSubscription.add(this.component.instance.valueChange.subscribe(() =>\n {\n const component = this.component?.instance;\n\n if(!component)\n {\n return;\n }\n\n this.value = formatDateTime(component.value, DateTimeValueFormat.DateInstance, null);\n this.valueChange.emit();\n }));\n\n this.periodChangesSubscription.add(this.component.instance.scaleUp.subscribe(date => this.showPicker(this.getUpperType(), date)));\n this.periodChangesSubscription.add(this.component.instance.scaleDown.subscribe(date => this.showPicker(this.getLowerType(), date)));\n }\n\n const component = this.component.instance;\n\n component.canScaleDown = false,\n component.canScaleUp = false;\n component.display = displayDate;\n // component.options\n //TODO: maybe add support for format!\n component.value = parseDateTime(this.value, this.dateApi, null, null);\n }\n\n /**\n * Gets type that is above current period picker\n */\n protected getUpperType(): Type<DateTimePicker<TDate>>\n {\n const periods = Object.keys(this.ɵOptions.periodsDefinition);\n const index = periods.indexOf(this.displayedPeriodName);\n\n if(index < 0)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n\n if(index >= periods.length)\n {\n return this.displayedPeriodType;\n }\n\n this.displayedPeriodName = periods[index + 1];\n this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n\n return this.displayedPeriodType;\n }\n\n /**\n * Gets type that is below current period picker\n */\n protected getLowerType(): Type<DateTimePicker<TDate>>\n {\n const periods = Object.keys(this.ɵOptions.periodsDefinition);\n const index = periods.indexOf(this.displayedPeriodName);\n\n if(index < 0)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n\n if(index <= 0)\n {\n return this.displayedPeriodType;\n }\n\n this.displayedPeriodName = periods[index - 1];\n this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n\n return this.displayedPeriodType;\n }\n}","<ng-container #container></ng-container>"]}
|
|
1
|
+
{"version":3,"file":"dateTimePicker.component.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.ts","../../../../../../src/modules/dateTimePicker/components/dateTimePicker/dateTimePicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,SAAS,EAAE,gBAAgB,EAAQ,YAAY,EAAE,MAAM,EAAE,KAAK,EAA4B,MAAM,EAAE,QAAQ,EAAkC,MAAM,eAAe,CAAC;AAC9M,OAAO,EAAW,QAAQ,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAIlC,OAAO,EAAC,wBAAwB,EAAC,MAAM,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MAAM;2BAAC,wBAAwB;;0BAAG,QAAQ;4CAhD7C,eAAe;sBADxB,SAAS;uBAAC,WAAW,EAAE,EAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,IAAI,EAAC;gBASnD,KAAK;sBADf,KAAK;gBAgBK,OAAO;sBADjB,KAAK;gBAqBC,WAAW;sBADjB,MAAM","sourcesContent":["import {Component, ChangeDetectionStrategy, ViewChild, ViewContainerRef, Type, EventEmitter, Output, Input, OnChanges, SimpleChanges, Inject, Optional, OnDestroy, ComponentRef, OnInit} from '@angular/core';\nimport {Position, POSITION} from '@anglr/common';\nimport {extend, isBlank, nameof} from '@jscrpt/common';\nimport {Subscription} from 'rxjs';\n\nimport {DateTimeInputValue} from '../../../../interfaces';\nimport {DateTimeInputOutputValue, DateTimeObjectValue} from '../../../../misc/types';\nimport {DATE_TIME_PICKER_OPTIONS} from '../../misc/tokens';\nimport {DayPickerSAComponent} from '../dayPicker/dayPicker.component';\nimport {DateTimePickerOptions} from './dateTimePicker.interface';\nimport {DateTimePicker} from '../../interfaces';\nimport {formatDateTime, parseDateTime} from '../../../../misc/utils';\nimport {DateTimeDirective} from '../../../dateTime/directives';\nimport {DateValueProvider} from '../../../../services';\n\n//TODO: use mixin for set internal\n\n/**\n * Text to be displayed when configuration, options are corrupted\n */\nconst CORRUPTED_CONFIG_TEXT = 'DateTime: Corrupted configuration for DateTimePicker!';\n\n/**\n * Default options for date time picker\n */\nconst defaultOptions: DateTimePickerOptions = \n{\n defaultPeriod: 'day',\n periodsDefinition:\n {\n 'day': DayPickerSAComponent,\n },\n};\n\n/**\n * Component used for displaying date time picker\n */\n@Component(\n{\n selector: 'date-time-picker',\n templateUrl: 'dateTimePicker.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DateTimePickerComponent<TDate = unknown> extends DateTimeDirective<TDate> implements DateTimeInputValue<TDate>, OnInit, OnChanges, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Current value of date time, could be string, unix timestamp, Date, TDate object, or ranged DateTimeValue\n */\n protected ɵValue: DateTimeInputOutputValue<TDate>|undefined|null;\n\n /**\n * Internal representation of current date time value\n */\n protected internalValue: DateTimeObjectValue<TDate>|undefined|null;\n \n /**\n * Subscription for changes in date time period picker\n */\n protected periodChangesSubscription: Subscription|undefined|null;\n\n /**\n * Options for date time picker\n */\n protected ɵOptions: DateTimePickerOptions<TDate>;\n\n /**\n * Currently displayed period type\n */\n protected displayedPeriodType: Type<DateTimePicker<TDate>>;\n\n /**\n * Name of period which is currently displayed\n */\n protected displayedPeriodName: string;\n\n /**\n * Instance of created date time period picker\n */\n protected component: ComponentRef<DateTimePicker<TDate>>|undefined|null;\n \n //######################### protected properties - children #########################\n\n /**\n * Container used for displaying pickers for specific date time part\n */\n @ViewChild('container', {read: ViewContainerRef, static: true})\n protected pickerContainer: ViewContainerRef|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * @inheritdoc\n */\n @Input()\n public get value(): DateTimeInputOutputValue<TDate>|undefined|null\n {\n return this.ɵValue;\n }\n public set value(value: DateTimeInputOutputValue<TDate>|undefined|null)\n {\n //accepts all available formats\n this.setInternalValue(value);\n this.ɵValue = formatDateTime(this.internalValue, this.valueFormat, this.customFormat);\n }\n\n /**\n * Options for date time picker\n */\n @Input()\n public get options(): Partial<DateTimePickerOptions<TDate>>\n {\n return this.ɵOptions;\n }\n public set options(value: Partial<DateTimePickerOptions<TDate>>)\n {\n this.ɵOptions = extend(true, {}, defaultOptions, value);\n\n if(value?.periodsDefinition)\n {\n this.ɵOptions.periodsDefinition = value.periodsDefinition;\n }\n }\n\n //######################### public properties - outputs #########################\n\n /**\n * @inheritdoc\n */\n @Output()\n public valueChange: EventEmitter<void> = new EventEmitter<void>();\n\n //######################### constructor #########################\n constructor(@Inject(POSITION) protected position: Position,\n protected valueProvider: DateValueProvider<TDate>,\n @Inject(DATE_TIME_PICKER_OPTIONS) @Optional() options?: DateTimePickerOptions<TDate>,)\n {\n super();\n\n this.ɵOptions = extend(true, {}, defaultOptions, options);\n \n if(options?.periodsDefinition)\n {\n this.ɵOptions.periodsDefinition = options.periodsDefinition;\n }\n\n this.displayedPeriodName = this.ɵOptions.defaultPeriod;\n this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n\n if(!this.displayedPeriodType)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n }\n\n //######################### public methods - implementation of OnInit #########################\n \n /**\n * Initialize component\n */\n public ngOnInit(): void\n {\n //empty value show now\n if(isBlank(this.value))\n {\n const now = this.dateApi.now();\n\n this.showPicker(this.displayedPeriodType, now.value);\n }\n else\n {\n const val = (Array.isArray(this.internalValue) ? this.internalValue[0] : this.internalValue) ?? this.dateApi.now();\n\n this.showPicker(this.displayedPeriodType, val.value);\n }\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(!this.component)\n {\n return;\n }\n\n const component = this.component.instance;\n let invalidate: boolean = false;\n\n if(nameof<DateTimePickerComponent>('maxDateTime') in changes)\n {\n component.maxDate = this.maxDateTime;\n invalidate = true;\n }\n\n if(nameof<DateTimePickerComponent>('minDateTime') in changes)\n {\n component.minDate = this.minDateTime;\n invalidate = true;\n }\n\n if(nameof<DateTimePickerComponent>('value') in changes)\n {\n const val = (Array.isArray(this.internalValue) ? this.internalValue[0] : this.internalValue) ?? this.dateApi.now();\n\n component.display = val.isValid() ? val.value : this.dateApi.now().value;\n component.value = this.internalValue;\n invalidate = true;\n }\n\n if(this.component && invalidate)\n {\n this.component.instance.invalidateVisuals();\n }\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n \n /**\n * Called when component is destroyed\n */\n public override ngOnDestroy(): void\n {\n super.ngOnDestroy();\n\n this.component?.destroy();\n this.component = null;\n\n this.periodChangesSubscription?.unsubscribe();\n this.periodChangesSubscription = null;\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets internal value and fix lowest time difference\n * @param value - Value to be set\n */\n protected setInternalValue(value: DateTimeInputOutputValue<TDate>|undefined|null): void\n {\n this.internalValue = parseDateTime(value, this.dateApi, null, this.customFormat);\n\n if(isBlank(this.internalValue))\n {\n return;\n }\n\n //ranged value\n if(Array.isArray(this.internalValue))\n {\n const [from, to] = this.internalValue;\n\n if(from)\n {\n const val = this.valueProvider.getValue(from.value, this.customFormat).from;\n\n if(val)\n {\n this.internalValue[0] = this.dateApi.getValue(val, this.customFormat);\n }\n }\n\n if(to)\n {\n const val = this.valueProvider.getValue(to.value, this.customFormat).to;\n\n if(val)\n {\n this.internalValue[1] = this.dateApi.getValue(val, this.customFormat);\n }\n }\n }\n else\n {\n const val = this.valueProvider.getValue(this.internalValue.value, this.customFormat).from;\n\n if(val)\n {\n this.internalValue = this.dateApi.getValue(val, this.customFormat);\n }\n }\n }\n\n /**\n * Shows picker\n * @param type - Type of period that should be displayed\n * @param displayDate - Display date to be shown\n */\n protected showPicker(type: Type<DateTimePicker<TDate>>, displayDate: TDate): void\n {\n if(!this.pickerContainer)\n {\n return;\n }\n\n //create new component and destroy previous one\n if(!this.component || (this.component && type != this.displayedPeriodType))\n {\n this.periodChangesSubscription?.unsubscribe();\n this.periodChangesSubscription = new Subscription();\n this.component?.destroy();\n this.component = this.pickerContainer.createComponent(type);\n\n this.periodChangesSubscription.add(this.component.instance.valueChange.subscribe(() =>\n {\n const component = this.component?.instance;\n\n if(!component)\n {\n return;\n }\n\n if(!Array.isArray(component.value))\n {\n this.setInternalValue(component.value?.value);\n }\n else\n {\n //TODO: handle ranges\n }\n\n this.value = formatDateTime(this.internalValue, this.valueFormat, this.customFormat);\n this.valueChange.emit();\n }));\n\n this.periodChangesSubscription.add(this.component.instance.scaleUp.subscribe(date => this.showPicker(this.getUpperType(), date)));\n this.periodChangesSubscription.add(this.component.instance.scaleDown.subscribe(date => this.showPicker(this.getLowerType(), date)));\n }\n\n const component = this.component.instance;\n\n component.canScaleDown = false,\n component.canScaleUp = false;\n component.display = displayDate;\n // component.options\n component.maxDate = this.maxDateTime;\n component.minDate = this.minDateTime;\n component.value = this.internalValue;\n component.invalidateVisuals();\n }\n\n /**\n * Gets type that is above current period picker\n */\n protected getUpperType(): Type<DateTimePicker<TDate>>\n {\n const periods = Object.keys(this.ɵOptions.periodsDefinition);\n const index = periods.indexOf(this.displayedPeriodName);\n\n if(index < 0)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n\n if(index >= periods.length)\n {\n return this.displayedPeriodType;\n }\n\n this.displayedPeriodName = periods[index + 1];\n this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n\n return this.displayedPeriodType;\n }\n\n /**\n * Gets type that is below current period picker\n */\n protected getLowerType(): Type<DateTimePicker<TDate>>\n {\n const periods = Object.keys(this.ɵOptions.periodsDefinition);\n const index = periods.indexOf(this.displayedPeriodName);\n\n if(index < 0)\n {\n throw new Error(CORRUPTED_CONFIG_TEXT);\n }\n\n if(index <= 0)\n {\n return this.displayedPeriodType;\n }\n\n this.displayedPeriodName = periods[index - 1];\n this.displayedPeriodType = this.ɵOptions.periodsDefinition[this.displayedPeriodName];\n\n return this.displayedPeriodType;\n }\n}","<ng-container #container></ng-container>"]}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy
|
|
1
|
+
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
3
|
import { DateTimePeriodPickerBase } from '../dateTimePeriodPickerBase';
|
|
4
4
|
import { DatePipesModule } from '../../../datePipes.module';
|
|
5
|
-
import { DATE_API } from '../../../../misc/tokens';
|
|
6
5
|
import * as i0 from "@angular/core";
|
|
7
6
|
import * as i1 from "@angular/common";
|
|
8
7
|
import * as i2 from "../../../../pipes/dateFormat.pipe";
|
|
@@ -11,55 +10,149 @@ import * as i2 from "../../../../pipes/dateFormat.pipe";
|
|
|
11
10
|
*/
|
|
12
11
|
export class DayPickerSAComponent extends DateTimePeriodPickerBase {
|
|
13
12
|
//######################### constructor #########################
|
|
14
|
-
constructor(
|
|
13
|
+
constructor() {
|
|
15
14
|
super();
|
|
16
|
-
|
|
15
|
+
//######################### protected properties #########################
|
|
16
|
+
/**
|
|
17
|
+
* Stored this picker month data
|
|
18
|
+
*/
|
|
19
|
+
this.thisMonthData = [];
|
|
17
20
|
//######################### protected properties - template bindings #########################
|
|
18
21
|
/**
|
|
19
22
|
* Names of days
|
|
20
23
|
*/
|
|
21
24
|
this.weekdays = [];
|
|
22
|
-
|
|
23
|
-
* Array of period data to be displayed
|
|
24
|
-
* @internal
|
|
25
|
-
*/
|
|
26
|
-
this.periodData = [];
|
|
25
|
+
this.weekdays = this.dateApi.weekdaysShort();
|
|
27
26
|
}
|
|
28
27
|
//######################### protected methods - template bindings #########################
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param dayData - Day data that were selected
|
|
31
|
+
*/
|
|
29
32
|
selectDay(dayData) {
|
|
33
|
+
if (dayData.disabled) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
30
36
|
if (!this.value) {
|
|
31
37
|
this.value = this.displayDate?.clone() ?? this.dateApi.getValue(this.display ?? new Date());
|
|
32
38
|
}
|
|
33
39
|
//single value
|
|
34
40
|
if (!Array.isArray(this.value)) {
|
|
35
41
|
this.value.dayOfMonth(dayData.day);
|
|
42
|
+
//other month was selected
|
|
43
|
+
if (dayData.otherMonth) {
|
|
44
|
+
this.value.month(dayData.dateObj.month());
|
|
45
|
+
this.displayDate?.month(dayData.dateObj.month());
|
|
46
|
+
}
|
|
36
47
|
this.value.updateOriginal();
|
|
37
48
|
this.valueChangeSubject.next();
|
|
38
49
|
}
|
|
50
|
+
else {
|
|
51
|
+
//TODO: range
|
|
52
|
+
}
|
|
53
|
+
this.render();
|
|
54
|
+
this.changeDetector.detectChanges();
|
|
39
55
|
}
|
|
40
56
|
/**
|
|
41
57
|
* Changes displayed month to next month
|
|
42
|
-
* @param event - Event that occured
|
|
43
58
|
*/
|
|
44
|
-
nextMonth(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.displayDate?.addMonths(1);
|
|
48
|
-
// this.display(this.displayDate);
|
|
59
|
+
nextMonth() {
|
|
60
|
+
this.displayDate?.addMonths(1).updateOriginal();
|
|
61
|
+
this.render();
|
|
49
62
|
}
|
|
50
63
|
/**
|
|
51
64
|
* Changes displayed month to previous month
|
|
52
|
-
* @param event - Event that occured
|
|
53
65
|
*/
|
|
54
|
-
previousMonth(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
66
|
+
previousMonth() {
|
|
67
|
+
this.displayDate?.subtractMonths(1).updateOriginal();
|
|
68
|
+
this.render();
|
|
69
|
+
}
|
|
70
|
+
//######################### protected methods #########################
|
|
71
|
+
/**
|
|
72
|
+
* Renders current day picker data
|
|
73
|
+
*/
|
|
74
|
+
render() {
|
|
75
|
+
//same month only data change
|
|
76
|
+
if (this.displayedMonth && this.displayDate?.isSameMonth(this.displayedMonth)) {
|
|
77
|
+
this.setActive();
|
|
78
|
+
this.updateMinMax();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this.periodData = [];
|
|
82
|
+
this.thisMonthData = [];
|
|
83
|
+
if (!this.displayDate) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const currentMonthDate = this.displayDate.value;
|
|
87
|
+
const today = this.dateApi.now().value;
|
|
88
|
+
this.displayDate
|
|
89
|
+
.startOfMonth()
|
|
90
|
+
.updateOriginal()
|
|
91
|
+
.startOfWeek();
|
|
92
|
+
do {
|
|
93
|
+
for (let x = 0; x < 7; x++) {
|
|
94
|
+
const day = this.displayDate.dayOfMonth();
|
|
95
|
+
const otherMonth = !this.displayDate.isSameMonth(currentMonthDate);
|
|
96
|
+
const data = {
|
|
97
|
+
active: false,
|
|
98
|
+
disabled: false,
|
|
99
|
+
date: this.displayDate.value,
|
|
100
|
+
otherMonth: otherMonth,
|
|
101
|
+
today: this.displayDate.isSameDay(today),
|
|
102
|
+
weekend: this.displayDate.isWeekend(),
|
|
103
|
+
day: day,
|
|
104
|
+
dateObj: this.displayDate.clone(),
|
|
105
|
+
};
|
|
106
|
+
this.periodData.push(data);
|
|
107
|
+
if (!otherMonth) {
|
|
108
|
+
this.thisMonthData.push(data);
|
|
109
|
+
}
|
|
110
|
+
this.displayDate.addDays(1);
|
|
111
|
+
}
|
|
112
|
+
} while (this.displayDate.isSameMonth(currentMonthDate));
|
|
113
|
+
this.displayDate.resetOriginal();
|
|
114
|
+
this.setActive();
|
|
115
|
+
this.updateMinMax();
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Sets active date
|
|
119
|
+
*/
|
|
120
|
+
setActive() {
|
|
121
|
+
this.periodData.forEach(itm => itm.active = false);
|
|
122
|
+
if (!this.value) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (!Array.isArray(this.value)) {
|
|
126
|
+
if (this.value) {
|
|
127
|
+
const value = this.value;
|
|
128
|
+
const day = this.periodData.find(itm => itm.dateObj.isSameDay(value.value));
|
|
129
|
+
if (day) {
|
|
130
|
+
day.active = true;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
//TODO: support range
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//######################### protected methods - overrides #########################
|
|
139
|
+
/**
|
|
140
|
+
* @inheritdoc
|
|
141
|
+
*/
|
|
142
|
+
onRender() {
|
|
143
|
+
this.render();
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Tests whether provided value is in same period target value
|
|
147
|
+
* @param val - Tested value
|
|
148
|
+
* @param target - Target value to be tested against
|
|
149
|
+
*/
|
|
150
|
+
isSamePeriod(val, target) {
|
|
151
|
+
return val.isSameDay(target);
|
|
59
152
|
}
|
|
60
153
|
}
|
|
61
|
-
DayPickerSAComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DayPickerSAComponent, deps: [
|
|
62
|
-
DayPickerSAComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: DayPickerSAComponent, isStandalone: true, selector: "day-picker", host: { properties: { "class.date-time-period": "true" } }, usesInheritance: true, ngImport: i0, template: "<div class=\"period\">\r\n <div class=\"fas fa-angle-left clickable\" (mousedown)=\"previousMonth(
|
|
154
|
+
DayPickerSAComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DayPickerSAComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
155
|
+
DayPickerSAComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: DayPickerSAComponent, isStandalone: true, selector: "day-picker", host: { properties: { "class.date-time-period": "true" } }, usesInheritance: true, ngImport: i0, template: "<div class=\"period\">\r\n <div class=\"fas fa-angle-left clickable\" (mousedown)=\"previousMonth()\"></div>\r\n <div class=\"period-value\" [class.clickable]=\"canScaleUp\" (mousedown)=\"displayDate && canScaleUp ? scaleUpSubject.next(displayDate.value) : undefined\">{{displayDate?.value | dateFormat: 'monthName'}} {{displayDate?.value | dateFormat: 'year'}}</div>\r\n <div class=\"fas fa-angle-right clickable\" (mousedown)=\"nextMonth()\"></div>\r\n</div>\r\n\r\n<div class=\"period-data\">\r\n <div class=\"weekday\" *ngFor=\"let weekday of weekdays\">{{weekday}}</div>\r\n <div *ngFor=\"let day of periodData\"\r\n class=\"period-datum clickable\"\r\n [class.other-month]=\"day.otherMonth\"\r\n [class.today]=\"day.today\"\r\n [class.weekend]=\"day.weekend\"\r\n [class.active]=\"day.active\"\r\n [class.disabled]=\"day.disabled\"\r\n (mousedown)=\"selectDay(day)\">{{day.day}}</div>\r\n</div>\r\n\r\n<div class=\"go-down-button\" style=\"justify-content: center; border-top: 1px solid #FFF;\" *ngIf=\"canScaleDown\">\r\n <!-- <div [class.clickable]=\"canScaleDown\" (mousedown)=\"displayDate ? goDownSubject.next(displayDate.value) : undefined\">{{timeValue?.from | dateFormat: 'time'}}</div> -->\r\n</div>", dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: DatePipesModule }, { kind: "pipe", type: i2.DateFormatPipe, name: "dateFormat" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
63
156
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DayPickerSAComponent, decorators: [{
|
|
64
157
|
type: Component,
|
|
65
158
|
args: [{ selector: 'day-picker', host: {
|
|
@@ -67,9 +160,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
67
160
|
}, standalone: true, imports: [
|
|
68
161
|
CommonModule,
|
|
69
162
|
DatePipesModule,
|
|
70
|
-
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"period\">\r\n <div class=\"fas fa-angle-left clickable\" (mousedown)=\"previousMonth(
|
|
71
|
-
}], ctorParameters: function () { return [
|
|
72
|
-
type: Inject,
|
|
73
|
-
args: [DATE_API]
|
|
74
|
-
}] }]; } });
|
|
163
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"period\">\r\n <div class=\"fas fa-angle-left clickable\" (mousedown)=\"previousMonth()\"></div>\r\n <div class=\"period-value\" [class.clickable]=\"canScaleUp\" (mousedown)=\"displayDate && canScaleUp ? scaleUpSubject.next(displayDate.value) : undefined\">{{displayDate?.value | dateFormat: 'monthName'}} {{displayDate?.value | dateFormat: 'year'}}</div>\r\n <div class=\"fas fa-angle-right clickable\" (mousedown)=\"nextMonth()\"></div>\r\n</div>\r\n\r\n<div class=\"period-data\">\r\n <div class=\"weekday\" *ngFor=\"let weekday of weekdays\">{{weekday}}</div>\r\n <div *ngFor=\"let day of periodData\"\r\n class=\"period-datum clickable\"\r\n [class.other-month]=\"day.otherMonth\"\r\n [class.today]=\"day.today\"\r\n [class.weekend]=\"day.weekend\"\r\n [class.active]=\"day.active\"\r\n [class.disabled]=\"day.disabled\"\r\n (mousedown)=\"selectDay(day)\">{{day.day}}</div>\r\n</div>\r\n\r\n<div class=\"go-down-button\" style=\"justify-content: center; border-top: 1px solid #FFF;\" *ngIf=\"canScaleDown\">\r\n <!-- <div [class.clickable]=\"canScaleDown\" (mousedown)=\"displayDate ? goDownSubject.next(displayDate.value) : undefined\">{{timeValue?.from | dateFormat: 'time'}}</div> -->\r\n</div>" }]
|
|
164
|
+
}], ctorParameters: function () { return []; } });
|
|
75
165
|
//# sourceMappingURL=dayPicker.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dayPicker.component.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/components/dayPicker/dayPicker.component.ts","../../../../../../src/modules/dateTimePicker/components/dayPicker/dayPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AACzE,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAC,wBAAwB,EAAC,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAC,QAAQ,EAAC,MAAM,yBAAyB,CAAC;;;;AAGjD;;GAEG;AAiBH,MAAM,OAAO,oBAAsC,SAAQ,wBAA+B;IAetF,iEAAiE;IACjE,YAAwC,OAAuB;QAE3D,KAAK,EAAE,CAAC;QAF4B,YAAO,GAAP,OAAO,CAAgB;QAd/D,8FAA8F;QAE9F;;WAEG;QACO,aAAQ,GAAa,EAAE,CAAC;QAElC;;;W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BlC,MAAM;2BAAC,QAAQ","sourcesContent":["import {Component, ChangeDetectionStrategy, Inject} from '@angular/core';\nimport {CommonModule} from '@angular/common';\n\nimport {DateTimePicker} from '../../interfaces';\nimport {DateTimePeriodPickerBase} from '../dateTimePeriodPickerBase';\nimport {DatePipesModule} from '../../../datePipes.module';\nimport {DayData} from '../../../../legacy/picker/interfaces';\nimport {DATE_API} from '../../../../misc/tokens';\nimport {DateApi} from '../../../../services';\n\n/**\n * Component used for displaying day picker\n */\n@Component(\n{\n selector: 'day-picker',\n templateUrl: 'dayPicker.component.html',\n host:\n {\n '[class.date-time-period]': 'true',\n },\n standalone: true,\n imports:\n [\n CommonModule,\n DatePipesModule,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DayPickerSAComponent<TDate = unknown> extends DateTimePeriodPickerBase<TDate> implements DateTimePicker<TDate>\n{\n //######################### protected properties - template bindings #########################\n\n /**\n * Names of days\n */\n protected weekdays: string[] = [];\n\n /**\n * Array of period data to be displayed\n * @internal\n */\n public periodData: DayData<TDate>[] = [];\n\n //######################### constructor #########################\n constructor(@Inject(DATE_API) protected dateApi: DateApi<TDate>,)\n {\n super();\n }\n\n //######################### protected methods - template bindings #########################\n\n protected selectDay(dayData: DayData): void\n {\n if(!this.value)\n {\n this.value = this.displayDate?.clone() ?? this.dateApi.getValue(this.display ?? new Date());\n }\n\n //single value\n if(!Array.isArray(this.value))\n {\n this.value.dayOfMonth(dayData.day);\n this.value.updateOriginal();\n\n this.valueChangeSubject.next();\n }\n }\n\n /**\n * Changes displayed month to next month\n * @param event - Event that occured\n */\n protected nextMonth(event: Event): void\n {\n event.preventDefault();\n event.stopPropagation();\n this.displayDate?.addMonths(1);\n\n // this.display(this.displayDate);\n }\n\n /**\n * Changes displayed month to previous month\n * @param event - Event that occured\n */\n protected previousMonth(event: Event): void\n {\n event.preventDefault();\n event.stopPropagation();\n this.displayDate?.subtractMonths(1);\n\n // this.display(this.displayDate!);\n }\n}","<div class=\"period\">\r\n <div class=\"fas fa-angle-left clickable\" (mousedown)=\"previousMonth($event)\"></div>\r\n <div class=\"period-value\" [class.clickable]=\"canScaleUp\" (mousedown)=\"$event.stopPropagation(); $event.preventDefault(); displayDate ? scaleUpSubject.next(displayDate.value) : undefined\">{{displayDate?.value | dateFormat: 'monthName'}} {{displayDate?.value | dateFormat: 'year'}}</div>\r\n <div class=\"fas fa-angle-right clickable\" (mousedown)=\"nextMonth($event)\"></div>\r\n</div>\r\n\r\n<div class=\"period-data\">\r\n <div class=\"weekday\" *ngFor=\"let weekday of weekdays\">{{weekday}}</div>\r\n <div *ngFor=\"let day of periodData\"\r\n class=\"period-datum clickable\"\r\n [class.other-month]=\"day.otherMonth\"\r\n [class.today]=\"day.today\"\r\n [class.weekend]=\"day.weekend\"\r\n [class.active]=\"day.active\"\r\n [class.disabled]=\"day.disabled\"\r\n (click)=\"$event.stopPropagation(); $event.preventDefault(); selectDay(day)\">{{day.day}}</div>\r\n</div>\r\n\r\n<div class=\"go-down-button\" style=\"justify-content: center; border-top: 1px solid #FFF;\" *ngIf=\"canScaleDown\">\r\n <!-- <div [class.clickable]=\"canScaleDown\" (mousedown)=\"$event.stopPropagation(); $event.preventDefault(); displayDate ? goDownSubject.next(displayDate.value) : undefined\">{{timeValue?.from | dateFormat: 'time'}}</div> -->\r\n</div>"]}
|
|
1
|
+
{"version":3,"file":"dayPicker.component.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/components/dayPicker/dayPicker.component.ts","../../../../../../src/modules/dateTimePicker/components/dayPicker/dayPicker.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AACjE,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAG7C,OAAO,EAAC,wBAAwB,EAAC,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;;;;AAI1D;;GAEG;AAiBH,MAAM,O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EACN;oBACI,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC;iBACrB;aACJ;SACJ;aAED;YACI,qBAAqB;SACxB;IACL,CAAC;IAED,mFAAmF;IAEnF;;OAEG;IACO,QAAQ;QAEd,IAAI,CAAC,MAAM,EAAE,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACO,YAAY,CAAC,GAAyB,EAAE,MAAa;QAE3D,OAAO,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;;iHAnNQ,oBAAoB;qGAApB,oBAAoB,yJC5BjC,0wCAoBM,2CDGE,YAAY,+PACZ,eAAe;2FAIV,oBAAoB;kBAhBhC,SAAS;+BAEI,YAAY,QAGtB;wBACI,0BAA0B,EAAE,MAAM;qBACrC,cACW,IAAI,WAEhB;wBACI,YAAY;wBACZ,eAAe;qBAClB,mBACgB,uBAAuB,CAAC,MAAM","sourcesContent":["import {Component, ChangeDetectionStrategy} from '@angular/core';\nimport {CommonModule} from '@angular/common';\n\nimport {DateTimePicker} from '../../interfaces';\nimport {DateTimePeriodPickerBase} from '../dateTimePeriodPickerBase';\nimport {DatePipesModule} from '../../../datePipes.module';\nimport {DayData} from '../../../../legacy/picker/interfaces';\nimport {DateApiObject} from '../../../../services';\n\n/**\n * Component used for displaying day picker\n */\n@Component(\n{\n selector: 'day-picker',\n templateUrl: 'dayPicker.component.html',\n host:\n {\n '[class.date-time-period]': 'true',\n },\n standalone: true,\n imports:\n [\n CommonModule,\n DatePipesModule,\n ],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class DayPickerSAComponent<TDate = unknown> extends DateTimePeriodPickerBase<DayData<TDate>, TDate> implements DateTimePicker<TDate>\n{\n //######################### protected properties #########################\n\n /**\n * Stored this picker month data\n */\n protected thisMonthData: DayData<TDate>[] = [];\n\n /**\n * Currently displayed month\n */\n protected displayedMonth: TDate|undefined|null;\n\n //######################### protected properties - template bindings #########################\n\n /**\n * Names of days\n */\n protected weekdays: string[] = [];\n\n //######################### constructor #########################\n constructor()\n {\n super();\n\n this.weekdays = this.dateApi.weekdaysShort();\n }\n\n //######################### protected methods - template bindings #########################\n\n /**\n * \n * @param dayData - Day data that were selected\n */\n protected selectDay(dayData: DayData): void\n {\n if(dayData.disabled)\n {\n return;\n }\n\n if(!this.value)\n {\n this.value = this.displayDate?.clone() ?? this.dateApi.getValue(this.display ?? new Date());\n }\n\n //single value\n if(!Array.isArray(this.value))\n {\n this.value.dayOfMonth(dayData.day);\n\n //other month was selected\n if(dayData.otherMonth)\n {\n this.value.month(dayData.dateObj.month());\n this.displayDate?.month(dayData.dateObj.month());\n }\n\n this.value.updateOriginal();\n\n this.valueChangeSubject.next();\n }\n else\n {\n //TODO: range\n }\n\n this.render();\n this.changeDetector.detectChanges();\n }\n\n /**\n * Changes displayed month to next month\n */\n protected nextMonth(): void\n {\n this.displayDate?.addMonths(1).updateOriginal();\n\n this.render();\n }\n\n /**\n * Changes displayed month to previous month\n */\n protected previousMonth(): void\n {\n this.displayDate?.subtractMonths(1).updateOriginal();\n\n this.render();\n }\n\n //######################### protected methods #########################\n\n /**\n * Renders current day picker data\n */\n protected render(): void\n {\n //same month only data change\n if(this.displayedMonth && this.displayDate?.isSameMonth(this.displayedMonth))\n {\n this.setActive();\n this.updateMinMax();\n\n return;\n }\n\n this.periodData = [];\n this.thisMonthData = [];\n\n if(!this.displayDate)\n {\n return;\n }\n\n const currentMonthDate = this.displayDate.value;\n const today = this.dateApi.now().value;\n\n this.displayDate\n .startOfMonth()\n .updateOriginal()\n .startOfWeek();\n\n do\n {\n for(let x = 0; x < 7; x++)\n {\n const day = this.displayDate.dayOfMonth();\n const otherMonth = !this.displayDate.isSameMonth(currentMonthDate);\n\n const data: DayData<TDate> = \n {\n active: false,\n disabled: false,\n date: this.displayDate.value,\n otherMonth: otherMonth,\n today: this.displayDate.isSameDay(today),\n weekend: this.displayDate.isWeekend(),\n day: day,\n dateObj: this.displayDate.clone(),\n };\n\n this.periodData.push(data);\n\n if(!otherMonth)\n {\n this.thisMonthData.push(data);\n }\n\n this.displayDate.addDays(1);\n }\n }\n while(this.displayDate.isSameMonth(currentMonthDate));\n\n this.displayDate.resetOriginal();\n\n this.setActive();\n this.updateMinMax();\n }\n\n /**\n * Sets active date\n */\n protected setActive(): void\n {\n this.periodData.forEach(itm => itm.active = false);\n\n if(!this.value)\n {\n return;\n }\n\n \n if(!Array.isArray(this.value))\n {\n if(this.value)\n {\n const value = this.value;\n const day = this.periodData.find(itm => itm.dateObj.isSameDay(value.value));\n\n if(day)\n {\n day.active = true;\n }\n }\n }\n else\n {\n //TODO: support range\n }\n }\n\n //######################### protected methods - overrides #########################\n\n /**\n * @inheritdoc\n */\n protected onRender(): void\n {\n this.render();\n }\n\n /**\n * Tests whether provided value is in same period target value\n * @param val - Tested value\n * @param target - Target value to be tested against\n */\n protected isSamePeriod(val: DateApiObject<TDate>, target: TDate): boolean\n {\n return val.isSameDay(target);\n }\n}","<div class=\"period\">\r\n <div class=\"fas fa-angle-left clickable\" (mousedown)=\"previousMonth()\"></div>\r\n <div class=\"period-value\" [class.clickable]=\"canScaleUp\" (mousedown)=\"displayDate && canScaleUp ? scaleUpSubject.next(displayDate.value) : undefined\">{{displayDate?.value | dateFormat: 'monthName'}} {{displayDate?.value | dateFormat: 'year'}}</div>\r\n <div class=\"fas fa-angle-right clickable\" (mousedown)=\"nextMonth()\"></div>\r\n</div>\r\n\r\n<div class=\"period-data\">\r\n <div class=\"weekday\" *ngFor=\"let weekday of weekdays\">{{weekday}}</div>\r\n <div *ngFor=\"let day of periodData\"\r\n class=\"period-datum clickable\"\r\n [class.other-month]=\"day.otherMonth\"\r\n [class.today]=\"day.today\"\r\n [class.weekend]=\"day.weekend\"\r\n [class.active]=\"day.active\"\r\n [class.disabled]=\"day.disabled\"\r\n (mousedown)=\"selectDay(day)\">{{day.day}}</div>\r\n</div>\r\n\r\n<div class=\"go-down-button\" style=\"justify-content: center; border-top: 1px solid #FFF;\" *ngIf=\"canScaleDown\">\r\n <!-- <div [class.clickable]=\"canScaleDown\" (mousedown)=\"displayDate ? goDownSubject.next(displayDate.value) : undefined\">{{timeValue?.from | dateFormat: 'time'}}</div> -->\r\n</div>"]}
|
package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js
CHANGED
|
@@ -3,10 +3,11 @@ import { Directive, ElementRef, Inject, Input, Optional, ViewContainerRef } from
|
|
|
3
3
|
import { DOCUMENT } from '@angular/common';
|
|
4
4
|
import { POSITION, applyPositionResult, PositionPlacement } from '@anglr/common';
|
|
5
5
|
import { extend, nameof, isDescendant, BindThis } from '@jscrpt/common';
|
|
6
|
-
import { lastValueFrom
|
|
6
|
+
import { lastValueFrom } from 'rxjs';
|
|
7
7
|
import { DATE_TIME_INPUT } from '../../../../misc/tokens';
|
|
8
8
|
import { DateTimePickerComponent } from '../../components';
|
|
9
9
|
import { DATE_TIME_PICKER_DIRECTIVE_OPTIONS } from '../../misc/tokens';
|
|
10
|
+
import { DateTimeBase } from '../../../dateTime/directives';
|
|
10
11
|
import * as i0 from "@angular/core";
|
|
11
12
|
/**
|
|
12
13
|
* Default options for date time picker directive
|
|
@@ -15,16 +16,19 @@ const defaultOptions = {
|
|
|
15
16
|
absolute: true,
|
|
16
17
|
alwaysVisible: false,
|
|
17
18
|
closeOnValueSelect: true,
|
|
19
|
+
closeOnBlur: true,
|
|
18
20
|
disabled: false,
|
|
19
21
|
positionOptions: PositionPlacement.BottomStart,
|
|
20
22
|
showOnFocus: true,
|
|
23
|
+
pickerCssClass: null,
|
|
21
24
|
};
|
|
22
25
|
/**
|
|
23
26
|
* Directive that is used for displaying and attaching date time picker
|
|
24
27
|
*/
|
|
25
|
-
export class DateTimePickerDirective {
|
|
28
|
+
export class DateTimePickerDirective extends DateTimeBase {
|
|
26
29
|
//######################### constructor #########################
|
|
27
30
|
constructor(viewContainer, element, input, document, position, options) {
|
|
31
|
+
super();
|
|
28
32
|
this.viewContainer = viewContainer;
|
|
29
33
|
this.element = element;
|
|
30
34
|
this.input = input;
|
|
@@ -35,10 +39,6 @@ export class DateTimePickerDirective {
|
|
|
35
39
|
* Indication whether is value changes disabled
|
|
36
40
|
*/
|
|
37
41
|
this.valueChangeDisabled = false;
|
|
38
|
-
/**
|
|
39
|
-
* Subscriptions created during initialization
|
|
40
|
-
*/
|
|
41
|
-
this.initSubscriptions = new Subscription();
|
|
42
42
|
this.ɵWithPickerOptions = extend(true, {}, defaultOptions, options);
|
|
43
43
|
}
|
|
44
44
|
//######################### public properties - inputs #########################
|
|
@@ -68,12 +68,18 @@ export class DateTimePickerDirective {
|
|
|
68
68
|
this.showPicker();
|
|
69
69
|
}
|
|
70
70
|
}));
|
|
71
|
+
this.initSubscriptions.add(this.input.blur.subscribe(() => {
|
|
72
|
+
if (this.withPickerOptions.closeOnBlur) {
|
|
73
|
+
this.hidePicker();
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
71
76
|
}
|
|
72
77
|
//######################### public methods - implementation of OnDestroy #########################
|
|
73
78
|
/**
|
|
74
79
|
* Called when component is destroyed
|
|
75
80
|
*/
|
|
76
81
|
ngOnDestroy() {
|
|
82
|
+
super.ngOnDestroy();
|
|
77
83
|
this.hidePicker();
|
|
78
84
|
this.initSubscriptions.unsubscribe();
|
|
79
85
|
}
|
|
@@ -97,17 +103,27 @@ export class DateTimePickerDirective {
|
|
|
97
103
|
this.input.value = this.component.value;
|
|
98
104
|
this.input.valueChange.emit();
|
|
99
105
|
this.valueChangeDisabled = false;
|
|
106
|
+
if (this.ɵWithPickerOptions.closeOnValueSelect) {
|
|
107
|
+
this.hidePicker();
|
|
108
|
+
}
|
|
100
109
|
}
|
|
101
110
|
});
|
|
102
111
|
this.document.addEventListener('click', this.handleClickOutside);
|
|
112
|
+
this.componentElement.addEventListener('mousedown', this.handleClickInside);
|
|
113
|
+
if (this.ɵWithPickerOptions.pickerCssClass) {
|
|
114
|
+
this.componentElement.classList.add(this.ɵWithPickerOptions.pickerCssClass);
|
|
115
|
+
}
|
|
103
116
|
const result = await lastValueFrom(this.position.placeElement(this.componentElement, this.element.nativeElement, {
|
|
104
117
|
placement: this.withPickerOptions.positionOptions,
|
|
105
118
|
}));
|
|
106
119
|
applyPositionResult(result);
|
|
107
120
|
this.setPickerValue();
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
121
|
+
this.componentRef.setInput(nameof('options'), this.pickerOptions);
|
|
122
|
+
this.componentRef.setInput(nameof('valueFormat'), this.dateTimeData.valueFormat);
|
|
123
|
+
this.componentRef.setInput(nameof('format'), this.dateTimeData.format);
|
|
124
|
+
this.componentRef.setInput(nameof('customFormat'), this.dateTimeData.customFormat);
|
|
125
|
+
this.componentRef.setInput(nameof('minDateTime'), this.dateTimeData.minDateTime);
|
|
126
|
+
this.componentRef.setInput(nameof('maxDateTime'), this.dateTimeData.maxDateTime);
|
|
111
127
|
this.componentRef.changeDetectorRef.detectChanges();
|
|
112
128
|
}
|
|
113
129
|
/**
|
|
@@ -117,6 +133,7 @@ export class DateTimePickerDirective {
|
|
|
117
133
|
if (this.withPickerOptions.alwaysVisible) {
|
|
118
134
|
return;
|
|
119
135
|
}
|
|
136
|
+
this.componentElement?.removeEventListener('mousedown', this.handleClickInside);
|
|
120
137
|
this.valueChangeSubscription?.unsubscribe();
|
|
121
138
|
this.valueChangeSubscription = null;
|
|
122
139
|
this.component = null;
|
|
@@ -153,15 +170,50 @@ export class DateTimePickerDirective {
|
|
|
153
170
|
this.hidePicker();
|
|
154
171
|
}
|
|
155
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Handles clicking inside of picker element
|
|
175
|
+
* @param event - Event that occured
|
|
176
|
+
*/
|
|
177
|
+
handleClickInside(event) {
|
|
178
|
+
event.preventDefault();
|
|
179
|
+
event.stopPropagation();
|
|
180
|
+
}
|
|
181
|
+
//######################### protected methods - overrides #########################
|
|
182
|
+
/**
|
|
183
|
+
* @inheritdoc
|
|
184
|
+
*/
|
|
185
|
+
onMaxDateTimeChange() {
|
|
186
|
+
if (!this.componentRef) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
this.componentRef.setInput(nameof('maxDateTime'), this.dateTimeData.maxDateTime);
|
|
190
|
+
this.componentRef.changeDetectorRef.detectChanges();
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* @inheritdoc
|
|
194
|
+
*/
|
|
195
|
+
onMinDateTimeChange() {
|
|
196
|
+
if (!this.componentRef) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
this.componentRef.setInput(nameof('minDateTime'), this.dateTimeData.minDateTime);
|
|
200
|
+
this.componentRef.changeDetectorRef.detectChanges();
|
|
201
|
+
}
|
|
156
202
|
}
|
|
157
203
|
DateTimePickerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimePickerDirective, deps: [{ token: i0.ViewContainerRef }, { token: i0.ElementRef }, { token: DATE_TIME_INPUT }, { token: DOCUMENT }, { token: POSITION }, { token: DATE_TIME_PICKER_DIRECTIVE_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
|
|
158
|
-
DateTimePickerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.6", type: DateTimePickerDirective, selector: "[dateTime][withPicker]", inputs: { withPickerOptions: "withPickerOptions" }, exportAs: ["dateTimePicker"], ngImport: i0 });
|
|
204
|
+
DateTimePickerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.6", type: DateTimePickerDirective, selector: "[dateTime][withPicker]", inputs: { withPickerOptions: "withPickerOptions", pickerOptions: "pickerOptions" }, exportAs: ["dateTimePicker"], usesInheritance: true, ngImport: i0 });
|
|
159
205
|
__decorate([
|
|
160
206
|
BindThis,
|
|
161
207
|
__metadata("design:type", Function),
|
|
162
208
|
__metadata("design:paramtypes", [MouseEvent]),
|
|
163
209
|
__metadata("design:returntype", void 0)
|
|
164
210
|
], DateTimePickerDirective.prototype, "handleClickOutside", null);
|
|
211
|
+
__decorate([
|
|
212
|
+
BindThis,
|
|
213
|
+
__metadata("design:type", Function),
|
|
214
|
+
__metadata("design:paramtypes", [MouseEvent]),
|
|
215
|
+
__metadata("design:returntype", void 0)
|
|
216
|
+
], DateTimePickerDirective.prototype, "handleClickInside", null);
|
|
165
217
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: DateTimePickerDirective, decorators: [{
|
|
166
218
|
type: Directive,
|
|
167
219
|
args: [{
|
|
@@ -184,5 +236,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
184
236
|
type: Optional
|
|
185
237
|
}] }]; }, propDecorators: { withPickerOptions: [{
|
|
186
238
|
type: Input
|
|
187
|
-
}],
|
|
239
|
+
}], pickerOptions: [{
|
|
240
|
+
type: Input
|
|
241
|
+
}], handleClickOutside: [], handleClickInside: [] } });
|
|
188
242
|
//# sourceMappingURL=dateTimePicker.directive.js.map
|
package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimePicker.directive.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.directive.ts"],"names":[],"mappings":";AAAA,OAAO,EAAe,SAAS,EAAE,UAAU,EAAmB,MAAM,EAAE,KAAK,EAAqB,QAAQ,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACjJ,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAW,QAAQ,EAAE,mBAAmB,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AACzF,OAAO,EAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,MAAM,CAAC;AAG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AAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,kCAAkC;;0BAAG,QAAQ;4CAftD,iBAAiB;sBAD3B,KAAK;gBAyJI,kBAAkB","sourcesContent":["import {ComponentRef, Directive, ElementRef, EmbeddedViewRef, Inject, Input, OnDestroy, OnInit, Optional, ViewContainerRef} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\nimport {Position, POSITION, applyPositionResult, PositionPlacement} from '@anglr/common';\nimport {extend, nameof, isDescendant, BindThis} from '@jscrpt/common';\nimport {lastValueFrom, Subscription} from 'rxjs';\n\nimport {DateTimeInput} from '../../../../interfaces';\nimport {DATE_TIME_INPUT} from '../../../../misc/tokens';\nimport {DateTimePickerComponent} from '../../components';\nimport {DateTimePickerDirectiveOptions} from './dateTimePicker.interface';\nimport {DATE_TIME_PICKER_DIRECTIVE_OPTIONS} from '../../misc/tokens';\n\n/**\n * Default options for date time picker directive\n */\nconst defaultOptions: DateTimePickerDirectiveOptions =\n{\n absolute: true,\n alwaysVisible: false,\n closeOnValueSelect: true,\n disabled: false,\n positionOptions: PositionPlacement.BottomStart,\n showOnFocus: true,\n};\n\n/**\n * Directive that is used for displaying and attaching date time picker\n */\n@Directive(\n{\n selector: '[dateTime][withPicker]',\n exportAs: 'dateTimePicker'\n})\nexport class DateTimePickerDirective<TDate = unknown> implements OnInit, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Indication whether is value changes disabled\n */\n protected valueChangeDisabled: boolean = false;\n\n /**\n * Options for date time picker directive\n */\n protected ɵWithPickerOptions: DateTimePickerDirectiveOptions;\n\n /**\n * Subscriptions created during initialization\n */\n protected initSubscriptions: Subscription = new Subscription();\n\n /**\n * Date time picker component reference\n */\n protected componentRef: ComponentRef<DateTimePickerComponent<TDate>>|undefined|null;\n\n /**\n * Instance of date time picker component\n */\n protected component: DateTimePickerComponent<TDate>|undefined|null;\n\n /**\n * Instance of date time picker element\n */\n protected componentElement: HTMLElement|undefined|null;\n\n /**\n * Subscription for value changes in picker\n */\n protected valueChangeSubscription: Subscription|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * Gets or sets options for date time picker directive\n */\n @Input()\n public get withPickerOptions(): Partial<DateTimePickerDirectiveOptions>\n {\n return this.ɵWithPickerOptions;\n }\n public set withPickerOptions(value: Partial<DateTimePickerDirectiveOptions>)\n {\n this.ɵWithPickerOptions = extend(true, {}, this.ɵWithPickerOptions, value);\n }\n\n //######################### constructor #########################\n constructor(protected viewContainer: ViewContainerRef,\n protected element: ElementRef<HTMLElement>,\n @Inject(DATE_TIME_INPUT) protected input: DateTimeInput<TDate>,\n @Inject(DOCUMENT) protected document: Document,\n @Inject(POSITION) protected position: Position,\n @Inject(DATE_TIME_PICKER_DIRECTIVE_OPTIONS) @Optional() options?: DateTimePickerDirectiveOptions,)\n {\n this.ɵWithPickerOptions = extend(true, {}, defaultOptions, options);\n }\n\n //######################### public methods - implementation of OnInit #########################\n\n /**\n * Initialize component\n */\n public async ngOnInit(): Promise<void>\n {\n if(this.withPickerOptions.alwaysVisible)\n {\n this.showPicker();\n }\n\n this.initSubscriptions.add(this.input.valueChange.subscribe(() =>\n {\n this.setPickerValue();\n this.componentRef?.changeDetectorRef.detectChanges();\n }));\n\n this.initSubscriptions.add(this.input.focus.subscribe(() =>\n {\n if(this.withPickerOptions.showOnFocus)\n {\n this.showPicker();\n }\n }));\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public ngOnDestroy(): void\n {\n this.hidePicker();\n this.initSubscriptions.unsubscribe();\n }\n\n //######################### public methods #########################\n\n /**\n * Hides date time picker\n */\n public async showPicker(): Promise<void>\n {\n if(this.withPickerOptions.disabled || this.componentRef)\n {\n return;\n }\n\n this.componentRef = this.viewContainer.createComponent(DateTimePickerComponent<TDate>);\n this.componentElement = (this.componentRef?.hostView as EmbeddedViewRef<DateTimePickerComponent<TDate>>).rootNodes[0] as HTMLElement;\n this.component = this.componentRef.instance;\n\n if(this.withPickerOptions.absolute)\n {\n this.document.body.append(this.componentElement);\n }\n\n this.valueChangeSubscription = this.component.valueChange.subscribe(() =>\n {\n if(this.component)\n {\n this.valueChangeDisabled = true;\n this.input.value = this.component.value;\n this.input.valueChange.emit();\n this.valueChangeDisabled = false;\n }\n });\n\n this.document.addEventListener('click', this.handleClickOutside);\n\n const result = await lastValueFrom(this.position.placeElement(this.componentElement, this.element.nativeElement,\n {\n placement: this.withPickerOptions.positionOptions,\n }));\n\n applyPositionResult(result);\n this.setPickerValue();\n // this.componentRef.setInput(nameof<DateTimePickerComponent>('valueFormat'), this.input.);\n // this.componentRef.setInput(nameof<DateTimePickerComponent>('value'), this.input.value);\n // this.componentRef.setInput(nameof<DateTimePickerComponent>('value'), this.input.value);\n this.componentRef.changeDetectorRef.detectChanges();\n }\n\n /**\n * Shows date time picker\n */\n public hidePicker(): void\n {\n if(this.withPickerOptions.alwaysVisible)\n {\n return;\n }\n\n this.valueChangeSubscription?.unsubscribe();\n this.valueChangeSubscription = null;\n\n this.component = null;\n\n this.componentRef?.destroy();\n this.componentRef = null;\n\n this.componentElement?.remove();\n this.componentElement = null;\n\n this.document.removeEventListener('click', this.handleClickOutside);\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets all picker value\n */\n protected setPickerValue(): void\n {\n if(this.valueChangeDisabled)\n {\n return;\n }\n\n if(this.componentRef)\n {\n this.componentRef.setInput(nameof<DateTimePickerComponent>('value'), this.input.value);\n }\n }\n\n /**\n * Handles clicking outside of picker\n * @param event - Event that occured\n */\n @BindThis\n protected handleClickOutside(event: MouseEvent): void\n {\n if(!this.componentElement)\n {\n return;\n }\n\n if(this.componentElement != event.target &&\n !isDescendant(this.componentElement, event.target as HTMLElement) &&\n (!this.input.element || (this.input.element != event.target &&\n !isDescendant(this.input.element, event.target as HTMLElement))))\n {\n this.hidePicker();\n }\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"dateTimePicker.directive.js","sourceRoot":"","sources":["../../../../../../src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gEAI5C;2FA5PQ,uBAAuB;kBALnC,SAAS;mBACV;oBACI,QAAQ,EAAE,wBAAwB;oBAClC,QAAQ,EAAE,gBAAgB;iBAC7B;;0BA2DgB,MAAM;2BAAC,eAAe;;0BACtB,MAAM;2BAAC,QAAQ;;0BACf,MAAM;2BAAC,QAAQ;;0BAEf,MAAM;2BAAC,kCAAkC;;0BAAG,QAAQ;4CAtBtD,iBAAiB;sBAD3B,KAAK;gBAcC,aAAa;sBADnB,KAAK;gBA+KI,kBAAkB,MAqBlB,iBAAiB","sourcesContent":["import {ComponentRef, Directive, ElementRef, EmbeddedViewRef, Inject, Input, OnDestroy, OnInit, Optional, ViewContainerRef} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\nimport {Position, POSITION, applyPositionResult, PositionPlacement} from '@anglr/common';\nimport {extend, nameof, isDescendant, BindThis} from '@jscrpt/common';\nimport {lastValueFrom, Subscription} from 'rxjs';\n\nimport {DateTimeInput} from '../../../../interfaces';\nimport {DATE_TIME_INPUT} from '../../../../misc/tokens';\nimport {DateTimePickerComponent} from '../../components';\nimport {DateTimePickerOptions} from '../../components/dateTimePicker/dateTimePicker.interface';\nimport {DateTimePickerDirectiveOptions} from './dateTimePicker.interface';\nimport {DATE_TIME_PICKER_DIRECTIVE_OPTIONS} from '../../misc/tokens';\nimport {DateTimeBase} from '../../../dateTime/directives';\n\n/**\n * Default options for date time picker directive\n */\nconst defaultOptions: DateTimePickerDirectiveOptions =\n{\n absolute: true,\n alwaysVisible: false,\n closeOnValueSelect: true,\n closeOnBlur: true,\n disabled: false,\n positionOptions: PositionPlacement.BottomStart,\n showOnFocus: true,\n pickerCssClass: null,\n};\n\n/**\n * Directive that is used for displaying and attaching date time picker\n */\n@Directive(\n{\n selector: '[dateTime][withPicker]',\n exportAs: 'dateTimePicker'\n})\nexport class DateTimePickerDirective<TDate = unknown> extends DateTimeBase<TDate> implements OnInit, OnDestroy\n{\n //######################### protected properties #########################\n\n /**\n * Indication whether is value changes disabled\n */\n protected valueChangeDisabled: boolean = false;\n\n /**\n * Options for date time picker directive\n */\n protected ɵWithPickerOptions: DateTimePickerDirectiveOptions;\n\n /**\n * Date time picker component reference\n */\n protected componentRef: ComponentRef<DateTimePickerComponent<TDate>>|undefined|null;\n\n /**\n * Instance of date time picker component\n */\n protected component: DateTimePickerComponent<TDate>|undefined|null;\n\n /**\n * Instance of date time picker element\n */\n protected componentElement: HTMLElement|undefined|null;\n\n /**\n * Subscription for value changes in picker\n */\n protected valueChangeSubscription: Subscription|undefined|null;\n\n //######################### public properties - inputs #########################\n\n /**\n * Gets or sets options for date time picker directive\n */\n @Input()\n public get withPickerOptions(): Partial<DateTimePickerDirectiveOptions>\n {\n return this.ɵWithPickerOptions;\n }\n public set withPickerOptions(value: Partial<DateTimePickerDirectiveOptions>)\n {\n this.ɵWithPickerOptions = extend(true, {}, this.ɵWithPickerOptions, value);\n }\n\n /**\n * Options for date time picker component\n */\n @Input()\n public pickerOptions: Partial<DateTimePickerOptions<TDate>>|undefined|null;\n\n //######################### constructor #########################\n constructor(protected viewContainer: ViewContainerRef,\n protected element: ElementRef<HTMLElement>,\n @Inject(DATE_TIME_INPUT) protected input: DateTimeInput<TDate>,\n @Inject(DOCUMENT) protected document: Document,\n @Inject(POSITION) protected position: Position,\n\n @Inject(DATE_TIME_PICKER_DIRECTIVE_OPTIONS) @Optional() options?: DateTimePickerDirectiveOptions,)\n {\n super();\n\n this.ɵWithPickerOptions = extend(true, {}, defaultOptions, options);\n }\n\n //######################### public methods - implementation of OnInit #########################\n\n /**\n * Initialize component\n */\n public async ngOnInit(): Promise<void>\n {\n if(this.withPickerOptions.alwaysVisible)\n {\n this.showPicker();\n }\n\n this.initSubscriptions.add(this.input.valueChange.subscribe(() =>\n {\n this.setPickerValue();\n this.componentRef?.changeDetectorRef.detectChanges();\n }));\n\n this.initSubscriptions.add(this.input.focus.subscribe(() =>\n {\n if(this.withPickerOptions.showOnFocus)\n {\n this.showPicker();\n }\n }));\n\n this.initSubscriptions.add(this.input.blur.subscribe(() =>\n {\n if(this.withPickerOptions.closeOnBlur)\n {\n this.hidePicker();\n }\n }));\n }\n\n //######################### public methods - implementation of OnDestroy #########################\n\n /**\n * Called when component is destroyed\n */\n public override ngOnDestroy(): void\n {\n super.ngOnDestroy();\n\n this.hidePicker();\n this.initSubscriptions.unsubscribe();\n }\n\n //######################### public methods #########################\n\n /**\n * Hides date time picker\n */\n public async showPicker(): Promise<void>\n {\n if(this.withPickerOptions.disabled || this.componentRef)\n {\n return;\n }\n\n this.componentRef = this.viewContainer.createComponent(DateTimePickerComponent<TDate>);\n this.componentElement = (this.componentRef?.hostView as EmbeddedViewRef<DateTimePickerComponent<TDate>>).rootNodes[0] as HTMLElement;\n this.component = this.componentRef.instance;\n\n if(this.withPickerOptions.absolute)\n {\n this.document.body.append(this.componentElement);\n }\n\n this.valueChangeSubscription = this.component.valueChange.subscribe(() =>\n {\n if(this.component)\n {\n this.valueChangeDisabled = true;\n this.input.value = this.component.value;\n this.input.valueChange.emit();\n this.valueChangeDisabled = false;\n\n if(this.ɵWithPickerOptions.closeOnValueSelect)\n {\n this.hidePicker();\n }\n }\n });\n\n this.document.addEventListener('click', this.handleClickOutside);\n this.componentElement.addEventListener('mousedown', this.handleClickInside);\n\n if(this.ɵWithPickerOptions.pickerCssClass)\n {\n this.componentElement.classList.add(this.ɵWithPickerOptions.pickerCssClass);\n }\n\n const result = await lastValueFrom(this.position.placeElement(this.componentElement, this.element.nativeElement,\n {\n placement: this.withPickerOptions.positionOptions,\n }));\n\n applyPositionResult(result);\n this.setPickerValue();\n this.componentRef.setInput(nameof<DateTimePickerComponent>('options'), this.pickerOptions);\n this.componentRef.setInput(nameof<DateTimePickerComponent>('valueFormat'), this.dateTimeData.valueFormat);\n this.componentRef.setInput(nameof<DateTimePickerComponent>('format'), this.dateTimeData.format);\n this.componentRef.setInput(nameof<DateTimePickerComponent>('customFormat'), this.dateTimeData.customFormat);\n this.componentRef.setInput(nameof<DateTimePickerComponent>('minDateTime'), this.dateTimeData.minDateTime);\n this.componentRef.setInput(nameof<DateTimePickerComponent>('maxDateTime'), this.dateTimeData.maxDateTime);\n this.componentRef.changeDetectorRef.detectChanges();\n }\n\n /**\n * Shows date time picker\n */\n public hidePicker(): void\n {\n if(this.withPickerOptions.alwaysVisible)\n {\n return;\n }\n \n this.componentElement?.removeEventListener('mousedown', this.handleClickInside);\n \n this.valueChangeSubscription?.unsubscribe();\n this.valueChangeSubscription = null;\n \n this.component = null;\n\n this.componentRef?.destroy();\n this.componentRef = null;\n\n this.componentElement?.remove();\n this.componentElement = null;\n\n this.document.removeEventListener('click', this.handleClickOutside);\n }\n\n //######################### protected methods #########################\n\n /**\n * Sets all picker value\n */\n protected setPickerValue(): void\n {\n if(this.valueChangeDisabled)\n {\n return;\n }\n\n if(this.componentRef)\n {\n this.componentRef.setInput(nameof<DateTimePickerComponent>('value'), this.input.value);\n }\n }\n\n /**\n * Handles clicking outside of picker\n * @param event - Event that occured\n */\n @BindThis\n protected handleClickOutside(event: MouseEvent): void\n {\n if(!this.componentElement)\n {\n return;\n }\n\n if(this.componentElement != event.target &&\n !isDescendant(this.componentElement, event.target as HTMLElement) &&\n (!this.input.element || (this.input.element != event.target &&\n !isDescendant(this.input.element, event.target as HTMLElement))))\n {\n this.hidePicker();\n }\n }\n\n /**\n * Handles clicking inside of picker element\n * @param event - Event that occured\n */\n @BindThis\n protected handleClickInside(event: MouseEvent): void\n {\n event.preventDefault();\n event.stopPropagation();\n }\n\n //######################### protected methods - overrides #########################\n\n /**\n * @inheritdoc\n */\n protected override onMaxDateTimeChange(): void\n {\n if(!this.componentRef)\n {\n return;\n }\n\n this.componentRef.setInput(nameof<DateTimePickerComponent>('maxDateTime'), this.dateTimeData.maxDateTime);\n this.componentRef.changeDetectorRef.detectChanges();\n }\n\n /**\n * @inheritdoc\n */\n protected override onMinDateTimeChange(): void\n {\n if(!this.componentRef)\n {\n return;\n }\n\n this.componentRef.setInput(nameof<DateTimePickerComponent>('minDateTime'), this.dateTimeData.minDateTime);\n this.componentRef.changeDetectorRef.detectChanges();\n }\n}"]}
|
package/es2020/src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimePicker.interface.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {PositionPlacement} from '@anglr/common';\n\n/**\n * Defintion of date time picker directive options\n */\nexport interface DateTimePickerDirectiveOptions\n{\n /**\n * Indication whether close picker on value selection\n */\n closeOnValueSelect: boolean;\n\n /**\n * Indication whether display picker when date time input gets focus\n */\n showOnFocus: boolean;\n\n /**\n * Indication whether is picker always visible, mostly used for debugging\n */\n alwaysVisible: boolean;\n\n /**\n * Indication whether picker is disabled, if true, you cant display picker\n */\n disabled: boolean;\n\n /**\n * Indication whether use absolute global positioning of picker\n */\n absolute: boolean;\n\n /**\n * Position options that are used to position picker\n */\n positionOptions: Partial<PositionPlacement>;\n}"]}
|
|
1
|
+
{"version":3,"file":"dateTimePicker.interface.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/directives/dateTimePicker/dateTimePicker.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {PositionPlacement} from '@anglr/common';\n\n/**\n * Defintion of date time picker directive options\n */\nexport interface DateTimePickerDirectiveOptions\n{\n /**\n * Indication whether close picker on value selection\n */\n closeOnValueSelect: boolean;\n\n /**\n * Indication whether close picker when date time input loses focus\n */\n closeOnBlur: boolean;\n\n /**\n * Indication whether display picker when date time input gets focus\n */\n showOnFocus: boolean;\n\n /**\n * Indication whether is picker always visible, mostly used for debugging\n */\n alwaysVisible: boolean;\n\n /**\n * Indication whether picker is disabled, if true, you cant display picker\n */\n disabled: boolean;\n\n /**\n * Indication whether use absolute global positioning of picker\n */\n absolute: boolean;\n\n /**\n * Position options that are used to position picker\n */\n positionOptions: Partial<PositionPlacement>;\n\n /**\n * Custom css class that is being added to picker component\n */\n pickerCssClass: string|undefined|null;\n}"]}
|
package/es2020/src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateTimePicker.interface.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {Observable} from 'rxjs';\n\nimport {DateTimeObjectValue} from '../../../../misc/types';\n\n/**\n * Describes date time picker API for each date time period\n */\nexport interface DateTimePicker<TDate = unknown, TOptions = unknown
|
|
1
|
+
{"version":3,"file":"dateTimePicker.interface.js","sourceRoot":"","sources":["../../../../../../src/modules/dateTimePicker/interfaces/dateTimePicker/dateTimePicker.interface.ts"],"names":[],"mappings":"","sourcesContent":["import {Invalidatable} from '@jscrpt/common';\nimport {Observable} from 'rxjs';\n\nimport {DateTimeObjectValue} from '../../../../misc/types';\n\n/**\n * Describes date time picker API for each date time period\n */\nexport interface DateTimePicker<TDate = unknown, TOptions = unknown> extends Invalidatable\n{\n /**\n * Value of date time picker\n */\n value: DateTimeObjectValue<TDate>|undefined|null;\n\n /**\n * Options for date time picker period\n */\n options: TOptions|undefined|null;\n\n /**\n * Date that describes which date should be displayed\n */\n display: TDate|undefined|null;\n\n /**\n * Max allowed date\n */\n maxDate: TDate|undefined|null;\n\n /**\n * Min allowed date to be selected\n */\n minDate: TDate|undefined|null;\n\n /**\n * Indication whether picker can display scale date time period up\n */\n canScaleUp: boolean;\n\n /**\n * Indication whether picker can display scale date time period down\n */\n canScaleDown: boolean;\n\n /**\n * Occurs when date time picker value changes\n */\n readonly valueChange: Observable<void>; \n\n /**\n * Occurs when period should be scaled up\n */\n readonly scaleUp: Observable<TDate>;\n\n /**\n * Occurs when period should be scaled down\n */\n readonly scaleDown: Observable<TDate>;\n}"]}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
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