@syncfusion/ej2-lists 24.2.4 → 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.
@@ -301,7 +301,7 @@ var ListBase;
301
301
  if (fieldData.hasOwnProperty(fields.htmlAttributes) && fieldData[fields.htmlAttributes]) {
302
302
  var htmlAttributes = fieldData[fields.htmlAttributes];
303
303
  // Check if 'class' attribute is present and not an empty string
304
- if (htmlAttributes.hasOwnProperty('class') && typeof htmlAttributes['class'] === 'string' && htmlAttributes['class'].trim() === '') {
304
+ if ('class' in htmlAttributes && typeof htmlAttributes['class'] === 'string' && htmlAttributes['class'].trim() === '') {
305
305
  delete htmlAttributes['class'];
306
306
  }
307
307
  setAttribute(li, htmlAttributes);
@@ -1988,11 +1988,13 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
1988
1988
  }
1989
1989
  };
1990
1990
  ListView.prototype.unWireEvents = function () {
1991
+ EventHandler.remove(this.element, 'keydown', this.keyActionHandler);
1991
1992
  EventHandler.remove(this.element, 'click', this.clickHandler);
1992
1993
  EventHandler.remove(this.element, 'mouseover', this.hoverHandler);
1993
1994
  EventHandler.remove(this.element, 'mouseout', this.leaveHandler);
1994
1995
  EventHandler.remove(this.element, 'mouseover', this.hoverHandler);
1995
1996
  EventHandler.remove(this.element, 'mouseout', this.leaveHandler);
1997
+ EventHandler.remove(this.element, 'focusout', this.focusout);
1996
1998
  if (!isNullOrUndefined(this.scroll)) {
1997
1999
  EventHandler.remove(this.element, 'scroll', this.onListScroll);
1998
2000
  }
@@ -2088,7 +2090,12 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
2088
2090
  var eventArgs = {};
2089
2091
  merge(eventArgs, selectedItem);
2090
2092
  if (e) {
2091
- merge(eventArgs, { isInteracted: true, event: e, cancel: false, index: this.curUL && Array.prototype.indexOf.call(this.curUL.children, li) });
2093
+ merge(eventArgs, {
2094
+ isInteracted: true,
2095
+ event: e,
2096
+ cancel: false,
2097
+ index: this.curUL && Array.prototype.indexOf.call(this.curUL.children, li)
2098
+ });
2092
2099
  }
2093
2100
  return eventArgs;
2094
2101
  };
@@ -2524,6 +2531,22 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
2524
2531
  }
2525
2532
  }
2526
2533
  };
2534
+ /**
2535
+ * This method allows for deselecting a list item within the ListView. The item to be deselected can be specified by passing the element or field object.
2536
+ *
2537
+ * @param {Fields | HTMLElement | Element} item - We can pass an element Object or Fields as an Object with ID and Text fields.
2538
+ */
2539
+ ListView.prototype.unselectItem = function (item) {
2540
+ if (isNullOrUndefined(item)) {
2541
+ this.removeSelect();
2542
+ }
2543
+ else {
2544
+ var li = this.getLiFromObjOrElement(item);
2545
+ if (!isNullOrUndefined(li)) {
2546
+ this.removeSelect(li);
2547
+ }
2548
+ }
2549
+ };
2527
2550
  ListView.prototype.getLiFromObjOrElement = function (obj) {
2528
2551
  var li;
2529
2552
  var dataSource = this.dataSource instanceof DataManager ?
@@ -3019,7 +3042,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
3019
3042
  ListView.prototype.requiredModules = function () {
3020
3043
  var modules = [];
3021
3044
  if (this.enableVirtualization) {
3022
- modules.push({ args: [this], member: 'virtualization' });
3045
+ modules.push({ args: [this], member: 'virtualization', name: 'Virtualization' });
3023
3046
  }
3024
3047
  return modules;
3025
3048
  };
@@ -3089,7 +3112,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
3089
3112
  Property(false)
3090
3113
  ], ListView.prototype, "showHeader", void 0);
3091
3114
  __decorate([
3092
- Property(false)
3115
+ Property(true)
3093
3116
  ], ListView.prototype, "enableHtmlSanitizer", void 0);
