@syncfusion/ej2-dropdowns 34.1.33 → 34.2.3
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-dropdowns.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js +2 -2
- package/dist/ej2-dropdowns.umd.min.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es2015.js +202 -10
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +210 -10
- package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
- package/dist/global/ej2-dropdowns.min.js +2 -2
- package/dist/global/ej2-dropdowns.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +8 -8
- package/src/drop-down-tree/drop-down-tree.d.ts +5 -0
- package/src/drop-down-tree/drop-down-tree.js +142 -0
- package/src/list-box/list-box.js +4 -2
- package/src/mention/mention.js +3 -2
- package/src/multi-select/multi-select.d.ts +3 -0
- package/src/multi-select/multi-select.js +61 -6
|
@@ -8144,6 +8144,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
8144
8144
|
this.windowResizeContext = this.windowResize.bind(this);
|
|
8145
8145
|
// Specifies if the checkAll method has been called
|
|
8146
8146
|
this.isCheckAllCalled = false;
|
|
8147
|
+
this.isNodeChecked = false;
|
|
8147
8148
|
this.isFromFilterChange = false;
|
|
8148
8149
|
this.fallbackValue = [];
|
|
8149
8150
|
}
|
|
@@ -10158,6 +10159,7 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
10158
10159
|
onNodeChecked(args) {
|
|
10159
10160
|
const eventArgs = this.getEventArgs(args);
|
|
10160
10161
|
this.trigger('select', eventArgs);
|
|
10162
|
+
this.isNodeChecked = args.action === 'check';
|
|
10161
10163
|
if (this.isFilteredData && args.action === 'uncheck') {
|
|
10162
10164
|
const id = getValue('id', args.data[0]).toString();
|
|
10163
10165
|
this.removeSelectedData(id, true);
|
|
@@ -10481,6 +10483,135 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
10481
10483
|
}
|
|
10482
10484
|
}
|
|
10483
10485
|
}
|
|
10486
|
+
getFilteredTreeData() {
|
|
10487
|
+
return this.treeData;
|
|
10488
|
+
}
|
|
10489
|
+
getChildren(parentId, result) {
|
|
10490
|
+
const treeData = this.getFilteredTreeData();
|
|
10491
|
+
treeData.forEach((item) => {
|
|
10492
|
+
if (!isNullOrUndefined(item) && !isNullOrUndefined(item.pid) && !isNullOrUndefined(item.id) && item.pid.toString() === parentId.toString()) {
|
|
10493
|
+
const childId = item.id.toString();
|
|
10494
|
+
if (result.indexOf(childId) === -1) {
|
|
10495
|
+
result.push(childId);
|
|
10496
|
+
this.getChildren(childId, result);
|
|
10497
|
+
}
|
|
10498
|
+
}
|
|
10499
|
+
});
|
|
10500
|
+
}
|
|
10501
|
+
getDirectChildren(parentId) {
|
|
10502
|
+
return this.getFilteredTreeData()
|
|
10503
|
+
.filter((childNode) => !isNullOrUndefined(childNode) && !isNullOrUndefined(childNode.pid) && !isNullOrUndefined(childNode.id) && childNode.pid.toString() === parentId)
|
|
10504
|
+
.map((childNode) => childNode.id.toString());
|
|
10505
|
+
}
|
|
10506
|
+
updateFilteredAutoCheckValues() {
|
|
10507
|
+
const treeData = this.getFilteredTreeData();
|
|
10508
|
+
let currentValues = Array.isArray(this.value) ? this.value.map((item) => item.toString()) : [];
|
|
10509
|
+
const removeParent = (parentId) => {
|
|
10510
|
+
this.value = this.value.filter((value) => value.toString() !== parentId);
|
|
10511
|
+
};
|
|
10512
|
+
if (this.isNodeChecked) {
|
|
10513
|
+
this.treeObj.checkedNodes.map((item) => item.toString()).forEach((value) => {
|
|
10514
|
+
if (this.value.indexOf(value) === -1) {
|
|
10515
|
+
this.value.push(value);
|
|
10516
|
+
}
|
|
10517
|
+
});
|
|
10518
|
+
treeData.forEach((node) => {
|
|
10519
|
+
if (isNullOrUndefined(node) || isNullOrUndefined(node.id)) {
|
|
10520
|
+
return;
|
|
10521
|
+
}
|
|
10522
|
+
const parentId = node.id.toString();
|
|
10523
|
+
if (node.haschild && this.value.indexOf(parentId) !== -1) {
|
|
10524
|
+
const childValues = [];
|
|
10525
|
+
this.getChildren(parentId, childValues);
|
|
10526
|
+
if (this.value.indexOf(parentId) === -1) {
|
|
10527
|
+
this.value.push(parentId);
|
|
10528
|
+
}
|
|
10529
|
+
childValues.forEach((value) => {
|
|
10530
|
+
if (this.value.indexOf(value) === -1) {
|
|
10531
|
+
this.value.push(value);
|
|
10532
|
+
}
|
|
10533
|
+
});
|
|
10534
|
+
}
|
|
10535
|
+
currentValues = this.value.map((item) => item.toString());
|
|
10536
|
+
});
|
|
10537
|
+
treeData.forEach((node) => {
|
|
10538
|
+
if (isNullOrUndefined(node) || isNullOrUndefined(node.id)) {
|
|
10539
|
+
return;
|
|
10540
|
+
}
|
|
10541
|
+
if (!node.haschild) {
|
|
10542
|
+
return;
|
|
10543
|
+
}
|
|
10544
|
+
const parentId = node.id.toString();
|
|
10545
|
+
const directChildren = this.getDirectChildren(parentId);
|
|
10546
|
+
if (!directChildren.length) {
|
|
10547
|
+
return;
|
|
10548
|
+
}
|
|
10549
|
+
const allChildrenSelected = directChildren.every((childId) => this.value.indexOf(childId) !== -1);
|
|
10550
|
+
if (allChildrenSelected) {
|
|
10551
|
+
const childValues = [];
|
|
10552
|
+
this.getChildren(parentId, childValues);
|
|
10553
|
+
if (this.value.indexOf(parentId) === -1) {
|
|
10554
|
+
this.value.push(parentId);
|
|
10555
|
+
}
|
|
10556
|
+
childValues.forEach((value) => {
|
|
10557
|
+
if (this.value.indexOf(value) === -1) {
|
|
10558
|
+
this.value.push(value);
|
|
10559
|
+
}
|
|
10560
|
+
});
|
|
10561
|
+
}
|
|
10562
|
+
else {
|
|
10563
|
+
removeParent(parentId);
|
|
10564
|
+
}
|
|
10565
|
+
currentValues = this.value.map((item) => item.toString());
|
|
10566
|
+
});
|
|
10567
|
+
this.selectedData.forEach((item) => {
|
|
10568
|
+
const value = getValue(this.treeSettings.loadOnDemand ? this.fields.value : 'id', item).toString();
|
|
10569
|
+
if (this.value.indexOf(value) === -1) {
|
|
10570
|
+
this.selectedData = this.selectedData.filter((data) => getValue(this.treeSettings.loadOnDemand ? this.fields.value : 'id', data).toString() !== value);
|
|
10571
|
+
}
|
|
10572
|
+
});
|
|
10573
|
+
return;
|
|
10574
|
+
}
|
|
10575
|
+
const removeValues = [];
|
|
10576
|
+
treeData.forEach((node) => {
|
|
10577
|
+
if (isNullOrUndefined(node.id)) {
|
|
10578
|
+
return;
|
|
10579
|
+
}
|
|
10580
|
+
if (!node.haschild) {
|
|
10581
|
+
return;
|
|
10582
|
+
}
|
|
10583
|
+
const parentId = node.id.toString();
|
|
10584
|
+
if (currentValues.indexOf(parentId) === -1) {
|
|
10585
|
+
const childValues = [];
|
|
10586
|
+
this.getChildren(parentId, childValues);
|
|
10587
|
+
if (childValues.some((child) => currentValues.indexOf(child) !== -1)) {
|
|
10588
|
+
removeValues.push(...childValues);
|
|
10589
|
+
}
|
|
10590
|
+
}
|
|
10591
|
+
});
|
|
10592
|
+
if (removeValues.length) {
|
|
10593
|
+
this.value = this.value.filter((value) => removeValues.indexOf(value.toString()) === -1);
|
|
10594
|
+
currentValues = this.value.map((item) => item.toString());
|
|
10595
|
+
}
|
|
10596
|
+
treeData.forEach((node) => {
|
|
10597
|
+
if (isNullOrUndefined(node) || isNullOrUndefined(node.id)) {
|
|
10598
|
+
return;
|
|
10599
|
+
}
|
|
10600
|
+
if (!node.haschild) {
|
|
10601
|
+
return;
|
|
10602
|
+
}
|
|
10603
|
+
const parentId = node.id.toString();
|
|
10604
|
+
if (currentValues.indexOf(parentId) === -1) {
|
|
10605
|
+
return;
|
|
10606
|
+
}
|
|
10607
|
+
const hasDirectChild = treeData.some((childNode) => !isNullOrUndefined(childNode) && !isNullOrUndefined(childNode.pid) && !isNullOrUndefined(childNode.id) && childNode.pid.toString() === parentId &&
|
|
10608
|
+
currentValues.indexOf(childNode.id.toString()) !== -1);
|
|
10609
|
+
if (!hasDirectChild) {
|
|
10610
|
+
removeParent(parentId);
|
|
10611
|
+
currentValues = this.value.map((item) => item.toString());
|
|
10612
|
+
}
|
|
10613
|
+
});
|
|
10614
|
+
}
|
|
10484
10615
|
updateSelectedValues() {
|
|
10485
10616
|
this.dataValue = '';
|
|
10486
10617
|
let temp;
|
|
@@ -10495,6 +10626,9 @@ let DropDownTree = class DropDownTree extends Component {
|
|
|
10495
10626
|
if (!this.isFilteredData) {
|
|
10496
10627
|
this.selectedData = [];
|
|
10497
10628
|
}
|
|
10629
|
+
if (this.treeSettings.autoCheck && this.isFilteredData && !isNullOrUndefined(this.value)) {
|
|
10630
|
+
this.updateFilteredAutoCheckValues();
|
|
10631
|
+
}
|
|
10498
10632
|
if (!isNullOrUndefined(this.value)) {
|
|
10499
10633
|
const compiledString = this.initializeValueTemplate();
|
|
10500
10634
|
for (let i = 0, len = this.value.length; i < len; i++) {
|
|
@@ -13467,6 +13601,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13467
13601
|
this.isBlurDispatching = false;
|
|
13468
13602
|
this.isFilterPrevented = false;
|
|
13469
13603
|
this.isFilteringAction = false;
|
|
13604
|
+
this.isPropertyChanged = false;
|
|
13470
13605
|
this.isValidKey = false;
|
|
13471
13606
|
this.selectAllEventData = [];
|
|
13472
13607
|
this.selectAllEventEle = [];
|
|
@@ -13615,7 +13750,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
13615
13750
|
if (!eventArgs.cancel) {
|
|
13616
13751
|
this.focusAtFirstListItem(true);
|
|
13617
13752
|
if (this.popupObj) {
|
|
13618
|
-
|
|
13753
|
+
const appendToElement = this.getAppendToElement();
|
|
13754
|
+
appendToElement.appendChild(this.popupObj.element);
|
|
13619
13755
|
}
|
|
13620
13756
|
if (this.mode === 'CheckBox' && this.enableGroupCheckBox && !isNullOrUndefined(this.fields.groupBy)) {
|
|
13621
13757
|
this.updateListItems(this.list.querySelectorAll('li.e-list-item'), this.mainList.querySelectorAll('li.e-list-item'));
|
|
@@ -14173,7 +14309,12 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14173
14309
|
}
|
|
14174
14310
|
}
|
|
14175
14311
|
else if (!(this.dataSource instanceof DataManager)) {
|
|
14176
|
-
this.
|
|
14312
|
+
if (!this.isRemoveSelection) {
|
|
14313
|
+
this.initialValueUpdate(this.listData, true);
|
|
14314
|
+
}
|
|
14315
|
+
else {
|
|
14316
|
+
this.initialValueUpdate();
|
|
14317
|
+
}
|
|
14177
14318
|
}
|
|
14178
14319
|
this.initialUpdate();
|
|
14179
14320
|
this.refreshPlaceHolder();
|
|
@@ -14187,6 +14328,16 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
14187
14328
|
this.onPopupShown(e);
|
|
14188
14329
|
}
|
|
14189
14330
|
}
|
|
14331
|
+
getAppendToElement() {
|
|
14332
|
+
if (this.isAngular) {
|
|
14333
|
+
const cdkPane = this.element && this.element.closest ? this.element.closest('.cdk-overlay-pane') : null;
|
|
14334
|
+
const popoverEl = this.element && this.element.closest ? this.element.closest('[popover]') : null;
|
|
14335
|
+
if (cdkPane && popoverEl) {
|
|
14336
|
+
return cdkPane;
|
|
14337
|
+
}
|
|
14338
|
+
}
|
|
14339
|
+
return document.body;
|
|
14340
|
+
}
|
|
14190
14341
|
refreshSelection() {
|
|
14191
14342
|
let value;
|
|
14192
14343
|
let element;
|
|
@@ -15763,7 +15914,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
15763
15914
|
else {
|
|
15764
15915
|
const listUl = this.list && this.list.querySelector('ul');
|
|
15765
15916
|
const isFullList = this.isReact && this.itemTemplate && listUl != null &&
|
|
15766
|
-
listUl.querySelectorAll('.e-list-item').length === this.mainData.length && !this.groupTemplate;
|
|
15917
|
+
listUl.querySelectorAll('.e-list-item').length === this.mainData.length && !this.groupTemplate && this.mode !== 'CheckBox';
|
|
15767
15918
|
this.onActionComplete(isFullList ? listUl : list, this.mainData);
|
|
15768
15919
|
}
|
|
15769
15920
|
this.focusAtLastListItem(data);
|
|
@@ -16661,7 +16812,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
16661
16812
|
}
|
|
16662
16813
|
if (!this.popupObj) {
|
|
16663
16814
|
if (!isNullOrUndefined(this.popupWrapper)) {
|
|
16664
|
-
|
|
16815
|
+
const appendToElement = this.getAppendToElement();
|
|
16816
|
+
appendToElement.appendChild(this.popupWrapper);
|
|
16665
16817
|
const checkboxFilter = this.popupWrapper.querySelector('.' + FILTERPARENT);
|
|
16666
16818
|
if (this.mode === 'CheckBox' && !this.allowFiltering && checkboxFilter && this.filterParent) {
|
|
16667
16819
|
checkboxFilter.remove();
|
|
@@ -17487,6 +17639,33 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
17487
17639
|
this.unwireListEvents();
|
|
17488
17640
|
this.wireListEvents();
|
|
17489
17641
|
}
|
|
17642
|
+
getTextByValueFromDataSource(value) {
|
|
17643
|
+
const dataSource = this.dataSource;
|
|
17644
|
+
if (isNullOrUndefined(dataSource) || !dataSource.length) {
|
|
17645
|
+
return null;
|
|
17646
|
+
}
|
|
17647
|
+
if (this.isPrimitiveData) {
|
|
17648
|
+
for (let i = 0; i < dataSource.length; i++) {
|
|
17649
|
+
if (dataSource[i] === value) {
|
|
17650
|
+
return dataSource[i];
|
|
17651
|
+
}
|
|
17652
|
+
}
|
|
17653
|
+
return null;
|
|
17654
|
+
}
|
|
17655
|
+
const fields = this.fields;
|
|
17656
|
+
const valueField = fields.value ? fields.value : 'value';
|
|
17657
|
+
const textField = fields.text ? fields.text : 'text';
|
|
17658
|
+
for (let i = 0; i < dataSource.length; i++) {
|
|
17659
|
+
const item = dataSource[i];
|
|
17660
|
+
if (!isNullOrUndefined(item) && getValue(valueField, item) === value) {
|
|
17661
|
+
const resolvedText = getValue(textField, item);
|
|
17662
|
+
if (!isNullOrUndefined(resolvedText)) {
|
|
17663
|
+
return resolvedText;
|
|
17664
|
+
}
|
|
17665
|
+
}
|
|
17666
|
+
}
|
|
17667
|
+
return null;
|
|
17668
|
+
}
|
|
17490
17669
|
initialValueUpdate(listItems, isInitialVirtualData, isInitialRender) {
|
|
17491
17670
|
if (this.list) {
|
|
17492
17671
|
let text;
|
|
@@ -17536,6 +17715,10 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
17536
17715
|
}
|
|
17537
17716
|
}
|
|
17538
17717
|
}
|
|
17718
|
+
if (this.isPropertyChanged && isNullOrUndefined(text) && !this.allowCustomValue &&
|
|
17719
|
+
!(this.dataSource instanceof DataManager)) {
|
|
17720
|
+
text = this.getTextByValueFromDataSource(value);
|
|
17721
|
+
}
|
|
17539
17722
|
if ((isNullOrUndefined(text) && this.allowCustomValue) &&
|
|
17540
17723
|
((!(this.dataSource instanceof DataManager)) ||
|
|
17541
17724
|
(this.dataSource instanceof DataManager && isInitialVirtualData))) {
|
|
@@ -19164,6 +19347,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
19164
19347
|
* @returns {void}
|
|
19165
19348
|
*/
|
|
19166
19349
|
onPropertyChanged(newProp, oldProp) {
|
|
19350
|
+
this.isPropertyChanged = true;
|
|
19167
19351
|
if (newProp.dataSource && !isNullOrUndefined(Object.keys(newProp.dataSource))
|
|
19168
19352
|
|| newProp.query && !isNullOrUndefined(Object.keys(newProp.query))) {
|
|
19169
19353
|
this.mainList = null;
|
|
@@ -19335,6 +19519,7 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
19335
19519
|
break;
|
|
19336
19520
|
}
|
|
19337
19521
|
}
|
|
19522
|
+
this.isPropertyChanged = false;
|
|
19338
19523
|
}
|
|
19339
19524
|
reInitializePoup() {
|
|
19340
19525
|
if (this.popupObj) {
|
|
@@ -19650,8 +19835,11 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
19650
19835
|
const mainLiLength = this.ulElement.querySelectorAll('li.' + 'e-list-item').length;
|
|
19651
19836
|
const liLength = this.ulElement.querySelectorAll('li.'
|
|
19652
19837
|
+ dropDownBaseClasses.li + '.' + HIDE_LIST).length;
|
|
19838
|
+
const isFilterText = this.allowFiltering && !isNullOrUndefined(this.inputElement) &&
|
|
19839
|
+
this.inputElement.value.trim() !== '';
|
|
19840
|
+
const isRemoteData = this.dataSource instanceof DataManager;
|
|
19653
19841
|
if (mainLiLength > 0 && (mainLiLength === liLength) && (liLength === this.mainData.length) &&
|
|
19654
|
-
!(this.targetElement() !== '' && this.allowCustomValue)) {
|
|
19842
|
+
!(this.targetElement() !== '' && this.allowCustomValue) && (!isRemoteData || !isFilterText)) {
|
|
19655
19843
|
this.beforePopupOpen = false;
|
|
19656
19844
|
return;
|
|
19657
19845
|
}
|
|
@@ -20076,7 +20264,8 @@ let MultiSelect = class MultiSelect extends DropDownBase {
|
|
|
20076
20264
|
const listParentHeight = formatUnit(this.popupHeight);
|
|
20077
20265
|
listParent.style.height = (parseInt(listParentHeight, 10)).toString() + 'px';
|
|
20078
20266
|
listParent.appendChild(item);
|
|
20079
|
-
|
|
20267
|
+
const appendToElement = this.getAppendToElement();
|
|
20268
|
+
appendToElement.appendChild(listParent);
|
|
20080
20269
|
this.virtualListHeight = listParent.getBoundingClientRect().height;
|
|
20081
20270
|
const listItemHeight = Math.ceil(item.getBoundingClientRect().height) +
|
|
20082
20271
|
parseInt(window.getComputedStyle(item).marginBottom, 10);
|
|
@@ -23344,10 +23533,12 @@ let ListBox = ListBox_1 = class ListBox extends DropDownBase {
|
|
|
23344
23533
|
return;
|
|
23345
23534
|
}
|
|
23346
23535
|
const isSpecialKey = e.keyCode >= 186 && e.keyCode <= 192;
|
|
23536
|
+
const isBracketKey = e.keyCode === 219 || e.keyCode === 220 || e.keyCode === 221 || e.keyCode === 222;
|
|
23347
23537
|
const isNumericKeyPadSpecialKey = e.keyCode === 107 || e.keyCode === 109 || e.keyCode === 111;
|
|
23348
23538
|
const isWordCharacter = e.key && e.key.match(/\w/);
|
|
23349
|
-
const isWordAccentCharacter = e.key && e.key.match(/[A-Za-z0-9\u00C0-\u024F ,>/:;\-+=]/);
|
|
23350
|
-
if (!isNullOrUndefined(isWordCharacter) || !isNullOrUndefined(isWordAccentCharacter)
|
|
23539
|
+
const isWordAccentCharacter = e.key && e.key.match(/[A-Za-z0-9\u00C0-\u024F ,>/:;\-+=[\]\\ ']/);
|
|
23540
|
+
if (!isNullOrUndefined(isWordCharacter) || !isNullOrUndefined(isWordAccentCharacter)
|
|
23541
|
+
|| isSpecialKey || isBracketKey || isNumericKeyPadSpecialKey) {
|
|
23351
23542
|
this.isValidKey = true;
|
|
23352
23543
|
}
|
|
23353
23544
|
this.isBackSpace = e.keyCode === 8;
|
|
@@ -25378,11 +25569,12 @@ let Mention = class Mention extends DropDownBase {
|
|
|
25378
25569
|
value = this.displayTempElement.innerHTML;
|
|
25379
25570
|
}
|
|
25380
25571
|
if (this.isContentEditable(this.inputElement)) {
|
|
25381
|
-
const
|
|
25572
|
+
const isMozilla = Browser.info.name === 'mozilla';
|
|
25573
|
+
const defaultSuffix = this.isRTE || isMozilla ? '​' : '';
|
|
25382
25574
|
if (Browser.isAndroid) {
|
|
25383
25575
|
return '<span contenteditable="true" class="e-mention-chip">' + showChar + value + '</span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : defaultSuffix);
|
|
25384
25576
|
}
|
|
25385
|
-
else if (
|
|
25577
|
+
else if (isMozilla) {
|
|
25386
25578
|
return '<span><span contenteditable="false" class="e-mention-chip">' + showChar + value + '</span></span>'.concat(typeof this.suffixText === 'string' ? this.suffixText : defaultSuffix);
|
|
25387
25579
|
}
|
|
25388
25580
|
else {
|