@progress/kendo-angular-dateinputs 17.1.2-develop.5 → 17.2.0-develop.2

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.
@@ -4,8 +4,10 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { Injectable } from '@angular/core';
6
6
  import { isDocumentAvailable } from '@progress/kendo-angular-common';
7
- import { domContainerFactory as containerFactory, windowSize } from '../../util';
7
+ import { domContainerFactory as containerFactory } from '../../util';
8
+ import { AdaptiveService } from '@progress/kendo-angular-utils';
8
9
  import * as i0 from "@angular/core";
10
+ import * as i1 from "@progress/kendo-angular-utils";
9
11
  const div = containerFactory('div');
10
12
  const ul = containerFactory('ul');
11
13
  const li = containerFactory('li');
@@ -40,12 +42,16 @@ const timeListWrapper = (isAdaptiveEnabled = false, windowSize, isDateTimePicker
40
42
  * @hidden
41
43
  */
42
44
  export class TimePickerDOMService {
45
+ adaptiveService;
46
+ constructor(adaptiveService) {
47
+ this.adaptiveService = adaptiveService;
48
+ }
43
49
  itemHeight;
44
50
  timeListHeight;
45
51
  isAdaptiveEnabled;
46
52
  isDateTimePicker;
47
53
  get windowSize() {
48
- return windowSize();
54
+ return this.adaptiveService.size;
49
55
  }
50
56
  ensureHeights() {
51
57
  if (this.timeListHeight !== undefined) {
@@ -78,7 +84,7 @@ export class TimePickerDOMService {
78
84
  }
79
85
  return (element.nativeElement || element) === document.activeElement;
80
86
  }
81
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TimePickerDOMService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
87
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TimePickerDOMService, deps: [{ token: i1.AdaptiveService }], target: i0.ɵɵFactoryTarget.Injectable });
82
88
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TimePickerDOMService, providedIn: 'root' });
83
89
  }
84
90
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TimePickerDOMService, decorators: [{
@@ -86,4 +92,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
86
92
  args: [{
87
93
  providedIn: 'root'
88
94
  }]
89
- }] });
95
+ }], ctorParameters: function () { return [{ type: i1.AdaptiveService }]; } });
@@ -8,6 +8,7 @@ import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
8
8
  import { PopupService } from '@progress/kendo-angular-popup';
9
9
  import { cloneDate, isEqual } from '@progress/kendo-date-math';
10
10
  import { hasObservers, isControlRequired, isDocumentAvailable, KendoInput, Keys, MultiTabStop, ResizeSensorComponent, EventsOutsideAngularDirective } from '@progress/kendo-angular-common';
11
+ import { AdaptiveService } from '@progress/kendo-angular-utils';
11
12
  import { validatePackage } from '@progress/kendo-licensing';
12
13
  import { packageMetadata } from '../package-metadata';
13
14
  import { MIDNIGHT_DATE, MIN_TIME, MAX_TIME } from '../defaults';
@@ -18,7 +19,7 @@ import { TIME_PART } from './models/time-part.default';
18
19
  import { TimeSelectorComponent } from './timeselector.component';
19
20
  import { DateInputComponent } from '../dateinput/dateinput.component';
20
21
  import { PreventableEvent } from '../preventable-event';
21
- import { noop, setTime, isWindowAvailable, getFillModeClass, getSizeClass, getRoundedClass, DEFAULT_FILL_MODE, DEFAULT_ROUNDED, DEFAULT_SIZE, windowSize } from '../util';
22
+ import { noop, setTime, isWindowAvailable, getFillModeClass, getSizeClass, getRoundedClass, DEFAULT_FILL_MODE, DEFAULT_ROUNDED, DEFAULT_SIZE } from '../util';
22
23
  import { timeRangeValidator } from '../validators/time-range.validator';
23
24
  import { fromEvent } from 'rxjs';
24
25
  import { incompleteDateValidator } from '../validators/incomplete-date.validator';
@@ -38,6 +39,7 @@ import * as i2 from "@progress/kendo-angular-l10n";
38
39
  import * as i3 from "@progress/kendo-angular-popup";
39
40
  import * as i4 from "../common/picker.service";
40
41
  import * as i5 from "@progress/kendo-angular-intl";
42
+ import * as i6 from "@progress/kendo-angular-utils";
41
43
  const VALUE_DOC_LINK = 'https://www.telerik.com/kendo-angular-ui/components/dateinputs/timepicker/#toc-integration-with-json';
42
44
  const INTL_DATE_FORMAT = 'https://github.com/telerik/kendo-intl/blob/master/docs/date-formatting/index.md';
43
45
  const formatRegExp = new RegExp(`${TIME_PART.hour}|${TIME_PART.minute}|${TIME_PART.second}|${TIME_PART.millisecond}|${TIME_PART.dayperiod}|literal`);
