@syncfusion/ej2-inputs 22.2.5 → 22.2.7

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.
@@ -7148,13 +7148,31 @@ let FormValidator = FormValidator_1 = class FormValidator extends Base {
7148
7148
  for (const element of elements) {
7149
7149
  const input = element;
7150
7150
  input.removeAttribute('aria-invalid');
7151
- input.classList.remove(this.errorClass);
7151
+ const inputParent = input.parentElement;
7152
+ const grandParent = inputParent.parentElement;
7153
+ if (inputParent.classList.contains('e-control-wrapper') || inputParent.classList.contains('e-wrapper')) {
7154
+ inputParent.classList.remove(this.errorClass);
7155
+ }
7156
+ else if ((grandParent != null) && (grandParent.classList.contains('e-control-wrapper') || grandParent.classList.contains('e-wrapper'))) {
7157
+ grandParent.classList.remove(this.errorClass);
7158
+ }
7159
+ else {
7160
+ input.classList.remove(this.errorClass);
7161
+ }
7152
7162
  if (input.name.length > 0) {
7153
7163
  this.getInputElement(input.name);
7154
7164
  this.getErrorElement(input.name);
7155
7165
  this.hideMessage(input.name);
7156
7166
  }
7157
- input.classList.remove(this.validClass);
7167
+ if (inputParent.classList.contains('e-control-wrapper') || inputParent.classList.contains('e-wrapper')) {
7168
+ inputParent.classList.remove(this.validClass);
7169
+ }
7170
+ else if ((grandParent != null) && (grandParent.classList.contains('e-control-wrapper') || grandParent.classList.contains('e-wrapper'))) {
7171
+ grandParent.classList.remove(this.validClass);
7172
+ }
7173
+ else {
7174
+ input.classList.remove(this.validClass);
7175
+ }
7158
7176
  }
7159
7177
  }
