@syncfusion/ej2-lists 20.4.48 → 20.4.50

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.
@@ -2348,7 +2348,7 @@ let ListView = class ListView extends Component {
2348
2348
  if (this.enableVirtualization) {
2349
2349
  if (Object.keys(this.dataSource).length) {
2350
2350
  if ((this.template || this.groupTemplate) && !this.virtualizationModule.isNgTemplate()) {
2351
- if (this.isReact) {
2351
+ if (this.isReact || this.isVue) {
2352
2352
  if (typeof this.template == "string") {
2353
2353
  this.listBaseOption.template = null;
2354
2354
  }
@@ -3086,6 +3086,14 @@ class Virtualization {
3086
3086
  isNgTemplate() {
3087
3087
  return !isNullOrUndefined(this.listViewInstance.templateRef) && typeof this.listViewInstance.templateRef !== 'string';
3088
3088
  }
3089
+ /**
3090
+ * Checks if the platform is a Vue and its template property is a function type.
3091
+ *
3092
+ * @returns {boolean} indicating the result of the check
3093
+ */
3094
+ isVueFunctionTemplate() {
3095
+ return this.listViewInstance.isVue && typeof this.listViewInstance.template === 'function';
3096
+ }
3089
3097
  /**
3090
3098
  * For internal use only.
3091
3099
  *
@@ -3871,10 +3879,14 @@ class Virtualization {
3871
3879
  this.listViewInstance.template = div.innerHTML;
3872
3880
  }
3873
3881
  }
3882
+ if (this.isVueFunctionTemplate())
3883
+ return;
3874
3884
  template.innerHTML = this.listViewInstance.template;
3875
3885
  this.listViewInstance.template = virtualTemplate;
3876
3886
  }
3877
3887
  else {
3888
+ if (this.isVueFunctionTemplate())
3889
+ return;
3878
3890
  template.innerHTML = this.listViewInstance.template || commonTemplate;
3879
3891
  }
3880
3892
  // eslint-disable-next-line
@@ -4145,7 +4157,7 @@ class Virtualization {
4145
4157
  }
4146
4158
  updateUI(element, index, targetElement) {
4147
4159
  // eslint-disable-next-line @typescript-eslint/ban-types
4148
- const onChange = this.isNgTemplate() ? this.onNgChange : this.onChange;
4160
+ const onChange = this.isNgTemplate() ? this.onNgChange : (this.isVueFunctionTemplate()) ? this.onVuechange : this.onChange;
4149
4161
  if (this.listViewInstance.template || this.listViewInstance.groupTemplate) {
4150
4162
  const curViewDS = this.listViewInstance.curViewDS[index];
4151
4163
  // eslint-disable-next-line
@@ -4162,6 +4174,22 @@ class Virtualization {
4162
4174
  this.listViewInstance.ulElement.insertBefore(element, targetElement);
4163
4175
  }
4164
4176
  }
4177
+ /**
4178
+ * Handles the UI change in vue for the list view.
4179
+ *
4180
+ * @param {DataSource} newData - The new data source for the list view.
4181
+ * @param {ElementContext} listElement - The HTML element context for the list view.
4182
+ * @param {Virtualization} virtualThis - The virtualization context for the list view.
4183
+ */
4184
+ onVuechange(newData, listElement, virtualThis) {
4185
+ let liItem = ListBase.createListItemFromJson(virtualThis.listViewInstance.createElement,
4186
+ // eslint-disable-next-line
4187
+ [newData], virtualThis.listViewInstance.listBaseOption, null, null, virtualThis.listViewInstance);
4188
+ while (listElement.lastChild) {
4189
+ listElement.removeChild(listElement.lastChild);
4190
+ }
4191
+ listElement.appendChild(liItem[0].firstChild);
4192
+ }
4165
4193
  onNgChange(newData, listElement, virtualThis) {
4166
4194
  // compile given target element with template for new data
4167
4195
  // eslint-disable-next-line
@@ -4399,7 +4427,7 @@ let Sortable = Sortable_1 = class Sortable extends Base {
4399
4427
  this.target = null;
4400
4428
  this.curTarget = null;
4401
4429
  remove(e.helper);
4402
- getComponent(this.element, Draggable).intDestroy(e.event);
4430
+ getComponent(this.element, 'draggable').intDestroy(e.event);
4403
4431
  };
4404
4432
  this.bind();
4405
4433
  }