@@ -57,6 +59,7 @@ export class TimePickerComponent extends MultiTabStop {
57
59
  injector;
58
60
  pickerService;
59
61
  intl;
62
+ adaptiveService;
60
63
  /**
61
64
  * @hidden
62
65
  */
@@ -518,7 +521,7 @@ export class TimePickerComponent extends MultiTabStop {
518
521
  _rounded = DEFAULT_ROUNDED;
519
522
  _fillMode = DEFAULT_FILL_MODE;
520
523
  windowSize;
521
- constructor(bus, zone, localization, cdr, popupService, wrapper, renderer, injector, pickerService, intl) {
524
+ constructor(bus, zone, localization, cdr, popupService, wrapper, renderer, injector, pickerService, intl, adaptiveService) {
522
525
  super();
523
526
  this.bus = bus;
524
527
  this.zone = zone;
@@ -530,6 +533,7 @@ export class TimePickerComponent extends MultiTabStop {
530
533
  this.injector = injector;
531
534
  this.pickerService = pickerService;
532
535
  this.intl = intl;
536
+ this.adaptiveService = adaptiveService;
533
537
  validatePackage(packageMetadata);
534
538
  this.pickerSubscriptions = this.pickerService.onFocus.subscribe(this.handleFocus.bind(this));
535
539
  this.pickerSubscriptions.add(this.pickerService.onBlur.subscribe(this.handleBlur.bind(this)));
@@ -562,6 +566,7 @@ export class TimePickerComponent extends MultiTabStop {
562
566
  */
563
567
  ngAfterViewInit() {
564
568
  this.setComponentClasses();
569
+ this.windowSize = this.adaptiveService.size;
565
570
  if (this.actionSheet && isDocumentAvailable()) {
566
571
  // The following syntax is used as it does not violate CSP compliance
567
572
  this.actionSheet.element.nativeElement.style.setProperty('--kendo-actionsheet-height', '60vh');
@@ -775,7 +780,7 @@ export class TimePickerComponent extends MultiTabStop {
775
780
  * @hidden
776
781
  */
777
782
  handleDateInputClick() {
778
- this.windowSize = windowSize();
783
+ this.windowSize = this.adaptiveService.size;
779
784
  if (this.isAdaptive) {
780
785
  this.show = true;
781
786
  }
@@ -847,7 +852,8 @@ export class TimePickerComponent extends MultiTabStop {
847
852
  * @hidden
848
853
  */
849
854
  onResize() {
850
- if (!this.isOpen || this.windowSize === windowSize()) {
855
+ const currentWindowSize = this.adaptiveService.size;
856
+ if (!this.isOpen || this.windowSize === currentWindowSize) {
851
857
  return;
852
858
  }
853
859
  if (this.actionSheet.expanded) {
@@ -856,7 +862,7 @@ export class TimePickerComponent extends MultiTabStop {
856
862
  else {
857
863
  this.togglePopup(false);
858
864
  }
859
- this.windowSize = windowSize();
865
+ this.windowSize = currentWindowSize;
860
866
  }
861
867
  /**
862
868
  * @hidden
@@ -883,12 +889,23 @@ export class TimePickerComponent extends MultiTabStop {
883
889
  }
884
890
  }
885
891
  toggleTimeSelector(show) {
886
- this.windowSize = windowSize();
887
- if (this.isAdaptive) {
888
- this.toggleActionSheet(show);
892
+ const previousWindowSize = this.windowSize;
893
+ this.windowSize = this.adaptiveService.size;
894
+ if (previousWindowSize !== this.windowSize && !show) {
895
+ if (previousWindowSize !== 'large') {
896
+ this.toggleActionSheet(show);
897
+ }
898
+ else {
899
+ this.togglePopup(show);
900
+ }
889
901
  }
890
902
  else {
891
- this.togglePopup(show);
903
+ if (this.isAdaptive) {
904
+ this.toggleActionSheet(show);
905
+ }
906
+ else {
907
+ this.togglePopup(show);
908
+ }
892
909
  }
893
910
  this.toggleFocus();
894
911
  }
@@ -1071,7 +1088,7 @@ export class TimePickerComponent extends MultiTabStop {
1071
1088
  this.renderer.addClass(this.toggleButton.nativeElement, `k-button-${this.fillMode}-base`);
1072
1089
  }
1073
1090
  }
1074
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TimePickerComponent, deps: [{ token: i1.BusViewService }, { token: i0.NgZone }, { token: i2.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i3.PopupService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.Injector }, { token: i4.PickerService }, { token: i5.IntlService }], target: i0.ɵɵFactoryTarget.Component });
1091
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TimePickerComponent, deps: [{ token: i1.BusViewService }, { token: i0.NgZone }, { token: i2.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i3.PopupService }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.Injector }, { token: i4.PickerService }, { token: i5.IntlService }, { token: i6.AdaptiveService }], target: i0.ɵɵFactoryTarget.Component });
1075
1092
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TimePickerComponent, isStandalone: true, selector: "kendo-timepicker", inputs: { focusableId: "focusableId", disabled: "disabled", readonly: "readonly", readOnlyInput: "readOnlyInput", clearButton: "clearButton", format: "format", formatPlaceholder: "formatPlaceholder", placeholder: "placeholder", min: "min", max: "max", incompleteDateValidation: "incompleteDateValidation", autoSwitchParts: "autoSwitchParts", autoSwitchKeys: "autoSwitchKeys", enableMouseWheel: "enableMouseWheel", allowCaretMode: "allowCaretMode", cancelButton: "cancelButton", nowButton: "nowButton", steps: "steps", popupSettings: "popupSettings", tabindex: "tabindex", tabIndex: "tabIndex", title: "title", subtitle: "subtitle", rangeValidation: "rangeValidation", adaptiveMode: "adaptiveMode", value: "value", size: "size", rounded: "rounded", fillMode: "fillMode", inputAttributes: "inputAttributes" }, outputs: { valueChange: "valueChange", onFocus: "focus", onBlur: "blur", open: "open", close: "close", escape: "escape" }, host: { properties: { "class.k-readonly": "this.readonly", "class.k-timepicker": "this.wrapperClasses", "class.k-input": "this.wrapperClasses", "class.k-disabled": "this.disabledClass" } }, providers: [
1076
1093
  { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => TimePickerComponent), multi: true },
1077
1094
  { provide: NG_VALIDATORS, useExisting: forwardRef(() => TimePickerComponent), multi: true },
@@ -1521,7 +1538,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
1521
1538
  standalone: true,
1522
1539
  imports: [TimePickerLocalizedMessagesDirective, DateInputComponent, DateInputCustomMessagesComponent, EventsOutsideAngularDirective, IconWrapperComponent, NgTemplateOutlet, NgIf, ResizeSensorComponent, ActionSheetComponent, ActionSheetTemplateDirective, ButtonComponent, TimeSelectorComponent, TimeSelectorCustomMessagesComponent]
1523
1540
  }]
1524
- }], ctorParameters: function () { return [{ type: i1.BusViewService }, { type: i0.NgZone }, { type: i2.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i3.PopupService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.Injector }, { type: i4.PickerService }, { type: i5.IntlService }]; }, propDecorators: { container: [{
1541
+ }], ctorParameters: function () { return [{ type: i1.BusViewService }, { type: i0.NgZone }, { type: i2.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i3.PopupService }, { type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.Injector }, { type: i4.PickerService }, { type: i5.IntlService }, { type: i6.AdaptiveService }]; }, propDecorators: { container: [{
1525
1542
  type: ViewChild,
1526
1543
  args: ['container', { read: ViewContainerRef, static: false }]
1527
1544
  }], popupTemplate: [{
@@ -12,7 +12,8 @@ import { MinutesService } from './services/minutes.service';
12
12
  import { SecondsService } from './services/seconds.service';
13
13
  import { IconsService } from '@progress/kendo-angular-icons';
14
14
  import { PopupService } from '@progress/kendo-angular-popup';
15
- import { KENDO_TOGGLEBUTTONTABSTOP, ResizeBatchService } from '@progress/kendo-angular-common';
15
+ import { ResizeBatchService, KENDO_TOGGLEBUTTONTABSTOP } from '@progress/kendo-angular-common';
16
+ import { AdaptiveService } from '@progress/kendo-angular-utils';
16
17
  import * as i0 from "@angular/core";
17
18
  import * as i1 from "./localization/timepicker-custom-messages.component";
18
19
  import * as i2 from "./timepicker.component";
@@ -35,6 +36,7 @@ export class TimePickerModule {
35
36
  SecondsService,
36
37
  MillisecondsService,
37
38
  DayPeriodService,
39
+ AdaptiveService
38
40
  ], imports: [i2.TimePickerComponent] });
39
41
  }
40
42
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TimePickerModule, decorators: [{
@@ -52,6 +54,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
52
54
  SecondsService,
53
55
  MillisecondsService,
54
56
  DayPeriodService,
57
+ AdaptiveService
55
58
  ]
56
59
  }]
57
60
  }] });
package/esm2022/util.mjs CHANGED
@@ -6,7 +6,6 @@ import { MS_PER_HOUR, MS_PER_MINUTE, addDays, cloneDate, getDate, isEqual } from
6
6
  import { MIDNIGHT_DATE } from './defaults';
7
7
  import { EMPTY_SELECTIONRANGE } from './calendar/models/selection-range.interface';
8
8
  import { isPresent } from './common/utils';
9
- import { isDocumentAvailable } from '@progress/kendo-angular-common';
10
9
  const isSet = (value) => value !== null && value !== undefined;
11
10
  const setter = (method) => (date, value) => {
12
11
  const clone = cloneDate(date);
@@ -405,20 +404,3 @@ export const DEFAULT_SIZE = 'medium';
405
404
  * @hidden
406
405
  */
407
406
  export const DEFAULT_FILL_MODE = 'solid';
408
- /**
409
- * @hidden
410
- */
411
- export const windowSize = () => {
412
- if (!isDocumentAvailable()) {
413
- return;
414
- }
415
- if (window.innerWidth > 768) {
416
- return 'large';
417
- }
418
- else if (window.innerWidth > 500) {
419
- return 'medium';
420
- }
421
- else {
422
- return 'small';
423
- }
424
- };