@syncfusion/ej2-dropdowns 20.3.60 → 20.4.38

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +2 -44
  2. package/dist/ej2-dropdowns.min.js +2 -2
  3. package/dist/ej2-dropdowns.umd.min.js +2 -2
  4. package/dist/ej2-dropdowns.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-dropdowns.es2015.js +485 -310
  6. package/dist/es6/ej2-dropdowns.es2015.js.map +1 -1
  7. package/dist/es6/ej2-dropdowns.es5.js +471 -296
  8. package/dist/es6/ej2-dropdowns.es5.js.map +1 -1
  9. package/dist/global/ej2-dropdowns.min.js +2 -2
  10. package/dist/global/ej2-dropdowns.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +11 -11
  13. package/src/auto-complete/auto-complete-model.d.ts +1 -1
  14. package/src/combo-box/combo-box.js +7 -5
  15. package/src/drop-down-base/drop-down-base-model.d.ts +0 -18
  16. package/src/drop-down-base/drop-down-base.d.ts +0 -22
  17. package/src/drop-down-base/drop-down-base.js +42 -37
  18. package/src/drop-down-list/drop-down-list-model.d.ts +18 -0
  19. package/src/drop-down-list/drop-down-list.d.ts +22 -0
  20. package/src/drop-down-list/drop-down-list.js +95 -41
  21. package/src/drop-down-tree/drop-down-tree-model.d.ts +15 -1
  22. package/src/drop-down-tree/drop-down-tree.d.ts +13 -1
  23. package/src/drop-down-tree/drop-down-tree.js +22 -5
  24. package/src/list-box/list-box-model.d.ts +18 -0
  25. package/src/list-box/list-box.d.ts +22 -0
  26. package/src/list-box/list-box.js +27 -14
  27. package/src/mention/mention-model.d.ts +2 -2
  28. package/src/mention/mention.d.ts +4 -1
  29. package/src/mention/mention.js +66 -27
  30. package/src/multi-select/checkbox-selection.js +10 -8
  31. package/src/multi-select/multi-select.js +203 -156
  32. package/styles/bootstrap5-dark.css +2 -2
  33. package/styles/bootstrap5.css +2 -2
  34. package/styles/drop-down-base/_bootstrap-dark-definition.scss +1 -0
  35. package/styles/drop-down-base/_bootstrap-definition.scss +1 -0
  36. package/styles/drop-down-base/_bootstrap4-definition.scss +1 -0
  37. package/styles/drop-down-base/_bootstrap5-definition.scss +1 -0
  38. package/styles/drop-down-base/_fabric-dark-definition.scss +1 -0
  39. package/styles/drop-down-base/_fabric-definition.scss +1 -0
  40. package/styles/drop-down-base/_fluent-definition.scss +1 -0
  41. package/styles/drop-down-base/_fusionnew-definition.scss +1 -0
  42. package/styles/drop-down-base/_highcontrast-definition.scss +1 -0
  43. package/styles/drop-down-base/_highcontrast-light-definition.scss +1 -0
  44. package/styles/drop-down-base/_layout.scss +1 -1
  45. package/styles/drop-down-base/_material-dark-definition.scss +1 -0
  46. package/styles/drop-down-base/_material-definition.scss +1 -0
  47. package/styles/drop-down-base/_material3-definition.scss +1 -0
  48. package/styles/drop-down-base/_tailwind-definition.scss +1 -0
  49. package/styles/drop-down-base/material-dark.css +1 -1
  50. package/styles/drop-down-tree/_layout.scss +3 -3
  51. package/styles/drop-down-tree/bootstrap5-dark.css +2 -2
  52. package/styles/drop-down-tree/bootstrap5.css +2 -2
  53. package/styles/material-dark.css +1 -1
  54. package/.eslintrc.json +0 -244
  55. package/tslint.json +0 -111
