@progress/kendo-angular-dateinputs 11.4.0-develop.1 → 11.4.0-develop.11

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.
Files changed (42) hide show
  1. package/calendar/calendar.component.d.ts +18 -1
  2. package/common/adaptive.module.d.ts +18 -0
  3. package/datepicker/datepicker.component.d.ts +57 -6
  4. package/datepicker/datepicker.module.d.ts +2 -1
  5. package/daterange/date-range-popup.component.d.ts +58 -7
  6. package/daterange/date-range-selection.directive.d.ts +12 -2
  7. package/daterange/date-range.module.d.ts +9 -6
  8. package/daterange/localization/daterange-popup-custom-messages.component.d.ts +17 -0
  9. package/daterange/localization/daterange-popup-localized-messages.directive.d.ts +16 -0
  10. package/daterange/localization/messages.d.ts +29 -0
  11. package/datetimepicker/datetimepicker.component.d.ts +58 -5
  12. package/datetimepicker/datetimepicker.module.d.ts +2 -1
  13. package/esm2020/calendar/calendar.component.mjs +34 -2
  14. package/esm2020/calendar/multiview-calendar.component.mjs +2 -1
  15. package/esm2020/common/adaptive.module.mjs +41 -0
  16. package/esm2020/datepicker/datepicker.component.mjs +271 -48
  17. package/esm2020/datepicker/datepicker.module.mjs +7 -3
  18. package/esm2020/daterange/date-range-popup.component.mjs +320 -17
  19. package/esm2020/daterange/date-range-selection.directive.mjs +27 -12
  20. package/esm2020/daterange/date-range.component.mjs +1 -1
  21. package/esm2020/daterange/date-range.module.mjs +16 -5
  22. package/esm2020/daterange/localization/daterange-popup-custom-messages.component.mjs +41 -0
  23. package/esm2020/daterange/localization/daterange-popup-localized-messages.directive.mjs +37 -0
  24. package/esm2020/daterange/localization/messages.mjs +29 -0
  25. package/esm2020/datetimepicker/datetimepicker.component.mjs +306 -49
  26. package/esm2020/datetimepicker/datetimepicker.module.mjs +7 -3
  27. package/esm2020/index.mjs +3 -0
  28. package/esm2020/package-metadata.mjs +2 -2
  29. package/esm2020/timepicker/services/dom.service.mjs +33 -7
  30. package/esm2020/timepicker/timepicker.component.mjs +279 -33
  31. package/esm2020/timepicker/timepicker.module.mjs +5 -2
  32. package/esm2020/timepicker/timeselector.component.mjs +7 -1
  33. package/esm2020/util.mjs +18 -0
  34. package/fesm2015/progress-kendo-angular-dateinputs.mjs +1417 -175
  35. package/fesm2020/progress-kendo-angular-dateinputs.mjs +1417 -175
  36. package/index.d.ts +4 -0
  37. package/package.json +11 -9
  38. package/timepicker/services/dom.service.d.ts +3 -0
  39. package/timepicker/timepicker.component.d.ts +52 -5
  40. package/timepicker/timepicker.module.d.ts +2 -1
  41. package/timepicker/timeselector.component.d.ts +7 -2
  42. package/util.d.ts +12 -0
@@ -16,13 +16,14 @@ import { PickerService } from '../common/picker.service';
16
16
  import { requiresZoneOnBlur, currentFocusTarget, attributeNames } from '../common/utils';
17
17
  import { TIME_PART } from './models/time-part.default';
18
18
  import { PreventableEvent } from '../preventable-event';
19
- import { noop, setTime, isWindowAvailable, getFillModeClass, getSizeClass, getRoundedClass, DEFAULT_FILL_MODE, DEFAULT_ROUNDED, DEFAULT_SIZE } from '../util';
19
+ import { noop, setTime, isWindowAvailable, getFillModeClass, getSizeClass, getRoundedClass, DEFAULT_FILL_MODE, DEFAULT_ROUNDED, DEFAULT_SIZE, windowSize } from '../util';
20
20
  import { timeRangeValidator } from '../validators/time-range.validator';
21
21
  import { TOUCH_ENABLED } from '../touch-enabled';
22
22
  import { fromEvent } from 'rxjs';
23
23
  import { incompleteDateValidator } from '../validators/incomplete-date.validator';
24
24
  import { BusViewService } from '../calendar/services/bus-view.service';
25
- import { clockIcon } from '@progress/kendo-svg-icons';
25
+ import { clockIcon, xIcon } from '@progress/kendo-svg-icons';
26
+ import { ActionSheetComponent } from '@progress/kendo-angular-navigation';
26
27
  import * as i0 from "@angular/core";
27
28
  import * as i1 from "../calendar/services/bus-view.service";
