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

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
@@ -2,8 +2,8 @@
2
2
  * Copyright © 2023 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { Component, ContentChild, ContentChildren, ChangeDetectorRef, ElementRef, EventEmitter, TemplateRef, NgZone, Input, Output, ViewChild, ViewChildren, ViewContainerRef, Inject, QueryList, Optional } from '@angular/core';
6
- import { RTL } from '@progress/kendo-angular-l10n';
5
+ import { Component, ContentChild, ContentChildren, ChangeDetectorRef, ElementRef, EventEmitter, TemplateRef, NgZone, Input, Output, ViewChild, ViewChildren, ViewContainerRef, Inject, QueryList, Optional, Renderer2 } from '@angular/core';
6
+ import { L10N_PREFIX, LocalizationService, RTL } from '@progress/kendo-angular-l10n';
7
7
  import { PopupService } from '@progress/kendo-angular-popup';
8
8
  import { DateRangePopupTemplateDirective } from './date-range-popup-template.directive';
9
9
  import { DateRangeService } from './date-range.service';
@@ -12,13 +12,22 @@ import { PreventableEvent } from '../preventable-event';
12
12
  import { isDocumentAvailable, guid, Keys, hasObservers } from '@progress/kendo-angular-common';
13
13
  import { Subscription, fromEvent, merge } from 'rxjs';
14
14
  import { filter, map } from 'rxjs/operators';
15
- import { isWindowAvailable } from '../util';
15
+ import { isWindowAvailable, windowSize } from '../util';
16
16
  import { isPresent } from '../common/utils';
17
+ import { xIcon } from '@progress/kendo-svg-icons';
18
+ import { DateRangeSelectionDirective } from './date-range-selection.directive';
19
+ import { ActionSheetComponent } from '@progress/kendo-angular-navigation';
17
20
  import * as i0 from "@angular/core";
18
21
  import * as i1 from "@progress/kendo-angular-popup";
19
22
  import * as i2 from "./date-range.service";
20
- import * as i3 from "../calendar/multiview-calendar.component";
21
- import * as i4 from "./date-range-selection.directive";
23
+ import * as i3 from "@progress/kendo-angular-l10n";
24
+ import * as i4 from "../calendar/multiview-calendar.component";
25
+ import * as i5 from "@progress/kendo-angular-navigation";
26
+ import * as i6 from "@progress/kendo-angular-common";
27
+ import * as i7 from "@progress/kendo-angular-buttons";
28
+ import * as i8 from "./localization/daterange-popup-localized-messages.directive";
29
+ import * as i9 from "./date-range-selection.directive";
30
+ import * as i10 from "@angular/common";
22
31
  /**
23
32
  * Represents the Kendo UI DateRangePopup component for Angular.
24
33
  *
@@ -39,11 +48,14 @@ import * as i4 from "./date-range-selection.directive";
39
48
  * ```
40
49
  */