7160
7178
  createHTML5Rules() {
@@ -7397,8 +7415,20 @@ let FormValidator = FormValidator_1 = class FormValidator extends Base {
7397
7415
  // Set aria attributes to invalid elements
7398
7416
  this.inputElement.setAttribute('aria-invalid', 'true');
7399
7417
  this.inputElement.setAttribute('aria-describedby', this.inputElement.id + '-info');
7400
- this.inputElement.classList.add(this.errorClass);
7401
- this.inputElement.classList.remove(this.validClass);
7418
+ const inputParent = this.inputElement.parentElement;
7419
+ const grandParent = inputParent.parentElement;
7420
+ if (inputParent.classList.contains('e-control-wrapper') || inputParent.classList.contains('e-wrapper')) {
7421
+ inputParent.classList.add(this.errorClass);
7422
+ inputParent.classList.remove(this.validClass);
7423
+ }
7424
+ else if ((grandParent != null) && (grandParent.classList.contains('e-control-wrapper') || grandParent.classList.contains('e-wrapper'))) {
7425
+ grandParent.classList.add(this.errorClass);
7426
+ grandParent.classList.remove(this.validClass);
7427
+ }
7428
+ else {
7429
+ this.inputElement.classList.add(this.errorClass);
7430
+ this.inputElement.classList.remove(this.validClass);
7431
+ }
7402
7432
  if (!this.infoElement) {
7403
7433
  this.createErrorElement(name, errorRule.message, this.inputElement);
7404
7434
  }
@@ -7407,8 +7437,18 @@ let FormValidator = FormValidator_1 = class FormValidator extends Base {
7407
7437
  }
7408
7438
  eventArgs.errorElement = this.infoElement;
7409
7439
  eventArgs.status = 'failure';
7410
- this.inputElement.classList.add(this.errorClass);
7411
- this.inputElement.classList.remove(this.validClass);
7440
+ if (inputParent.classList.contains('e-control-wrapper') || inputParent.classList.contains('e-wrapper')) {
7441
+ inputParent.classList.add(this.errorClass);
7442
+ inputParent.classList.remove(this.validClass);
7443
+ }
7444
+ else if ((grandParent != null) && (grandParent.classList.contains('e-control-wrapper') || grandParent.classList.contains('e-wrapper'))) {
7445
+ grandParent.classList.add(this.errorClass);
7446
+ grandParent.classList.remove(this.validClass);
7447
+ }
7448
+ else {
7449
+ this.inputElement.classList.add(this.errorClass);
7450
+ this.inputElement.classList.remove(this.validClass);
7451
+ }
7412
7452
  this.optionalValidationStatus(name, eventArgs);
7413
7453
  this.trigger('validationComplete', eventArgs);
7414
7454
  // Set aria-required to required rule elements
@@ -7550,8 +7590,20 @@ let FormValidator = FormValidator_1 = class FormValidator extends Base {
7550
7590
  if (this.infoElement) {
7551
7591
  this.infoElement.style.display = 'none';
7552
7592
  this.removeErrorRules(name);
7553
- this.inputElement.classList.add(this.validClass);
7554
- this.inputElement.classList.remove(this.errorClass);
7593
+ const inputParent = this.inputElement.parentElement;
7594
+ const grandParent = inputParent.parentElement;
7595
+ if (inputParent.classList.contains('e-control-wrapper') || inputParent.classList.contains('e-wrapper')) {
7596
+ inputParent.classList.add(this.validClass);
7597
+ inputParent.classList.remove(this.errorClass);
7598
+ }
7599
+ else if ((grandParent != null) && (grandParent.classList.contains('e-control-wrapper') || grandParent.classList.contains('e-wrapper'))) {
7600
+ grandParent.classList.add(this.validClass);
7601
+ grandParent.classList.remove(this.errorClass);
7602
+ }
7603
+ else {
7604
+ this.inputElement.classList.add(this.validClass);
7605
+ this.inputElement.classList.remove(this.errorClass);
7606
+ }
7555
7607
  this.inputElement.setAttribute('aria-invalid', 'false');
7556
7608
  }
7557
7609
  }
@@ -13401,6 +13453,7 @@ let TextBox = class TextBox extends Component {
13401
13453
  wireEvents() {
13402
13454
  EventHandler.add(this.respectiveElement, 'focus', this.focusHandler, this);
13403
13455
  EventHandler.add(this.respectiveElement, 'blur', this.focusOutHandler, this);
13456
+ EventHandler.add(this.respectiveElement, 'keydown', this.keydownHandler, this);
13404
13457
  EventHandler.add(this.respectiveElement, 'input', this.inputHandler, this);
13405
13458
  EventHandler.add(this.respectiveElement, 'change', this.changeHandler, this);
13406
13459
  if (this.isForm) {
@@ -13470,6 +13523,11 @@ let TextBox = class TextBox extends Component {
13470
13523
  };
13471
13524
  this.trigger('blur', eventArgs);
13472
13525
  }
13526
+ keydownHandler(args) {
13527
+ if ((args.keyCode === 13 || args.keyCode === 9) && !((this.previousValue === null || this.previousValue === "") && (this.value === null || this.value === "") && this.respectiveElement.value === "")) {
13528
+ this.setProperties({ value: this.respectiveElement.value }, true);
13529
+ }
13530
+ }
13473
13531
  inputHandler(args) {
13474
13532
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-this-alias
13475
13533
  const textboxObj = this;
@@ -13553,6 +13611,7 @@ let TextBox = class TextBox extends Component {
13553
13611
  unWireEvents() {
13554
13612
  EventHandler.remove(this.respectiveElement, 'focus', this.focusHandler);
13555
13613
  EventHandler.remove(this.respectiveElement, 'blur', this.focusOutHandler);
13614
+ EventHandler.remove(this.respectiveElement, 'keydown', this.keydownHandler);
13556
13615
  EventHandler.remove(this.respectiveElement, 'input', this.inputHandler);
13557
13616
  EventHandler.remove(this.respectiveElement, 'change', this.changeHandler);
13558
13617
  if (this.isForm) {