@progress/kendo-angular-inputs 15.4.0 → 15.5.0-develop.1

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.
@@ -273,7 +273,7 @@ ColorInputComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
273
273
  <label [for]="alpha.focusableId" class="k-colorgradient-input-label">A</label>
274
274
  </div>
275
275
  </ng-container>
276
- `, isInline: true, components: [{ type: i2.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { type: i3.NumericTextBoxComponent, selector: "kendo-numerictextbox", inputs: ["focusableId", "disabled", "readonly", "title", "autoCorrect", "format", "max", "min", "decimals", "placeholder", "step", "spinners", "rangeValidation", "tabindex", "tabIndex", "changeValueOnScroll", "selectOnFocus", "value", "maxlength", "size", "rounded", "fillMode"], outputs: ["valueChange", "focus", "blur", "inputFocus", "inputBlur"], exportAs: ["kendoNumericTextBox"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NumericLabelDirective, selector: "[kendoAdditionalNumericLabel]", inputs: ["kendoAdditionalNumericLabel", "localizationService"] }] });
276
+ `, isInline: true, components: [{ type: i2.ButtonComponent, selector: "button[kendoButton], span[kendoButton], kendo-button", inputs: ["arrowIcon", "toggleable", "togglable", "selected", "tabIndex", "imageUrl", "iconClass", "icon", "disabled", "size", "rounded", "fillMode", "themeColor", "svgIcon", "role", "primary", "look"], outputs: ["selectedChange", "click"], exportAs: ["kendoButton"] }, { type: i3.NumericTextBoxComponent, selector: "kendo-numerictextbox", inputs: ["focusableId", "disabled", "readonly", "title", "autoCorrect", "format", "max", "min", "decimals", "placeholder", "step", "spinners", "rangeValidation", "tabindex", "tabIndex", "changeValueOnScroll", "selectOnFocus", "value", "maxlength", "size", "rounded", "fillMode", "inputAttributes"], outputs: ["valueChange", "focus", "blur", "inputFocus", "inputBlur"], exportAs: ["kendoNumericTextBox"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i5.NumericLabelDirective, selector: "[kendoAdditionalNumericLabel]", inputs: ["kendoAdditionalNumericLabel", "localizationService"] }] });
277
277
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: ColorInputComponent, decorators: [{
278
278
  type: Component,
279
279
  args: [{
@@ -4,7 +4,7 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { Component, ElementRef, EventEmitter, HostBinding, HostListener, Inject, Input, Optional, Output, Renderer2, ViewChild, forwardRef, NgZone, Injector, isDevMode, ChangeDetectorRef, ContentChild } from '@angular/core';
6
6
  import { NG_VALIDATORS, NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
7
- import { guid, hasObservers, isChanged, KendoInput, PrefixTemplateDirective, SuffixTemplateDirective } from '@progress/kendo-angular-common';
7
+ import { guid, hasObservers, isChanged, isControlRequired, isObjectPresent, KendoInput, parseAttributes, PrefixTemplateDirective, removeHTMLAttributes, setHTMLAttributes, SuffixTemplateDirective } from '@progress/kendo-angular-common';
8
8
  import { RTL } from '@progress/kendo-angular-l10n';
9
9
  import { validatePackage } from '@progress/kendo-licensing';
10
10
  import { packageMetadata } from '../package-metadata';
@@ -167,6 +167,7 @@ export class MaskedTextBoxComponent {
167
167
  this._size = 'medium';
168
168
  this._rounded = 'medium';
169
169
  this._fillMode = 'solid';
170
+ this.parsedAttributes = {};
170
171
  /**
171
172
  * @hidden
172
173
  */
@@ -316,6 +317,43 @@ export class MaskedTextBoxComponent {
316
317
  get tabIndex() {
317
318
  return this.tabindex;
318
319
  }
320
+ /**
321
+ * Sets the HTML attributes of the inner focusable input element. Attributes which are essential for certain component functionalities cannot be changed.
322
+ */
323
+ set inputAttributes(attributes) {
324
+ if (isObjectPresent(this.parsedAttributes)) {
325
+ removeHTMLAttributes(this.parsedAttributes, this.renderer, this.input.nativeElement);
326
+ }
327
+ this._inputAttributes = attributes;
328
+ this.parsedAttributes = this.inputAttributes ?
329
+ parseAttributes(this.inputAttributes, this.defaultAttributes) :
330
+ this.inputAttributes;
331
+ this.setInputAttributes();
332
+ }
333
+ get inputAttributes() {
334
+ return this._inputAttributes;
335
+ }
336
+ get defaultAttributes() {
337
+ return {
338
+ id: this.focusableId,
339
+ disabled: this.disabled ? '' : null,
340
+ readonly: this.readonly ? '' : null,
341
+ tabindex: this.tabIndex,
342
+ 'aria-placeholder': this.mask,
343
+ 'aria-invalid': this.isControlInvalid,
344
+ title: this.title,
345
+ required: this.isControlRequired ? '' : null
346
+ };
347
+ }
348
+ get mutableAttributes() {
349
+ return {
350
+ autocomplete: 'off',
351
+ autocorrect: 'off',
352
+ autocapitalize: 'off',
353
+ spellcheck: 'false'
354
+ };
355
+ }
356
+ ;
319
357
  get hostDisabledClass() {
320
358
  return this.disabled;
321
359
  }
@@ -498,6 +536,12 @@ export class MaskedTextBoxComponent {
498
536
  get isControlInvalid() {
499
537
  return this.control && this.control.touched && this.control.invalid;
500
538
  }
539
+ /**
540
+ * @hidden
541
+ */
542
+ get isControlRequired() {
543
+ return isControlRequired(this.control?.control);
544
+ }
501
545
  /**
502
546
  * @hidden
503
547
  */
@@ -602,9 +646,13 @@ export class MaskedTextBoxComponent {
602
646
  this.renderer.addClass(elem, classes.toAdd);
603
647
  }
604
648
  }
649
+ setInputAttributes() {
650
+ const attributesToRender = Object.assign({}, this.mutableAttributes, this.parsedAttributes);
651
+ setHTMLAttributes(attributesToRender, this.renderer, this.input.nativeElement);
652
+ }
605
653
  }
606
654
  MaskedTextBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: MaskedTextBoxComponent, deps: [{ token: i1.MaskingService }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i0.NgZone }, { token: i0.Injector }, { token: i0.ChangeDetectorRef }, { token: RTL, optional: true }], target: i0.ɵɵFactoryTarget.Component });
607
- MaskedTextBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: MaskedTextBoxComponent, selector: "kendo-maskedtextbox", inputs: { focusableId: "focusableId", disabled: "disabled", readonly: "readonly", title: "title", size: "size", rounded: "rounded", fillMode: "fillMode", mask: "mask", value: "value", rules: "rules", prompt: "prompt", promptPlaceholder: "promptPlaceholder", includeLiterals: "includeLiterals", maskOnFocus: "maskOnFocus", maskValidation: "maskValidation", tabindex: "tabindex", tabIndex: "tabIndex" }, outputs: { onFocus: "focus", onBlur: "blur", inputFocus: "inputFocus", inputBlur: "inputBlur", valueChange: "valueChange" }, host: { listeners: { "paste": "pasteHandler($event)", "input": "inputHandler($event)" }, properties: { "class.k-readonly": "this.readonly", "attr.dir": "this.direction", "class.k-input": "this.hostClasses", "class.k-maskedtextbox": "this.hostClasses", "class.k-disabled": "this.hostDisabledClass" } }, providers: [
655
+ MaskedTextBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: MaskedTextBoxComponent, selector: "kendo-maskedtextbox", inputs: { focusableId: "focusableId", disabled: "disabled", readonly: "readonly", title: "title", size: "size", rounded: "rounded", fillMode: "fillMode", mask: "mask", value: "value", rules: "rules", prompt: "prompt", promptPlaceholder: "promptPlaceholder", includeLiterals: "includeLiterals", maskOnFocus: "maskOnFocus", maskValidation: "maskValidation", tabindex: "tabindex", tabIndex: "tabIndex", inputAttributes: "inputAttributes" }, outputs: { onFocus: "focus", onBlur: "blur", inputFocus: "inputFocus", inputBlur: "inputBlur", valueChange: "valueChange" }, host: { listeners: { "paste": "pasteHandler($event)", "input": "inputHandler($event)" }, properties: { "class.k-readonly": "this.readonly", "attr.dir": "this.direction", "class.k-input": "this.hostClasses", "class.k-maskedtextbox": "this.hostClasses", "class.k-disabled": "this.hostDisabledClass" } }, providers: [
608
656
  MaskingService,
609
657
  {
610
658
  multi: true,
@@ -633,18 +681,18 @@ MaskedTextBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0",
633
681
  </ng-template>
634
682
  </span>
635
683
  <kendo-input-separator *ngIf="prefixTemplate && prefixTemplate.showSeparator"></kendo-input-separator>
636
- <input type="text"
637
- #input
684
+ <input #input
685
+ class="k-input-inner"
638
686
  autocomplete="off"
639
687
  autocorrect="off"
640
688
  autocapitalize="off"
641
689
  spellcheck="false"
642
- class="k-input-inner"
643
690
  [id]="focusableId"
644
691
  [tabindex]="tabIndex"
645
692
  [attr.title]="title"
646
693
  [attr.aria-placeholder]="mask"
647
694
  [attr.aria-invalid]="isControlInvalid"
695
+ [attr.required]="isControlRequired ? '' : null"
648
696
  [disabled]="disabled"
649
697
  [readonly]="readonly"
650
698
  [kendoEventsOutsideAngular]="{
@@ -697,18 +745,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
697
745
  </ng-template>
698
746
  </span>
699
747
  <kendo-input-separator *ngIf="prefixTemplate && prefixTemplate.showSeparator"></kendo-input-separator>
700
- <input type="text"
701
- #input
748
+ <input #input
749
+ class="k-input-inner"
702
750
  autocomplete="off"
703
751
  autocorrect="off"
704
752
  autocapitalize="off"
705
753
  spellcheck="false"
706
- class="k-input-inner"
707
754
  [id]="focusableId"
708
755
  [tabindex]="tabIndex"
709
756
  [attr.title]="title"
710
757
  [attr.aria-placeholder]="mask"
711
758
  [attr.aria-invalid]="isControlInvalid"
759
+ [attr.required]="isControlRequired ? '' : null"
712
760
  [disabled]="disabled"
713
761
  [readonly]="readonly"
714
762
  [kendoEventsOutsideAngular]="{
@@ -769,6 +817,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
769
817
  type: Input
770
818
  }], tabIndex: [{
771
819
  type: Input
820
+ }], inputAttributes: [{
821
+ type: Input
772
822
  }], onFocus: [{
773
823
  type: Output,
774
824
  args: ['focus']
@@ -4,7 +4,7 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  /* eslint-disable @typescript-eslint/no-explicit-any */
6
6
  import { Component, ElementRef, EventEmitter, HostBinding, Input, Output, Renderer2, ViewChild, forwardRef, isDevMode, NgZone, ChangeDetectorRef, Injector, ContentChild } from '@angular/core';
7
- import { anyChanged, hasObservers, Keys, guid, KendoInput, SuffixTemplateDirective, PrefixTemplateDirective } from '@progress/kendo-angular-common';
7
+ import { anyChanged, hasObservers, Keys, guid, KendoInput, SuffixTemplateDirective, PrefixTemplateDirective, setHTMLAttributes, isControlRequired, isObjectPresent, removeHTMLAttributes, parseAttributes } from '@progress/kendo-angular-common';
8
8
  import { areSame, getStylingClasses, requiresZoneOnBlur } from '../common/utils';
9
9
  import { invokeElementMethod } from '../common/dom-utils';
10
10
  import { add, toFixedPrecision, limitPrecision } from '../common/math';
@@ -166,6 +166,7 @@ export class NumericTextBoxComponent {
166
166
  this.ngTouched = noop;
167
167
  this.ngValidatorChange = noop;
168
168
  this.domEvents = [];
169
+ this.parsedAttributes = {};
169
170
  /**
170
171
  * @hidden
171
172
  */
@@ -424,9 +425,49 @@ export class NumericTextBoxComponent {
424
425
  get fillMode() {
425
426
  return this._fillMode;
426
427
  }
428
+ /**
429
+ * Sets the HTML attributes of the inner focusable input element. Attributes which are essential for certain component functionalities cannot be changed.
430
+ */
431
+ set inputAttributes(attributes) {
432
+ if (isObjectPresent(this.parsedAttributes)) {
433
+ removeHTMLAttributes(this.parsedAttributes, this.renderer, this.numericInput.nativeElement);
434
+ }
435
+ this._inputAttributes = attributes;
436
+ this.parsedAttributes = this.inputAttributes ?
437
+ parseAttributes(this.inputAttributes, this.defaultAttributes) :
438
+ this.inputAttributes;
439
+ this.setInputAttributes();
440
+ }
441
+ get inputAttributes() {
442
+ return this._inputAttributes;
443
+ }
427
444
  get disableClass() {
428
445
  return this.disabled;
429
446
  }
447
+ get defaultAttributes() {
448
+ return {
449
+ id: this.focusableId,
450
+ disabled: this.disabled ? '' : null,
451
+ readonly: this.readonly ? '' : null,
452
+ tabindex: this.tabIndex,
453
+ placeholder: this.placeholder,
454
+ title: this.title,
455
+ maxlength: this.maxlength,
456
+ 'aria-valuemin': this.min,
457
+ 'aria-valuemax': this.max,
458
+ 'aria-valuenow': this.value,
459
+ required: this.isControlRequired ? '' : null,
460
+ 'aria-invalid': this.isControlInvalid
461
+ };
462
+ }
463
+ get mutableAttributes() {
464
+ return {
465
+ autocomplete: 'off',
466
+ autocorrect: 'off',
467
+ role: 'spinbutton'
468
+ };
469
+ }
470
+ ;
430
471
  ngOnInit() {
431
472
  this.subscriptions = this.localizationService
432
473
  .changes
@@ -587,6 +628,12 @@ export class NumericTextBoxComponent {
587
628
  get isControlInvalid() {
588
629
  return this.control && this.control.touched && !this.control.valid;
589
630
  }
631
+ /**
632
+ * @hidden
633
+ */
634
+ get isControlRequired() {
635
+ return isControlRequired(this.control?.control);
636
+ }
590
637
  /**
591
638
  * @hidden
592
639
  */
@@ -917,9 +964,13 @@ export class NumericTextBoxComponent {
917
964
  this.renderer.addClass(elem, classes.toAdd);
918
965
  }
919
966
  }
967
+ setInputAttributes() {
968
+ const attributesToRender = Object.assign({}, this.mutableAttributes, this.parsedAttributes);
969
+ setHTMLAttributes(attributesToRender, this.renderer, this.numericInput.nativeElement);
970
+ }
920
971
  }
921
972
  NumericTextBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: NumericTextBoxComponent, deps: [{ token: i1.IntlService }, { token: i0.Renderer2 }, { token: i2.LocalizationService }, { token: i0.Injector }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
922
- NumericTextBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: NumericTextBoxComponent, selector: "kendo-numerictextbox", inputs: { focusableId: "focusableId", disabled: "disabled", readonly: "readonly", title: "title", autoCorrect: "autoCorrect", format: "format", max: "max", min: "min", decimals: "decimals", placeholder: "placeholder", step: "step", spinners: "spinners", rangeValidation: "rangeValidation", tabindex: "tabindex", tabIndex: "tabIndex", changeValueOnScroll: "changeValueOnScroll", selectOnFocus: "selectOnFocus", value: "value", maxlength: "maxlength", size: "size", rounded: "rounded", fillMode: "fillMode" }, outputs: { valueChange: "valueChange", onFocus: "focus", onBlur: "blur", inputFocus: "inputFocus", inputBlur: "inputBlur" }, host: { properties: { "class.k-readonly": "this.readonly", "attr.dir": "this.direction", "class.k-disabled": "this.disableClass", "class.k-input": "this.hostClasses", "class.k-numerictextbox": "this.hostClasses" } }, providers: [
973
+ NumericTextBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: NumericTextBoxComponent, selector: "kendo-numerictextbox", inputs: { focusableId: "focusableId", disabled: "disabled", readonly: "readonly", title: "title", autoCorrect: "autoCorrect", format: "format", max: "max", min: "min", decimals: "decimals", placeholder: "placeholder", step: "step", spinners: "spinners", rangeValidation: "rangeValidation", tabindex: "tabindex", tabIndex: "tabIndex", changeValueOnScroll: "changeValueOnScroll", selectOnFocus: "selectOnFocus", value: "value", maxlength: "maxlength", size: "size", rounded: "rounded", fillMode: "fillMode", inputAttributes: "inputAttributes" }, outputs: { valueChange: "valueChange", onFocus: "focus", onBlur: "blur", inputFocus: "inputFocus", inputBlur: "inputBlur" }, host: { properties: { "class.k-readonly": "this.readonly", "attr.dir": "this.direction", "class.k-disabled": "this.disableClass", "class.k-input": "this.hostClasses", "class.k-numerictextbox": "this.hostClasses" } }, providers: [
923
974
  LocalizationService,
924
975
  { provide: L10N_PREFIX, useValue: 'kendo.numerictextbox' },
925
976
  { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => NumericTextBoxComponent), multi: true },
@@ -945,9 +996,9 @@ NumericTextBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0"
945
996
  </ng-template>
946
997
  </span>
947
998
  <kendo-input-separator *ngIf="prefixTemplate && prefixTemplate.showSeparator"></kendo-input-separator>
948
- <input
949
- role="spinbutton"
999
+ <input #numericInput
950
1000
  class="k-input-inner"
1001
+ role="spinbutton"
951
1002
  autocomplete="off"
952
1003
  autocorrect="off"
953
1004
  [id]="focusableId"
@@ -957,10 +1008,11 @@ NumericTextBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0"
957
1008
  [attr.title]="title"
958
1009
  [attr.placeholder]="placeholder"
959
1010
  [attr.maxLength]="maxlength"
960
- [attr.aria-invalid]="isControlInvalid"
961
1011
  [tabindex]="tabIndex"
962
1012
  [disabled]="disabled"
963
1013
  [readonly]="readonly"
1014
+ [attr.aria-invalid]="isControlInvalid"
1015
+ [attr.required]="isControlRequired ? '' : null"
964
1016
  [kendoEventsOutsideAngular]="{
965
1017
  mousedown: handleMouseDown,
966
1018
  dragenter: handleDragEnter,
@@ -969,8 +1021,7 @@ NumericTextBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0"
969
1021
  focus: handleInputFocus,
970
1022
  blur: handleInputBlur,
971
1023
  paste: handlePaste
972
- }"
973
- #numericInput />
1024
+ }"/>
974
1025
  <kendo-input-separator *ngIf="suffixTemplate && suffixTemplate?.showSeparator"></kendo-input-separator>
975
1026
  <span *ngIf="suffixTemplate" class="k-input-suffix k-input-suffix-horizontal">
976
1027
  <ng-template [ngTemplateOutlet]="suffixTemplate?.templateRef">
@@ -1049,9 +1100,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1049
1100
  </ng-template>
1050
1101
  </span>
1051
1102
  <kendo-input-separator *ngIf="prefixTemplate && prefixTemplate.showSeparator"></kendo-input-separator>
1052
- <input
1053
- role="spinbutton"
1103
+ <input #numericInput
1054
1104
  class="k-input-inner"
1105
+ role="spinbutton"
1055
1106
  autocomplete="off"
1056
1107
  autocorrect="off"
1057
1108
  [id]="focusableId"
@@ -1061,10 +1112,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1061
1112
  [attr.title]="title"
1062
1113
  [attr.placeholder]="placeholder"
1063
1114
  [attr.maxLength]="maxlength"
1064
- [attr.aria-invalid]="isControlInvalid"
1065
1115
  [tabindex]="tabIndex"
1066
1116
  [disabled]="disabled"
1067
1117
  [readonly]="readonly"
1118
+ [attr.aria-invalid]="isControlInvalid"
1119
+ [attr.required]="isControlRequired ? '' : null"
1068
1120
  [kendoEventsOutsideAngular]="{
1069
1121
  mousedown: handleMouseDown,
1070
1122
  dragenter: handleDragEnter,
@@ -1073,8 +1125,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1073
1125
  focus: handleInputFocus,
1074
1126
  blur: handleInputBlur,
1075
1127
  paste: handlePaste
1076
- }"
1077
- #numericInput />
1128
+ }"/>
1078
1129
  <kendo-input-separator *ngIf="suffixTemplate && suffixTemplate?.showSeparator"></kendo-input-separator>
1079
1130
  <span *ngIf="suffixTemplate" class="k-input-suffix k-input-suffix-horizontal">
1080
1131
  <ng-template [ngTemplateOutlet]="suffixTemplate?.templateRef">
@@ -1169,6 +1220,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
1169
1220
  type: Input
1170
1221
  }], fillMode: [{
1171
1222
  type: Input
1223
+ }], inputAttributes: [{
1224
+ type: Input
1172
1225
  }], valueChange: [{
1173
1226
  type: Output
1174
1227
  }], onFocus: [{
@@ -9,7 +9,7 @@ export const packageMetadata = {
9
9
  name: '@progress/kendo-angular-inputs',
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
12
- publishDate: 1712142368,
13
- version: '15.4.0',
12
+ publishDate: 1712152346,
13
+ version: '15.5.0-develop.1',
14
14
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
15
15
  };
@@ -6,7 +6,7 @@ import { Component, HostBinding, Input, Output, ElementRef, EventEmitter, NgZone
6
6
  import { fromEvent } from 'rxjs';
7
7
  import { debounceTime } from 'rxjs/operators';
8
8
  import { NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
9
- import { KendoInput, guid, isDocumentAvailable, hasObservers } from '@progress/kendo-angular-common';
9
+ import { KendoInput, guid, isDocumentAvailable, hasObservers, setHTMLAttributes, isControlRequired, isObjectPresent, removeHTMLAttributes, parseAttributes } from '@progress/kendo-angular-common';
10
10
  import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
11
11
  import { TextFieldsBase } from '../text-fields-common/text-fields-base';
12
12
  import { areSame, isPresent, getStylingClasses } from '../common/utils';
@@ -132,6 +132,7 @@ export class TextAreaComponent extends TextFieldsBase {
132
132
  this._rounded = 'medium';
133
133
  this._fillMode = 'solid';
134
134
  this._adornmentsOrientation = 'horizontal';
135
+ this.parsedAttributes = {};
135
136
  /**
136
137
  * @hidden
137
138
  */
@@ -191,6 +192,22 @@ export class TextAreaComponent extends TextFieldsBase {
191
192
  get flow() {
192
193
  return this._flow;
193
194
  }
195
+ /**
196
+ * Sets the HTML attributes of the inner focusable input element. Attributes which are essential for certain component functionalities cannot be changed.
197
+ */
198
+ set inputAttributes(attributes) {
199
+ if (isObjectPresent(this.parsedAttributes)) {
200
+ removeHTMLAttributes(this.parsedAttributes, this.renderer, this.input.nativeElement);
201
+ }
202
+ this._inputAttributes = attributes;
203
+ this.parsedAttributes = this.inputAttributes ?
204
+ parseAttributes(this.inputAttributes, this.defaultAttributes) :
205
+ this.inputAttributes;
206
+ this.setInputAttributes();
207
+ }
208
+ get inputAttributes() {
209
+ return this._inputAttributes;
210
+ }
194
211
  /**
195
212
  * Specifies the orientation of the TextArea adornments. This property is used in order to specify
196
213
  * the adornments' position relative to themselves.
@@ -274,6 +291,29 @@ export class TextAreaComponent extends TextFieldsBase {
274
291
  get fillMode() {
275
292
  return this._fillMode;
276
293
  }
294
+ get defaultAttributes() {
295
+ return {
296
+ id: this.focusableId,
297
+ disabled: this.disabled ? '' : null,
298
+ readonly: this.readonly ? '' : null,
299
+ tabindex: this.disabled ? undefined : this.tabIndex,
300
+ placeholder: this.placeholder,
301
+ title: this.title,
302
+ maxlength: this.maxlength,
303
+ rows: this.rows,
304
+ cols: this.cols,
305
+ 'aria-disabled': this.disabled ? true : undefined,
306
+ 'aria-readonly': this.readonly ? true : undefined,
307
+ 'aria-invalid': this.isControlInvalid,
308
+ required: this.isControlRequired ? '' : null
309
+ };
310
+ }
311
+ get mutableAttributes() {
312
+ return {
313
+ 'aria-multiline': 'true'
314
+ };
315
+ }
316
+ ;
277
317
  ngAfterViewInit() {
278
318
  this.ngZone.runOutsideAngular(() => {
279
319
  this.handleFlow();
@@ -372,6 +412,12 @@ export class TextAreaComponent extends TextFieldsBase {
372
412
  get isControlInvalid() {
373
413
  return this.control && this.control.touched && !this.control.valid;
374
414
  }
415
+ /**
416
+ * @hidden
417
+ */
418
+ get isControlRequired() {
419
+ return isControlRequired(this.control?.control);
420
+ }
375
421
  /**
376
422
  * @hidden
377
423
  */
@@ -501,9 +547,13 @@ export class TextAreaComponent extends TextFieldsBase {
501
547
  const element = this.input.nativeElement;
502
548
  this.renderer[isVertical ? 'addClass' : 'removeClass'](element, '\!k-flex-none');
503
549
  }
550
+ setInputAttributes() {
551
+ const attributesToRender = Object.assign({}, this.mutableAttributes, this.parsedAttributes);
552
+ setHTMLAttributes(attributesToRender, this.renderer, this.input.nativeElement);
553
+ }
504
554
  }
505
555
  TextAreaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: TextAreaComponent, deps: [{ token: i1.LocalizationService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: i0.Injector }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
506
- TextAreaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: TextAreaComponent, selector: "kendo-textarea", inputs: { focusableId: "focusableId", flow: "flow", adornmentsOrientation: "adornmentsOrientation", rows: "rows", cols: "cols", maxlength: "maxlength", tabindex: "tabindex", tabIndex: "tabIndex", resizable: "resizable", size: "size", rounded: "rounded", fillMode: "fillMode", showPrefixSeparator: "showPrefixSeparator", showSuffixSeparator: "showSuffixSeparator" }, outputs: { onFocus: "focus", onBlur: "blur", valueChange: "valueChange" }, host: { properties: { "class.k-textarea": "this.hostClasses", "class.k-input": "this.hostClasses", "class.!k-flex-col": "this.flowCol", "class.!k-flex-row": "this.flowRow" } }, providers: [
556
+ TextAreaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: TextAreaComponent, selector: "kendo-textarea", inputs: { focusableId: "focusableId", flow: "flow", inputAttributes: "inputAttributes", adornmentsOrientation: "adornmentsOrientation", rows: "rows", cols: "cols", maxlength: "maxlength", tabindex: "tabindex", tabIndex: "tabIndex", resizable: "resizable", size: "size", rounded: "rounded", fillMode: "fillMode", showPrefixSeparator: "showPrefixSeparator", showSuffixSeparator: "showSuffixSeparator" }, outputs: { onFocus: "focus", onBlur: "blur", valueChange: "valueChange" }, host: { properties: { "class.k-textarea": "this.hostClasses", "class.k-input": "this.hostClasses", "class.!k-flex-col": "this.flowCol", "class.!k-flex-row": "this.flowRow" } }, providers: [
507
557
  LocalizationService,
508
558
  { provide: L10N_PREFIX, useValue: 'kendo.textarea' },
509
559
  {
@@ -525,14 +575,15 @@ TextAreaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
525
575
  *ngIf="prefix && showPrefixSeparator"
526
576
  [orientation]="separatorOrientation"
527
577
  ></kendo-input-separator>
528
- <textarea
529
- #input
578
+ <textarea #input
579
+ class="k-input-inner !k-overflow-auto"
530
580
  [attr.aria-multiline]="true"
531
581
  [attr.aria-disabled]="disabled ? true : undefined"
532
582
  [attr.aria-readonly]="readonly ? true : undefined"
533
- class="k-input-inner !k-overflow-auto"
534
- [ngClass]="resizableClass"
583
+ [attr.aria-invalid]="isControlInvalid"
535
584
  [id]="focusableId"
585
+ [attr.required]="isControlRequired ? '' : null"
586
+ [ngClass]="resizableClass"
536
587
  [value]="value"
537
588
  [attr.placeholder]="placeholder"
538
589
  [disabled]="disabled"
@@ -583,14 +634,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
583
634
  *ngIf="prefix && showPrefixSeparator"
584
635
  [orientation]="separatorOrientation"
585
636
  ></kendo-input-separator>
586
- <textarea
587
- #input
637
+ <textarea #input
638
+ class="k-input-inner !k-overflow-auto"
588
639
  [attr.aria-multiline]="true"
589
640
  [attr.aria-disabled]="disabled ? true : undefined"
590
641
  [attr.aria-readonly]="readonly ? true : undefined"
591
- class="k-input-inner !k-overflow-auto"
592
- [ngClass]="resizableClass"
642
+ [attr.aria-invalid]="isControlInvalid"
593
643
  [id]="focusableId"
644
+ [attr.required]="isControlRequired ? '' : null"
645
+ [ngClass]="resizableClass"
594
646
  [value]="value"
595
647
  [attr.placeholder]="placeholder"
596
648
  [disabled]="disabled"
@@ -630,6 +682,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
630
682
  args: ['class.\!k-flex-row']
631
683
  }], flow: [{
632
684
  type: Input
685
+ }], inputAttributes: [{
686
+ type: Input
633
687
  }], adornmentsOrientation: [{
634
688
  type: Input
635
689
  }], rows: [{
@@ -10,7 +10,7 @@ import { validatePackage } from '@progress/kendo-licensing';
10
10
  import { packageMetadata } from '../package-metadata';
11
11
  import { invokeElementMethod } from '../common/dom-utils';
12
12
  import { areSame, requiresZoneOnBlur, getStylingClasses } from '../common/utils';
13
- import { guid, hasObservers, KendoInput, isSafari, SuffixTemplateDirective, PrefixTemplateDirective } from '@progress/kendo-angular-common';
13
+ import { guid, hasObservers, KendoInput, isSafari, SuffixTemplateDirective, PrefixTemplateDirective, setHTMLAttributes, isControlRequired, isObjectPresent, removeHTMLAttributes, parseAttributes } from '@progress/kendo-angular-common';
14
14
  import { TextBoxSuffixTemplateDirective } from './textbox-suffix.directive';
15
15
  import { TextBoxPrefixTemplateDirective } from './textbox-prefix.directive';
16
16
  import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
@@ -171,6 +171,7 @@ export class TextBoxComponent {
171
171
  this._size = 'medium';
172
172
  this._rounded = 'medium';
173
173
  this._fillMode = 'solid';
174
+ this.parsedAttributes = {};
174
175
  /**
175
176
  * @hidden
176
177
  */
@@ -287,9 +288,39 @@ export class TextBoxComponent {
287
288
  get tabIndex() {
288
289
  return this.tabindex;
289
290
  }
291
+ /**
292
+ * Sets the HTML attributes of the inner focusable input element. Attributes which are essential for certain component functionalities cannot be changed.
293
+ */
294
+ set inputAttributes(attributes) {
295
+ if (isObjectPresent(this.parsedAttributes)) {
296
+ removeHTMLAttributes(this.parsedAttributes, this.renderer, this.input.nativeElement);
297
+ }
298
+ this._inputAttributes = attributes;
299
+ this.parsedAttributes = this.inputAttributes ?
300
+ parseAttributes(this.inputAttributes, this.defaultAttributes) :
301
+ this.inputAttributes;
302
+ this.setInputAttributes();
303
+ }
304
+ get inputAttributes() {
305
+ return this._inputAttributes;
306
+ }
290
307
  get disabledClass() {
291
308
  return this.disabled;
292
309
  }
310
+ get defaultAttributes() {
311
+ return {
312
+ id: this.focusableId,
313
+ disabled: this.disabled ? '' : null,
314
+ readonly: this.readonly ? '' : null,
315
+ tabindex: this.disabled ? undefined : this.tabindex,
316
+ type: this.type,
317
+ placeholder: this.placeholder,
318
+ title: this.title,
319
+ maxlength: this.maxlength,
320
+ 'aria-invalid': this.isControlInvalid,
321
+ required: this.isControlRequired ? '' : null
322
+ };
323
+ }
293
324
  ngOnInit() {
294
325
  this.control = this.injector.get(NgControl, null);
295
326
  this.checkClearButton();
@@ -531,6 +562,12 @@ export class TextBoxComponent {
531
562
  this._isFocused = value;
532
563
  }
533
564
  }
565
+ /**
566
+ * @hidden
567
+ */
568
+ get isControlRequired() {
569
+ return isControlRequired(this.control?.control);
570
+ }
534
571
  setSelection(start, end) {
535
572
  if (this.isFocused) {
536
573
  invokeElementMethod(this.input, 'setSelectionRange', start, end);
@@ -588,9 +625,12 @@ export class TextBoxComponent {
588
625
  this.prefix = this.textBoxPrefixTemplate.first || this.prefixTemplate;
589
626
  this.suffix = this.textBoxSuffixTemplate.first || this.suffixTemplate;
590
627
  }
628
+ setInputAttributes() {
629
+ setHTMLAttributes(this.parsedAttributes, this.renderer, this.input.nativeElement);
630
+ }
591
631
  }
592
632
  TextBoxComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.12", ngImport: i0, type: TextBoxComponent, deps: [{ token: i1.LocalizationService }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: i0.Injector }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
593
- TextBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: TextBoxComponent, selector: "kendo-textbox", inputs: { focusableId: "focusableId", title: "title", type: "type", disabled: "disabled", readonly: "readonly", tabindex: "tabindex", value: "value", selectOnFocus: "selectOnFocus", showSuccessIcon: "showSuccessIcon", showErrorIcon: "showErrorIcon", clearButton: "clearButton", successIcon: "successIcon", successSvgIcon: "successSvgIcon", errorIcon: "errorIcon", errorSvgIcon: "errorSvgIcon", clearButtonIcon: "clearButtonIcon", clearButtonSvgIcon: "clearButtonSvgIcon", size: "size", rounded: "rounded", fillMode: "fillMode", tabIndex: "tabIndex", placeholder: "placeholder", maxlength: "maxlength" }, outputs: { valueChange: "valueChange", inputFocus: "inputFocus", inputBlur: "inputBlur", onFocus: "focus", onBlur: "blur" }, host: { properties: { "class.k-readonly": "this.readonly", "class.k-disabled": "this.disabledClass", "class.k-textbox": "this.hostClasses", "class.k-input": "this.hostClasses", "attr.dir": "this.direction" } }, providers: [
633
+ TextBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.12", type: TextBoxComponent, selector: "kendo-textbox", inputs: { focusableId: "focusableId", title: "title", type: "type", disabled: "disabled", readonly: "readonly", tabindex: "tabindex", value: "value", selectOnFocus: "selectOnFocus", showSuccessIcon: "showSuccessIcon", showErrorIcon: "showErrorIcon", clearButton: "clearButton", successIcon: "successIcon", successSvgIcon: "successSvgIcon", errorIcon: "errorIcon", errorSvgIcon: "errorSvgIcon", clearButtonIcon: "clearButtonIcon", clearButtonSvgIcon: "clearButtonSvgIcon", size: "size", rounded: "rounded", fillMode: "fillMode", tabIndex: "tabIndex", placeholder: "placeholder", maxlength: "maxlength", inputAttributes: "inputAttributes" }, outputs: { valueChange: "valueChange", inputFocus: "inputFocus", inputBlur: "inputBlur", onFocus: "focus", onBlur: "blur" }, host: { properties: { "class.k-readonly": "this.readonly", "class.k-disabled": "this.disabledClass", "class.k-textbox": "this.hostClasses", "class.k-input": "this.hostClasses", "attr.dir": "this.direction" } }, providers: [
594
634
  LocalizationService,
595
635
  { provide: L10N_PREFIX, useValue: 'kendo.textbox' },
596
636
  {
@@ -629,6 +669,7 @@ TextBoxComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versi
629
669
  [attr.title]="title"
630
670
  [attr.maxlength]="maxlength"
631
671
  [attr.aria-invalid]="isControlInvalid"
672
+ [attr.required]="isControlRequired ? '' : null"
632
673
  [kendoEventsOutsideAngular]="{
633
674
  focus: handleInputFocus,
634
675
  blur: handleInputBlur,
@@ -720,6 +761,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
720
761
  [attr.title]="title"
721
762
  [attr.maxlength]="maxlength"
722
763
  [attr.aria-invalid]="isControlInvalid"
764
+ [attr.required]="isControlRequired ? '' : null"
723
765
  [kendoEventsOutsideAngular]="{
724
766
  focus: handleInputFocus,
725
767
  blur: handleInputBlur,
@@ -816,6 +858,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.12", ngImpo
816
858
  type: Input
817
859
  }], maxlength: [{
818
860
  type: Input
861
+ }], inputAttributes: [{
862
+ type: Input
819
863
  }], valueChange: [{
820
864
  type: Output
821
865
  }], inputFocus: [{