41
50
  export class DateRangePopupComponent {
42
- constructor(popupService, dateRangeService, ref, zone, rtl) {
51
+ constructor(popupService, dateRangeService, ref, zone, renderer, localization, cdr, rtl) {
43
52
  this.popupService = popupService;
44
53
  this.dateRangeService = dateRangeService;
45
54
  this.ref = ref;
46
55
  this.zone = zone;
56
+ this.renderer = renderer;
57
+ this.localization = localization;
58
+ this.cdr = cdr;
47
59
  this.rtl = rtl;
48
60
  /**
49
61
  * Controls the popup animation.
@@ -58,6 +70,15 @@ export class DateRangePopupComponent {
58
70
  * [viewport boundary detection]({% slug viewportboundarydetection_popup %}).
59
71
  */
60
72
  this.collision = { horizontal: 'fit', vertical: 'flip' };
73
+ /**
74
+ * Enables or disables the adaptive mode. By default the adaptive rendering is disabled.
75
+ */
76
+ this.adaptiveMode = 'none';
77
+ /**
78
+ * Sets the title of the input element of the DateRangePopup and the title text rendered
79
+ * in the header of the popup(action sheet). Applicable only when [`AdaptiveMode` is set to `auto`](slug:api_dateinputs_adaptivemode).
80
+ */
81
+ this.title = "";
61
82
  /**
62
83
  * Fires each time the popup is about to open.
63
84
  * This event is preventable. If you cancel the event, the popup will remain closed.
@@ -88,10 +109,25 @@ export class DateRangePopupComponent {
88
109
  * @hidden
89
110
  */
90
111
  this.popupUID = guid();
112
+ /**
113
+ * @hidden
114
+ */
115
+ this.xIcon = xIcon;
91
116
  this.calendarSubscriptions = new Subscription();
92
117
  this.popupSubscriptions = new Subscription();
118
+ this.localizationSubscriptions = new Subscription();
93
119
  this.resolvedPromise = Promise.resolve();
94
120
  }
121
+ /**
122
+ * Sets the subtitle text rendered in the header of the popup(action sheet).
123
+ * Applicable only when [`AdaptiveMode` is set to `auto`](slug:api_dateinputs_adaptivemode).
124
+ */
125
+ set subtitle(subtitle) {
126
+ this._subtitle = subtitle;
127
+ }
128
+ get subtitle() {
129
+ return this._subtitle;
130
+ }
95
131
  /**
96
132
  * The active calendar that is visible in the popup.
97
133
  *
@@ -109,7 +145,23 @@ export class DateRangePopupComponent {
109
145
  * When the opened calendar is active, returns `true`.
110
146
  */
111
147
  get isActive() {
112
- return this.calendar && this.calendar.isActive;
148
+ // The actionsheet is expanding before the calendar gets activated
149
+ // and if we only check for calendar.isActive a blur event handler in the date-rage-input.ts will close the actionsheet
150
+ // TODO: Potentially the entire logic would need refactoring to avoid hacks like this one
151
+ return (this.calendar && this.calendar.isActive)
152
+ || (this.actionSheet && this.actionSheet.expanded);
153
+ }
154
+ /**
155
+ * @hidden
156
+ */
157
+ get isAdaptiveModeEnabled() {
158
+ return this.adaptiveMode === 'auto';
159
+ }
160
+ /**
161
+ * @hidden
162
+ */
163
+ get isAdaptive() {
164
+ return this.isAdaptiveModeEnabled && this.windowSize !== 'large';
113
165
  }
114
166
  /**
115
167
  * Gets or sets the visibility state of the component.
@@ -128,13 +180,18 @@ export class DateRangePopupComponent {
128
180
  if (event.isDefaultPrevented()) {
129
181
  return;
130
182
  }
131
- this._toggle(show);
183
+ this.toggleDateRange(show);
132
184
  }
133
185
  get show() {
134
186
  return this._show;
135
187
  }
136
188
  ngOnInit() {
137
189
  this.dateRangeService.registerPopup(this);
190
+ if (this.localization) {
191
+ this.localizationSubscriptions.add(this.localization
192
+ .changes
193
+ .subscribe(() => this.cdr.markForCheck()));
194
+ }
138
195
  }
139
196
  ngAfterViewInit() {
140
197
  this.calendarSubscriptions.add(this.contentCalendar.changes.subscribe((changes) => this.calendar = changes.first));
@@ -142,6 +199,7 @@ export class DateRangePopupComponent {
142
199
  if (isWindowAvailable()) {
143
200
  this.zone.runOutsideAngular(() => this.windowBlurSubscription = fromEvent(window, 'blur').subscribe(this.handleWindowBlur.bind(this)));
144
201
  }
202
+ this.renderer.setAttribute(this.actionSheet.element.nativeElement, 'style', '--kendo-actionsheet-height: 60vh; --kendo-actionsheet-max-height: none');
145
203
  }
146
204
  ngOnDestroy() {
147
205
  this.destroyPopup();
@@ -200,15 +258,15 @@ export class DateRangePopupComponent {
200
258
  return this.popupRef.popupElement.contains(document.activeElement);
201
259
  }
202
260
  /**
203
- * Toggles the visibility of the popup.
204
- * If you use the `toggle` method to show or hide the popup,
261
+ * Toggles the visibility of the popup or actionSheet.
262
+ * If you use the `toggle` method to show or hide the popup or actionSheet,
205
263
  * the `open` and `close` events do not fire.
206
264
  *
207
265
  * @param show The state of the popup.
208
266
  */
209
267
  toggle(show) {
210
268
  this.resolvedPromise.then(() => {
211
- this._toggle((show === undefined) ? !this.show : show);
269
+ this.toggleDateRange((show === undefined) ? !this.show : show);
212
270
  });
213
271
  }
214
272
  /**
@@ -220,8 +278,31 @@ export class DateRangePopupComponent {
220
278
  this.show = false;
221
279
  this.cancel.emit();
222
280
  }
281
+ /**
282
+ * @hidden
283
+ */
284
+ handleAccept() {
285
+ this.dateRangeSelectionDirective.setRange(this.dateRangeService.selectionRange);
286
+ this.show = false;
287
+ }
288
+ /**
289
+ * @hidden
290
+ */
291
+ onResize() {
292
+ if (!this.show || this.windowSize === windowSize()) {
293
+ return;
294
+ }
295
+ ;
296
+ if (this.actionSheet.expanded) {
297
+ this.toggleActionSheet(false);
298
+ }
299
+ else {
300
+ this.togglePopup(false);
301
+ }
302
+ this.windowSize = windowSize();
303
+ }
223
304
  handleWindowBlur() {
224
- if (!this.show) {
305
+ if (!this.show || this.actionSheet.expanded) {
225
306
  return;
226
307
  }
227
308
  if (hasObservers(this.close)) {
@@ -265,7 +346,7 @@ export class DateRangePopupComponent {
265
346
  }
266
347
  return appendTo === 'component' ? this.container : appendTo;
267
348
  }
268
- _toggle(show) {
349
+ togglePopup(show) {
269
350
  this._show = show;
270
351
  if (this.popupRef) {
271
352
  this.destroyPopup();
@@ -297,27 +378,237 @@ export class DateRangePopupComponent {
297
378
  this.popupSubscriptions.unsubscribe();
298
379
  }
299
380
  }
381
+ toggleDateRange(show) {
382
+ this.windowSize = windowSize();
383
+ if (this.isAdaptive) {
384
+ this.toggleActionSheet(show);
385
+ }
386
+ else {
387
+ this.togglePopup(show);
388
+ }
389
+ }
390
+ toggleActionSheet(show) {
391
+ if (show === this._show) {
392
+ return;
393
+ }
394
+ if (show && !this.actionSheet.expanded) {
395
+ this.actionSheet.toggle();
396
+ this.updateActionSheetAdaptiveAppearance();
397
+ }
398
+ else if (!show && this.actionSheet.expanded) {
399
+ this.actionSheet.toggle();
400
+ }
401
+ this._show = show;
402
+ }
403
+ updateActionSheetAdaptiveAppearance() {
404
+ let element;
405
+ let animationContainer;
406
+ if (this.actionSheet) {
407
+ element = this.actionSheet['element'].nativeElement.querySelector('.k-actionsheet');
408
+ animationContainer = this.actionSheet['element'].nativeElement.querySelector('.k-child-animation-container');
409
+ if (this.windowSize === 'medium') {
410
+ this.renderer.removeClass(element, 'k-actionsheet-fullscreen');
411
+ this.renderer.removeStyle(animationContainer, 'height');
412
+ }
413
+ else if (this.windowSize === 'small') {
414
+ this.renderer.addClass(element, 'k-actionsheet-fullscreen');
415
+ this.renderer.setStyle(animationContainer, 'height', '100%');
416
+ }
417
+ this.renderer.addClass(element, 'k-adaptive-actionsheet');
418
+ this.renderer.addClass(element, 'k-actionsheet-bottom');
419
+ this.renderer.setStyle(animationContainer, 'bottom', '0px');
420
+ }
421
+ }
300
422
  }
301
- DateRangePopupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DateRangePopupComponent, deps: [{ token: i1.PopupService }, { token: i2.DateRangeService }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: RTL, optional: true }], target: i0.ɵɵFactoryTarget.Component });
302
- DateRangePopupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: DateRangePopupComponent, selector: "kendo-daterange-popup", inputs: { animate: "animate", anchor: "anchor", anchorAlign: "anchorAlign", appendTo: "appendTo", collision: "collision", popupAlign: "popupAlign", margin: "margin" }, outputs: { open: "open", close: "close", onBlur: "blur", onFocus: "focus", cancel: "cancel" }, queries: [{ propertyName: "contentTemplate", first: true, predicate: DateRangePopupTemplateDirective, descendants: true }, { propertyName: "contentCalendar", predicate: MultiViewCalendarComponent }], viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef }, { propertyName: "defaultTemplate", first: true, predicate: ["defaultTemplate"], descendants: true }, { propertyName: "viewCalendar", predicate: MultiViewCalendarComponent, descendants: true }], exportAs: ["kendo-daterange-popup"], ngImport: i0, template: `
423
+ DateRangePopupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DateRangePopupComponent, deps: [{ token: i1.PopupService }, { token: i2.DateRangeService }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i0.Renderer2 }, { token: i3.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: RTL, optional: true }], target: i0.ɵɵFactoryTarget.Component });
424
+ DateRangePopupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: DateRangePopupComponent, selector: "kendo-daterange-popup", inputs: { animate: "animate", anchor: "anchor", anchorAlign: "anchorAlign", appendTo: "appendTo", collision: "collision", popupAlign: "popupAlign", margin: "margin", adaptiveMode: "adaptiveMode", title: "title", subtitle: "subtitle" }, outputs: { open: "open", close: "close", onBlur: "blur", onFocus: "focus", cancel: "cancel" }, providers: [
425
+ LocalizationService,
426
+ {
427
+ provide: L10N_PREFIX,
428
+ useValue: 'kendo.daterangepopup'
429
+ }
430
+ ], queries: [{ propertyName: "contentTemplate", first: true, predicate: DateRangePopupTemplateDirective, descendants: true }, { propertyName: "contentCalendar", predicate: MultiViewCalendarComponent }], viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef }, { propertyName: "actionSheet", first: true, predicate: ["actionSheet"], descendants: true }, { propertyName: "defaultTemplate", first: true, predicate: ["defaultTemplate"], descendants: true }, { propertyName: "dateRangeSelectionDirective", first: true, predicate: DateRangeSelectionDirective, descendants: true }, { propertyName: "viewCalendar", predicate: MultiViewCalendarComponent, descendants: true }], exportAs: ["kendo-daterange-popup"], ngImport: i0, template: `
431
+ <ng-container kendoDateRangePopupLocalizedMessages
432
+ i18n-accept="kendo.daterangepopup.accept|The Accept button text in the timepicker component"
433
+ accept="Set"
434
+
435
+ i18n-acceptLabel="kendo.daterangepopup.acceptLabel|The label for the Accept button in the timepicker component"
436
+ acceptLabel="Set time"
437
+
438
+ i18n-cancel="kendo.daterangepopup.cancel|The Cancel button text in the timepicker component"
439
+ cancel="Cancel"
440
+
441
+ i18n-cancelLabel="kendo.daterangepopup.cancelLabel|The label for the Cancel button in the timepicker component"
442
+ cancelLabel="Cancel changes"
443
+ >
444
+ </ng-container>
303
445
  <ng-container #container></ng-container>
