@syncfusion/ej2-inputs 22.1.39 → 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.
@@ -4192,7 +4192,7 @@ let Slider = class Slider extends Component {
4192
4192
  this.setCSSClass();
4193
4193
  }
4194
4194
  setElementWidth(width) {
4195
- if (!isNullOrUndefined(width)) {
4195
+ if (!isNullOrUndefined(width) && !isNullOrUndefined(this.sliderContainer)) {
4196
4196
  if (typeof width === 'number') {
4197
4197
  this.sliderContainer.style.width = formatUnit(width);
4198
4198
  }
@@ -4752,10 +4752,12 @@ let Slider = class Slider extends Component {
4752
4752
  this.tooltipElement.style.transform = this.getTooltipTransformProperties(this.previousTooltipClass).rotate;
4753
4753
  }
4754
4754
  if (this.type === 'Default') {
4755
- setTimeout(() => { this.tooltipElement.style.transition = this.transition.handle; }, 2500);
4755
+ setTimeout(() => { if (this.tooltipElement)
4756
+ this.tooltipElement.style.transition = this.transition.handle; }, 2500);
4756
4757
  }
4757
4758
  else {
4758
- setTimeout(() => { this.tooltipElement.style.transition = 'none'; }, 2500);
4759
+ setTimeout(() => { if (this.tooltipElement)
4760
+ this.tooltipElement.style.transition = 'none'; }, 2500);
4759
4761
  }
4760
4762
  }
4761
4763
  }
@@ -4773,7 +4775,8 @@ let Slider = class Slider extends Component {
4773
4775
  this.tooltipElement.classList.remove(classNames.materialTooltipOpen);
4774
4776
  this.setTooltipTransform();
4775
4777
  this.tooltipTarget = undefined;
4776
- setTimeout(() => { this.tooltipElement.style.transition = 'none'; }, 2500);
4778
+ setTimeout(() => { if (this.tooltipElement)
4779
+ this.tooltipElement.style.transition = 'none'; }, 2500);
4777
4780
  }
4778
4781
  }
