@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.
- package/dist/ej2-inputs.min.js +2 -2
- package/dist/ej2-inputs.umd.min.js +2 -2
- package/dist/ej2-inputs.umd.min.js.map +1 -1
- package/dist/es6/ej2-inputs.es2015.js +89 -13
- package/dist/es6/ej2-inputs.es2015.js.map +1 -1
- package/dist/es6/ej2-inputs.es5.js +89 -13
- package/dist/es6/ej2-inputs.es5.js.map +1 -1
- package/dist/global/ej2-inputs.min.js +2 -2
- package/dist/global/ej2-inputs.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +2 -2
- package/src/color-picker/color-picker.js +53 -11
- package/src/input/input.js +30 -9
- package/src/numerictextbox/numerictextbox.js +6 -0
|
@@ -40,6 +40,30 @@ var Input;
|
|
|
40
40
|
let floatType;
|
|
41
41
|
let isBindClearAction = true;
|
|
42
42
|
let resizeHandlers = new Map();
|
|
43
|
+
const mutationObservers = new Map();
|
|
44
|
+
const observeElementDetach = (element, container, resizeHandler) => {
|
|
45
|
+
const parent = container.parentElement;
|
|
46
|
+
if (!parent) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const observer = new MutationObserver(() => {
|
|
50
|
+
if (!document.documentElement.contains(container)) {
|
|
51
|
+
window.removeEventListener('resize', resizeHandler);
|
|
52
|
+
resizeHandlers.delete(element);
|
|
53
|
+
observer.disconnect();
|
|
54
|
+
mutationObservers.delete(element);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
let host = parent;
|
|
58
|
+
while (host && host.parentElement && host.parentElement !== document.body) {
|
|
59
|
+
host = host.parentElement;
|
|
60
|
+
}
|
|
61
|
+
observer.observe(host || parent, {
|
|
62
|
+
childList: true,
|
|
63
|
+
subtree: true
|
|
64
|
+
});
|
|
65
|
+
mutationObservers.set(element, observer);
|
|
66
|
+
};
|
|
43
67
|
/**
|
|
44
68
|
* Create a wrapper to input element with multiple span elements and set the basic properties to input based components.
|
|
45
69
|
* ```
|
|
@@ -461,8 +485,11 @@ var Input;
|
|
|
461
485
|
if (!isNullOrUndefined(resizeHandlers)) {
|
|
462
486
|
const resizeHandler = resizeHandlers.get(args.element);
|
|
463
487
|
if (resizeHandler) {
|
|
464
|
-
|
|
465
|
-
|
|
488
|
+
const observer = mutationObservers.get(args.element);
|
|
489
|
+
if (observer) {
|
|
490
|
+
observer.disconnect();
|
|
491
|
+
mutationObservers.delete(args.element);
|
|
492
|
+
}
|
|
466
493
|
if (isReactMode) {
|
|
467
494
|
resizeHandlers = null;
|
|
468
495
|
}
|
|
@@ -605,6 +632,7 @@ var Input;
|
|
|
605
632
|
};
|
|
606
633
|
resizeHandlers.set(element, resizeHandler);
|
|
607
634
|
window.addEventListener('resize', resizeHandler);
|
|
635
|
+
observeElementDetach(element, container, resizeHandler);
|
|
608
636
|
}
|
|
609
637
|
if (moduleName !== 'multiselect' && !_isElementVisible(element)) {
|
|
610
638
|
return;
|
|
@@ -1604,12 +1632,18 @@ let NumericTextBox = class NumericTextBox extends Component {
|
|
|
1604
1632
|
'title': this.l10n.getConstant('decrementTitle'),
|
|
1605
1633
|
'aria-label': this.l10n.getConstant('decrementTitle')
|
|
1606
1634
|
});
|
|
1635
|
+
if (this.spinDown.getAttribute('aria-label')) {
|
|
1636
|
+
this.spinDown.setAttribute('role', 'button');
|
|
1637
|
+
}
|
|
1607
1638
|
}
|
|
1608
1639
|
if (!isNullOrUndefined(this.spinUp)) {
|
|
1609
1640
|
attributes(this.spinUp, {
|
|
1610
1641
|
'title': this.l10n.getConstant('incrementTitle'),
|
|
1611
1642
|
'aria-label': this.l10n.getConstant('incrementTitle')
|
|
1612
1643
|
});
|
|
1644
|
+
if (this.spinUp.getAttribute('aria-label')) {
|
|
1645
|
+
this.spinUp.setAttribute('role', 'button');
|
|
1646
|
+
}
|
|
1613
1647
|
}
|
|
1614
1648
|
}
|
|
1615
1649
|
wireEvents() {
|
|
@@ -12458,11 +12492,26 @@ let ColorPicker = class ColorPicker extends Component {
|
|
|
12458
12492
|
}
|
|
12459
12493
|
firstPaletteFocus() {
|
|
12460
12494
|
if (!select('.' + SELECT, this.container.children[0])) {
|
|
12461
|
-
|
|
12495
|
+
const firstTile = select('.' + TILE, this.container);
|
|
12496
|
+
if (firstTile) {
|
|
12497
|
+
firstTile.focus();
|
|
12498
|
+
}
|
|
12499
|
+
else {
|
|
12500
|
+
selectAll('.' + PALETTES, this.container)[0].focus();
|
|
12501
|
+
}
|
|
12462
12502
|
}
|
|
12463
12503
|
}
|
|
12464
12504
|
appendPalette(colors, key, refEle) {
|
|
12465
|
-
const
|
|
12505
|
+
const rowCount = Math.ceil(colors.length / this.columns);
|
|
12506
|
+
const palette = this.createElement('div', {
|
|
12507
|
+
className: PALETTES,
|
|
12508
|
+
attrs: {
|
|
12509
|
+
'tabindex': '0', 'role': 'grid',
|
|
12510
|
+
'aria-label': (key === 'recent-color' ? 'Recent ' : '') + 'Color palette, ' + rowCount +
|
|
12511
|
+
(rowCount === 1 ? ' row and ' : ' rows and ') + this.columns +
|
|
12512
|
+
(this.columns === 1 ? ' column' : ' columns')
|
|
12513
|
+
}
|
|
12514
|
+
});
|
|
12466
12515
|
if (key === 'recent-color') {
|
|
12467
12516
|
palette.classList.add('e-recent-palette');
|
|
12468
12517
|
}
|
|
@@ -12475,34 +12524,51 @@ let ColorPicker = class ColorPicker extends Component {
|
|
|
12475
12524
|
let row;
|
|
12476
12525
|
let tile;
|
|
12477
12526
|
let roundedColor;
|
|
12527
|
+
let rowIdx = 0;
|
|
12528
|
+
let colIdx;
|
|
12478
12529
|
for (let i = 0, len = colors.length; i < len; i++) {
|
|
12479
12530
|
if (i === 0 || i % this.columns === 0) {
|
|
12531
|
+
rowIdx++;
|
|
12532
|
+
colIdx = 0;
|
|
12480
12533
|
row = this.createElement('div', {
|
|
12481
|
-
className: 'e-row',
|
|
12534
|
+
className: 'e-row',
|
|
12535
|
+
attrs: { 'role': 'row', 'aria-label': 'Row ' + rowIdx }
|
|
12482
12536
|
});
|
|
12483
12537
|
palette.appendChild(row);
|
|
12484
12538
|
}
|
|
12539
|
+
colIdx++;
|
|
12485
12540
|
roundedColor = this.roundValue(colors[i]).toLowerCase();
|
|
12486
12541
|
tile = this.createElement('span', {
|
|
12487
|
-
className: TILE, attrs: {
|
|
12542
|
+
className: TILE, attrs: {
|
|
12543
|
+
'role': 'gridcell', 'aria-label': roundedColor, 'aria-selected': 'false',
|
|
12544
|
+
'tabindex': '-1',
|
|
12545
|
+
'aria-rowindex': rowIdx.toString(), 'aria-colindex': colIdx.toString()
|
|
12546
|
+
}
|
|
12488
12547
|
});
|
|
12489
12548
|
this.trigger('beforeTileRender', { element: tile, presetName: key, value: colors[i] });
|
|
12490
12549
|
row.appendChild(tile);
|
|
12491
12550
|
if (this.value === roundedColor && key !== 'recent-color') {
|
|
12492
12551
|
this.addTileSelection(tile);
|
|
12493
|
-
palette.focus();
|
|
12494
12552
|
}
|
|
12495
12553
|
tile.style.backgroundColor = this.convertToRgbString(this.hexToRgb(roundedColor));
|
|
12496
12554
|
}
|
|
12555
|
+
const selectedTile = palette.querySelector('.' + TILE + '.' + SELECT);
|
|
12556
|
+
if (selectedTile) {
|
|
12557
|
+
selectedTile.focus();
|
|
12558
|
+
}
|
|
12497
12559
|
}
|
|
12498
12560
|
setNoColor() {
|
|
12499
12561
|
const noColorEle = this.container.querySelector('.e-row').children[0];
|
|
12500
12562
|
noColorEle.classList.add(NOCOLOR);
|
|
12563
|
+
noColorEle.setAttribute('aria-label', 'No color');
|
|
12501
12564
|
if (!this.value) {
|
|
12502
12565
|
noColorEle.classList.add(SELECT);
|
|
12503
|
-
|
|
12566
|
+
noColorEle.setAttribute('aria-selected', 'true');
|
|
12567
|
+
noColorEle.focus();
|
|
12568
|
+
}
|
|
12569
|
+
else {
|
|
12570
|
+
noColorEle.setAttribute('aria-selected', 'false');
|
|
12504
12571
|
}
|
|
12505
|
-
['aria-selected', 'aria-label'].forEach((attr) => { noColorEle.removeAttribute(attr); });
|
|
12506
12572
|
noColorEle.style.backgroundColor = '';
|
|
12507
12573
|
}
|
|
12508
12574
|
appendElement(ele, insertPos = 0) {
|
|
@@ -13358,10 +13424,12 @@ let ColorPicker = class ColorPicker extends Component {
|
|
|
13358
13424
|
}
|
|
13359
13425
|
}
|
|
13360
13426
|
paletteKeyDown(e) {
|
|
13361
|
-
const
|
|
13362
|
-
if (!
|
|
13427
|
+
const eventTarget = e.target;
|
|
13428
|
+
if (!eventTarget.classList.contains(PALETTES) && !eventTarget.classList.contains(TILE)) {
|
|
13363
13429
|
return;
|
|
13364
13430
|
}
|
|
13431
|
+
const target = eventTarget.classList.contains(TILE) ?
|
|
13432
|
+
closest(eventTarget, '.' + PALETTES) : eventTarget;
|
|
13365
13433
|
let selectedEle;
|
|
13366
13434
|
let idx;
|
|
13367
13435
|
const tiles = [].slice.call(selectAll('.' + TILE, target));
|
|
@@ -13419,8 +13487,13 @@ let ColorPicker = class ColorPicker extends Component {
|
|
|
13419
13487
|
case 13:
|
|
13420
13488
|
e.preventDefault();
|
|
13421
13489
|
if (prevSelectedEle) {
|
|
13422
|
-
|
|
13423
|
-
|
|
13490
|
+
if (prevSelectedEle.classList.contains(NOCOLOR)) {
|
|
13491
|
+
this.enterKeyHandler('');
|
|
13492
|
+
}
|
|
13493
|
+
else {
|
|
13494
|
+
const cValue = prevSelectedEle.getAttribute('aria-label');
|
|
13495
|
+
this.enterKeyHandler(cValue ? cValue : '');
|
|
13496
|
+
}
|
|
13424
13497
|
}
|
|
13425
13498
|
break;
|
|
13426
13499
|
}
|
|
@@ -13441,6 +13514,9 @@ let ColorPicker = class ColorPicker extends Component {
|
|
|
13441
13514
|
}
|
|
13442
13515
|
this.triggerEvent(cValue, pValue, this.convertToRgbString(this.rgb), true);
|
|
13443
13516
|
}
|
|
13517
|
+
if (newEle) {
|
|
13518
|
+
newEle.focus();
|
|
13519
|
+
}
|
|
13444
13520
|
}
|
|
13445
13521
|
tilePosition(items, element, cIdx) {
|
|
13446
13522
|
items = Array.prototype.slice.call(items);
|