28
29
  import * as i2 from "@progress/kendo-angular-l10n";
@@ -31,10 +32,13 @@ import * as i4 from "../common/picker.service";
31
32
  import * as i5 from "@progress/kendo-angular-intl";
32
33
  import * as i6 from "../dateinput/dateinput.component";
33
34
  import * as i7 from "@progress/kendo-angular-icons";
34
- import * as i8 from "./timeselector.component";
35
- import * as i9 from "./localization/timeselector-custom-messages.component";
36
- import * as i10 from "./localization/timepicker-localized-messages.directive";
37
- import * as i11 from "@progress/kendo-angular-common";
35
+ import * as i8 from "@progress/kendo-angular-common";
36
+ import * as i9 from "@progress/kendo-angular-navigation";
37
+ import * as i10 from "@progress/kendo-angular-buttons";
38
+ import * as i11 from "./timeselector.component";
39
+ import * as i12 from "./localization/timeselector-custom-messages.component";
40
+ import * as i13 from "./localization/timepicker-localized-messages.directive";
41
+ import * as i14 from "@angular/common";
38
42
  const VALUE_DOC_LINK = 'https://www.telerik.com/kendo-angular-ui/components/dateinputs/timepicker/#toc-integration-with-json';
39
43
  const INTL_DATE_FORMAT = 'https://github.com/telerik/kendo-intl/blob/master/docs/date-formatting/index.md';
40
44
  const formatRegExp = new RegExp(`${TIME_PART.hour}|${TIME_PART.minute}|${TIME_PART.second}|${TIME_PART.millisecond}|${TIME_PART.dayperiod}|literal`);
