@progress/kendo-angular-inputs 18.1.0-develop.3 → 18.1.0-develop.31

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 (33) hide show
  1. package/colorpicker/adaptiveness/adaptive-close-button.component.d.ts +20 -0
  2. package/colorpicker/adaptiveness/adaptive-renderer.component.d.ts +38 -0
  3. package/colorpicker/color-gradient-text-label.directive.d.ts +19 -0
  4. package/colorpicker/color-gradient.component.d.ts +19 -1
  5. package/colorpicker/color-input.component.d.ts +15 -3
  6. package/colorpicker/color-palette.component.d.ts +16 -6
  7. package/colorpicker/colorpicker.component.d.ts +55 -8
  8. package/colorpicker/flatcolorpicker-actions.component.d.ts +3 -1
  9. package/colorpicker/flatcolorpicker-header.component.d.ts +3 -1
  10. package/colorpicker/flatcolorpicker.component.d.ts +19 -1
  11. package/colorpicker/localization/messages.d.ts +9 -1
  12. package/colorpicker/models/adaptive-mode.d.ts +23 -0
  13. package/esm2022/colorpicker/adaptiveness/adaptive-close-button.component.mjs +62 -0
  14. package/esm2022/colorpicker/adaptiveness/adaptive-renderer.component.mjs +205 -0
  15. package/esm2022/colorpicker/color-gradient-text-label.directive.mjs +34 -0
  16. package/esm2022/colorpicker/color-gradient.component.mjs +75 -17
  17. package/esm2022/colorpicker/color-input.component.mjs +56 -23
  18. package/esm2022/colorpicker/color-palette.component.mjs +45 -15
  19. package/esm2022/colorpicker/colorpicker.component.mjs +182 -41
  20. package/esm2022/colorpicker/flatcolorpicker-actions.component.mjs +22 -7
  21. package/esm2022/colorpicker/flatcolorpicker-header.component.mjs +8 -3
  22. package/esm2022/colorpicker/flatcolorpicker.component.mjs +72 -17
  23. package/esm2022/colorpicker/localization/messages.mjs +13 -1
  24. package/esm2022/colorpicker/models/adaptive-mode.mjs +27 -0
  25. package/esm2022/colorpicker/services/flatcolorpicker.service.mjs +3 -3
  26. package/esm2022/colorpicker.module.mjs +3 -2
  27. package/esm2022/inputs.module.mjs +3 -2
  28. package/esm2022/otpinput/otpinput.component.mjs +75 -45
  29. package/esm2022/package-metadata.mjs +2 -2
  30. package/fesm2022/progress-kendo-angular-inputs.mjs +9170 -8497
  31. package/otpinput/models/separator-icon.d.ts +9 -3
  32. package/otpinput/otpinput.component.d.ts +4 -7
  33. package/package.json +13 -11
@@ -59,7 +59,7 @@ export class OTPInputComponent {
59
59
  */
60
60
  spacing = true;
61
61
  /**
62
- * Adds a separator between groups of input fields.
62
+ * Specifies the separator between groups of input fields.
63
63
  *
64
64
  * > The configuration can only be applied when `groupLength` is set.
65
65
  */
@@ -107,7 +107,7 @@ export class OTPInputComponent {
107
107
  }
108
108
  }
109
109
  this._groupLength = length;
110
- this.populateSeparatorPosititons();
110
+ this.populateSeparatorPositions();
111
111
  }
112
112
  /**
113
113
  * Configures the value of the component. Unfilled input fields are represented with space.
@@ -116,8 +116,8 @@ export class OTPInputComponent {
116
116
  return this._value;
117
117
  }
118
118
  set value(input) {
119
- if (this._value === input ||
120
- (this.type === 'number' && isPresent(input) && !this.isValidNumber(input))) {
119
+ const isInvalidInput = this.type === 'number' && isPresent(input) && !this.containsDigitsOrSpaces(input);
120
+ if (this._value === input || isInvalidInput) {
121
121
  return;
122
122
  }
123
123
  if (!isPresent(input)) {
@@ -209,10 +209,6 @@ export class OTPInputComponent {
209
209
  * might cause a mix-up with the built-in `valueChange` mechanisms of the `ngModel` or `formControl` bindings.
210
210
  */
211
211
  valueChange = new EventEmitter();
212
- /**
213
- * Fires when the length of the trimmed value is equal to `length`.
214
- */
215
- inputFinish = new EventEmitter();
216
212
  /**
217
213
  * Fires each time the user focuses the OTP Input.
218
214
  */
@@ -312,7 +308,7 @@ export class OTPInputComponent {
312
308
  if (typeof this.groupLength === 'number') {
313
309
  this.populateGroupArray(this.groupLength);
314
310
  }
315
- this.populateSeparatorPosititons();
311
+ this.populateSeparatorPositions();
316
312
  }
