@syncfusion/ej2-lists 22.2.9 → 23.1.36
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 -46
- 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 +103 -218
- package/dist/es6/ej2-lists.es2015.js.map +1 -1
- package/dist/es6/ej2-lists.es5.js +111 -237
- 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 +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 +9 -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);
|
|
@@ -1381,7 +1381,7 @@ let ListView = class ListView extends Component {
|
|
|
1381
1381
|
this.element.style.overflow = 'hidden';
|
|
1382
1382
|
this.aniObj.animate(fromView, {
|
|
1383
1383
|
name: (reverse === true ? anim[0] : anim[1]),
|
|
1384
|
-
duration: duration,
|
|
1384
|
+
duration: (duration === 0 && animationMode === 'Enable') ? 400 : duration,
|
|
1385
1385
|
timingFunction: this.animation.easing,
|
|
1386
1386
|
// eslint-disable-next-line
|
|
1387
1387
|
end: (model) => {
|
|
@@ -1394,7 +1394,7 @@ let ListView = class ListView extends Component {
|
|
|
1394
1394
|
toView.style.display = '';
|
|
1395
1395
|
this.aniObj.animate(toView, {
|
|
1396
1396
|
name: (reverse === true ? anim[2] : anim[3]),
|
|
1397
|
-
duration: duration,
|
|
1397
|
+
duration: (duration === 0 && animationMode === 'Enable') ? 400 : duration,
|
|
1398
1398
|
timingFunction: this.animation.easing,
|
|
1399
1399
|
end: () => {
|
|
1400
1400
|
this.trigger('actionComplete');
|
|
@@ -1406,7 +1406,7 @@ let ListView = class ListView extends Component {
|
|
|
1406
1406
|
preRender() {
|
|
1407
1407
|
if (this.template) {
|
|
1408
1408
|
try {
|
|
1409
|
-
if (document.querySelectorAll(this.template).length) {
|
|
1409
|
+
if (typeof this.template !== 'function' && document.querySelectorAll(this.template).length) {
|
|
1410
1410
|
this.setProperties({ template: document.querySelector(this.template).innerHTML.trim() }, true);
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
@@ -1419,7 +1419,7 @@ let ListView = class ListView extends Component {
|
|
|
1419
1419
|
headerTemplate: this.headerTemplate,
|
|
1420
1420
|
groupTemplate: this.groupTemplate, expandCollapse: true, listClass: '',
|
|
1421
1421
|
ariaAttributes: {
|
|
1422
|
-
itemRole: 'listitem', listRole: '
|
|
1422
|
+
itemRole: 'listitem', listRole: 'list', itemText: '',
|
|
1423
1423
|
groupItemRole: 'presentation', wrapperRole: 'presentation'
|
|
1424
1424
|
},
|
|
1425
1425
|
// eslint-disable-next-line
|
|
@@ -1629,6 +1629,9 @@ let ListView = class ListView extends Component {
|
|
|
1629
1629
|
}
|
|
1630
1630
|
}
|
|
1631
1631
|
clickHandler(e) {
|
|
1632
|
+
if (Array.isArray(this.dataSource) && this.dataSource.length === 0) {
|
|
1633
|
+
return;
|
|
1634
|
+
}
|
|
1632
1635
|
const target = e.target;
|
|
1633
1636
|
this.targetElement = target;
|
|
1634
1637
|
const classList = target.classList;
|
|
@@ -2353,18 +2356,6 @@ let ListView = class ListView extends Component {
|
|
|
2353
2356
|
if (this.enableVirtualization) {
|
|
2354
2357
|
if (Object.keys(this.dataSource).length) {
|
|
2355
2358
|
if ((this.template || this.groupTemplate) && !this.virtualizationModule.isNgTemplate()) {
|
|
2356
|
-
if (this.isReact || this.isVue) {
|
|
2357
|
-
if (typeof this.template == "string") {
|
|
2358
|
-
this.listBaseOption.template = null;
|
|
2359
|
-
}
|
|
2360
|
-
if (typeof this.groupTemplate == "string") {
|
|
2361
|
-
this.listBaseOption.groupTemplate = null;
|
|
2362
|
-
}
|
|
2363
|
-
}
|
|
2364
|
-
else {
|
|
2365
|
-
this.listBaseOption.template = null;
|
|
2366
|
-
this.listBaseOption.groupTemplate = null;
|
|
2367
|
-
}
|
|
2368
2359
|
this.listBaseOption.itemCreated = this.virtualizationModule.createUIItem.bind(this.virtualizationModule);
|
|
2369
2360
|
}
|
|
2370
2361
|
}
|
|
@@ -2397,7 +2388,7 @@ let ListView = class ListView extends Component {
|
|
|
2397
2388
|
*/
|
|
2398
2389
|
render() {
|
|
2399
2390
|
this.element.classList.add(classNames.root);
|
|
2400
|
-
attributes(this.element, {
|
|
2391
|
+
attributes(this.element, { tabindex: '0' });
|
|
2401
2392
|
this.setCSSClass();
|
|
2402
2393
|
this.setEnableRTL();
|
|
2403
2394
|
this.setEnable();
|
|
@@ -3112,6 +3103,10 @@ class Virtualization {
|
|
|
3112
3103
|
* @private
|
|
3113
3104
|
*/
|
|
3114
3105
|
uiVirtualization() {
|
|
3106
|
+
this.commonTemplate = '<div class="e-text-content" role="presentation"> ' +
|
|
3107
|
+
'<span class="e-list-text"> ${' + this.listViewInstance.fields.text + '} </span></div>';
|
|
3108
|
+
this.templateFunction = compile(this.listViewInstance.template || this.commonTemplate, this.listViewInstance);
|
|
3109
|
+
this.groupTemplateFunction = compile(this.listViewInstance.groupTemplate || this.commonTemplate, this.listViewInstance);
|
|
3115
3110
|
this.wireScrollEvent(false);
|
|
3116
3111
|
const curViewDS = this.listViewInstance.curViewDS;
|
|
3117
3112
|
const firstDs = curViewDS.slice(0, 1);
|
|
@@ -3860,12 +3855,11 @@ class Virtualization {
|
|
|
3860
3855
|
this.refreshItemHeight();
|
|
3861
3856
|
}
|
|
3862
3857
|
createUIItem(args) {
|
|
3863
|
-
const
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
'<span class="e-list-text"> ${' + this.listViewInstance.fields.text + '} </span></div>';
|
|
3858
|
+
const template = document.createElement('div');
|
|
3859
|
+
this.templateData = args.curData.isHeader ? args.curData.items[0] :
|
|
3860
|
+
args.curData;
|
|
3867
3861
|
if (this.listViewInstance.isReact) {
|
|
3868
|
-
commonTemplate = null;
|
|
3862
|
+
this.commonTemplate = null;
|
|
3869
3863
|
}
|
|
3870
3864
|
if (this.listViewInstance.showCheckBox) {
|
|
3871
3865
|
// eslint-disable-next-line
|
|
@@ -3873,7 +3867,13 @@ class Virtualization {
|
|
|
3873
3867
|
if ((!isNullOrUndefined(this.listViewInstance.virtualCheckBox)) &&
|
|
3874
3868
|
(!isNullOrUndefined(this.listViewInstance.virtualCheckBox.outerHTML))) {
|
|
3875
3869
|
const div = document.createElement('div');
|
|
3876
|
-
|
|
3870
|
+
const nodes = this.templateFunction(this.templateData, this.listViewInstance);
|
|
3871
|
+
if (this.listViewInstance.template && this.listViewInstance.isReact) {
|
|
3872
|
+
this.listViewInstance.renderReactTemplates();
|
|
3873
|
+
}
|
|
3874
|
+
[].slice.call(nodes).forEach((ele) => {
|
|
3875
|
+
div.appendChild(ele);
|
|
3876
|
+
});
|
|
3877
3877
|
if (div.children && div.children[0]) {
|
|
3878
3878
|
div.children[0].classList.add('e-checkbox');
|
|
3879
3879
|
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
@@ -3888,55 +3888,105 @@ class Virtualization {
|
|
|
3888
3888
|
else {
|
|
3889
3889
|
div.children[0].appendChild(this.listViewInstance.virtualCheckBox);
|
|
3890
3890
|
}
|
|
3891
|
-
|
|
3891
|
+
template.innerHTML = div.innerHTML;
|
|
3892
3892
|
}
|
|
3893
3893
|
}
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3894
|
+
else {
|
|
3895
|
+
let div = document.createElement('div');
|
|
3896
|
+
const nodes = this.templateFunction(this.templateData, this.listViewInstance);
|
|
3897
|
+
if (this.listViewInstance.template && this.listViewInstance.isReact) {
|
|
3898
|
+
this.listViewInstance.renderReactTemplates();
|
|
3899
|
+
}
|
|
3900
|
+
[].slice.call(nodes).forEach((ele) => {
|
|
3901
|
+
div.appendChild(ele);
|
|
3902
|
+
});
|
|
3903
|
+
template.innerHTML = div.innerHTML;
|
|
3904
|
+
}
|
|
3898
3905
|
}
|
|
3899
3906
|
else {
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
if (this.listViewInstance.fields.groupBy) {
|
|
3908
|
-
groupTemplate.innerHTML = this.listViewInstance.groupTemplate || commonTemplate;
|
|
3907
|
+
const nodes = this.templateFunction(this.templateData, this.listViewInstance);
|
|
3908
|
+
if (this.listViewInstance.template && this.listViewInstance.isReact) {
|
|
3909
|
+
this.listViewInstance.renderReactTemplates();
|
|
3910
|
+
}
|
|
3911
|
+
[].slice.call(nodes).forEach((ele) => {
|
|
3912
|
+
template.appendChild(ele);
|
|
3913
|
+
});
|
|
3909
3914
|
}
|
|
3910
|
-
// eslint-disable-next-line
|
|
3911
|
-
let groupTemplateElements = groupTemplate.getElementsByTagName('*');
|
|
3912
3915
|
if (args.curData.isHeader) {
|
|
3913
3916
|
this.headerData = args.curData;
|
|
3914
3917
|
}
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
(
|
|
3918
|
+
const groupTemplate = this.listViewInstance.createElement('div');
|
|
3919
|
+
if (this.listViewInstance.fields.groupBy) {
|
|
3920
|
+
const nodes = this.groupTemplateFunction(this.headerData, this.listViewInstance);
|
|
3921
|
+
if (this.listViewInstance.template && this.listViewInstance.isReact) {
|
|
3922
|
+
this.listViewInstance.renderReactTemplates();
|
|
3923
|
+
}
|
|
3924
|
+
[].slice.call(nodes).forEach((ele) => {
|
|
3925
|
+
groupTemplate.appendChild(ele);
|
|
3926
|
+
});
|
|
3927
|
+
}
|
|
3928
|
+
if ((!this.listViewInstance.isReact || (typeof this.listViewInstance.template == "string" && !args.item.classList.contains("e-list-group-item")) ||
|
|
3929
|
+
(typeof this.listViewInstance.groupTemplate == "string" && args.item.classList.contains("e-list-group-item"))) && !this.listViewInstance.isVue) {
|
|
3919
3930
|
args.item.innerHTML = '';
|
|
3920
3931
|
}
|
|
3921
3932
|
args.item.context = { data: args.curData, nodes: { flatTemplateNodes: [], groupTemplateNodes: [] } };
|
|
3922
|
-
for (let i = 0; i <
|
|
3923
|
-
this.compileTemplate(
|
|
3933
|
+
for (let i = 0; i < template.children.length; i++) {
|
|
3934
|
+
this.compileTemplate(template.children[i], args.item, false);
|
|
3924
3935
|
}
|
|
3925
|
-
for (let i = 0; i <
|
|
3926
|
-
this.compileTemplate(
|
|
3936
|
+
for (let i = 0; i < groupTemplate.children.length; i++) {
|
|
3937
|
+
this.compileTemplate(groupTemplate.children[i], args.item, true);
|
|
3927
3938
|
}
|
|
3928
3939
|
args.item.context.template = args.curData.isHeader ? template.firstElementChild :
|
|
3929
3940
|
groupTemplate.firstElementChild;
|
|
3930
3941
|
args.item.context.type = args.curData.isHeader ? 'flatList' : 'groupList';
|
|
3931
3942
|
const element = args.curData.isHeader ? groupTemplate : template;
|
|
3932
|
-
if (element.firstElementChild) {
|
|
3943
|
+
if (element.firstElementChild && !this.listViewInstance.isReact && !this.listViewInstance.isVue) {
|
|
3933
3944
|
args.item.insertBefore(element.firstElementChild, null);
|
|
3934
3945
|
}
|
|
3935
3946
|
}
|
|
3936
3947
|
compileTemplate(element, item, isHeader) {
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3948
|
+
const subNode = {};
|
|
3949
|
+
subNode.onChange = (value) => {
|
|
3950
|
+
let groupTemplateElements;
|
|
3951
|
+
let templateElements;
|
|
3952
|
+
if (this.listViewInstance.isVue) {
|
|
3953
|
+
groupTemplateElements = this.groupTemplateFunction(value);
|
|
3954
|
+
templateElements = this.templateFunction(value);
|
|
3955
|
+
}
|
|
3956
|
+
else {
|
|
3957
|
+
groupTemplateElements = this.groupTemplateFunction(value, this.listViewInstance);
|
|
3958
|
+
templateElements = this.templateFunction(value, this.listViewInstance);
|
|
3959
|
+
}
|
|
3960
|
+
if (this.listViewInstance.template && this.listViewInstance.isReact) {
|
|
3961
|
+
this.listViewInstance.renderReactTemplates();
|
|
3962
|
+
}
|
|
3963
|
+
let currentTemplate = templateElements;
|
|
3964
|
+
if (value.isHeader) {
|
|
3965
|
+
currentTemplate = groupTemplateElements;
|
|
3966
|
+
}
|
|
3967
|
+
[].slice.call(currentTemplate).forEach(function (currentElement) {
|
|
3968
|
+
let RemovableClass = element.classList.value.replace('e-checkbox', '');
|
|
3969
|
+
RemovableClass = RemovableClass.replace('e-checkbox-left', '');
|
|
3970
|
+
RemovableClass = RemovableClass.replace('e-checkbox-right', '');
|
|
3971
|
+
removeClass([element], RemovableClass.split(' ').filter(function (css) { return css; }));
|
|
3972
|
+
addClass([element], Array.from(currentElement.classList));
|
|
3973
|
+
for (let i = 0; i < element.attributes.length; i++) {
|
|
3974
|
+
if (element.attributes[i].name != 'class') {
|
|
3975
|
+
const newData = currentElement.getAttribute(element.attributes[i].name);
|
|
3976
|
+
element.setAttribute(element.attributes[i].name, newData);
|
|
3977
|
+
}
|
|
3978
|
+
}
|
|
3979
|
+
[].slice.call(element.children).forEach(function (ele) {
|
|
3980
|
+
if (!ele.classList.contains('e-listview-checkbox') && !(ele.classList.contains('e-checkbox-left') || ele.classList.contains('e-checkbox-right'))) {
|
|
3981
|
+
ele.remove();
|
|
3982
|
+
}
|
|
3983
|
+
});
|
|
3984
|
+
[].slice.call(currentElement.children).forEach(function (ele) {
|
|
3985
|
+
element.appendChild(ele);
|
|
3986
|
+
});
|
|
3987
|
+
});
|
|
3988
|
+
};
|
|
3989
|
+
this.updateContextData(item, subNode, isHeader);
|
|
3940
3990
|
}
|
|
3941
3991
|
onChange(newData, listElement) {
|
|
3942
3992
|
listElement.context.data = newData;
|
|
@@ -3990,171 +4040,6 @@ class Virtualization {
|
|
|
3990
4040
|
listElement.context.nodes.flatTemplateNodes.push(node);
|
|
3991
4041
|
}
|
|
3992
4042
|
}
|
|
3993
|
-
classProperty(element, listElement, isHeader) {
|
|
3994
|
-
const regex = new RegExp('\\${([^}]*)}', 'g');
|
|
3995
|
-
const resultantOutput = [];
|
|
3996
|
-
let regexMatch;
|
|
3997
|
-
while (regexMatch !== null) {
|
|
3998
|
-
const match = regex.exec(element.className);
|
|
3999
|
-
resultantOutput.push(match);
|
|
4000
|
-
regexMatch = match;
|
|
4001
|
-
if (regexMatch === null) {
|
|
4002
|
-
resultantOutput.pop();
|
|
4003
|
-
}
|
|
4004
|
-
}
|
|
4005
|
-
if (resultantOutput && resultantOutput.length) {
|
|
4006
|
-
for (let i = 0; i < resultantOutput.length; i++) {
|
|
4007
|
-
const classNameMatch = resultantOutput[i];
|
|
4008
|
-
// eslint-disable-next-line
|
|
4009
|
-
let classFunction;
|
|
4010
|
-
if (classNameMatch[1].indexOf('?') !== -1 && classNameMatch[1].indexOf(':') !== -1) {
|
|
4011
|
-
// tslint:disable-next-line:no-function-constructor-with-string-args
|
|
4012
|
-
classFunction = new Function('data', 'return ' + classNameMatch[1].replace(/\$/g, 'data.'));
|
|
4013
|
-
}
|
|
4014
|
-
else {
|
|
4015
|
-
// tslint:disable-next-line:no-function-constructor-with-string-args
|
|
4016
|
-
classFunction = new Function('data', 'return ' + 'data.' + classNameMatch[1]);
|
|
4017
|
-
}
|
|
4018
|
-
// eslint-disable-next-line
|
|
4019
|
-
const subNode = {};
|
|
4020
|
-
if (isHeader) {
|
|
4021
|
-
subNode.bindedvalue = classFunction(this.headerData);
|
|
4022
|
-
}
|
|
4023
|
-
else {
|
|
4024
|
-
subNode.bindedvalue = classFunction(this.templateData);
|
|
4025
|
-
}
|
|
4026
|
-
subNode.onChange = (value) => {
|
|
4027
|
-
if (subNode.bindedvalue) {
|
|
4028
|
-
removeClass([element], subNode.bindedvalue.split(' ').filter((css) => css));
|
|
4029
|
-
}
|
|
4030
|
-
const newCss = classFunction(value);
|
|
4031
|
-
if (newCss) {
|
|
4032
|
-
addClass([element], (newCss).split(' ').filter((css) => css));
|
|
4033
|
-
}
|
|
4034
|
-
subNode.bindedvalue = newCss;
|
|
4035
|
-
};
|
|
4036
|
-
const className = classNameMatch[0].split(' ');
|
|
4037
|
-
for (let i = 0; i < className.length; i++) {
|
|
4038
|
-
element.classList.remove(className[i]);
|
|
4039
|
-
}
|
|
4040
|
-
if (subNode.bindedvalue) {
|
|
4041
|
-
addClass([element], subNode.bindedvalue.split(' ').filter((css) => css));
|
|
4042
|
-
}
|
|
4043
|
-
this.updateContextData(listElement, subNode, isHeader);
|
|
4044
|
-
}
|
|
4045
|
-
}
|
|
4046
|
-
}
|
|
4047
|
-
attributeProperty(element, listElement, isHeader) {
|
|
4048
|
-
const attributeNames = [];
|
|
4049
|
-
for (let i = 0; i < element.attributes.length; i++) {
|
|
4050
|
-
attributeNames.push(element.attributes[i].nodeName);
|
|
4051
|
-
}
|
|
4052
|
-
if (attributeNames.indexOf('class') !== -1) {
|
|
4053
|
-
attributeNames.splice(attributeNames.indexOf('class'), 1);
|
|
4054
|
-
}
|
|
4055
|
-
for (let i = 0; i < attributeNames.length; i++) {
|
|
4056
|
-
const attributeName = attributeNames[i];
|
|
4057
|
-
const attrNameMatch = new RegExp('\\${([^}]*)}', 'g').exec(attributeName) || [];
|
|
4058
|
-
const attrValueMatch = new RegExp('\\${([^}]*)}', 'g').exec(element.getAttribute(attributeName))
|
|
4059
|
-
|| [];
|
|
4060
|
-
// eslint-disable-next-line
|
|
4061
|
-
let attributeNameFunction;
|
|
4062
|
-
// eslint-disable-next-line
|
|
4063
|
-
let attributeValueFunction;
|
|
4064
|
-
if (attrNameMatch.length || attrValueMatch.length) {
|
|
4065
|
-
if (attrNameMatch[1]) {
|
|
4066
|
-
// tslint:disable-next-line:no-function-constructor-with-string-args
|
|
4067
|
-
attributeNameFunction = new Function('data', 'return ' + 'data.' + attrNameMatch[1]);
|
|
4068
|
-
}
|
|
4069
|
-
if (attrValueMatch[1]) {
|
|
4070
|
-
if (attrValueMatch[1].indexOf('?') !== -1 && attrValueMatch[1].indexOf(':') !== -1) {
|
|
4071
|
-
// tslint:disable-next-line:no-function-constructor-with-string-args
|
|
4072
|
-
attributeValueFunction = new Function('data', 'return ' + attrValueMatch[1].replace(/\$/g, 'data.'));
|
|
4073
|
-
}
|
|
4074
|
-
else {
|
|
4075
|
-
// tslint:disable-next-line:no-function-constructor-with-string-args
|
|
4076
|
-
attributeValueFunction = new Function('data', 'return ' + 'data.' + attrValueMatch[1]);
|
|
4077
|
-
}
|
|
4078
|
-
}
|
|
4079
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
4080
|
-
const subNode = {};
|
|
4081
|
-
if (isHeader) {
|
|
4082
|
-
subNode.bindedvalue = [attrNameMatch[1] === undefined ? undefined : attributeNameFunction(this.headerData),
|
|
4083
|
-
attrValueMatch[1] === undefined ? undefined : attributeValueFunction(this.headerData)];
|
|
4084
|
-
}
|
|
4085
|
-
else {
|
|
4086
|
-
subNode.bindedvalue = [attrNameMatch[1] === undefined ? undefined : attributeNameFunction(this.templateData),
|
|
4087
|
-
attrValueMatch[1] === undefined ? undefined : attributeValueFunction(this.templateData)];
|
|
4088
|
-
}
|
|
4089
|
-
subNode.attrName = subNode.bindedvalue[0] === undefined ?
|
|
4090
|
-
attributeName : subNode.bindedvalue[0];
|
|
4091
|
-
subNode.onChange = (value) => {
|
|
4092
|
-
const bindedvalue = subNode.bindedvalue[1] === undefined ?
|
|
4093
|
-
element.getAttribute(subNode.attrName) : attributeValueFunction(value);
|
|
4094
|
-
element.removeAttribute(subNode.attrName);
|
|
4095
|
-
subNode.attrName = subNode.bindedvalue[0] === undefined ? subNode.attrName : attributeNameFunction(value);
|
|
4096
|
-
element.setAttribute(subNode.attrName, bindedvalue);
|
|
4097
|
-
subNode.bindedvalue = [subNode.bindedvalue[0] === undefined ? undefined : attributeNameFunction(value),
|
|
4098
|
-
subNode.bindedvalue[1] === undefined ? undefined : attributeValueFunction(value)];
|
|
4099
|
-
};
|
|
4100
|
-
const attributeValue = subNode.bindedvalue[1] === undefined ? element.getAttribute(attributeName) :
|
|
4101
|
-
subNode.bindedvalue[1];
|
|
4102
|
-
element.removeAttribute(attributeName);
|
|
4103
|
-
element.setAttribute(subNode.attrName, attributeValue);
|
|
4104
|
-
this.updateContextData(listElement, subNode, isHeader);
|
|
4105
|
-
}
|
|
4106
|
-
}
|
|
4107
|
-
}
|
|
4108
|
-
textProperty(element, listElement, isHeader) {
|
|
4109
|
-
const regex = new RegExp('\\${([^}]*)}', 'g');
|
|
4110
|
-
const resultantOutput = [];
|
|
4111
|
-
let regexMatch;
|
|
4112
|
-
while (regexMatch !== null) {
|
|
4113
|
-
const match = regex.exec(element.innerText);
|
|
4114
|
-
resultantOutput.push(match);
|
|
4115
|
-
regexMatch = match;
|
|
4116
|
-
if (regexMatch === null) {
|
|
4117
|
-
resultantOutput.pop();
|
|
4118
|
-
}
|
|
4119
|
-
}
|
|
4120
|
-
const isChildHasTextContent = Array.prototype.some.call(element.children, (element) => {
|
|
4121
|
-
if (new RegExp('\\${([^}]*)}', 'g').exec(element.innerText)) {
|
|
4122
|
-
return true;
|
|
4123
|
-
}
|
|
4124
|
-
else {
|
|
4125
|
-
return false;
|
|
4126
|
-
}
|
|
4127
|
-
});
|
|
4128
|
-
if (resultantOutput && resultantOutput.length && !isChildHasTextContent) {
|
|
4129
|
-
for (let i = 0; i < resultantOutput.length; i++) {
|
|
4130
|
-
const textPropertyMatch = resultantOutput[i];
|
|
4131
|
-
// eslint-disable-next-line
|
|
4132
|
-
const subNode = {};
|
|
4133
|
-
// eslint-disable-next-line
|
|
4134
|
-
let textFunction;
|
|
4135
|
-
if (textPropertyMatch[1].indexOf('?') !== -1 && textPropertyMatch[1].indexOf(':') !== -1) {
|
|
4136
|
-
// tslint:disable-next-line:no-function-constructor-with-string-args
|
|
4137
|
-
textFunction = new Function('data', 'return ' + textPropertyMatch[1].replace(/\$/g, 'data.'));
|
|
4138
|
-
}
|
|
4139
|
-
else {
|
|
4140
|
-
// tslint:disable-next-line:no-function-constructor-with-string-args
|
|
4141
|
-
textFunction = new Function('data', 'return ' + 'data.' + textPropertyMatch[1]);
|
|
4142
|
-
}
|
|
4143
|
-
if (isHeader) {
|
|
4144
|
-
subNode.bindedvalue = textFunction(this.headerData);
|
|
4145
|
-
}
|
|
4146
|
-
else {
|
|
4147
|
-
subNode.bindedvalue = textFunction(this.templateData);
|
|
4148
|
-
}
|
|
4149
|
-
subNode.onChange = (value) => {
|
|
4150
|
-
element.innerText = element.innerText.replace(subNode.bindedvalue, textFunction(value));
|
|
4151
|
-
subNode.bindedvalue = textFunction(value);
|
|
4152
|
-
};
|
|
4153
|
-
element.innerText = element.innerText.replace(textPropertyMatch[0], subNode.bindedvalue);
|
|
4154
|
-
this.updateContextData(listElement, subNode, isHeader);
|
|
4155
|
-
}
|
|
4156
|
-
}
|
|
4157
|
-
}
|
|
4158
4043
|
reRenderUiVirtualization() {
|
|
4159
4044
|
this.wireScrollEvent(true);
|
|
4160
4045
|
if (this.listViewInstance.contentContainer) {
|