@@ -45,6 +45,7 @@ export declare class Mention extends DropDownBase {
45
45
  private isFiltered;
46
46
  private beforePopupOpen;
47
47
  private listHeight;
48
+ private isListResetted;
48
49
  private range;
49
50
  private displayTempElement;
50
51
  private isCollided;
@@ -337,6 +338,7 @@ export declare class Mention extends DropDownBase {
337
338
  /**
338
339
  * Hides the spinner loader.
339
340
  *
341
+ * @private
340
342
  * @returns {void}
341
343
  */
342
344
  hideSpinner(): void;
@@ -383,6 +385,7 @@ export declare class Mention extends DropDownBase {
383
385
  hidePopup(e?: MouseEvent | KeyboardEventArgs): void;
384
386
  private closePopup;
385
387
  private renderPopup;
388
+ private setHeight;
386
389
  private checkCollision;
387
390
  private getTriggerCharPosition;
388
391
  private initializePopup;
@@ -418,7 +421,7 @@ export declare class Mention extends DropDownBase {
418
421
  private updateMentionValue;
419
422
  private mentionVal;
420
423
  private setDisplayTemplate;
421
- renderTemplates(callBack?: any): void;
424
+ private renderTemplates;
422
425
  private setSpinnerTemplate;
423
426
  private onChangeEvent;
424
427
  private detachMentionChanges;
@@ -22,7 +22,7 @@ import { isNullOrUndefined, detach, Event, Complex, addClass, removeClass, close
22
22
  import { FieldSettings } from '../drop-down-base/drop-down-base';
23
23
  import { DropDownBase, dropDownBaseClasses } from '../drop-down-base/drop-down-base';
24
24
  import { DataManager, Query } from '@syncfusion/ej2-data';
25
- import { Popup, isCollide, createSpinner, showSpinner, hideSpinner } from '@syncfusion/ej2-popups';
25
+ import { Popup, isCollide, createSpinner, showSpinner, hideSpinner, getZindexPartial } from '@syncfusion/ej2-popups';
26
26
  import { highlightSearch, revertHighlightSearch } from '../common/highlight-search';
27
27
  /**
28
28
  * The Mention component is used to list someone or something based on user input in textarea, input,
@@ -99,6 +99,7 @@ var Mention = /** @class */ (function (_super) {
99
99
  this.isFiltered = false;
100
100
  this.beforePopupOpen = false;
101
101
  this.initRemoteRender = false;
102
+ this.isListResetted = false;
102
103
  this.isPopupOpen = false;
103
104
  this.isCollided = false;
104
105
  this.lineBreak = false;
@@ -165,6 +166,7 @@ var Mention = /** @class */ (function (_super) {
165
166
  /**
166
167
  * Hides the spinner loader.
167
168
  *
169
+ * @private
168
170
  * @returns {void}
169
171
  */
170
172
  Mention.prototype.hideSpinner = function () {
@@ -220,6 +222,7 @@ var Mention = /** @class */ (function (_super) {
220
222
  break;
221
223
  case 'tab':
222
224
  if (this.isPopupOpen) {
225
+ e.preventDefault();
223
226
  var li = this.list.querySelector('.' + dropDownBaseClasses.selected);
224
227
  if (li) {
225
228
  this.setSelection(li, e);
@@ -259,7 +262,8 @@ var Mention = /** @class */ (function (_super) {
259
262
  var startIndex = 0;
260
263
  startIndex = e.action === 'down' && isNullOrUndefined(this.activeIndex) ? 0 : this.liCollections.length - 1;
261
264
  index = index < 0 ? this.liCollections.length - 1 : index === this.liCollections.length ? 0 : index;
262
- var nextItem = isNullOrUndefined(this.activeIndex) ? this.liCollections[startIndex] : this.liCollections[index];
265
+ var nextItem = isNullOrUndefined(this.activeIndex) ?
266
+ this.liCollections[startIndex] : this.liCollections[index];
263
267
  if (!isNullOrUndefined(nextItem)) {
264
268
  this.setSelection(nextItem, e);
265
269
  }
@@ -284,9 +288,14 @@ var Mention = /** @class */ (function (_super) {
284
288
  }
285
289
  var currentRange = this.getTextRange();
286
290
  var lastWordRange = this.getLastLetter(currentRange);
291
+ // eslint-disable-next-line security/detect-non-literal-regexp
287
292
  var Regex = new RegExp(this.mentionChar, 'g');
288
293
  var charRegex = new RegExp('[a-zA-Z]', 'g');
289
294
  if (e.key === 'Shift' || e.keyCode === 37 || e.keyCode === 39) {
295
+ if ((e.keyCode === 37 || e.keyCode === 39) && !isNullOrUndefined(currentRange) &&
296
+ currentRange.indexOf(this.mentionChar) === -1 && this.isPopupOpen) {
297
+ this.hidePopup();
298
+ }
290
299
  return;
291
300
  }
292
301
  if ((!currentRange || !lastWordRange) || e.code === 'Enter' || e.keyCode === 27 ||
@@ -315,7 +324,7 @@ var Mention = /** @class */ (function (_super) {
315
324
  if (!this.isContentEditable(this.inputElement)) {
316
325
  this.showPopup();
317
326
  }
318
- else if (this.isContentEditable(this.inputElement) && this.range && this.range.startContainer !== this.inputElement) {
327
+ else if (this.isContentEditable(this.inputElement) && this.range && this.range.startContainer !== this.inputElement && e.keyCode !== 9) {
319
328
  this.showPopup();
320
329
  }
321
330
  }
@@ -344,8 +353,12 @@ var Mention = /** @class */ (function (_super) {
344
353
  this.searchLists(e);
345
354
  }
346
355
  else if (this.queryString === '' && this.isPopupOpen && e.keyCode !== 38 && e.keyCode !== 40) {
347
- this.resetList(this.dataSource, this.fields);
356
+ this.searchLists(e);
357
+ if (!this.isListResetted) {
358
+ this.resetList(this.dataSource, this.fields);
359
+ }
348
360
  }
361
+ this.isListResetted = false;
349
362
  };
350
363
  Mention.prototype.isMatchedText = function () {
351
364
  var isMatched = false;
@@ -379,7 +392,7 @@ var Mention = /** @class */ (function (_super) {
379
392
  this.activeIndex = null;
380
393
  var eventArgs = {
381
394
  preventDefaultAction: false,
382
- text: this.elementValue(),
395
+ text: this.queryString,
383
396
  updateData: function (dataSource, query, fields) {
384
397
  if (eventArgs.cancel) {
385
398
  return;
@@ -397,8 +410,9 @@ var Mention = /** @class */ (function (_super) {
397
410
  };
398
411
  Mention.prototype.filterAction = function (dataSource, query, fields) {
399
412
  this.beforePopupOpen = true;
400
- if (this.queryString !== '' && (this.queryString.length >= this.minLength)) {
413
+ if (this.queryString.length >= this.minLength) {
401
414
  this.resetList(dataSource, fields, query);
415
+ this.isListResetted = true;
402
416
  }
403
417
  else {
404
418
  if (this.isPopupOpen) {
@@ -520,12 +534,14 @@ var Mention = /** @class */ (function (_super) {
520
534
  }
521
535
  }
522
536
  else {
523
- var selectedElem = this.range.startContainer;
524
- if (!isNullOrUndefined(selectedElem)) {
525
- var workingNodeContent = selectedElem.textContent;
526
- var selectStartOffset = this.range.startOffset;
527
- if (workingNodeContent && selectStartOffset >= 0) {
528
- text = workingNodeContent.substring(0, selectStartOffset);
537
+ if (this.range) {
538
+ var selectedElem = this.range.startContainer;
539
+ if (!isNullOrUndefined(selectedElem)) {
540
+ var workingNodeContent = selectedElem.textContent;
541
+ var selectStartOffset = this.range.startOffset;
542
+ if (workingNodeContent && selectStartOffset >= 0) {
543
+ text = workingNodeContent.substring(0, selectStartOffset);
544
+ }
529
545
  }
530
546
  }
531
547
  }
@@ -549,6 +565,10 @@ var Mention = /** @class */ (function (_super) {
549
565
  * @returns {void}
550
566
  */
551
567
  Mention.prototype.showPopup = function () {
568
+ this.beforePopupOpen = true;
569
+ if (isNullOrUndefined(this.list)) {
570
+ this.initValue();
571
+ }
552
572
  this.renderPopup();
553
573
  attributes(this.inputElement, { 'aria-activedescendant': this.selectedElementID });
554
574
  if (this.selectedElementID == null) {
@@ -614,18 +634,13 @@ var Mention = /** @class */ (function (_super) {
614
634
  }
615
635
  }
616
636
  append([_this.list], popupEle_1);
617
- if ((!_this.popupObj || !document.body.contains(_this.popupObj.element)) || !document.contains(popupEle_1) && isNullOrUndefined(_this.target)) {
637
+ if ((!_this.popupObj || !document.body.contains(_this.popupObj.element)) ||
638
+ !document.contains(popupEle_1) && isNullOrUndefined(_this.target)) {
618
639
  document.body.appendChild(popupEle_1);
619
640
  }
620
641
  var coordinates_1;
621
642
  popupEle_1.style.visibility = 'hidden';
622
- if (_this.popupHeight !== 'auto') {
623
- _this.list.style.maxHeight = (parseInt(_this.listHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
624
- popupEle_1.style.maxHeight = formatUnit(_this.popupHeight);
625
- }
626
- else {
627
- popupEle_1.style.height = 'auto';
628
- }
643
+ _this.setHeight(popupEle_1);
629
644
  var offsetValue = 0;
630
645
  var left = 0;
631
646
  _this.initializePopup(popupEle_1, offsetValue, left);
@@ -648,6 +663,9 @@ var Mention = /** @class */ (function (_super) {
648
663
  if (!eventArgs.cancel) {
649
664
  _this.renderReactTemplates();
650
665
  _this.popupObj.show(new Animation(eventArgs.animation), (_this.zIndex === 1000) ? _this.inputElement : null);
666
+ if (isNullOrUndefined(_this.getTriggerCharPosition())) {
667
+ return;
668
+ }
651
669
  coordinates_1 = _this.getCoordinates(_this.inputElement, _this.getTriggerCharPosition());
652
670
  if (!_this.isCollided) {
653
671
  popupEle_1.style.cssText = 'top: '.concat(coordinates_1.top.toString(), 'px;\n left: ').concat(coordinates_1.left.toString(), 'px;\nposition: absolute;\n display: block;');
@@ -657,6 +675,8 @@ var Mention = /** @class */ (function (_super) {
657
675
  _this.isCollided = false;
658
676
  }
659
677
  popupEle_1.style.width = _this.popupWidth !== '100%' && !isNullOrUndefined(_this.popupWidth) ? formatUnit(_this.popupWidth) : 'auto';
678
+ _this.setHeight(popupEle_1);
679
+ popupEle_1.style.zIndex = _this.zIndex === 1000 ? getZindexPartial(popupEle_1).toString() : _this.zIndex.toString();
660
680
  }
661
681
  else {
662
682
  _this.beforePopupOpen = false;
@@ -669,6 +689,15 @@ var Mention = /** @class */ (function (_super) {
669
689
  }
670
690
  });
671
691
  };
692
+ Mention.prototype.setHeight = function (popupEle) {
693
+ if (this.popupHeight !== 'auto') {
694
+ this.list.style.maxHeight = (parseInt(this.listHeight, 10) - 2).toString() + 'px'; // due to box-sizing property
695
+ popupEle.style.maxHeight = formatUnit(this.popupHeight);
696
+ }
697
+ else {
698
+ popupEle.style.height = 'auto';
699
+ }
700
+ };
672
701
  Mention.prototype.checkCollision = function (popupEle) {
673
702
  if (!Browser.isDevice || (Browser.isDevice && !(this.getModuleName() === 'mention'))) {
674
703
  var collision = isCollide(popupEle);
@@ -749,7 +778,9 @@ var Mention = /** @class */ (function (_super) {
749
778
  computed = getComputedStyle(element);
750
779
  div.style.position = 'absolute';
751
780
  div.style.visibility = 'hidden';
781
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
752
782
  properties.forEach(function (prop) {
783
+ // eslint-disable-next-line security/detect-object-injection
753
784
  div.style[prop] = computed[prop];
754
785
  });
755
786
  div.textContent = element.value.substring(0, position);
@@ -783,13 +814,12 @@ var Mention = /** @class */ (function (_super) {
783
814
  }
784
815
  else {
785
816
  coordinates = {
786
- top: rect.top + windowTop + parseInt(getComputedStyle(this.inputElement).fontSize),
817
+ top: rect.top + windowTop + parseInt(getComputedStyle(this.inputElement).fontSize, 10),
787
818
  left: rect.left + windowLeft
788
819
  };
789
820
  }
790
821
  return coordinates;
791
822
  };
792
- ;
793
823
  Mention.prototype.initValue = function () {
794
824
  this.renderList();
795
825
  if (this.dataSource instanceof DataManager) {
@@ -985,8 +1015,8 @@ var Mention = /** @class */ (function (_super) {
985
1015
  }
986
1016
  return items;
987
1017
  };
988
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
989
1018
  Mention.prototype.setValue = function (e) {
1019
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
990
1020
  if (!this.isReact) {
991
1021
  if (!isNullOrUndefined(this.displayTemplate)) {
992
1022
  this.setDisplayTemplate();
@@ -1014,7 +1044,7 @@ var Mention = /** @class */ (function (_super) {
1014
1044
  var selection = this.inputElement.ownerDocument.getSelection();
1015
1045
  var startPos = this.getTriggerCharPosition();
1016
1046
  textSuffix = typeof this.suffixText === 'string' ? this.suffixText : '';
1017
- if (dataItem.value !== null) {
1047
+ if (dataItem.text !== null) {
1018
1048
  value = this.mentionVal(dataItem.text);
1019
1049
  }
1020
1050
  if (!this.isContentEditable(this.inputElement)) {
@@ -1046,6 +1076,7 @@ var Mention = /** @class */ (function (_super) {
1046
1076
  var frag = document.createDocumentFragment();
1047
1077
  var node = void 0;
1048
1078
  var lastNode = void 0;
1079
+ // eslint-disable-next-line no-cond-assign
1049
1080
  while (node = element.firstChild) {
1050
1081
  lastNode = frag.appendChild(node);
1051
1082
  }
@@ -1101,6 +1132,7 @@ var Mention = /** @class */ (function (_super) {
1101
1132
  this.displayTempElement.appendChild(displayCompTemp[i]);
1102
1133
  }
1103
1134
  }
1135
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1104
1136
  if (!this.isReact) {
1105
1137
  this.renderTemplates();
1106
1138
  }
@@ -1110,6 +1142,7 @@ var Mention = /** @class */ (function (_super) {
1110
1142
  });
1111
1143
  }
1112
1144
  };
1145
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1113
1146
  Mention.prototype.renderTemplates = function (callBack) {
1114
1147
  this.renderReactTemplates(callBack);
1115
1148
  };
@@ -1139,6 +1172,7 @@ var Mention = /** @class */ (function (_super) {
1139
1172
  this.spinnerTemplateElement.appendChild(spinnerCompTemp[i]);
1140
1173
  }
1141
1174
  }
1175
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1142
1176
  if (!this.isReact) {
1143
1177
  this.renderTemplates();
1144
1178
  this.popupObj.element.appendChild(this.spinnerTemplateElement);
@@ -1233,7 +1267,7 @@ var Mention = /** @class */ (function (_super) {
1233
1267
  this.setHover(currentLi);
1234
1268
  };
1235
1269
  Mention.prototype.setHover = function (li) {
1236
- if (this.enabled && this.isValidLI(li) && !li.classList.contains(dropDownBaseClasses.hover)) {
1270
+ if (this.isValidLI(li) && !li.classList.contains(dropDownBaseClasses.hover)) {
1237
1271
  this.removeHover();
1238
1272
  addClass([li], dropDownBaseClasses.hover);
1239
1273
  }
@@ -1258,8 +1292,13 @@ var Mention = /** @class */ (function (_super) {
1258
1292
  * @returns {void}
1259
1293
  */
1260
1294
  Mention.prototype.search = function (text, positionX, positionY) {
1261
- if ((this.ignoreCase && (text === this.elementValue() || text === this.elementValue().toLowerCase()))
1262
- || !this.ignoreCase && text === this.elementValue()) {
1295
+ if (this.isContentEditable(this.inputElement)) {
1296
+ this.range = this.getCurrentRange();
1297
+ }
1298
+ var currentRange = this.getTextRange();
1299
+ var lastWordRange = this.getLastLetter(currentRange);
1300
+ if ((this.ignoreCase && (text === lastWordRange || text === lastWordRange.toLowerCase()))
1301
+ || !this.ignoreCase && text === lastWordRange) {
1263
1302
  this.resetList(this.dataSource, this.fields);
1264
1303
  }
1265
1304
  else {
@@ -164,6 +164,12 @@ var CheckBoxSelection = /** @class */ (function () {
164
164
  CheckBoxSelection.prototype.destroy = function () {
165
165
  this.removeEventListener();
166
166
  EventHandler.remove(document, 'mousedown', this.onDocumentClick);
167
+ this.checkAllParent = null;
168
+ this.clearIconElement = null;
169
+ this.filterInput = null;
170
+ this.filterInputObj = null;
171
+ this.checkWrapper = null;
172
+ this.selectAllSpan = null;
167
173
  };
168
174
  CheckBoxSelection.prototype.listSelection = function (args) {
169
175
  var target;
@@ -240,10 +246,6 @@ var CheckBoxSelection = /** @class */ (function () {
240
246
  this.setLocale();
241
247
  }
242
248
  }
243
- ariaState = state === 'check' ? 'true' : state === 'uncheck' ? 'false' : ariaState;
244
- if (!isNullOrUndefined(ariaState)) {
245
- wrapper.setAttribute('aria-checked', ariaState);
246
- }
247
249
  };
248
250
  CheckBoxSelection.prototype.setSearchBox = function (args) {
249
251
  if (isNullOrUndefined(this.parent.filterParent)) {
@@ -404,8 +406,8 @@ var CheckBoxSelection = /** @class */ (function () {
404
406
  e.preventDefault();
405
407
  }
406
408
  }
407
- if (!(!isNullOrUndefined(this.parent.popupObj) && closest(target, '[id="' + this.parent.popupObj.element.id + '"]')) &&
408
- !this.parent.overAllWrapper.contains(e.target)) {
409
+ if (!(!isNullOrUndefined(this.parent.popupObj) && closest(target, '[id="' + this.parent.popupObj.element.id + '"]'))
410
+ && !isNullOrUndefined(this.parent.overAllWrapper) && !this.parent.overAllWrapper.contains(e.target)) {
409
411
  if (this.parent.overAllWrapper.classList.contains(dropDownBaseClasses.focus) || this.parent.isPopupOpen()) {
410
412
  this.parent.inputFocus = false;
411
413
  this.parent.scrollFocusStatus = false;
@@ -418,7 +420,7 @@ var CheckBoxSelection = /** @class */ (function () {
418
420
  this.parent.scrollFocusStatus = (Browser.isIE || Browser.info.name === 'edge') &&
419
421
  (document.activeElement === this.filterInput);
420
422
  }
421
- if (!this.parent.overAllWrapper.contains(e.target) && this.parent.overAllWrapper.classList.contains('e-input-focus') &&
423
+ if (!isNullOrUndefined(this.parent.overAllWrapper) && !this.parent.overAllWrapper.contains(e.target) && this.parent.overAllWrapper.classList.contains('e-input-focus') &&
422
424
  !this.parent.isPopupOpen()) {
423
425
  if (Browser.isIE) {
424
426
  this.parent.onBlurHandler();
@@ -449,7 +451,7 @@ var CheckBoxSelection = /** @class */ (function () {
449
451
  }
450
452
  };
451
453
  CheckBoxSelection.prototype.checkSelectAll = function (e) {
452
- if (e.value === 'check' && this.checkAllParent.getAttribute('aria-checked') !== 'true') {
454
+ if (e.value === 'check') {
453
455
  this.changeState(this.checkAllParent, e.value, null, null, false);
454
456
  this.setLocale(true);
455
457
  }