@syncfusion/ej2-dropdowns 24.2.8 → 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 -150
- 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 +2049 -528
- package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
- package/dist/es6/ej2-dropdowns.es5.js +2072 -533
- 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 +11 -2
- package/src/combo-box/combo-box.d.ts +10 -2
- package/src/combo-box/combo-box.js +75 -16
- 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 +65 -5
- package/src/drop-down-base/drop-down-base.js +242 -25
- package/src/drop-down-list/drop-down-list-model.d.ts +10 -1
- package/src/drop-down-list/drop-down-list.d.ts +16 -51
- package/src/drop-down-list/drop-down-list.js +180 -217
- 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 +21 -9
- 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 +8 -2
- package/styles/bootstrap.css +8 -2
- package/styles/bootstrap4.css +3 -2
- package/styles/bootstrap5-dark.css +3 -2
- package/styles/bootstrap5.css +3 -2
- 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/_layout.scss +1 -1
- package/styles/drop-down-list/bootstrap-dark.css +1 -1
- package/styles/drop-down-list/bootstrap.css +1 -1
- package/styles/drop-down-list/bootstrap4.css +1 -1
- package/styles/drop-down-list/bootstrap5-dark.css +1 -1
- package/styles/drop-down-list/bootstrap5.css +1 -1
- package/styles/drop-down-list/fabric-dark.css +1 -1
- package/styles/drop-down-list/fabric.css +1 -1
- package/styles/drop-down-list/fluent-dark.css +1 -1
- package/styles/drop-down-list/fluent.css +1 -1
- package/styles/drop-down-list/highcontrast-light.css +1 -1
- package/styles/drop-down-list/highcontrast.css +1 -1
- package/styles/drop-down-list/icons/_bds.scss +14 -0
- package/styles/drop-down-list/material-dark.css +1 -1
- package/styles/drop-down-list/material.css +1 -1
- package/styles/drop-down-list/material3-dark.css +1 -1
- package/styles/drop-down-list/material3.css +1 -1
- package/styles/drop-down-list/tailwind-dark.css +1 -1
- package/styles/drop-down-list/tailwind.css +1 -1
- 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 +4 -2
- package/styles/fabric.css +4 -2
- package/styles/fluent-dark.css +8 -2
- package/styles/fluent.css +8 -2
- package/styles/highcontrast-light.css +4 -2
- package/styles/highcontrast.css +4 -2
- package/styles/list-box/_bds-definition.scss +136 -0
- package/styles/list-box/icons/_bds.scss +25 -0
- package/styles/material-dark.css +3 -2
- package/styles/material.css +3 -2
- package/styles/material3-dark.css +3 -2
- package/styles/material3.css +3 -2
- 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 +3 -2
- package/styles/tailwind.css +3 -2
|
@@ -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
|
};
|
|
@@ -160,7 +116,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
160
116
|
this.isFilterFocus = false;
|
|
161
117
|
this.beforePopupOpen = false;
|
|
162
118
|
this.initial = true;
|
|
163
|
-
this.
|
|
119
|
+
this.initialRemoteRender = false;
|
|
164
120
|
this.isNotSearchList = false;
|
|
165
121
|
this.isTyped = false;
|
|
166
122
|
this.isSelected = false;
|
|
@@ -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);
|
|
@@ -451,7 +412,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
451
412
|
this.viewPortInfo.endIndex = this.virtualItemEndIndex = this.itemCount;
|
|
452
413
|
this.renderList();
|
|
453
414
|
if (this.dataSource instanceof DataManager) {
|
|
454
|
-
this.
|
|
415
|
+
this.initialRemoteRender = true;
|
|
455
416
|
}
|
|
456
417
|
else {
|
|
457
418
|
this.updateValues();
|
|
@@ -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
|
}
|
|
@@ -1430,34 +1376,34 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1430
1376
|
}
|
|
1431
1377
|
};
|
|
1432
1378
|
DropDownList.prototype.setSelection = function (li, e) {
|
|
1433
|
-
var _this = this;
|
|
1434
1379
|
if (this.isValidLI(li) && (!li.classList.contains(dropDownBaseClasses.selected) || (this.isPopupOpen && this.isSelected
|
|
1435
1380
|
&& li.classList.contains(dropDownBaseClasses.selected)))) {
|
|
1436
1381
|
this.updateSelectedItem(li, e, false, true);
|
|
1437
1382
|
}
|
|
1438
1383
|
else {
|
|
1439
1384
|
this.setSelectOptions(li, e);
|
|
1440
|
-
if (this.enableVirtualization) {
|
|
1385
|
+
if (this.enableVirtualization && this.value) {
|
|
1441
1386
|
var fields = (this.fields.value) ? this.fields.value : '';
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
}
|
|
1387
|
+
var currentValue = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
1388
|
+
if (this.dataSource instanceof DataManager && this.virtualGroupDataSource) {
|
|
1389
|
+
var getItem = new DataManager(this.virtualGroupDataSource).executeLocal(new Query().where(new Predicate(fields, 'equal', currentValue)));
|
|
1390
|
+
if (getItem && getItem.length > 0) {
|
|
1391
|
+
this.itemData = getItem[0];
|
|
1392
|
+
var dataItem = this.getItemData();
|
|
1393
|
+
var value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
1394
|
+
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
1395
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
1451
1396
|
}
|
|
1452
|
-
}
|
|
1397
|
+
}
|
|
1453
1398
|
}
|
|
1454
1399
|
else {
|
|
1455
|
-
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)));
|
|
1456
1401
|
if (getItem && getItem.length > 0) {
|
|
1457
1402
|
this.itemData = getItem[0];
|
|
1458
1403
|
var dataItem = this.getItemData();
|
|
1404
|
+
var value = this.allowObjectBinding ? this.getDataByValue(dataItem.value) : dataItem.value;
|
|
1459
1405
|
if ((this.value === dataItem.value && this.text !== dataItem.text) || (this.value !== dataItem.value && this.text === dataItem.text)) {
|
|
1460
|
-
this.setProperties({ 'text': dataItem.text, 'value':
|
|
1406
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
1461
1407
|
}
|
|
1462
1408
|
}
|
|
1463
1409
|
}
|
|
@@ -1571,10 +1517,23 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1571
1517
|
* @param {MouseEvent | KeyboardEvent | TouchEvent} eve - Specifies the event arguments.
|
|
1572
1518
|
* @returns {void}
|
|
1573
1519
|
*/
|
|
1574
|
-
DropDownList.prototype.onChangeEvent = function (eve) {
|
|
1520
|
+
DropDownList.prototype.onChangeEvent = function (eve, isCustomValue) {
|
|
1521
|
+
var _this = this;
|
|
1575
1522
|
var dataItem = this.getItemData();
|
|
1576
1523
|
var index = this.isSelectCustom ? null : this.activeIndex;
|
|
1577
|
-
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);
|
|
1578
1537
|
this.detachChangeEvent(eve);
|
|
1579
1538
|
};
|
|
1580
1539
|
DropDownList.prototype.detachChanges = function (value) {
|
|
@@ -1601,7 +1560,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1601
1560
|
DropDownList.prototype.detachChangeEvent = function (eve) {
|
|
1602
1561
|
this.isSelected = false;
|
|
1603
1562
|
this.previousValue = this.value;
|
|
1604
|
-
this.activeIndex = this.index;
|
|
1563
|
+
this.activeIndex = this.enableVirtualization ? this.getIndexByValue(this.value) : this.index;
|
|
1605
1564
|
this.typedString = !isNullOrUndefined(this.text) ? this.text : '';
|
|
1606
1565
|
if (!this.initial) {
|
|
1607
1566
|
var items = this.detachChanges(this.itemData);
|
|
@@ -1648,16 +1607,17 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1648
1607
|
};
|
|
1649
1608
|
DropDownList.prototype.setHiddenValue = function () {
|
|
1650
1609
|
if (!isNullOrUndefined(this.value)) {
|
|
1610
|
+
var value = this.allowObjectBinding && !isNullOrUndefined(this.value) ? getValue((this.fields.value) ? this.fields.value : '', this.value) : this.value;
|
|
1651
1611
|
if (this.hiddenElement.querySelector('option')) {
|
|
1652
1612
|
var selectedElement = this.hiddenElement.querySelector('option');
|
|
1653
1613
|
selectedElement.textContent = this.text;
|
|
1654
|
-
selectedElement.setAttribute('value',
|
|
1614
|
+
selectedElement.setAttribute('value', value.toString());
|
|
1655
1615
|
}
|
|
1656
1616
|
else {
|
|
1657
1617
|
if (!isNullOrUndefined(this.hiddenElement)) {
|
|
1658
1618
|
this.hiddenElement.innerHTML = '<option selected>' + this.text + '</option>';
|
|
1659
1619
|
var selectedElement = this.hiddenElement.querySelector('option');
|
|
1660
|
-
selectedElement.setAttribute('value',
|
|
1620
|
+
selectedElement.setAttribute('value', value.toString());
|
|
1661
1621
|
}
|
|
1662
1622
|
}
|
|
1663
1623
|
}
|
|
@@ -1674,6 +1634,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1674
1634
|
DropDownList.prototype.onFilterUp = function (e) {
|
|
1675
1635
|
if (!(e.ctrlKey && e.keyCode === 86) && (this.isValidKey || e.keyCode === 40 || e.keyCode === 38)) {
|
|
1676
1636
|
this.isValidKey = false;
|
|
1637
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
1677
1638
|
switch (e.keyCode) {
|
|
1678
1639
|
case 38: //up arrow
|
|
1679
1640
|
case 40: //down arrow
|
|
@@ -1730,42 +1691,6 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1730
1691
|
this.isValidKey = false;
|
|
1731
1692
|
}
|
|
1732
1693
|
};
|
|
1733
|
-
DropDownList.prototype.getFilteringSkeletonCount = function () {
|
|
1734
|
-
var difference = this.dataCount - this.viewPortInfo.endIndex;
|
|
1735
|
-
var currentSkeletonCount = this.skeletonCount;
|
|
1736
|
-
this.getSkeletonCount(true);
|
|
1737
|
-
this.skeletonCount = this.dataCount > this.itemCount * 2 ? this.skeletonCount : difference > this.skeletonCount ? this.skeletonCount : difference > 0 ? difference : 0;
|
|
1738
|
-
var skeletonUpdated = true;
|
|
1739
|
-
if (this.getModuleName() === 'autocomplete' && (this.totalItemCount != 0 && this.totalItemCount < (this.itemCount * 2))) {
|
|
1740
|
-
this.skeletonCount = 0;
|
|
1741
|
-
skeletonUpdated = false;
|
|
1742
|
-
}
|
|
1743
|
-
if (!this.list.classList.contains(dropDownBaseClasses.noData)) {
|
|
1744
|
-
var isSkeletonCountChange = currentSkeletonCount !== this.skeletonCount;
|
|
1745
|
-
if (currentSkeletonCount !== this.skeletonCount && skeletonUpdated) {
|
|
1746
|
-
this.UpdateSkeleton(true, Math.abs(currentSkeletonCount - this.skeletonCount));
|
|
1747
|
-
}
|
|
1748
|
-
else {
|
|
1749
|
-
this.UpdateSkeleton();
|
|
1750
|
-
}
|
|
1751
|
-
this.liCollections = this.list.querySelectorAll('.e-list-item');
|
|
1752
|
-
if ((this.list.getElementsByClassName('e-virtual-ddl').length > 0)) {
|
|
1753
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1754
|
-
this.list.getElementsByClassName('e-virtual-ddl')[0].style = this.GetVirtualTrackHeight();
|
|
1755
|
-
}
|
|
1756
|
-
if (this.list.getElementsByClassName('e-virtual-ddl-content').length > 0) {
|
|
1757
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1758
|
-
this.list.getElementsByClassName('e-virtual-ddl-content')[0].style = this.getTransformValues();
|
|
1759
|
-
}
|
|
1760
|
-
}
|
|
1761
|
-
};
|
|
1762
|
-
DropDownList.prototype.getSkeletonCount = function (retainSkeleton) {
|
|
1763
|
-
this.virtualListHeight = this.listHeight != null ? parseInt(this.listHeight, 10) : this.virtualListHeight;
|
|
1764
|
-
var actualCount = this.virtualListHeight > 0 ? Math.floor(this.virtualListHeight / this.listItemHeight) : 0;
|
|
1765
|
-
this.skeletonCount = actualCount * 2 < this.itemCount ? this.itemCount : actualCount * 2;
|
|
1766
|
-
this.itemCount = retainSkeleton ? this.itemCount : this.skeletonCount;
|
|
1767
|
-
this.skeletonCount = Math.floor(this.skeletonCount / 2) + 2;
|
|
1768
|
-
};
|
|
1769
1694
|
DropDownList.prototype.onFilterDown = function (e) {
|
|
1770
1695
|
switch (e.keyCode) {
|
|
1771
1696
|
case 13: //enter
|
|
@@ -1820,14 +1745,51 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
1820
1745
|
}
|
|
1821
1746
|
}
|
|
1822
1747
|
}
|
|
1823
|
-
|
|
1824
|
-
|
|
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
|
+
}
|
|
1825
1780
|
}
|
|
1826
1781
|
if (this.isIncrementalRequest) {
|
|
1827
1782
|
filterQuery.take(this.incrementalEndIndex);
|
|
1828
1783
|
}
|
|
1829
1784
|
else {
|
|
1830
|
-
|
|
1785
|
+
if (!takeExists) {
|
|
1786
|
+
if (queryTakeValue > 0) {
|
|
1787
|
+
filterQuery.take(queryTakeValue);
|
|
1788
|
+
}
|
|
1789
|
+
else {
|
|
1790
|
+
filterQuery.take(takeValue);
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1831
1793
|
}
|
|
1832
1794
|
filterQuery.requiresCount();
|
|
1833
1795
|
}
|
|
@@ -2048,29 +2010,6 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2048
2010
|
this.renderPopup();
|
|
2049
2011
|
}
|
|
2050
2012
|
};
|
|
2051
|
-
DropDownList.prototype.UpdateSkeleton = function (isSkeletonCountChange, skeletonCount) {
|
|
2052
|
-
var isContainSkeleton = this.list.querySelector('.e-virtual-ddl-content');
|
|
2053
|
-
var isContainVirtualList = this.list.querySelector('.e-virtual-list');
|
|
2054
|
-
if (isContainSkeleton && (!isContainVirtualList || isSkeletonCountChange) && this.enableVirtualization) {
|
|
2055
|
-
var totalSkeletonCount = isSkeletonCountChange ? skeletonCount : this.skeletonCount;
|
|
2056
|
-
for (var i = 0; i < totalSkeletonCount; i++) {
|
|
2057
|
-
var liElement = this.createElement('li', { className: dropDownListClasses.virtualList, styles: 'overflow: inherit' });
|
|
2058
|
-
if (this.enableVirtualization && this.itemTemplate) {
|
|
2059
|
-
liElement.style.height = this.listItemHeight + 'px';
|
|
2060
|
-
}
|
|
2061
|
-
var skeleton = new Skeleton({
|
|
2062
|
-
shape: "Text",
|
|
2063
|
-
height: "10px",
|
|
2064
|
-
width: "95%",
|
|
2065
|
-
cssClass: "e-skeleton-text",
|
|
2066
|
-
});
|
|
2067
|
-
skeleton.appendTo(this.createElement('div'));
|
|
2068
|
-
liElement.appendChild(skeleton.element);
|
|
2069
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2070
|
-
isContainSkeleton.firstChild.insertBefore(liElement, isContainSkeleton.firstChild.children[0]);
|
|
2071
|
-
}
|
|
2072
|
-
}
|
|
2073
|
-
};
|
|
2074
2013
|
DropDownList.prototype.getTakeValue = function () {
|
|
2075
2014
|
return this.allowFiltering && this.getModuleName() === 'dropdownlist' && Browser.isDevice ? Math.round(window.outerHeight / this.listItemHeight) : this.itemCount;
|
|
2076
2015
|
};
|
|
@@ -2106,19 +2045,26 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2106
2045
|
if (!isNullOrUndefined(ulElement)) {
|
|
2107
2046
|
attributes(ulElement, { 'id': this.element.id + '_options', 'role': 'listbox', 'aria-hidden': 'false', 'aria-label': 'listbox' });
|
|
2108
2047
|
}
|
|
2109
|
-
if (this.
|
|
2048
|
+
if (this.initialRemoteRender) {
|
|
2110
2049
|
this.initial = true;
|
|
2111
2050
|
this.activeIndex = this.index;
|
|
2112
|
-
this.
|
|
2051
|
+
this.initialRemoteRender = false;
|
|
2113
2052
|
if (this.value && this.dataSource instanceof DataManager) {
|
|
2114
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;
|
|
2115
2055
|
var fieldValue_1 = this.fields.value.split('.');
|
|
2116
2056
|
var checkVal = list.some(function (x) {
|
|
2117
2057
|
return isNullOrUndefined(x[checkField_1]) && fieldValue_1.length > 1 ?
|
|
2118
|
-
_this.checkFieldValue(x, fieldValue_1) ===
|
|
2058
|
+
_this.checkFieldValue(x, fieldValue_1) === value_5 : x[checkField_1] === value_5;
|
|
2119
2059
|
});
|
|
2060
|
+
if (this.enableVirtualization && this.virtualGroupDataSource) {
|
|
2061
|
+
checkVal = this.virtualGroupDataSource.some(function (x) {
|
|
2062
|
+
return isNullOrUndefined(x[checkField_1]) && fieldValue_1.length > 1 ?
|
|
2063
|
+
_this.checkFieldValue(x, fieldValue_1) === value_5 : x[checkField_1] === value_5;
|
|
2064
|
+
});
|
|
2065
|
+
}
|
|
2120
2066
|
if (!checkVal) {
|
|
2121
|
-
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)))
|
|
2122
2068
|
.then(function (e) {
|
|
2123
2069
|
if (e.result.length > 0) {
|
|
2124
2070
|
_this.addItem(e.result, list.length);
|
|
@@ -2230,10 +2176,10 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2230
2176
|
DropDownList.prototype.addNewItem = function (listData, newElement) {
|
|
2231
2177
|
var _this = this;
|
|
2232
2178
|
if (!isNullOrUndefined(this.itemData) && !isNullOrUndefined(newElement)) {
|
|
2233
|
-
var
|
|
2179
|
+
var value_6 = this.getItemData().value;
|
|
2234
2180
|
var isExist = listData.some(function (data) {
|
|
2235
|
-
return (((typeof data === 'string' || typeof data === 'number') && data ===
|
|
2236
|
-
(getValue(_this.fields.value, data) ===
|
|
2181
|
+
return (((typeof data === 'string' || typeof data === 'number') && data === value_6) ||
|
|
2182
|
+
(getValue(_this.fields.value, data) === value_6));
|
|
2237
2183
|
});
|
|
2238
2184
|
if (!isExist) {
|
|
2239
2185
|
this.addItem(this.itemData);
|
|
@@ -2289,46 +2235,19 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2289
2235
|
DropDownList.prototype.updateSelectionList = function () {
|
|
2290
2236
|
var selectedItem = this.list && this.list.querySelector('.' + 'e-active');
|
|
2291
2237
|
if (!selectedItem && !isNullOrUndefined(this.value)) {
|
|
2292
|
-
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);
|
|
2293
2240
|
if (findEle) {
|
|
2294
2241
|
findEle.classList.add('e-active');
|
|
2295
2242
|
}
|
|
2296
2243
|
}
|
|
2297
2244
|
};
|
|
2298
|
-
DropDownList.prototype.checkAndResetCache = function () {
|
|
2299
|
-
if (this.enableVirtualization) {
|
|
2300
|
-
this.generatedDataObject = {};
|
|
2301
|
-
this.virtualItemStartIndex = this.virtualItemEndIndex = 0;
|
|
2302
|
-
this.viewPortInfo = { currentPageNumber: null,
|
|
2303
|
-
direction: null,
|
|
2304
|
-
sentinelInfo: {},
|
|
2305
|
-
offsets: {},
|
|
2306
|
-
startIndex: 0,
|
|
2307
|
-
endIndex: this.itemCount, };
|
|
2308
|
-
this.selectedValueInfo = null;
|
|
2309
|
-
}
|
|
2310
|
-
};
|
|
2311
2245
|
DropDownList.prototype.removeFocus = function () {
|
|
2312
2246
|
var highlightedItem = this.list.querySelectorAll('.' + dropDownListClasses.focus);
|
|
2313
2247
|
if (highlightedItem && highlightedItem.length) {
|
|
2314
2248
|
removeClass(highlightedItem, dropDownListClasses.focus);
|
|
2315
2249
|
}
|
|
2316
2250
|
};
|
|
2317
|
-
DropDownList.prototype.getTransformValues = function () {
|
|
2318
|
-
var translateY = this.viewPortInfo.startIndex * this.listItemHeight;
|
|
2319
|
-
translateY = translateY - (this.skeletonCount * this.listItemHeight);
|
|
2320
|
-
translateY = this.viewPortInfo.startIndex === 0 && this.listData && this.listData.length === 0 ? 0 : translateY;
|
|
2321
|
-
var styleText = "transform: translate(0px, " + translateY + "px);";
|
|
2322
|
-
return styleText;
|
|
2323
|
-
};
|
|
2324
|
-
DropDownList.prototype.GetVirtualTrackHeight = function () {
|
|
2325
|
-
var height = this.totalItemCount === this.viewPortInfo.endIndex ? this.totalItemCount * this.listItemHeight - this.itemCount * this.listItemHeight : this.totalItemCount * this.listItemHeight;
|
|
2326
|
-
var heightDimension = "height: " + (height - this.itemCount * this.listItemHeight) + "px;";
|
|
2327
|
-
if (this.getModuleName() === 'autocomplete' && this.skeletonCount === 0) {
|
|
2328
|
-
return "height: 0px;";
|
|
2329
|
-
}
|
|
2330
|
-
return heightDimension;
|
|
2331
|
-
};
|
|
2332
2251
|
DropDownList.prototype.renderPopup = function (e) {
|
|
2333
2252
|
var _this = this;
|
|
2334
2253
|
if (this.popupObj && document.body.contains(this.popupObj.element)) {
|
|
@@ -2344,7 +2263,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2344
2263
|
popupEle.setAttribute('aria-label', _this.element.id);
|
|
2345
2264
|
popupEle.setAttribute('role', 'dialog');
|
|
2346
2265
|
var searchBox = _this.setSearchBox(popupEle);
|
|
2347
|
-
_this.
|
|
2266
|
+
_this.listContainerHeight = formatUnit(_this.popupHeight);
|
|
2348
2267
|
if (_this.headerTemplate) {
|
|
2349
2268
|
_this.setHeaderTemplate(popupEle);
|
|
2350
2269
|
}
|
|
@@ -2388,19 +2307,19 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2388
2307
|
_this.searchBoxHeight = 0;
|
|
2389
2308
|
if (!isNullOrUndefined(searchBox.container) && _this.getModuleName() !== 'combobox' && _this.getModuleName() !== 'autocomplete') {
|
|
2390
2309
|
_this.searchBoxHeight = (searchBox.container.parentElement).getBoundingClientRect().height;
|
|
2391
|
-
_this.
|
|
2310
|
+
_this.listContainerHeight = (parseInt(_this.listContainerHeight, 10) - (_this.searchBoxHeight)).toString() + 'px';
|
|
2392
2311
|
}
|
|
2393
2312
|
if (_this.headerTemplate) {
|
|
2394
2313
|
_this.header = _this.header ? _this.header : popupEle.querySelector('.e-ddl-header');
|
|
2395
2314
|
var height = Math.round(_this.header.getBoundingClientRect().height);
|
|
2396
|
-
_this.
|
|
2315
|
+
_this.listContainerHeight = (parseInt(_this.listContainerHeight, 10) - (height + _this.searchBoxHeight)).toString() + 'px';
|
|
2397
2316
|
}
|
|
2398
2317
|
if (_this.footerTemplate) {
|
|
2399
2318
|
_this.footer = _this.footer ? _this.footer : popupEle.querySelector('.e-ddl-footer');
|
|
2400
2319
|
var height = Math.round(_this.footer.getBoundingClientRect().height);
|
|
2401
|
-
_this.
|
|
2320
|
+
_this.listContainerHeight = (parseInt(_this.listContainerHeight, 10) - (height + _this.searchBoxHeight)).toString() + 'px';
|
|
2402
2321
|
}
|
|
2403
|
-
_this.list.style.maxHeight = (parseInt(_this.
|
|
2322
|
+
_this.list.style.maxHeight = (parseInt(_this.listContainerHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
|
|
2404
2323
|
popupEle.style.maxHeight = formatUnit(_this.popupHeight);
|
|
2405
2324
|
}
|
|
2406
2325
|
else {
|
|
@@ -2433,6 +2352,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2433
2352
|
_this.getFocusElement();
|
|
2434
2353
|
_this.checkCollision(popupEle);
|
|
2435
2354
|
if (Browser.isDevice) {
|
|
2355
|
+
if ((parseInt(_this.popupWidth.toString(), 10) > window.outerWidth) && !(_this.getModuleName() === 'dropdownlist' && _this.allowFiltering)) {
|
|
2356
|
+
_this.popupObj.element.classList.add('e-wide-popup');
|
|
2357
|
+
}
|
|
2436
2358
|
_this.popupObj.element.classList.add(dropDownListClasses.device);
|
|
2437
2359
|
if (_this.getModuleName() === 'dropdownlist' || (_this.getModuleName() === 'combobox'
|
|
2438
2360
|
&& !_this.allowFiltering && _this.isDropDownClick)) {
|
|
@@ -2709,6 +2631,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2709
2631
|
this.list.scrollTop += nextOffset;
|
|
2710
2632
|
}
|
|
2711
2633
|
else {
|
|
2634
|
+
if (this.enableVirtualization) {
|
|
2635
|
+
liCount = keyAction == "pageDown" ? this.getPageCount() : liCount;
|
|
2636
|
+
}
|
|
2712
2637
|
this.list.scrollTop += this.selectedLI.offsetHeight * liCount;
|
|
2713
2638
|
}
|
|
2714
2639
|
this.isPreventKeyAction = this.IsScrollerAtEnd() ? false : this.isPreventKeyAction;
|
|
@@ -2762,6 +2687,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2762
2687
|
else if (nextOffset < 0 || isPageUpKeyAction) {
|
|
2763
2688
|
var currentElementValue = this.selectedLI ? this.selectedLI.getAttribute('data-value') : null;
|
|
2764
2689
|
var liCount = keyAction == "pageUp" ? this.getPageCount() - 2 : 1;
|
|
2690
|
+
if (this.enableVirtualization) {
|
|
2691
|
+
liCount = keyAction == "pageUp" ? this.getPageCount() : liCount;
|
|
2692
|
+
}
|
|
2765
2693
|
if (this.enableVirtualization && this.isKeyBoardAction && firstElementValue && currentElementValue === firstElementValue && keyAction != "home" && !this.isVirtualScrolling) {
|
|
2766
2694
|
this.isUpwardScrolling = true;
|
|
2767
2695
|
this.isPreventKeyAction = true;
|
|
@@ -2859,6 +2787,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2859
2787
|
var isFilterValue = !isNullOrUndefined(this.filterInput) && !isNullOrUndefined(this.filterInput.value) && this.filterInput.value !== '';
|
|
2860
2788
|
var typedString = this.getModuleName() === 'combobox' ? this.typedString : null;
|
|
2861
2789
|
this.isTyped = false;
|
|
2790
|
+
this.isVirtualTrackHeight = false;
|
|
2862
2791
|
if (!(this.popupObj && document.body.contains(this.popupObj.element) && this.beforePopupOpen)) {
|
|
2863
2792
|
return;
|
|
2864
2793
|
}
|
|
@@ -2948,8 +2877,8 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
2948
2877
|
}
|
|
2949
2878
|
}
|
|
2950
2879
|
});
|
|
2951
|
-
if (
|
|
2952
|
-
this.
|
|
2880
|
+
if (Browser.isDevice && !eventArgs.cancel && this.popupObj.element.classList.contains('e-wide-popup')) {
|
|
2881
|
+
this.popupObj.element.classList.remove('e-wide-popup');
|
|
2953
2882
|
}
|
|
2954
2883
|
var dataSourceCount;
|
|
2955
2884
|
if (this.dataSource instanceof DataManager) {
|
|
@@ -3114,6 +3043,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3114
3043
|
this.listItemHeight = this.getListHeight();
|
|
3115
3044
|
this.getSkeletonCount();
|
|
3116
3045
|
this.updateVirtualizationProperties(this.itemCount, this.allowFiltering);
|
|
3046
|
+
if (this.index !== null) {
|
|
3047
|
+
this.activeIndex = this.index + this.skeletonCount;
|
|
3048
|
+
}
|
|
3117
3049
|
}
|
|
3118
3050
|
this.initValue();
|
|
3119
3051
|
this.selectedValueInfo = this.viewPortInfo;
|
|
@@ -3123,7 +3055,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3123
3055
|
}
|
|
3124
3056
|
else if (this.element.tagName === 'SELECT' && this.element.options[0]) {
|
|
3125
3057
|
var selectElement = this.element;
|
|
3126
|
-
this.value = selectElement.options[selectElement.selectedIndex].value;
|
|
3058
|
+
this.value = this.allowObjectBinding ? this.getDataByValue(selectElement.options[selectElement.selectedIndex].value) : selectElement.options[selectElement.selectedIndex].value;
|
|
3127
3059
|
this.text = isNullOrUndefined(this.value) ? null : selectElement.options[selectElement.selectedIndex].textContent;
|
|
3128
3060
|
this.initValue();
|
|
3129
3061
|
}
|
|
@@ -3275,7 +3207,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3275
3207
|
this.actionData = this.actionCompleteData;
|
|
3276
3208
|
}
|
|
3277
3209
|
};
|
|
3278
|
-
DropDownList.prototype.updateDataSource = function (props) {
|
|
3210
|
+
DropDownList.prototype.updateDataSource = function (props, oldProps) {
|
|
3279
3211
|
if (this.inputElement.value !== '' || (!isNullOrUndefined(props) && (isNullOrUndefined(props.dataSource)
|
|
3280
3212
|
|| (!(props.dataSource instanceof DataManager) && props.dataSource.length === 0)))) {
|
|
3281
3213
|
this.clearAll(null, props);
|
|
@@ -3285,7 +3217,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3285
3217
|
EventHandler.add(this.list, 'scroll', this.setFloatingHeader, this);
|
|
3286
3218
|
}
|
|
3287
3219
|
if (!(!isNullOrUndefined(props) && (isNullOrUndefined(props.dataSource)
|
|
3288
|
-
|| (!(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))) {
|
|
3289
3221
|
this.typedString = '';
|
|
3290
3222
|
this.resetList(this.dataSource);
|
|
3291
3223
|
}
|
|
@@ -3294,9 +3226,11 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3294
3226
|
}
|
|
3295
3227
|
};
|
|
3296
3228
|
DropDownList.prototype.checkCustomValue = function () {
|
|
3297
|
-
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);
|
|
3298
3231
|
var dataItem = this.getItemData();
|
|
3299
|
-
this.
|
|
3232
|
+
var value = this.allowObjectBinding ? this.itemData : dataItem.value;
|
|
3233
|
+
this.setProperties({ 'text': dataItem.text, 'value': value });
|
|
3300
3234
|
};
|
|
3301
3235
|
DropDownList.prototype.updateInputFields = function () {
|
|
3302
3236
|
if (this.getModuleName() === 'dropdownlist') {
|
|
@@ -3377,11 +3311,11 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3377
3311
|
}
|
|
3378
3312
|
if (!this_1.list) {
|
|
3379
3313
|
if (this_1.dataSource instanceof DataManager) {
|
|
3380
|
-
this_1.
|
|
3314
|
+
this_1.initialRemoteRender = true;
|
|
3381
3315
|
}
|
|
3382
3316
|
this_1.renderList();
|
|
3383
3317
|
}
|
|
3384
|
-
if (!this_1.
|
|
3318
|
+
if (!this_1.initialRemoteRender) {
|
|
3385
3319
|
var li = this_1.getElementByText(newProp.text);
|
|
3386
3320
|
if (!this_1.checkValidLi(li)) {
|
|
3387
3321
|
if (this_1.liCollections && this_1.liCollections.length === 100 &&
|
|
@@ -3418,6 +3352,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3418
3352
|
this_1.clearAll();
|
|
3419
3353
|
break;
|
|
3420
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
|
+
}
|
|
3421
3358
|
if (this_1.enableVirtualization) {
|
|
3422
3359
|
this_1.updateValues();
|
|
3423
3360
|
this_1.updateInputFields();
|
|
@@ -3430,12 +3367,13 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3430
3367
|
this_1.notify('beforeValueChange', { newProp: newProp }); // gird component value type change
|
|
3431
3368
|
if (!this_1.list) {
|
|
3432
3369
|
if (this_1.dataSource instanceof DataManager) {
|
|
3433
|
-
this_1.
|
|
3370
|
+
this_1.initialRemoteRender = true;
|
|
3434
3371
|
}
|
|
3435
3372
|
this_1.renderList();
|
|
3436
3373
|
}
|
|
3437
|
-
if (!this_1.
|
|
3438
|
-
var
|
|
3374
|
+
if (!this_1.initialRemoteRender) {
|
|
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);
|
|
3439
3377
|
if (!this_1.checkValidLi(item)) {
|
|
3440
3378
|
if (this_1.liCollections && this_1.liCollections.length === 100 &&
|
|
3441
3379
|
this_1.getModuleName() === 'autocomplete' && this_1.listData.length > 100) {
|
|
@@ -3445,7 +3383,8 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3445
3383
|
var listLength_2 = this_1.getItems().length;
|
|
3446
3384
|
var checkField = isNullOrUndefined(this_1.fields.value) ? this_1.fields.text : this_1.fields.value;
|
|
3447
3385
|
this_1.typedString = '';
|
|
3448
|
-
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)))
|
|
3449
3388
|
.then(function (e) {
|
|
3450
3389
|
if (e.result.length > 0) {
|
|
3451
3390
|
_this.addItem(e.result, listLength_2);
|
|
@@ -3474,11 +3413,11 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3474
3413
|
}
|
|
3475
3414
|
if (!this_1.list) {
|
|
3476
3415
|
if (this_1.dataSource instanceof DataManager) {
|
|
3477
|
-
this_1.
|
|
3416
|
+
this_1.initialRemoteRender = true;
|
|
3478
3417
|
}
|
|
3479
3418
|
this_1.renderList();
|
|
3480
3419
|
}
|
|
3481
|
-
if (!this_1.
|
|
3420
|
+
if (!this_1.initialRemoteRender && this_1.liCollections) {
|
|
3482
3421
|
var element = this_1.liCollections[newProp.index];
|
|
3483
3422
|
if (!this_1.checkValidLi(element)) {
|
|
3484
3423
|
if (this_1.liCollections && this_1.liCollections.length === 100 &&
|
|
@@ -3542,7 +3481,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3542
3481
|
var this_1 = this;
|
|
3543
3482
|
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
|
|
3544
3483
|
var prop = _a[_i];
|
|
3545
|
-
_loop_1(prop);
|
|
3484
|
+
var state_1 = _loop_1(prop);
|
|
3485
|
+
if (typeof state_1 === "object")
|
|
3486
|
+
return state_1.value;
|
|
3546
3487
|
}
|
|
3547
3488
|
};
|
|
3548
3489
|
DropDownList.prototype.checkValidLi = function (element) {
|
|
@@ -3563,6 +3504,8 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3563
3504
|
}
|
|
3564
3505
|
}
|
|
3565
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;
|
|
3566
3509
|
li = _this.getElementByValue(newProp);
|
|
3567
3510
|
if (!_this.checkValidLi(li)) {
|
|
3568
3511
|
_this.setOldValue(oldProp);
|
|
@@ -3625,6 +3568,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3625
3568
|
if (!this.enabled) {
|
|
3626
3569
|
return;
|
|
3627
3570
|
}
|
|
3571
|
+
this.firstItem = this.dataSource && this.dataSource.length > 0 ? this.dataSource[0] : null;
|
|
3628
3572
|
if (this.isReact && this.getModuleName() === 'combobox' && this.itemTemplate && this.isCustomFilter && this.isAddNewItemTemplate) {
|
|
3629
3573
|
this.renderList();
|
|
3630
3574
|
this.isAddNewItemTemplate = false;
|
|
@@ -3645,6 +3589,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3645
3589
|
}
|
|
3646
3590
|
else if (isNullOrUndefined(this.list) || !isUndefined(this.list) && (this.list.classList.contains(dropDownBaseClasses.noData) ||
|
|
3647
3591
|
this.list.querySelectorAll('.' + dropDownBaseClasses.li).length <= 0)) {
|
|
3592
|
+
if (this.isReact && this.isFiltering() && this.itemTemplate != null) {
|
|
3593
|
+
this.isSecondClick = false;
|
|
3594
|
+
}
|
|
3648
3595
|
this.renderList(e);
|
|
3649
3596
|
}
|
|
3650
3597
|
if (this.enableVirtualization && this.listData && this.listData.length) {
|
|
@@ -3698,7 +3645,8 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3698
3645
|
}
|
|
3699
3646
|
this.isEscapeKey = false;
|
|
3700
3647
|
if (!isNullOrUndefined(this.index)) {
|
|
3701
|
-
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);
|
|
3702
3650
|
this.selectedLI = this.liCollections[this.index] || element;
|
|
3703
3651
|
if (this.selectedLI) {
|
|
3704
3652
|
this.updateSelectedItem(this.selectedLI, null, true);
|
|
@@ -3711,6 +3659,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3711
3659
|
this.resetSelection();
|
|
3712
3660
|
}
|
|
3713
3661
|
}
|
|
3662
|
+
this.isVirtualTrackHeight = false;
|
|
3714
3663
|
this.closePopup(0, e);
|
|
3715
3664
|
var dataItem = this.getItemData();
|
|
3716
3665
|
var isSelectVal = !isNullOrUndefined(this.selectedLI);
|
|
@@ -3782,6 +3731,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3782
3731
|
*/
|
|
3783
3732
|
DropDownList.prototype.destroy = function () {
|
|
3784
3733
|
this.isActive = false;
|
|
3734
|
+
if (this.showClearButton) {
|
|
3735
|
+
this.clearButton = document.getElementsByClassName('e-clear-icon')[0];
|
|
3736
|
+
}
|
|
3785
3737
|
resetIncrementalSearchValues(this.element.id);
|
|
3786
3738
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3787
3739
|
if (this.isReact) {
|
|
@@ -3837,6 +3789,14 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3837
3789
|
if (this.inputElement && !isNullOrUndefined(this.inputElement.onchange)) {
|
|
3838
3790
|
this.inputElement.onchange = null;
|
|
3839
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);
|
|
3840
3800
|
if (this.isAngular) {
|
|
3841
3801
|
this.inputElement = null;
|
|
3842
3802
|
}
|
|
@@ -3851,7 +3811,7 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3851
3811
|
DropDownList.prototype.getItems = function () {
|
|
3852
3812
|
if (!this.list) {
|
|
3853
3813
|
if (this.dataSource instanceof DataManager) {
|
|
3854
|
-
this.
|
|
3814
|
+
this.initialRemoteRender = true;
|
|
3855
3815
|
}
|
|
3856
3816
|
this.renderList();
|
|
3857
3817
|
}
|
|
@@ -3929,6 +3889,9 @@ var DropDownList = /** @class */ (function (_super) {
|
|
|
3929
3889
|
__decorate([
|
|
3930
3890
|
Property(null)
|
|
3931
3891
|
], DropDownList.prototype, "value", void 0);
|
|
3892
|
+
__decorate([
|
|
3893
|
+
Property(false)
|
|
3894
|
+
], DropDownList.prototype, "allowObjectBinding", void 0);
|
|
3932
3895
|
__decorate([
|
|
3933
3896
|
Property(null)
|
|
3934
3897
|
], DropDownList.prototype, "index", void 0);
|