@syncfusion/ej2-lists
Version:
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.
10 lines • 94 kB
JavaScript
/*!
* filename: ej2-lists.umd.min.js
* version : 31.1.17
* Copyright Syncfusion Inc. 2001 - 2024. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-buttons")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-data","@syncfusion/ej2-buttons"],t):t((e=e||self).ej={},e.ej2Base,e.ej2Data,e.ej2Buttons)}(this,function(C,V,d,L){"use strict";function a(e,t,i,s,n){return u(e,l(e,t,i,s,n),null,s)}function l(e,t,i,s,n){for(var l,r,a=[],o=V.extend({},U,s),c=(C.cssClass=N(o.moduleName),D()),h=0;h<t.length;h++)V.isNullOrUndefined(t[h])||(l=void 0,o.itemCreating&&"function"==typeof o.itemCreating&&(r={dataSource:t,curData:t[h],text:t[h],options:o},o.itemCreating(r)),l=i?H(e,t[h],void 0,null,null,[],null,c,h,s):P(e,t[h],void 0,null,null,s,n),o.itemCreated&&"function"==typeof o.itemCreated&&(r={dataSource:t,curData:t[h],text:t[h],item:l,options:o},o.itemCreated(r)),a.push(l));return a}function o(e,t,i,s,n,l){var r,a,o=V.extend({},U,i),c=(C.cssClass=N(o.moduleName),!l||"listview"!==l.getModuleName()&&"multiselect"!==l.getModuleName()?V.extend({},T.defaultMappedFields,o.fields):o.fields),h=V.extend({},B,o.ariaAttributes),d=[],u=(s&&(h.level=s),[]);t&&t.length&&!V.isNullOrUndefined(O(t).item)&&!Object.prototype.hasOwnProperty.call(O(t).item,c.id)&&(r=D());for(var p=0;p<t.length;p++){var m,f,I,g,y,v,b,S,w,x,L=A(t[p],c);V.isNullOrUndefined(t[p])||(o.itemCreating&&"function"==typeof o.itemCreating&&(x={dataSource:t,curData:t[p],text:L[c.text],options:o,fields:c},o.itemCreating(x)),I=t[p],o.itemCreating&&"function"==typeof o.itemCreating&&(L=A(t[p],c)),Object.prototype.hasOwnProperty.call(L,c.id)&&!V.isNullOrUndefined(L[c.id])&&(r=L[c.id]),w=[],o.showCheckBox&&(o.itemNavigable&&(L[c.url]||L[c.urlAttributes])?d:w).push(e("input",{className:C.cssClass.check,attrs:{type:"checkbox"}})),!0===n?(o.showIcon&&Object.prototype.hasOwnProperty.call(L,c.iconCss)&&!V.isNullOrUndefined(L[c.iconCss])&&w.push(e("span",{className:C.cssClass.icon+" "+L[c.iconCss]})),a=(f=H(e,I,L,c,o.itemClass,w,!(!Object.prototype.hasOwnProperty.call(I,"isHeader")||!I.isHeader),r,p,i)).querySelector("."+C.cssClass.anchorWrap),Object.prototype.hasOwnProperty.call(L,c.tooltip)&&(m=L[c.tooltip],i&&i.enableHtmlSanitizer?m=V.SanitizeHtmlHelper.sanitize(m):(m=e("span",{innerHTML:m}).innerText,0),f.setAttribute("title",m)),o.itemNavigable&&d.length&&V.prepend(d,f.firstElementChild)):((f=P(e,I,L,c,o.itemClass,i,l)).classList.add(C.cssClass.level+"-"+h.level),f.setAttribute("aria-level",h.level.toString()),"presentation"!==h.groupItemRole&&"presentation"!==h.itemRole||f.removeAttribute("aria-level"),a=f.querySelector("."+C.cssClass.anchorWrap),Object.prototype.hasOwnProperty.call(L,c.tooltip)&&(m=L[c.tooltip],i&&i.enableHtmlSanitizer?m=V.SanitizeHtmlHelper.sanitize(m):(m=e("span",{innerHTML:m}).innerText,0),f.setAttribute("title",m)),Object.prototype.hasOwnProperty.call(L,c.htmlAttributes)&&L[c.htmlAttributes]&&("class"in(I=L[c.htmlAttributes])&&"string"==typeof I.class&&""===I.class.trim()&&delete I.class,k(f,I)),Object.prototype.hasOwnProperty.call(L,c.enabled)&&!1===L[c.enabled]&&f.classList.add(C.cssClass.disabled),Object.prototype.hasOwnProperty.call(L,c.isVisible)&&!1===L[c.isVisible]&&(f.style.display="none"),!Object.prototype.hasOwnProperty.call(L,c.imageUrl)||V.isNullOrUndefined(L[c.imageUrl])||o.template||(I={src:L[c.imageUrl],alt:V.isNullOrUndefined(L.name)?"Displaying Image":"Displaying "+L.name+" Image"},V.merge(I,L[c.imageAttributes]),I=e("img",{className:C.cssClass.image,attrs:I}),a?a.insertAdjacentElement("afterbegin",I):V.prepend([I],f.firstElementChild)),o.showIcon&&Object.prototype.hasOwnProperty.call(L,c.iconCss)&&!V.isNullOrUndefined(L[c.iconCss])&&!o.template&&(I=e("div",{className:C.cssClass.icon+" "+L[c.iconCss]}),a?a.insertAdjacentElement("afterbegin",I):V.prepend([I],f.firstElementChild)),w.length&&V.prepend(w,f.firstElementChild),o.itemNavigable&&d.length&&V.prepend(d,f.firstElementChild),S=b=v=y=g=w=I=void 0,I=e,w=L,g=c,y=o,v=f,b=h.level,S=w[g.child]||[],w=w[g.hasChildren],S.length&&(w=!0,v.classList.add(C.cssClass.hasChild),y.processSubChild)&&(g=E(I,S,y,++b),v.appendChild(g)),y.expandCollapse&&w&&!y.template&&(v.firstElementChild.classList.add(C.cssClass.iconWrapper),("Left"===y.expandIconPosition?V.prepend:V.append)([I("div",{className:"e-icons "+y.expandIconClass})],v.querySelector("."+C.cssClass.textContent)))),a&&V.addClass([f],[C.cssClass.navigable]),o.itemCreated&&"function"==typeof o.itemCreated&&(x={dataSource:t,curData:t[p],text:L[c.text],item:f,options:o,fields:c},o.itemCreated(x)),d=[],u.push(f))}return u}function E(e,t,i,s,n,l){var r=V.extend({},U,i);return u(e,o(e,t,i,s,n,l),r.listClass,i)}function r(e,t){if(t&&e)return Array.prototype.slice.call(t).indexOf(e)}function c(e,t,i){if(void 0===i&&(i=new d.Query),"Ascending"===e)i.sortBy(t,"ascending",!0);else if("Descending"===e)i.sortBy(t,"descending",!0);else for(var s=0;s<i.queries.length;s++)"onSortBy"===i.queries[s].fn&&i.queries.splice(s,1);return i}function h(e,t){return new d.DataManager(e).executeLocal(t)}function O(e){for(var t={typeof:null,item:null},i=0;i<e.length;i++)if(!V.isNullOrUndefined(e[i]))return{typeof:typeof e[i],item:e[i]};return t}function k(e,t){var i={};V.merge(i,t),i.class&&(V.addClass([e],i.class.split(" ")),delete i.class),V.attributes(e,i)}function f(e){for(var t={},i=e.attributes,s=0;s<i.length;s++)t[i[s].nodeName]=i[s].nodeValue;return t}function D(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}function H(e,t,i,s,n,l,r,a,o,c){var h,d=V.extend({},U,c),u=V.extend({},B,d.ariaAttributes),p=t,m=t,o=("string"!=typeof t&&"number"!=typeof t&&"boolean"!=typeof t&&(h=t,p="boolean"==typeof i[s.text]||"number"==typeof i[s.text]?i[s.text]:i[s.text]||"",m=i[s.value]),t=V.isNullOrUndefined(h)||V.isNullOrUndefined(i[s.id])||""===i[s.id]?a+"-"+o:a,e("li",{className:(!0===r?C.cssClass.group:C.cssClass.li)+" "+(V.isNullOrUndefined(n)?"":n),id:t,attrs:""!==u.groupItemRole&&""!==u.itemRole?{role:!0===r?u.groupItemRole:u.itemRole}:{}}));return h&&Object.prototype.hasOwnProperty.call(i,s.enabled)&&"false"===i[s.enabled].toString()&&o.classList.add(C.cssClass.disabled),c&&c.enableHtmlSanitizer&&(p=V.SanitizeHtmlHelper.sanitize(p)),r?o.innerText=p:(o.setAttribute("data-value",V.isNullOrUndefined(m)?"null":m),o.setAttribute("role","option"),h&&Object.prototype.hasOwnProperty.call(i,s.htmlAttributes)&&i[s.htmlAttributes]&&k(o,i[s.htmlAttributes]),l.length&&!d.itemNavigable&&V.append(l,o),h&&(i[s.url]||i[s.urlAttributes]&&i[s.urlAttributes].href)?o.appendChild(F(e,h,s,p,l,d.itemNavigable)):(l.length&&d.itemNavigable&&V.append(l,o),o.appendChild(document.createTextNode(p)))),o}function N(e){return{li:"e-"+e+"-item",ul:"e-"+e+"-parent e-ul",group:"e-"+e+"-group-item",icon:"e-"+e+"-icon",text:"e-"+e+"-text",check:"e-"+e+"-check",checked:"e-checked",selected:"e-selected",expanded:"e-expanded",textContent:"e-text-content",hasChild:"e-has-child",level:"e-level",url:"e-"+e+"-url",collapsible:"e-icon-collapsible",disabled:"e-disabled",image:"e-"+e+"-img",iconWrapper:"e-icon-wrapper",anchorWrap:"e-anchor-wrap",navigable:"e-navigable"}}function F(e,t,i,s,n,l){var r,t=A(t,i),a={href:t[i.url]};return Object.prototype.hasOwnProperty.call(t,i.urlAttributes)&&t[i.urlAttributes]&&(V.merge(a,t[i.urlAttributes]),a.href=t[i.url]||t[i.urlAttributes].href),l?(r=e("a",{className:C.cssClass.text+" "+C.cssClass.url}),t=e("div",{className:C.cssClass.anchorWrap}),n&&n.length&&V.append(n,t),t.appendChild(document.createTextNode(s)),V.append([t],r)):r=e("a",{className:C.cssClass.text+" "+C.cssClass.url,innerHTML:s}),k(r,a),r}function P(e,t,i,s,n,l,r){var a,o,c,h,d,u=V.extend({},U,l),p=V.extend({},B,u.ariaAttributes),m=t,n=("string"!=typeof t&&"number"!=typeof t&&(a=t,m=i[s.text]||"",h=V.isNullOrUndefined(i._id)?i[s.id]:i._id,d=!(!Object.prototype.hasOwnProperty.call(t,"isHeader")||!t.isHeader)),l&&l.enableHtmlSanitizer&&(m=V.SanitizeHtmlHelper.sanitize(m)),e("li",{className:(!0===d?C.cssClass.group:C.cssClass.li)+" "+(V.isNullOrUndefined(n)?"":n),attrs:""!==p.groupItemRole&&""!==p.itemRole?{role:!0===d?p.groupItemRole:p.itemRole}:{}}));return!0==!V.isNullOrUndefined(h)?n.setAttribute("data-uid",h):n.setAttribute("data-uid",D()),d&&l&&l.groupTemplate?(o=v(l.groupTemplate),r&&"listview"!==r.getModuleName()?(c=o(t,r,"groupTemplate",u.groupTemplateID,!!u.isStringTemplate,null,n))&&V.append(c,n):V.append(o(t,r,"groupTemplate",u.groupTemplateID,!!u.isStringTemplate),n)):!d&&l&&l.template?(o=v(l.template),r&&"listview"!==r.getModuleName()?(c=o(t,r,"template",u.templateID,!!u.isStringTemplate,null,n))&&V.append(c,n):V.append(o(t,r,"template",u.templateID,!!u.isStringTemplate),n)):(h=e("div",{className:C.cssClass.textContent,attrs:""!==p.wrapperRole?{role:p.wrapperRole}:{}}),a&&(i[s.url]||i[s.urlAttributes]&&i[s.urlAttributes].href)?h.appendChild(F(e,a,s,m,null,u.itemNavigable)):(d=e("span",{className:C.cssClass.text,attrs:""!==p.itemText?{role:p.itemText}:{}}),l&&l.enableHtmlSanitizer?d.innerText=m:d.innerHTML=m,h.appendChild(d)),n.appendChild(h)),n}function u(e,t,i,s){var s=V.extend({},U,s),n=V.extend({},B,s.ariaAttributes),s=(C.cssClass=N(s.moduleName),e("ul",{className:C.cssClass.ul+" "+(V.isNullOrUndefined(i)?"":i),attrs:""!==n.listRole?{role:n.listRole}:{}}));return V.append(t,s),s}var T,B,U;function A(e,t){var i={};if(V.isNullOrUndefined(e)||"string"==typeof e||"number"==typeof e||!V.isNullOrUndefined(e.isHeader))return e;for(var s=0,n=Object.keys(t);s<n.length;s++){var l=t[""+n[s]],r=V.isNullOrUndefined(l)||"string"!=typeof l?void 0:V.getValue(l,e);V.isNullOrUndefined(r)||(i[""+l]=r)}return i}function v(t){if(t)try{return"function"!=typeof t&&document.querySelector(t)?V.compile(document.querySelector(t).innerHTML.trim()):V.compile(t)}catch(e){return V.compile(t)}}C.cssClass={li:"e-list-item",ul:"e-list-parent e-ul",group:"e-list-group-item",icon:"e-list-icon",text:"e-list-text",check:"e-list-check",checked:"e-checked",selected:"e-selected",expanded:"e-expanded",textContent:"e-text-content",hasChild:"e-has-child",level:"e-level",url:"e-list-url",collapsible:"e-icon-collapsible",disabled:"e-disabled",image:"e-list-img",iconWrapper:"e-icon-wrapper",anchorWrap:"e-anchor-wrap",navigable:"e-navigable"},(T=C.ListBase||(C.ListBase={})).defaultMappedFields={id:"id",text:"text",url:"url",value:"value",isChecked:"isChecked",enabled:"enabled",expanded:"expanded",selected:"selected",iconCss:"iconCss",child:"child",isVisible:"isVisible",hasChildren:"hasChildren",tooltip:"tooltip",htmlAttributes:"htmlAttributes",urlAttributes:"urlAttributes",imageAttributes:"imageAttributes",imageUrl:"imageUrl",groupBy:null,sortBy:null},U={showCheckBox:!(B={level:1,listRole:"presentation",itemRole:"presentation",groupItemRole:"group",itemText:"list-item",wrapperRole:"presentation"}),showIcon:!1,enableHtmlSanitizer:!1,expandCollapse:!1,fields:T.defaultMappedFields,ariaAttributes:B,listClass:"",itemClass:"",processSubChild:!1,sortOrder:"None",template:null,groupTemplate:null,headerTemplate:null,expandIconClass:"e-icon-collapsible",moduleName:"list",expandIconPosition:"Right",itemNavigable:!1},T.createList=function(e,t,i,s,n){var l=V.extend({},U,i),l=V.extend({},B,l.ariaAttributes),r=O(t).typeof;return"string"===r||"number"===r?a(e,t,s,i,n):E(e,t,i,l.level,s,n)},T.createListFromArray=a,T.createListItemFromArray=l,T.createListItemFromJson=o,T.createListFromJson=E,T.getSiblingLI=function(e,t,i){if(C.cssClass=N(U.moduleName),e&&e.length){for(var s=Array.prototype.slice.call(e),n=t?r(t,s):!0===i?s.length:-1,l=s[n+(!0===i?-1:1)];l&&(!V.isVisible(l)||l.classList.contains(C.cssClass.disabled));)l=s[n+=!0===i?-1:1];return l}},T.indexOf=r,T.groupDataSource=function(e,t,i){void 0===i&&(i="None");var s=V.extend({},T.defaultMappedFields,t),n=h(e,c(i,"key",(new d.Query).group(s.groupBy)));e=[];for(var l=0;l<n.length;l++){var r=n[l].items,a={};a[s.text]=n[l].key,a.isHeader=!0,"id"===s.text&&(a.text=n[l].key),a._id="group-list-item-"+(n[l].key?n[l].key.toString().trim():"undefined"),a.items=r,e.push(a);for(var o=0;o<r.length;o++)e.push(r[o])}return e},T.addSorting=c,T.getDataSource=h,T.createJsonFromElement=function e(t,i){var s=V.extend({},U,i),n=V.extend({},T.defaultMappedFields,s.fields),s=t.cloneNode(!0),l=[],r=(s.classList.add("json-parent"),s.querySelectorAll(".json-parent>li"));s.classList.remove("json-parent");for(var a=0;a<r.length;a++){for(var o=r[a],c=o.querySelector("a"),h=o.querySelector("ul"),d={},u=(c||o).childNodes,p=Object.keys(u),m=0;m<u.length;m++)u[Number(p[m])].hasChildNodes()||(d[n.text]=u[Number(p[m])].textContent);(o=f(o)).id?(d[n.id]=o.id,delete o.id):d[n.id]=D(),Object.keys(o).length&&(d[n.htmlAttributes]=o),c&&(o=f(c),Object.keys(o).length)&&(d[n.urlAttributes]=o),h&&(d[n.child]=e(h,i)),l.push(d)}return l},T.renderContentTemplate=function(e,t,i,s,n,l){C.cssClass=N(U.moduleName);for(var r=e("ul",{className:C.cssClass.ul,attrs:{role:"presentation"}}),a=V.extend({},U,n),o=V.extend({},T.defaultMappedFields,s),c=v(t),h=[],d=D(),u=0;u<i.length;u++){var p,m=A(i[u],o),f=i[u],I=f.isHeader,g="string"==typeof i[u]||"number"==typeof i[u]?f:m[o.value],y=(a.itemCreating&&"function"==typeof a.itemCreating&&a.itemCreating({dataSource:i,curData:f,text:g,options:a,fields:o}),a.itemCreating&&"function"==typeof a.itemCreating&&(m=A(i[u],o),g="string"==typeof i[u]||"number"==typeof i[u]?f:m[o.value]),e("li",{id:d+"-"+u,className:I?C.cssClass.group:C.cssClass.li,attrs:{role:"presentation"}}));I?"string"==typeof i[u]||"number"==typeof i[u]?y.innerText=f:y.innerText=m[o.text]:(m=I?a.groupTemplateID:a.templateID,I?l&&"listview"!==l.getModuleName()?(p=c(f,l,"headerTemplate",m,!!a.isStringTemplate,null,y))&&V.append(p,y):V.append(c(f,l,"headerTemplate",m,!!a.isStringTemplate),y):l&&"listview"!==l.getModuleName()?(p=c(f,l,"template",m,!!a.isStringTemplate,null,y))&&V.append(p,y):V.append(c(f,l,"template",m,!!a.isStringTemplate),y),y.setAttribute("data-value",V.isNullOrUndefined(g)?"null":g),y.setAttribute("role","option")),a.itemCreated&&"function"==typeof a.itemCreated&&a.itemCreated({dataSource:i,curData:f,text:g,item:y,options:a,fields:o}),h.push(y)}return V.append(h,r),r},T.renderGroupTemplate=function(e,t,i,s,n,l){for(var r=v(e),e=V.extend({},T.defaultMappedFields,i),a=V.extend({},U,n),o=e.groupBy,c=0,h=s;c<h.length;c++){var d,u=h[c],p={};p[""+o]=u.textContent,u.innerHTML="",l&&"listview"!==l.getModuleName()?(d=r(p,l,"groupTemplate",a.groupTemplateID,!!a.isStringTemplate,null,u))&&V.append(d,u):V.append(r(p,l,"groupTemplate",a.groupTemplateID,!!a.isStringTemplate),u)}return s},T.generateId=D,T.generateUL=u,T.generateIcon=function(e,t,i,s){return s=V.extend({},U,s),C.cssClass=N(s.moduleName),("Left"===s.expandIconPosition?V.prepend:V.append)([e("div",{className:"e-icons "+s.expandIconClass+" "+(V.isNullOrUndefined(i)?"":i)})],t.querySelector("."+C.cssClass.textContent)),t};s=function(e,t){return(s=Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}))(e,t)};var s,e,t=function(e,t){function i(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)},i=function(e,t,i,s){var n,l=arguments.length,r=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;0<=a;a--)(n=e[a])&&(r=(l<3?n(r):3<l?n(t,i,r):n(t,i))||r);return 3<l&&r&&Object.defineProperty(t,i,r),r},q={None:[],SlideLeft:["SlideRightOut","SlideLeftOut","SlideLeftIn","SlideRightIn"],SlideDown:["SlideTopOut","SlideBottomOut","SlideBottomIn","SlideTopIn"],Zoom:["FadeOut","FadeZoomOut","FadeZoomIn","FadeIn"],Fade:["FadeOut","FadeOut","FadeIn","FadeIn"]},j={None:[],SlideLeft:["SlideLeftOut","SlideRightOut","SlideRightIn","SlideLeftIn"],SlideDown:["SlideBottomOut","SlideTopOut","SlideTopIn","SlideBottomIn"],Zoom:["FadeZoomOut","FadeOut","FadeIn","FadeZoomIn"],Fade:["FadeOut","FadeOut","FadeIn","FadeIn"]},p={root:"e-listview",hover:"e-hover",selected:"e-active",focused:"e-focused",parentItem:"e-list-parent",listItem:"e-list-item",listIcon:"e-list-icon",textContent:"e-text-content",listItemText:"e-list-text",groupListItem:"e-list-group-item",hasChild:"e-has-child",view:"e-view",header:"e-list-header",headerText:"e-headertext",headerTemplateText:"e-headertemplate-text",text:"e-text",disable:"e-disabled",container:"e-list-container",icon:"e-icons",backIcon:"e-icon-back",backButton:"e-back-button",checkboxWrapper:"e-checkbox-wrapper",checkbox:"e-checkbox",checked:"e-check",checklist:"e-checklist",checkboxIcon:"e-frame",checkboxRight:"e-checkbox-right",checkboxLeft:"e-checkbox-left",listviewCheckbox:"e-listview-checkbox",itemCheckList:"e-checklist",virtualElementContainer:"e-list-virtualcontainer",listTemplate:"e-listview-template"},M="Template",z="GroupTemplate",R=(e=V.ChildProperty,t(n,e),i([V.Property("id")],n.prototype,"id",void 0),i([V.Property("text")],n.prototype,"text",void 0),i([V.Property("isChecked")],n.prototype,"isChecked",void 0),i([V.Property("isVisible")],n.prototype,"isVisible",void 0),i([V.Property("enabled")],n.prototype,"enabled",void 0),i([V.Property("iconCss")],n.prototype,"iconCss",void 0),i([V.Property("child")],n.prototype,"child",void 0),i([V.Property("tooltip")],n.prototype,"tooltip",void 0),i([V.Property("groupBy")],n.prototype,"groupBy",void 0),i([V.Property("text")],n.prototype,"sortBy",void 0),i([V.Property("htmlAttributes")],n.prototype,"htmlAttributes",void 0),i([V.Property("tableName")],n.prototype,"tableName",void 0),n);function n(){return null!==e&&e.apply(this,arguments)||this}m=V.Component,t(I,m),I.prototype.onPropertyChanged=function(e,t){for(var i=0,s=Object.keys(e);i<s.length;i++)switch(s[i]){case"htmlAttributes":this.setHTMLAttribute();break;case"cssClass":this.setCSSClass(t.cssClass);break;case"enable":this.setEnable();break;case"width":case"height":this.setSize();break;case"enableRtl":this.setEnableRTL();break;case"fields":this.listBaseOption.fields=this.fields.properties,this.enableVirtualization?this.virtualizationModule.reRenderUiVirtualization():this.reRender();break;case"headerTitle":this.curDSLevel.length||this.header(this.headerTitle,!1,"header");break;case"query":this.enableVirtualization?this.virtualizationModule.reRenderUiVirtualization():this.reRender();break;case"showHeader":this.header(this.headerTitle,!1,"header");break;case"enableVirtualization":V.isNullOrUndefined(this.contentContainer)||V.detach(this.contentContainer),this.refresh();break;case"showCheckBox":case"checkBoxPosition":this.enableVirtualization?this.virtualizationModule.reRenderUiVirtualization():this.setCheckbox();break;case"dataSource":this.previousScrollTop=this.element.scrollTop,this.enableVirtualization?this.virtualizationModule.reRenderUiVirtualization():this.reRender();break;case"sortOrder":case"template":this.enableVirtualization||this.refresh();break;case"showIcon":this.enableVirtualization?this.virtualizationModule.reRenderUiVirtualization():(this.listBaseOption.showIcon=this.showIcon,this.curViewDS=this.getSubDS(),this.resetCurrentList())}},I.prototype.setHTMLAttribute=function(){!V.isNullOrUndefined(this.htmlAttributes)&&Object.keys(this.htmlAttributes).length&&V.attributes(this.element,this.htmlAttributes)},I.prototype.setCSSClass=function(e){this.cssClass&&V.addClass([this.element],this.cssClass.split(" ").filter(function(e){return e})),e&&V.removeClass([this.element],e.split(" ").filter(function(e){return e}))},I.prototype.setSize=function(){this.element.style.height=V.formatUnit(this.height),this.element.style.width=V.formatUnit(this.width),this.isWindow=!this.element.clientHeight},I.prototype.setEnable=function(){this.enableElement(this.element,this.enable)},I.prototype.setEnableRTL=function(){this.enableRtl?this.element.classList.add("e-rtl"):this.element.classList.remove("e-rtl")},I.prototype.enableElement=function(e,t){t?e.classList.remove(p.disable):e.classList.add(p.disable)},I.prototype.header=function(e,t,i){var s,n,l,r;void 0===this.headerEle&&this.showHeader?(this.headerEle=this.createElement("div",{className:p.header}),l=this.createElement("span",{className:p.headerText}),this.enableHtmlSanitizer?(this.setProperties({headerTitle:V.SanitizeHtmlHelper.sanitize(this.headerTitle)},!0),l.innerText=this.headerTitle):l.innerHTML=this.headerTitle,l=this.createElement("div",{className:p.text,innerHTML:l.outerHTML}),r=this.createElement("div",{className:p.icon+" "+p.backIcon+" "+p.backButton,attrs:{style:"display:none;"}}),this.headerEle.appendChild(r),this.headerEle.appendChild(l),this.headerTemplate&&(n=V.compile(this.headerTemplate),s=this.createElement("div",{className:p.headerTemplateText}),(n=n({},this,i,this.LISTVIEW_HEADERTEMPLATE_ID,null,null,this.headerEle))&&V.append(n,s),V.append([s],this.headerEle),this.isReact)&&this.renderReactTemplates(),this.headerTemplate&&this.headerTitle&&l.classList.add("header"),this.element.classList.add("e-has-header"),V.prepend([this.headerEle],this.element)):this.headerEle&&(this.showHeader?(this.headerEle.style.display="",l=this.headerEle.querySelector("."+p.headerText),r=this.headerEle.querySelector("."+p.backIcon),this.enableHtmlSanitizer&&(e=V.SanitizeHtmlHelper.sanitize(e)),l.innerHTML=e,this.headerTemplate&&t&&(l.parentElement.classList.remove("header"),this.headerEle.querySelector("."+p.headerTemplateText).classList.add("nested-header")),this.headerTemplate&&!t&&(l.parentElement.classList.add("header"),this.headerEle.querySelector("."+p.headerTemplateText).classList.remove("nested-header"),this.headerEle.querySelector("."+p.headerTemplateText).classList.add("header")),r.style.display=!0===t?"":"none"):this.headerEle.style.display="none")},I.prototype.switchView=function(e,t,i){var s,n,l,r,a=this;e&&t&&(s=e.style.position,n="hidden"!==this.element.style.overflow?this.element.style.overflow:"",e.style.position="absolute",r=void e.classList.add("e-view"),l=this.animation.duration,this.animation.effect?r=(this.enableRtl?j:q)[this.animation.effect]:(r=q.SlideLeft,i=this.enableRtl,l=0),this.element.style.overflow="hidden",this.aniObj.animate(e,{name:!0===i?r[0]:r[1],duration:0===l&&"Enable"===V.animationMode?400:l,timingFunction:this.animation.easing,end:function(){e.style.display="none",a.element.style.overflow=n,e.style.position=s,e.classList.remove("e-view")}}),t.style.display="",this.aniObj.animate(t,{name:!0===i?r[2]:r[3],duration:0===l&&"Enable"===V.animationMode?400:l,timingFunction:this.animation.easing,end:function(){a.trigger("actionComplete")}}),this.curUL=t)},I.prototype.preRender=function(){if(this.template)try{"function"!=typeof this.template&&document.querySelectorAll(this.template).length&&this.setProperties({template:document.querySelector(this.template).innerHTML.trim()},!0)}catch(e){V.compile(this.template)}this.listBaseOption={template:this.template,headerTemplate:this.headerTemplate,groupTemplate:this.groupTemplate,expandCollapse:!0,listClass:"",ariaAttributes:{itemRole:"listitem",listRole:"list",itemText:"",groupItemRole:"presentation",wrapperRole:"presentation"},fields:this.fields.properties,sortOrder:this.sortOrder,showIcon:this.showIcon,itemCreated:this.renderCheckbox.bind(this),templateID:this.element.id+M,groupTemplateID:this.element.id+z,enableHtmlSanitizer:this.enableHtmlSanitizer},this.initialization()},I.prototype.initialization=function(){this.curDSLevel=[],this.animateOptions={},this.curViewDS=[],this.currentLiElements=[],this.isNestedList=!1,this.selectedData=[],this.selectedId=this.enablePersistence?this.selectedId:[],this.LISTVIEW_TEMPLATE_ID=this.element.id+M,this.LISTVIEW_GROUPTEMPLATE_ID=this.element.id+z,this.LISTVIEW_HEADERTEMPLATE_ID=this.element.id+"HeaderTemplate",this.aniObj=new V.Animation(this.animateOptions),this.removeElement(this.curUL),this.removeElement(this.ulElement),this.removeElement(this.headerEle),this.removeElement(this.contentContainer),this.curUL=this.ulElement=this.liCollection=this.headerEle=this.contentContainer=void 0},I.prototype.renderCheckbox=function(e){var t,i,s,n=this;e.item.classList.contains(p.hasChild)&&(this.isNestedList=!0),this.showCheckBox&&e.item.classList.contains(p.listItem)&&((t=L.createCheckBox(this.createElement,!1,{checked:!1,enableRtl:this.enableRtl,cssClass:p.listviewCheckbox})).setAttribute("role","checkbox"),i=t.querySelector("."+p.checkboxIcon),e.item.classList.add(p.itemCheckList),e.item.firstElementChild.classList.add(p.checkbox),this.template&&this.element?V.addClass([this.element],p.listTemplate):null===this.template&&this.element&&this.element.classList&&this.element.classList.contains("e-listview-template")&&V.removeClass([this.element],p.listTemplate),"string"!=typeof this.dataSource[0]&&"number"!=typeof this.dataSource[0]?(s=A(e.curData,this.listBaseOption.fields),this.enablePersistence&&!V.isNullOrUndefined(this.selectedId)?-1!==this.selectedId.findIndex(function(e){return e===s[n.listBaseOption.fields.id].toString()})&&this.checkInternally(e,t):s[this.listBaseOption.fields.isChecked]&&this.checkInternally(e,t)):"string"!=typeof this.dataSource[0]&&"number"!=typeof this.dataSource[0]||-1===this.selectedData.indexOf(e.text)||this.checkInternally(e,t),t.setAttribute("aria-checked",i.classList.contains(p.checked)?"true":"false"),t.setAttribute("aria-label",e.text),"Left"===this.checkBoxPosition?(t.classList.add(p.checkboxLeft),e.item.firstElementChild.classList.add(p.checkboxLeft),e.item.firstElementChild.insertBefore(t,e.item.firstElementChild.childNodes[0])):(t.classList.add(p.checkboxRight),e.item.firstElementChild.classList.add(p.checkboxRight),e.item.firstElementChild.appendChild(t)),this.currentLiElements.push(e.item),"Left"===this.checkBoxPosition?this.virtualCheckBox=e.item.firstElementChild.children[0]:this.virtualCheckBox=e.item.firstElementChild.lastElementChild)},I.prototype.checkInternally=function(e,t){e.item.classList.add(p.selected),t.querySelector("."+p.checkboxIcon).classList.add(p.checked),t.setAttribute("aria-checked","true")},I.prototype.checkItem=function(e){this.toggleCheckBase(e,!0)},I.prototype.toggleCheckBase=function(e,t){var i;this.showCheckBox&&((i=e)instanceof Object&&e.constructor!==HTMLLIElement&&(i=this.getLiFromObjOrElement(e)),V.isNullOrUndefined(i)||(e=i.querySelector("."+p.checkboxIcon),!0===t?i.classList.add(p.selected):i.classList.remove(p.selected),!0===t?e.classList.add(p.checked):e.classList.remove(p.checked),e.parentElement.setAttribute("aria-checked",t?"true":"false")),this.setSelectedItemData(i),this.updateSelectedId())},I.prototype.uncheckItem=function(e){this.toggleCheckBase(e,!1)},I.prototype.checkAllItems=function(){this.toggleAllCheckBase(!0)},I.prototype.uncheckAllItems=function(){this.toggleAllCheckBase(!1)},I.prototype.toggleAllCheckBase=function(e){if(this.showCheckBox){for(var t=0;t<this.liCollection.length;t++){var i=this.liCollection[t].querySelector("."+p.checkboxIcon);i&&(e?i.classList.contains(p.checked)||this.checkItem(this.liCollection[t]):i.classList.contains(p.checked)&&this.uncheckItem(this.liCollection[t]))}this.enableVirtualization&&this.virtualizationModule.checkedItem(e),this.updateSelectedId()}},I.prototype.setCheckbox=function(){if(this.showCheckBox)for(var e=Array.prototype.slice.call(this.element.querySelectorAll("."+p.listItem)),t={item:void 0,curData:void 0,dataSource:void 0,fields:void 0,options:void 0,text:""},i=0;i<e.length;i++){var s=e[i];t.item=s,t.curData=this.getItemData(s),s.querySelector("."+p.checkboxWrapper)&&this.removeElement(s.querySelector("."+p.checkboxWrapper)),this.renderCheckbox(t),t.item.classList.contains(p.selected)&&this.checkInternally(t,t.item.querySelector("."+p.checkboxWrapper))}else{for(e=Array.prototype.slice.call(this.element.querySelectorAll("."+p.itemCheckList)),i=0;i<e.length;i++)(s=e[i]).classList.remove(p.selected),s.firstElementChild.classList.remove(p.checkbox),this.removeElement(s.querySelector("."+p.checkboxWrapper));this.selectedItems&&this.selectedItems.item.classList.add(p.selected)}},I.prototype.refreshItemHeight=function(){this.virtualizationModule&&this.virtualizationModule.refreshItemHeight()},I.prototype.handleCheckboxState=function(t,i,s,n,l,r,a,o){this.trigger("select",r,function(e){e.cancel&&((a?n:!n)?(i.classList.add(p.checked),t.classList.add(p.selected)):(i.classList.remove(p.checked),t.classList.remove(p.selected)),s.setAttribute("aria-checked",a?n?"true":"false":n?"false":"true"),V.merge(r,{isChecked:i.classList.contains(p.checked)}),l)&&(t.classList.remove(p.focused),o)&&o.classList.remove("e-focused")})},I.prototype.clickHandler=function(e){var t,i,s,n,l,r,a;Array.isArray(this.dataSource)&&0===this.dataSource.length||(t=e.target,(i=(this.targetElement=t).classList).contains(p.backIcon)||i.contains(p.headerText)?(this.showCheckBox&&this.curDSLevel[this.curDSLevel.length-1]&&this.uncheckAllItems(),this.back()):(null===(i=V.closest(t.parentNode,"."+p.listItem))&&(i=t),this.removeFocus(),this.enable&&this.showCheckBox&&this.isValidLI(i)?e.target.classList.contains(p.checkboxIcon)?(i.classList.add(p.focused),V.isNullOrUndefined(i.querySelector("."+p.checked))?this.checkInternally(s={curData:void 0,dataSource:void 0,fields:void 0,options:void 0,text:void 0,item:i},s.item.querySelector("."+p.checkboxWrapper)):(this.uncheckItem(i),i.classList.add(p.focused)),this.enableVirtualization&&this.virtualizationModule.setCheckboxLI(i,e),e&&(s=this.selectEventData(i,e),n=i.querySelector("."+p.checkboxIcon),V.merge(s,{isChecked:n.classList.contains(p.checked)}),l=i.querySelector("."+p.checkboxWrapper),r=n.classList.contains(p.checked),a=i.classList.contains(p.focused),this.handleCheckboxState(i,n,l,r,a,s,!1))):i.classList.contains(p.hasChild)?(this.removeHover(),this.removeSelect(),this.removeSelect(i),this.setSelectLI(i,e),i.classList.remove(p.selected)):(this.setCheckboxLI(i,e),"INPUT"!==t.nodeName&&"TEXTAREA"!==t.nodeName||(t.classList.add("e-focused"),this.targetElement=t)):(this.setSelectLI(i,e),"INPUT"!==t.nodeName&&"TEXTAREA"!==t.nodeName||(t.classList.add("e-focused"),this.targetElement=t)),n=V.closest(e.target,"li"),V.isNullOrUndefined(n)||n.classList.contains("e-has-child")&&!e.target.parentElement.classList.contains("e-listview-checkbox")&&n.classList.add(p.disable)),this.updateSelectedId())},I.prototype.removeElement=function(e){return e&&e.parentNode&&e.parentNode.removeChild(e)},I.prototype.hoverHandler=function(e){e=V.closest(e.target.parentNode,"."+p.listItem);this.setHoverLI(e)},I.prototype.leaveHandler=function(){this.removeHover()},I.prototype.homeKeyHandler=function(e,t){var i,s;e.preventDefault(),Object.keys(this.dataSource).length&&this.curUL&&(i=this.curUL.querySelectorAll("."+p.listItem),(s=this.curUL.querySelector("."+p.focused)||this.curUL.querySelector("."+p.selected))&&(s.classList.remove(p.focused),this.showCheckBox||s.classList.remove(p.selected)),i[s=t?i.length-1:0].classList.contains(p.hasChild)||this.showCheckBox?i[s].classList.add(p.focused):this.setSelectLI(i[s],e),i[s]?this.element.setAttribute("aria-activedescendant",i[s].id.toString()):this.element.removeAttribute("aria-activedescendant"))},I.prototype.onArrowKeyDown=function(e,t){var i,s;return!V.isNullOrUndefined(this.curUL.querySelector("."+p.hasChild))||this.showCheckBox?(s=this.curUL.querySelector("."+p.focused)||this.curUL.querySelector("."+p.selected),i=C.ListBase.getSiblingLI(this.curUL.querySelectorAll("."+p.listItem),s,t),V.isNullOrUndefined(i)||(s&&(s.classList.remove(p.focused),this.showCheckBox||s.classList.remove(p.selected)),i.classList.contains(p.hasChild)||this.showCheckBox?i.classList.add(p.focused):this.setSelectLI(i,e))):(s=this.curUL.querySelector("."+p.selected),i=C.ListBase.getSiblingLI(this.curUL.querySelectorAll("."+p.listItem),s,t),this.setSelectLI(i,e)),i?this.element.setAttribute("aria-activedescendant",i.id.toString()):this.element.removeAttribute("aria-activedescendant"),i},I.prototype.arrowKeyHandler=function(e,t){var i,s,n,l,r,a,o,c=this;e.preventDefault(),Object.keys(this.dataSource).length&&this.curUL&&(o=this.onArrowKeyDown(e,t),i=this.element.getBoundingClientRect().top,l=this.element.getBoundingClientRect().height,s=this.curUL.querySelector("."+p.listItem).getBoundingClientRect(),n=r=void 0,this.fields.groupBy&&(n=this.curUL.querySelector("."+p.groupListItem).getBoundingClientRect()),o?(a=o.getBoundingClientRect().top,o=o.getBoundingClientRect().height,t?(r=this.isWindow?a:a-i)<0&&(!0===this.isWindow?window.scroll(0,pageYOffset+r):this.element.scrollTop=this.element.scrollTop+r):(l=this.isWindow?window.innerHeight:l)<(r=this.isWindow?a+o:a-i+o)&&(!0===this.isWindow?window.scroll(0,pageYOffset+(r-l)):this.element.scrollTop=this.element.scrollTop+(r-l))):this.enableVirtualization&&t&&this.virtualizationModule.uiFirstIndex?(this.onUIScrolled=function(){c.onArrowKeyDown(e,t),c.onUIScrolled=void 0},r=this.virtualizationModule.listItemHeight,!0===this.isWindow?window.scroll(0,pageYOffset-r):this.element.scrollTop=this.element.scrollTop-r):t&&(this.showHeader&&this.headerEle?(a=(n||s).top,r=(o=this.headerEle.getBoundingClientRect()).top<0?o.height-a:0,!0===this.isWindow?window.scroll(0,pageYOffset-r):this.element.scrollTop=0):this.fields.groupBy&&(r=this.isWindow?n.top<0?n.top:0:i-s.top+n.height,!0===this.isWindow?window.scroll(0,pageYOffset+r):this.element.scrollTop=this.element.scrollTop-r)))},I.prototype.enterKeyHandler=function(e){var t,i;Object.keys(this.dataSource).length&&this.curUL&&(t=!V.isNullOrUndefined(this.curUL.querySelector("."+p.hasChild)),i=this.curUL.querySelector("."+p.focused),t)&&i&&(i.classList.remove(p.focused),this.showCheckBox&&(this.removeSelect(),this.removeSelect(i),this.removeHover()),this.setSelectLI(i,e))},I.prototype.spaceKeyHandler=function(e){var t,i,s,n,l;this.enable&&this.showCheckBox&&Object.keys(this.dataSource).length&&this.curUL&&(e.preventDefault(),t=this.curUL.querySelector("."+p.focused),n=s=void 0,!V.isNullOrUndefined(t)&&V.isNullOrUndefined(t.querySelector("."+p.checked))?(s=(i={curData:void 0,dataSource:void 0,fields:void 0,options:void 0,text:void 0,item:t}).item.querySelector("."+p.checkboxWrapper),this.checkInternally(i,s),n=s.querySelector("."+p.checkboxIcon+"."+p.icon)):this.uncheckItem(t),i=this.selectEventData(t,e),V.merge(i,{isChecked:!!n&&n.classList.contains(p.checked)}),V.isNullOrUndefined(t)||(s=t.querySelector("."+p.checkboxWrapper),n=(e=t.querySelector("."+p.checkboxIcon)).classList.contains(p.checked),l=t.classList.contains(p.focused),this.handleCheckboxState(t,e,s,n,l,i,!1)),this.updateSelectedId())},I.prototype.keyActionHandler=function(e){switch(e.keyCode){case 36:this.homeKeyHandler(e);break;case 35:this.homeKeyHandler(e,!0);break;case 40:this.arrowKeyHandler(e);break;case 38:this.arrowKeyHandler(e,!0);break;case 13:this.enterKeyHandler(e);break;case 8:this.showCheckBox&&this.curDSLevel[this.curDSLevel.length-1]&&this.uncheckAllItems(),this.back();break;case 32:!V.isNullOrUndefined(this.targetElement)&&this.targetElement.classList.contains("e-focused")||this.spaceKeyHandler(e)}},I.prototype.swipeActionHandler=function(e){"Right"===e.swipeDirection&&.5<e.velocity&&"touchend"===e.originalEvent.type&&(this.showCheckBox&&this.curDSLevel[this.curDSLevel.length-1]&&this.uncheckAllItems(),this.back())},I.prototype.focusout=function(){var e;Object.keys(this.dataSource).length&&this.curUL&&(e=this.curUL.querySelector("."+p.focused))&&(e.classList.remove(p.focused),this.showCheckBox||V.isNullOrUndefined(this.selectedLI)||this.selectedLI.classList.add(p.selected))},I.prototype.wireEvents=function(){V.EventHandler.add(this.element,"keydown",this.keyActionHandler,this),V.EventHandler.add(this.element,"click",this.clickHandler,this),V.EventHandler.add(this.element,"mouseover",this.hoverHandler,this),V.EventHandler.add(this.element,"mouseout",this.leaveHandler,this),V.EventHandler.add(this.element,"focusout",this.focusout,this),this.touchModule=new V.Touch(this.element,{swipe:this.swipeActionHandler.bind(this)}),V.isNullOrUndefined(this.scroll)||V.EventHandler.add(this.element,"scroll",this.onListScroll,this)},I.prototype.unWireEvents=function(){V.EventHandler.remove(this.element,"keydown",this.keyActionHandler),V.EventHandler.remove(this.element,"click",this.clickHandler),V.EventHandler.remove(this.element,"mouseover",this.hoverHandler),V.EventHandler.remove(this.element,"mouseout",this.leaveHandler),V.EventHandler.remove(this.element,"mouseover",this.hoverHandler),V.EventHandler.remove(this.element,"mouseout",this.leaveHandler),V.EventHandler.remove(this.element,"focusout",this.focusout),V.isNullOrUndefined(this.scroll)||V.EventHandler.remove(this.element,"scroll",this.onListScroll),this.touchModule&&this.touchModule.destroy(),this.touchModule=null},I.prototype.removeFocus=function(){for(var e=0,t=this.element.querySelectorAll("."+p.focused);e<t.length;e++)t[e].classList.remove(p.focused)},I.prototype.removeHover=function(){var e=this.element.querySelector("."+p.hover);e&&e.classList.remove(p.hover)},I.prototype.removeSelect=function(e){if(V.isNullOrUndefined(e))for(var t=0,i=this.element.querySelectorAll("."+p.selected);t<i.length;t++){var s=i[t];this.showCheckBox&&s.querySelector("."+p.checked)||s.classList.remove(p.selected)}else e.classList.remove(p.selected)},I.prototype.isValidLI=function(e){return e&&e.classList.contains(p.listItem)&&!e.classList.contains(p.groupListItem)&&!e.classList.contains(p.disable)},I.prototype.setCheckboxLI=function(e,t){var i,s,n,l,r,a;this.isValidLI(e)&&this.enable&&this.showCheckBox&&(this.curUL.querySelector("."+p.focused)&&this.curUL.querySelector("."+p.focused).classList.remove(p.focused),i=e.querySelector("textarea")||e.querySelector("input"),e.classList.add(p.focused),V.isNullOrUndefined(t)||t.target===i&&i.classList.add("e-focused"),n=(s=e.querySelector("."+p.checkboxWrapper)).querySelector("."+p.checkboxIcon+"."+p.icon),this.removeHover(),l=n.classList.contains(p.checked),r=e.classList.contains(p.focused),l?(n.classList.remove(p.checked),e.classList.remove(p.selected)):(n.classList.add(p.checked),e.classList.add(p.selected)),s.setAttribute("aria-checked",n.classList.contains(p.checked)?"true":"false"),a=this.selectEventData(e,t),V.merge(a,{isChecked:n.classList.contains(p.checked)}),this.enableVirtualization&&this.virtualizationModule.setCheckboxLI(e,t),this.handleCheckboxState(e,n,s,l,r,a,!0,i),this.setSelectedItemData(e),this.renderSubList(e))},I.prototype.selectEventData=function(e,t){var i=this.getItemData(e),s=A(i,this.listBaseOption.fields),s=!V.isNullOrUndefined(i)&&"string"==typeof this.dataSource[0]||"number"==typeof this.dataSource[0]?{item:e,text:e&&e.innerText.trim(),data:this.dataSource}:{item:e,text:s&&s[this.listBaseOption.fields.text],data:i},i={};return V.merge(i,s),t&&V.merge(i,{isInteracted:!0,event:t,cancel:!1,index:this.curUL&&Array.prototype.indexOf.call(this.curUL.children,e)}),i},I.prototype.setSelectedItemData=function(e){var t=this.getItemData(e),i=A(t,this.listBaseOption.fields);V.isNullOrUndefined(t)||"string"!=typeof this.dataSource[0]&&"number"!=typeof this.dataSource[0]?this.selectedItems={item:e,text:i&&i[this.listBaseOption.fields.text],data:t}:this.selectedItems={item:e,text:e&&e.innerText.trim(),data:this.dataSource}},I.prototype.setSelectLI=function(t,e){var i=this;this.isValidLI(t)&&!t.classList.contains(p.selected)&&this.enable&&(this.showCheckBox||this.removeSelect(),t.classList.add(p.selected),this.removeHover(),this.setSelectedItemData(t),this.enableVirtualization&&this.virtualizationModule.setSelectLI(t,e),e=this.selectEventData(t,e),this.trigger("select",e,function(e){e.cancel?(t.classList.remove(p.selected),i.selectedLI=t):(i.selectedLI=t,i.renderSubList(t))}))},I.prototype.setHoverLI=function(e){var t;this.isValidLI(e)&&!e.classList.contains(p.hover)&&this.enable&&((t=this.element.querySelectorAll("."+p.hover))&&t.length&&V.removeClass(t,p.hover),e.classList.contains(p.selected)&&!this.showCheckBox||e.classList.add(p.hover))},I.prototype.getSubDS=function(){var e=this.curDSLevel;if(e.length){for(var t=this.localData,i=0,s=e;i<s.length;i++)var n=s[i],l={},n=(l[this.fields.id]=n,this.curDSJSON=this.findItemFromDS(t,l),A(this.curDSJSON,this.listBaseOption.fields)),t=this.curDSJSON?n[this.fields.child]:t;return t}return this.localData},I.prototype.getItemData=function(e){var t=this.dataSource instanceof d.DataManager?this.localData:this.dataSource,e=this.getElementUID(e),t=V.isNullOrUndefined(this.element.querySelector("."+p.hasChild))&&this.fields.groupBy?this.curViewDS:t;return this.findItemFromDS(t,e)},I.prototype.findItemFromDS=function(s,n,l){var r,a=this;return s&&s.length&&n?s.some(function(e){var t,i=A(e,a.listBaseOption.fields);return!(!n[a.fields.id]&&!n[a.fields.text]||n[a.fields.id]&&(!V.isNullOrUndefined(i[a.fields.id])&&i[a.fields.id].toString())!==n[a.fields.id].toString()||n[a.fields.text]&&i[a.fields.text]!==n[a.fields.text])||"object"!=typeof e&&-1!==s.indexOf(e)?r=l?s:e:!V.isNullOrUndefined(n[a.fields.id])&&V.isNullOrUndefined(i[a.fields.id])?(t=a.element.querySelector('[data-uid="'+n[a.fields.id]+'"]'))&&t.innerText.trim()===i[a.fields.text]&&(r=e):Object.prototype.hasOwnProperty.call(i,a.fields.child)&&i[a.fields.child].length&&(r=a.findItemFromDS(i[a.fields.child],n,l)),!!r}):r=s,r},I.prototype.getQuery=function(){var e=[],t=this.query||new d.Query;if(!this.query){for(var i=0,s=Object.keys(this.fields.properties);i<s.length;i++){var n=s[i];"tableName"!==n&&this.fields[""+n]&&this.fields[""+n]!==C.ListBase.defaultMappedFields[""+n]&&-1===e.indexOf(this.fields[""+n])&&e.push(this.fields[""+n])}t.select(e),Object.prototype.hasOwnProperty.call(this.fields.properties,"tableName")&&t.from(this.fields.tableName)}return t},I.prototype.setViewDataSource=function(e){void 0===e&&(e=this.localData);var t=V.isNullOrUndefined(this.fields.sortBy)?this.fields.text:this.fields.sortBy,t=C.ListBase.addSorting(this.sortOrder,t);e&&this.fields.groupBy?"None"!==this.sortOrder?this.curViewDS=C.ListBase.groupDataSource(C.ListBase.getDataSource(e,t),this.listBaseOption.fields,this.sortOrder):this.curViewDS=C.ListBase.groupDataSource(e,this.listBaseOption.fields,this.sortOrder):e&&"None"!==this.sortOrder?this.curViewDS=C.ListBase.getDataSource(e,t):this.curViewDS=e},I.prototype.isInAnimation=function(){return this.curUL.classList.contains(".e-animate")},I.prototype.renderRemoteLists=function(e,t){this.isDestroyed||(this.localData=e.result,t.removeElement(t.contentContainer),this.renderList(),this.trigger("actionComplete",e))},I.prototype.triggerActionFailure=function(e){this.isDestroyed||this.trigger("actionFailure",e)},I.prototype.setLocalData=function(){var e,t=this;this.trigger("actionBegin"),this.dataSource instanceof d.DataManager?this.dataSource.ready?this.dataSource.ready.then(function(e){t.isOffline=t.dataSource.dataSource.offline,t.dataSource instanceof d.DataManager&&t.isOffline&&t.renderRemoteLists(e,t)}).catch(function(e){t.triggerActionFailure(e)}):this.dataSource.executeQuery(this.getQuery()).then(function(e){t.renderRemoteLists(e,t)}).catch(function(e){t.triggerActionFailure(e)}):this.dataSource&&this.dataSource.length?(this.localData=this.dataSource,this.renderList(),this.trigger("actionComplete",{data:this.localData})):(e=this.element.querySelector("ul"))&&(V.remove(e),this.setProperties({dataSource:C.ListBase.createJsonFromElement(e)},!0),this.localData=this.dataSource,this.renderList(),this.trigger("actionComplete",{data:this.localData}))},I.prototype.reRender=function(){this.removeElement(this.headerEle),this.removeElement(this.ulElement),this.removeElement(this.contentContainer),this.isReact&&this.clearTemplate(),-1===Object.keys(window).indexOf("ejsInterop")&&(this.element.innerHTML=""),this.headerEle=this.ulElement=this.liCollection=void 0,this.header(),this.setLocalData()},I.prototype.resetCurrentList=function(){this.setViewDataSource(this.curViewDS),this.contentContainer.innerHTML="",this.createList(),this.renderIntoDom(this.curUL)},I.prototype.setAttributes=function(e){for(var t=0;t<e.length;t++){var i=e[parseInt(t.toString(),10)];i.classList.contains("e-list-item")&&(i.setAttribute("id",this.element.id+"_"+i.getAttribute("data-uid")),i.setAttribute("tabindex","-1"))}},I.prototype.createList=function(){this.currentLiElements=[],this.isNestedList=!1,this.ulElement=this.curUL=C.ListBase.createList(this.createElement,this.curViewDS,this.listBaseOption,null,this),this.liCollection=this.curUL.querySelectorAll("."+p.listItem),this.setAttributes(this.liCollection)},I.prototype.renderSubList=function(e){var t,i,s=(this.liElement=e).getAttribute("data-uid");e.classList.contains(p.hasChild)&&s&&(e=V.closest(e.parentNode,"."+p.parentItem),t=this.element.querySelector("[pid='"+s+"']"),this.curDSLevel.push(s),this.setViewDataSource(this.getSubDS()),this.enableVirtualization&&this.virtualizationModule.updateDOMItemCount(),t||(i=this.curViewDS,t=C.ListBase.createListFromJson(this.createElement,i,this.listBaseOption,this.curDSLevel.length,null,this),this.isReact&&this.renderReactTemplates(),i=t.querySelectorAll("."+p.listItem),this.setAttributes(i),t.setAttribute("pID",s),t.style.display="none",this.renderIntoDom(t)),this.switchView(e,t),this.liCollection=this.curUL.querySelectorAll("."+p.listItem),this.selectedItems&&(i=A(this.selectedItems.data,this.listBaseOption.fields),this.header(i[this.listBaseOption.fields.text],!0,"header")),this.selectedLI=void 0)},I.prototype.renderIntoDom=function(e){this.contentContainer.appendChild(e)},I.prototype.renderList=function(e){this.setViewDataSource(e),this.enableVirtualization?(Object.keys(this.dataSource).length&&(this.template||this.groupTemplate)&&!this.virtualizationModule.isNgTemplate()&&(this.listBaseOption.itemCreated=this.virtualizationModule.createUIItem.bind(this.virtualizationModule)),this.virtualizationModule.uiVirtualization()):(this.createList(),this.contentContainer=this.createElement("div",{className:p.container}),this.element.appendChild(this.contentContainer),this.renderIntoDom(this.ulElement),this.isReact&&this.renderReactTemplates())},I.prototype.getElementUID=function(e){var t={};return e instanceof Element?t[this.fields.id]=e.getAttribute("data-uid"):t=e,t},I.prototype.render=function(){this.element.classList.add(p.root),V.attributes(this.element,{tabindex:"0"}),this.setCSSClass(),this.setEnableRTL(),this.setEnable(),this.setSize(),this.wireEvents(),this.header(),this.setLocalData(),this.setHTMLAttribute(),this.rippleFn=V.rippleEffect(this.element,{selector:"."+p.listItem}),this.renderComplete(),this.previousScrollTop=this.element.scrollTop},I.prototype.destroy=function(){this.isReact&&this.clearTemplate(),this.unWireEvents();var e=[p.root,p.disable,"e-rtl","e-has-header","e-lib"].concat(this.cssClass?this.cssClass.split(" ").filter(function(e){return e}):[]);V.removeClass([this.element],e),this.element.removeAttribute("role"),this.element.removeAttribute("tabindex"),this.curUL=this.ulElement=this.liCollection=this.headerEle=void 0,this.element.innerHTML="",this.contentContainer=null,this.selectedItems=null,this.selectedLI=null,this.liElement=null,this.targetElement=null,this.currentLiElements=null,this.virtualCheckBox=null,m.prototype.destroy.call(this)},I.prototype.back=function(){var e,t,i,s=this.curDSLevel[this.curDSLevel.length-1];void 0===s||this.isInAnimation()||(this.curDSLevel.pop(),this.setViewDataSource(this.getSubDS()),this.enableVirtualization&&this.virtualizationModule.updateDOMItemCount(),e=this.element.querySelector("[data-uid='"+s+"']"),i=this.curUL,e=e?e.parentElement:(this.createList(),this.renderIntoDom(this.ulElement),this.curUL),t=A(this.curDSJSON,this.listBaseOption.fields)[this.fields.text],this.switchView(i,e,!0),this.removeFocus(),(i=this.element.querySelector("[data-uid='"+s+"']")).classList.remove(p.disable),i.classList.add(p.focused),this.showCheckBox&&i.querySelector("."+p.checkboxIcon).classList.contains(p.checked)||i.classList.remove(p.selected),this.liCollection=this.curUL.querySelectorAll("."+p.listItem),this.enableHtmlSanitizer&&this.setProperties({headerTitle:V.SanitizeHtmlHelper.sanitize(this.headerTitle)},!0),this.header(this.curDSLevel.length?t:this.headerTitle,!!this.curDSLevel.length,"header"))},I.prototype.selectItem=function(e){this.enableVirtualization?this.virtualizationModule.selectItem(e):this.showCheckBox?this.setCheckboxLI(this.getLiFromObjOrElement(e)):!0===V.isNullOrUndefined(e)?this.removeSelect():this.setSelectLI(this.getLiFromObjOrElement(e))},I.prototype.unselectItem=function(e){V.isNullOrUndefined(e)?this.removeSelect():(e=this.getLiFromObjOrElement(e),V.isNullOrUndefined(e)||this.removeSelect(e))},I.prototype.getLiFromObjOrElement=function(t){var i,e=this.dataSource instanceof d.DataManager?this.localData:this.dataSource;if(!V.isNullOrUndefined(t))if("string"==typeof e[0]||"number"==typeof e[0])if(t instanceof Element){for(var s=t.getAttribute("data-uid").toString(),n=0;n<this.liCollection.length;n++)if(this.liCollection[parseInt(n.toString(),10)].getAttribute("data-uid").toString()===s){i=this.liCollection[parseInt(n.toString(),10)];break}}else Array.prototype.some.call(this.curUL.querySelectorAll("."+p.listItem),function(e){return e.innerText.trim()===t.toString()&&(i=e,!0)});else{var e=this.getItemData(t),l=A(e,this.listBaseOption.fields);if(e&&(i=this.element.querySelector('[data-uid="'+l[this.fields.id]+'"]'),!this.enableVirtualization)&&V.isNullOrUndefined(i))for(var r=this.element.querySelectorAll("."+p.listItem),n=0;n<r.length;n++)r[parseInt(n.toString(),10)].innerText.trim()===l[this.fields.text]&&(i=r[parseInt(n.toString(),10)])}return i},I.prototype.selectMultipleItems=function(e){if