304
446
  <ng-template #defaultTemplate>
305
447
  <kendo-multiviewcalendar kendoDateRangeSelection></kendo-multiviewcalendar>
306
448
  </ng-template>
307
- `, isInline: true, components: [{ type: i3.MultiViewCalendarComponent, selector: "kendo-multiviewcalendar", inputs: ["id", "focusedDate", "min", "max", "rangeValidation", "disabledDatesRangeValidation", "selection", "value", "disabled", "tabindex", "tabIndex", "isActive", "disabledDates", "activeView", "bottomView", "topView", "showViewHeader", "animateNavigation", "weekNumber", "activeRangeEnd", "selectionRange", "views", "orientation", "cellTemplate", "monthCellTemplate", "yearCellTemplate", "decadeCellTemplate", "centuryCellTemplate", "weekNumberTemplate", "headerTitleTemplate"], outputs: ["activeViewChange", "navigate", "cellEnter", "cellLeave", "valueChange", "blur", "focus", "focusCalendar"], exportAs: ["kendo-multiviewcalendar"] }], directives: [{ type: i4.DateRangeSelectionDirective, selector: "[kendoDateRangeSelection]", inputs: ["autoCorrectOn", "selectionRange", "activeRangeEnd"], outputs: ["activeRangeEndChange", "selectionRangeChange"] }] });
449
+
450
+ <kendo-actionsheet
451
+ #actionSheet
452
+ (overlayClick)="show=false"
453
+ (collapse)="onBlur.emit()"
454
+ >
455
+ <ng-template kendoActionSheetTemplate>
456
+ <!-- Resize sensor needs to be inside the template because the date-range-popup
457
+ element itself always has 0x0 size and does not trigger the sensor.
458
+ Note: The popup in non-adaptive mode closes on window blur -->
459
+ <kendo-resize-sensor *ngIf="isAdaptiveModeEnabled" (resize)="onResize()"></kendo-resize-sensor>
460
+ <div class="k-actionsheet-titlebar">
461
+ <div class="k-actionsheet-titlebar-group k-hbox">
462
+ <div class="k-actionsheet-title">
463
+ <div class="k-text-center">{{ title }}</div>
464
+ <div class="k-actionsheet-subtitle k-text-center">{{ subtitle }}</div>
465
+ </div>
466
+ <div class="k-actionsheet-actions">
467
+ <button
468
+ kendoButton
469
+ icon="x"
470
+ [attr.title]="localization.get('clearTitle')"
471
+ [svgIcon]="xIcon"
472
+ fillMode="flat"
473
+ size="large"
474
+ innerCssClass="k-button-icon"
475
+ (click)="show = false">
476
+ </button>
477
+ </div>
478
+ </div>
479
+ </div>
480
+ <div class="k-actionsheet-content !k-overflow-hidden">
481
+ <div class="k-scrollable-wrap">
482
+ <kendo-multiviewcalendar
483
+ class="k-calendar-lg"
484
+ orientation="vertical"
485
+ #test
486
+ kendoDateRangeSelection
487
+ [shouldSetRange]="false">
488
+ </kendo-multiviewcalendar>
489
+ </div>
490
+ </div>
491
+ <div class="k-actions k-actions-stretched k-actions-horizontal k-actionsheet-footer">
492
+ <button kendoButton
493
+ size="large"
494
+ [attr.title]="localization.get('cancelLabel')"
495
+ [attr.aria-label]="localization.get('cancelLabel')"
496
+ (click)="show=false"
497
+ >
498
+ {{localization.get('cancel')}}
499
+ </button>
500
+
501
+ <button kendoButton
502
+ size="large"
503
+ themeColor="primary"
504
+ [attr.title]="localization.get('acceptLabel')"
505
+ [attr.aria-label]="localization.get('acceptLabel')"
506
+ (click)="handleAccept()"
507
+ >
508
+ {{localization.get('accept')}}
509
+ </button>
510
+ </div>
511
+ </ng-template>
512
+ </kendo-actionsheet>
513
+ `, isInline: true, components: [{ type: i4.MultiViewCalendarComponent, selector: "kendo-multiviewcalendar", inputs: ["id", "focusedDate", "min", "max", "rangeValidation", "disabledDatesRangeValidation", "selection", "value", "disabled", "tabindex", "tabIndex", "isActive", "disabledDates", "activeView", "bottomView", "topView", "showViewHeader", "animateNavigation", "weekNumber", "activeRangeEnd", "selectionRange", "views", "orientation", "cellTemplate", "monthCellTemplate", "yearCellTemplate", "decadeCellTemplate", "centuryCellTemplate", "weekNumberTemplate", "headerTitleTemplate"], outputs: ["activeViewChange", "navigate", "cellEnter", "cellLeave", "valueChange", "blur", "focus", "focusCalendar"], exportAs: ["kendo-multiviewcalendar"] }, { type: i5.ActionSheetComponent, selector: "kendo-actionsheet", inputs: ["title", "subtitle", "items", "cssClass", "animation", "expanded"], outputs: ["expandedChange", "expand", "collapse", "itemClick", "overlayClick"], exportAs: ["kendoActionSheet"] }, { type: i6.ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }, { type: i7.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"] }], directives: [{ type: i8.DateRangePopupLocalizedMessagesDirective, selector: "[kendoDateRangePopupLocalizedMessages]" }, { type: i9.DateRangeSelectionDirective, selector: "[kendoDateRangeSelection]", inputs: ["autoCorrectOn", "selectionRange", "activeRangeEnd", "shouldSetRange"], outputs: ["activeRangeEndChange", "selectionRangeChange"] }, { type: i5.ActionSheetTemplateDirective, selector: "[kendoActionSheetTemplate]" }, { type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
308
514
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DateRangePopupComponent, decorators: [{
309
515
  type: Component,
310
516
  args: [{
311
517
  exportAs: 'kendo-daterange-popup',
518
+ providers: [
519
+ LocalizationService,
520
+ {
521
+ provide: L10N_PREFIX,
522
+ useValue: 'kendo.daterangepopup'
523
+ }
524
+ ],
312
525
  selector: 'kendo-daterange-popup',
313
526
  template: `
527
+ <ng-container kendoDateRangePopupLocalizedMessages
528
+ i18n-accept="kendo.daterangepopup.accept|The Accept button text in the timepicker component"
529
+ accept="Set"
530
+
531
+ i18n-acceptLabel="kendo.daterangepopup.acceptLabel|The label for the Accept button in the timepicker component"
532
+ acceptLabel="Set time"
533
+
534
+ i18n-cancel="kendo.daterangepopup.cancel|The Cancel button text in the timepicker component"
535
+ cancel="Cancel"
536
+
537
+ i18n-cancelLabel="kendo.daterangepopup.cancelLabel|The label for the Cancel button in the timepicker component"
538
+ cancelLabel="Cancel changes"
539
+ >
540
+ </ng-container>
314
541
  <ng-container #container></ng-container>
315
542
  <ng-template #defaultTemplate>
316
543
  <kendo-multiviewcalendar kendoDateRangeSelection></kendo-multiviewcalendar>
317
544
  </ng-template>
545
+
546
+ <kendo-actionsheet
547
+ #actionSheet
548
+ (overlayClick)="show=false"
549
+ (collapse)="onBlur.emit()"
550
+ >
551
+ <ng-template kendoActionSheetTemplate>
552
+ <!-- Resize sensor needs to be inside the template because the date-range-popup
553
+ element itself always has 0x0 size and does not trigger the sensor.
554
+ Note: The popup in non-adaptive mode closes on window blur -->
555
+ <kendo-resize-sensor *ngIf="isAdaptiveModeEnabled" (resize)="onResize()"></kendo-resize-sensor>
556
+ <div class="k-actionsheet-titlebar">
557
+ <div class="k-actionsheet-titlebar-group k-hbox">
558
+ <div class="k-actionsheet-title">
559
+ <div class="k-text-center">{{ title }}</div>
560
+ <div class="k-actionsheet-subtitle k-text-center">{{ subtitle }}</div>
561
+ </div>
562
+ <div class="k-actionsheet-actions">
563
+ <button
564
+ kendoButton
565
+ icon="x"
566
+ [attr.title]="localization.get('clearTitle')"
567
+ [svgIcon]="xIcon"
568
+ fillMode="flat"
569
+ size="large"
570
+ innerCssClass="k-button-icon"
571
+ (click)="show = false">
572
+ </button>
573
+ </div>
574
+ </div>
575
+ </div>
576
+ <div class="k-actionsheet-content !k-overflow-hidden">
577
+ <div class="k-scrollable-wrap">
578
+ <kendo-multiviewcalendar
579
+ class="k-calendar-lg"
580
+ orientation="vertical"
581
+ #test
582
+ kendoDateRangeSelection
583
+ [shouldSetRange]="false">
584
+ </kendo-multiviewcalendar>
585
+ </div>
586
+ </div>
587
+ <div class="k-actions k-actions-stretched k-actions-horizontal k-actionsheet-footer">
588
+ <button kendoButton
589
+ size="large"
590
+ [attr.title]="localization.get('cancelLabel')"
591
+ [attr.aria-label]="localization.get('cancelLabel')"
592
+ (click)="show=false"
593
+ >
594
+ {{localization.get('cancel')}}
595
+ </button>
596
+
597
+ <button kendoButton
598
+ size="large"
599
+ themeColor="primary"
600
+ [attr.title]="localization.get('acceptLabel')"
601
+ [attr.aria-label]="localization.get('acceptLabel')"
602
+ (click)="handleAccept()"
603
+ >
604
+ {{localization.get('accept')}}
605
+ </button>
606
+ </div>
607
+ </ng-template>
608
+ </kendo-actionsheet>
318
609
  `
319
610
  }]
320
- }], ctorParameters: function () { return [{ type: i1.PopupService }, { type: i2.DateRangeService }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: undefined, decorators: [{
611
+ }], ctorParameters: function () { return [{ type: i1.PopupService }, { type: i2.DateRangeService }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i0.Renderer2 }, { type: i3.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
321
612
  type: Optional
322
613
  }, {
323
614
  type: Inject,
@@ -325,12 +616,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
325
616
  }] }]; }, propDecorators: { container: [{
326
617
  type: ViewChild,
327
618
  args: ['container', { read: ViewContainerRef, static: false }]
619
+ }], actionSheet: [{
620
+ type: ViewChild,
621
+ args: ['actionSheet']
328
622
  }], defaultTemplate: [{
329
623
  type: ViewChild,
330
624
  args: ['defaultTemplate', { static: false }]
331
625
  }], contentTemplate: [{
332
626
  type: ContentChild,
333
627
  args: [DateRangePopupTemplateDirective, { static: false }]
628
+ }], dateRangeSelectionDirective: [{
629
+ type: ViewChild,
630
+ args: [DateRangeSelectionDirective, { static: false }]
334
631
  }], viewCalendar: [{
335
632
  type: ViewChildren,
336
633
  args: [MultiViewCalendarComponent]
@@ -351,6 +648,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
351
648
  type: Input
352
649
  }], margin: [{
353
650
  type: Input
651
+ }], adaptiveMode: [{
652
+ type: Input
653
+ }], title: [{
654
+ type: Input
655
+ }], subtitle: [{
656
+ type: Input
354
657
  }], open: [{
355
658
  type: Output
356
659
  }], close: [{
@@ -30,6 +30,11 @@ export class DateRangeSelectionDirective {
30
30
  * To disable this behavior, set the `autoCorrectOn` property to `none`.
31
31
  */
32
32
  this.autoCorrectOn = 'change';
33
+ /**
34
+ * @hidden
35
+ * When in adaptive mode range should not be set automatically on calendar value change but only on accept
36
+ */
37
+ this.shouldSetRange = true;
33
38
  /**
34
39
  * Fires when the active range end is changed. For more information, refer to
35
40
  * the section on [events]({% slug overview_multiviewcalendar %}#toc-events).
@@ -110,6 +115,25 @@ export class DateRangeSelectionDirective {
110
115
  ngOnDestroy() {
111
116
  this.calendarSubscriptions.unsubscribe();
112
117
  }
118
+ /**
119
+ * @hidden
120
+ */
121
+ handleChange(value) {
122
+ const service = this.dateRangeService;
123
+ const autoCorrect = this.autoCorrectOn === 'change' && this.shouldAutoCorrect(value);
124
+ const activeEnd = this.calendar.activeRangeEnd !== 'end' ? 'end' : (autoCorrect ? 'end' : 'start');
125
+ this.range = autoCorrect ? clampRange(value) : this.updateRange(value);
126
+ if (!isEqualRange(service.selectionRange, this.range)) {
127
+ this.acceptAndEmit(this.range);
128
+ service.setActiveRangeEnd(activeEnd);
129
+ if (this.shouldSetRange) {
130
+ this.setRange();
131
+ }
132
+ }
133
+ }
134
+ setRange(range) {
135
+ this.dateRangeService.setRange(this.range ? this.range : range);
136
+ }
113
137
  addSubscriptions(...subscriptions) {
114
138
  subscriptions.map(s => this.calendarSubscriptions.add(s));
115
139
  }
@@ -123,17 +147,6 @@ export class DateRangeSelectionDirective {
123
147
  this.dateRangeService.setRange(clampRange(start));
124
148
  }
125
149
  }
126
- handleChange(value) {
127
- const service = this.dateRangeService;
128
- const autoCorrect = this.autoCorrectOn === 'change' && this.shouldAutoCorrect(value);
129
- const activeEnd = this.calendar.activeRangeEnd !== 'end' ? 'end' : (autoCorrect ? 'end' : 'start');
130
- const range = autoCorrect ? clampRange(value) : this.updateRange(value);
131
- if (!isEqualRange(service.selectionRange, range)) {
132
- this.acceptAndEmit(range);
133
- service.setActiveRangeEnd(activeEnd);
134
- service.setRange(range);
135
- }
136
- }
137
150
  handleHover(value) {
138
151
  if (this.hasCompleteRange()) {
139
152
  return;
@@ -178,7 +191,7 @@ export class DateRangeSelectionDirective {
178
191
  }
179
192
  }
180
193
  DateRangeSelectionDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DateRangeSelectionDirective, deps: [{ token: i1.MultiViewCalendarComponent }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i2.DateRangeService, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
181
- DateRangeSelectionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: DateRangeSelectionDirective, selector: "[kendoDateRangeSelection]", inputs: { autoCorrectOn: "autoCorrectOn", selectionRange: "selectionRange", activeRangeEnd: "activeRangeEnd" }, outputs: { activeRangeEndChange: "activeRangeEndChange", selectionRangeChange: "selectionRangeChange" }, ngImport: i0 });
194
+ DateRangeSelectionDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.12", type: DateRangeSelectionDirective, selector: "[kendoDateRangeSelection]", inputs: { autoCorrectOn: "autoCorrectOn", selectionRange: "selectionRange", activeRangeEnd: "activeRangeEnd", shouldSetRange: "shouldSetRange" }, outputs: { activeRangeEndChange: "activeRangeEndChange", selectionRangeChange: "selectionRangeChange" }, ngImport: i0 });
182
195
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DateRangeSelectionDirective, decorators: [{
183
196
  type: Directive,
184
197
  args: [{
@@ -192,6 +205,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
192
205
  type: Input
193
206
  }], activeRangeEnd: [{
194
207
  type: Input
208
+ }], shouldSetRange: [{
209
+ type: Input
195
210
  }], activeRangeEndChange: [{
196
211
  type: Output
197
212
  }], selectionRangeChange: [{
@@ -71,7 +71,7 @@ DateRangeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", versi
71
71
  DateRangeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: DateRangeComponent, selector: "kendo-daterange", host: { listeners: { "keydown": "keydown($event)" }, properties: { "class.k-daterangepicker": "this.wrapperClass" } }, providers: [DateRangeService], queries: [{ propertyName: "contentPopup", predicate: DateRangePopupComponent }], ngImport: i0, template: `
72
72
  <ng-content></ng-content>
73
73
  <kendo-daterange-popup *ngIf="showDefault"></kendo-daterange-popup>
74
- `, isInline: true, components: [{ type: i2.DateRangePopupComponent, selector: "kendo-daterange-popup", inputs: ["animate", "anchor", "anchorAlign", "appendTo", "collision", "popupAlign", "margin"], outputs: ["open", "close", "blur", "focus", "cancel"], exportAs: ["kendo-daterange-popup"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
74
+ `, isInline: true, components: [{ type: i2.DateRangePopupComponent, selector: "kendo-daterange-popup", inputs: ["animate", "anchor", "anchorAlign", "appendTo", "collision", "popupAlign", "margin", "adaptiveMode", "title", "subtitle"], outputs: ["open", "close", "blur", "focus", "cancel"], exportAs: ["kendo-daterange-popup"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
75
75
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DateRangeComponent, decorators: [{
76
76
  type: Component,
77
77
  args: [{
@@ -14,6 +14,9 @@ import { DateRangePopupComponent } from './date-range-popup.component';
14
14
  import { DateRangePopupTemplateDirective } from './date-range-popup-template.directive';
15
15
  import { DateRangeSelectionDirective } from './date-range-selection.directive';
16
16
  import { EventsModule } from '@progress/kendo-angular-common';
17
+ import { AdaptiveModule } from '../common/adaptive.module';
18
+ import { DateRangePopupCustomMessagesComponent } from './localization/daterange-popup-custom-messages.component';
19
+ import { DateRangePopupLocalizedMessagesDirective } from './localization/daterange-popup-localized-messages.directive';
17
20
  import * as i0 from "@angular/core";
18
21
  const COMPONENT_DIRECTIVES = [
19
22
  DateRangeComponent,
@@ -21,13 +24,16 @@ const COMPONENT_DIRECTIVES = [
21
24
  DateRangePopupTemplateDirective,
22
25
  DateRangeSelectionDirective,
23
26
  DateRangeStartInputDirective,
24
- DateRangeEndInputDirective
27
+ DateRangeEndInputDirective,
28
+ DateRangePopupCustomMessagesComponent,
29
+ DateRangePopupLocalizedMessagesDirective
25
30
  ];
26
31
  const COMPONENT_MODULES = [
27
32
  MultiViewCalendarModule,
28
33
  DateInputModule,
29
34
  PopupModule,
30
- EventsModule
35
+ EventsModule,
36
+ AdaptiveModule
31
37
  ];
32
38
  /**
33
39
  * The exported package module.
@@ -75,15 +81,20 @@ DateRangeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version
75
81
  DateRangePopupTemplateDirective,
76
82
  DateRangeSelectionDirective,
77
83
  DateRangeStartInputDirective,
78
- DateRangeEndInputDirective], imports: [CommonModule, MultiViewCalendarModule,
84
+ DateRangeEndInputDirective,
85
+ DateRangePopupCustomMessagesComponent,
86
+ DateRangePopupLocalizedMessagesDirective], imports: [CommonModule, MultiViewCalendarModule,
79
87
  DateInputModule,
80
88
  PopupModule,
81
- EventsModule], exports: [DateRangeComponent,
89
+ EventsModule,
90
+ AdaptiveModule], exports: [DateRangeComponent,
82
91
  DateRangePopupComponent,
83
92
  DateRangePopupTemplateDirective,
84
93
  DateRangeSelectionDirective,
85
94
  DateRangeStartInputDirective,
86
- DateRangeEndInputDirective] });
95
+ DateRangeEndInputDirective,
96
+ DateRangePopupCustomMessagesComponent,
97
+ DateRangePopupLocalizedMessagesDirective] });
87
98
  DateRangeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DateRangeModule, imports: [[CommonModule, COMPONENT_MODULES]] });
88
99
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: DateRangeModule, decorators: [{
89
100
  type: NgModule,