@syncfusion/ej2-lists 23.2.4 → 24.1.41
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 +0 -10
- 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 +48 -57
- package/dist/es6/ej2-lists.es2015.js.map +1 -1
- package/dist/es6/ej2-lists.es5.js +44 -53
- 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 +10 -9
- package/src/common/list-base.js +10 -13
- package/src/list-view/list-view-model.d.ts +8 -1
- package/src/list-view/list-view.d.ts +34 -0
- package/src/list-view/list-view.js +32 -35
- package/src/list-view/virtualization.js +2 -5
- package/styles/bootstrap4.css +2 -2
- package/styles/bootstrap5-dark.css +1 -1
- package/styles/bootstrap5.css +1 -1
- package/styles/list-view/_bootstrap4-definition.scss +2 -2
- package/styles/list-view/_bootstrap5-definition.scss +1 -1
- package/styles/list-view/_material-definition.scss +1 -1
- package/styles/list-view/_material3-definition.scss +1 -1
- package/styles/list-view/_tailwind-definition.scss +2 -2
- package/styles/list-view/bootstrap4.css +2 -2
- package/styles/list-view/bootstrap5-dark.css +1 -1
- package/styles/list-view/bootstrap5.css +1 -1
- package/styles/list-view/material.css +1 -1
- package/styles/list-view/material3-dark.css +1 -1
- package/styles/list-view/material3.css +1 -1
- package/styles/list-view/tailwind-dark.css +4 -4
- package/styles/list-view/tailwind.css +4 -4
- package/styles/material.css +1 -1
- package/styles/material3-dark.css +1 -1
- package/styles/material3.css +1 -1
- package/styles/tailwind-dark.css +4 -4
- package/styles/tailwind.css +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
|
|
283
|
+
if (ariaAttributes.groupItemRole === 'presentation' || ariaAttributes.itemRole === 'presentation') {
|
|
284
284
|
li.removeAttribute('aria-level');
|
|
285
285
|
}
|
|
286
286
|
anchorElement = li.querySelector('.' + cssClass.anchorWrap);
|
|
@@ -291,7 +291,12 @@ var ListBase;
|
|
|
291
291
|
}
|
|
292
292
|
// eslint-disable-next-line no-prototype-builtins
|
|
293
293
|
if (fieldData.hasOwnProperty(fields.htmlAttributes) && fieldData[fields.htmlAttributes]) {
|
|
294
|
-
|
|
294
|
+
const htmlAttributes = fieldData[fields.htmlAttributes];
|
|
295
|
+
// Check if 'class' attribute is present and not an empty string
|
|
296
|
+
if (htmlAttributes.hasOwnProperty('class') && typeof htmlAttributes['class'] === 'string' && htmlAttributes['class'].trim() === '') {
|
|
297
|
+
delete htmlAttributes['class'];
|
|
298
|
+
}
|
|
299
|
+
setAttribute(li, htmlAttributes);
|
|
295
300
|
}
|
|
296
301
|
// eslint-disable-next-line no-prototype-builtins
|
|
297
302
|
if (fieldData.hasOwnProperty(fields.enabled) && fieldData[fields.enabled] === false) {
|
|
@@ -507,7 +512,6 @@ var ListBase;
|
|
|
507
512
|
const curOpt = extend({}, defaultListBaseOptions, options);
|
|
508
513
|
const fields = extend({}, ListBase.defaultMappedFields, curOpt.fields);
|
|
509
514
|
const curEle = element.cloneNode(true);
|
|
510
|
-
// eslint-disable-next-line
|
|
511
515
|
const jsonAr = [];
|
|
512
516
|
curEle.classList.add('json-parent');
|
|
513
517
|
const childs = curEle.querySelectorAll('.json-parent>li');
|
|
@@ -516,7 +520,6 @@ var ListBase;
|
|
|
516
520
|
const li = childs[i];
|
|
517
521
|
const anchor = li.querySelector('a');
|
|
518
522
|
const ul = li.querySelector('ul');
|
|
519
|
-
// eslint-disable-next-line
|
|
520
523
|
const json = {};
|
|
521
524
|
const childNodes = anchor ? anchor.childNodes : li.childNodes;
|
|
522
525
|
const keys = Object.keys(childNodes);
|
|
@@ -590,7 +593,6 @@ var ListBase;
|
|
|
590
593
|
const ulElement = createElement('ul', { className: cssClass.ul, attrs: { role: 'presentation' } });
|
|
591
594
|
const curOpt = extend({}, defaultListBaseOptions, options);
|
|
592
595
|
const curFields = extend({}, ListBase.defaultMappedFields, fields);
|
|
593
|
-
// eslint-disable-next-line
|
|
594
596
|
const compiledString = compileTemplate(template);
|
|
595
597
|
const liCollection = [];
|
|
596
598
|
let value;
|
|
@@ -639,7 +641,7 @@ var ListBase;
|
|
|
639
641
|
else {
|
|
640
642
|
const currentID = isHeader ? curOpt.groupTemplateID : curOpt.templateID;
|
|
641
643
|
if (isHeader) {
|
|
642
|
-
if (componentInstance && componentInstance.getModuleName()
|
|
644
|
+
if (componentInstance && componentInstance.getModuleName() !== 'listview') {
|
|
643
645
|
// eslint-disable-next-line
|
|
644
646
|
const compiledElement = compiledString(curItem, componentInstance, 'headerTemplate', currentID, !!curOpt.isStringTemplate, null, li);
|
|
645
647
|
if (compiledElement) {
|
|
@@ -697,7 +699,6 @@ var ListBase;
|
|
|
697
699
|
function renderGroupTemplate(groupTemplate, groupDataSource, fields,
|
|
698
700
|
// eslint-disable-next-line
|
|
699
701
|
headerItems, options, componentInstance) {
|
|
700
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
701
702
|
const compiledString = compileTemplate(groupTemplate);
|
|
702
703
|
const curFields = extend({}, ListBase.defaultMappedFields, fields);
|
|
703
704
|
const curOpt = extend({}, defaultListBaseOptions, options);
|
|
@@ -706,7 +707,7 @@ var ListBase;
|
|
|
706
707
|
const headerData = {};
|
|
707
708
|
headerData[`${category}`] = header.textContent;
|
|
708
709
|
header.innerHTML = '';
|
|
709
|
-
if (componentInstance && componentInstance.getModuleName() !==
|
|
710
|
+
if (componentInstance && componentInstance.getModuleName() !== 'listview') {
|
|
710
711
|
// eslint-disable-next-line
|
|
711
712
|
const compiledElement = compiledString(headerData, componentInstance, 'groupTemplate', curOpt.groupTemplateID, !!curOpt.isStringTemplate, null, header);
|
|
712
713
|
if (compiledElement) {
|
|
@@ -742,7 +743,6 @@ var ListBase;
|
|
|
742
743
|
// Create expand and collapse node
|
|
743
744
|
if (!!options.expandCollapse && hasChildren && !options.template) {
|
|
744
745
|
element.firstElementChild.classList.add(cssClass.iconWrapper);
|
|
745
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
746
746
|
const expandElement = options.expandIconPosition === 'Left' ? prepend : append;
|
|
747
747
|
expandElement([createElement('div', { className: 'e-icons ' + options.expandIconClass })], element.querySelector('.' + cssClass.textContent));
|
|
748
748
|
}
|
|
@@ -888,9 +888,8 @@ var ListBase;
|
|
|
888
888
|
li.setAttribute('data-uid', generateId());
|
|
889
889
|
}
|
|
890
890
|
if (grpLI && options && options.groupTemplate) {
|
|
891
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
892
891
|
const compiledString = compileTemplate(options.groupTemplate);
|
|
893
|
-
if (componentInstance && componentInstance.getModuleName() !==
|
|
892
|
+
if (componentInstance && componentInstance.getModuleName() !== 'listview') {
|
|
894
893
|
// eslint-disable-next-line
|
|
895
894
|
const compiledElement = compiledString(item, componentInstance, 'groupTemplate', curOpt.groupTemplateID, !!curOpt.isStringTemplate, null, li);
|
|
896
895
|
if (compiledElement) {
|
|
@@ -902,7 +901,6 @@ var ListBase;
|
|
|
902
901
|
}
|
|
903
902
|
}
|
|
904
903
|
else if (!grpLI && options && options.template) {
|
|
905
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
906
904
|
const compiledString = compileTemplate(options.template);
|
|
907
905
|
if (componentInstance && componentInstance.getModuleName() !== 'listview') {
|
|
908
906
|
// eslint-disable-next-line
|
|
@@ -974,7 +972,6 @@ var ListBase;
|
|
|
974
972
|
function generateIcon(createElement, liElement, className, options) {
|
|
975
973
|
const curOpt = extend({}, defaultListBaseOptions, options);
|
|
976
974
|
cssClass = getModuleClass(curOpt.moduleName);
|
|
977
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
978
975
|
const expandElement = curOpt.expandIconPosition === 'Left' ? prepend : append;
|
|
979
976
|
expandElement([createElement('div', {
|
|
980
977
|
className: 'e-icons ' + curOpt.expandIconClass + ' ' +
|
|
@@ -1311,7 +1308,6 @@ let ListView = class ListView extends Component {
|
|
|
1311
1308
|
this.headerEle.appendChild(hedBackButton);
|
|
1312
1309
|
this.headerEle.appendChild(textEle);
|
|
1313
1310
|
if (this.headerTemplate) {
|
|
1314
|
-
// eslint-disable-next-line
|
|
1315
1311
|
const compiledString = compile(this.headerTemplate);
|
|
1316
1312
|
const headerTemplateEle = this.createElement('div', { className: classNames.headerTemplateText });
|
|
1317
1313
|
// eslint-disable-next-line
|
|
@@ -1430,7 +1426,7 @@ let ListView = class ListView extends Component {
|
|
|
1430
1426
|
itemCreated: this.renderCheckbox.bind(this),
|
|
1431
1427
|
templateID: `${this.element.id}${LISTVIEW_TEMPLATE_PROPERTY}`,
|
|
1432
1428
|
groupTemplateID: `${this.element.id}${LISTVIEW_GROUPTEMPLATE_PROPERTY}`,
|
|
1433
|
-
enableHtmlSanitizer: this.enableHtmlSanitizer
|
|
1429
|
+
enableHtmlSanitizer: this.enableHtmlSanitizer
|
|
1434
1430
|
};
|
|
1435
1431
|
this.initialization();
|
|
1436
1432
|
}
|
|
@@ -1471,8 +1467,8 @@ let ListView = class ListView extends Component {
|
|
|
1471
1467
|
if (typeof this.dataSource[0] !== 'string' && typeof this.dataSource[0] !== 'number') {
|
|
1472
1468
|
fieldData = getFieldValues(args.curData, this.listBaseOption.fields);
|
|
1473
1469
|
if (this.enablePersistence && !isNullOrUndefined(this.selectedId)) {
|
|
1474
|
-
|
|
1475
|
-
if (index
|
|
1470
|
+
const index = this.selectedId.findIndex(e => e === fieldData[this.listBaseOption.fields.id].toString());
|
|
1471
|
+
if (index !== -1) {
|
|
1476
1472
|
this.checkInternally(args, checkboxElement);
|
|
1477
1473
|
}
|
|
1478
1474
|
}
|
|
@@ -1485,7 +1481,7 @@ let ListView = class ListView extends Component {
|
|
|
1485
1481
|
this.checkInternally(args, checkboxElement);
|
|
1486
1482
|
}
|
|
1487
1483
|
checkboxElement.setAttribute('aria-checked', frameElement.classList.contains(classNames.checked) ? 'true' : 'false');
|
|
1488
|
-
checkboxElement.setAttribute('aria-label',
|
|
1484
|
+
checkboxElement.setAttribute('aria-label', args.text);
|
|
1489
1485
|
if (this.checkBoxPosition === 'Left') {
|
|
1490
1486
|
checkboxElement.classList.add(classNames.checkboxLeft);
|
|
1491
1487
|
args.item.firstElementChild.classList.add(classNames.checkboxLeft);
|
|
@@ -1682,7 +1678,7 @@ let ListView = class ListView extends Component {
|
|
|
1682
1678
|
}
|
|
1683
1679
|
else {
|
|
1684
1680
|
this.setCheckboxLI(li, e);
|
|
1685
|
-
if ((target.nodeName
|
|
1681
|
+
if ((target.nodeName === 'INPUT') || (target.nodeName === 'TEXTAREA')) {
|
|
1686
1682
|
target.classList.add('e-focused');
|
|
1687
1683
|
this.targetElement = target;
|
|
1688
1684
|
}
|
|
@@ -1690,7 +1686,7 @@ let ListView = class ListView extends Component {
|
|
|
1690
1686
|
}
|
|
1691
1687
|
else {
|
|
1692
1688
|
this.setSelectLI(li, e);
|
|
1693
|
-
if ((target.nodeName
|
|
1689
|
+
if ((target.nodeName === 'INPUT') || (target.nodeName === 'TEXTAREA')) {
|
|
1694
1690
|
target.classList.add('e-focused');
|
|
1695
1691
|
this.targetElement = target;
|
|
1696
1692
|
}
|
|
@@ -1951,6 +1947,9 @@ let ListView = class ListView extends Component {
|
|
|
1951
1947
|
EventHandler.add(this.element, 'mouseout', this.leaveHandler, this);
|
|
1952
1948
|
EventHandler.add(this.element, 'focusout', this.focusout, this);
|
|
1953
1949
|
this.touchModule = new Touch(this.element, { swipe: this.swipeActionHandler.bind(this) });
|
|
1950
|
+
if (!isNullOrUndefined(this.scroll)) {
|
|
1951
|
+
EventHandler.add(this.element, 'scroll', this.onListScroll, this);
|
|
1952
|
+
}
|
|
1954
1953
|
}
|
|
1955
1954
|
unWireEvents() {
|
|
1956
1955
|
EventHandler.remove(this.element, 'click', this.clickHandler);
|
|
@@ -1958,6 +1957,9 @@ let ListView = class ListView extends Component {
|
|
|
1958
1957
|
EventHandler.remove(this.element, 'mouseout', this.leaveHandler);
|
|
1959
1958
|
EventHandler.remove(this.element, 'mouseover', this.hoverHandler);
|
|
1960
1959
|
EventHandler.remove(this.element, 'mouseout', this.leaveHandler);
|
|
1960
|
+
if (!isNullOrUndefined(this.scroll)) {
|
|
1961
|
+
EventHandler.remove(this.element, 'scroll', this.onListScroll);
|
|
1962
|
+
}
|
|
1961
1963
|
this.touchModule.destroy();
|
|
1962
1964
|
this.touchModule = null;
|
|
1963
1965
|
}
|
|
@@ -1999,7 +2001,7 @@ let ListView = class ListView extends Component {
|
|
|
1999
2001
|
if (this.curUL.querySelector('.' + classNames.focused)) {
|
|
2000
2002
|
this.curUL.querySelector('.' + classNames.focused).classList.remove(classNames.focused);
|
|
2001
2003
|
}
|
|
2002
|
-
|
|
2004
|
+
const textAreaFocus = li.querySelector('textarea') || li.querySelector('input');
|
|
2003
2005
|
li.classList.add(classNames.focused);
|
|
2004
2006
|
if (!isNullOrUndefined(e)) {
|
|
2005
2007
|
if (e.target === textAreaFocus) {
|
|
@@ -2039,7 +2041,6 @@ let ListView = class ListView extends Component {
|
|
|
2039
2041
|
}
|
|
2040
2042
|
else {
|
|
2041
2043
|
selectedItem =
|
|
2042
|
-
// eslint-disable-next-line
|
|
2043
2044
|
{
|
|
2044
2045
|
item: li, text: fieldData && fieldData[this.listBaseOption.fields.text],
|
|
2045
2046
|
// eslint-disable-next-line
|
|
@@ -2197,7 +2198,7 @@ let ListView = class ListView extends Component {
|
|
|
2197
2198
|
setViewDataSource(dataSource = this.localData) {
|
|
2198
2199
|
// eslint-disable-next-line
|
|
2199
2200
|
let fieldValue = (isNullOrUndefined(this.fields.sortBy)) ? this.fields.text : this.fields.sortBy;
|
|
2200
|
-
|
|
2201
|
+
const query = ListBase.addSorting(this.sortOrder, fieldValue);
|
|
2201
2202
|
if (dataSource && this.fields.groupBy) {
|
|
2202
2203
|
if (this.sortOrder !== 'None') {
|
|
2203
2204
|
this.curViewDS = ListBase.groupDataSource(ListBase.getDataSource(dataSource, query), this.listBaseOption.fields, this.sortOrder);
|
|
@@ -2275,7 +2276,6 @@ let ListView = class ListView extends Component {
|
|
|
2275
2276
|
this.removeElement(this.headerEle);
|
|
2276
2277
|
this.removeElement(this.ulElement);
|
|
2277
2278
|
this.removeElement(this.contentContainer);
|
|
2278
|
-
// eslint-disable-next-line
|
|
2279
2279
|
if (this.isReact) {
|
|
2280
2280
|
this.clearTemplate();
|
|
2281
2281
|
}
|
|
@@ -2314,7 +2314,6 @@ let ListView = class ListView extends Component {
|
|
|
2314
2314
|
UpdateCurrentUL() {
|
|
2315
2315
|
this.ulElement = this.curUL = this.element.querySelector('.' + classNames.parentItem);
|
|
2316
2316
|
if (this.curUL) {
|
|
2317
|
-
// eslint-disable-next-line
|
|
2318
2317
|
this.liCollection = this.curUL.querySelectorAll('.' + classNames.listItem);
|
|
2319
2318
|
}
|
|
2320
2319
|
}
|
|
@@ -2329,7 +2328,6 @@ let ListView = class ListView extends Component {
|
|
|
2329
2328
|
if (!ele) {
|
|
2330
2329
|
const data = this.curViewDS;
|
|
2331
2330
|
ele = ListBase.createListFromJson(this.createElement, data, this.listBaseOption, this.curDSLevel.length, null, this);
|
|
2332
|
-
// eslint-disable-next-line
|
|
2333
2331
|
if (this.isReact) {
|
|
2334
2332
|
this.renderReactTemplates();
|
|
2335
2333
|
}
|
|
@@ -2343,7 +2341,6 @@ let ListView = class ListView extends Component {
|
|
|
2343
2341
|
this.liCollection = this.curUL.querySelectorAll('.' + classNames.listItem);
|
|
2344
2342
|
if (this.selectedItems) {
|
|
2345
2343
|
const fieldData = getFieldValues(this.selectedItems.data, this.listBaseOption.fields);
|
|
2346
|
-
// eslint-disable-next-line
|
|
2347
2344
|
this.header((fieldData[this.listBaseOption.fields.text]), true, 'header');
|
|
2348
2345
|
}
|
|
2349
2346
|
this.selectedLI = undefined;
|
|
@@ -2367,7 +2364,6 @@ let ListView = class ListView extends Component {
|
|
|
2367
2364
|
this.contentContainer = this.createElement('div', { className: classNames.container });
|
|
2368
2365
|
this.element.appendChild(this.contentContainer);
|
|
2369
2366
|
this.renderIntoDom(this.ulElement);
|
|
2370
|
-
// eslint-disable-next-line
|
|
2371
2367
|
if (this.isReact) {
|
|
2372
2368
|
this.renderReactTemplates();
|
|
2373
2369
|
}
|
|
@@ -2376,7 +2372,6 @@ let ListView = class ListView extends Component {
|
|
|
2376
2372
|
getElementUID(obj) {
|
|
2377
2373
|
let fields = {};
|
|
2378
2374
|
if (obj instanceof Element) {
|
|
2379
|
-
// eslint-disable-next-line
|
|
2380
2375
|
fields[this.fields.id] = obj.getAttribute('data-uid');
|
|
2381
2376
|
}
|
|
2382
2377
|
else {
|
|
@@ -2402,12 +2397,12 @@ let ListView = class ListView extends Component {
|
|
|
2402
2397
|
selector: '.' + classNames.listItem
|
|
2403
2398
|
});
|
|
2404
2399
|
this.renderComplete();
|
|
2400
|
+
this.previousScrollTop = this.element.scrollTop;
|
|
2405
2401
|
}
|
|
2406
2402
|
/**
|
|
2407
2403
|
* It is used to destroy the ListView component.
|
|
2408
2404
|
*/
|
|
2409
2405
|
destroy() {
|
|
2410
|
-
// eslint-disable-next-line
|
|
2411
2406
|
if (this.isReact) {
|
|
2412
2407
|
this.clearTemplate();
|
|
2413
2408
|
}
|
|
@@ -2449,7 +2444,6 @@ let ListView = class ListView extends Component {
|
|
|
2449
2444
|
toUL = toUL.parentElement;
|
|
2450
2445
|
}
|
|
2451
2446
|
const fieldData = getFieldValues(this.curDSJSON, this.listBaseOption.fields);
|
|
2452
|
-
// eslint-disable-next-line
|
|
2453
2447
|
const text = fieldData[this.fields.text];
|
|
2454
2448
|
this.switchView(fromUL, toUL, true);
|
|
2455
2449
|
this.removeFocus();
|
|
@@ -2522,7 +2516,6 @@ let ListView = class ListView extends Component {
|
|
|
2522
2516
|
if (!this.enableVirtualization && isNullOrUndefined(li)) {
|
|
2523
2517
|
const curLi = this.element.querySelectorAll('.' + classNames.listItem);
|
|
2524
2518
|
for (let i = 0; i < curLi.length; i++) {
|
|
2525
|
-
// eslint-disable-next-line
|
|
2526
2519
|
if (curLi[i].innerText.trim() === fieldData[this.fields.text]) {
|
|
2527
2520
|
li = curLi[i];
|
|
2528
2521
|
}
|
|
@@ -2572,7 +2565,6 @@ let ListView = class ListView extends Component {
|
|
|
2572
2565
|
*
|
|
2573
2566
|
*/
|
|
2574
2567
|
getSelectedItems() {
|
|
2575
|
-
// eslint-disable-next-line
|
|
2576
2568
|
let finalValue;
|
|
2577
2569
|
let isCompleted = false;
|
|
2578
2570
|
this.selectedId = [];
|
|
@@ -2583,7 +2575,6 @@ let ListView = class ListView extends Component {
|
|
|
2583
2575
|
isCompleted = true;
|
|
2584
2576
|
}
|
|
2585
2577
|
else if (this.showCheckBox && !isCompleted) {
|
|
2586
|
-
// eslint-disable-next-line
|
|
2587
2578
|
const liCollection = this.curUL.getElementsByClassName(classNames.selected);
|
|
2588
2579
|
const liTextCollection = [];
|
|
2589
2580
|
const liDataCollection = [];
|
|
@@ -2603,9 +2594,7 @@ let ListView = class ListView extends Component {
|
|
|
2603
2594
|
liDataCollection.push(tempData);
|
|
2604
2595
|
}
|
|
2605
2596
|
if (fieldData) {
|
|
2606
|
-
// eslint-disable-next-line
|
|
2607
2597
|
liTextCollection.push(fieldData[this.listBaseOption.fields.text]);
|
|
2608
|
-
// eslint-disable-next-line
|
|
2609
2598
|
this.selectedId.push(fieldData[this.listBaseOption.fields.id]);
|
|
2610
2599
|
}
|
|
2611
2600
|
else {
|
|
@@ -2647,7 +2636,6 @@ let ListView = class ListView extends Component {
|
|
|
2647
2636
|
isCompleted = true;
|
|
2648
2637
|
}
|
|
2649
2638
|
else {
|
|
2650
|
-
// eslint-disable-next-line
|
|
2651
2639
|
this.selectedId.push(fieldData[this.listBaseOption.fields.id]);
|
|
2652
2640
|
finalValue = {
|
|
2653
2641
|
text: fieldData[this.listBaseOption.fields.text], item: liElement,
|
|
@@ -2705,7 +2693,6 @@ let ListView = class ListView extends Component {
|
|
|
2705
2693
|
if (li) {
|
|
2706
2694
|
li.classList.add(classNames.disable);
|
|
2707
2695
|
}
|
|
2708
|
-
// eslint-disable-next-line
|
|
2709
2696
|
resultJSON[this.fields.enabled] = false;
|
|
2710
2697
|
}
|
|
2711
2698
|
}
|
|
@@ -2741,7 +2728,6 @@ let ListView = class ListView extends Component {
|
|
|
2741
2728
|
li.style.display = display;
|
|
2742
2729
|
}
|
|
2743
2730
|
if (isHide) {
|
|
2744
|
-
// eslint-disable-next-line
|
|
2745
2731
|
resultJSON[this.fields.isVisible] = false;
|
|
2746
2732
|
}
|
|
2747
2733
|
else {
|
|
@@ -2824,7 +2810,6 @@ let ListView = class ListView extends Component {
|
|
|
2824
2810
|
return newDataSource;
|
|
2825
2811
|
}
|
|
2826
2812
|
addItemInNestedList(targetItemData, itemQueue) {
|
|
2827
|
-
// eslint-disable-next-line
|
|
2828
2813
|
const targetItemId = targetItemData[this.fields.id];
|
|
2829
2814
|
const targetChildDS = targetItemData[this.fields.child];
|
|
2830
2815
|
const isAlreadyRenderedUL = this.element.querySelector('[pid=\'' + targetItemId + '\']');
|
|
@@ -2865,7 +2850,6 @@ let ListView = class ListView extends Component {
|
|
|
2865
2850
|
this.getLiFromObjOrElement(curViewDS[index + 2]) || null;
|
|
2866
2851
|
const li = ListBase.createListItemFromJson(this.createElement, [dataSource], this.listBaseOption, null, null, this);
|
|
2867
2852
|
this.setAttributes(li);
|
|
2868
|
-
// eslint-disable-next-line
|
|
2869
2853
|
if (this.template && this.isReact) {
|
|
2870
2854
|
this.renderReactTemplates();
|
|
2871
2855
|
}
|
|
@@ -2897,11 +2881,9 @@ let ListView = class ListView extends Component {
|
|
|
2897
2881
|
const curViewDS = this.curViewDS;
|
|
2898
2882
|
const fields = obj instanceof Element ? this.getElementUID(obj) : obj;
|
|
2899
2883
|
let dataSource;
|
|
2900
|
-
// eslint-disable-next-line prefer-const
|
|
2901
2884
|
dataSource = this.findItemFromDS(listDataSource, fields, true);
|
|
2902
2885
|
if (dataSource) {
|
|
2903
2886
|
let data;
|
|
2904
|
-
// eslint-disable-next-line prefer-const
|
|
2905
2887
|
data = this.findItemFromDS(dataSource, fields);
|
|
2906
2888
|
const index = curViewDS.indexOf(data);
|
|
2907
2889
|
const li = this.getLiFromObjOrElement(obj);
|
|
@@ -2922,11 +2904,8 @@ let ListView = class ListView extends Component {
|
|
|
2922
2904
|
if (groupLi) {
|
|
2923
2905
|
detach(groupLi);
|
|
2924
2906
|
}
|
|
2925
|
-
// eslint-disable-next-line
|
|
2926
2907
|
const foundData = (dataSource.length - 1) <= 0
|
|
2927
|
-
? this.findParent(this.localData, this.fields.id,
|
|
2928
|
-
// eslint-disable-next-line
|
|
2929
|
-
(value) => value === data[this.fields.id], null) : null;
|
|
2908
|
+
? this.findParent(this.localData, this.fields.id, (value) => value === data[this.fields.id], null) : null;
|
|
2930
2909
|
const dsIndex = dataSource.indexOf(data);
|
|
2931
2910
|
dataSource.splice(dsIndex, 1);
|
|
2932
2911
|
this.setViewDataSource(listDataSource);
|
|
@@ -2969,16 +2948,13 @@ let ListView = class ListView extends Component {
|
|
|
2969
2948
|
}
|
|
2970
2949
|
}
|
|
2971
2950
|
}
|
|
2972
|
-
// eslint-disable-next-line
|
|
2973
2951
|
findParent(dataSource, id, callback, parent) {
|
|
2974
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
2975
2952
|
if (dataSource.hasOwnProperty(id) && callback(dataSource[id]) === true) {
|
|
2976
2953
|
return extend({}, dataSource);
|
|
2977
2954
|
}
|
|
2978
2955
|
for (let i = 0; i < Object.keys(dataSource).length; i++) {
|
|
2979
2956
|
if (dataSource[Object.keys(dataSource)[i]]
|
|
2980
2957
|
&& typeof dataSource[Object.keys(dataSource)[i]] === 'object') {
|
|
2981
|
-
// eslint-disable-next-line
|
|
2982
2958
|
const result = this.findParent(dataSource[Object.keys(dataSource)[i]], id, callback, dataSource);
|
|
2983
2959
|
if (result != null) {
|
|
2984
2960
|
if (!result.parent) {
|
|
@@ -3001,6 +2977,21 @@ let ListView = class ListView extends Component {
|
|
|
3001
2977
|
}
|
|
3002
2978
|
return modules;
|
|
3003
2979
|
}
|
|
2980
|
+
onListScroll(e) {
|
|
2981
|
+
let args = { originalEvent: e, scrollDirection: "Bottom", distanceY: this.element.scrollHeight - this.element.scrollTop };
|
|
2982
|
+
let currentScrollTop = this.element.scrollTop;
|
|
2983
|
+
if (currentScrollTop > this.previousScrollTop) {
|
|
2984
|
+
args.scrollDirection = "Bottom";
|
|
2985
|
+
args.distanceY = this.element.scrollHeight - this.element.clientHeight - this.element.scrollTop;
|
|
2986
|
+
this.trigger('scroll', args);
|
|
2987
|
+
}
|
|
2988
|
+
else if (this.previousScrollTop > currentScrollTop) {
|
|
2989
|
+
args.scrollDirection = "Top";
|
|
2990
|
+
args.distanceY = this.element.scrollTop;
|
|
2991
|
+
this.trigger('scroll', args);
|
|
2992
|
+
}
|
|
2993
|
+
this.previousScrollTop = currentScrollTop;
|
|
2994
|
+
}
|
|
3004
2995
|
/**
|
|
3005
2996
|
* Get the properties to be maintained in the persisted state.
|
|
3006
2997
|
*/
|
|
@@ -3082,6 +3073,9 @@ __decorate([
|
|
|
3082
3073
|
__decorate([
|
|
3083
3074
|
Event()
|
|
3084
3075
|
], ListView.prototype, "actionFailure", void 0);
|
|
3076
|
+
__decorate([
|
|
3077
|
+
Event()
|
|
3078
|
+
], ListView.prototype, "scroll", void 0);
|
|
3085
3079
|
ListView = __decorate([
|
|
3086
3080
|
NotifyPropertyChanges
|
|
3087
3081
|
], ListView);
|
|
@@ -3247,7 +3241,7 @@ class Virtualization {
|
|
|
3247
3241
|
onVirtualUiScroll(e) {
|
|
3248
3242
|
let startingHeight;
|
|
3249
3243
|
const curViewDS = this.listViewInstance.curViewDS;
|
|
3250
|
-
this.listItemHeight = select(
|
|
3244
|
+
this.listItemHeight = select('.e-list-item', this.listViewInstance.element).getBoundingClientRect().height;
|
|
3251
3245
|
this.totalHeight = (Object.keys(curViewDS).length * this.listItemHeight) - (this.domItemCount * this.listItemHeight);
|
|
3252
3246
|
if (this.listViewInstance.isWindow) {
|
|
3253
3247
|
startingHeight = this.listViewInstance.ulElement.getBoundingClientRect().top -
|
|
@@ -3608,7 +3602,6 @@ class Virtualization {
|
|
|
3608
3602
|
const curViewDS = this.listViewInstance.curViewDS;
|
|
3609
3603
|
// eslint-disable-next-line
|
|
3610
3604
|
const resutJSON = this.findDSAndIndexFromId(curViewDS, obj);
|
|
3611
|
-
// eslint-disable-next-line
|
|
3612
3605
|
if (Object.keys(resutJSON).length) {
|
|
3613
3606
|
dataSource = resutJSON.data;
|
|
3614
3607
|
if (curViewDS[resutJSON.index - 1] &&
|
|
@@ -3856,7 +3849,7 @@ class Virtualization {
|
|
|
3856
3849
|
this.listViewInstance.getLiFromObjOrElement(this.listViewInstance.curViewDS[index + 2]);
|
|
3857
3850
|
}
|
|
3858
3851
|
if (this.listViewInstance.fields.groupBy && this.listViewInstance.curViewDS[index + 1] && this.listViewInstance.curViewDS[index + 1].isHeader) {
|
|
3859
|
-
|
|
3852
|
+
const targetEle = this.listViewInstance.getLiFromObjOrElement(this.listViewInstance.curViewDS[index - 1]);
|
|
3860
3853
|
if (targetEle) {
|
|
3861
3854
|
target = targetEle.nextElementSibling;
|
|
3862
3855
|
}
|
|
@@ -3872,7 +3865,7 @@ class Virtualization {
|
|
|
3872
3865
|
this.refreshItemHeight();
|
|
3873
3866
|
}
|
|
3874
3867
|
createUIItem(args) {
|
|
3875
|
-
if (!args.item.classList.contains(
|
|
3868
|
+
if (!args.item.classList.contains('e-list-group-item')) {
|
|
3876
3869
|
this.templateData = args.curData.isHeader ? args.curData.items[0] :
|
|
3877
3870
|
args.curData;
|
|
3878
3871
|
if (this.listViewInstance.showCheckBox) {
|
|
@@ -3929,7 +3922,6 @@ class Virtualization {
|
|
|
3929
3922
|
this.listViewInstance.setLocalData();
|
|
3930
3923
|
}
|
|
3931
3924
|
updateUI(element, index, targetElement) {
|
|
3932
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
3933
3925
|
const onChange = this.isNgTemplate() ? this.onNgChange : this.onChange;
|
|
3934
3926
|
if (this.listViewInstance.template || this.listViewInstance.groupTemplate) {
|
|
3935
3927
|
const curViewDS = this.listViewInstance.curViewDS[index];
|
|
@@ -3955,7 +3947,7 @@ class Virtualization {
|
|
|
3955
3947
|
* @param {Virtualization} virtualThis - The virtualization context for the list view.
|
|
3956
3948
|
*/
|
|
3957
3949
|
onChange(newData, listElement, virtualThis) {
|
|
3958
|
-
|
|
3950
|
+
const liItem = ListBase.createListItemFromJson(virtualThis.listViewInstance.createElement,
|
|
3959
3951
|
// eslint-disable-next-line
|
|
3960
3952
|
[newData], virtualThis.listViewInstance.listBaseOption, null, null, virtualThis.listViewInstance);
|
|
3961
3953
|
if (virtualThis.listViewInstance.isReact) {
|
|
@@ -3970,7 +3962,6 @@ class Virtualization {
|
|
|
3970
3962
|
}
|
|
3971
3963
|
onNgChange(newData, listElement, virtualThis) {
|
|
3972
3964
|
// compile given target element with template for new data
|
|
3973
|
-
// eslint-disable-next-line
|
|
3974
3965
|
const templateCompiler = compile(virtualThis.listViewInstance.template);
|
|
3975
3966
|
const resultElement = templateCompiler(newData);
|
|
3976
3967
|
while (listElement.lastChild) {
|