3094
3117
  __decorate([
3095
3118
  Property('')
@@ -3383,9 +3406,10 @@ var Virtualization = /** @__PURE__ @class */ (function () {
3383
3406
  }
3384
3407
  if (this.listViewInstance.curViewDS[index][this.listViewInstance.fields.iconCss]) {
3385
3408
  var textContent = element.querySelector('.' + classNames.textContent);
3409
+ var curViewDS = this.listViewInstance.curViewDS[index];
3410
+ var iconCss = curViewDS[this.listViewInstance.fields.iconCss].toString();
3386
3411
  var target = this.listViewInstance.createElement('div', {
3387
- className: classNames.listIcon + ' ' +
3388
- this.listViewInstance.curViewDS[index][this.listViewInstance.fields.iconCss]
3412
+ className: classNames.listIcon + ' ' + iconCss
3389
3413
  });
3390
3414
  textContent.insertBefore(target, element.querySelector('.' + classNames.listItemText));
3391
3415
  }
@@ -3902,7 +3926,9 @@ var Virtualization = /** @__PURE__ @class */ (function () {
3902
3926
  target = this.listViewInstance.getLiFromObjOrElement(this.listViewInstance.curViewDS[index + 1]) ||
3903
3927
  this.listViewInstance.getLiFromObjOrElement(this.listViewInstance.curViewDS[index + 2]);
3904
3928
  }
3905
- if (this.listViewInstance.fields.groupBy && this.listViewInstance.curViewDS[index + 1] && this.listViewInstance.curViewDS[index + 1].isHeader) {
3929
+ if (this.listViewInstance.fields.groupBy
3930
+ && this.listViewInstance.curViewDS[index + 1]
3931
+ && this.listViewInstance.curViewDS[index + 1].isHeader) {
3906
3932
  var targetEle = this.listViewInstance.getLiFromObjOrElement(this.listViewInstance.curViewDS[index - 1]);
3907
3933
  if (targetEle) {
3908
3934
  target = targetEle.nextElementSibling;
@@ -3999,6 +4025,7 @@ var Virtualization = /** @__PURE__ @class */ (function () {
3999
4025
  * @param {DataSource} newData - The new data source for the list view.
4000
4026
  * @param {ElementContext} listElement - The HTML element context for the list view.
4001
4027
  * @param {Virtualization} virtualThis - The virtualization context for the list view.
4028
+ * @returns {void}
4002
4029
  */
4003
4030
  Virtualization.prototype.onChange = function (newData, listElement, virtualThis) {
4004
4031
  var liItem = ListBase.createListItemFromJson(virtualThis.listViewInstance.createElement,
@@ -4108,7 +4135,7 @@ var Sortable = /** @__PURE__ @class */ (function (_super) {
4108
4135
  _this.trigger('drag', { event: e.event, element: _this.element, target: e.target });
4109
4136
  var newInst = _this.getSortableInstance(e.target);
4110
4137
  var target = _this.getSortableElement(e.target, newInst);
4111
- if ((_this.isValidTarget(target, newInst) || e.target.className.indexOf('e-list-group-item') > -1) && (_this.curTarget !== target ||
4138
+ if ((_this.isValidTarget(target, newInst) || (e.target && typeof e.target.className === 'string' && e.target.className.indexOf('e-list-group-item') > -1)) && (_this.curTarget !== target ||
4112
4139
  !isNullOrUndefined(newInst.placeHolder)) && (newInst.placeHolderElement ? newInst.placeHolderElement !== e.target : true)) {
4113
4140
  if (e.target.classList.contains('e-list-group-item')) {
4114
4141
  target = e.target;
@@ -4249,7 +4276,7 @@ var Sortable = /** @__PURE__ @class */ (function (_super) {
4249
4276
  target: e.target, droppedElement: _this.target, helper: e.helper, cancel: false
4250
4277
  };
4251
4278
  _this.trigger('beforeDrop', beforeDropArgs, function (observedArgs) {
4252
- if ((dropInst.element === e.target || e.target.className.indexOf('e-list-nrt') > -1 || e.target.className.indexOf('e-list-nr-template') > -1
4279
+ if ((dropInst.element === e.target || (typeof e.target.className === 'string' && e.target.className.indexOf('e-list-nrt') > -1) || (typeof e.target.className === 'string' && e.target.className.indexOf('e-list-nr-template') > -1)
4253
4280
  || e.target.closest('.e-list-nr-template')) && !observedArgs.cancel) {
4254
4281
  _this.updateItemClass(dropInst);
4255
4282
  dropInst.element.appendChild(_this.target);