@syncfusion/ej2-inputs 35.1.41 → 35.1.43

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 35.1.41
3
+ * version : 35.1.43
4
4
  * Copyright Syncfusion Inc. 2001 - 2025. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncfusion/ej2-inputs",
3
- "version": "35.1.41",
3
+ "version": "35.1.43",
4
4
  "description": "A package of Essential JS 2 input components such as Textbox, Color-picker, Masked-textbox, Numeric-textbox, Slider, Upload, and Form-validator that is used to get input from the users.",
5
5
  "author": "Syncfusion Inc.",
6
6
  "license": "SEE LICENSE IN license",
@@ -10,7 +10,7 @@
10
10
  "dependencies": {
11
11
  "@syncfusion/ej2-base": "~35.1.37",
12
12
  "@syncfusion/ej2-buttons": "~35.1.41",
13
- "@syncfusion/ej2-popups": "~35.1.39",
13
+ "@syncfusion/ej2-popups": "~35.1.42",
14
14
  "@syncfusion/ej2-splitbuttons": "~35.1.37"
15
15
  },
16
16
  "devDependencies": {},
@@ -399,11 +399,26 @@ var ColorPicker = /** @class */ (function (_super) {
399
399
  };
400
400
  ColorPicker.prototype.firstPaletteFocus = function () {
401
401
  if (!select('.' + SELECT, this.container.children[0])) {
402
- selectAll('.' + PALETTES, this.container)[0].focus();
402
+ var firstTile = select('.' + TILE, this.container);
403
+ if (firstTile) {
404
+ firstTile.focus();
405
+ }
406
+ else {
407
+ selectAll('.' + PALETTES, this.container)[0].focus();
408
+ }
403
409
  }
404
410
  };
405
411
  ColorPicker.prototype.appendPalette = function (colors, key, refEle) {
406
- var palette = this.createElement('div', { className: PALETTES, attrs: { 'tabindex': '0', 'role': 'grid' } });
412
+ var rowCount = Math.ceil(colors.length / this.columns);
413
+ var palette = this.createElement('div', {
414
+ className: PALETTES,
415
+ attrs: {
416
+ 'tabindex': '0', 'role': 'grid',
417
+ 'aria-label': (key === 'recent-color' ? 'Recent ' : '') + 'Color palette, ' + rowCount +
418
+ (rowCount === 1 ? ' row and ' : ' rows and ') + this.columns +
419
+ (this.columns === 1 ? ' column' : ' columns')
420
+ }
421
+ });
407
422
  if (key === 'recent-color') {
408
423
  palette.classList.add('e-recent-palette');
409
424
  }
@@ -416,34 +431,51 @@ var ColorPicker = /** @class */ (function (_super) {
416
431
  var row;
417
432
  var tile;
418
433
  var roundedColor;
434
+ var rowIdx = 0;
435
+ var colIdx;
419
436
  for (var i = 0, len = colors.length; i < len; i++) {
420
437
  if (i === 0 || i % this.columns === 0) {
438
+ rowIdx++;
439
+ colIdx = 0;
421
440
  row = this.createElement('div', {
422
- className: 'e-row', attrs: { 'role': 'row' }
441
+ className: 'e-row',
442
+ attrs: { 'role': 'row', 'aria-label': 'Row ' + rowIdx }
423
443
  });
424
444
  palette.appendChild(row);
425
445
  }
446
+ colIdx++;
426
447
  roundedColor = this.roundValue(colors[i]).toLowerCase();
427
448
  tile = this.createElement('span', {
428
- className: TILE, attrs: { 'role': 'gridcell', 'aria-label': roundedColor, 'aria-selected': 'false' }
449
+ className: TILE, attrs: {
450
+ 'role': 'gridcell', 'aria-label': roundedColor, 'aria-selected': 'false',
451
+ 'tabindex': '-1',
452
+ 'aria-rowindex': rowIdx.toString(), 'aria-colindex': colIdx.toString()
453
+ }
429
454
  });
430
455
  this.trigger('beforeTileRender', { element: tile, presetName: key, value: colors[i] });
431
456
  row.appendChild(tile);
432
457
  if (this.value === roundedColor && key !== 'recent-color') {
433
458
  this.addTileSelection(tile);
434
- palette.focus();
435
459
  }
436
460
  tile.style.backgroundColor = this.convertToRgbString(this.hexToRgb(roundedColor));
437
461
  }
462
+ var selectedTile = palette.querySelector('.' + TILE + '.' + SELECT);
463
+ if (selectedTile) {
464
+ selectedTile.focus();
465
+ }
438
466
  };
439
467
  ColorPicker.prototype.setNoColor = function () {
440
468
  var noColorEle = this.container.querySelector('.e-row').children[0];
441
469
  noColorEle.classList.add(NOCOLOR);
470
+ noColorEle.setAttribute('aria-label', 'No color');
442
471
  if (!this.value) {
443
472
  noColorEle.classList.add(SELECT);
444
- closest(noColorEle, '.' + PALETTES).focus();
473
+ noColorEle.setAttribute('aria-selected', 'true');
474
+ noColorEle.focus();
475
+ }
476
+ else {
477
+ noColorEle.setAttribute('aria-selected', 'false');
445
478
  }
446
- ['aria-selected', 'aria-label'].forEach(function (attr) { noColorEle.removeAttribute(attr); });
447
479
  noColorEle.style.backgroundColor = '';
448
480
  };
449
481
  ColorPicker.prototype.appendElement = function (ele, insertPos) {
@@ -1306,10 +1338,12 @@ var ColorPicker = /** @class */ (function (_super) {
1306
1338
  }
1307
1339
  };
1308
1340
  ColorPicker.prototype.paletteKeyDown = function (e) {
1309
- var target = e.target;
1310
- if (!target.classList.contains(PALETTES)) {
1341
+ var eventTarget = e.target;
1342
+ if (!eventTarget.classList.contains(PALETTES) && !eventTarget.classList.contains(TILE)) {
1311
1343
  return;
1312
1344
  }
1345
+ var target = eventTarget.classList.contains(TILE) ?
1346
+ closest(eventTarget, '.' + PALETTES) : eventTarget;
1313
1347
  var selectedEle;
1314
1348
  var idx;
1315
1349
  var tiles = [].slice.call(selectAll('.' + TILE, target));
@@ -1367,8 +1401,13 @@ var ColorPicker = /** @class */ (function (_super) {
1367
1401
  case 13:
1368
1402
  e.preventDefault();
1369
1403
  if (prevSelectedEle) {
1370
- var cValue = prevSelectedEle.getAttribute('aria-label');
1371
- this.enterKeyHandler(cValue ? cValue : '');
1404
+ if (prevSelectedEle.classList.contains(NOCOLOR)) {
1405
+ this.enterKeyHandler('');
1406
+ }
1407
+ else {
1408
+ var cValue = prevSelectedEle.getAttribute('aria-label');
1409
+ this.enterKeyHandler(cValue ? cValue : '');
1410
+ }
1372
1411
  }
1373
1412
  break;
1374
1413
  }
@@ -1389,6 +1428,9 @@ var ColorPicker = /** @class */ (function (_super) {
1389
1428
  }
1390
1429
  this.triggerEvent(cValue, pValue, this.convertToRgbString(this.rgb), true);
1391
1430
  }
1431
+ if (newEle) {
1432
+ newEle.focus();
1433
+ }
1392
1434
  };
1393
1435
  ColorPicker.prototype.tilePosition = function (items, element, cIdx) {
1394
1436
  items = Array.prototype.slice.call(items);
@@ -34,14 +34,33 @@ export var TEXTBOX_FOCUS = 'e-input-focus';
34
34
  // eslint-disable-next-line @typescript-eslint/no-namespace
35
35
  export var Input;
36
36
  (function (Input) {
37
- var privateInputObj = {
38
- container: null,
39
- buttons: [],
40
- clearButton: null
41
- };
42
37
  var floatType;
43
38
  var isBindClearAction = true;
44
39
  var resizeHandlers = new Map();
40
+ var mutationObservers = new Map();
41
+ var observeElementDetach = function (element, container, resizeHandler) {
42
+ var parent = container.parentElement;
43
+ if (!parent) {
44
+ return;
45
+ }
46
+ var observer = new MutationObserver(function () {
47
+ if (!document.documentElement.contains(container)) {
48
+ window.removeEventListener('resize', resizeHandler);
49
+ resizeHandlers.delete(element);
50
+ observer.disconnect();
51
+ mutationObservers.delete(element);
52
+ }
53
+ });
54
+ var host = parent;
55
+ while (host && host.parentElement && host.parentElement !== document.body) {
56
+ host = host.parentElement;
57
+ }
58
+ observer.observe(host || parent, {
59
+ childList: true,
60
+ subtree: true
61
+ });
62
+ mutationObservers.set(element, observer);
63
+ };
45
64
  /**
46
65
  * Create a wrapper to input element with multiple span elements and set the basic properties to input based components.
47
66
  * ```
@@ -84,7 +103,6 @@ export var Input;
84
103
  validateInputType(inputObject.container, args.element);
85
104
  inputObject = setPropertyValue(args, inputObject);
86
105
  createSpanElement(inputObject.container, makeElement);
87
- privateInputObj = inputObject;
88
106
  return inputObject;
89
107
  }
90
108
  Input.createInput = createInput;
@@ -467,8 +485,11 @@ export var Input;
467
485
  if (!isNullOrUndefined(resizeHandlers)) {
468
486
  var resizeHandler = resizeHandlers.get(args.element);
469
487
  if (resizeHandler) {
470
- window.removeEventListener('resize', resizeHandler);
471
- resizeHandlers.delete(args.element);
488
+ var observer = mutationObservers.get(args.element);
489
+ if (observer) {
490
+ observer.disconnect();
491
+ mutationObservers.delete(args.element);
492
+ }
472
493
  if (isReactMode) {
473
494
  resizeHandlers = null;
474
495
  }
@@ -480,7 +501,6 @@ export var Input;
480
501
  args.element.classList.remove(CLASSNAMES.INPUT);
481
502
  }
482
503
  }
483
- privateInputObj = null;
484
504
  }
485
505
  Input.destroy = destroy;
486
506
  function validateLabel(element, floatLabelType) {
@@ -612,6 +632,7 @@ export var Input;
612
632
  };
613
633
  resizeHandlers.set(element, resizeHandler_1);
614
634
  window.addEventListener('resize', resizeHandler_1);
635
+ observeElementDetach(element, container, resizeHandler_1);
615
636
  }
616
637
  if (moduleName !== 'multiselect' && !_isElementVisible(element)) {
617
638
  return;
@@ -472,12 +472,18 @@ var NumericTextBox = /** @class */ (function (_super) {
472
472
  'title': this.l10n.getConstant('decrementTitle'),
473
473
  'aria-label': this.l10n.getConstant('decrementTitle')
474
474
  });
475
+ if (this.spinDown.getAttribute('aria-label')) {
476
+ this.spinDown.setAttribute('role', 'button');
477
+ }
475
478
  }
476
479
  if (!isNullOrUndefined(this.spinUp)) {
477
480
  attributes(this.spinUp, {
478
481
  'title': this.l10n.getConstant('incrementTitle'),
479
482
  'aria-label': this.l10n.getConstant('incrementTitle')
480
483
  });
484
+ if (this.spinUp.getAttribute('aria-label')) {
485
+ this.spinUp.setAttribute('role', 'button');
486
+ }
481
487
  }
482
488
  };
483
489
  NumericTextBox.prototype.wireEvents = function () {