@progress/kendo-angular-dateinputs 5.3.1-dev.202112201533 → 6.0.0

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 (74) hide show
  1. package/LICENSE.md +1 -1
  2. package/NOTICE.txt +119 -79
  3. package/README.md +1 -1
  4. package/dist/cdn/js/kendo-angular-dateinputs.js +2 -2
  5. package/dist/cdn/main.js +1 -1
  6. package/dist/es/calendar/calendar.component.js +1 -1
  7. package/dist/es/calendar/header.component.js +1 -1
  8. package/dist/es/calendar/multiview-calendar.component.js +11 -4
  9. package/dist/es/calendar/services/dom.service.js +1 -1
  10. package/dist/es/calendar/view.component.js +1 -1
  11. package/dist/es/common/models/fillmode.js +4 -0
  12. package/dist/es/common/models/rounded.js +4 -0
  13. package/dist/es/common/models/size.js +4 -0
  14. package/dist/es/dateinput/dateinput.component.js +143 -18
  15. package/dist/es/datepicker/datepicker.component.js +130 -13
  16. package/dist/es/daterange/date-range-input.js +1 -1
  17. package/dist/es/datetimepicker/datetimepicker.component.js +147 -11
  18. package/dist/es/package-metadata.js +1 -1
  19. package/dist/es/timepicker/services/dom.service.js +12 -8
  20. package/dist/es/timepicker/timelist.component.js +3 -2
  21. package/dist/es/timepicker/timepicker.component.js +130 -13
  22. package/dist/es/timepicker/timeselector.component.js +2 -2
  23. package/dist/es/util.js +37 -0
  24. package/dist/es2015/calendar/calendar.component.js +1 -1
  25. package/dist/es2015/calendar/header.component.js +4 -4
  26. package/dist/es2015/calendar/multiview-calendar.component.d.ts +3 -1
  27. package/dist/es2015/calendar/multiview-calendar.component.js +11 -4
  28. package/dist/es2015/calendar/services/dom.service.js +1 -1
  29. package/dist/es2015/calendar/view.component.js +1 -1
  30. package/dist/es2015/common/models/fillmode.d.ts +14 -0
  31. package/dist/es2015/common/models/fillmode.js +4 -0
  32. package/dist/es2015/common/models/rounded.d.ts +15 -0
  33. package/dist/es2015/common/models/rounded.js +4 -0
  34. package/dist/es2015/common/models/size.d.ts +14 -0
  35. package/dist/es2015/common/models/size.js +4 -0
  36. package/dist/es2015/dateinput/dateinput.component.d.ts +49 -8
  37. package/dist/es2015/dateinput/dateinput.component.js +183 -68
  38. package/dist/es2015/datepicker/datepicker.component.d.ts +47 -5
  39. package/dist/es2015/datepicker/datepicker.component.js +155 -49
  40. package/dist/es2015/daterange/date-range-input.js +1 -1
  41. package/dist/es2015/datetimepicker/datetimepicker.component.d.ts +56 -6
  42. package/dist/es2015/datetimepicker/datetimepicker.component.js +186 -63
  43. package/dist/es2015/index.metadata.json +1 -1
  44. package/dist/es2015/package-metadata.js +1 -1
  45. package/dist/es2015/timepicker/services/dom.service.d.ts +1 -0
  46. package/dist/es2015/timepicker/services/dom.service.js +12 -8
  47. package/dist/es2015/timepicker/timelist.component.js +3 -2
  48. package/dist/es2015/timepicker/timepicker.component.d.ts +50 -5
  49. package/dist/es2015/timepicker/timepicker.component.js +174 -69
  50. package/dist/es2015/timepicker/timeselector.component.js +7 -5
  51. package/dist/es2015/util.d.ts +18 -0
  52. package/dist/es2015/util.js +37 -0
  53. package/dist/fesm2015/index.js +780 -282
  54. package/dist/fesm5/index.js +625 -83
  55. package/dist/npm/calendar/calendar.component.js +1 -1
  56. package/dist/npm/calendar/header.component.js +1 -1
  57. package/dist/npm/calendar/multiview-calendar.component.js +10 -3
  58. package/dist/npm/calendar/services/dom.service.js +1 -1
  59. package/dist/npm/calendar/view.component.js +1 -1
  60. package/dist/npm/common/models/fillmode.js +6 -0
  61. package/dist/npm/common/models/rounded.js +6 -0
  62. package/dist/npm/common/models/size.js +6 -0
  63. package/dist/npm/dateinput/dateinput.component.js +142 -17
  64. package/dist/npm/datepicker/datepicker.component.js +129 -12
  65. package/dist/npm/daterange/date-range-input.js +1 -1
  66. package/dist/npm/datetimepicker/datetimepicker.component.js +146 -10
  67. package/dist/npm/package-metadata.js +1 -1
  68. package/dist/npm/timepicker/services/dom.service.js +15 -10
  69. package/dist/npm/timepicker/timelist.component.js +3 -2
  70. package/dist/npm/timepicker/timepicker.component.js +129 -12
  71. package/dist/npm/timepicker/timeselector.component.js +2 -2
  72. package/dist/npm/util.js +37 -0
  73. package/dist/systemjs/kendo-angular-dateinputs.js +1 -1
  74. package/package.json +7 -7
