@syncfusion/ej2-lists 23.1.43 → 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 +2 -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 +59 -189
- package/dist/es6/ej2-lists.es2015.js.map +1 -1
- package/dist/es6/ej2-lists.es5.js +59 -190
- 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/virtualization.d.ts +1 -8
- package/src/list-view/virtualization.js +57 -189
|
@@ -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
|
+
const 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]) {
|
|
@@ -3114,10 +3115,6 @@ class Virtualization {
|
|
|
3114
3115
|
* @private
|
|
3115
3116
|
*/
|
|
3116
3117
|
uiVirtualization() {
|
|
3117
|
-
this.commonTemplate = '<div class="e-text-content" role="presentation"> ' +
|
|
3118
|
-
'<span class="e-list-text"> ${' + this.listViewInstance.fields.text + '} </span></div>';
|
|
3119
|
-
this.templateFunction = compile(this.listViewInstance.template || this.commonTemplate, this.listViewInstance);
|
|
3120
|
-
this.groupTemplateFunction = compile(this.listViewInstance.groupTemplate || this.commonTemplate, this.listViewInstance);
|
|
3121
3118
|
this.wireScrollEvent(false);
|
|
3122
3119
|
const curViewDS = this.listViewInstance.curViewDS;
|
|
3123
3120
|
const firstDs = curViewDS.slice(0, 1);
|
|
@@ -3249,6 +3246,9 @@ class Virtualization {
|
|
|
3249
3246
|
}
|
|
3250
3247
|
onVirtualUiScroll(e) {
|
|
3251
3248
|
let startingHeight;
|
|
3249
|
+
const curViewDS = this.listViewInstance.curViewDS;
|
|
3250
|
+
this.listItemHeight = select(".e-list-item", this.listViewInstance.element).getBoundingClientRect().height;
|
|
3251
|
+
this.totalHeight = (Object.keys(curViewDS).length * this.listItemHeight) - (this.domItemCount * this.listItemHeight);
|
|
3252
3252
|
if (this.listViewInstance.isWindow) {
|
|
3253
3253
|
startingHeight = this.listViewInstance.ulElement.getBoundingClientRect().top -
|
|
3254
3254
|
document.documentElement.getBoundingClientRect().top;
|
|
@@ -3364,7 +3364,13 @@ class Virtualization {
|
|
|
3364
3364
|
if (!element.querySelector('.' + classNames.checkboxWrapper)) {
|
|
3365
3365
|
element.classList.add(classNames.checklist);
|
|
3366
3366
|
textContent.classList.add(classNames.checkbox);
|
|
3367
|
-
|
|
3367
|
+
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
3368
|
+
textContent.classList.add('e-checkbox-left');
|
|
3369
|
+
}
|
|
3370
|
+
else {
|
|
3371
|
+
textContent.classList.add('e-checkbox-right');
|
|
3372
|
+
}
|
|
3373
|
+
textContent.append(this.checkListWrapper.cloneNode(true));
|
|
3368
3374
|
}
|
|
3369
3375
|
}
|
|
3370
3376
|
}
|
|
@@ -3866,191 +3872,50 @@ class Virtualization {
|
|
|
3866
3872
|
this.refreshItemHeight();
|
|
3867
3873
|
}
|
|
3868
3874
|
createUIItem(args) {
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
}
|
|
3885
|
-
[].slice.call(nodes).forEach((ele) => {
|
|
3886
|
-
div.appendChild(ele);
|
|
3887
|
-
});
|
|
3888
|
-
if (div.children && div.children[0]) {
|
|
3889
|
-
div.children[0].classList.add('e-checkbox');
|
|
3890
|
-
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
3891
|
-
div.children[0].classList.add('e-checkbox-left');
|
|
3892
|
-
}
|
|
3893
|
-
else {
|
|
3894
|
-
div.children[0].classList.add('e-checkbox-right');
|
|
3895
|
-
}
|
|
3896
|
-
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
3897
|
-
div.children[0].insertBefore(this.listViewInstance.virtualCheckBox, div.childNodes[0].children[0]);
|
|
3898
|
-
}
|
|
3899
|
-
else {
|
|
3900
|
-
div.children[0].appendChild(this.listViewInstance.virtualCheckBox);
|
|
3875
|
+
if (!args.item.classList.contains("e-list-group-item")) {
|
|
3876
|
+
this.templateData = args.curData.isHeader ? args.curData.items[0] :
|
|
3877
|
+
args.curData;
|
|
3878
|
+
if (this.listViewInstance.showCheckBox) {
|
|
3879
|
+
// eslint-disable-next-line
|
|
3880
|
+
this.listViewInstance.renderCheckbox(args);
|
|
3881
|
+
if ((!isNullOrUndefined(this.listViewInstance.virtualCheckBox)) &&
|
|
3882
|
+
(!isNullOrUndefined(this.listViewInstance.virtualCheckBox.outerHTML))) {
|
|
3883
|
+
const div = document.createElement('div');
|
|
3884
|
+
const commonTemplate = '<div class="e-text-content" role="presentation"> ' +
|
|
3885
|
+
'<span class="e-list-text"> ${' + this.listViewInstance.fields.text + '} </span></div>';
|
|
3886
|
+
const templateFunction = compile(this.listViewInstance.template || commonTemplate, this.listViewInstance);
|
|
3887
|
+
const nodes = templateFunction(this.templateData, this.listViewInstance);
|
|
3888
|
+
if (this.listViewInstance.template && this.listViewInstance.isReact) {
|
|
3889
|
+
this.listViewInstance.renderReactTemplates();
|
|
3901
3890
|
}
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
}
|
|
3926
|
-
if (args.curData.isHeader) {
|
|
3927
|
-
this.headerData = args.curData;
|
|
3928
|
-
}
|
|
3929
|
-
const groupTemplate = this.listViewInstance.createElement('div');
|
|
3930
|
-
if (this.listViewInstance.fields.groupBy) {
|
|
3931
|
-
const nodes = this.groupTemplateFunction(this.headerData, this.listViewInstance);
|
|
3932
|
-
if (this.listViewInstance.template && this.listViewInstance.isReact) {
|
|
3933
|
-
this.listViewInstance.renderReactTemplates();
|
|
3934
|
-
}
|
|
3935
|
-
[].slice.call(nodes).forEach((ele) => {
|
|
3936
|
-
groupTemplate.appendChild(ele);
|
|
3937
|
-
});
|
|
3938
|
-
}
|
|
3939
|
-
if ((!this.listViewInstance.isReact || (typeof this.listViewInstance.template == "string" && !args.item.classList.contains("e-list-group-item")) ||
|
|
3940
|
-
(typeof this.listViewInstance.groupTemplate == "string" && args.item.classList.contains("e-list-group-item"))) && !this.listViewInstance.isVue) {
|
|
3941
|
-
args.item.innerHTML = '';
|
|
3942
|
-
}
|
|
3943
|
-
args.item.context = { data: args.curData, nodes: { flatTemplateNodes: [], groupTemplateNodes: [] } };
|
|
3944
|
-
for (let i = 0; i < template.children.length; i++) {
|
|
3945
|
-
this.compileTemplate(template.children[i], args.item, false);
|
|
3946
|
-
}
|
|
3947
|
-
for (let i = 0; i < groupTemplate.children.length; i++) {
|
|
3948
|
-
this.compileTemplate(groupTemplate.children[i], args.item, true);
|
|
3949
|
-
}
|
|
3950
|
-
args.item.context.template = args.curData.isHeader ? template.firstElementChild :
|
|
3951
|
-
groupTemplate.firstElementChild;
|
|
3952
|
-
args.item.context.type = args.curData.isHeader ? 'flatList' : 'groupList';
|
|
3953
|
-
const element = args.curData.isHeader ? groupTemplate : template;
|
|
3954
|
-
if (element.firstElementChild && !this.listViewInstance.isReact && !this.listViewInstance.isVue) {
|
|
3955
|
-
args.item.insertBefore(element.firstElementChild, null);
|
|
3956
|
-
}
|
|
3957
|
-
}
|
|
3958
|
-
compileTemplate(element, item, isHeader) {
|
|
3959
|
-
const subNode = {};
|
|
3960
|
-
subNode.onChange = (value) => {
|
|
3961
|
-
let groupTemplateElements;
|
|
3962
|
-
let templateElements;
|
|
3963
|
-
if (this.listViewInstance.isVue) {
|
|
3964
|
-
groupTemplateElements = this.groupTemplateFunction(value);
|
|
3965
|
-
templateElements = this.templateFunction(value);
|
|
3966
|
-
}
|
|
3967
|
-
else {
|
|
3968
|
-
groupTemplateElements = this.groupTemplateFunction(value, this.listViewInstance);
|
|
3969
|
-
templateElements = this.templateFunction(value, this.listViewInstance);
|
|
3970
|
-
}
|
|
3971
|
-
if (this.listViewInstance.template && this.listViewInstance.isReact) {
|
|
3972
|
-
this.listViewInstance.renderReactTemplates();
|
|
3973
|
-
}
|
|
3974
|
-
let currentTemplate = templateElements;
|
|
3975
|
-
if (value.isHeader) {
|
|
3976
|
-
currentTemplate = groupTemplateElements;
|
|
3977
|
-
}
|
|
3978
|
-
[].slice.call(currentTemplate).forEach(function (currentElement) {
|
|
3979
|
-
let RemovableClass = element.classList.value.replace('e-checkbox', '');
|
|
3980
|
-
RemovableClass = RemovableClass.replace('e-checkbox-left', '');
|
|
3981
|
-
RemovableClass = RemovableClass.replace('e-checkbox-right', '');
|
|
3982
|
-
removeClass([element], RemovableClass.split(' ').filter(function (css) { return css; }));
|
|
3983
|
-
addClass([element], Array.from(currentElement.classList));
|
|
3984
|
-
for (let i = 0; i < element.attributes.length; i++) {
|
|
3985
|
-
if (element.attributes[i].name != 'class') {
|
|
3986
|
-
const newData = currentElement.getAttribute(element.attributes[i].name);
|
|
3987
|
-
element.setAttribute(element.attributes[i].name, newData);
|
|
3891
|
+
[].slice.call(nodes).forEach((ele) => {
|
|
3892
|
+
div.appendChild(ele);
|
|
3893
|
+
});
|
|
3894
|
+
if (div.children && div.children[0]) {
|
|
3895
|
+
div.children[0].classList.add('e-checkbox');
|
|
3896
|
+
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
3897
|
+
div.children[0].classList.add('e-checkbox-left');
|
|
3898
|
+
}
|
|
3899
|
+
else {
|
|
3900
|
+
div.children[0].classList.add('e-checkbox-right');
|
|
3901
|
+
}
|
|
3902
|
+
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
3903
|
+
div.children[0].insertBefore(this.listViewInstance.virtualCheckBox, div.childNodes[0].children[0]);
|
|
3904
|
+
}
|
|
3905
|
+
else {
|
|
3906
|
+
div.children[0].appendChild(this.listViewInstance.virtualCheckBox);
|
|
3907
|
+
}
|
|
3908
|
+
while (args.item.lastChild) {
|
|
3909
|
+
args.item.removeChild(args.item.lastChild);
|
|
3910
|
+
}
|
|
3911
|
+
[].slice.call(div.children).forEach(function (ele) {
|
|
3912
|
+
args.item.appendChild(ele);
|
|
3913
|
+
});
|
|
3988
3914
|
}
|
|
3989
3915
|
}
|
|
3990
|
-
[].slice.call(element.children).forEach(function (ele) {
|
|
3991
|
-
if (!ele.classList.contains('e-listview-checkbox') && !(ele.classList.contains('e-checkbox-left') || ele.classList.contains('e-checkbox-right'))) {
|
|
3992
|
-
ele.remove();
|
|
3993
|
-
}
|
|
3994
|
-
});
|
|
3995
|
-
[].slice.call(currentElement.children).forEach(function (ele) {
|
|
3996
|
-
element.appendChild(ele);
|
|
3997
|
-
});
|
|
3998
|
-
});
|
|
3999
|
-
};
|
|
4000
|
-
this.updateContextData(item, subNode, isHeader);
|
|
4001
|
-
}
|
|
4002
|
-
onChange(newData, listElement) {
|
|
4003
|
-
listElement.context.data = newData;
|
|
4004
|
-
// eslint-disable-next-line max-len
|
|
4005
|
-
const groupTemplateNodes = listElement.context.nodes.groupTemplateNodes;
|
|
4006
|
-
// eslint-disable-next-line max-len
|
|
4007
|
-
const flatTemplateNodes = listElement.context.nodes.flatTemplateNodes;
|
|
4008
|
-
// eslint-disable-next-line
|
|
4009
|
-
if (!isNullOrUndefined(newData.isHeader) && newData.isHeader && listElement.context.type === 'groupList') {
|
|
4010
|
-
// eslint-disable-next-line
|
|
4011
|
-
const element = listElement.firstElementChild;
|
|
4012
|
-
detach(listElement.firstElementChild);
|
|
4013
|
-
listElement.insertBefore(listElement.context.template, null);
|
|
4014
|
-
listElement.context.template = element;
|
|
4015
|
-
listElement.context.type = 'flatList';
|
|
4016
|
-
for (let i = 0; i < groupTemplateNodes.length; i++) {
|
|
4017
|
-
// eslint-disable-next-line
|
|
4018
|
-
groupTemplateNodes[i].onChange(newData);
|
|
4019
|
-
}
|
|
4020
|
-
}
|
|
4021
|
-
else if (!newData.isHeader && listElement.context.type === 'flatList') {
|
|
4022
|
-
const element = listElement.firstElementChild;
|
|
4023
|
-
detach(listElement.firstElementChild);
|
|
4024
|
-
listElement.insertBefore(listElement.context.template, null);
|
|
4025
|
-
listElement.context.template = element;
|
|
4026
|
-
listElement.context.type = 'groupList';
|
|
4027
|
-
for (let i = 0; i < flatTemplateNodes.length; i++) {
|
|
4028
|
-
// eslint-disable-next-line
|
|
4029
|
-
flatTemplateNodes[i].onChange(newData);
|
|
4030
|
-
}
|
|
4031
|
-
}
|
|
4032
|
-
else if (!newData.isHeader) {
|
|
4033
|
-
for (let i = 0; i < flatTemplateNodes.length; i++) {
|
|
4034
|
-
// eslint-disable-next-line
|
|
4035
|
-
flatTemplateNodes[i].onChange(newData);
|
|
4036
|
-
}
|
|
4037
|
-
}
|
|
4038
|
-
else {
|
|
4039
|
-
for (let i = 0; i < groupTemplateNodes.length; i++) {
|
|
4040
|
-
// eslint-disable-next-line
|
|
4041
|
-
groupTemplateNodes[i].onChange(newData);
|
|
4042
3916
|
}
|
|
4043
3917
|
}
|
|
4044
3918
|
}
|
|
4045
|
-
// eslint-disable-next-line
|
|
4046
|
-
updateContextData(listElement, node, isHeader) {
|
|
4047
|
-
if (isHeader) {
|
|
4048
|
-
listElement.context.nodes.groupTemplateNodes.push(node);
|
|
4049
|
-
}
|
|
4050
|
-
else {
|
|
4051
|
-
listElement.context.nodes.flatTemplateNodes.push(node);
|
|
4052
|
-
}
|
|
4053
|
-
}
|
|
4054
3919
|
reRenderUiVirtualization() {
|
|
4055
3920
|
this.wireScrollEvent(true);
|
|
4056
3921
|
if (this.listViewInstance.contentContainer) {
|
|
@@ -4065,7 +3930,7 @@ class Virtualization {
|
|
|
4065
3930
|
}
|
|
4066
3931
|
updateUI(element, index, targetElement) {
|
|
4067
3932
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
4068
|
-
const onChange = this.isNgTemplate() ? this.onNgChange :
|
|
3933
|
+
const onChange = this.isNgTemplate() ? this.onNgChange : this.onChange;
|
|
4069
3934
|
if (this.listViewInstance.template || this.listViewInstance.groupTemplate) {
|
|
4070
3935
|
const curViewDS = this.listViewInstance.curViewDS[index];
|
|
4071
3936
|
// eslint-disable-next-line
|
|
@@ -4089,14 +3954,19 @@ class Virtualization {
|
|
|
4089
3954
|
* @param {ElementContext} listElement - The HTML element context for the list view.
|
|
4090
3955
|
* @param {Virtualization} virtualThis - The virtualization context for the list view.
|
|
4091
3956
|
*/
|
|
4092
|
-
|
|
3957
|
+
onChange(newData, listElement, virtualThis) {
|
|
4093
3958
|
let liItem = ListBase.createListItemFromJson(virtualThis.listViewInstance.createElement,
|
|
4094
3959
|
// eslint-disable-next-line
|
|
4095
3960
|
[newData], virtualThis.listViewInstance.listBaseOption, null, null, virtualThis.listViewInstance);
|
|
3961
|
+
if (virtualThis.listViewInstance.isReact) {
|
|
3962
|
+
virtualThis.listViewInstance.renderReactTemplates();
|
|
3963
|
+
}
|
|
4096
3964
|
while (listElement.lastChild) {
|
|
4097
3965
|
listElement.removeChild(listElement.lastChild);
|
|
4098
3966
|
}
|
|
4099
|
-
|
|
3967
|
+
[].slice.call(liItem[0].children).forEach(function (ele) {
|
|
3968
|
+
listElement.appendChild(ele);
|
|
3969
|
+
});
|
|
4100
3970
|
}
|
|
4101
3971
|
onNgChange(newData, listElement, virtualThis) {
|
|
4102
3972
|
// compile given target element with template for new data
|