@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
package/dist/global/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* filename: index.d.ts
|
|
3
|
-
* version : 23.
|
|
3
|
+
* version : 23.2.4
|
|
4
4
|
* Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
|
|
5
5
|
* Use of this code is subject to the terms of our license.
|
|
6
6
|
* A copy of the current license can be obtained at any time by e-mailing
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_from": "@syncfusion/ej2-lists@*",
|
|
3
|
-
"_id": "@syncfusion/ej2-lists@
|
|
3
|
+
"_id": "@syncfusion/ej2-lists@23.1.43",
|
|
4
4
|
"_inBundle": false,
|
|
5
|
-
"_integrity": "sha512-
|
|
5
|
+
"_integrity": "sha512-ZxZ2s8B0jIlHbLi8qgl0OTos0aGYcIV7SW8DITGgwBWX6Orh+hxs/AnQ0YiqL7zwFtJe+E5oo2cctD0Fj6yi8Q==",
|
|
6
6
|
"_location": "/@syncfusion/ej2-lists",
|
|
7
7
|
"_phantomChildren": {},
|
|
8
8
|
"_requested": {
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"/@syncfusion/ej2-schedule",
|
|
36
36
|
"/@syncfusion/ej2-vue-lists"
|
|
37
37
|
],
|
|
38
|
-
"_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-lists/-/ej2-lists-
|
|
39
|
-
"_shasum": "
|
|
38
|
+
"_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-lists/-/ej2-lists-23.1.43.tgz",
|
|
39
|
+
"_shasum": "597cc14fc40bb16eb42cc9c91a539e19230c8380",
|
|
40
40
|
"_spec": "@syncfusion/ej2-lists@*",
|
|
41
41
|
"_where": "/jenkins/workspace/elease-automation_release_23.1.1/packages/included",
|
|
42
42
|
"author": {
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
},
|
|
45
45
|
"bundleDependencies": false,
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@syncfusion/ej2-base": "~23.
|
|
48
|
-
"@syncfusion/ej2-buttons": "~23.
|
|
49
|
-
"@syncfusion/ej2-data": "~23.
|
|
47
|
+
"@syncfusion/ej2-base": "~23.2.4",
|
|
48
|
+
"@syncfusion/ej2-buttons": "~23.2.4",
|
|
49
|
+
"@syncfusion/ej2-data": "~23.2.4"
|
|
50
50
|
},
|
|
51
51
|
"deprecated": false,
|
|
52
52
|
"description": "The listview control allows you to select an item or multiple items from a list-like interface and represents the data in interactive hierarchical structure across different layouts or views.",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"url": "https://github.com/syncfusion/ej2-javascript-ui-controls/tree/master/controls/lists"
|
|
87
87
|
},
|
|
88
88
|
"typings": "index.d.ts",
|
|
89
|
-
"version": "23.
|
|
89
|
+
"version": "23.2.4",
|
|
90
90
|
"sideEffects": false,
|
|
91
91
|
"homepage": "https://www.syncfusion.com/javascript-ui-controls"
|
|
92
92
|
}
|
package/src/common/list-base.js
CHANGED
|
@@ -286,7 +286,8 @@ export 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]) {
|
|
@@ -556,11 +556,13 @@ export declare class ListView extends Component<HTMLElement> implements INotifyP
|
|
|
556
556
|
*
|
|
557
557
|
* @param {Fields} fields - Target item to add the given data as its children (can be null).
|
|
558
558
|
*
|
|
559
|
+
* @param {number} index - Indicates the index where the data to be added.
|
|
559
560
|
*/
|
|
560
561
|
addItem(data: {
|
|
561
562
|
[key: string]: Object;
|
|
562
|
-
}[], fields?: Fields): void;
|
|
563
|
+
}[], fields?: Fields, index?: number): void;
|
|
563
564
|
private addItemInternally;
|
|
565
|
+
private addItemAtIndex;
|
|
564
566
|
private addItemInNestedList;
|
|
565
567
|
private addItemIntoDom;
|
|
566
568
|
private addListItem;
|
|
@@ -1773,17 +1773,18 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1773
1773
|
*
|
|
1774
1774
|
* @param {Fields} fields - Target item to add the given data as its children (can be null).
|
|
1775
1775
|
*
|
|
1776
|
+
* @param {number} index - Indicates the index where the data to be added.
|
|
1776
1777
|
*/
|
|
1777
|
-
ListView.prototype.addItem = function (data, fields) {
|
|
1778
|
+
ListView.prototype.addItem = function (data, fields, index) {
|
|
1778
1779
|
if (fields === void 0) { fields = undefined; }
|
|
1779
1780
|
var dataSource = this.dataSource instanceof DataManager
|
|
1780
1781
|
? this.localData : this.dataSource;
|
|
1781
|
-
this.addItemInternally(data, fields, dataSource);
|
|
1782
|
+
this.addItemInternally(data, fields, dataSource, index);
|
|
1782
1783
|
};
|
|
1783
|
-
ListView.prototype.addItemInternally = function (data, fields, dataSource) {
|
|
1784
|
+
ListView.prototype.addItemInternally = function (data, fields, dataSource, index) {
|
|
1784
1785
|
if (data instanceof Array) {
|
|
1785
1786
|
if (this.enableVirtualization) {
|
|
1786
|
-
this.virtualizationModule.addItem(data, fields, dataSource);
|
|
1787
|
+
this.virtualizationModule.addItem(data, fields, dataSource, index);
|
|
1787
1788
|
}
|
|
1788
1789
|
else {
|
|
1789
1790
|
var ds = this.findItemFromDS(dataSource, fields);
|
|
@@ -1799,7 +1800,7 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1799
1800
|
// check for whether target is nested level or top level in list
|
|
1800
1801
|
if (ds instanceof Array) {
|
|
1801
1802
|
for (var i = 0; i < data.length; i++) {
|
|
1802
|
-
dataSource.
|
|
1803
|
+
dataSource = this.addItemAtIndex(index, dataSource, data[i]);
|
|
1803
1804
|
this.setViewDataSource(dataSource);
|
|
1804
1805
|
// since it is top level target, get the content container's first child
|
|
1805
1806
|
// as it is always the top level UL
|
|
@@ -1827,6 +1828,16 @@ var ListView = /** @class */ (function (_super) {
|
|
|
1827
1828
|
}
|
|
1828
1829
|
}
|
|
1829
1830
|
};
|
|
1831
|
+
ListView.prototype.addItemAtIndex = function (index, newDataSource, itemData) {
|
|
1832
|
+
var isIndexValid = !(isNullOrUndefined(index)) && index >= 0 && index < newDataSource.length && isNullOrUndefined(this.listBaseOption.fields.groupBy);
|
|
1833
|
+
if (isIndexValid) {
|
|
1834
|
+
newDataSource.splice(index, 0, itemData);
|
|
1835
|
+
}
|
|
1836
|
+
else {
|
|
1837
|
+
newDataSource.push(itemData);
|
|
1838
|
+
}
|
|
1839
|
+
return newDataSource;
|
|
1840
|
+
};
|
|
1830
1841
|
ListView.prototype.addItemInNestedList = function (targetItemData, itemQueue) {
|
|
1831
1842
|
// eslint-disable-next-line
|
|
1832
1843
|
var targetItemId = targetItemData[this.fields.id];
|
|
@@ -10,7 +10,6 @@ export interface ElementContext extends HTMLElement {
|
|
|
10
10
|
export declare class Virtualization {
|
|
11
11
|
constructor(instance: ListView);
|
|
12
12
|
private listViewInstance;
|
|
13
|
-
private headerData;
|
|
14
13
|
private templateData;
|
|
15
14
|
private topElementHeight;
|
|
16
15
|
private bottomElementHeight;
|
|
@@ -31,9 +30,6 @@ export declare class Virtualization {
|
|
|
31
30
|
private uiIndices;
|
|
32
31
|
private listDiff;
|
|
33
32
|
private elementDifference;
|
|
34
|
-
private templateFunction;
|
|
35
|
-
private groupTemplateFunction;
|
|
36
|
-
private commonTemplate;
|
|
37
33
|
/**
|
|
38
34
|
* For internal use only.
|
|
39
35
|
*
|
|
@@ -77,12 +73,9 @@ export declare class Virtualization {
|
|
|
77
73
|
private addUiItem;
|
|
78
74
|
private removeUiItem;
|
|
79
75
|
private changeUiIndices;
|
|
80
|
-
addItem(data: DataSource[], fields: Fields, dataSource: DataSource[]): void;
|
|
76
|
+
addItem(data: DataSource[], fields: Fields, dataSource: DataSource[], index: number): void;
|
|
81
77
|
private createAndInjectNewItem;
|
|
82
78
|
createUIItem(args: ItemCreatedArgs): void;
|
|
83
|
-
private compileTemplate;
|
|
84
|
-
private onChange;
|
|
85
|
-
private updateContextData;
|
|
86
79
|
reRenderUiVirtualization(): void;
|
|
87
80
|
private updateUI;
|
|
88
81
|
/**
|
|
@@ -92,7 +85,7 @@ export declare class Virtualization {
|
|
|
92
85
|
* @param {ElementContext} listElement - The HTML element context for the list view.
|
|
93
86
|
* @param {Virtualization} virtualThis - The virtualization context for the list view.
|
|
94
87
|
*/
|
|
95
|
-
private
|
|
88
|
+
private onChange;
|
|
96
89
|
private onNgChange;
|
|
97
90
|
getModuleName(): string;
|
|
98
91
|
destroy(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { classNames } from './list-view';
|
|
2
|
-
import { EventHandler, append, isNullOrUndefined, detach,
|
|
2
|
+
import { EventHandler, append, isNullOrUndefined, detach, compile, formatUnit, select } from '@syncfusion/ej2-base';
|
|
3
3
|
import { ListBase } from '../common/list-base';
|
|
4
4
|
import { DataManager } from '@syncfusion/ej2-data';
|
|
5
5
|
var listElementCount = 1.5;
|
|
@@ -31,10 +31,6 @@ var Virtualization = /** @class */ (function () {
|
|
|
31
31
|
* @private
|
|
32
32
|
*/
|
|
33
33
|
Virtualization.prototype.uiVirtualization = function () {
|
|
34
|
-
this.commonTemplate = '<div class="e-text-content" role="presentation"> ' +
|
|
35
|
-
'<span class="e-list-text"> ${' + this.listViewInstance.fields.text + '} </span></div>';
|
|
36
|
-
this.templateFunction = compile(this.listViewInstance.template || this.commonTemplate, this.listViewInstance);
|
|
37
|
-
this.groupTemplateFunction = compile(this.listViewInstance.groupTemplate || this.commonTemplate, this.listViewInstance);
|
|
38
34
|
this.wireScrollEvent(false);
|
|
39
35
|
var curViewDS = this.listViewInstance.curViewDS;
|
|
40
36
|
var firstDs = curViewDS.slice(0, 1);
|
|
@@ -167,6 +163,9 @@ var Virtualization = /** @class */ (function () {
|
|
|
167
163
|
Virtualization.prototype.onVirtualUiScroll = function (e) {
|
|
168
164
|
var _a;
|
|
169
165
|
var startingHeight;
|
|
166
|
+
var curViewDS = this.listViewInstance.curViewDS;
|
|
167
|
+
this.listItemHeight = select(".e-list-item", this.listViewInstance.element).getBoundingClientRect().height;
|
|
168
|
+
this.totalHeight = (Object.keys(curViewDS).length * this.listItemHeight) - (this.domItemCount * this.listItemHeight);
|
|
170
169
|
if (this.listViewInstance.isWindow) {
|
|
171
170
|
startingHeight = this.listViewInstance.ulElement.getBoundingClientRect().top -
|
|
172
171
|
document.documentElement.getBoundingClientRect().top;
|
|
@@ -282,7 +281,13 @@ var Virtualization = /** @class */ (function () {
|
|
|
282
281
|
if (!element.querySelector('.' + classNames.checkboxWrapper)) {
|
|
283
282
|
element.classList.add(classNames.checklist);
|
|
284
283
|
textContent.classList.add(classNames.checkbox);
|
|
285
|
-
|
|
284
|
+
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
285
|
+
textContent.classList.add('e-checkbox-left');
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
textContent.classList.add('e-checkbox-right');
|
|
289
|
+
}
|
|
290
|
+
textContent.append(this.checkListWrapper.cloneNode(true));
|
|
286
291
|
}
|
|
287
292
|
}
|
|
288
293
|
}
|
|
@@ -706,11 +711,11 @@ var Virtualization = /** @class */ (function () {
|
|
|
706
711
|
});
|
|
707
712
|
}
|
|
708
713
|
};
|
|
709
|
-
Virtualization.prototype.addItem = function (data, fields, dataSource) {
|
|
714
|
+
Virtualization.prototype.addItem = function (data, fields, dataSource, index) {
|
|
710
715
|
for (var i = 0; i < data.length; i++) {
|
|
711
716
|
var currentItem = data[i];
|
|
712
717
|
// push the given data to main data array
|
|
713
|
-
dataSource.
|
|
718
|
+
dataSource = this.listViewInstance.addItemAtIndex(index, dataSource, currentItem);
|
|
714
719
|
// recalculate all the group data or other datasource related things
|
|
715
720
|
this.listViewInstance.setViewDataSource(dataSource);
|
|
716
721
|
// render list items for first time due to no datasource present earlier
|
|
@@ -728,16 +733,16 @@ var Virtualization = /** @class */ (function () {
|
|
|
728
733
|
var ds = this.listViewInstance.findItemFromDS(dataSource, fields);
|
|
729
734
|
if (ds instanceof Array) {
|
|
730
735
|
if (this.listViewInstance.ulElement) {
|
|
731
|
-
var
|
|
736
|
+
var index_1 = this.listViewInstance.curViewDS.indexOf(currentItem);
|
|
732
737
|
// inject new list item into DOM
|
|
733
|
-
this.createAndInjectNewItem(currentItem,
|
|
738
|
+
this.createAndInjectNewItem(currentItem, index_1);
|
|
734
739
|
// check for group header item
|
|
735
|
-
var curViewDS = this.listViewInstance.curViewDS[
|
|
740
|
+
var curViewDS = this.listViewInstance.curViewDS[index_1 - 1];
|
|
736
741
|
if (curViewDS && curViewDS.isHeader && curViewDS.items.length === 1) {
|
|
737
742
|
// target group item index in datasource
|
|
738
|
-
--
|
|
743
|
+
--index_1;
|
|
739
744
|
// inject new group header into DOM for previously created list item
|
|
740
|
-
this.createAndInjectNewItem(curViewDS,
|
|
745
|
+
this.createAndInjectNewItem(curViewDS, index_1);
|
|
741
746
|
}
|
|
742
747
|
}
|
|
743
748
|
// recollect all the list item into collection
|
|
@@ -747,13 +752,13 @@ var Virtualization = /** @class */ (function () {
|
|
|
747
752
|
}
|
|
748
753
|
else {
|
|
749
754
|
// eslint-disable-next-line
|
|
750
|
-
var
|
|
755
|
+
var index_2 = this.listViewInstance.curViewDS.indexOf(currentItem);
|
|
751
756
|
// virtually new add list item based on the scollbar position
|
|
752
|
-
this.addUiItem(
|
|
757
|
+
this.addUiItem(index_2);
|
|
753
758
|
// check for group header item needs to be added
|
|
754
|
-
var curViewDS = this.listViewInstance.curViewDS[
|
|
759
|
+
var curViewDS = this.listViewInstance.curViewDS[index_2 - 1];
|
|
755
760
|
if (curViewDS && curViewDS.isHeader && curViewDS.items.length === 1) {
|
|
756
|
-
this.addUiItem(
|
|
761
|
+
this.addUiItem(index_2 - 1);
|
|
757
762
|
}
|
|
758
763
|
}
|
|
759
764
|
}
|
|
@@ -790,192 +795,50 @@ var Virtualization = /** @class */ (function () {
|
|
|
790
795
|
this.refreshItemHeight();
|
|
791
796
|
};
|
|
792
797
|
Virtualization.prototype.createUIItem = function (args) {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
}
|
|
809
|
-
[].slice.call(nodes).forEach(function (ele) {
|
|
810
|
-
div_1.appendChild(ele);
|
|
811
|
-
});
|
|
812
|
-
if (div_1.children && div_1.children[0]) {
|
|
813
|
-
div_1.children[0].classList.add('e-checkbox');
|
|
814
|
-
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
815
|
-
div_1.children[0].classList.add('e-checkbox-left');
|
|
816
|
-
}
|
|
817
|
-
else {
|
|
818
|
-
div_1.children[0].classList.add('e-checkbox-right');
|
|
819
|
-
}
|
|
820
|
-
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
821
|
-
div_1.children[0].insertBefore(this.listViewInstance.virtualCheckBox, div_1.childNodes[0].children[0]);
|
|
822
|
-
}
|
|
823
|
-
else {
|
|
824
|
-
div_1.children[0].appendChild(this.listViewInstance.virtualCheckBox);
|
|
798
|
+
if (!args.item.classList.contains("e-list-group-item")) {
|
|
799
|
+
this.templateData = args.curData.isHeader ? args.curData.items[0] :
|
|
800
|
+
args.curData;
|
|
801
|
+
if (this.listViewInstance.showCheckBox) {
|
|
802
|
+
// eslint-disable-next-line
|
|
803
|
+
this.listViewInstance.renderCheckbox(args);
|
|
804
|
+
if ((!isNullOrUndefined(this.listViewInstance.virtualCheckBox)) &&
|
|
805
|
+
(!isNullOrUndefined(this.listViewInstance.virtualCheckBox.outerHTML))) {
|
|
806
|
+
var div_1 = document.createElement('div');
|
|
807
|
+
var commonTemplate = '<div class="e-text-content" role="presentation"> ' +
|
|
808
|
+
'<span class="e-list-text"> ${' + this.listViewInstance.fields.text + '} </span></div>';
|
|
809
|
+
var templateFunction = compile(this.listViewInstance.template || commonTemplate, this.listViewInstance);
|
|
810
|
+
var nodes = templateFunction(this.templateData, this.listViewInstance);
|
|
811
|
+
if (this.listViewInstance.template && this.listViewInstance.isReact) {
|
|
812
|
+
this.listViewInstance.renderReactTemplates();
|
|
825
813
|
}
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
}
|
|
850
|
-
if (args.curData.isHeader) {
|
|
851
|
-
this.headerData = args.curData;
|
|
852
|
-
}
|
|
853
|
-
var groupTemplate = this.listViewInstance.createElement('div');
|
|
854
|
-
if (this.listViewInstance.fields.groupBy) {
|
|
855
|
-
var nodes = this.groupTemplateFunction(this.headerData, this.listViewInstance);
|
|
856
|
-
if (this.listViewInstance.template && this.listViewInstance.isReact) {
|
|
857
|
-
this.listViewInstance.renderReactTemplates();
|
|
858
|
-
}
|
|
859
|
-
[].slice.call(nodes).forEach(function (ele) {
|
|
860
|
-
groupTemplate.appendChild(ele);
|
|
861
|
-
});
|
|
862
|
-
}
|
|
863
|
-
if ((!this.listViewInstance.isReact || (typeof this.listViewInstance.template == "string" && !args.item.classList.contains("e-list-group-item")) ||
|
|
864
|
-
(typeof this.listViewInstance.groupTemplate == "string" && args.item.classList.contains("e-list-group-item"))) && !this.listViewInstance.isVue) {
|
|
865
|
-
args.item.innerHTML = '';
|
|
866
|
-
}
|
|
867
|
-
args.item.context = { data: args.curData, nodes: { flatTemplateNodes: [], groupTemplateNodes: [] } };
|
|
868
|
-
for (var i = 0; i < template.children.length; i++) {
|
|
869
|
-
this.compileTemplate(template.children[i], args.item, false);
|
|
870
|
-
}
|
|
871
|
-
for (var i = 0; i < groupTemplate.children.length; i++) {
|
|
872
|
-
this.compileTemplate(groupTemplate.children[i], args.item, true);
|
|
873
|
-
}
|
|
874
|
-
args.item.context.template = args.curData.isHeader ? template.firstElementChild :
|
|
875
|
-
groupTemplate.firstElementChild;
|
|
876
|
-
args.item.context.type = args.curData.isHeader ? 'flatList' : 'groupList';
|
|
877
|
-
var element = args.curData.isHeader ? groupTemplate : template;
|
|
878
|
-
if (element.firstElementChild && !this.listViewInstance.isReact && !this.listViewInstance.isVue) {
|
|
879
|
-
args.item.insertBefore(element.firstElementChild, null);
|
|
880
|
-
}
|
|
881
|
-
};
|
|
882
|
-
Virtualization.prototype.compileTemplate = function (element, item, isHeader) {
|
|
883
|
-
var _this = this;
|
|
884
|
-
var subNode = {};
|
|
885
|
-
subNode.onChange = function (value) {
|
|
886
|
-
var groupTemplateElements;
|
|
887
|
-
var templateElements;
|
|
888
|
-
if (_this.listViewInstance.isVue) {
|
|
889
|
-
groupTemplateElements = _this.groupTemplateFunction(value);
|
|
890
|
-
templateElements = _this.templateFunction(value);
|
|
891
|
-
}
|
|
892
|
-
else {
|
|
893
|
-
groupTemplateElements = _this.groupTemplateFunction(value, _this.listViewInstance);
|
|
894
|
-
templateElements = _this.templateFunction(value, _this.listViewInstance);
|
|
895
|
-
}
|
|
896
|
-
if (_this.listViewInstance.template && _this.listViewInstance.isReact) {
|
|
897
|
-
_this.listViewInstance.renderReactTemplates();
|
|
898
|
-
}
|
|
899
|
-
var currentTemplate = templateElements;
|
|
900
|
-
if (value.isHeader) {
|
|
901
|
-
currentTemplate = groupTemplateElements;
|
|
902
|
-
}
|
|
903
|
-
[].slice.call(currentTemplate).forEach(function (currentElement) {
|
|
904
|
-
var RemovableClass = element.classList.value.replace('e-checkbox', '');
|
|
905
|
-
RemovableClass = RemovableClass.replace('e-checkbox-left', '');
|
|
906
|
-
RemovableClass = RemovableClass.replace('e-checkbox-right', '');
|
|
907
|
-
removeClass([element], RemovableClass.split(' ').filter(function (css) { return css; }));
|
|
908
|
-
addClass([element], Array.from(currentElement.classList));
|
|
909
|
-
for (var i = 0; i < element.attributes.length; i++) {
|
|
910
|
-
if (element.attributes[i].name != 'class') {
|
|
911
|
-
var newData = currentElement.getAttribute(element.attributes[i].name);
|
|
912
|
-
element.setAttribute(element.attributes[i].name, newData);
|
|
814
|
+
[].slice.call(nodes).forEach(function (ele) {
|
|
815
|
+
div_1.appendChild(ele);
|
|
816
|
+
});
|
|
817
|
+
if (div_1.children && div_1.children[0]) {
|
|
818
|
+
div_1.children[0].classList.add('e-checkbox');
|
|
819
|
+
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
820
|
+
div_1.children[0].classList.add('e-checkbox-left');
|
|
821
|
+
}
|
|
822
|
+
else {
|
|
823
|
+
div_1.children[0].classList.add('e-checkbox-right');
|
|
824
|
+
}
|
|
825
|
+
if (this.listViewInstance.checkBoxPosition === 'Left') {
|
|
826
|
+
div_1.children[0].insertBefore(this.listViewInstance.virtualCheckBox, div_1.childNodes[0].children[0]);
|
|
827
|
+
}
|
|
828
|
+
else {
|
|
829
|
+
div_1.children[0].appendChild(this.listViewInstance.virtualCheckBox);
|
|
830
|
+
}
|
|
831
|
+
while (args.item.lastChild) {
|
|
832
|
+
args.item.removeChild(args.item.lastChild);
|
|
833
|
+
}
|
|
834
|
+
[].slice.call(div_1.children).forEach(function (ele) {
|
|
835
|
+
args.item.appendChild(ele);
|
|
836
|
+
});
|
|
913
837
|
}
|
|
914
838
|
}
|
|
915
|
-
[].slice.call(element.children).forEach(function (ele) {
|
|
916
|
-
if (!ele.classList.contains('e-listview-checkbox') && !(ele.classList.contains('e-checkbox-left') || ele.classList.contains('e-checkbox-right'))) {
|
|
917
|
-
ele.remove();
|
|
918
|
-
}
|
|
919
|
-
});
|
|
920
|
-
[].slice.call(currentElement.children).forEach(function (ele) {
|
|
921
|
-
element.appendChild(ele);
|
|
922
|
-
});
|
|
923
|
-
});
|
|
924
|
-
};
|
|
925
|
-
this.updateContextData(item, subNode, isHeader);
|
|
926
|
-
};
|
|
927
|
-
Virtualization.prototype.onChange = function (newData, listElement) {
|
|
928
|
-
listElement.context.data = newData;
|
|
929
|
-
// eslint-disable-next-line max-len
|
|
930
|
-
var groupTemplateNodes = listElement.context.nodes.groupTemplateNodes;
|
|
931
|
-
// eslint-disable-next-line max-len
|
|
932
|
-
var flatTemplateNodes = listElement.context.nodes.flatTemplateNodes;
|
|
933
|
-
// eslint-disable-next-line
|
|
934
|
-
if (!isNullOrUndefined(newData.isHeader) && newData.isHeader && listElement.context.type === 'groupList') {
|
|
935
|
-
// eslint-disable-next-line
|
|
936
|
-
var element = listElement.firstElementChild;
|
|
937
|
-
detach(listElement.firstElementChild);
|
|
938
|
-
listElement.insertBefore(listElement.context.template, null);
|
|
939
|
-
listElement.context.template = element;
|
|
940
|
-
listElement.context.type = 'flatList';
|
|
941
|
-
for (var i = 0; i < groupTemplateNodes.length; i++) {
|
|
942
|
-
// eslint-disable-next-line
|
|
943
|
-
groupTemplateNodes[i].onChange(newData);
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
else if (!newData.isHeader && listElement.context.type === 'flatList') {
|
|
947
|
-
var element = listElement.firstElementChild;
|
|
948
|
-
detach(listElement.firstElementChild);
|
|
949
|
-
listElement.insertBefore(listElement.context.template, null);
|
|
950
|
-
listElement.context.template = element;
|
|
951
|
-
listElement.context.type = 'groupList';
|
|
952
|
-
for (var i = 0; i < flatTemplateNodes.length; i++) {
|
|
953
|
-
// eslint-disable-next-line
|
|
954
|
-
flatTemplateNodes[i].onChange(newData);
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
else if (!newData.isHeader) {
|
|
958
|
-
for (var i = 0; i < flatTemplateNodes.length; i++) {
|
|
959
|
-
// eslint-disable-next-line
|
|
960
|
-
flatTemplateNodes[i].onChange(newData);
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
else {
|
|
964
|
-
for (var i = 0; i < groupTemplateNodes.length; i++) {
|
|
965
|
-
// eslint-disable-next-line
|
|
966
|
-
groupTemplateNodes[i].onChange(newData);
|
|
967
839
|
}
|
|
968
840
|
}
|
|
969
841
|
};
|
|
970
|
-
// eslint-disable-next-line
|
|
971
|
-
Virtualization.prototype.updateContextData = function (listElement, node, isHeader) {
|
|
972
|
-
if (isHeader) {
|
|
973
|
-
listElement.context.nodes.groupTemplateNodes.push(node);
|
|
974
|
-
}
|
|
975
|
-
else {
|
|
976
|
-
listElement.context.nodes.flatTemplateNodes.push(node);
|
|
977
|
-
}
|
|
978
|
-
};
|
|
979
842
|
Virtualization.prototype.reRenderUiVirtualization = function () {
|
|
980
843
|
this.wireScrollEvent(true);
|
|
981
844
|
if (this.listViewInstance.contentContainer) {
|
|
@@ -990,7 +853,7 @@ var Virtualization = /** @class */ (function () {
|
|
|
990
853
|
};
|
|
991
854
|
Virtualization.prototype.updateUI = function (element, index, targetElement) {
|
|
992
855
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
993
|
-
var onChange = this.isNgTemplate() ? this.onNgChange :
|
|
856
|
+
var onChange = this.isNgTemplate() ? this.onNgChange : this.onChange;
|
|
994
857
|
if (this.listViewInstance.template || this.listViewInstance.groupTemplate) {
|
|
995
858
|
var curViewDS = this.listViewInstance.curViewDS[index];
|
|
996
859
|
// eslint-disable-next-line
|
|
@@ -1014,14 +877,19 @@ var Virtualization = /** @class */ (function () {
|
|
|
1014
877
|
* @param {ElementContext} listElement - The HTML element context for the list view.
|
|
1015
878
|
* @param {Virtualization} virtualThis - The virtualization context for the list view.
|
|
1016
879
|
*/
|
|
1017
|
-
Virtualization.prototype.
|
|
880
|
+
Virtualization.prototype.onChange = function (newData, listElement, virtualThis) {
|
|
1018
881
|
var liItem = ListBase.createListItemFromJson(virtualThis.listViewInstance.createElement,
|
|
1019
882
|
// eslint-disable-next-line
|
|
1020
883
|
[newData], virtualThis.listViewInstance.listBaseOption, null, null, virtualThis.listViewInstance);
|
|
884
|
+
if (virtualThis.listViewInstance.isReact) {
|
|
885
|
+
virtualThis.listViewInstance.renderReactTemplates();
|
|
886
|
+
}
|
|
1021
887
|
while (listElement.lastChild) {
|
|
1022
888
|
listElement.removeChild(listElement.lastChild);
|
|
1023
889
|
}
|
|
1024
|
-
|
|
890
|
+
[].slice.call(liItem[0].children).forEach(function (ele) {
|
|
891
|
+
listElement.appendChild(ele);
|
|
892
|
+
});
|
|
1025
893
|
};
|
|
1026
894
|
Virtualization.prototype.onNgChange = function (newData, listElement, virtualThis) {
|
|
1027
895
|
// compile given target element with template for new data
|