@syncfusion/ej2-lists 22.2.11 → 23.1.42
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 +18 -54
- package/dist/ej2-lists.min.js +3 -3
- package/dist/ej2-lists.umd.min.js +3 -3
- package/dist/ej2-lists.umd.min.js.map +1 -1
- package/dist/es6/ej2-lists.es2015.js +100 -218
- package/dist/es6/ej2-lists.es2015.js.map +1 -1
- package/dist/es6/ej2-lists.es5.js +108 -237
- package/dist/es6/ej2-lists.es5.js.map +1 -1
- package/dist/global/ej2-lists.min.js +3 -3
- package/dist/global/ej2-lists.min.js.map +1 -1
- package/dist/global/index.d.ts +2 -2
- package/dist/ts/common/list-base.ts +1286 -0
- package/dist/ts/component.ts +4 -0
- package/dist/ts/list-view/list-view.ts +2653 -0
- package/dist/ts/list-view/virtualization.ts +1187 -0
- package/dist/ts/sortable/sortable.ts +485 -0
- package/package.json +9 -9
- package/src/common/list-base.d.ts +0 -6
- package/src/common/list-base.js +1 -1
- package/src/list-view/list-view-model.d.ts +7 -7
- package/src/list-view/list-view.d.ts +6 -6
- package/src/list-view/list-view.js +6 -18
- package/src/list-view/virtualization.d.ts +3 -3
- package/src/list-view/virtualization.js +101 -218
- package/styles/list-view/bootstrap-dark.scss +1 -1
- package/styles/list-view/bootstrap.scss +1 -1
- package/styles/list-view/bootstrap4.scss +1 -1
- package/styles/list-view/bootstrap5-dark.scss +1 -1
- package/styles/list-view/bootstrap5.scss +1 -1
- package/styles/list-view/fabric-dark.scss +1 -1
- package/styles/list-view/fabric.scss +1 -1
- package/styles/list-view/fluent-dark.scss +1 -1
- package/styles/list-view/fluent.scss +1 -1
- package/styles/list-view/highcontrast-light.scss +1 -1
- package/styles/list-view/highcontrast.scss +1 -1
- package/styles/list-view/material-dark.css +0 -1
- package/styles/list-view/material-dark.scss +1 -1
- package/styles/list-view/material.css +0 -1
- package/styles/list-view/material.scss +1 -1
- package/styles/list-view/material3-dark.css +0 -1
- package/styles/list-view/material3-dark.scss +1 -1
- package/styles/list-view/material3.css +0 -1
- package/styles/list-view/material3.scss +1 -1
- package/styles/list-view/tailwind-dark.css +0 -1
- package/styles/list-view/tailwind-dark.scss +1 -1
- package/styles/list-view/tailwind.css +0 -1
- package/styles/list-view/tailwind.scss +1 -1
- package/styles/material-dark.css +0 -1
- package/styles/material.css +0 -1
- package/styles/material3-dark.css +0 -1
- package/styles/material3-dark.scss +1 -1
- package/styles/material3.css +0 -1
- package/styles/material3.scss +1 -1
- package/styles/sortable/bootstrap-dark.scss +1 -1
- package/styles/sortable/bootstrap.scss +1 -1
- package/styles/sortable/bootstrap4.scss +1 -1
- package/styles/sortable/bootstrap5-dark.scss +1 -1
- package/styles/sortable/bootstrap5.scss +1 -1
- package/styles/sortable/fabric-dark.scss +1 -1
- package/styles/sortable/fabric.scss +1 -1
- package/styles/sortable/fluent-dark.scss +1 -1
- package/styles/sortable/fluent.scss +1 -1
- package/styles/sortable/highcontrast-light.scss +1 -1
- package/styles/sortable/highcontrast.scss +1 -1
- package/styles/sortable/material-dark.css +0 -1
- package/styles/sortable/material-dark.scss +1 -1
- package/styles/sortable/material.css +0 -1
- package/styles/sortable/material.scss +1 -1
- package/styles/sortable/material3-dark.css +0 -1
- package/styles/sortable/material3-dark.scss +1 -1
- package/styles/sortable/material3.css +0 -1
- package/styles/sortable/material3.scss +1 -1
- package/styles/sortable/tailwind-dark.css +0 -1
- package/styles/sortable/tailwind-dark.scss +1 -1
- package/styles/sortable/tailwind.css +0 -1
- package/styles/sortable/tailwind.scss +1 -1
- package/styles/tailwind-dark.css +0 -2
- package/styles/tailwind.css +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Animation, Base, ChildProperty, Complex, Component, Draggable, Event, EventHandler, NotifyPropertyChanges, Property, SanitizeHtmlHelper, Touch, addClass, 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 } from '@syncfusion/ej2-base';
|
|
2
2
|
import { DataManager, Query } from '@syncfusion/ej2-data';
|
|
3
3
|
import { createCheckBox } from '@syncfusion/ej2-buttons';
|
|
4
4
|
|
|
@@ -280,7 +280,7 @@ var ListBase;
|
|
|
280
280
|
li = generateLI(createElement, curItem, fieldData, fields, curOpt.itemClass, options, componentInstance);
|
|
281
281
|
li.classList.add(cssClass.level + '-' + ariaAttributes.level);
|
|
282
282
|
li.setAttribute('aria-level', ariaAttributes.level.toString());
|
|
283
|
-
if (ariaAttributes.groupItemRole == 'presentation') {
|
|
283
|
+
if (ariaAttributes.groupItemRole == 'presentation' || ariaAttributes.itemRole == 'presentation') {
|
|
284
284
|
li.removeAttribute('aria-level');
|
|
285
285
|
}
|
|
286
286
|
anchorElement = li.querySelector('.' + cssClass.anchorWrap);
|
|
@@ -1407,7 +1407,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1407
1407
|
this.element.style.overflow = 'hidden';
|
|
1408
1408
|
this.aniObj.animate(fromView, {
|
|
1409
1409
|
name: (reverse === true ? anim[0] : anim[1]),
|
|
1410
|
-
duration: duration,
|
|
1410
|
+
duration: (duration === 0 && animationMode === 'Enable') ? 400 : duration,
|
|
1411
1411
|
timingFunction: this.animation.easing,
|
|
1412
1412
|
// eslint-disable-next-line
|
|
1413
1413
|
end: function (model) {
|
|
@@ -1420,7 +1420,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1420
1420
|
toView.style.display = '';
|
|
1421
1421
|
this.aniObj.animate(toView, {
|
|
1422
1422
|
name: (reverse === true ? anim[2] : anim[3]),
|
|
1423
|
-
duration: duration,
|
|
1423
|
+
duration: (duration === 0 && animationMode === 'Enable') ? 400 : duration,
|
|
1424
1424
|
timingFunction: this.animation.easing,
|
|
1425
1425
|
end: function () {
|
|
1426
1426
|
_this.trigger('actionComplete');
|
|
@@ -1432,7 +1432,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1432
1432
|
ListView.prototype.preRender = function () {
|
|
1433
1433
|
if (this.template) {
|
|
1434
1434
|
try {
|
|
1435
|
-
if (document.querySelectorAll(this.template).length) {
|
|
1435
|
+
if (typeof this.template !== 'function' && document.querySelectorAll(this.template).length) {
|
|
1436
1436
|
this.setProperties({ template: document.querySelector(this.template).innerHTML.trim() }, true);
|
|
1437
1437
|
}
|
|
1438
1438
|
}
|
|
@@ -1445,7 +1445,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
1445
1445
|
headerTemplate: this.headerTemplate,
|
|
1446
1446
|
groupTemplate: this.groupTemplate, expandCollapse: true, listClass: '',
|
|
1447
1447
|
ariaAttributes: {
|
|
1448
|
-
itemRole: 'listitem', listRole: '
|
|
1448
|
+
itemRole: 'listitem', listRole: 'list', itemText: '',
|
|
1449
1449
|
groupItemRole: 'presentation', wrapperRole: 'presentation'
|
|
1450
1450
|
},
|
|
1451
1451
|
// eslint-disable-next-line
|
|
@@ -2392,18 +2392,6 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2392
2392
|
if (this.enableVirtualization) {
|
|
2393
2393
|
if (Object.keys(this.dataSource).length) {
|
|
2394
2394
|
if ((this.template || this.groupTemplate) && !this.virtualizationModule.isNgTemplate()) {
|
|
2395
|
-
if (this.isReact || this.isVue) {
|
|
2396
|
-
if (typeof this.template == "string") {
|
|
2397
|
-
this.listBaseOption.template = null;
|
|
2398
|
-
}
|
|
2399
|
-
if (typeof this.groupTemplate == "string") {
|
|
2400
|
-
this.listBaseOption.groupTemplate = null;
|
|
2401
|
-
}
|
|
2402
|
-
}
|
|
2403
|
-
else {
|
|
2404
|
-
this.listBaseOption.template = null;
|
|
2405
|
-
this.listBaseOption.groupTemplate = null;
|
|
2406
|
-
}
|
|
2407
2395
|
this.listBaseOption.itemCreated = this.virtualizationModule.createUIItem.bind(this.virtualizationModule);
|
|
2408
2396
|
}
|
|
2409
2397
|
}
|
|
@@ -2436,7 +2424,7 @@ var ListView = /** @__PURE__ @class */ (function (_super) {
|
|
|
2436
2424
|
*/
|
|
2437
2425
|
ListView.prototype.render = function () {
|
|
2438
2426
|
this.element.classList.add(classNames.root);
|
|
2439
|
-
attributes(this.element, {
|
|
2427
|
+
attributes(this.element, { tabindex: '0' });
|
|
2440
2428
|
this.setCSSClass();
|
|
2441
2429
|
this.setEnableRTL();
|
|
2442
2430
|
this.setEnable();
|
|
@@ -3154,6 +3142,10 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3154
3142
|
* @private
|
|
3155
3143
|
*/
|
|
3156
3144
|
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);
|
|
3157
3149
|
this.wireScrollEvent(false);
|
|
3158
3150
|
var curViewDS = this.listViewInstance.curViewDS;
|
|
3159
3151
|
var firstDs = curViewDS.slice(0, 1);
|
|
@@ -3909,83 +3901,139 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
3909
3901
|
this.refreshItemHeight();
|
|
3910
3902
|
};
|
|
3911
3903
|
Virtualization.prototype.createUIItem = function (args) {
|
|
3912
|
-
var
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
'<span class="e-list-text"> ${' + this.listViewInstance.fields.text + '} </span></div>';
|
|
3904
|
+
var template = document.createElement('div');
|
|
3905
|
+
this.templateData = args.curData.isHeader ? args.curData.items[0] :
|
|
3906
|
+
args.curData;
|
|
3916
3907
|
if (this.listViewInstance.isReact) {
|
|
3917
|
-
commonTemplate = null;
|
|
3908
|
+
this.commonTemplate = null;
|
|
3918
3909
|
}
|
|
3919
3910
|
if (this.listViewInstance.showCheckBox) {
|
|
3920
3911
|
// eslint-disable-next-line
|
|
3921
3912
|
this.listViewInstance.renderCheckbox(args);
|
|
3922
3913
|
if ((!isNullOrUndefined(this.listViewInstance.virtualCheckBox)) &&
|
|
3923
3914
|
(!isNullOrUndefined(this.listViewInstance.virtualCheckBox.outerHTML))) {
|
|
3924
|
-
var
|
|
3925
|
-
|
|
3926
|
-
if (
|
|
3927
|
-
|
|
3915
|
+
var div_1 = document.createElement('div');
|
|
3916
|
+
var nodes = this.templateFunction(this.templateData, this.listViewInstance);
|
|
3917
|
+
if (this.listViewInstance.template && this.listViewInstance.isReact) {
|
|
3918
|
+
this.listViewInstance.renderReactTemplates();
|
|
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');
|
|
3928
3925
|
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
3929
|
-
|
|
3926
|
+
div_1.children[0].classList.add('e-checkbox-left');
|
|
3930
3927
|
}
|
|
3931
3928
|
else {
|
|
3932
|
-
|
|
3929
|
+
div_1.children[0].classList.add('e-checkbox-right');
|
|
3933
3930
|
}
|
|
3934
3931
|
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
3935
|
-
|
|
3932
|
+
div_1.children[0].insertBefore(this.listViewInstance.virtualCheckBox, div_1.childNodes[0].children[0]);
|
|
3936
3933
|
}
|
|
3937
3934
|
else {
|
|
3938
|
-
|
|
3935
|
+
div_1.children[0].appendChild(this.listViewInstance.virtualCheckBox);
|
|
3939
3936
|
}
|
|
3940
|
-
|
|
3937
|
+
template.innerHTML = div_1.innerHTML;
|
|
3941
3938
|
}
|
|
3942
3939
|
}
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3940
|
+
else {
|
|
3941
|
+
var div_2 = document.createElement('div');
|
|
3942
|
+
var nodes = this.templateFunction(this.templateData, this.listViewInstance);
|
|
3943
|
+
if (this.listViewInstance.template && this.listViewInstance.isReact) {
|
|
3944
|
+
this.listViewInstance.renderReactTemplates();
|
|
3945
|
+
}
|
|
3946
|
+
[].slice.call(nodes).forEach(function (ele) {
|
|
3947
|
+
div_2.appendChild(ele);
|
|
3948
|
+
});
|
|
3949
|
+
template.innerHTML = div_2.innerHTML;
|
|
3950
|
+
}
|
|
3947
3951
|
}
|
|
3948
3952
|
else {
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
if (this.listViewInstance.fields.groupBy) {
|
|
3957
|
-
groupTemplate.innerHTML = this.listViewInstance.groupTemplate || commonTemplate;
|
|
3953
|
+
var nodes = this.templateFunction(this.templateData, this.listViewInstance);
|
|
3954
|
+
if (this.listViewInstance.template && this.listViewInstance.isReact) {
|
|
3955
|
+
this.listViewInstance.renderReactTemplates();
|
|
3956
|
+
}
|
|
3957
|
+
[].slice.call(nodes).forEach(function (ele) {
|
|
3958
|
+
template.appendChild(ele);
|
|
3959
|
+
});
|
|
3958
3960
|
}
|
|
3959
|
-
// eslint-disable-next-line
|
|
3960
|
-
var groupTemplateElements = groupTemplate.getElementsByTagName('*');
|
|
3961
3961
|
if (args.curData.isHeader) {
|
|
3962
3962
|
this.headerData = args.curData;
|
|
3963
3963
|
}
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
(
|
|
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) {
|
|
3968
3976
|
args.item.innerHTML = '';
|
|
3969
3977
|
}
|
|
3970
3978
|
args.item.context = { data: args.curData, nodes: { flatTemplateNodes: [], groupTemplateNodes: [] } };
|
|
3971
|
-
for (var i = 0; i <
|
|
3972
|
-
this.compileTemplate(
|
|
3979
|
+
for (var i = 0; i < template.children.length; i++) {
|
|
3980
|
+
this.compileTemplate(template.children[i], args.item, false);
|
|
3973
3981
|
}
|
|
3974
|
-
for (var i = 0; i <
|
|
3975
|
-
this.compileTemplate(
|
|
3982
|
+
for (var i = 0; i < groupTemplate.children.length; i++) {
|
|
3983
|
+
this.compileTemplate(groupTemplate.children[i], args.item, true);
|
|
3976
3984
|
}
|
|
3977
3985
|
args.item.context.template = args.curData.isHeader ? template.firstElementChild :
|
|
3978
3986
|
groupTemplate.firstElementChild;
|
|
3979
3987
|
args.item.context.type = args.curData.isHeader ? 'flatList' : 'groupList';
|
|
3980
3988
|
var element = args.curData.isHeader ? groupTemplate : template;
|
|
3981
|
-
if (element.firstElementChild) {
|
|
3989
|
+
if (element.firstElementChild && !this.listViewInstance.isReact && !this.listViewInstance.isVue) {
|
|
3982
3990
|
args.item.insertBefore(element.firstElementChild, null);
|
|
3983
3991
|
}
|
|
3984
3992
|
};
|
|
3985
3993
|
Virtualization.prototype.compileTemplate = function (element, item, isHeader) {
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
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);
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
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);
|
|
3989
4037
|
};
|
|
3990
4038
|
Virtualization.prototype.onChange = function (newData, listElement) {
|
|
3991
4039
|
listElement.context.data = newData;
|
|
@@ -4039,183 +4087,6 @@ var Virtualization = /** @__PURE__ @class */ (function () {
|
|
|
4039
4087
|
listElement.context.nodes.flatTemplateNodes.push(node);
|
|
4040
4088
|
}
|
|
4041
4089
|
};
|
|
4042
|
-
Virtualization.prototype.classProperty = function (element, listElement, isHeader) {
|
|
4043
|
-
var regex = new RegExp('\\${([^}]*)}', 'g');
|
|
4044
|
-
var resultantOutput = [];
|
|
4045
|
-
var regexMatch;
|
|
4046
|
-
while (regexMatch !== null) {
|
|
4047
|
-
var match = regex.exec(element.className);
|
|
4048
|
-
resultantOutput.push(match);
|
|
4049
|
-
regexMatch = match;
|
|
4050
|
-
if (regexMatch === null) {
|
|
4051
|
-
resultantOutput.pop();
|
|
4052
|
-
}
|
|
4053
|
-
}
|
|
4054
|
-
if (resultantOutput && resultantOutput.length) {
|
|
4055
|
-
var _loop_1 = function (i) {
|
|
4056
|
-
var classNameMatch = resultantOutput[i];
|
|
4057
|
-
// eslint-disable-next-line
|
|
4058
|
-
var classFunction;
|
|
4059
|
-
if (classNameMatch[1].indexOf('?') !== -1 && classNameMatch[1].indexOf(':') !== -1) {
|
|
4060
|
-
// tslint:disable-next-line:no-function-constructor-with-string-args
|
|
4061
|
-
classFunction = new Function('data', 'return ' + classNameMatch[1].replace(/\$/g, 'data.'));
|
|
4062
|
-
}
|
|
4063
|
-
else {
|
|
4064
|
-
// tslint:disable-next-line:no-function-constructor-with-string-args
|
|
4065
|
-
classFunction = new Function('data', 'return ' + 'data.' + classNameMatch[1]);
|
|
4066
|
-
}
|
|
4067
|
-
// eslint-disable-next-line
|
|
4068
|
-
var subNode = {};
|
|
4069
|
-
if (isHeader) {
|
|
4070
|
-
subNode.bindedvalue = classFunction(this_1.headerData);
|
|
4071
|
-
}
|
|
4072
|
-
else {
|
|
4073
|
-
subNode.bindedvalue = classFunction(this_1.templateData);
|
|
4074
|
-
}
|
|
4075
|
-
subNode.onChange = function (value) {
|
|
4076
|
-
if (subNode.bindedvalue) {
|
|
4077
|
-
removeClass([element], subNode.bindedvalue.split(' ').filter(function (css) { return css; }));
|
|
4078
|
-
}
|
|
4079
|
-
var newCss = classFunction(value);
|
|
4080
|
-
if (newCss) {
|
|
4081
|
-
addClass([element], (newCss).split(' ').filter(function (css) { return css; }));
|
|
4082
|
-
}
|
|
4083
|
-
subNode.bindedvalue = newCss;
|
|
4084
|
-
};
|
|
4085
|
-
var className = classNameMatch[0].split(' ');
|
|
4086
|
-
for (var i_1 = 0; i_1 < className.length; i_1++) {
|
|
4087
|
-
element.classList.remove(className[i_1]);
|
|
4088
|
-
}
|
|
4089
|
-
if (subNode.bindedvalue) {
|
|
4090
|
-
addClass([element], subNode.bindedvalue.split(' ').filter(function (css) { return css; }));
|
|
4091
|
-
}
|
|
4092
|
-
this_1.updateContextData(listElement, subNode, isHeader);
|
|
4093
|
-
};
|
|
4094
|
-
var this_1 = this;
|
|
4095
|
-
for (var i = 0; i < resultantOutput.length; i++) {
|
|
4096
|
-
_loop_1(i);
|
|
4097
|
-
}
|
|
4098
|
-
}
|
|
4099
|
-
};
|
|
4100
|
-
Virtualization.prototype.attributeProperty = function (element, listElement, isHeader) {
|
|
4101
|
-
var attributeNames = [];
|
|
4102
|
-
for (var i = 0; i < element.attributes.length; i++) {
|
|
4103
|
-
attributeNames.push(element.attributes[i].nodeName);
|
|
4104
|
-
}
|
|
4105
|
-
if (attributeNames.indexOf('class') !== -1) {
|
|
4106
|
-
attributeNames.splice(attributeNames.indexOf('class'), 1);
|
|
4107
|
-
}
|
|
4108
|
-
var _loop_2 = function (i) {
|
|
4109
|
-
var attributeName = attributeNames[i];
|
|
4110
|
-
var attrNameMatch = new RegExp('\\${([^}]*)}', 'g').exec(attributeName) || [];
|
|
4111
|
-
var attrValueMatch = new RegExp('\\${([^}]*)}', 'g').exec(element.getAttribute(attributeName))
|
|
4112
|
-
|| [];
|
|
4113
|
-
// eslint-disable-next-line
|
|
4114
|
-
var attributeNameFunction;
|
|
4115
|
-
// eslint-disable-next-line
|
|
4116
|
-
var attributeValueFunction;
|
|
4117
|
-
if (attrNameMatch.length || attrValueMatch.length) {
|
|
4118
|
-
if (attrNameMatch[1]) {
|
|
4119
|
-
// tslint:disable-next-line:no-function-constructor-with-string-args
|
|
4120
|
-
attributeNameFunction = new Function('data', 'return ' + 'data.' + attrNameMatch[1]);
|
|
4121
|
-
}
|
|
4122
|
-
if (attrValueMatch[1]) {
|
|
4123
|
-
if (attrValueMatch[1].indexOf('?') !== -1 && attrValueMatch[1].indexOf(':') !== -1) {
|
|
4124
|
-
// tslint:disable-next-line:no-function-constructor-with-string-args
|
|
4125
|
-
attributeValueFunction = new Function('data', 'return ' + attrValueMatch[1].replace(/\$/g, 'data.'));
|
|
4126
|
-
}
|
|
4127
|
-
else {
|
|
4128
|
-
// tslint:disable-next-line:no-function-constructor-with-string-args
|
|
4129
|
-
attributeValueFunction = new Function('data', 'return ' + 'data.' + attrValueMatch[1]);
|
|
4130
|
-
}
|
|
4131
|
-
}
|
|
4132
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
4133
|
-
var subNode_1 = {};
|
|
4134
|
-
if (isHeader) {
|
|
4135
|
-
subNode_1.bindedvalue = [attrNameMatch[1] === undefined ? undefined : attributeNameFunction(this_2.headerData),
|
|
4136
|
-
attrValueMatch[1] === undefined ? undefined : attributeValueFunction(this_2.headerData)];
|
|
4137
|
-
}
|
|
4138
|
-
else {
|
|
4139
|
-
subNode_1.bindedvalue = [attrNameMatch[1] === undefined ? undefined : attributeNameFunction(this_2.templateData),
|
|
4140
|
-
attrValueMatch[1] === undefined ? undefined : attributeValueFunction(this_2.templateData)];
|
|
4141
|
-
}
|
|
4142
|
-
subNode_1.attrName = subNode_1.bindedvalue[0] === undefined ?
|
|
4143
|
-
attributeName : subNode_1.bindedvalue[0];
|
|
4144
|
-
subNode_1.onChange = function (value) {
|
|
4145
|
-
var bindedvalue = subNode_1.bindedvalue[1] === undefined ?
|
|
4146
|
-
element.getAttribute(subNode_1.attrName) : attributeValueFunction(value);
|
|
4147
|
-
element.removeAttribute(subNode_1.attrName);
|
|
4148
|
-
subNode_1.attrName = subNode_1.bindedvalue[0] === undefined ? subNode_1.attrName : attributeNameFunction(value);
|
|
4149
|
-
element.setAttribute(subNode_1.attrName, bindedvalue);
|
|
4150
|
-
subNode_1.bindedvalue = [subNode_1.bindedvalue[0] === undefined ? undefined : attributeNameFunction(value),
|
|
4151
|
-
subNode_1.bindedvalue[1] === undefined ? undefined : attributeValueFunction(value)];
|
|
4152
|
-
};
|
|
4153
|
-
var attributeValue = subNode_1.bindedvalue[1] === undefined ? element.getAttribute(attributeName) :
|
|
4154
|
-
subNode_1.bindedvalue[1];
|
|
4155
|
-
element.removeAttribute(attributeName);
|
|
4156
|
-
element.setAttribute(subNode_1.attrName, attributeValue);
|
|
4157
|
-
this_2.updateContextData(listElement, subNode_1, isHeader);
|
|
4158
|
-
}
|
|
4159
|
-
};
|
|
4160
|
-
var this_2 = this;
|
|
4161
|
-
for (var i = 0; i < attributeNames.length; i++) {
|
|
4162
|
-
_loop_2(i);
|
|
4163
|
-
}
|
|
4164
|
-
};
|
|
4165
|
-
Virtualization.prototype.textProperty = function (element, listElement, isHeader) {
|
|
4166
|
-
var regex = new RegExp('\\${([^}]*)}', 'g');
|
|
4167
|
-
var resultantOutput = [];
|
|
4168
|
-
var regexMatch;
|
|
4169
|
-
while (regexMatch !== null) {
|
|
4170
|
-
var match = regex.exec(element.innerText);
|
|
4171
|
-
resultantOutput.push(match);
|
|
4172
|
-
regexMatch = match;
|
|
4173
|
-
if (regexMatch === null) {
|
|
4174
|
-
resultantOutput.pop();
|
|
4175
|
-
}
|
|
4176
|
-
}
|
|
4177
|
-
var isChildHasTextContent = Array.prototype.some.call(element.children, function (element) {
|
|
4178
|
-
if (new RegExp('\\${([^}]*)}', 'g').exec(element.innerText)) {
|
|
4179
|
-
return true;
|
|
4180
|
-
}
|
|
4181
|
-
else {
|
|
4182
|
-
return false;
|
|
4183
|
-
}
|
|
4184
|
-
});
|
|
4185
|
-
if (resultantOutput && resultantOutput.length && !isChildHasTextContent) {
|
|
4186
|
-
var _loop_3 = function (i) {
|
|
4187
|
-
var textPropertyMatch = resultantOutput[i];
|
|
4188
|
-
// eslint-disable-next-line
|
|
4189
|
-
var subNode = {};
|
|
4190
|
-
// eslint-disable-next-line
|
|
4191
|
-
var textFunction;
|
|
4192
|
-
if (textPropertyMatch[1].indexOf('?') !== -1 && textPropertyMatch[1].indexOf(':') !== -1) {
|
|
4193
|
-
// tslint:disable-next-line:no-function-constructor-with-string-args
|
|
4194
|
-
textFunction = new Function('data', 'return ' + textPropertyMatch[1].replace(/\$/g, 'data.'));
|
|
4195
|
-
}
|
|
4196
|
-
else {
|
|
4197
|
-
// tslint:disable-next-line:no-function-constructor-with-string-args
|
|
4198
|
-
textFunction = new Function('data', 'return ' + 'data.' + textPropertyMatch[1]);
|
|
4199
|
-
}
|
|
4200
|
-
if (isHeader) {
|
|
4201
|
-
subNode.bindedvalue = textFunction(this_3.headerData);
|
|
4202
|
-
}
|
|
4203
|
-
else {
|
|
4204
|
-
subNode.bindedvalue = textFunction(this_3.templateData);
|
|
4205
|
-
}
|
|
4206
|
-
subNode.onChange = function (value) {
|
|
4207
|
-
element.innerText = element.innerText.replace(subNode.bindedvalue, textFunction(value));
|
|
4208
|
-
subNode.bindedvalue = textFunction(value);
|
|
4209
|
-
};
|
|
4210
|
-
element.innerText = element.innerText.replace(textPropertyMatch[0], subNode.bindedvalue);
|
|
4211
|
-
this_3.updateContextData(listElement, subNode, isHeader);
|
|
4212
|
-
};
|
|
4213
|
-
var this_3 = this;
|
|
4214
|
-
for (var i = 0; i < resultantOutput.length; i++) {
|
|
4215
|
-
_loop_3(i);
|
|
4216
|
-
}
|
|
4217
|
-
}
|
|
4218
|
-
};
|
|
4219
4090
|
Virtualization.prototype.reRenderUiVirtualization = function () {
|
|
4220
4091
|
this.wireScrollEvent(true);
|
|
4221
4092
|
if (this.listViewInstance.contentContainer) {
|