4779
4782
  checkTooltipPosition(args) {
@@ -4799,6 +4802,8 @@ let Slider = class Slider extends Component {
4799
4802
  }
4800
4803
  setTooltipTransform() {
4801
4804
  let transformProperties = this.getTooltipTransformProperties(this.previousTooltipClass);
4805
+ if (isNullOrUndefined(this.tooltipElement))
4806
+ return;
4802
4807
  if (this.tooltipElement.firstElementChild.innerText.length > 4) {
4803
4808
  this.tooltipElement.style.transform = `${transformProperties.translate} scale(0.01)`;
4804
4809
  }
@@ -5336,7 +5341,7 @@ let Slider = class Slider extends Component {
5336
5341
  }
5337
5342
  }
5338
5343
  setRangeBar() {
5339
- if (this.orientation === 'Horizontal') {
5344
+ if (this.orientation === 'Horizontal' && !isNullOrUndefined(this.rangeBar)) {
5340
5345
  if (this.type === 'MinRange') {
5341
5346
  // eslint-disable-next-line
5342
5347
  this.enableRtl ? (this.rangeBar.style.right = '0px') : (this.rangeBar.style.left = '0px');
@@ -5349,7 +5354,7 @@ let Slider = class Slider extends Component {
5349
5354
  setStyleAttribute(this.rangeBar, { 'width': this.handlePos2 - this.handlePos1 + 'px' });
5350
5355
  }
5351
5356
  }
5352
- else {
5357
+ else if (!isNullOrUndefined(this.rangeBar)) {
5353
5358
  if (this.type === 'MinRange') {
5354
5359
  this.rangeBar.style.bottom = this.min > this.max ? this.handlePos1 + 'px' : '0px';
5355
5360
  setStyleAttribute(this.rangeBar, { 'height': isNullOrUndefined(this.handlePos1) ? 0 : this.min > this.max ? this.element.clientHeight - this.handlePos1 + 'px' : this.handlePos1 + 'px' });
@@ -5486,7 +5491,7 @@ let Slider = class Slider extends Component {
5486
5491
  this.setRangeValue();
5487
5492
  }
5488
5493
  modifyZindex() {
5489
- if (this.type === 'Range') {
5494
+ if (this.type === 'Range' && !isNullOrUndefined(this.firstHandle) && !isNullOrUndefined(this.secondHandle)) {
5490
5495
  if (this.activeHandle === 1) {
5491
5496
  this.firstHandle.style.zIndex = (this.zIndex + 4) + '';
5492
5497
  this.secondHandle.style.zIndex = (this.zIndex + 3) + '';
@@ -5669,11 +5674,12 @@ let Slider = class Slider extends Component {
5669
5674
  * @returns void
5670
5675
  */
5671
5676
  reposition() {
5672
- this.firstHandle.style.transition = 'none';
5673
- if (this.type !== 'Default') {
5677
+ if (!isNullOrUndefined(this.firstHandle))
5678
+ this.firstHandle.style.transition = 'none';
5679
+ if (this.type !== 'Default' && !isNullOrUndefined(this.rangeBar)) {
5674
5680
  this.rangeBar.style.transition = 'none';
5675
5681
  }
5676
- if (this.type === 'Range') {
5682
+ if (this.type === 'Range' && !isNullOrUndefined(this.secondHandle)) {
5677
5683
  this.secondHandle.style.transition = 'none';
5678
5684
  }
5679
5685
  this.handlePos1 = this.checkHandlePosition(this.handleVal1);
@@ -5684,17 +5690,17 @@ let Slider = class Slider extends Component {
5684
5690
  // eslint-disable-next-line
5685
5691
  this.enableRtl ? this.firstHandle.style.right =
5686
5692
  `${this.handlePos1}px` : this.firstHandle.style.left = `${this.handlePos1}px`;
5687
- if (this.isMaterialTooltip) {
5693
+ if (this.isMaterialTooltip && !isNullOrUndefined(this.materialHandle)) {
5688
5694
  // eslint-disable-next-line
5689
5695
  this.enableRtl ? this.materialHandle.style.right =
5690
5696
  `${this.handlePos1}px` : this.materialHandle.style.left = `${this.handlePos1}px`;
5691
5697
  }
5692
- if (this.type === 'MinRange') {
5698
+ if (this.type === 'MinRange' && !isNullOrUndefined(this.rangeBar)) {
5693
5699
  // eslint-disable-next-line
5694
5700
  this.enableRtl ? (this.rangeBar.style.right = '0px') : (this.rangeBar.style.left = '0px');
5695
5701
  setStyleAttribute(this.rangeBar, { 'width': isNullOrUndefined(this.handlePos1) ? 0 : this.handlePos1 + 'px' });
5696
5702
  }
5697
- else if (this.type === 'Range') {
5703
+ else if (this.type === 'Range' && !isNullOrUndefined(this.secondHandle) && !isNullOrUndefined(this.rangeBar)) {
5698
5704
  // eslint-disable-next-line
5699
5705
  this.enableRtl ? this.secondHandle.style.right =
5700
5706
  `${this.handlePos2}px` : this.secondHandle.style.left = `${this.handlePos2}px`;
@@ -5730,8 +5736,9 @@ let Slider = class Slider extends Component {
5730
5736
  this.handleStart();
5731
5737
  if (!this.tooltip.isVisible) {
5732
5738
  setTimeout(() => {
5733
- this.firstHandle.style.transition = this.scaleTransform;
5734
- if (this.type === 'Range') {
5739
+ if (!isNullOrUndefined(this.firstHandle))
5740
+ this.firstHandle.style.transition = this.scaleTransform;
5741
+ if (this.type === 'Range' && !isNullOrUndefined(this.secondHandle)) {
5735
5742
  this.secondHandle.style.transition = this.scaleTransform;
5736
5743
  }
5737
5744
  });
@@ -6529,6 +6536,24 @@ let Slider = class Slider extends Component {
6529
6536
  this.tooltipObj.destroy();
6530
6537
  }
6531
6538
  this.element.innerHTML = '';
6539
+ this.hiddenInput = null;
6540
+ this.sliderContainer = null;
6541
+ this.sliderTrack = null;
6542
+ this.rangeBar = null;
6543
+ this.firstHandle = null;
6544
+ this.secondHandle = null;
6545
+ this.tickElementCollection = null;
6546
+ this.ul = null;
6547
+ this.firstBtn = null;
6548
+ this.secondBtn = null;
6549
+ this.materialHandle = null;
6550
+ this.tooltipObj = null;
6551
+ this.tooltipTarget = null;
6552
+ this.limitBarFirst = null;
6553
+ this.limitBarSecond = null;
6554
+ this.firstChild = null;
6555
+ this.lastChild = null;
6556
+ this.tooltipElement = null;
6532
6557
  }
6533
6558
  /**
6534
6559
  * Calls internally if any of the property value is changed.
@@ -6684,15 +6709,16 @@ let Slider = class Slider extends Component {
6684
6709
  }
6685
6710
  setZindex() {
6686
6711
  this.zIndex = 6;
6687
- if (!isNullOrUndefined(this.ticks) && this.ticks.placement !== 'None') {
6712
+ if (!isNullOrUndefined(this.ticks) && this.ticks.placement !== 'None' && !isNullOrUndefined(this.ul) && !isNullOrUndefined(this.element)) {
6688
6713
  this.ul.style.zIndex = (this.zIndex + -7) + '';
6689
6714
  this.element.style.zIndex = (this.zIndex + 2) + '';
6690
6715
  }
6691
6716
  if (!this.isMaterial && !this.isMaterial3 && !isNullOrUndefined(this.ticks) && this.ticks.placement === 'Both') {
6692
6717
  this.element.style.zIndex = (this.zIndex + 2) + '';
6693
6718
  }
6694
- this.firstHandle.style.zIndex = (this.zIndex + 3) + '';
6695
- if (this.type === 'Range') {
6719
+ if (!isNullOrUndefined(this.firstHandle))
6720
+ this.firstHandle.style.zIndex = (this.zIndex + 3) + '';
6721
+ if (this.type === 'Range' && !isNullOrUndefined(this.secondHandle)) {
6696
6722
  this.secondHandle.style.zIndex = (this.zIndex + 4) + '';
6697
6723
  }
6698
6724
  }
@@ -7122,13 +7148,31 @@ let FormValidator = FormValidator_1 = class FormValidator extends Base {
7122
7148
  for (const element of elements) {
7123
7149
  const input = element;
7124
7150
  input.removeAttribute('aria-invalid');
7125
- 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
+ }
7126
7162
  if (input.name.length > 0) {
7127
7163
  this.getInputElement(input.name);
7128
7164
  this.getErrorElement(input.name);
7129
7165
  this.hideMessage(input.name);
7130
7166
  }
7131
- 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
+ }
7132
7176
  }
7133
7177
  }
7134
7178
  createHTML5Rules() {
@@ -7371,8 +7415,20 @@ let FormValidator = FormValidator_1 = class FormValidator extends Base {
7371
7415
  // Set aria attributes to invalid elements
7372
7416
  this.inputElement.setAttribute('aria-invalid', 'true');
7373
7417
  this.inputElement.setAttribute('aria-describedby', this.inputElement.id + '-info');
7374
- this.inputElement.classList.add(this.errorClass);
7375
- 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
+ }
7376
7432
  if (!this.infoElement) {
7377
7433
  this.createErrorElement(name, errorRule.message, this.inputElement);
7378
7434
  }
@@ -7381,8 +7437,18 @@ let FormValidator = FormValidator_1 = class FormValidator extends Base {
7381
7437
  }
7382
7438
  eventArgs.errorElement = this.infoElement;
7383
7439
  eventArgs.status = 'failure';
7384
- this.inputElement.classList.add(this.errorClass);
7385
- 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
+ }
7386
7452
  this.optionalValidationStatus(name, eventArgs);
7387
7453
  this.trigger('validationComplete', eventArgs);
7388
7454
  // Set aria-required to required rule elements
@@ -7524,8 +7590,20 @@ let FormValidator = FormValidator_1 = class FormValidator extends Base {
7524
7590
  if (this.infoElement) {
7525
7591
  this.infoElement.style.display = 'none';
7526
7592
  this.removeErrorRules(name);
7527
- this.inputElement.classList.add(this.validClass);
7528
- 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
+ }
7529
7607
  this.inputElement.setAttribute('aria-invalid', 'false');
7530
7608
  }
7531
7609
  }
@@ -13375,6 +13453,7 @@ let TextBox = class TextBox extends Component {
13375
13453
  wireEvents() {
13376
13454
  EventHandler.add(this.respectiveElement, 'focus', this.focusHandler, this);
13377
13455
  EventHandler.add(this.respectiveElement, 'blur', this.focusOutHandler, this);
13456
+ EventHandler.add(this.respectiveElement, 'keydown', this.keydownHandler, this);
13378
13457
  EventHandler.add(this.respectiveElement, 'input', this.inputHandler, this);
13379
13458
  EventHandler.add(this.respectiveElement, 'change', this.changeHandler, this);
13380
13459
  if (this.isForm) {
@@ -13444,6 +13523,11 @@ let TextBox = class TextBox extends Component {
13444
13523
  };
13445
13524
  this.trigger('blur', eventArgs);
13446
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
+ }
13447
13531
  inputHandler(args) {
13448
13532
  // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-this-alias
13449
13533
  const textboxObj = this;
@@ -13527,6 +13611,7 @@ let TextBox = class TextBox extends Component {
13527
13611
  unWireEvents() {
13528
13612
  EventHandler.remove(this.respectiveElement, 'focus', this.focusHandler);
13529
13613
  EventHandler.remove(this.respectiveElement, 'blur', this.focusOutHandler);
13614
+ EventHandler.remove(this.respectiveElement, 'keydown', this.keydownHandler);
13530
13615
  EventHandler.remove(this.respectiveElement, 'input', this.inputHandler);
13531
13616
  EventHandler.remove(this.respectiveElement, 'change', this.changeHandler);
13532
13617
  if (this.isForm) {
@@ -14370,18 +14455,28 @@ class SignatureBase extends Component {
14370
14455
  * @param {string} text - specify text to be drawn as signature.
14371
14456
  * @param {string} fontFamily - specify font family of a signature.
14372
14457
  * @param {number} fontSize - specify font size of a signature.
14458
+ * @param {number} x- Specifies the x-coordinate to start the text of a signature. Default to the center point of the image if it not specified.
14459
+ * @param {number} y - Specifies the y-coordinate to start the text of a signature. Default to the center point of the image if it not specified.
14373
14460
  *
14374
14461
  * @returns {void}.
14375
14462
  */
14376
- draw(text, fontFamily, fontSize) {
14463
+ draw(text, fontFamily, fontSize, x, y) {
14377
14464
  const args = { actionName: 'draw-text' };
14378
14465
  this.canvasContext.clearRect(0, 0, this.canvasContext.canvas.width, this.canvasContext.canvas.height);
14379
14466
  fontFamily = fontFamily || 'Arial';
14380
14467
  fontSize = fontSize || 30;
14381
14468
  this.canvasContext.font = fontSize + 'px ' + fontFamily;
14382
- this.canvasContext.textAlign = 'center';
14383
- this.canvasContext.textBaseline = 'middle';
14384
- this.canvasContext.fillText(text, this.element.width / 2, this.element.height / 2);
14469
+ let startX = this.element.width / 2;
14470
+ let startY = this.element.height / 2;
14471
+ if (isNullOrUndefined(x) && isNullOrUndefined(y)) {
14472
+ this.canvasContext.textAlign = 'center';
14473
+ this.canvasContext.textBaseline = 'middle';
14474
+ }
14475
+ else {
14476
+ startX = isNullOrUndefined(x) ? startX : x;
14477
+ startY = isNullOrUndefined(y) ? startY + fontSize / 2 : (y + fontSize / 2);
14478
+ }
14479
+ this.canvasContext.fillText(text, startX, startY);
14385
14480
  this.updateSnapCollection();
14386
14481
  this.isSignatureEmpty = false;
14387
14482
  this.trigger('change', args);