@syncfusion/ej2-dropdowns 24.2.9 → 25.1.35
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/CHANGELOG.md +23 -158
- 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 +1996 -513
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +2012 -512
- 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 +13 -13
- package/src/auto-complete/auto-complete-model.d.ts +3 -1
- package/src/auto-complete/auto-complete.d.ts +2 -0
- package/src/auto-complete/auto-complete.js +51 -6
- package/src/combo-box/combo-box-model.d.ts +10 -1
- package/src/combo-box/combo-box.d.ts +10 -2
- package/src/combo-box/combo-box.js +55 -23
- package/src/common/interface.d.ts +32 -0
- package/src/common/virtual-scroll.d.ts +1 -3
- package/src/common/virtual-scroll.js +157 -27
- package/src/drop-down-base/drop-down-base-model.d.ts +1 -1
- package/src/drop-down-base/drop-down-base.d.ts +64 -5
- package/src/drop-down-base/drop-down-base.js +241 -24
- package/src/drop-down-list/drop-down-list-model.d.ts +10 -1
- package/src/drop-down-list/drop-down-list.d.ts +16 -50
- package/src/drop-down-list/drop-down-list.js +150 -196
- package/src/drop-down-tree/drop-down-tree-model.d.ts +16 -12
- package/src/drop-down-tree/drop-down-tree.d.ts +13 -3
- package/src/drop-down-tree/drop-down-tree.js +55 -49
- package/src/global.js +1 -1
- package/src/list-box/list-box.js +9 -4
- package/src/mention/mention.d.ts +2 -0
- package/src/mention/mention.js +16 -8
- package/src/multi-select/checkbox-selection.js +8 -2
- package/src/multi-select/float-label.d.ts +5 -5
- package/src/multi-select/index.d.ts +1 -0
- package/src/multi-select/index.js +1 -0
- package/src/multi-select/interface.d.ts +1 -0
- package/src/multi-select/multi-select-model.d.ts +17 -2
- package/src/multi-select/multi-select.d.ts +34 -4
- package/src/multi-select/multi-select.js +1271 -173
- package/styles/auto-complete/_bds-definition.scss +2 -0
- package/styles/bootstrap-dark.css +7 -1
- package/styles/bootstrap.css +7 -1
- package/styles/bootstrap4.css +2 -1
- package/styles/bootstrap5-dark.css +2 -1
- package/styles/bootstrap5.css +2 -1
- package/styles/combo-box/_bds-definition.scss +2 -0
- package/styles/drop-down-base/_bds-definition.scss +134 -0
- package/styles/drop-down-list/_bds-definition.scss +134 -0
- package/styles/drop-down-list/icons/_bds.scss +14 -0
- package/styles/drop-down-tree/_bds-definition.scss +61 -0
- package/styles/drop-down-tree/icons/_bds.scss +11 -0
- package/styles/fabric-dark.css +3 -1
- package/styles/fabric.css +3 -1
- package/styles/fluent-dark.css +7 -1
- package/styles/fluent.css +7 -1
- package/styles/highcontrast-light.css +3 -1
- package/styles/highcontrast.css +3 -1
- package/styles/list-box/_bds-definition.scss +136 -0
- package/styles/list-box/icons/_bds.scss +25 -0
- package/styles/material-dark.css +2 -1
- package/styles/material.css +2 -1
- package/styles/material3-dark.css +2 -1
- package/styles/material3.css +2 -1
- package/styles/mention/_bds-definition.scss +1 -0
- package/styles/multi-select/_bds-definition.scss +235 -0
- package/styles/multi-select/_bootstrap-dark-definition.scss +4 -0
- package/styles/multi-select/_bootstrap-definition.scss +4 -0
- package/styles/multi-select/_fluent-definition.scss +5 -0
- package/styles/multi-select/_layout.scss +8 -1
- package/styles/multi-select/bootstrap-dark.css +7 -1
- package/styles/multi-select/bootstrap.css +7 -1
- package/styles/multi-select/bootstrap4.css +2 -1
- package/styles/multi-select/bootstrap5-dark.css +2 -1
- package/styles/multi-select/bootstrap5.css +2 -1
- package/styles/multi-select/fabric-dark.css +3 -1
- package/styles/multi-select/fabric.css +3 -1
- package/styles/multi-select/fluent-dark.css +7 -1
- package/styles/multi-select/fluent.css +7 -1
- package/styles/multi-select/highcontrast-light.css +3 -1
- package/styles/multi-select/highcontrast.css +3 -1
- package/styles/multi-select/icons/_bds.scss +26 -0
- package/styles/multi-select/material-dark.css +2 -1
- package/styles/multi-select/material.css +2 -1
- package/styles/multi-select/material3-dark.css +2 -1
- package/styles/multi-select/material3.css +2 -1
- package/styles/multi-select/tailwind-dark.css +2 -1
- package/styles/multi-select/tailwind.css +2 -1
- package/styles/tailwind-dark.css +2 -1
- package/styles/tailwind.css +2 -1
|
@@ -28,7 +28,6 @@ import { Input } from '@syncfusion/ej2-inputs';
|
|
|
28
28
|
import { incrementalSearch, resetIncrementalSearchValues } from '../common/incremental-search';
|
|
29
29
|
import { DropDownBase, dropDownBaseClasses } from '../drop-down-base/drop-down-base';
|
|
30
30
|
import { DataManager, Query, Predicate } from '@syncfusion/ej2-data';
|
|
31
|
-
import { Skeleton } from '@syncfusion/ej2-notifications';
|
|
32
31
|
[];
|
|
33
32
|
// don't use space in classnames
|
|
34
33
|
export var dropDownListClasses = {
|
|
@@ -87,53 +86,10 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
87
86
|
*/
|
|
88
87
|
function DropDownList(options, element) {
|
|
89
88
|
var _this = _super.call(this, options, element) || this;
|
|
90
|
-
_this.skeletonCount = 32;
|
|
91
89
|
_this.isListSearched = false;
|
|
92
90
|
_this.preventChange = false;
|
|
93
91
|
_this.isAngular = false;
|
|
94
|
-
_this.virtualListHeight = 0;
|
|
95
|
-
_this.isVirtualScrolling = false;
|
|
96
|
-
_this.isPreventScrollAction = false;
|
|
97
|
-
_this.scrollPreStartIndex = 0;
|
|
98
|
-
_this.isScrollActionTriggered = false;
|
|
99
|
-
_this.previousStartIndex = 0;
|
|
100
|
-
_this.isMouseScrollAction = false;
|
|
101
|
-
_this.isKeyBoardAction = false;
|
|
102
|
-
_this.isUpwardScrolling = false;
|
|
103
|
-
_this.startIndex = 0;
|
|
104
|
-
_this.currentPageNumber = 0;
|
|
105
|
-
_this.pageCount = 0;
|
|
106
|
-
_this.isPreventKeyAction = false;
|
|
107
|
-
_this.generatedDataObject = {};
|
|
108
|
-
_this.incrementalQueryString = '';
|
|
109
|
-
_this.incrementalEndIndex = 0;
|
|
110
|
-
_this.incrementalStartIndex = 0;
|
|
111
|
-
_this.incrementalPreQueryString = '';
|
|
112
92
|
_this.isTouched = false;
|
|
113
|
-
_this.virtualListInfo = {
|
|
114
|
-
currentPageNumber: null,
|
|
115
|
-
direction: null,
|
|
116
|
-
sentinelInfo: {},
|
|
117
|
-
offsets: {},
|
|
118
|
-
startIndex: 0,
|
|
119
|
-
endIndex: 0,
|
|
120
|
-
};
|
|
121
|
-
_this.viewPortInfo = {
|
|
122
|
-
currentPageNumber: null,
|
|
123
|
-
direction: null,
|
|
124
|
-
sentinelInfo: {},
|
|
125
|
-
offsets: {},
|
|
126
|
-
startIndex: 0,
|
|
127
|
-
endIndex: 0,
|
|
128
|
-
};
|
|
129
|
-
_this.selectedValueInfo = {
|
|
130
|
-
currentPageNumber: null,
|
|
131
|
-
direction: null,
|
|
132
|
-
sentinelInfo: {},
|
|
133
|
-
offsets: {},
|
|
134
|
-
startIndex: 0,
|
|
135
|
-
endIndex: 0,
|
|
136
|
-
};
|
|
137
93
|
_this.IsScrollerAtEnd = function () {
|
|
138
94
|
return this.list && this.list.scrollTop + this.list.clientHeight >= this.list.scrollHeight;
|
|
139
95
|
};
|
|
@@ -222,6 +178,11 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
222
178
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
223
179
|
this.totalItemCount = this.dataSource && this.dataSource.length ? this.dataSource.length : 0;
|
|
224
180
|
}
|
|
181
|
+
if (this.enableVirtualization && this.isFiltering() && this.getModuleName() === 'combobox') {
|
|
182
|
+
this.UpdateSkeleton();
|
|
183
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
184
|
+
this.ulElement = this.list.querySelector('ul');
|
|
185
|
+
}
|
|
225
186
|
this.unWireListEvents();
|
|
226
187
|
this.wireListEvents();
|
|
227
188
|
};
|
|
@@ -270,7 +231,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
270
231
|
this.resetSelection(properties);
|
|
271
232
|
}
|
|
272
233
|
var dataItem = this.getItemData();
|
|
273
|
-
if (this.previousValue === dataItem.value) {
|
|
234
|
+
if ((!this.allowObjectBinding && (this.previousValue === dataItem.value)) || (this.allowObjectBinding && this.previousValue && this.isObjectInArray(this.previousValue, [this.allowCustom ? this.value ? this.value : dataItem : dataItem.value ? this.getDataByValue(dataItem.value) : dataItem]))) {
|
|
274
235
|
return;
|
|
275
236
|
}
|
|
276
237
|
this.onChangeEvent(e);
|
|
@@ -460,7 +421,8 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
460
421
|
DropDownList.prototype.updateValues = function () {
|
|
461
422
|
this.selectedValueInfo = this.viewPortInfo;
|
|
462
423
|
if (!isNullOrUndefined(this.value)) {
|
|
463
|
-
this.
|
|
424
|
+
var value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue(((this.fields.value) ? this.fields.value : ''), this.value) : this.value;
|
|
425
|
+
this.setSelection(this.getElementByValue(value), null);
|
|
464
426
|
}
|
|
465
427
|
else if (this.text && isNullOrUndefined(this.value)) {
|
|
466
428
|
var element = this.getElementByText(this.text);
|
|
@@ -685,23 +647,6 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
685
647
|
DropDownList.prototype.isValidLI = function (li) {
|
|
686
648
|
return (li && li.hasAttribute('role') && li.getAttribute('role') === 'option');
|
|
687
649
|
};
|
|
688
|
-
DropDownList.prototype.updateIncrementalInfo = function (startIndex, endIndex) {
|
|
689
|
-
this.viewPortInfo.startIndex = startIndex;
|
|
690
|
-
this.viewPortInfo.endIndex = endIndex;
|
|
691
|
-
this.updateVirtualItemIndex();
|
|
692
|
-
this.isIncrementalRequest = true;
|
|
693
|
-
this.resetList(this.dataSource, this.fields, this.query);
|
|
694
|
-
this.isIncrementalRequest = false;
|
|
695
|
-
};
|
|
696
|
-
DropDownList.prototype.updateIncrementalView = function (startIndex, endIndex) {
|
|
697
|
-
this.viewPortInfo.startIndex = startIndex;
|
|
698
|
-
this.viewPortInfo.endIndex = endIndex;
|
|
699
|
-
this.updateVirtualItemIndex();
|
|
700
|
-
this.resetList(this.dataSource, this.fields, this.query);
|
|
701
|
-
this.UpdateSkeleton();
|
|
702
|
-
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
703
|
-
this.ulElement = this.list.querySelector('ul');
|
|
704
|
-
};
|
|
705
650
|
DropDownList.prototype.updateIncrementalItemIndex = function (startIndex, endIndex) {
|
|
706
651
|
this.incrementalStartIndex = startIndex;
|
|
707
652
|
this.incrementalEndIndex = endIndex;
|
|
@@ -869,10 +814,12 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
869
814
|
var isTabAction = e.action === 'tab' || e.action === 'close';
|
|
870
815
|
if (isNullOrUndefined(this.list) && !this.isRequested && !isTabAction && e.action !== 'escape') {
|
|
871
816
|
this.searchKeyEvent = e;
|
|
872
|
-
this.
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
817
|
+
if (!this.enableVirtualization || (this.enableVirtualization && this.getModuleName() !== 'autocomplete' && e.type !== 'mousedown' && (e.keyCode === 40 || e.keyCode === 38))) {
|
|
818
|
+
this.renderList(e);
|
|
819
|
+
this.UpdateSkeleton();
|
|
820
|
+
this.liCollections = this.list.querySelectorAll('.' + dropDownBaseClasses.li);
|
|
821
|
+
this.ulElement = this.list.querySelector('ul');
|
|
822
|
+
}
|
|
876
823
|
}
|
|
877
824
|
if (isNullOrUndefined(this.list) || (!isNullOrUndefined(this.liCollections) &&
|
|
878
825
|
isNavigation && this.liCollections.length === 0) || this.isRequested) {
|
|
@@ -1031,7 +978,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1031
978
|
this.activeIndex = filterIndex;
|
|
1032
979
|
}
|
|
1033
980
|
}
|
|
1034
|
-
if (this.allowFiltering && this.getModuleName() === 'dropdownlist') {
|
|
981
|
+
if (this.allowFiltering && this.getModuleName() === 'dropdownlist' && this.filterInput) {
|
|
1035
982
|
if (!isNullOrUndefined(this.ulElement) && !isNullOrUndefined(this.ulElement.getElementsByClassName('e-item-focus')[0])) {
|
|
1036
983
|
attributes(this.filterInput, { 'aria-activedescendant': this.ulElement.getElementsByClassName('e-item-focus')[0].id });
|
|
1037
984
|
}
|
|
@@ -1041,11 +988,6 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1041
988
|
}
|
|
1042
989
|
e.preventDefault();
|
|
1043
990
|
};
|
|
1044
|
-
DropDownList.prototype.updateVirtualItemIndex = function () {
|
|
1045
|
-
this.virtualItemStartIndex = this.viewPortInfo.startIndex;
|
|
1046
|
-
this.virtualItemEndIndex = this.viewPortInfo.endIndex;
|
|
1047
|
-
this.virtualListInfo = this.viewPortInfo;
|
|
1048
|
-
};
|
|
1049
991
|
DropDownList.prototype.updateHomeEndAction = function (e, isVirtualKeyAction) {
|
|
1050
992
|
if (this.getModuleName() === 'dropdownlist') {
|
|
1051
993
|
var findLi = 0;
|
|
@@ -1194,6 +1136,10 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1194
1136
|
DropDownList.prototype.pageDownSelection = function (steps, event, isVirtualKeyAction) {
|
|
1195
1137
|
var list = this.getItems();
|
|
1196
1138
|
var previousItem = steps <= list.length ? this.liCollections[steps - 1] : this.liCollections[list.length - 1];
|
|
1139
|
+
if (this.enableVirtualization && this.skeletonCount > 0) {
|
|
1140
|
+
steps = this.getModuleName() === 'dropdownlist' && this.allowFiltering ? steps + 1 : steps;
|
|
1141
|
+
previousItem = steps < list.length ? this.liCollections[steps] : this.liCollections[list.length - 1];
|
|
1142
|
+
}
|
|
1197
1143
|
if ((this.enableVirtualization && this.activeIndex == null) || isVirtualKeyAction) {
|
|
1198
1144
|
previousItem = steps <= list.length ? this.liCollections[steps + this.skeletonCount - 1] : this.liCollections[list.length - 1];
|
|
1199
1145
|
}
|
|
@@ -1358,7 +1304,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1358
1304
|
DropDownList.prototype.selectEventCallback = function (li, e, preventSelect, selectedData, value) {
|
|
1359
1305
|
this.previousItemData = (!isNullOrUndefined(this.itemData)) ? this.itemData : null;
|
|
1360
1306
|
if (this.itemData != selectedData) {
|
|
1361
|
-
this.previousValue = (!isNullOrUndefined(this.itemData)) ? typeof this.itemData == "object" ? this.checkFieldValue(this.itemData, this.fields.value.split('.')) : this.itemData : null;
|
|
1307
|
+
this.previousValue = (!isNullOrUndefined(this.itemData)) ? typeof this.itemData == "object" && !this.allowObjectBinding ? this.checkFieldValue(this.itemData, this.fields.value.split('.')) : this.itemData : null;
|
|
1362
1308
|
}
|
|
1363
1309
|
this.item = li;
|
|
1364
1310
|
this.itemData = selectedData;
|
|
@@ -1416,7 +1362,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1416
1362
|
if (this.isFiltering() && clearElement) {
|
|
1417
1363
|
clearElement.style.removeProperty('visibility');
|
|
1418
1364
|
}
|
|
1419
|
-
if (this.previousValue === dataItem.value) {
|
|
1365
|
+
if ((!this.allowObjectBinding && (this.previousValue === dataItem.value)) || (this.allowObjectBinding && (this.previousValue != null && this.isObjectInArray(this.previousValue, [this.allowCustom && this.isObjectCustomValue ? this.value ? this.value : dataItem : dataItem.value ? this.getDataByValue(dataItem.value) : dataItem])))) {
|
|
1420
1366
|
this.isSelected = false;
|
|
1421
1367
|
return true;
|
|
1422
1368
|
}
|
|
@@ -1436,25 +1382,28 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1436
1382
|
}
|
|
1437
1383
|
else {
|
|
1438
1384
|
this.setSelectOptions(li, e);
|
|
1439
|
-
if (this.enableVirtualization) {
|
|
1385
|
+
if (this.enableVirtualization && this.value) {
|
|
1440
1386
|
var fields = (this.fields.value) ? this.fields.value : '';
|
|
1387
|
+
var currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
1441
1388
|
if (this.dataSource instanceof DataManager && this.virtualGroupDataSource) {
|
|
1442
|
-
var getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal',
|
|
1389
|
+
var getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue)));
|
|
1443
1390
|
if (getItem && getItem.length > 0) {
|
|
1444
1391
|
this.itemData = getItem[0];
|
|
1445
1392
|
var dataItem = this.getItemData();
|
|
1393
|
+
var value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
1446
1394
|
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
1447
|
-
this.setProperties({ 'text': dataItem.text, 'value':
|
|
1395
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
1448
1396
|
}
|
|
1449
1397
|
}
|
|
1450
1398
|
}
|
|
1451
1399
|
else {
|
|
1452
|
-
var getItem = new DataManager(this.dataSource).executeLocal(new Query().where(new Predicate(fields, 'equal',
|
|
1400
|
+
var getItem = new DataManager(this.dataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue)));
|
|
1453
1401
|
if (getItem && getItem.length > 0) {
|
|
1454
1402
|
this.itemData = getItem[0];
|
|
1455
1403
|
var dataItem = this.getItemData();
|
|
1404
|
+
var value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
1456
1405
|
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
1457
|
-
this.setProperties({ 'text': dataItem.text, 'value':
|
|
1406
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
1458
1407
|
}
|
|
1459
1408
|
}
|
|
1460
1409
|
}
|
|
@@ -1568,10 +1517,23 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1568
1517
|
* @param {MouseEvent | KeyboardEvent | TouchEvent} eve - Specifies the event arguments.
|
|
1569
1518
|
* @returns {void}
|
|
1570
1519
|
*/
|
|
1571
|
-
DropDownList.prototype.onChangeEvent = function (eve) {
|
|
1520
|
+
DropDownList.prototype.onChangeEvent = function (eve, isCustomValue) {
|
|
1521
|
+
var _this = this;
|
|
1572
1522
|
var dataItem = this.getItemData();
|
|
1573
1523
|
var index = this.isSelectCustom ? null : this.activeIndex;
|
|
1574
|
-
this.
|
|
1524
|
+
if (this.enableVirtualization) {
|
|
1525
|
+
var datas = this.dataSource instanceof DataManager ? this.virtualGroupDataSource : this.dataSource;
|
|
1526
|
+
if (dataItem.value && datas && datas.length > 0) {
|
|
1527
|
+
var foundIndex = datas.findIndex(function (data) {
|
|
1528
|
+
return !isNullOrUndefined(dataItem.value) && getValue(_this.fields.value, data) === dataItem.value;
|
|
1529
|
+
});
|
|
1530
|
+
if (foundIndex !== -1) {
|
|
1531
|
+
index = foundIndex;
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
var value = this.allowObjectBinding ? isCustomValue ? this.value : this.getDataByValue(dataItem.value) : dataItem.value;
|
|
1536
|
+
this.setProperties({ 'index': index, 'text': dataItem.text, 'value': value }, true);
|
|
1575
1537
|
this.detachChangeEvent(eve);
|
|
1576
1538
|
};
|
|
1577
1539
|
DropDownList.prototype.detachChanges = function (value) {
|
|
@@ -1598,7 +1560,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1598
1560
|
DropDownList.prototype.detachChangeEvent = function (eve) {
|
|
1599
1561
|
this.isSelected = false;
|
|
1600
1562
|
this.previousValue = this.value;
|
|
1601
|
-
this.activeIndex = this.index;
|
|
1563
|
+
this.activeIndex = this.enableVirtualization ? this.getIndexByValue(this.value) : this.index;
|
|
1602
1564
|
this.typedString = !isNullOrUndefined(this.text) ? this.text : '';
|
|
1603
1565
|
if (!this.initial) {
|
|
1604
1566
|
var items = this.detachChanges(this.itemData);
|
|
@@ -1645,16 +1607,17 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1645
1607
|
};
|
|
1646
1608
|
DropDownList.prototype.setHiddenValue = function () {
|
|
1647
1609
|
if (!isNullOrUndefined(this.value)) {
|
|
1610
|
+
var value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
1648
1611
|
if (this.hiddenElement.querySelector('option')) {
|
|
1649
1612
|
var selectedElement = this.hiddenElement.querySelector('option');
|
|
1650
1613
|
selectedElement.textContent = this.text;
|
|
1651
|
-
selectedElement.setAttribute('value',
|
|
1614
|
+
selectedElement.setAttribute('value', value.toString());
|
|
1652
1615
|
}
|
|
1653
1616
|
else {
|
|
1654
1617
|
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
1655
1618
|
this.hiddenElement.innerHTML = '<option selected>' + this.text + '</option>';
|
|
1656
1619
|
var selectedElement = this.hiddenElement.querySelector('option');
|
|
1657
|
-
selectedElement.setAttribute('value',
|
|
1620
|
+
selectedElement.setAttribute('value', value.toString());
|
|
1658
1621
|
}
|
|
1659
1622
|
}
|
|
1660
1623
|
}
|
|
@@ -1671,6 +1634,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1671
1634
|
DropDownList.prototype.onFilterUp = function (e) {
|
|
1672
1635
|
if (!(e.ctrlKey && e.keyCode === 86) && (this.isValidKey || e.keyCode === 40 || e.keyCode === 38)) {
|
|
1673
1636
|
this.isValidKey = false;
|
|
1637
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
1674
1638
|
switch (e.keyCode) {
|
|
1675
1639
|
case 38: //up arrow
|
|
1676
1640
|
case 40: //down arrow
|
|
@@ -1727,42 +1691,6 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1727
1691
|
this.isValidKey = false;
|
|
1728
1692
|
}
|
|
1729
1693
|
};
|
|
1730
|
-
DropDownList.prototype.getFilteringSkeletonCount = function () {
|
|
1731
|
-
var difference = this.dataCount - this.viewPortInfo.endIndex;
|
|
1732
|
-
var currentSkeletonCount = this.skeletonCount;
|
|
1733
|
-
this.getSkeletonCount(true);
|
|
1734
|
-
this.skeletonCount = this.dataCount > this.itemCount * 2 ? this.skeletonCount : difference > this.skeletonCount ? this.skeletonCount : difference > 0 ? difference : 0;
|
|
1735
|
-
var skeletonUpdated = true;
|
|
1736
|
-
if (this.getModuleName() === 'autocomplete' && (this.totalItemCount != 0 && this.totalItemCount < (this.itemCount * 2))) {
|
|
1737
|
-
this.skeletonCount = 0;
|
|
1738
|
-
skeletonUpdated = false;
|
|
1739
|
-
}
|
|
1740
|
-
if (!this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
1741
|
-
var isSkeletonCountChange = currentSkeletonCount !== this.skeletonCount;
|
|
1742
|
-
if (currentSkeletonCount !== this.skeletonCount && skeletonUpdated) {
|
|
1743
|
-
this.UpdateSkeleton(true, Math.abs(currentSkeletonCount - this.skeletonCount));
|
|
1744
|
-
}
|
|
1745
|
-
else {
|
|
1746
|
-
this.UpdateSkeleton();
|
|
1747
|
-
}
|
|
1748
|
-
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
1749
|
-
if ((this.list.getElementsByClassName('e-virtual-ddl').length > 0)) {
|
|
1750
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1751
|
-
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
1752
|
-
}
|
|
1753
|
-
if (this.list.getElementsByClassName('e-virtual-ddl-content').length > 0) {
|
|
1754
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1755
|
-
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
1756
|
-
}
|
|
1757
|
-
}
|
|
1758
|
-
};
|
|
1759
|
-
DropDownList.prototype.getSkeletonCount = function (retainSkeleton) {
|
|
1760
|
-
this.virtualListHeight = this.listHeight != null ? parseInt(this.listHeight, 10) : this.virtualListHeight;
|
|
1761
|
-
var actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
1762
|
-
this.skeletonCount = actualCount * 2 < this.itemCount ? this.itemCount : actualCount * 2;
|
|
1763
|
-
this.itemCount = retainSkeleton ? this.itemCount : this.skeletonCount;
|
|
1764
|
-
this.skeletonCount = Math.floor(this.skeletonCount / 2) + 2;
|
|
1765
|
-
};
|
|
1766
1694
|
DropDownList.prototype.onFilterDown = function (e) {
|
|
1767
1695
|
switch (e.keyCode) {
|
|
1768
1696
|
case 13: //enter
|
|
@@ -1817,14 +1745,51 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1817
1745
|
}
|
|
1818
1746
|
}
|
|
1819
1747
|
}
|
|
1820
|
-
|
|
1821
|
-
|
|
1748
|
+
var queryTakeValue = 0;
|
|
1749
|
+
var querySkipValue = 0;
|
|
1750
|
+
if (this.query && this.query.queries.length > 0) {
|
|
1751
|
+
for (var queryElements_1 = 0; queryElements_1 < this.query.queries.length; queryElements_1++) {
|
|
1752
|
+
if (this.query.queries[queryElements_1].fn === 'onSkip') {
|
|
1753
|
+
querySkipValue = this.query.queries[queryElements_1].e.nos;
|
|
1754
|
+
}
|
|
1755
|
+
if (this.query.queries[queryElements_1].fn === 'onTake') {
|
|
1756
|
+
queryTakeValue = takeValue <= this.query.queries[queryElements_1].e.nos ? this.query.queries[queryElements_1].e.nos : takeValue;
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
var skipExists = false;
|
|
1761
|
+
var takeExists = false;
|
|
1762
|
+
if (filterQuery && filterQuery.queries.length > 0) {
|
|
1763
|
+
for (var queryElements_2 = 0; queryElements_2 < filterQuery.queries.length; queryElements_2++) {
|
|
1764
|
+
if (filterQuery.queries[queryElements_2].fn === 'onSkip') {
|
|
1765
|
+
skipExists = true;
|
|
1766
|
+
}
|
|
1767
|
+
if (filterQuery.queries[queryElements_2].fn === 'onTake') {
|
|
1768
|
+
takeExists = true;
|
|
1769
|
+
filterQuery.queries[queryElements_2].e.nos = filterQuery.queries[queryElements_2].e.nos <= queryTakeValue ? queryTakeValue : filterQuery.queries[queryElements_2].e.nos;
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
if (!skipExists && (this.allowFiltering || !this.isPopupOpen || !alreadySkipAdded)) {
|
|
1774
|
+
if (querySkipValue > 0) {
|
|
1775
|
+
filterQuery.skip(querySkipValue);
|
|
1776
|
+
}
|
|
1777
|
+
else {
|
|
1778
|
+
filterQuery.skip(this.virtualItemStartIndex);
|
|
1779
|
+
}
|
|
1822
1780
|
}
|
|
1823
1781
|
if (this.isIncrementalRequest) {
|
|
1824
1782
|
filterQuery.take(this.incrementalEndIndex);
|
|
1825
1783
|
}
|
|
1826
1784
|
else {
|
|
1827
|
-
|
|
1785
|
+
if (!takeExists) {
|
|
1786
|
+
if (queryTakeValue > 0) {
|
|
1787
|
+
filterQuery.take(queryTakeValue);
|
|
1788
|
+
}
|
|
1789
|
+
else {
|
|
1790
|
+
filterQuery.take(takeValue);
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1828
1793
|
}
|
|
1829
1794
|
filterQuery.requiresCount();
|
|
1830
1795
|
}
|
|
@@ -2045,29 +2010,6 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2045
2010
|
this.renderPopup();
|
|
2046
2011
|
}
|
|
2047
2012
|
};
|
|
2048
|
-
DropDownList.prototype.UpdateSkeleton = function (isSkeletonCountChange, skeletonCount) {
|
|
2049
|
-
var isContainSkeleton = this.list.querySelector('.e-virtual-ddl-content');
|
|
2050
|
-
var isContainVirtualList = this.list.querySelector('.e-virtual-list');
|
|
2051
|
-
if (isContainSkeleton && (!isContainVirtualList || isSkeletonCountChange) && this.enableVirtualization) {
|
|
2052
|
-
var totalSkeletonCount = isSkeletonCountChange ? skeletonCount : this.skeletonCount;
|
|
2053
|
-
for (var i = 0; i < totalSkeletonCount; i++) {
|
|
2054
|
-
var liElement = this.createElement('li', { className: dropDownListClasses.virtualList, styles: 'overflow: inherit' });
|
|
2055
|
-
if (this.enableVirtualization && this.itemTemplate) {
|
|
2056
|
-
liElement.style.height = this.listItemHeight + 'px';
|
|
2057
|
-
}
|
|
2058
|
-
var skeleton = new Skeleton({
|
|
2059
|
-
shape: "Text",
|
|
2060
|
-
height: "10px",
|
|
2061
|
-
width: "95%",
|
|
2062
|
-
cssClass: "e-skeleton-text",
|
|
2063
|
-
});
|
|
2064
|
-
skeleton.appendTo(this.createElement('div'));
|
|
2065
|
-
liElement.appendChild(skeleton.element);
|
|
2066
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2067
|
-
isContainSkeleton.firstChild.insertBefore(liElement, isContainSkeleton.firstChild.children[0]);
|
|
2068
|
-
}
|
|
2069
|
-
}
|
|
2070
|
-
};
|
|
2071
2013
|
DropDownList.prototype.getTakeValue = function () {
|
|
2072
2014
|
return this.allowFiltering && this.getModuleName() === 'dropdownlist' && Browser.isDevice ? Math.round(window.outerHeight / this.listItemHeight) : this.itemCount;
|
|
2073
2015
|
};
|
|
@@ -2109,19 +2051,20 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2109
2051
|
this.initialRemoteRender = false;
|
|
2110
2052
|
if (this.value && this.dataSource instanceof DataManager) {
|
|
2111
2053
|
var checkField_1 = isNullOrUndefined(this.fields.value) ? this.fields.text : this.fields.value;
|
|
2054
|
+
var value_5 = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue(checkField_1, this.value) : this.value;
|
|
2112
2055
|
var fieldValue_1 = this.fields.value.split('.');
|
|
2113
2056
|
var checkVal = list.some(function (x) {
|
|
2114
2057
|
return isNullOrUndefined(x[checkField_1]) && fieldValue_1.length > 1 ?
|
|
2115
|
-
_this.checkFieldValue(x, fieldValue_1) ===
|
|
2058
|
+
_this.checkFieldValue(x, fieldValue_1) === value_5 : x[checkField_1] === value_5;
|
|
2116
2059
|
});
|
|
2117
2060
|
if (this.enableVirtualization && this.virtualGroupDataSource) {
|
|
2118
2061
|
checkVal = this.virtualGroupDataSource.some(function (x) {
|
|
2119
2062
|
return isNullOrUndefined(x[checkField_1]) && fieldValue_1.length > 1 ?
|
|
2120
|
-
_this.checkFieldValue(x, fieldValue_1) ===
|
|
2063
|
+
_this.checkFieldValue(x, fieldValue_1) === value_5 : x[checkField_1] === value_5;
|
|
2121
2064
|
});
|
|
2122
2065
|
}
|
|
2123
2066
|
if (!checkVal) {
|
|
2124
|
-
this.dataSource.executeQuery(this.getQuery(this.query).where(new Predicate(checkField_1, 'equal',
|
|
2067
|
+
this.dataSource.executeQuery(this.getQuery(this.query).where(new Predicate(checkField_1, 'equal', value_5)))
|
|
2125
2068
|
.then(function (e) {
|
|
2126
2069
|
if (e.result.length > 0) {
|
|
2127
2070
|
_this.addItem(e.result, list.length);
|
|
@@ -2233,10 +2176,10 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2233
2176
|
DropDownList.prototype.addNewItem = function (listData, newElement) {
|
|
2234
2177
|
var _this = this;
|
|
2235
2178
|
if (!isNullOrUndefined(this.itemData) && !isNullOrUndefined(newElement)) {
|
|
2236
|
-
var
|
|
2179
|
+
var value_6 = this.getItemData().value;
|
|
2237
2180
|
var isExist = listData.some(function (data) {
|
|
2238
|
-
return (((typeof data === 'string' || typeof data === 'number') && data ===
|
|
2239
|
-
(getValue(_this.fields.value, data) ===
|
|
2181
|
+
return (((typeof data === 'string' || typeof data === 'number') && data === value_6) ||
|
|
2182
|
+
(getValue(_this.fields.value, data) === value_6));
|
|
2240
2183
|
});
|
|
2241
2184
|
if (!isExist) {
|
|
2242
2185
|
this.addItem(this.itemData);
|
|
@@ -2292,46 +2235,19 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2292
2235
|
DropDownList.prototype.updateSelectionList = function () {
|
|
2293
2236
|
var selectedItem = this.list && this.list.querySelector('.' + 'e-active');
|
|
2294
2237
|
if (!selectedItem && !isNullOrUndefined(this.value)) {
|
|
2295
|
-
var
|
|
2238
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
2239
|
+
var findEle = this.findListElement(this.list, 'li', 'data-value', value);
|
|
2296
2240
|
if (findEle) {
|
|
2297
2241
|
findEle.classList.add('e-active');
|
|
2298
2242
|
}
|
|
2299
2243
|
}
|
|
2300
2244
|
};
|
|
2301
|
-
DropDownList.prototype.checkAndResetCache = function () {
|
|
2302
|
-
if (this.enableVirtualization) {
|
|
2303
|
-
this.generatedDataObject = {};
|
|
2304
|
-
this.virtualItemStartIndex = this.virtualItemEndIndex = 0;
|
|
2305
|
-
this.viewPortInfo = { currentPageNumber: null,
|
|
2306
|
-
direction: null,
|
|
2307
|
-
sentinelInfo: {},
|
|
2308
|
-
offsets: {},
|
|
2309
|
-
startIndex: 0,
|
|
2310
|
-
endIndex: this.itemCount, };
|
|
2311
|
-
this.selectedValueInfo = null;
|
|
2312
|
-
}
|
|
2313
|
-
};
|
|
2314
2245
|
DropDownList.prototype.removeFocus = function () {
|
|
2315
2246
|
var highlightedItem = this.list.querySelectorAll('.' + dropDownListClasses.focus);
|
|
2316
2247
|
if (highlightedItem && highlightedItem.length) {
|
|
2317
2248
|
removeClass(highlightedItem, dropDownListClasses.focus);
|
|
2318
2249
|
}
|
|
2319
2250
|
};
|
|
2320
|
-
DropDownList.prototype.getTransformValues = function () {
|
|
2321
|
-
var translateY = this.viewPortInfo.startIndex * this.listItemHeight;
|
|
2322
|
-
translateY = translateY - (this.skeletonCount * this.listItemHeight);
|
|
2323
|
-
translateY = this.viewPortInfo.startIndex === 0 && this.listData && this.listData.length === 0 ? 0 : translateY;
|
|
2324
|
-
var styleText = "transform: translate(0px, " + translateY + "px);";
|
|
2325
|
-
return styleText;
|
|
2326
|
-
};
|
|
2327
|
-
DropDownList.prototype.GetVirtualTrackHeight = function () {
|
|
2328
|
-
var height = this.totalItemCount === this.viewPortInfo.endIndex ? this.totalItemCount * this.listItemHeight - this.itemCount * this.listItemHeight : this.totalItemCount * this.listItemHeight;
|
|
2329
|
-
var heightDimension = "height: " + (height - this.itemCount * this.listItemHeight) + "px;";
|
|
2330
|
-
if (this.getModuleName() === 'autocomplete' && this.skeletonCount === 0) {
|
|
2331
|
-
return "height: 0px;";
|
|
2332
|
-
}
|
|
2333
|
-
return heightDimension;
|
|
2334
|
-
};
|
|
2335
2251
|
DropDownList.prototype.renderPopup = function (e) {
|
|
2336
2252
|
var _this = this;
|
|
2337
2253
|
if (this.popupObj && document.body.contains(this.popupObj.element)) {
|
|
@@ -2347,7 +2263,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2347
2263
|
popupEle.setAttribute('aria-label', _this.element.id);
|
|
2348
2264
|
popupEle.setAttribute('role', 'dialog');
|
|
2349
2265
|
var searchBox = _this.setSearchBox(popupEle);
|
|
2350
|
-
_this.
|
|
2266
|
+
_this.listContainerHeight = formatUnit(_this.popupHeight);
|
|
2351
2267
|
if (_this.headerTemplate) {
|
|
2352
2268
|
_this.setHeaderTemplate(popupEle);
|
|
2353
2269
|
}
|
|
@@ -2391,19 +2307,19 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2391
2307
|
_this.searchBoxHeight = 0;
|
|
2392
2308
|
if (!isNullOrUndefined(searchBox.container) && _this.getModuleName() !== 'combobox' && _this.getModuleName() !== 'autocomplete') {
|
|
2393
2309
|
_this.searchBoxHeight = (searchBox.container.parentElement).getBoundingClientRect().height;
|
|
2394
|
-
_this.
|
|
2310
|
+
_this.listContainerHeight = (parseInt(_this.listContainerHeight, 10) - (_this.searchBoxHeight)).toString() + 'px';
|
|
2395
2311
|
}
|
|
2396
2312
|
if (_this.headerTemplate) {
|
|
2397
2313
|
_this.header = _this.header ? _this.header : popupEle.querySelector('.e-ddl-header');
|
|
2398
2314
|
var height = Math.round(_this.header.getBoundingClientRect().height);
|
|
2399
|
-
_this.
|
|
2315
|
+
_this.listContainerHeight = (parseInt(_this.listContainerHeight, 10) - (height + _this.searchBoxHeight)).toString() + 'px';
|
|
2400
2316
|
}
|
|
2401
2317
|
if (_this.footerTemplate) {
|
|
2402
2318
|
_this.footer = _this.footer ? _this.footer : popupEle.querySelector('.e-ddl-footer');
|
|
2403
2319
|
var height = Math.round(_this.footer.getBoundingClientRect().height);
|
|
2404
|
-
_this.
|
|
2320
|
+
_this.listContainerHeight = (parseInt(_this.listContainerHeight, 10) - (height + _this.searchBoxHeight)).toString() + 'px';
|
|
2405
2321
|
}
|
|
2406
|
-
_this.list.style.maxHeight = (parseInt(_this.
|
|
2322
|
+
_this.list.style.maxHeight = (parseInt(_this.listContainerHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
|
|
2407
2323
|
popupEle.style.maxHeight = formatUnit(_this.popupHeight);
|
|
2408
2324
|
}
|
|
2409
2325
|
else {
|
|
@@ -2715,6 +2631,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2715
2631
|
this.list.scrollTop += nextOffset;
|
|
2716
2632
|
}
|
|
2717
2633
|
else {
|
|
2634
|
+
if (this.enableVirtualization) {
|
|
2635
|
+
liCount = keyAction == "pageDown" ? this.getPageCount() : liCount;
|
|
2636
|
+
}
|
|
2718
2637
|
this.list.scrollTop += this.selectedLI.offsetHeight * liCount;
|
|
2719
2638
|
}
|
|
2720
2639
|
this.isPreventKeyAction = this.IsScrollerAtEnd() ? false : this.isPreventKeyAction;
|
|
@@ -2768,6 +2687,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2768
2687
|
else if (nextOffset < 0 || isPageUpKeyAction) {
|
|
2769
2688
|
var currentElementValue = this.selectedLI ? this.selectedLI.getAttribute('data-value') : null;
|
|
2770
2689
|
var liCount = keyAction == "pageUp" ? this.getPageCount() - 2 : 1;
|
|
2690
|
+
if (this.enableVirtualization) {
|
|
2691
|
+
liCount = keyAction == "pageUp" ? this.getPageCount() : liCount;
|
|
2692
|
+
}
|
|
2771
2693
|
if (this.enableVirtualization && this.isKeyBoardAction && firstElementValue && currentElementValue === firstElementValue && keyAction != "home" && !this.isVirtualScrolling) {
|
|
2772
2694
|
this.isUpwardScrolling = true;
|
|
2773
2695
|
this.isPreventKeyAction = true;
|
|
@@ -2865,6 +2787,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2865
2787
|
var isFilterValue = !isNullOrUndefined(this.filterInput) && !isNullOrUndefined(this.filterInput.value) && this.filterInput.value !== '';
|
|
2866
2788
|
var typedString = this.getModuleName() === 'combobox' ? this.typedString : null;
|
|
2867
2789
|
this.isTyped = false;
|
|
2790
|
+
this.isVirtualTrackHeight = false;
|
|
2868
2791
|
if (!(this.popupObj && document.body.contains(this.popupObj.element) && this.beforePopupOpen)) {
|
|
2869
2792
|
return;
|
|
2870
2793
|
}
|
|
@@ -3120,6 +3043,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3120
3043
|
this.listItemHeight = this.getListHeight();
|
|
3121
3044
|
this.getSkeletonCount();
|
|
3122
3045
|
this.updateVirtualizationProperties(this.itemCount, this.allowFiltering);
|
|
3046
|
+
if (this.index !== null) {
|
|
3047
|
+
this.activeIndex = this.index + this.skeletonCount;
|
|
3048
|
+
}
|
|
3123
3049
|
}
|
|
3124
3050
|
this.initValue();
|
|
3125
3051
|
this.selectedValueInfo = this.viewPortInfo;
|
|
@@ -3129,7 +3055,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3129
3055
|
}
|
|
3130
3056
|
else if (this.element.tagName === 'SELECT' && this.element.options[0]) {
|
|
3131
3057
|
var selectElement = this.element;
|
|
3132
|
-
this.value = selectElement.options[selectElement.selectedIndex].value;
|
|
3058
|
+
this.value = this.allowObjectBinding ? this.getDataByValue(selectElement.options[selectElement.selectedIndex].value) : selectElement.options[selectElement.selectedIndex].value;
|
|
3133
3059
|
this.text = isNullOrUndefined(this.value) ? null : selectElement.options[selectElement.selectedIndex].textContent;
|
|
3134
3060
|
this.initValue();
|
|
3135
3061
|
}
|
|
@@ -3281,7 +3207,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3281
3207
|
this.actionData = this.actionCompleteData;
|
|
3282
3208
|
}
|
|
3283
3209
|
};
|
|
3284
|
-
DropDownList.prototype.updateDataSource = function (props) {
|
|
3210
|
+
DropDownList.prototype.updateDataSource = function (props, oldProps) {
|
|
3285
3211
|
if (this.inputElement.value !== '' || (!isNullOrUndefined(props) && (isNullOrUndefined(props.dataSource)
|
|
3286
3212
|
|| (!(props.dataSource instanceof DataManager) && props.dataSource.length === 0)))) {
|
|
3287
3213
|
this.clearAll(null, props);
|
|
@@ -3291,7 +3217,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3291
3217
|
EventHandler.add(this.list, 'scroll', this.setFloatingHeader, this);
|
|
3292
3218
|
}
|
|
3293
3219
|
if (!(!isNullOrUndefined(props) && (isNullOrUndefined(props.dataSource)
|
|
3294
|
-
|| (!(props.dataSource instanceof DataManager) && props.dataSource.length === 0))) || !(Array.isArray(props.dataSource) && props.dataSource.length
|
|
3220
|
+
|| (!(props.dataSource instanceof DataManager) && props.dataSource.length === 0))) || ((props.dataSource instanceof DataManager) || (!isNullOrUndefined(props) && Array.isArray(props.dataSource) && !isNullOrUndefined(oldProps) && Array.isArray(oldProps.dataSource) && props.dataSource.length !== oldProps.dataSource.length))) {
|
|
3295
3221
|
this.typedString = '';
|
|
3296
3222
|
this.resetList(this.dataSource);
|
|
3297
3223
|
}
|
|
@@ -3300,9 +3226,11 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3300
3226
|
}
|
|
3301
3227
|
};
|
|
3302
3228
|
DropDownList.prototype.checkCustomValue = function () {
|
|
3303
|
-
this.
|
|
3229
|
+
var currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
3230
|
+
this.itemData = this.getDataByValue(currentValue);
|
|
3304
3231
|
var dataItem = this.getItemData();
|
|
3305
|
-
this.
|
|
3232
|
+
var value = this.allowObjectBinding ? this.itemData : dataItem.value;
|
|
3233
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
3306
3234
|
};
|
|
3307
3235
|
DropDownList.prototype.updateInputFields = function () {
|
|
3308
3236
|
if (this.getModuleName() === 'dropdownlist') {
|
|
@@ -3424,6 +3352,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3424
3352
|
this_1.clearAll();
|
|
3425
3353
|
break;
|
|
3426
3354
|
}
|
|
3355
|
+
if (this_1.allowObjectBinding && !isNullOrUndefined(newProp.value) && !isNullOrUndefined(oldProp.value) && this_1.isObjectInArray(newProp.value, [oldProp.value])) {
|
|
3356
|
+
return { value: void 0 };
|
|
3357
|
+
}
|
|
3427
3358
|
if (this_1.enableVirtualization) {
|
|
3428
3359
|
this_1.updateValues();
|
|
3429
3360
|
this_1.updateInputFields();
|
|
@@ -3441,7 +3372,8 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3441
3372
|
this_1.renderList();
|
|
3442
3373
|
}
|
|
3443
3374
|
if (!this_1.initialRemoteRender) {
|
|
3444
|
-
var
|
|
3375
|
+
var value = this_1.allowObjectBinding && !isNullOrUndefined(newProp.value) ? getValue((this_1.fields.value) ? this_1.fields.value : '', newProp.value) : newProp.value;
|
|
3376
|
+
var item = this_1.getElementByValue(value);
|
|
3445
3377
|
if (!this_1.checkValidLi(item)) {
|
|
3446
3378
|
if (this_1.liCollections && this_1.liCollections.length === 100 &&
|
|
3447
3379
|
this_1.getModuleName() === 'autocomplete' && this_1.listData.length > 100) {
|
|
@@ -3451,7 +3383,8 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3451
3383
|
var listLength_2 = this_1.getItems().length;
|
|
3452
3384
|
var checkField = isNullOrUndefined(this_1.fields.value) ? this_1.fields.text : this_1.fields.value;
|
|
3453
3385
|
this_1.typedString = '';
|
|
3454
|
-
this_1.
|
|
3386
|
+
var value_7 = this_1.allowObjectBinding && !isNullOrUndefined(newProp.value) ? getValue(checkField, newProp.value) : newProp.value;
|
|
3387
|
+
this_1.dataSource.executeQuery(this_1.getQuery(this_1.query).where(new Predicate(checkField, 'equal', value_7)))
|
|
3455
3388
|
.then(function (e) {
|
|
3456
3389
|
if (e.result.length > 0) {
|
|
3457
3390
|
_this.addItem(e.result, listLength_2);
|
|
@@ -3548,7 +3481,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3548
3481
|
var this_1 = this;
|
|
3549
3482
|
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
|
|
3550
3483
|
var prop = _a[_i];
|
|
3551
|
-
_loop_1(prop);
|
|
3484
|
+
var state_1 = _loop_1(prop);
|
|
3485
|
+
if (typeof state_1 === "object")
|
|
3486
|
+
return state_1.value;
|
|
3552
3487
|
}
|
|
3553
3488
|
};
|
|
3554
3489
|
DropDownList.prototype.checkValidLi = function (element) {
|
|
@@ -3569,6 +3504,8 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3569
3504
|
}
|
|
3570
3505
|
}
|
|
3571
3506
|
else if (prop === 'value') {
|
|
3507
|
+
var fields = (_this.fields.value) ? _this.fields.value : '';
|
|
3508
|
+
var value = _this.allowObjectBinding && !isNullOrUndefined(newProp) ? getValue(fields, newProp) : newProp;
|
|
3572
3509
|
li = _this.getElementByValue(newProp);
|
|
3573
3510
|
if (!_this.checkValidLi(li)) {
|
|
3574
3511
|
_this.setOldValue(oldProp);
|
|
@@ -3631,6 +3568,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3631
3568
|
if (!this.enabled) {
|
|
3632
3569
|
return;
|
|
3633
3570
|
}
|
|
3571
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
3634
3572
|
if (this.isReact && this.getModuleName() === 'combobox' && this.itemTemplate && this.isCustomFilter && this.isAddNewItemTemplate) {
|
|
3635
3573
|
this.renderList();
|
|
3636
3574
|
this.isAddNewItemTemplate = false;
|
|
@@ -3707,7 +3645,8 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3707
3645
|
}
|
|
3708
3646
|
this.isEscapeKey = false;
|
|
3709
3647
|
if (!isNullOrUndefined(this.index)) {
|
|
3710
|
-
var
|
|
3648
|
+
var value = this.allowObjectBinding ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
3649
|
+
var element = this.findListElement(this.ulElement, 'li', 'data-value', value);
|
|
3711
3650
|
this.selectedLI = this.liCollections[this.index] || element;
|
|
3712
3651
|
if (this.selectedLI) {
|
|
3713
3652
|
this.updateSelectedItem(this.selectedLI, null, true);
|
|
@@ -3720,6 +3659,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3720
3659
|
this.resetSelection();
|
|
3721
3660
|
}
|
|
3722
3661
|
}
|
|
3662
|
+
this.isVirtualTrackHeight = false;
|
|
3723
3663
|
this.closePopup(0, e);
|
|
3724
3664
|
var dataItem = this.getItemData();
|
|
3725
3665
|
var isSelectVal = !isNullOrUndefined(this.selectedLI);
|
|
@@ -3791,6 +3731,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3791
3731
|
*/
|
|
3792
3732
|
DropDownList.prototype.destroy = function () {
|
|
3793
3733
|
this.isActive = false;
|
|
3734
|
+
if (this.showClearButton) {
|
|
3735
|
+
this.clearButton = document.getElementsByClassName('e-clear-icon')[0];
|
|
3736
|
+
}
|
|
3794
3737
|
resetIncrementalSearchValues(this.element.id);
|
|
3795
3738
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3796
3739
|
if (this.isReact) {
|
|
@@ -3846,6 +3789,14 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3846
3789
|
if (this.inputElement && !isNullOrUndefined(this.inputElement.onchange)) {
|
|
3847
3790
|
this.inputElement.onchange = null;
|
|
3848
3791
|
}
|
|
3792
|
+
if (this.inputElement && !isNullOrUndefined(this.inputElement.onselect)) {
|
|
3793
|
+
this.inputElement.onselect = null;
|
|
3794
|
+
}
|
|
3795
|
+
Input.destroy({
|
|
3796
|
+
element: this.inputElement,
|
|
3797
|
+
floatLabelType: this.floatLabelType,
|
|
3798
|
+
properties: this.properties
|
|
3799
|
+
}, this.clearButton);
|
|
3849
3800
|
if (this.isAngular) {
|
|
3850
3801
|
this.inputElement = null;
|
|
3851
3802
|
}
|
|
@@ -3938,6 +3889,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3938
3889
|
__decorate([
|
|
3939
3890
|
Property(null)
|
|
3940
3891
|
], DropDownList.prototype, "value", void 0);
|
|
3892
|
+
__decorate([
|
|
3893
|
+
Property(false)
|
|
3894
|
+
], DropDownList.prototype, "allowObjectBinding", void 0);
|
|
3941
3895
|
__decorate([
|
|
3942
3896
|
Property(null)
|
|
3943
3897
|
], DropDownList.prototype, "index", void 0);
|