@@ -18,7 +18,7 @@ import { packageMetadata } from '../package-metadata';
18
18
  import { PickerService } from '../common/picker.service';
19
19
  import { DisabledDatesService } from '../calendar/services/disabled-dates.service';
20
20
  import { isPresent } from '../common/utils';
21
- import { mergeDateAndTime, noop, lastMillisecondOfDate, isInRange, isValidRange, isWindowAvailable } from '../util';
21
+ import { mergeDateAndTime, noop, lastMillisecondOfDate, isInRange, isValidRange, isWindowAvailable, getFillModeClass, getRoundedClass, getSizeClass } from '../util';
22
22
  import { PreventableEvent } from '../preventable-event';
23
23
  import { minValidator } from '../validators/min.validator';
24
24
  import { maxValidator } from '../validators/max.validator';
@@ -45,13 +45,13 @@ const TWO_DIGIT_YEAR_MAX = 68;
45
45
  * Represents the [Kendo UI DateTimePicker component for Angular]({% slug overview_datetimepicker %}).
46
46
  */
47
47
  let DateTimePickerComponent = DateTimePickerComponent_1 = class DateTimePickerComponent {
48
- constructor(popupService, intl, cdr, pickerService, ngZone, host, touchEnabled, localization, disabledDatesService, renderer) {
48
+ constructor(popupService, intl, cdr, pickerService, ngZone, wrapper, touchEnabled, localization, disabledDatesService, renderer) {
49
49
  this.popupService = popupService;
50
50
  this.intl = intl;
51
51
  this.cdr = cdr;
52
52
  this.pickerService = pickerService;
53
53
  this.ngZone = ngZone;
54
- this.host = host;
54
+ this.wrapper = wrapper;
55
55
  this.touchEnabled = touchEnabled;
56
56
  this.localization = localization;
57
57
  this.disabledDatesService = disabledDatesService;
@@ -218,8 +218,17 @@ let DateTimePickerComponent = DateTimePickerComponent_1 = class DateTimePickerCo
218
218
  this.disabledDatesValidateFn = noop;
219
219
  this.incompleteValidator = noop;
220
220
  this.subscriptions = new Subscription();
221
+ this._size = 'medium';
222
+ this._rounded = 'medium';
223
+ this._fillMode = 'solid';
221
224
  validatePackage(packageMetadata);
222
225
  }
226
+ /**
227
+ * @hidden
228
+ */
229
+ get disabledClass() {
230
+ return this.disabled;
231
+ }
223
232
  /**
224
233
  * @hidden
225
234
  */
@@ -355,10 +364,10 @@ let DateTimePickerComponent = DateTimePickerComponent_1 = class DateTimePickerCo
355
364
  }
356
365
  set isActive(value) {
357
366
  if (value) {
358
- this.renderer.addClass(this.wrapper.nativeElement, 'k-state-focused');
367
+ this.renderer.addClass(this.wrapper.nativeElement, 'k-focus');
359
368
  }
360
369
  else {
361
- this.renderer.removeClass(this.wrapper.nativeElement, 'k-state-focused');
370
+ this.renderer.removeClass(this.wrapper.nativeElement, 'k-focus');
362
371
  }
363
372
  this._isActive = value;
364
373
  }
@@ -373,6 +382,73 @@ let DateTimePickerComponent = DateTimePickerComponent_1 = class DateTimePickerCo
373
382
  get defaultTab() {
374
383
  return this._defaultTab;
375
384
  }
385
+ /**
386
+ * Sets the size of the component.
387
+ *
388
+ * The possible values are:
389
+ * * `'small'`
390
+ * * `'medium'` (Default)
391
+ * * `'large'`
392
+ * * `null`
393
+ *
394
+ */
395
+ set size(size) {
396
+ this.renderer.removeClass(this.wrapper.nativeElement, getSizeClass('input', this.size));
397
+ this.renderer.removeClass(this.toggleButton.nativeElement, getSizeClass('input', this.size));
398
+ if (size) {
399
+ this.renderer.addClass(this.wrapper.nativeElement, getSizeClass('input', size));
400
+ this.renderer.addClass(this.toggleButton.nativeElement, getSizeClass('input', size));
401
+ }
402
+ this._size = size;
403
+ }
404
+ get size() {
405
+ return this._size;
406
+ }
407
+ /**
408
+ * Sets the border radius of the component.
409
+ *
410
+ * The possible values are:
411
+ * * `'small'`
412
+ * * `'medium'` (Default)
413
+ * * `'large'`
414
+ * * `'full'`
415
+ * * `null`
416
+ *
417
+ */
418
+ set rounded(rounded) {
419
+ this.renderer.removeClass(this.wrapper.nativeElement, getRoundedClass(this.rounded));
420
+ if (rounded) {
421
+ this.renderer.addClass(this.wrapper.nativeElement, getRoundedClass(rounded));
422
+ }
423
+ this._rounded = rounded;
424
+ }
425
+ get rounded() {
426
+ return this._rounded;
427
+ }
428
+ /**
429
+ * Sets the fillMode of the component.
430
+ *
431
+ * The possible values are:
432
+ * * `'solid'` (Default)
433
+ * * `'flat'`
434
+ * * `'outline'`
435
+ * * `null`
436
+ *
437
+ */
438
+ set fillMode(fillMode) {
439
+ this.renderer.removeClass(this.wrapper.nativeElement, getFillModeClass('input', this.fillMode));
440
+ this.renderer.removeClass(this.toggleButton.nativeElement, getFillModeClass('button', this.fillMode));
441
+ this.renderer.removeClass(this.toggleButton.nativeElement, `k-button-${this.fillMode}-base`);
442
+ if (fillMode) {
443
+ this.renderer.addClass(this.wrapper.nativeElement, getFillModeClass('input', fillMode));
444
+ this.renderer.addClass(this.toggleButton.nativeElement, getFillModeClass('button', fillMode));
445
+ this.renderer.addClass(this.toggleButton.nativeElement, `k-button-${fillMode}-base`);
446
+ }
447
+ this._fillMode = fillMode;
448
+ }
449
+ get fillMode() {
450
+ return this._fillMode;
451
+ }
376
452
  /**
377
453
  * @hidden
378
454
  */
@@ -438,6 +514,9 @@ let DateTimePickerComponent = DateTimePickerComponent_1 = class DateTimePickerCo
438
514
  this.subscriptions.add(this.ngZone.runOutsideAngular(() => fromEvent(window, 'blur').subscribe(this.handleCancel.bind(this))));
439
515
  }