@@ -118,13 +122,18 @@ export class TimePickerComponent {
118
122
  */
119
123
  this.tabindex = 0;
120
124
  /**
121
- * Sets the title of the input element of the TimePicker.
125
+ * Sets the title of the input element of the TimePicker and the title text rendered
126
+ * in the header of the popup(action sheet). Applicable only when [`AdaptiveMode` is set to `auto`](slug:api_dateinputs_adaptivemode).
122
127
  */
123
128
  this.title = "";
124
129
  /**
125
130
  * Determines whether the built-in min or max validators are enforced when a form is being validated.
126
131
  */
127
132
  this.rangeValidation = true;
133
+ /**
134
+ * Enables or disables the adaptive mode. By default the adaptive rendering is disabled.
135
+ */
136
+ this.adaptiveMode = 'none';
128
137
  /**
129
138
  * Fires each time the user selects a new value.
130
139
  * For more information, refer to the section on
@@ -195,6 +204,10 @@ export class TimePickerComponent {
195
204
  * @hidden
196
205
  */
197
206
  this.wrapperClasses = true;
207
+ /**
208
+ * @hidden
209
+ */
210
+ this.xIcon = xIcon;
198
211
  this.onControlChange = noop;
199
212
  this.onControlTouched = noop;
200
213
  this.onValidatorChange = noop;
@@ -287,6 +300,16 @@ export class TimePickerComponent {
287
300
  get tabIndex() {
288
301
  return this.tabindex;
289
302
  }
303
+ /**
304
+ * Sets the subtitle text rendered in the header of the popup(action sheet).
305
+ * Applicable only when [`AdaptiveMode` is set to `auto`](slug:api_dateinputs_adaptivemode).
306
+ */
307
+ set subtitle(subtitle) {
308
+ this._subtitle = subtitle;
309
+ }
310
+ get subtitle() {
311
+ return this._subtitle || this.placeholder;
312
+ }
290
313
  /**
291
314
  * Specifies the value of the TimePicker component.
292
315
  */
@@ -400,14 +423,24 @@ export class TimePickerComponent {
400
423
  if (show && (this.disabled || this.readonly)) {
401
424
  return;
402
425
  }
403
- const skipZone = !show && (!this._show || !hasObservers(this.close));
426
+ const skipZone = !show && (!this._show || (!hasObservers(this.close) && !hasObservers(this.open)));
404
427
  if (!skipZone) {
405
428
  this.zone.run(() => {
406
- this.togglePopup(show);
429
+ const event = new PreventableEvent();
430
+ if (!this._show && show) {
431
+ this.open.emit(event);
432
+ }
433
+ else if (this._show && !show) {
434
+ this.close.emit(event);
435
+ }
436
+ if (event.isDefaultPrevented()) {
437
+ return;
438
+ }
439
+ this.toggleTimeSelector(show);
407
440
  });
408
441
  }
409
442
  else {
410
- this.togglePopup(show);
443
+ this.toggleTimeSelector(show);
411
444
  }
412
445
  }
413
446
  get input() {
@@ -442,6 +475,7 @@ export class TimePickerComponent {
442
475
  */
443
476
  ngAfterViewInit() {
444
477
  this.setComponentClasses();
478
+ this.renderer.setAttribute(this.actionSheet.element.nativeElement, 'style', '--kendo-actionsheet-height: 60vh; --kendo-actionsheet-max-height: none');
445
479
  }
446
480
  /**
447
481
  * @hidden
@@ -561,7 +595,8 @@ export class TimePickerComponent {
561
595
  (this.timeSelector || this.input)['blur']();
562
596
  }
563
597
  /**
564
- * Toggles the visibility of the popup. If you use the `toggle` method to show or hide the popup,
598
+ * Toggles the visibility of the popup or actionSheet.
599
+ * If you use the `toggle` method to show or hide the popup or actionSheet,
565
600
  * the `open` and `close` events do not fire.
566
601
  *
567
602
  * @param show - The state of the popup.
@@ -571,11 +606,11 @@ export class TimePickerComponent {
571
606
  return;
572
607
  }
573
608
  this.resolvedPromise.then(() => {
574
- this._toggle((show === undefined) ? !this.show : show);
609
+ this.toggleTimeSelector((show === undefined) ? !this.show : show);
575
610
  });
576
611
  }
577
612
  /**
578
- * Returns the current open state of the popup.
613
+ * Indicates whether the component is currently open. That is when the popup or actionSheet is open.
579
614
  */
580
615
  get isOpen() {
581
616
  return this.show;
@@ -607,6 +642,19 @@ export class TimePickerComponent {
607
642
  this.valueChange.emit(cloneDate(value));
608
643
  });
609
644
  }
645
+ /**
646
+ * @hidden
647
+ */
648
+ handleActionSheetAccept() {
649
+ this.timeSelector.handleAccept();
650
+ }
651
+ /**
652
+ * @hidden
653
+ */
654
+ handleActionSheetCollapse() {
655
+ // If not handled, the actionsheet expanded state does not get updated when overlay is clicked
656
+ this.cdr.markForCheck();
657
+ }
610
658
  /**
611
659
  * @hidden
612
660
  */
@@ -620,6 +668,15 @@ export class TimePickerComponent {
620
668
  const val = this.input.formatSections['date'] ? value : this.mergeTime(value);
621
669
  this.handleChange(val);
622
670
  }
671
+ /**
672
+ * @hidden
673
+ */
674
+ handleDateInputClick() {
675
+ this.windowSize = windowSize();
676
+ if (this.isAdaptive) {
677
+ this.show = true;
678
+ }
679
+ }
623
680
  /**
624
681
  * @hidden
625
682
  */
@@ -650,6 +707,18 @@ export class TimePickerComponent {
650
707
  'k-reset'
651
708
  ].concat(this.popupSettings.popupClass || []);
652
709
  }
710
+ /**
711
+ * @hidden
712
+ */
713
+ get isAdaptiveModeEnabled() {
714
+ return this.adaptiveMode === 'auto';
715
+ }
716
+ /**
717
+ * @hidden
718
+ */
719
+ get isAdaptive() {
720
+ return this.isAdaptiveModeEnabled && this.windowSize !== 'large';
721
+ }
653
722
  /**
654
723
  * @hidden
655
724
  */
@@ -662,21 +731,48 @@ export class TimePickerComponent {
662
731
  mergeTime(value) {
663
732
  return this.value && value ? setTime(this.value, value) : value;
664
733
  }
665
- togglePopup(show) {
666
- const event = new PreventableEvent();
667
- if (!this._show && show) {
668
- this.open.emit(event);
734
+ /**
735
+ * @hidden
736
+ */
737
+ onResize() {
738
+ if (!this.isOpen || this.windowSize === windowSize()) {
739
+ return;
669
740
  }
670
- else if (this._show && !show) {
671
- this.close.emit(event);
741
+ ;
742
+ if (this.actionSheet.expanded) {
743
+ this.toggleActionSheet(false);
672
744
  }
673
- if (event.isDefaultPrevented()) {
674
- return;
745
+ else {
746
+ this.togglePopup(false);
747
+ }
748
+ this.windowSize = windowSize();
749
+ }
750
+ toggleTimeSelector(show) {
751
+ this.windowSize = windowSize();
752
+ if (this.isAdaptive) {
753
+ this.toggleActionSheet(show);
754
+ }
755
+ else {
756
+ this.togglePopup(show);
675
757
  }
676
- this._toggle(show);
677
758
  this.toggleFocus();
678
759
  }
679
- _toggle(show) {
760
+ toggleActionSheet(show) {
761
+ if (show === this._show) {
762
+ return;
763
+ }
764
+ if (show && !this.isOpen) {
765
+ this.actionSheet.toggle();
766
+ this.updateActionSheetAdaptiveAppearance();
767
+ }
768
+ else if (!show && this.isOpen) {
769
+ // Need to disable the pointer events to avoid triggering focus on the timelist when acionsheet close down animation starts
770
+ this.renderer.setStyle(this.timeSelector.element.nativeElement, 'pointer-events', 'none');
771
+ this.actionSheet.toggle();
772
+ }
773
+ this._show = show;
774
+ }
775
+ togglePopup(show) {
680
776
  if (show === this.isOpen) {
681
777
  return;
682
778
  }
@@ -705,6 +801,25 @@ export class TimePickerComponent {
705
801
  this.renderer.removeAttribute(inputElement, attributeNames.ariaControls);
706
802
  }
707
803
  }
804
+ updateActionSheetAdaptiveAppearance() {
805
+ let element;
806
+ let animationContainer;
807
+ if (this.actionSheet) {
808
+ element = this.actionSheet['element'].nativeElement.querySelector('.k-actionsheet');
809
+ animationContainer = this.actionSheet['element'].nativeElement.querySelector('.k-child-animation-container');
810
+ if (this.windowSize === 'medium') {
811
+ this.renderer.removeClass(element, 'k-actionsheet-fullscreen');
812
+ this.renderer.removeStyle(animationContainer, 'height');
813
+ }
814
+ else if (this.windowSize === 'small') {
815
+ this.renderer.addClass(element, 'k-actionsheet-fullscreen');
816
+ this.renderer.setStyle(animationContainer, 'height', '100%');
817
+ }
818
+ this.renderer.addClass(element, 'k-adaptive-actionsheet');
819
+ this.renderer.addClass(element, 'k-actionsheet-bottom');
820
+ this.renderer.setStyle(animationContainer, 'bottom', '0px');
821
+ }
822
+ }
708
823
  focusInput() {
709
824
  if (this.touchEnabled) {
710
825
  return;
@@ -755,7 +870,7 @@ export class TimePickerComponent {
755
870
  }
756
871
  }
757
872
  handleWindowBlur() {
758
- if (!this.isOpen) {
873
+ if (!this.isOpen || this.actionSheet.expanded) {
759
874
  return;
760
875
  }
761
876
  this.show = false;
@@ -772,9 +887,11 @@ export class TimePickerComponent {
772
887
  }
773
888
  }
774
889
  handleBlur(args) {
775
- const currentTarget = args && currentFocusTarget(args);
890
+ const currentTarget = args && currentFocusTarget(args); // relatedTarget || activeElement
891
+ const target = args && args.target;
892
+ const isInsideActionSheet = this.actionSheet && (this.actionSheet.element.nativeElement.contains(target) || this.actionSheet.element.nativeElement.contains(currentTarget));
776
893
  if (currentTarget && (this.input.containsElement(currentTarget) ||
777
- (this.timeSelector && this.timeSelector.containsElement(currentTarget)))) {
894
+ (this.timeSelector && this.timeSelector.containsElement(currentTarget)) || isInsideActionSheet)) {
778
895
  return;
779
896
  }
780
897
  if (hasObservers(this.onBlur) || (this.show && hasObservers(this.close)) || requiresZoneOnBlur(this.control)) {
@@ -814,7 +931,7 @@ export class TimePickerComponent {
814
931
  }
815
932
  }
816
933
  TimePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.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: TOUCH_ENABLED, optional: true }], target: i0.ɵɵFactoryTarget.Component });
817
- TimePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: TimePickerComponent, selector: "kendo-timepicker", inputs: { focusableId: "focusableId", disabled: "disabled", readonly: "readonly", readOnlyInput: "readOnlyInput", format: "format", formatPlaceholder: "formatPlaceholder", placeholder: "placeholder", min: "min", max: "max", incompleteDateValidation: "incompleteDateValidation", cancelButton: "cancelButton", nowButton: "nowButton", steps: "steps", popupSettings: "popupSettings", tabindex: "tabindex", tabIndex: "tabIndex", title: "title", rangeValidation: "rangeValidation", value: "value", size: "size", rounded: "rounded", fillMode: "fillMode" }, outputs: { valueChange: "valueChange", onFocus: "focus", onBlur: "blur", open: "open", close: "close" }, host: { properties: { "class.k-timepicker": "this.wrapperClasses", "class.k-input": "this.wrapperClasses", "class.k-disabled": "this.disabledClass" } }, providers: [
934
+ TimePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: TimePickerComponent, selector: "kendo-timepicker", inputs: { focusableId: "focusableId", disabled: "disabled", readonly: "readonly", readOnlyInput: "readOnlyInput", format: "format", formatPlaceholder: "formatPlaceholder", placeholder: "placeholder", min: "min", max: "max", incompleteDateValidation: "incompleteDateValidation", 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" }, outputs: { valueChange: "valueChange", onFocus: "focus", onBlur: "blur", open: "open", close: "close" }, host: { properties: { "class.k-timepicker": "this.wrapperClasses", "class.k-input": "this.wrapperClasses", "class.k-disabled": "this.disabledClass" } }, providers: [
818
935
  { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => TimePickerComponent), multi: true },
819
936
  { provide: NG_VALIDATORS, useExisting: forwardRef(() => TimePickerComponent), multi: true },
820
937
  { provide: KendoInput, useExisting: forwardRef(() => TimePickerComponent) },
@@ -825,7 +942,7 @@ TimePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
825
942
  useValue: 'kendo.timepicker'
826
943
  },
827
944
  PickerService
828
- ], viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true }, { propertyName: "toggleButton", first: true, predicate: ["toggleButton"], descendants: true, static: true }], exportAs: ["kendo-timepicker"], usesOnChanges: true, ngImport: i0, template: `
945
+ ], viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef }, { propertyName: "popupTemplate", first: true, predicate: ["popupTemplate"], descendants: true }, { propertyName: "toggleButton", first: true, predicate: ["toggleButton"], descendants: true, static: true }, { propertyName: "actionSheet", first: true, predicate: ["actionSheet"], descendants: true }], exportAs: ["kendo-timepicker"], usesOnChanges: true, ngImport: i0, template: `
829
946
  <ng-container kendoTimePickerLocalizedMessages
830
947
  i18n-accept="kendo.timepicker.accept|The Accept button text in the timepicker component"
831
948
  accept="Set"
@@ -888,6 +1005,7 @@ TimePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
888
1005
  [title]="title"
889
1006
  [value]="value"
890
1007
  (valueChange)="handleInputChange($event)"
1008
+ (click)="handleDateInputClick()"
891
1009
  ></kendo-dateinput>
892
1010
  <button
893
1011
  #toggleButton
@@ -910,15 +1028,76 @@ TimePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
910
1028
  </kendo-icon-wrapper>
911
1029
  </button>
912
1030
  <ng-template #popupTemplate>
1031
+ <ng-container *ngTemplateOutlet="timeSelectorTemplate"></ng-container>
1032
+ </ng-template>
1033
+ <ng-container #container></ng-container>
1034
+
1035
+ <kendo-resize-sensor *ngIf="isAdaptiveModeEnabled" (resize)="onResize()"></kendo-resize-sensor>
1036
+ <kendo-actionsheet
1037
+ #actionSheet
1038
+ (overlayClick)="show=false"
1039
+ (collapse)="handleActionSheetCollapse()"
1040
+ >
1041
+ <ng-template kendoActionSheetTemplate>
1042
+ <div class="k-actionsheet-titlebar">
1043
+ <div class="k-actionsheet-titlebar-group k-hbox">
1044
+ <div class="k-actionsheet-title">
1045
+ <div class="k-text-center">{{ title }}</div>
1046
+ <div class="k-actionsheet-subtitle k-text-center">{{ subtitle }}</div>
1047
+ </div>
1048
+ <div class="k-actionsheet-actions">
1049
+ <button
1050
+ kendoButton
1051
+ icon="x"
1052
+ [attr.title]="localization.get('clearTitle')"
1053
+ [svgIcon]="xIcon"
1054
+ fillMode="flat"
1055
+ size="large"
1056
+ innerCssClass="k-button-icon"
1057
+ (click)="show = false">
1058
+ </button>
1059
+ </div>
1060
+ </div>
1061
+ </div>
1062
+ <div class="k-actionsheet-content !k-overflow-hidden">
1063
+ <ng-container *ngTemplateOutlet="timeSelectorTemplate"></ng-container>
1064
+ </div>
1065
+ <div class="k-actions k-actions-stretched k-actions-horizontal k-actionsheet-footer">
1066
+ <button kendoButton
1067
+ (click)="handleReject()"
1068
+ size="large"
1069
+ [attr.title]="localization.get('cancelLabel')"
1070
+ [attr.aria-label]="localization.get('cancelLabel')"
1071
+ >
1072
+ {{localization.get('cancel')}}
1073
+ </button>
1074
+
1075
+ <button kendoButton
1076
+ (click)="handleActionSheetAccept()"
1077
+ size="large"
1078
+ themeColor="primary"
1079
+ [attr.title]="localization.get('acceptLabel')"
1080
+ [attr.aria-label]="localization.get('acceptLabel')"
1081
+ >
1082
+ {{localization.get('accept')}}
1083
+ </button>
1084
+ </div>
1085
+ </ng-template>
1086
+ </kendo-actionsheet>
1087
+
1088
+ <ng-template #timeSelectorTemplate>
913
1089
  <kendo-timeselector
914
1090
  #timeSelector
915
- [cancelButton]="cancelButton"
1091
+ [class.k-timeselector-lg]="isAdaptive"
1092
+ [cancelButton]="cancelButton && !this.isAdaptive"
1093
+ [setButton]="!isAdaptive"
916
1094
  [nowButton]="nowButton"
917
1095
  [format]="format"
918
1096
  [min]="min"
919
1097
  [max]="max"
920
1098
  [steps]="steps"
921
1099
  [value]="value"
1100
+ [isAdaptiveEnabled]="isAdaptiveModeEnabled"
922
1101
  [kendoEventsOutsideAngular]="{
923
1102
  keydown: handleKeydown,
924
1103
  mousedown: handleMousedown
@@ -943,8 +1122,7 @@ TimePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
943
1122
  </kendo-timeselector-messages>
944
1123
  </kendo-timeselector>
945
1124
  </ng-template>
946
- <ng-container #container></ng-container>
947
- `, isInline: true, components: [{ type: i6.DateInputComponent, selector: "kendo-dateinput", inputs: ["focusableId", "pickerType", "disabled", "readonly", "title", "tabindex", "role", "ariaReadOnly", "tabIndex", "format", "formatPlaceholder", "placeholder", "steps", "max", "min", "rangeValidation", "autoCorrect", "incompleteDateValidation", "twoDigitYearMax", "value", "spinners", "isPopupOpen", "hasPopup", "size", "rounded", "fillMode"], outputs: ["valueChange", "valueUpdate", "focus", "blur"], exportAs: ["kendo-dateinput"] }, { type: i7.IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass"], exportAs: ["kendoIconWrapper"] }, { type: i8.TimeSelectorComponent, selector: "kendo-timeselector", inputs: ["format", "min", "max", "cancelButton", "setButton", "nowButton", "disabled", "steps", "value"], outputs: ["valueChange", "valueReject"], exportAs: ["kendo-timeselector"] }, { type: i9.TimeSelectorCustomMessagesComponent, selector: "kendo-timeselector-messages" }], directives: [{ type: i10.TimePickerLocalizedMessagesDirective, selector: "[kendoTimePickerLocalizedMessages]" }, { type: i11.EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1125
+ `, isInline: true, components: [{ type: i6.DateInputComponent, selector: "kendo-dateinput", inputs: ["focusableId", "pickerType", "disabled", "readonly", "title", "tabindex", "role", "ariaReadOnly", "tabIndex", "format", "formatPlaceholder", "placeholder", "steps", "max", "min", "rangeValidation", "autoCorrect", "incompleteDateValidation", "twoDigitYearMax", "value", "spinners", "isPopupOpen", "hasPopup", "size", "rounded", "fillMode"], outputs: ["valueChange", "valueUpdate", "focus", "blur"], exportAs: ["kendo-dateinput"] }, { type: i7.IconWrapperComponent, selector: "kendo-icon-wrapper", inputs: ["name", "svgIcon", "innerCssClass", "customFontClass"], exportAs: ["kendoIconWrapper"] }, { type: i8.ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }, { type: i9.ActionSheetComponent, selector: "kendo-actionsheet", inputs: ["title", "subtitle", "items", "cssClass", "animation", "expanded"], outputs: ["expandedChange", "expand", "collapse", "itemClick", "overlayClick"], exportAs: ["kendoActionSheet"] }, { type: i10.Button, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { type: i11.TimeSelectorComponent, selector: "kendo-timeselector", inputs: ["format", "min", "max", "cancelButton", "setButton", "nowButton", "disabled", "isAdaptiveEnabled", "isDateTimePicker", "steps", "value"], outputs: ["valueChange", "valueReject"], exportAs: ["kendo-timeselector"] }, { type: i12.TimeSelectorCustomMessagesComponent, selector: "kendo-timeselector-messages" }], directives: [{ type: i13.TimePickerLocalizedMessagesDirective, selector: "[kendoTimePickerLocalizedMessages]" }, { type: i8.EventsOutsideAngularDirective, selector: "[kendoEventsOutsideAngular]", inputs: ["kendoEventsOutsideAngular", "scope"] }, { type: i14.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i14.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i9.ActionSheetTemplateDirective, selector: "[kendoActionSheetTemplate]" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
948
1126
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: TimePickerComponent, decorators: [{
949
1127
  type: Component,
950
1128
  args: [{
@@ -1026,6 +1204,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1026
1204
  [title]="title"
1027
1205
  [value]="value"
1028
1206
  (valueChange)="handleInputChange($event)"
1207
+ (click)="handleDateInputClick()"
1029
1208
  ></kendo-dateinput>
1030
1209
  <button
1031
1210
  #toggleButton
@@ -1048,15 +1227,76 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1048
1227
  </kendo-icon-wrapper>
1049
1228
  </button>
1050
1229
  <ng-template #popupTemplate>
1230
+ <ng-container *ngTemplateOutlet="timeSelectorTemplate"></ng-container>
1231
+ </ng-template>
1232
+ <ng-container #container></ng-container>
1233
+
1234
+ <kendo-resize-sensor *ngIf="isAdaptiveModeEnabled" (resize)="onResize()"></kendo-resize-sensor>
1235
+ <kendo-actionsheet
1236
+ #actionSheet
1237
+ (overlayClick)="show=false"
1238
+ (collapse)="handleActionSheetCollapse()"
1239
+ >
1240
+ <ng-template kendoActionSheetTemplate>
1241
+ <div class="k-actionsheet-titlebar">
1242
+ <div class="k-actionsheet-titlebar-group k-hbox">
1243
+ <div class="k-actionsheet-title">
1244
+ <div class="k-text-center">{{ title }}</div>
1245
+ <div class="k-actionsheet-subtitle k-text-center">{{ subtitle }}</div>
1246
+ </div>
1247
+ <div class="k-actionsheet-actions">
1248
+ <button
1249
+ kendoButton
1250
+ icon="x"
1251
+ [attr.title]="localization.get('clearTitle')"
1252
+ [svgIcon]="xIcon"
1253
+ fillMode="flat"
1254
+ size="large"
1255
+ innerCssClass="k-button-icon"
1256
+ (click)="show = false">
1257
+ </button>
1258
+ </div>
1259
+ </div>
1260
+ </div>
1261
+ <div class="k-actionsheet-content !k-overflow-hidden">
1262
+ <ng-container *ngTemplateOutlet="timeSelectorTemplate"></ng-container>
1263
+ </div>
1264
+ <div class="k-actions k-actions-stretched k-actions-horizontal k-actionsheet-footer">
1265
+ <button kendoButton
1266
+ (click)="handleReject()"
1267
+ size="large"
1268
+ [attr.title]="localization.get('cancelLabel')"
1269
+ [attr.aria-label]="localization.get('cancelLabel')"
1270
+ >
1271
+ {{localization.get('cancel')}}
1272
+ </button>
1273
+
1274
+ <button kendoButton
1275
+ (click)="handleActionSheetAccept()"
1276
+ size="large"
1277
+ themeColor="primary"
1278
+ [attr.title]="localization.get('acceptLabel')"
1279
+ [attr.aria-label]="localization.get('acceptLabel')"
1280
+ >
1281
+ {{localization.get('accept')}}
1282
+ </button>
1283
+ </div>
1284
+ </ng-template>
1285
+ </kendo-actionsheet>
1286
+
1287
+ <ng-template #timeSelectorTemplate>
1051
1288
  <kendo-timeselector
1052
1289
  #timeSelector
1053
- [cancelButton]="cancelButton"
1290
+ [class.k-timeselector-lg]="isAdaptive"
1291
+ [cancelButton]="cancelButton && !this.isAdaptive"
1292
+ [setButton]="!isAdaptive"
1054
1293
  [nowButton]="nowButton"
1055
1294
  [format]="format"
1056
1295
  [min]="min"
1057
1296
  [max]="max"
1058
1297
  [steps]="steps"
1059
1298
  [value]="value"
1299
+ [isAdaptiveEnabled]="isAdaptiveModeEnabled"
1060
1300
  [kendoEventsOutsideAngular]="{
1061
1301
  keydown: handleKeydown,
1062
1302
  mousedown: handleMousedown
@@ -1081,7 +1321,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1081
1321
  </kendo-timeselector-messages>
1082
1322
  </kendo-timeselector>
1083
1323
  </ng-template>
1084
- <ng-container #container></ng-container>
1085
1324
  `
1086
1325
  }]
1087
1326
  }], 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: undefined, decorators: [{
@@ -1098,6 +1337,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1098
1337
  }], toggleButton: [{
1099
1338
  type: ViewChild,
1100
1339
  args: ['toggleButton', { static: true }]
1340
+ }], actionSheet: [{
1341
+ type: ViewChild,
1342
+ args: ['actionSheet']
1101
1343
  }], focusableId: [{
1102
1344
  type: Input
1103
1345
  }], disabled: [{
@@ -1132,8 +1374,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1132
1374
  type: Input
1133
1375
  }], title: [{
1134
1376
  type: Input
1377
+ }], subtitle: [{
1378
+ type: Input
1135
1379
  }], rangeValidation: [{
1136
1380
  type: Input
1381
+ }], adaptiveMode: [{
1382
+ type: Input
1137
1383
  }], value: [{
1138
1384
  type: Input
1139
1385
  }], size: [{
@@ -25,6 +25,7 @@ import { touchEnabled } from '@progress/kendo-common';
25
25
  import { TOUCH_ENABLED } from '../touch-enabled';
26
26
  import { EventsModule } from '@progress/kendo-angular-common';
27
27
  import { IconsModule } from '@progress/kendo-angular-icons';
28
+ import { AdaptiveModule } from '../common/adaptive.module';
28
29
  import * as i0 from "@angular/core";
29
30
  const COMPONENT_DIRECTIVES = [
30
31
  TimePickerLocalizedMessagesDirective,
@@ -41,7 +42,8 @@ const COMPONENT_MODULES = [
41
42
  PopupModule,
42
43
  VirtualizationModule,
43
44
  EventsModule,
44
- IconsModule
45
+ IconsModule,
46
+ AdaptiveModule
45
47
  ];
46
48
  const providers = [
47
49
  TimePickerDOMService,
@@ -73,7 +75,8 @@ TimePickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", versio
73
75
  PopupModule,
74
76
  VirtualizationModule,
75
77
  EventsModule,
76
- IconsModule], exports: [TimePickerLocalizedMessagesDirective,
78
+ IconsModule,
79
+ AdaptiveModule], exports: [TimePickerLocalizedMessagesDirective,
77
80
  TimeListComponent,
78
81
  TimePickerCustomMessagesComponent,
79
82
  TimePickerComponent,
@@ -178,6 +178,8 @@ export class TimeSelectorComponent {
178
178
  .subscribe(() => this.cdr.markForCheck()));
179
179
  }
180
180
  this.renderer.addClass(this.element.nativeElement, 'k-timeselector');
181
+ this.dom.isAdaptiveEnabled = this.isAdaptiveEnabled;
182
+ this.dom.isDateTimePicker = this.isDateTimePicker;
181
183
  this.dom.calculateHeights(this.element.nativeElement);
182
184
  this.init();
183
185
  this.bindEvents();
@@ -373,7 +375,7 @@ export class TimeSelectorComponent {
373
375
  }
374
376
  }
375
377
  TimeSelectorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: TimeSelectorComponent, deps: [{ token: i1.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i2.IntlService }, { token: i3.TimePickerDOMService }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i4.PickerService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
376
- TimeSelectorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: TimeSelectorComponent, selector: "kendo-timeselector", inputs: { format: "format", min: "min", max: "max", cancelButton: "cancelButton", setButton: "setButton", nowButton: "nowButton", disabled: "disabled", steps: "steps", value: "value" }, outputs: { valueChange: "valueChange", valueReject: "valueReject" }, host: { properties: { "class.k-disabled": "this.disabledClass" } }, providers: [
378
+ TimeSelectorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: TimeSelectorComponent, selector: "kendo-timeselector", inputs: { format: "format", min: "min", max: "max", cancelButton: "cancelButton", setButton: "setButton", nowButton: "nowButton", disabled: "disabled", isAdaptiveEnabled: "isAdaptiveEnabled", isDateTimePicker: "isDateTimePicker", steps: "steps", value: "value" }, outputs: { valueChange: "valueChange", valueReject: "valueReject" }, host: { properties: { "class.k-disabled": "this.disabledClass" } }, providers: [
377
379
  LocalizationService,
378
380
  {
379
381
  provide: L10N_PREFIX,
@@ -635,6 +637,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
635
637
  type: Input
636
638
  }], disabled: [{
637
639
  type: Input
640
+ }], isAdaptiveEnabled: [{
641
+ type: Input
642
+ }], isDateTimePicker: [{
643
+ type: Input
638
644
  }], steps: [{
639
645
  type: Input
640
646
  }], value: [{
package/esm2020/util.mjs CHANGED
@@ -6,6 +6,7 @@ import { addDays, cloneDate, getDate, isEqual } from '@progress/kendo-date-math'
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';
9
10
  const isSet = (value) => value !== null && value !== undefined;
10
11
  const setter = (method) => (date, value) => {
11
12
  const clone = cloneDate(date);
@@ -394,3 +395,20 @@ export const DEFAULT_SIZE = 'medium';
394
395
  * @hidden
395
396
  */
396
397
  export const DEFAULT_FILL_MODE = 'solid';
398
+ /**
399
+ * @hidden
400
+ */
401
+ export const windowSize = () => {
402
+ if (!isDocumentAvailable()) {
403
+ return;
404
+ }
405
+ if (window.innerWidth > 768) {
406
+ return 'large';
407
+ }
408
+ else if (window.innerWidth > 500) {
409
+ return 'medium';
410
+ }
411
+ else {
412
+ return 'small';
413
+ }
414
+ };