317
313
  if (changes.spacing) {
318
314
  if (this.spacing === true) {
@@ -323,8 +319,12 @@ export class OTPInputComponent {
323
319
  }
324
320
  }
325
321
  if (changes.type && this.type === 'number') {
326
- if (isPresent(this.value) && !this.isValidNumber(this.value)) {
322
+ if (isPresent(this.value) && !this.containsDigitsOrSpaces(this.value)) {
327
323
  this.value = null;
324
+ this.zone.runOutsideAngular(() => setTimeout(() => this.zone.run(() => {
325
+ this.ngChange(null);
326
+ this.cdr.markForCheck();
327
+ })));
328
328
  }
329
329
  }
330
330
  }
@@ -395,13 +395,13 @@ export class OTPInputComponent {
395
395
  * @hidden
396
396
  */
397
397
  showGroupSeparator(index) {
398
- return this.separator && this.groupLengthArray && index < this.groupLengthArray.length - 1;
398
+ return this.groupLengthArray && index < this.groupLengthArray.length - 1;
399
399
  }
400
400
  /**
401
401
  * @hidden
402
402
  */
403
403
  showSeparator(index) {
404
- return this.separator && this.groupLength ? this.separatorPositions.has(index) : false;
404
+ return this.groupLength ? this.separatorPositions.has(index) : false;
405
405
  }
406
406
  /**
407
407
  * @hidden
@@ -412,16 +412,16 @@ export class OTPInputComponent {
412
412
  index = this.getIndexByGroup(groupIndex, index);
413
413
  }
414
414
  let newValue = '';
415
- this.inputFields.forEach((input) => newValue = newValue.concat(input.value?.toString() || " "));
415
+ this.inputFields.forEach((input) => newValue = newValue.concat(input.value?.toString() || ' '));
416
416
  if (!areSame(this.value, newValue)) {
417
- this.value = newValue;
418
- this.ngChange(newValue);
419
- this.valueChange.emit(newValue);
417
+ this.zone.run(() => {
418
+ this.value = newValue;
419
+ this.ngChange(newValue);
420
+ this.valueChange.emit(newValue);
421
+ this.cdr.markForCheck();
422
+ });
420
423
  }
421
424
  this.inputFieldValueChanged = false;
422
- if (this.value && this.value.trim().length === this.length) {
423
- this.inputFinish.emit(this.value);
424
- }
425
425
  if (isPresent(index) && isPresent(this.inputFields?.get(index).value)) {
426
426
  this.focusNext();
427
427
  }
@@ -444,7 +444,13 @@ export class OTPInputComponent {
444
444
  handleInput(event, index, groupIndex) {
445
445
  if (this.type === 'number' && !this.isValidNumber(event?.data)) {
446
446
  const inputIndex = groupIndex ? this.getIndexByGroup(groupIndex, index) : index;
447
- this.inputFields.get(inputIndex).value = null;
447
+ const textbox = this.inputFields.get(inputIndex);
448
+ if (this.value && this.isValidNumber(this.value[inputIndex])) {
449
+ textbox.value = this.value[inputIndex];
450
+ }
451
+ else {
452
+ textbox.value = null;
453
+ }
448
454
  this.showInvalidInput(inputIndex);
449
455
  return;
450
456
  }
@@ -571,24 +577,35 @@ export class OTPInputComponent {
571
577
  this.inputFields.get(this.focusedInput).focus();
572
578
  }
573
579
  handleKeydown(event) {
574
- if (event.keyCode === Keys.ArrowRight) {
575
- event.preventDefault();
576
- this.direction === 'ltr' ? this.focusNext() : this.focusPrevious();
577
- }
578
- if (event.keyCode === Keys.ArrowLeft) {
579
- event.preventDefault();
580
- this.direction === 'ltr' ? this.focusPrevious() : this.focusNext();
581
- }
582
- if (event.keyCode === Keys.Backspace) {
583
- event.preventDefault();
584
- this.inputFields.get(this.focusedInput).value = null;
585
- this.handleValueChange();
586
- this.focusPrevious();
580
+ if (this.readonly) {
581
+ const isCopyCommand = (event.ctrlKey || event.metaKey) && event.keyCode === Keys.KeyC;
582
+ if (!(event.keyCode === Keys.Tab || isCopyCommand)) {
583
+ event.preventDefault();
584
+ return;
585
+ }
587
586
  }
588
- if (event.keyCode === Keys.Delete) {
589
- event.preventDefault();
590
- this.inputFields.get(this.focusedInput).value = null;
591
- this.handleValueChange();
587
+ switch (event.keyCode) {
588
+ case Keys.ArrowRight:
589
+ event.preventDefault();
590
+ this.direction === 'ltr' ? this.focusNext() : this.focusPrevious();
591
+ break;
592
+ case Keys.ArrowLeft:
593
+ event.preventDefault();
594
+ this.direction === 'ltr' ? this.focusPrevious() : this.focusNext();
595
+ break;
596
+ case Keys.Backspace:
597
+ event.preventDefault();
598
+ this.inputFields.get(this.focusedInput).value = null;
599
+ this.handleValueChange();
600
+ this.focusPrevious();
601
+ break;
602
+ case Keys.Delete:
603
+ event.preventDefault();
604
+ this.inputFields.get(this.focusedInput).value = null;
605
+ this.handleValueChange();
606
+ break;
607
+ default:
608
+ break;
592
609
  }
593
610
  }
594
611
  isValidGroupArray(groups) {
@@ -611,7 +628,7 @@ export class OTPInputComponent {
611
628
  this.adjacentGroups = [...this.groupLengthArray];
612
629
  }
613
630
  }
614
- populateSeparatorPosititons() {
631
+ populateSeparatorPositions() {
615
632
  let itemIndex = 0;
616
633
  this.separatorPositions.clear();
617
634
  if (!isPresent(this.groupLengthArray)) {
@@ -690,18 +707,33 @@ export class OTPInputComponent {
690
707
  !isNaN(Number(trimmedValue));
691
708
  }
692
709
  showInvalidInput(index) {
693
- const inputElement = this.inputFields.get(index).hostElement.nativeElement;
694
- this.renderer.addClass(inputElement, 'k-invalid');
710
+ const textbox = this.inputFields.get(index);
711
+ const textboxElement = this.inputFields.get(index).hostElement.nativeElement;
712
+ const inputElement = textbox.input.nativeElement;
713
+ this.renderer.addClass(textboxElement, 'k-invalid');
714
+ if (textbox.value && this.isValidNumber(textbox.value)) {
715
+ this.zone.onStable.pipe(take(1)).subscribe(() => inputElement.select());
716
+ }
695
717
  this.zone.runOutsideAngular(() => {
696
718
  setTimeout(() => {
697
- if (!this.isControlInvalid && inputElement) {
698
- this.renderer.removeClass(inputElement, 'k-invalid');
719
+ if (!this.isControlInvalid && textboxElement) {
720
+ this.renderer.removeClass(textboxElement, 'k-invalid');
699
721
  }
700
722
  }, 300);
701
723
  });
702
724
  }
725
+ containsDigitsOrSpaces(value) {
726
+ // @ts-expect-error TS does not allow comparing string with number
727
+ const isDigitOrSpace = (char) => (char == +char) || char === ' ';
728
+ for (let i = 0; i < value.length; i++) {
729
+ if (!isDigitOrSpace(value[i])) {
730
+ return false;
731
+ }
732
+ }
733
+ return true;
734
+ }
703
735
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OTPInputComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i0.Injector }, { token: i0.Renderer2 }, { token: i1.LocalizationService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
704
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: OTPInputComponent, isStandalone: true, selector: "kendo-otpinput", inputs: { length: "length", type: "type", spacing: "spacing", separator: "separator", disabled: "disabled", readonly: "readonly", placeholder: "placeholder", groupLength: "groupLength", value: "value", size: "size", rounded: "rounded", fillMode: "fillMode", inputAttributes: "inputAttributes" }, outputs: { valueChange: "valueChange", inputFinish: "inputFinish", onFocus: "focus", onBlur: "blur" }, host: { properties: { "class.k-otp": "this.wrapperClass", "class.k-invalid": "this.invalidClass", "attr.dir": "this.direction", "attr.role": "this.role" } }, providers: [
736
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: OTPInputComponent, isStandalone: true, selector: "kendo-otpinput", inputs: { length: "length", type: "type", spacing: "spacing", separator: "separator", disabled: "disabled", readonly: "readonly", placeholder: "placeholder", groupLength: "groupLength", value: "value", size: "size", rounded: "rounded", fillMode: "fillMode", inputAttributes: "inputAttributes" }, outputs: { valueChange: "valueChange", onFocus: "focus", onBlur: "blur" }, host: { properties: { "class.k-otp": "this.wrapperClass", "class.k-invalid": "this.invalidClass", "attr.dir": "this.direction", "attr.role": "this.role" } }, providers: [
705
737
  LocalizationService,
706
738
  { provide: L10N_PREFIX, useValue: 'kendo.otpinput' },
707
739
  {
@@ -871,8 +903,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
871
903
  type: Input
872
904
  }], valueChange: [{
873
905
  type: Output
874
- }], inputFinish: [{
875
- type: Output
876
906
  }], onFocus: [{
877
907
  type: Output,
878
908
  args: ['focus']
@@ -10,7 +10,7 @@ export const packageMetadata = {
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCode: 'KENDOUIANGULAR',
12
12
  productCodes: ['KENDOUIANGULAR'],
13
- publishDate: 1738245756,
14
- version: '18.1.0-develop.3',
13
+ publishDate: 1739264223,
14
+ version: '18.1.0-develop.31',
15
15
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
16
16
  };