440
516
  }
517
+ ngAfterViewInit() {
518
+ this.setComponentClasses();
519
+ }
441
520
  ngOnChanges(changes) {
442
521
  if (isPresent(changes.min) || isPresent(changes.max)) {
443
522
  this.verifyMinMaxRange();
@@ -589,7 +668,7 @@ let DateTimePickerComponent = DateTimePickerComponent_1 = class DateTimePickerCo
589
668
  return;
590
669
  }
591
670
  this.isActive = false;
592
- const isNgControlUntouched = this.host.nativeElement.classList.contains('ng-untouched');
671
+ const isNgControlUntouched = this.wrapper.nativeElement.classList.contains('ng-untouched');
593
672
  const runInZone = isNgControlUntouched || hasObservers(this.onBlur) || (this.isOpen && hasObservers(this.close));
594
673
  this.run(runInZone, () => {
595
674
  this.onBlur.emit();
@@ -714,6 +793,13 @@ let DateTimePickerComponent = DateTimePickerComponent_1 = class DateTimePickerCo
714
793
  this.input.focus();
715
794
  }
716
795
  }
796
+ /**
797
+ * @hidden
798
+ */
799
+ popupButtonsClasses(type) {
800
+ const buttonType = type ? type : 'base';
801
+ return `${this.size ? getSizeClass('button', this.size) : ''} ${this.rounded ? getRoundedClass(this.rounded) : ''} ${this.fillMode ? 'k-button-' + this.fillMode + ' ' + 'k-button-' + this.fillMode + '-' + buttonType : ''}`;
802
+ }
717
803
  /**
718
804
  * @hidden
719
805
  *
@@ -837,7 +923,7 @@ let DateTimePickerComponent = DateTimePickerComponent_1 = class DateTimePickerCo
837
923
  }
838
924
  /**
839
925
  * Indicates whether the focus target is part of this component,
840
- * that is, whether the focus target is inside the component wrapper or in the popup.
926
+ * that is, whether the focus target is inside the component or in the popup.
841
927
  */
842
928
  focusTargetInComponent(event) {
843
929
  if (!isPresent(event)) {
@@ -883,16 +969,35 @@ let DateTimePickerComponent = DateTimePickerComponent_1 = class DateTimePickerCo
883
969
  this.cdr.markForCheck();
884
970
  this.ngZone.run(() => this.onValidatorChange());
885
971
  }
972
+ setComponentClasses() {
973
+ if (this.size) {
974
+ this.renderer.addClass(this.wrapper.nativeElement, getSizeClass('input', this.size));
975
+ this.renderer.addClass(this.toggleButton.nativeElement, getSizeClass('button', this.size));
976
+ }
977
+ if (this.rounded) {
978
+ this.renderer.addClass(this.wrapper.nativeElement, getRoundedClass(this.rounded));
979
+ }
980
+ if (this.fillMode) {
981
+ this.renderer.addClass(this.wrapper.nativeElement, getFillModeClass('input', this.fillMode));
982
+ this.renderer.addClass(this.toggleButton.nativeElement, getFillModeClass('button', this.fillMode));
983
+ this.renderer.addClass(this.toggleButton.nativeElement, `k-button-${this.fillMode}-base`);
984
+ }
985
+ }
886
986
  };
887
987
  tslib_1.__decorate([
888
- HostBinding('class.k-widget'),
889
988
  HostBinding('class.k-datetimepicker'),
989
+ HostBinding('class.k-input'),
890
990
  tslib_1.__metadata("design:type", Boolean)
891
991
  ], DateTimePickerComponent.prototype, "hostClasses", void 0);
892
992
  tslib_1.__decorate([
893
- ViewChild('wrapper', { static: true }),
993
+ HostBinding('class.k-disabled'),
994
+ tslib_1.__metadata("design:type", Boolean),
995
+ tslib_1.__metadata("design:paramtypes", [])
996
+ ], DateTimePickerComponent.prototype, "disabledClass", null);
997
+ tslib_1.__decorate([
998
+ ViewChild('toggleButton', { static: true }),
894
999
  tslib_1.__metadata("design:type", ElementRef)
895
- ], DateTimePickerComponent.prototype, "wrapper", void 0);
1000
+ ], DateTimePickerComponent.prototype, "toggleButton", void 0);
896
1001
  tslib_1.__decorate([
897
1002
  Input(),
898
1003
  tslib_1.__metadata("design:type", Date),
@@ -1021,6 +1126,21 @@ tslib_1.__decorate([
1021
1126
  tslib_1.__metadata("design:type", String),
1022
1127
  tslib_1.__metadata("design:paramtypes", [String])
1023
1128
  ], DateTimePickerComponent.prototype, "defaultTab", null);
1129
+ tslib_1.__decorate([
1130
+ Input(),
1131
+ tslib_1.__metadata("design:type", String),
1132
+ tslib_1.__metadata("design:paramtypes", [String])
1133
+ ], DateTimePickerComponent.prototype, "size", null);
1134
+ tslib_1.__decorate([
1135
+ Input(),
1136
+ tslib_1.__metadata("design:type", String),
1137
+ tslib_1.__metadata("design:paramtypes", [String])
1138
+ ], DateTimePickerComponent.prototype, "rounded", null);
1139
+ tslib_1.__decorate([
1140
+ Input(),
1141
+ tslib_1.__metadata("design:type", String),
1142
+ tslib_1.__metadata("design:paramtypes", [String])
1143
+ ], DateTimePickerComponent.prototype, "fillMode", null);
1024
1144
  tslib_1.__decorate([
1025
1145
  ContentChild(CellTemplateDirective, { static: false }),
1026
1146
  tslib_1.__metadata("design:type", CellTemplateDirective)
@@ -1119,56 +1239,55 @@ DateTimePickerComponent = DateTimePickerComponent_1 = tslib_1.__decorate([
1119
1239
  >
1120
1240
  </ng-container>
1121
1241
 
1122
- <span
1123
- #wrapper
1124
- class="k-picker-wrap"
1125
- [class.k-state-disabled]="disabled"
1242
+ <kendo-dateinput
1243
+ [value]="value"
1244
+ [format]="format"
1245
+ [twoDigitYearMax]="twoDigitYearMax"
1246
+ [min]="min"
1247
+ [max]="max"
1248
+ [incompleteDateValidation]="incompleteDateValidation"
1249
+ [formatPlaceholder]="formatPlaceholder"
1250
+ [placeholder]="placeholder"
1251
+ [disabled]="disabled"
1252
+ [readonly]="readonly || readOnlyInput"
1253
+ [role]="inputRole"
1254
+ [ariaReadOnly]="readonly"
1255
+ [steps]="steps"
1256
+ [tabindex]="tabindex"
1257
+ [title]="title"
1258
+ [focusableId]="focusableId"
1259
+ [hasPopup]="true"
1260
+ [isPopupOpen]="isOpen"
1261
+ (valueChange)="handleInputValueChange($event)"
1262
+ [kendoEventsOutsideAngular]="{
1263
+ keydown: handleKeyDown
1264
+ }"
1265
+ [scope]="this"
1266
+ [fillMode]="fillMode"
1267
+ [rounded]="rounded"
1268
+ [size]="size"
1126
1269
  >
1127
- <kendo-dateinput
1128
- [value]="value"
1129
- [format]="format"
1130
- [twoDigitYearMax]="twoDigitYearMax"
1131
- [min]="min"
1132
- [max]="max"
1133
- [incompleteDateValidation]="incompleteDateValidation"
1134
- [formatPlaceholder]="formatPlaceholder"
1135
- [placeholder]="placeholder"
1136
- [disabled]="disabled"
1137
- [readonly]="readonly || readOnlyInput"
1138
- [role]="inputRole"
1139
- [ariaReadOnly]="readonly"
1140
- [steps]="steps"
1141
- [tabindex]="tabindex"
1142
- [title]="title"
1143
- [focusableId]="focusableId"
1144
- [hasPopup]="true"
1145
- [isPopupOpen]="isOpen"
1146
- (valueChange)="handleInputValueChange($event)"
1147
- [kendoEventsOutsideAngular]="{
1148
- keydown: handleKeyDown
1149
- }"
1150
- [scope]="this"
1151
- >
1152
- </kendo-dateinput>
1153
- <span class="k-select"
1154
- [attr.title]="localization.get('toggle')"
1155
- [attr.aria-label]="localization.get('toggle')"
1156
- [kendoEventsOutsideAngular]="{
1157
- mousedown: preventMouseDown,
1158
- click: handleIconClick
1270
+ </kendo-dateinput>
1271
+ <button
1272
+ #toggleButton
1273
+ type="button"
1274
+ class="k-input-button k-button k-icon-button"
1275
+ [tabindex]="-1"
1276
+ [attr.title]="localization.get('toggle')"
1277
+ [attr.aria-label]="localization.get('toggle')"
1278
+ [kendoEventsOutsideAngular]="{
1279
+ mousedown: preventMouseDown,
1280
+ click: handleIconClick
1281
+ }"
1282
+ [scope]="this"
1283
+ >
1284
+ <span class="k-button-icon k-icon"
1285
+ [ngClass]="{
1286
+ 'k-i-calendar': activeTab === 'date',
1287
+ 'k-i-clock': activeTab === 'time'
1159
1288
  }"
1160
- [scope]="this"
1161
- >
1162
- <span class="k-link k-link-date">
1163
- <span
1164
- class="k-icon"
1165
- [class.k-i-calendar]="activeTab === 'date'"
1166
- [class.k-i-clock]="activeTab === 'time'"
1167
- >
1168
- </span>
1169
- </span>
1170
- </span>
1171
- </span>
1289
+ ></span>
1290
+ </button>
1172
1291
 
1173
1292
  <ng-container #container></ng-container>
1174
1293
 
@@ -1191,8 +1310,9 @@ DateTimePickerComponent = DateTimePickerComponent_1 = tslib_1.__decorate([
1191
1310
  <div class="k-button-group k-button-group-stretched">
1192
1311
  <button
1193
1312
  type="button"
1194
- class="k-button k-date-tab"
1195
- [class.k-state-active]="activeTab === 'date'"
1313
+ class="k-button k-group-start k-date-tab"
1314
+ [ngClass]="popupButtonsClasses()"
1315
+ [class.k-active]="activeTab === 'date'"
1196
1316
  [attr.title]="localization.get('dateTabLabel')"
1197
1317
  [attr.aria-label]="localization.get('dateTabLabel')"
1198
1318
  [kendoEventsOutsideAngular]="{
@@ -1205,8 +1325,9 @@ DateTimePickerComponent = DateTimePickerComponent_1 = tslib_1.__decorate([
1205
1325
  </button>
1206
1326
  <button
1207
1327
  type="button"
1208
- class="k-button k-time-tab"
1209
- [class.k-state-active]="activeTab === 'time'"
1328
+ class="k-button k-group-end k-time-tab"
1329
+ [ngClass]="popupButtonsClasses()"
1330
+ [class.k-active]="activeTab === 'time'"
1210
1331
  [attr.title]="localization.get('timeTabLabel')"
1211
1332
  [attr.aria-label]="localization.get('timeTabLabel')"
1212
1333
  [kendoEventsOutsideAngular]="{
@@ -1286,6 +1407,7 @@ DateTimePickerComponent = DateTimePickerComponent_1 = tslib_1.__decorate([
1286
1407
  *ngIf="cancelButton"
1287
1408
  type="button"
1288
1409
  class="k-button k-time-cancel"
1410
+ [ngClass]="popupButtonsClasses()"
1289
1411
  [attr.title]="localization.get('cancelLabel')"
1290
1412
  [attr.aria-label]="localization.get('cancelLabel')"
1291
1413
  [kendoEventsOutsideAngular]="{
@@ -1297,7 +1419,8 @@ DateTimePickerComponent = DateTimePickerComponent_1 = tslib_1.__decorate([
1297
1419
  </button>
1298
1420
  <button
1299
1421
  type="button"
1300
- class="k-time-accept k-button k-primary"
1422
+ class="k-button k-time-accept"
1423
+ [ngClass]="popupButtonsClasses('primary')"
1301
1424
  [attr.title]="localization.get('acceptLabel')"
1302
1425
  [attr.aria-label]="localization.get('acceptLabel')"
1303
1426
  [disabled]="!calendarValue"