@syncfusion/ej2-lists 23.1.42 → 23.2.4
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 +10 -0
- package/dist/ej2-lists.min.js +2 -2
- package/dist/ej2-lists.umd.min.js +2 -2
- package/dist/ej2-lists.umd.min.js.map +1 -1
- package/dist/es6/ej2-lists.es2015.js +77 -196
- package/dist/es6/ej2-lists.es2015.js.map +1 -1
- package/dist/es6/ej2-lists.es5.js +86 -206
- package/dist/es6/ej2-lists.es5.js.map +1 -1
- package/dist/global/ej2-lists.min.js +2 -2
- package/dist/global/ej2-lists.min.js.map +1 -1
- package/dist/global/index.d.ts +1 -1
- package/package.json +8 -8
- package/src/common/list-base.js +2 -1
- package/src/list-view/list-view.d.ts +3 -1
- package/src/list-view/list-view.js +16 -5
- package/src/list-view/virtualization.d.ts +2 -9
- package/src/list-view/virtualization.js +68 -200
- package/dist/ts/common/list-base.ts +0 -1286
- package/dist/ts/component.ts +0 -4
- package/dist/ts/list-view/list-view.ts +0 -2653
- package/dist/ts/list-view/virtualization.ts +0 -1187
- package/dist/ts/sortable/sortable.ts +0 -485
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Animation, Base, ChildProperty, Complex, Component, Draggable, Event, EventHandler, NotifyPropertyChanges, Property, SanitizeHtmlHelper, Touch, addClass, animationMode, append, attributes, closest, compareElementParent, compile, detach, extend, formatUnit, getComponent, getUniqueID, getValue, isBlazor, isNullOrUndefined, isVisible, merge, prepend, remove, removeClass, rippleEffect } from '@syncfusion/ej2-base';
|
|
1
|
+
import { Animation, Base, ChildProperty, Complex, Component, Draggable, Event, EventHandler, NotifyPropertyChanges, Property, SanitizeHtmlHelper, Touch, addClass, animationMode, append, attributes, closest, compareElementParent, compile, detach, extend, formatUnit, getComponent, getUniqueID, getValue, isBlazor, isNullOrUndefined, isVisible, merge, prepend, remove, removeClass, rippleEffect, select } from '@syncfusion/ej2-base';
|
|
2
2
|
import { DataManager, Query } from '@syncfusion/ej2-data';
|
|
3
3
|
import { createCheckBox } from '@syncfusion/ej2-buttons';
|
|
4
4
|
|
|
@@ -286,7 +286,8 @@ var ListBase;
|
|
|
286
286
|
anchorElement = li.querySelector('.' + cssClass.anchorWrap);
|
|
287
287
|
// eslint-disable-next-line no-prototype-builtins
|
|
288
288
|
if (fieldData.hasOwnProperty(fields.tooltip)) {
|
|
289
|
-
|
|
289
|
+
var tooltipText = SanitizeHtmlHelper.sanitize(fieldData[fields.tooltip]);
|
|
290
|
+
li.setAttribute('title', tooltipText);
|
|
290
291
|
}
|
|
291
292
|
// eslint-disable-next-line no-prototype-builtins
|
|
292
293
|
if (fieldData.hasOwnProperty(fields.htmlAttributes) && fieldData[fields.htmlAttributes]) {
|
|
@@ -2794,17 +2795,18 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2794
2795
|
*
|
|
2795
2796
|
* @param {Fields} fields - Target item to add the given data as its children (can be null).
|
|
2796
2797
|
*
|
|
2798
|
+
* @param {number} index - Indicates the index where the data to be added.
|
|
2797
2799
|
*/
|
|
2798
|
-
ListView.prototype.addItem = function (data, fields) {
|
|
2800
|
+
ListView.prototype.addItem = function (data, fields, index) {
|
|
2799
2801
|
if (fields === void 0) { fields = undefined; }
|
|
2800
2802
|
var dataSource = this.dataSource instanceof DataManager
|
|
2801
2803
|
? this.localData : this.dataSource;
|
|
2802
|
-
this.addItemInternally(data, fields, dataSource);
|
|
2804
|
+
this.addItemInternally(data, fields, dataSource, index);
|
|
2803
2805
|
};
|
|
2804
|
-
ListView.prototype.addItemInternally = function (data, fields, dataSource) {
|
|
2806
|
+
ListView.prototype.addItemInternally = function (data, fields, dataSource, index) {
|
|
2805
2807
|
if (data instanceof Array) {
|
|
2806
2808
|
if (this.enableVirtualization) {
|
|
2807
|
-
this.virtualizationModule.addItem(data, fields, dataSource);
|
|
2809
|
+
this.virtualizationModule.addItem(data, fields, dataSource, index);
|
|
2808
2810
|
}
|
|
2809
2811
|
else {
|
|
2810
2812
|
var ds = this.findItemFromDS(dataSource, fields);
|
|
@@ -2820,7 +2822,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2820
2822
|
// check for whether target is nested level or top level in list
|
|
2821
2823
|
if (ds instanceof Array) {
|
|
2822
2824
|
for (var i = 0; i < data.length; i++) {
|
|
2823
|
-
dataSource.
|
|
2825
|
+
dataSource = this.addItemAtIndex(index, dataSource, data[i]);
|
|
2824
2826
|
this.setViewDataSource(dataSource);
|
|
2825
2827
|
// since it is top level target, get the content container's first child
|
|
2826
2828
|
// as it is always the top level UL
|
|
@@ -2848,6 +2850,16 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2848
2850
|
}
|
|
2849
2851
|
}
|
|
2850
2852
|
};
|
|
2853
|
+
ListView.prototype.addItemAtIndex = function (index, newDataSource, itemData) {
|
|
2854
|
+
var isIndexValid = !(isNullOrUndefined(index)) && index >= 0 && index < newDataSource.length && isNullOrUndefined(this.listBaseOption.fields.groupBy);
|
|
2855
|
+
if (isIndexValid) {
|
|
2856
|
+
newDataSource.splice(index, 0, itemData);
|
|
2857
|
+
}
|
|
2858
|
+
else {
|
|
2859
|
+
newDataSource.push(itemData);
|
|
2860
|
+
}
|
|
2861
|
+
return newDataSource;
|
|
2862
|
+
};
|
|
2851
2863
|
ListView.prototype.addItemInNestedList = function (targetItemData, itemQueue) {
|
|
2852
2864
|
// eslint-disable-next-line
|
|
2853
2865
|
var targetItemId = targetItemData[this.fields.id];
|
|
@@ -3142,10 +3154,6 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3142
3154
|
* @private
|
|
3143
3155
|
*/
|
|
3144
3156
|
Virtualization.prototype.uiVirtualization = function () {
|
|
3145
|
-
this.commonTemplate = '<div class="e-text-content" role="presentation"> ' +
|
|
3146
|
-
'<span class="e-list-text"> ${' + this.listViewInstance.fields.text + '} </span></div>';
|
|
3147
|
-
this.templateFunction = compile(this.listViewInstance.template || this.commonTemplate, this.listViewInstance);
|
|
3148
|
-
this.groupTemplateFunction = compile(this.listViewInstance.groupTemplate || this.commonTemplate, this.listViewInstance);
|
|
3149
3157
|
this.wireScrollEvent(false);
|
|
3150
3158
|
var curViewDS = this.listViewInstance.curViewDS;
|
|
3151
3159
|
var firstDs = curViewDS.slice(0, 1);
|
|
@@ -3278,6 +3286,9 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3278
3286
|
Virtualization.prototype.onVirtualUiScroll = function (e) {
|
|
3279
3287
|
var _a;
|
|
3280
3288
|
var startingHeight;
|
|
3289
|
+
var curViewDS = this.listViewInstance.curViewDS;
|
|
3290
|
+
this.listItemHeight = select(".e-list-item", this.listViewInstance.element).getBoundingClientRect().height;
|
|
3291
|
+
this.totalHeight = (Object.keys(curViewDS).length * this.listItemHeight) - (this.domItemCount * this.listItemHeight);
|
|
3281
3292
|
if (this.listViewInstance.isWindow) {
|
|
3282
3293
|
startingHeight = this.listViewInstance.ulElement.getBoundingClientRect().top -
|
|
3283
3294
|
document.documentElement.getBoundingClientRect().top;
|
|
@@ -3393,7 +3404,13 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3393
3404
|
if (!element.querySelector('.' + classNames.checkboxWrapper)) {
|
|
3394
3405
|
element.classList.add(classNames.checklist);
|
|
3395
3406
|
textContent.classList.add(classNames.checkbox);
|
|
3396
|
-
|
|
3407
|
+
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
3408
|
+
textContent.classList.add('e-checkbox-left');
|
|
3409
|
+
}
|
|
3410
|
+
else {
|
|
3411
|
+
textContent.classList.add('e-checkbox-right');
|
|
3412
|
+
}
|
|
3413
|
+
textContent.append(this.checkListWrapper.cloneNode(true));
|
|
3397
3414
|
}
|
|
3398
3415
|
}
|
|
3399
3416
|
}
|
|
@@ -3817,11 +3834,11 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3817
3834
|
});
|
|
3818
3835
|
}
|
|
3819
3836
|
};
|
|
3820
|
-
Virtualization.prototype.addItem = function (data, fields, dataSource) {
|
|
3837
|
+
Virtualization.prototype.addItem = function (data, fields, dataSource, index) {
|
|
3821
3838
|
for (var i = 0; i < data.length; i++) {
|
|
3822
3839
|
var currentItem = data[i];
|
|
3823
3840
|
// push the given data to main data array
|
|
3824
|
-
dataSource.
|
|
3841
|
+
dataSource = this.listViewInstance.addItemAtIndex(index, dataSource, currentItem);
|
|
3825
3842
|
// recalculate all the group data or other datasource related things
|
|
3826
3843
|
this.listViewInstance.setViewDataSource(dataSource);
|
|
3827
3844
|
// render list items for first time due to no datasource present earlier
|
|
@@ -3839,16 +3856,16 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3839
3856
|
var ds = this.listViewInstance.findItemFromDS(dataSource, fields);
|
|
3840
3857
|
if (ds instanceof Array) {
|
|
3841
3858
|
if (this.listViewInstance.ulElement) {
|
|
3842
|
-
var
|
|
3859
|
+
var index_1 = this.listViewInstance.curViewDS.indexOf(currentItem);
|
|
3843
3860
|
// inject new list item into DOM
|
|
3844
|
-
this.createAndInjectNewItem(currentItem,
|
|
3861
|
+
this.createAndInjectNewItem(currentItem, index_1);
|
|
3845
3862
|
// check for group header item
|
|
3846
|
-
var curViewDS = this.listViewInstance.curViewDS[
|
|
3863
|
+
var curViewDS = this.listViewInstance.curViewDS[index_1 - 1];
|
|
3847
3864
|
if (curViewDS && curViewDS.isHeader && curViewDS.items.length === 1) {
|
|
3848
3865
|
// target group item index in datasource
|
|
3849
|
-
--
|
|
3866
|
+
--index_1;
|
|
3850
3867
|
// inject new group header into DOM for previously created list item
|
|
3851
|
-
this.createAndInjectNewItem(curViewDS,
|
|
3868
|
+
this.createAndInjectNewItem(curViewDS, index_1);
|
|
3852
3869
|
}
|
|
3853
3870
|
}
|
|
3854
3871
|
// recollect all the list item into collection
|
|
@@ -3858,13 +3875,13 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3858
3875
|
}
|
|
3859
3876
|
else {
|
|
3860
3877
|
// eslint-disable-next-line
|
|
3861
|
-
var
|
|
3878
|
+
var index_2 = this.listViewInstance.curViewDS.indexOf(currentItem);
|
|
3862
3879
|
// virtually new add list item based on the scollbar position
|
|
3863
|
-
this.addUiItem(
|
|
3880
|
+
this.addUiItem(index_2);
|
|
3864
3881
|
// check for group header item needs to be added
|
|
3865
|
-
var curViewDS = this.listViewInstance.curViewDS[
|
|
3882
|
+
var curViewDS = this.listViewInstance.curViewDS[index_2 - 1];
|
|
3866
3883
|
if (curViewDS && curViewDS.isHeader && curViewDS.items.length === 1) {
|
|
3867
|
-
this.addUiItem(
|
|
3884
|
+
this.addUiItem(index_2 - 1);
|
|
3868
3885
|
}
|
|
3869
3886
|
}
|
|
3870
3887
|
}
|
|
@@ -3901,192 +3918,50 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3901
3918
|
this.refreshItemHeight();
|
|
3902
3919
|
};
|
|
3903
3920
|
Virtualization.prototype.createUIItem = function (args) {
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
}
|
|
3920
|
-
[].slice.call(nodes).forEach(function (ele) {
|
|
3921
|
-
div_1.appendChild(ele);
|
|
3922
|
-
});
|
|
3923
|
-
if (div_1.children && div_1.children[0]) {
|
|
3924
|
-
div_1.children[0].classList.add('e-checkbox');
|
|
3925
|
-
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
3926
|
-
div_1.children[0].classList.add('e-checkbox-left');
|
|
3927
|
-
}
|
|
3928
|
-
else {
|
|
3929
|
-
div_1.children[0].classList.add('e-checkbox-right');
|
|
3930
|
-
}
|
|
3931
|
-
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
3932
|
-
div_1.children[0].insertBefore(this.listViewInstance.virtualCheckBox, div_1.childNodes[0].children[0]);
|
|
3933
|
-
}
|
|
3934
|
-
else {
|
|
3935
|
-
div_1.children[0].appendChild(this.listViewInstance.virtualCheckBox);
|
|
3921
|
+
if (!args.item.classList.contains("e-list-group-item")) {
|
|
3922
|
+
this.templateData = args.curData.isHeader ? args.curData.items[0] :
|
|
3923
|
+
args.curData;
|
|
3924
|
+
if (this.listViewInstance.showCheckBox) {
|
|
3925
|
+
// eslint-disable-next-line
|
|
3926
|
+
this.listViewInstance.renderCheckbox(args);
|
|
3927
|
+
if ((!isNullOrUndefined(this.listViewInstance.virtualCheckBox)) &&
|
|
3928
|
+
(!isNullOrUndefined(this.listViewInstance.virtualCheckBox.outerHTML))) {
|
|
3929
|
+
var div_1 = document.createElement('div');
|
|
3930
|
+
var commonTemplate = '<div class="e-text-content" role="presentation"> ' +
|
|
3931
|
+
'<span class="e-list-text"> ${' + this.listViewInstance.fields.text + '} </span></div>';
|
|
3932
|
+
var templateFunction = compile(this.listViewInstance.template || commonTemplate, this.listViewInstance);
|
|
3933
|
+
var nodes = templateFunction(this.templateData, this.listViewInstance);
|
|
3934
|
+
if (this.listViewInstance.template && this.listViewInstance.isReact) {
|
|
3935
|
+
this.listViewInstance.renderReactTemplates();
|
|
3936
3936
|
}
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
}
|
|
3961
|
-
if (args.curData.isHeader) {
|
|
3962
|
-
this.headerData = args.curData;
|
|
3963
|
-
}
|
|
3964
|
-
var groupTemplate = this.listViewInstance.createElement('div');
|
|
3965
|
-
if (this.listViewInstance.fields.groupBy) {
|
|
3966
|
-
var nodes = this.groupTemplateFunction(this.headerData, this.listViewInstance);
|
|
3967
|
-
if (this.listViewInstance.template && this.listViewInstance.isReact) {
|
|
3968
|
-
this.listViewInstance.renderReactTemplates();
|
|
3969
|
-
}
|
|
3970
|
-
[].slice.call(nodes).forEach(function (ele) {
|
|
3971
|
-
groupTemplate.appendChild(ele);
|
|
3972
|
-
});
|
|
3973
|
-
}
|
|
3974
|
-
if ((!this.listViewInstance.isReact || (typeof this.listViewInstance.template == "string" && !args.item.classList.contains("e-list-group-item")) ||
|
|
3975
|
-
(typeof this.listViewInstance.groupTemplate == "string" && args.item.classList.contains("e-list-group-item"))) && !this.listViewInstance.isVue) {
|
|
3976
|
-
args.item.innerHTML = '';
|
|
3977
|
-
}
|
|
3978
|
-
args.item.context = { data: args.curData, nodes: { flatTemplateNodes: [], groupTemplateNodes: [] } };
|
|
3979
|
-
for (var i = 0; i < template.children.length; i++) {
|
|
3980
|
-
this.compileTemplate(template.children[i], args.item, false);
|
|
3981
|
-
}
|
|
3982
|
-
for (var i = 0; i < groupTemplate.children.length; i++) {
|
|
3983
|
-
this.compileTemplate(groupTemplate.children[i], args.item, true);
|
|
3984
|
-
}
|
|
3985
|
-
args.item.context.template = args.curData.isHeader ? template.firstElementChild :
|
|
3986
|
-
groupTemplate.firstElementChild;
|
|
3987
|
-
args.item.context.type = args.curData.isHeader ? 'flatList' : 'groupList';
|
|
3988
|
-
var element = args.curData.isHeader ? groupTemplate : template;
|
|
3989
|
-
if (element.firstElementChild && !this.listViewInstance.isReact && !this.listViewInstance.isVue) {
|
|
3990
|
-
args.item.insertBefore(element.firstElementChild, null);
|
|
3991
|
-
}
|
|
3992
|
-
};
|
|
3993
|
-
Virtualization.prototype.compileTemplate = function (element, item, isHeader) {
|
|
3994
|
-
var _this = this;
|
|
3995
|
-
var subNode = {};
|
|
3996
|
-
subNode.onChange = function (value) {
|
|
3997
|
-
var groupTemplateElements;
|
|
3998
|
-
var templateElements;
|
|
3999
|
-
if (_this.listViewInstance.isVue) {
|
|
4000
|
-
groupTemplateElements = _this.groupTemplateFunction(value);
|
|
4001
|
-
templateElements = _this.templateFunction(value);
|
|
4002
|
-
}
|
|
4003
|
-
else {
|
|
4004
|
-
groupTemplateElements = _this.groupTemplateFunction(value, _this.listViewInstance);
|
|
4005
|
-
templateElements = _this.templateFunction(value, _this.listViewInstance);
|
|
4006
|
-
}
|
|
4007
|
-
if (_this.listViewInstance.template && _this.listViewInstance.isReact) {
|
|
4008
|
-
_this.listViewInstance.renderReactTemplates();
|
|
4009
|
-
}
|
|
4010
|
-
var currentTemplate = templateElements;
|
|
4011
|
-
if (value.isHeader) {
|
|
4012
|
-
currentTemplate = groupTemplateElements;
|
|
4013
|
-
}
|
|
4014
|
-
[].slice.call(currentTemplate).forEach(function (currentElement) {
|
|
4015
|
-
var RemovableClass = element.classList.value.replace('e-checkbox', '');
|
|
4016
|
-
RemovableClass = RemovableClass.replace('e-checkbox-left', '');
|
|
4017
|
-
RemovableClass = RemovableClass.replace('e-checkbox-right', '');
|
|
4018
|
-
removeClass([element], RemovableClass.split(' ').filter(function (css) { return css; }));
|
|
4019
|
-
addClass([element], Array.from(currentElement.classList));
|
|
4020
|
-
for (var i = 0; i < element.attributes.length; i++) {
|
|
4021
|
-
if (element.attributes[i].name != 'class') {
|
|
4022
|
-
var newData = currentElement.getAttribute(element.attributes[i].name);
|
|
4023
|
-
element.setAttribute(element.attributes[i].name, newData);
|
|
3937
|
+
[].slice.call(nodes).forEach(function (ele) {
|
|
3938
|
+
div_1.appendChild(ele);
|
|
3939
|
+
});
|
|
3940
|
+
if (div_1.children && div_1.children[0]) {
|
|
3941
|
+
div_1.children[0].classList.add('e-checkbox');
|
|
3942
|
+
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
3943
|
+
div_1.children[0].classList.add('e-checkbox-left');
|
|
3944
|
+
}
|
|
3945
|
+
else {
|
|
3946
|
+
div_1.children[0].classList.add('e-checkbox-right');
|
|
3947
|
+
}
|
|
3948
|
+
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
3949
|
+
div_1.children[0].insertBefore(this.listViewInstance.virtualCheckBox, div_1.childNodes[0].children[0]);
|
|
3950
|
+
}
|
|
3951
|
+
else {
|
|
3952
|
+
div_1.children[0].appendChild(this.listViewInstance.virtualCheckBox);
|
|
3953
|
+
}
|
|
3954
|
+
while (args.item.lastChild) {
|
|
3955
|
+
args.item.removeChild(args.item.lastChild);
|
|
3956
|
+
}
|
|
3957
|
+
[].slice.call(div_1.children).forEach(function (ele) {
|
|
3958
|
+
args.item.appendChild(ele);
|
|
3959
|
+
});
|
|
4024
3960
|
}
|
|
4025
3961
|
}
|
|
4026
|
-
[].slice.call(element.children).forEach(function (ele) {
|
|
4027
|
-
if (!ele.classList.contains('e-listview-checkbox') && !(ele.classList.contains('e-checkbox-left') || ele.classList.contains('e-checkbox-right'))) {
|
|
4028
|
-
ele.remove();
|
|
4029
|
-
}
|
|
4030
|
-
});
|
|
4031
|
-
[].slice.call(currentElement.children).forEach(function (ele) {
|
|
4032
|
-
element.appendChild(ele);
|
|
4033
|
-
});
|
|
4034
|
-
});
|
|
4035
|
-
};
|
|
4036
|
-
this.updateContextData(item, subNode, isHeader);
|
|
4037
|
-
};
|
|
4038
|
-
Virtualization.prototype.onChange = function (newData, listElement) {
|
|
4039
|
-
listElement.context.data = newData;
|
|
4040
|
-
// eslint-disable-next-line max-len
|
|
4041
|
-
var groupTemplateNodes = listElement.context.nodes.groupTemplateNodes;
|
|
4042
|
-
// eslint-disable-next-line max-len
|
|
4043
|
-
var flatTemplateNodes = listElement.context.nodes.flatTemplateNodes;
|
|
4044
|
-
// eslint-disable-next-line
|
|
4045
|
-
if (!isNullOrUndefined(newData.isHeader) && newData.isHeader && listElement.context.type === 'groupList') {
|
|
4046
|
-
// eslint-disable-next-line
|
|
4047
|
-
var element = listElement.firstElementChild;
|
|
4048
|
-
detach(listElement.firstElementChild);
|
|
4049
|
-
listElement.insertBefore(listElement.context.template, null);
|
|
4050
|
-
listElement.context.template = element;
|
|
4051
|
-
listElement.context.type = 'flatList';
|
|
4052
|
-
for (var i = 0; i < groupTemplateNodes.length; i++) {
|
|
4053
|
-
// eslint-disable-next-line
|
|
4054
|
-
groupTemplateNodes[i].onChange(newData);
|
|
4055
|
-
}
|
|
4056
|
-
}
|
|
4057
|
-
else if (!newData.isHeader && listElement.context.type === 'flatList') {
|
|
4058
|
-
var element = listElement.firstElementChild;
|
|
4059
|
-
detach(listElement.firstElementChild);
|
|
4060
|
-
listElement.insertBefore(listElement.context.template, null);
|
|
4061
|
-
listElement.context.template = element;
|
|
4062
|
-
listElement.context.type = 'groupList';
|
|
4063
|
-
for (var i = 0; i < flatTemplateNodes.length; i++) {
|
|
4064
|
-
// eslint-disable-next-line
|
|
4065
|
-
flatTemplateNodes[i].onChange(newData);
|
|
4066
|
-
}
|
|
4067
|
-
}
|
|
4068
|
-
else if (!newData.isHeader) {
|
|
4069
|
-
for (var i = 0; i < flatTemplateNodes.length; i++) {
|
|
4070
|
-
// eslint-disable-next-line
|
|
4071
|
-
flatTemplateNodes[i].onChange(newData);
|
|
4072
|
-
}
|
|
4073
|
-
}
|
|
4074
|
-
else {
|
|
4075
|
-
for (var i = 0; i < groupTemplateNodes.length; i++) {
|
|
4076
|
-
// eslint-disable-next-line
|
|
4077
|
-
groupTemplateNodes[i].onChange(newData);
|
|
4078
3962
|
}
|
|
4079
3963
|
}
|
|
4080
3964
|
};
|
|
4081
|
-
// eslint-disable-next-line
|
|
4082
|
-
Virtualization.prototype.updateContextData = function (listElement, node, isHeader) {
|
|
4083
|
-
if (isHeader) {
|
|
4084
|
-
listElement.context.nodes.groupTemplateNodes.push(node);
|
|
4085
|
-
}
|
|
4086
|
-
else {
|
|
4087
|
-
listElement.context.nodes.flatTemplateNodes.push(node);
|
|
4088
|
-
}
|
|
4089
|
-
};
|
|
4090
3965
|
Virtualization.prototype.reRenderUiVirtualization = function () {
|
|
4091
3966
|
this.wireScrollEvent(true);
|
|
4092
3967
|
if (this.listViewInstance.contentContainer) {
|
|
@@ -4101,7 +3976,7 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
4101
3976
|
};
|
|
4102
3977
|
Virtualization.prototype.updateUI = function (element, index, targetElement) {
|
|
4103
3978
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
4104
|
-
var onChange = this.isNgTemplate() ? this.onNgChange :
|
|
3979
|
+
var onChange = this.isNgTemplate() ? this.onNgChange : this.onChange;
|
|
4105
3980
|
if (this.listViewInstance.template || this.listViewInstance.groupTemplate) {
|
|
4106
3981
|
var curViewDS = this.listViewInstance.curViewDS[index];
|
|
4107
3982
|
// eslint-disable-next-line
|
|
@@ -4125,14 +4000,19 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
4125
4000
|
* @param {ElementContext} listElement - The HTML element context for the list view.
|
|
4126
4001
|
* @param {Virtualization} virtualThis - The virtualization context for the list view.
|
|
4127
4002
|
*/
|
|
4128
|
-
Virtualization.prototype.
|
|
4003
|
+
Virtualization.prototype.onChange = function (newData, listElement, virtualThis) {
|
|
4129
4004
|
var liItem = ListBase.createListItemFromJson(virtualThis.listViewInstance.createElement,
|
|
4130
4005
|
// eslint-disable-next-line
|
|
4131
4006
|
[newData], virtualThis.listViewInstance.listBaseOption, null, null, virtualThis.listViewInstance);
|
|
4007
|
+
if (virtualThis.listViewInstance.isReact) {
|
|
4008
|
+
virtualThis.listViewInstance.renderReactTemplates();
|
|
4009
|
+
}
|
|
4132
4010
|
while (listElement.lastChild) {
|
|
4133
4011
|
listElement.removeChild(listElement.lastChild);
|
|
4134
4012
|
}
|
|
4135
|
-
|
|
4013
|
+
[].slice.call(liItem[0].children).forEach(function (ele) {
|
|
4014
|
+
listElement.appendChild(ele);
|
|
4015
|
+
});
|
|
4136
4016
|
};
|
|
4137
4017
|
Virtualization.prototype.onNgChange = function (newData, listElement, virtualThis) {
|
|
4138
4018
|
// compile given target element with template for new data
|