@syncfusion/ej2-lists
Advanced tools
Comparing version 15.4.23 to 15.4.24
@@ -7,2 +7,10 @@ # Changelog | ||
#### Bug Fixes | ||
- `data-value` not updated properly for array of string or number inputs bug fixed. | ||
## 15.4.23-preview (2017-12-27) | ||
### Common | ||
#### New Features | ||
@@ -9,0 +17,0 @@ |
/*! | ||
* filename: ej2-lists.umd.min.js | ||
* version : 15.4.23 | ||
* version : 15.4.24 | ||
* Copyright Syncfusion Inc. 2001 - 2017. All rights reserved. | ||
@@ -11,3 +11,3 @@ * Use of this code is subject to the terms of our license. | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-data")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-data"],t):t(e.ej={},e.ej2Base,e.ej2Data)}(this,function(e,t,i){"use strict";function s(e,i){var s,r={};if(t.isNullOrUndefined(e))return e;if("string"==typeof e||"number"==typeof e)return e;if(t.isNullOrUndefined(e.isHeader))for(var n=0,o=Object.keys(i);n<o.length;n++){var l=o[n];if(!t.isNullOrUndefined(i[l])&&"string"==typeof i[l]){var a=i[l].split("."),d=a.length>1?a[0]:i[l];t.isNullOrUndefined(e[d])||(s=t.getValue(i[l],e),t.isNullOrUndefined(s)||(r[i[l]]=s))}}else!t.isNullOrUndefined(e.isHeader)&&e.isHeader&&(r=e);return r}e.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"},function(r){function n(e,t,i){return C(o(e,t,i),null,i)}function o(i,s,r){var n=[],o=t.extend({},O,r);e.cssClass=g(o.moduleName);for(var l=y(),a=0;a<i.length;a++)if(!t.isNullOrUndefined(i[a])){var d=void 0;if(o.itemCreating&&"function"==typeof o.itemCreating){var c={dataSource:i,curData:i[a],text:i[a],options:o};o.itemCreating(c)}if(d=s?v(i[a],null,null,[],null,l,a,r):S(i[a],null,null,r),o.itemCreated&&"function"==typeof o.itemCreated){c={dataSource:i,curData:i[a],text:i[a],item:d,options:o};o.itemCreated(c)}n.push(d)}return n}function l(i,n,o,l){var d=t.extend({},O,n);e.cssClass=g(d.moduleName);var c,h=t.extend({},r.defaultMappedFields,d.fields),u=t.extend({},L,d.ariaAttributes);o&&(u.level=o);var f,b=[];Object.keys(i).length&&!p(i).item.hasOwnProperty(h.id)&&(c=y());for(var C=0;C<i.length;C++){var I=s(i[C],h);if(!t.isNullOrUndefined(i[C])){if(d.itemCreating&&"function"==typeof d.itemCreating){var w={dataSource:i,curData:i[C],text:I[h.text],options:d,fields:h};d.itemCreating(w)}var x=i[C];Object.keys(i).length&&I.hasOwnProperty(h.id)&&!t.isNullOrUndefined(I[h.id])&&(c=I.id);var D=[];if(d.showCheckBox&&D.push(t.createElement("input",{className:e.cssClass.check,attrs:{type:"checkbox"}})),!0===l)d.showIcon&&I.hasOwnProperty(h.iconCss)&&(t.isNullOrUndefined(I[h.iconCss])||D.push(t.createElement("span",{className:e.cssClass.icon+" "+I[h.iconCss]}))),f=v(x,h,d.itemClass,D,!(!x.hasOwnProperty("isHeader")||!x.isHeader),c,C,n);else{if((f=S(x,h,d.itemClass,n)).classList.add(e.cssClass.level+"-"+u.level),f.setAttribute("aria-level",u.level.toString()),I.hasOwnProperty(h.tooltip)&&f.setAttribute("title",I[h.tooltip]),I.hasOwnProperty(h.htmlAttributes)&&I[h.htmlAttributes]&&m(f,I[h.htmlAttributes]),I.hasOwnProperty(h.enabled)&&!1===I[h.enabled]&&f.classList.add(e.cssClass.disabled),I.hasOwnProperty(h.isVisible)&&!1===I[h.isVisible]&&(f.style.display="none"),I.hasOwnProperty(h.imageUrl)&&!t.isNullOrUndefined(I[h.imageUrl])){var N={src:I[h.imageUrl]};I.hasOwnProperty(h.imageUrl)&&t.merge(N,I[h.imageAttributes]),t.prepend([t.createElement("img",{className:e.cssClass.image,attrs:N})],f.firstElementChild)}d.showIcon&&I.hasOwnProperty(h.iconCss)&&!d.template&&(t.isNullOrUndefined(I[h.iconCss])||t.prepend([t.createElement("div",{className:e.cssClass.icon+" "+I[h.iconCss]})],f.firstElementChild)),D.length&&t.prepend(D,f.firstElementChild),function(i,r,n,o,l,d){var c=s(i,r),h=c[r.child]||[],u=c[r.hasChildren];if(h.length&&(u=!0,l.classList.add(e.cssClass.hasChild),o.processSubChild)){var p=a(h,o,++d);l.appendChild(p)}if(o.expandCollapse&&u&&!o.template){l.firstElementChild.classList.contains(e.cssClass.textContent)&&l.firstElementChild.classList.add(e.cssClass.iconWrapper);var m="left"===o.expandIconPosition?t.prepend:t.append;m([t.createElement("div",{className:"e-icons "+o.expandIconClass})],l.querySelector("."+e.cssClass.textContent))}}(x,h,0,d,f,u.level)}if(d.itemCreated&&"function"==typeof d.itemCreated){w={dataSource:i,curData:i[C],text:I[h.text],item:f,options:d,fields:h};d.itemCreated(w)}b.push(f)}}return b}function a(e,i,s,r){var n=t.extend({},O,i);return C(l(e,i,s,r),n.listClass,i)}function d(e,t){if(t&&e){return Array.prototype.slice.call(t).indexOf(e)}}function c(e,t,s){return void 0===s&&(s=new i.Query),"Ascending"===e?s.sortBy(t,"ascending",!0):"Descending"===e&&s.sortBy(t,"descending",!0),s}function h(e,t){return new i.DataManager(e).executeLocal(t)}function u(e,i){var s=t.extend({},O,i),n=t.extend({},r.defaultMappedFields,s.fields),o=e.cloneNode(!0),l=[];o.classList.add("json-parent");var a=o.querySelectorAll(".json-parent>li");o.classList.remove("json-parent");for(var d=0;d<a.length;d++){for(var c=a[d],h=c.querySelector("a"),p=c.querySelector("ul"),m={},v=h?h.childNodes:c.childNodes,g=Object.keys(v),b=0;b<v.length;b++)v[Number(g[b])].hasChildNodes()||(m[n.text]=v[Number(g[b])].textContent);m[n.id]=y();var S=f(c);Object.keys(S).length&&(m[n.htmlAttributes]=S),h&&(S=f(h),Object.keys(S).length&&(m[n.urlAttributes]=S)),p&&(m[n.child]=u(p,i)),l.push(m)}return l}function p(e){for(var i={typeof:null,item:null},s=0;s<e.length;s++)if(!t.isNullOrUndefined(e[s]))return i={typeof:typeof e[s],item:e[s]};return i}function m(e,i){var s={};t.merge(s,i),s.class&&(t.addClass([e],s.class.split(" ")),delete s.class),t.attributes(e,s)}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 y(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}function v(i,r,n,o,l,a,d,c){var h,u=t.extend({},O,c),p=t.extend({},L,u.ariaAttributes),f=i,y=i,v=s(i,r);"string"!=typeof i&&"number"!=typeof i&&(h=i,f=v[r.text]||"",y=v[r.value]);var g;g=t.isNullOrUndefined(h)||t.isNullOrUndefined(v[r.id])||""===v[r.id]?a+"-"+d:a;var S=t.createElement("li",{className:(!0===l?e.cssClass.group:e.cssClass.li)+" "+(t.isNullOrUndefined(n)?"":n),id:g,attrs:""!==p.groupItemRole&&""!==p.itemRole?{role:!0===l?p.groupItemRole:p.itemRole}:{}});return h&&v.hasOwnProperty(r.enabled)&&"false"===v[r.enabled].toString()&&S.classList.add(e.cssClass.disabled),l?S.innerText=f:(t.isNullOrUndefined(y)||S.setAttribute("data-value",y),S.setAttribute("role","option"),h&&v.hasOwnProperty(r.htmlAttributes)&&v[r.htmlAttributes]&&m(S,v[r.htmlAttributes]),o.length&&t.append(o,S),h&&v.hasOwnProperty(r.url)&&v[r.url]?S.appendChild(b(h,r,f)):S.appendChild(document.createTextNode(f))),S}function g(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"}}function b(i,r,n){var o=s(i,r),l={href:o[r.url]};o.hasOwnProperty(r.urlAttributes)&&o[r.urlAttributes]&&t.merge(l,o[r.urlAttributes]);var a=t.createElement("a",{className:e.cssClass.text+" "+e.cssClass.url,innerHTML:n});return m(a,l),a}function S(i,r,n,o){var l,a,d,c,h=t.extend({},O,o),u=t.extend({},L,h.ariaAttributes),p=i;"string"!=typeof i&&(d=i,p=(c=s(i,r))[r.text]||"",l=c[r.id],a=!(!i.hasOwnProperty("isHeader")||!i.isHeader));var m=t.createElement("li",{className:(!0===a?e.cssClass.group:e.cssClass.li)+" "+(t.isNullOrUndefined(n)?"":n),attrs:""!==u.groupItemRole&&""!==u.itemRole?{role:!0===a?u.groupItemRole:u.itemRole}:{}});if(t.isNullOrUndefined(l)?m.setAttribute("data-uid",y()):m.setAttribute("data-uid",l),a&&o&&o.groupTemplate){var f=t.compile(o.groupTemplate);t.append(f(i),m)}else if(!a&&o&&o.template){f=t.compile(o.template);t.append(f(i),m)}else{var v=t.createElement("div",{className:e.cssClass.textContent,attrs:""!==u.wrapperRole?{role:u.wrapperRole}:{}});d&&c.hasOwnProperty(r.url)&&c[r.url]?v.appendChild(b(d,r,p)):v.appendChild(t.createElement("span",{className:e.cssClass.text,innerHTML:p,attrs:""!==u.itemText?{role:u.itemText}:{}})),m.appendChild(v)}return m}function C(i,s,r){var n=t.extend({},O,r),o=t.extend({},L,n.ariaAttributes);e.cssClass=g(n.moduleName);var l=t.createElement("ul",{className:e.cssClass.ul+" "+(t.isNullOrUndefined(s)?"":s),attrs:""!==o.listRole?{role:o.listRole}:{}});return t.append(i,l),l}r.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};var L={level:1,listRole:"presentation",itemRole:"presentation",groupItemRole:"group",itemText:"list-item",wrapperRole:"presentation"},O={showCheckBox:!1,showIcon:!1,expandCollapse:!1,fields:r.defaultMappedFields,ariaAttributes:L,listClass:"",itemClass:"",processSubChild:!1,sortOrder:"None",template:null,groupTemplate:null,expandIconClass:"e-icon-collapsible",moduleName:"list",expandIconPosition:"right"};r.createList=function(e,i,s){var r=t.extend({},O,i),o=t.extend({},L,r.ariaAttributes),l=p(e).typeof;return"string"===l||"number"===l?n(e,s,i):a(e,i,o.level,s)},r.createListFromArray=n,r.createListItemFromArray=o,r.createListItemFromJson=l,r.createListFromJson=a,r.getSiblingLI=function(i,s,r){if(e.cssClass=g(O.moduleName),i&&i.length){var n,o,l=Array.prototype.slice.call(i);for(n=l[(o=s?d(s,l):!0===r?l.length:-1)+(!0===r?-1:1)];n&&(!t.isVisible(n)||n.classList.contains(e.cssClass.disabled));)n=l[o+=!0===r?-1:1];return n}},r.indexOf=d,r.groupDataSource=function(e,t,s){void 0===s&&(s="None");var r=(new i.Query).group(t.groupBy),n=h(e,r=c(s,"key",r));e=[];for(var o=0;o<n.length;o++){var l=n[o].items,a={};a[t.text]=n[o].key,a.isHeader=!0,a.items=l,e.push(a);for(var d=0;d<l.length;d++)e.push(l[d])}return e},r.addSorting=c,r.getDataSource=h,r.createJsonFromElement=u,r.renderContentTemplate=function(i,r,n){e.cssClass=g(O.moduleName);for(var o=t.createElement("ul",{className:e.cssClass.ul,attrs:{role:"presentation"}}),l=t.compile(i),a=[],d=y(),c=0;c<r.length;c++){var h=s(r[c],n),u=r[c],p=u.isHeader,m=t.createElement("li",{id:d+"-"+c,className:p?e.cssClass.group:e.cssClass.li,attrs:{role:"presentation"}});if(p)m.innerText=h[n.text];else{t.append(l(u),m);var f=h[n.value];m.setAttribute("data-value",f),m.setAttribute("role","option")}a.push(m)}return t.append(a,o),o},r.renderGroupTemplate=function(e,i,s,r){for(var n=t.compile(e),o=s.groupBy,l={},a=0,d=r;a<d.length;a++){var c=d[a];l[o]=c.textContent,c.innerHTML="",t.append(n(l),c)}return r},r.generateUL=C,r.generateIcon=function(i,s,r){var n=t.extend({},O,r);return t.extend({},L,n.ariaAttributes),e.cssClass=g(n.moduleName),("left"===n.expandIconPosition?t.prepend:t.append)([t.createElement("div",{className:"e-icons "+n.expandIconClass+" "+(t.isNullOrUndefined(s)?"":s)})],i.querySelector("."+e.cssClass.textContent)),i}}(e.ListBase||(e.ListBase={}));var r=function(){var e=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])};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),n=function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;l>=0;l--)(r=e[l])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},o={None:[],SlideLeft:["SlideRightOut","SlideLeftOut","SlideLeftIn","SlideRightIn"],SlideDown:["SlideTopOut","SlideBottomOut","SlideBottomIn","SlideTopIn"],Zoom:["FadeOut","FadeZoomOut","FadeZoomIn","FadeIn"],Fade:["FadeOut","FadeOut","FadeIn","FadeIn"]},l={None:[],SlideLeft:["SlideLeftOut","SlideRightOut","SlideRightIn","SlideLeftIn"],SlideDown:["SlideBottomOut","SlideTopOut","SlideTopIn","SlideBottomIn"],Zoom:["FadeZoomOut","FadeOut","FadeIn","FadeZoomIn"],Fade:["FadeOut","FadeOut","FadeIn","FadeIn"]},a="e-listview",d="e-hover",c="e-active",h="e-list-parent",u="e-list-item",p="e-list-group-item",m="e-has-child",f="e-list-header",y="e-headertext",v="e-text",g="e-disabled",b="e-content",S="e-icons",C="e-icon-back",L=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return r(i,e),n([t.Property("id")],i.prototype,"id",void 0),n([t.Property("text")],i.prototype,"text",void 0),n([t.Property("isChecked")],i.prototype,"isChecked",void 0),n([t.Property("isVisible")],i.prototype,"isVisible",void 0),n([t.Property("enabled")],i.prototype,"enabled",void 0),n([t.Property("iconCss")],i.prototype,"iconCss",void 0),n([t.Property("child")],i.prototype,"child",void 0),n([t.Property("tooltip")],i.prototype,"tooltip",void 0),n([t.Property("groupBy")],i.prototype,"groupBy",void 0),n([t.Property("text")],i.prototype,"sortBy",void 0),n([t.Property("htmlAttributes")],i.prototype,"htmlAttributes",void 0),n([t.Property("tableName")],i.prototype,"tableName",void 0),i}(t.ChildProperty),O=function(O){function I(e,i){var s=O.call(this,e,i)||this;return s.curDSLevel=[],s.curViewDS=[],s.keyConfigs={moveDown:"downarrow",moveUp:"uparrow",select:"enter",back:"backspace"},s.animateOptions={},s.aniObj=new t.Animation(s.animateOptions),s}return r(I,O),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.reRender();break;case"headerTitle":this.curDSLevel.length||this.header(this.headerTitle,!1);break;case"showHeader":this.header(this.headerTitle,!1);break;case"dataSource":this.reRender();break;case"sortOrder":case"showIcon":this.listBaseOption.showIcon=this.showIcon,this.curViewDS=this.getSubDS(),this.resetCurrentList()}}},I.prototype.setHTMLAttribute=function(){Object.keys(this.htmlAttributes).length&&t.attributes(this.element,this.htmlAttributes)},I.prototype.setCSSClass=function(e){this.cssClass&&t.addClass([this.element],this.cssClass.split(" ")),e&&t.removeClass([this.element],e.split(" "))},I.prototype.setSize=function(){this.element.style.height=t.formatUnit(this.height),this.element.style.width=t.formatUnit(this.width)},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(g):e.classList.add(g)},I.prototype.header=function(e,i){if(void 0===this.headerEle&&this.showHeader){this.headerEle=t.createElement("div",{className:f});var s=t.createElement("span",{className:y,innerHTML:this.headerTitle}),r=t.createElement("div",{className:v,innerHTML:s.outerHTML}),n=t.createElement("div",{className:S+" "+C+" e-but-back",attrs:{style:"display:none;"}});this.headerEle.appendChild(n),this.headerEle.appendChild(r),this.element.classList.add("e-has-header"),t.prepend([this.headerEle],this.element)}else if(this.headerEle)if(this.showHeader){this.headerEle.style.display="";r=this.headerEle.querySelector("."+y),n=this.headerEle.querySelector("."+C);r.innerHTML=e,n.style.display=!0===i?"":"none"}else this.headerEle.style.display="none"},I.prototype.switchView=function(e,t,i){var s=this;if(e&&t){var r=e.style.position,n="hidden"!==this.element.style.overflow?this.element.style.overflow:"";e.style.position="absolute",e.classList.add("e-view");var a=void 0,d=this.animation.duration;if(this.animation.effect)a=this.enableRtl?l[this.animation.effect]:o[this.animation.effect];else{a=o.SlideLeft,i=this.enableRtl,d=0}this.element.style.overflow="hidden",this.aniObj.animate(e,{name:!0===i?a[0]:a[1],duration:d,timingFunction:this.animation.easing,end:function(t){e.style.display="none",s.element.style.overflow=n,e.style.position=r,e.classList.remove("e-view")}}),t.style.display="",this.aniObj.animate(t,{name:!0===i?a[2]:a[3],duration:d,timingFunction:this.animation.easing,end:function(){s.trigger("actionComplete")}}),this.curUL=t}},I.prototype.preRender=function(){this.listBaseOption={template:this.template,groupTemplate:this.groupTemplate,expandCollapse:!0,listClass:"",ariaAttributes:{itemRole:"listitem",listRole:"list",itemText:"",groupItemRole:"group",wrapperRole:"presentation"},fields:this.fields.properties,sortOrder:this.sortOrder,showIcon:this.showIcon}},I.prototype.clickHandler=function(e){var i=e.target,s=i.classList;if(s.contains(C)||s.contains(y))this.back();else{var r=t.closest(i.parentNode,"."+u);null===r&&(r=i),this.setSelectLI(r,e)}},I.prototype.hoverHandler=function(e){var i=t.closest(e.target.parentNode,"."+u);this.setHoverLI(i)},I.prototype.leaveHandler=function(e){this.removeHover()},I.prototype.keyActionHandler=function(e){switch(e.preventDefault(),e.action){case"moveDown":this.hoverSiblingLI();break;case"moveUp":this.hoverSiblingLI(!0);break;case"select":this.setSelectLI(this.curUL.querySelector("."+d),e);break;case"back":this.back()}},I.prototype.swipeActionHandler=function(e){"Right"===e.swipeDirection&&this.back()},I.prototype.wireEvents=function(){t.EventHandler.add(this.element,"click",this.clickHandler,this),t.EventHandler.add(this.element,"mouseover",this.hoverHandler,this),t.EventHandler.add(this.element,"mouseout",this.leaveHandler,this),this.keyboardModule=new t.KeyboardEvents(this.element,{keyAction:this.keyActionHandler.bind(this),keyConfigs:this.keyConfigs}),this.touchModule=new t.Touch(this.element,{swipe:this.swipeActionHandler.bind(this)})},I.prototype.unWireEvents=function(){t.EventHandler.remove(this.element,"click",this.clickHandler),t.EventHandler.remove(this.element,"mouseover",this.hoverHandler),t.EventHandler.remove(this.element,"mouseout",this.leaveHandler),this.keyboardModule.destroy(),this.touchModule.destroy()},I.prototype.removeHover=function(){var e=this.element.querySelector("."+d);e&&e.classList.remove(d)},I.prototype.removeSelect=function(){for(var e=0,t=this.element.querySelectorAll("."+c);e<t.length;e++){var i=t[e];i.removeAttribute("aria-selected"),""!==i.className&&i.classList.remove(c),this.selectedItems=void 0}},I.prototype.isValidLI=function(e){return e&&e.classList.contains(u)&&!e.classList.contains(p)&&!e.classList.contains(g)},I.prototype.setSelectLI=function(e,i){if(this.isValidLI(e)&&!e.classList.contains(c)&&this.enable){this.removeSelect(),e.classList.add(c),e.setAttribute("aria-selected","true"),this.removeHover();var r=this.getItemData(e),n=s(r,this.listBaseOption.fields);t.isNullOrUndefined(r)&&"string"==typeof this.dataSource[0]?this.selectedItems={item:e,text:e.innerText.trim(),data:this.dataSource}:this.selectedItems={item:e,text:n[this.listBaseOption.fields.text],data:r};var o={};t.merge(o,this.selectedItems),i&&t.merge(o,{isInteracted:!0,event:i}),this.trigger("select",o),this.selectedLI=e,this.renderSubList(e)}},I.prototype.setHoverLI=function(e){if(this.isValidLI(e)&&!e.classList.contains(d)&&this.enable){var i=this.element.querySelectorAll("."+d);i&&i.length&&t.removeClass(i,d),e.classList.contains(c)||e.classList.add(d)}},I.prototype.hoverSiblingLI=function(t){var i,s=this.curUL.querySelector("."+d);if(s||(s=this.curUL.querySelector("."+c)),s)i=e.ListBase.getSiblingLI(this.curUL.querySelectorAll("."+u),s,t);else if(t){var r=this.curUL.querySelectorAll("."+u);i=r[r.length-1]}else i=this.curUL.querySelector("."+u);this.setHoverLI(i)},I.prototype.getSubDS=function(){var e=this.curDSLevel;if(e.length){for(var t=this.localData,i=0,r=e;i<r.length;i++){var n=r[i];this.curDSJSON=this.findItemFromDS(t,{id:n});var o=s(this.curDSJSON,this.listBaseOption.fields);t=this.curDSJSON?o[this.fields.child]:t}return t}return this.localData},I.prototype.getItemData=function(e){var t=this.getElementUID(e),i=this.dataSource;return this.findItemFromDS(i,t)},I.prototype.findItemFromDS=function(e,i,r){var n,o=this;return e&&e.length&&i?e.some(function(l){var a=s(l,o.listBaseOption.fields);if(!i.id&&!i.text||i.id&&a[o.fields.id]!==i.id||i.text&&a[o.fields.text]!==i.text)if(!t.isNullOrUndefined(i.id)&&t.isNullOrUndefined(a[o.fields.id])){o.element.querySelector('[data-uid="'+i.id+'"]').innerText.trim()===a[o.fields.text]&&(n=l)}else a.hasOwnProperty(o.fields.child)&&a[o.fields.child].length&&(n=o.findItemFromDS(a[o.fields.child],i,r));else n=r?e:l;return!!n}):n=e,n},I.prototype.getQuery=function(){var t=[],s=this.query?this.query:new i.Query;if(!this.query){for(var r=0,n=Object.keys(this.fields.properties);r<n.length;r++){var o=n[r];"tableName"!==o&&this.fields[o]&&this.fields[o]!==e.ListBase.defaultMappedFields[o]&&-1===t.indexOf(this.fields[o])&&t.push(this.fields[o])}s.select(t),this.fields.properties.hasOwnProperty("tableName")&&s.from(this.fields.tableName)}return s},I.prototype.setViewDataSource=function(t){void 0===t&&(t=this.localData),t&&this.fields.groupBy?this.curViewDS=e.ListBase.groupDataSource(t,this.fields,this.sortOrder):t&&"None"!==this.sortOrder?this.curViewDS=e.ListBase.getDataSource(t,e.ListBase.addSorting(this.sortOrder,this.fields.sortBy)):this.curViewDS=t},I.prototype.isInAnimation=function(){return this.curUL.classList.contains(".e-animate")},I.prototype.setLocalData=function(){var s=this;if(this.trigger("actionBegin"),this.dataSource instanceof i.DataManager)this.dataSource.executeQuery(this.getQuery()).then(function(e){s.isDestroyed||(s.localData=e.result,s.renderList(),s.trigger("actionComplete",e))}).catch(function(e){s.isDestroyed||s.trigger("actionFailure",e)});else if(this.dataSource&&this.dataSource.length)this.localData=this.dataSource,this.renderList(),this.trigger("actionComplete",{data:this.localData});else{var r=this.element.querySelector("ul");r&&(t.remove(r),this.setProperties({dataSource:e.ListBase.createJsonFromElement(r)},!0),this.localData=this.dataSource,this.renderList(),this.trigger("actionComplete",{data:this.localData}))}},I.prototype.reRender=function(){this.element.innerHTML="",this.curUL=this.headerEle=void 0,this.setLocalData(),this.header()},I.prototype.resetCurrentList=function(){this.setViewDataSource(this.curViewDS),this.contentContainer.innerHTML="",this.createList(),this.renderIntoDom(this.curUL)},I.prototype.createList=function(){this.ulElement=this.curUL=e.ListBase.createList(this.curViewDS,this.listBaseOption),this.liCollection=this.curUL.querySelectorAll("."+u)},I.prototype.renderSubList=function(i){var r=i.getAttribute("data-uid");if(i.classList.contains(m)&&r){var n=t.closest(i.parentNode,"."+h),o=this.element.querySelector("[pid='"+r+"']");this.curDSLevel.push(r),this.setViewDataSource(this.getSubDS()),o||((o=e.ListBase.createListFromJson(this.curViewDS,this.listBaseOption,this.curDSLevel.length)).setAttribute("pID",r),o.style.display="none",this.renderIntoDom(o)),this.switchView(n,o),this.liCollection=this.curUL.querySelectorAll("."+u);var l=s(this.selectedItems.data,this.listBaseOption.fields);this.header(l[this.listBaseOption.fields.text],!0),this.selectedLI=void 0}},I.prototype.renderIntoDom=function(e){this.contentContainer.appendChild(e)},I.prototype.renderList=function(){this.setViewDataSource(),this.createList(),this.contentContainer=t.createElement("div",{className:b}),this.element.appendChild(this.contentContainer),this.renderIntoDom(this.ulElement)},I.prototype.getElementUID=function(e){var t={};return e instanceof Element?t.id=e.getAttribute("data-uid"):t=e,t},I.prototype.render=function(){this.element.classList.add(a),t.attributes(this.element,{role:"list"}),this.setCSSClass(),this.setEnableRTL(),this.setEnable(),this.setSize(),this.wireEvents(),this.header(),this.setLocalData(),this.setHTMLAttribute(),this.rippleFn=t.rippleEffect(this.element,{selector:"."+u})},I.prototype.destroy=function(){this.unWireEvents();var e=[a,this.cssClass,g,"e-rtl","e-has-header"];t.removeClass([this.element],e),this.rippleFn(),O.prototype.destroy.call(this)},I.prototype.back=function(){var e=this.curDSLevel[this.curDSLevel.length-1];if(void 0!==e&&!this.isInAnimation()){this.curDSLevel.pop(),this.setViewDataSource(this.getSubDS());var t=this.element.querySelector("[data-uid='"+e+"']"),i=this.curUL;t?t=t.parentElement:(this.createList(),this.renderIntoDom(this.ulElement),t=this.curUL);var r=s(this.curDSJSON,this.listBaseOption.fields)[this.fields.text];this.switchView(i,t,!0),this.removeSelect(),this.liCollection=this.curUL.querySelectorAll("."+u),this.header(this.curDSLevel.length?r:this.headerTitle,!!this.curDSLevel.length)}},I.prototype.selectItem=function(e){if(!t.isNullOrUndefined(e)){var i=this.getItemData(e),r=s(i,this.listBaseOption.fields);if(i){var n=this.element.querySelector('[data-uid="'+r[this.fields.id]+'"]');if(t.isNullOrUndefined(n))for(var o=this.element.querySelectorAll("."+u),l=0;l<o.length;l++)o[l].innerText.trim()===i.text&&(n=o[l]);this.setSelectLI(n)}}},I.prototype.getSelectedItem=function(){return this.selectedItems},I.prototype.findItem=function(e){return this.findItemFromDS(this.dataSource,e)},I.prototype.enableItem=function(e){this.setItemState(e,!0)},I.prototype.disableItem=function(e){this.setItemState(e,!1)},I.prototype.setItemState=function(e,t){var i=this.getItemData(e),r=s(i,this.listBaseOption.fields);if(i){var n=this.element.querySelector('[data-uid="'+r[this.fields.id]+'"]');t?(n&&n.classList.remove(g),delete i[this.fields.enabled]):t||(n&&n.classList.add(g),i[this.fields.enabled]=!1)}},I.prototype.showItem=function(e){this.showHideItem(e,!1,"")},I.prototype.hideItem=function(e){this.showHideItem(e,!0,"none")},I.prototype.showHideItem=function(e,t,i){var r=this.getItemData(e),n=s(r,this.listBaseOption.fields);if(r){var o=this.element.querySelector('[data-uid="'+n[this.fields.id]+'"]');o&&(o.style.display=i),t?r[this.fields.isVisible]=!1:delete r[this.fields.isVisible]}},I.prototype.addItem=function(e,t){var i=this.findItemFromDS(this.dataSource,t),r=s(i,this.listBaseOption.fields)[this.fields.child];r||(r=[]),r=r.concat(e),i instanceof Array?(this.dataSource=this.localData=i.concat(e),this.setViewDataSource()):i[this.fields.child]=r,this.resetCurrentList()},I.prototype.removeItem=function(e){var i=this,r=this.getElementUID(e),n=this.findItemFromDS(this.dataSource,r,!0);if(n&&e){var o,l;n.some(function(e,t,n){var a=s(e,i.listBaseOption.fields);return!(!r.id&&!r.text||r.id&&a[i.fields.id]!==r.id||r.text&&a[i.fields.text]!==r.text)&&(o=n,l=t,!0)}),t.isNullOrUndefined(this.selectedItems)||this.selectedItems.data!==o[l]||(this.selectedItems=void 0),o.splice(l,1),this.curViewDS=o,this.resetCurrentList(),this.selectItem(this.selectedItems)}},I.prototype.getModuleName=function(){return"listview"},I.prototype.getPersistData=function(){return this.addOnPersist(["cssClass","enableRtl","htmlAttributes","enable","fields","animation","headerTitle","sortOrder","showIcon","height","width"])},n([t.Property()],I.prototype,"cssClass",void 0),n([t.Property({})],I.prototype,"htmlAttributes",void 0),n([t.Property(!0)],I.prototype,"enable",void 0),n([t.Property([])],I.prototype,"dataSource",void 0),n([t.Property()],I.prototype,"query",void 0),n([t.Complex(e.ListBase.defaultMappedFields,L)],I.prototype,"fields",void 0),n([t.Property({effect:"SlideLeft",duration:400,easing:"ease"})],I.prototype,"animation",void 0),n([t.Property("None")],I.prototype,"sortOrder",void 0),n([t.Property(!1)],I.prototype,"showIcon",void 0),n([t.Property("")],I.prototype,"headerTitle",void 0),n([t.Property(!1)],I.prototype,"showHeader",void 0),n([t.Property("")],I.prototype,"height",void 0),n([t.Property("")],I.prototype,"width",void 0),n([t.Property(null)],I.prototype,"template",void 0),n([t.Property(null)],I.prototype,"groupTemplate",void 0),n([t.Event()],I.prototype,"select",void 0),n([t.Event()],I.prototype,"actionBegin",void 0),n([t.Event()],I.prototype,"actionComplete",void 0),n([t.Event()],I.prototype,"actionFailure",void 0),I=n([t.NotifyPropertyChanges],I)}(t.Component);e.FieldSettings=L,e.ListView=O,e.getFieldValues=s,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-data")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-data"],t):t(e.ej={},e.ej2Base,e.ej2Data)}(this,function(e,t,i){"use strict";function s(e,i){var s,r={};if(t.isNullOrUndefined(e))return e;if("string"==typeof e||"number"==typeof e)return e;if(t.isNullOrUndefined(e.isHeader))for(var n=0,o=Object.keys(i);n<o.length;n++){var l=o[n];if(!t.isNullOrUndefined(i[l])&&"string"==typeof i[l]){var a=i[l].split("."),d=a.length>1?a[0]:i[l];t.isNullOrUndefined(e[d])||(s=t.getValue(i[l],e),t.isNullOrUndefined(s)||(r[i[l]]=s))}}else!t.isNullOrUndefined(e.isHeader)&&e.isHeader&&(r=e);return r}e.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"},function(r){function n(e,t,i){return C(o(e,t,i),null,i)}function o(i,s,r){var n=[],o=t.extend({},O,r);e.cssClass=g(o.moduleName);for(var l=y(),a=0;a<i.length;a++)if(!t.isNullOrUndefined(i[a])){var d=void 0;if(o.itemCreating&&"function"==typeof o.itemCreating){var c={dataSource:i,curData:i[a],text:i[a],options:o};o.itemCreating(c)}if(d=s?v(i[a],null,null,[],null,l,a,r):S(i[a],null,null,r),o.itemCreated&&"function"==typeof o.itemCreated){c={dataSource:i,curData:i[a],text:i[a],item:d,options:o};o.itemCreated(c)}n.push(d)}return n}function l(i,n,o,l){var d=t.extend({},O,n);e.cssClass=g(d.moduleName);var c,h=t.extend({},r.defaultMappedFields,d.fields),u=t.extend({},L,d.ariaAttributes);o&&(u.level=o);var f,b=[];Object.keys(i).length&&!p(i).item.hasOwnProperty(h.id)&&(c=y());for(var C=0;C<i.length;C++){var I=s(i[C],h);if(!t.isNullOrUndefined(i[C])){if(d.itemCreating&&"function"==typeof d.itemCreating){var w={dataSource:i,curData:i[C],text:I[h.text],options:d,fields:h};d.itemCreating(w)}var x=i[C];Object.keys(i).length&&I.hasOwnProperty(h.id)&&!t.isNullOrUndefined(I[h.id])&&(c=I.id);var D=[];if(d.showCheckBox&&D.push(t.createElement("input",{className:e.cssClass.check,attrs:{type:"checkbox"}})),!0===l)d.showIcon&&I.hasOwnProperty(h.iconCss)&&(t.isNullOrUndefined(I[h.iconCss])||D.push(t.createElement("span",{className:e.cssClass.icon+" "+I[h.iconCss]}))),f=v(x,h,d.itemClass,D,!(!x.hasOwnProperty("isHeader")||!x.isHeader),c,C,n);else{if((f=S(x,h,d.itemClass,n)).classList.add(e.cssClass.level+"-"+u.level),f.setAttribute("aria-level",u.level.toString()),I.hasOwnProperty(h.tooltip)&&f.setAttribute("title",I[h.tooltip]),I.hasOwnProperty(h.htmlAttributes)&&I[h.htmlAttributes]&&m(f,I[h.htmlAttributes]),I.hasOwnProperty(h.enabled)&&!1===I[h.enabled]&&f.classList.add(e.cssClass.disabled),I.hasOwnProperty(h.isVisible)&&!1===I[h.isVisible]&&(f.style.display="none"),I.hasOwnProperty(h.imageUrl)&&!t.isNullOrUndefined(I[h.imageUrl])){var N={src:I[h.imageUrl]};I.hasOwnProperty(h.imageUrl)&&t.merge(N,I[h.imageAttributes]),t.prepend([t.createElement("img",{className:e.cssClass.image,attrs:N})],f.firstElementChild)}d.showIcon&&I.hasOwnProperty(h.iconCss)&&!d.template&&(t.isNullOrUndefined(I[h.iconCss])||t.prepend([t.createElement("div",{className:e.cssClass.icon+" "+I[h.iconCss]})],f.firstElementChild)),D.length&&t.prepend(D,f.firstElementChild),function(i,r,n,o,l,d){var c=s(i,r),h=c[r.child]||[],u=c[r.hasChildren];if(h.length&&(u=!0,l.classList.add(e.cssClass.hasChild),o.processSubChild)){var p=a(h,o,++d);l.appendChild(p)}if(o.expandCollapse&&u&&!o.template){l.firstElementChild.classList.contains(e.cssClass.textContent)&&l.firstElementChild.classList.add(e.cssClass.iconWrapper);var m="left"===o.expandIconPosition?t.prepend:t.append;m([t.createElement("div",{className:"e-icons "+o.expandIconClass})],l.querySelector("."+e.cssClass.textContent))}}(x,h,0,d,f,u.level)}if(d.itemCreated&&"function"==typeof d.itemCreated){w={dataSource:i,curData:i[C],text:I[h.text],item:f,options:d,fields:h};d.itemCreated(w)}b.push(f)}}return b}function a(e,i,s,r){var n=t.extend({},O,i);return C(l(e,i,s,r),n.listClass,i)}function d(e,t){if(t&&e){return Array.prototype.slice.call(t).indexOf(e)}}function c(e,t,s){return void 0===s&&(s=new i.Query),"Ascending"===e?s.sortBy(t,"ascending",!0):"Descending"===e&&s.sortBy(t,"descending",!0),s}function h(e,t){return new i.DataManager(e).executeLocal(t)}function u(e,i){var s=t.extend({},O,i),n=t.extend({},r.defaultMappedFields,s.fields),o=e.cloneNode(!0),l=[];o.classList.add("json-parent");var a=o.querySelectorAll(".json-parent>li");o.classList.remove("json-parent");for(var d=0;d<a.length;d++){for(var c=a[d],h=c.querySelector("a"),p=c.querySelector("ul"),m={},v=h?h.childNodes:c.childNodes,g=Object.keys(v),b=0;b<v.length;b++)v[Number(g[b])].hasChildNodes()||(m[n.text]=v[Number(g[b])].textContent);m[n.id]=y();var S=f(c);Object.keys(S).length&&(m[n.htmlAttributes]=S),h&&(S=f(h),Object.keys(S).length&&(m[n.urlAttributes]=S)),p&&(m[n.child]=u(p,i)),l.push(m)}return l}function p(e){for(var i={typeof:null,item:null},s=0;s<e.length;s++)if(!t.isNullOrUndefined(e[s]))return i={typeof:typeof e[s],item:e[s]};return i}function m(e,i){var s={};t.merge(s,i),s.class&&(t.addClass([e],s.class.split(" ")),delete s.class),t.attributes(e,s)}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 y(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}function v(i,r,n,o,l,a,d,c){var h,u=t.extend({},O,c),p=t.extend({},L,u.ariaAttributes),f=i,y=i,v=s(i,r);"string"!=typeof i&&"number"!=typeof i&&(h=i,f=v[r.text]||"",y=v[r.value]);var g;g=t.isNullOrUndefined(h)||t.isNullOrUndefined(v[r.id])||""===v[r.id]?a+"-"+d:a;var S=t.createElement("li",{className:(!0===l?e.cssClass.group:e.cssClass.li)+" "+(t.isNullOrUndefined(n)?"":n),id:g,attrs:""!==p.groupItemRole&&""!==p.itemRole?{role:!0===l?p.groupItemRole:p.itemRole}:{}});return h&&v.hasOwnProperty(r.enabled)&&"false"===v[r.enabled].toString()&&S.classList.add(e.cssClass.disabled),l?S.innerText=f:(t.isNullOrUndefined(y)||S.setAttribute("data-value",y),S.setAttribute("role","option"),h&&v.hasOwnProperty(r.htmlAttributes)&&v[r.htmlAttributes]&&m(S,v[r.htmlAttributes]),o.length&&t.append(o,S),h&&v.hasOwnProperty(r.url)&&v[r.url]?S.appendChild(b(h,r,f)):S.appendChild(document.createTextNode(f))),S}function g(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"}}function b(i,r,n){var o=s(i,r),l={href:o[r.url]};o.hasOwnProperty(r.urlAttributes)&&o[r.urlAttributes]&&t.merge(l,o[r.urlAttributes]);var a=t.createElement("a",{className:e.cssClass.text+" "+e.cssClass.url,innerHTML:n});return m(a,l),a}function S(i,r,n,o){var l,a,d,c,h=t.extend({},O,o),u=t.extend({},L,h.ariaAttributes),p=i;"string"!=typeof i&&(d=i,p=(c=s(i,r))[r.text]||"",l=c[r.id],a=!(!i.hasOwnProperty("isHeader")||!i.isHeader));var m=t.createElement("li",{className:(!0===a?e.cssClass.group:e.cssClass.li)+" "+(t.isNullOrUndefined(n)?"":n),attrs:""!==u.groupItemRole&&""!==u.itemRole?{role:!0===a?u.groupItemRole:u.itemRole}:{}});if(t.isNullOrUndefined(l)?m.setAttribute("data-uid",y()):m.setAttribute("data-uid",l),a&&o&&o.groupTemplate){var f=t.compile(o.groupTemplate);t.append(f(i),m)}else if(!a&&o&&o.template){f=t.compile(o.template);t.append(f(i),m)}else{var v=t.createElement("div",{className:e.cssClass.textContent,attrs:""!==u.wrapperRole?{role:u.wrapperRole}:{}});d&&c.hasOwnProperty(r.url)&&c[r.url]?v.appendChild(b(d,r,p)):v.appendChild(t.createElement("span",{className:e.cssClass.text,innerHTML:p,attrs:""!==u.itemText?{role:u.itemText}:{}})),m.appendChild(v)}return m}function C(i,s,r){var n=t.extend({},O,r),o=t.extend({},L,n.ariaAttributes);e.cssClass=g(n.moduleName);var l=t.createElement("ul",{className:e.cssClass.ul+" "+(t.isNullOrUndefined(s)?"":s),attrs:""!==o.listRole?{role:o.listRole}:{}});return t.append(i,l),l}r.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};var L={level:1,listRole:"presentation",itemRole:"presentation",groupItemRole:"group",itemText:"list-item",wrapperRole:"presentation"},O={showCheckBox:!1,showIcon:!1,expandCollapse:!1,fields:r.defaultMappedFields,ariaAttributes:L,listClass:"",itemClass:"",processSubChild:!1,sortOrder:"None",template:null,groupTemplate:null,expandIconClass:"e-icon-collapsible",moduleName:"list",expandIconPosition:"right"};r.createList=function(e,i,s){var r=t.extend({},O,i),o=t.extend({},L,r.ariaAttributes),l=p(e).typeof;return"string"===l||"number"===l?n(e,s,i):a(e,i,o.level,s)},r.createListFromArray=n,r.createListItemFromArray=o,r.createListItemFromJson=l,r.createListFromJson=a,r.getSiblingLI=function(i,s,r){if(e.cssClass=g(O.moduleName),i&&i.length){var n,o,l=Array.prototype.slice.call(i);for(n=l[(o=s?d(s,l):!0===r?l.length:-1)+(!0===r?-1:1)];n&&(!t.isVisible(n)||n.classList.contains(e.cssClass.disabled));)n=l[o+=!0===r?-1:1];return n}},r.indexOf=d,r.groupDataSource=function(e,t,s){void 0===s&&(s="None");var r=(new i.Query).group(t.groupBy),n=h(e,r=c(s,"key",r));e=[];for(var o=0;o<n.length;o++){var l=n[o].items,a={};a[t.text]=n[o].key,a.isHeader=!0,a.items=l,e.push(a);for(var d=0;d<l.length;d++)e.push(l[d])}return e},r.addSorting=c,r.getDataSource=h,r.createJsonFromElement=u,r.renderContentTemplate=function(i,r,n){e.cssClass=g(O.moduleName);for(var o=t.createElement("ul",{className:e.cssClass.ul,attrs:{role:"presentation"}}),l=t.compile(i),a=[],d=y(),c=0;c<r.length;c++){var h=s(r[c],n),u=r[c],p=u.isHeader,m=t.createElement("li",{id:d+"-"+c,className:p?e.cssClass.group:e.cssClass.li,attrs:{role:"presentation"}});if(p)m.innerText=h[n.text];else{var f="string"==typeof u||"number"==typeof u?u:h[n.value];t.append(l(u),m),m.setAttribute("data-value",f),m.setAttribute("role","option")}a.push(m)}return t.append(a,o),o},r.renderGroupTemplate=function(e,i,s,r){for(var n=t.compile(e),o=s.groupBy,l={},a=0,d=r;a<d.length;a++){var c=d[a];l[o]=c.textContent,c.innerHTML="",t.append(n(l),c)}return r},r.generateUL=C,r.generateIcon=function(i,s,r){var n=t.extend({},O,r);return t.extend({},L,n.ariaAttributes),e.cssClass=g(n.moduleName),("left"===n.expandIconPosition?t.prepend:t.append)([t.createElement("div",{className:"e-icons "+n.expandIconClass+" "+(t.isNullOrUndefined(s)?"":s)})],i.querySelector("."+e.cssClass.textContent)),i}}(e.ListBase||(e.ListBase={}));var r=function(){var e=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])};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),n=function(e,t,i,s){var r,n=arguments.length,o=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;l>=0;l--)(r=e[l])&&(o=(n<3?r(o):n>3?r(t,i,o):r(t,i))||o);return n>3&&o&&Object.defineProperty(t,i,o),o},o={None:[],SlideLeft:["SlideRightOut","SlideLeftOut","SlideLeftIn","SlideRightIn"],SlideDown:["SlideTopOut","SlideBottomOut","SlideBottomIn","SlideTopIn"],Zoom:["FadeOut","FadeZoomOut","FadeZoomIn","FadeIn"],Fade:["FadeOut","FadeOut","FadeIn","FadeIn"]},l={None:[],SlideLeft:["SlideLeftOut","SlideRightOut","SlideRightIn","SlideLeftIn"],SlideDown:["SlideBottomOut","SlideTopOut","SlideTopIn","SlideBottomIn"],Zoom:["FadeZoomOut","FadeOut","FadeIn","FadeZoomIn"],Fade:["FadeOut","FadeOut","FadeIn","FadeIn"]},a="e-listview",d="e-hover",c="e-active",h="e-list-parent",u="e-list-item",p="e-list-group-item",m="e-has-child",f="e-list-header",y="e-headertext",v="e-text",g="e-disabled",b="e-content",S="e-icons",C="e-icon-back",L=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return r(i,e),n([t.Property("id")],i.prototype,"id",void 0),n([t.Property("text")],i.prototype,"text",void 0),n([t.Property("isChecked")],i.prototype,"isChecked",void 0),n([t.Property("isVisible")],i.prototype,"isVisible",void 0),n([t.Property("enabled")],i.prototype,"enabled",void 0),n([t.Property("iconCss")],i.prototype,"iconCss",void 0),n([t.Property("child")],i.prototype,"child",void 0),n([t.Property("tooltip")],i.prototype,"tooltip",void 0),n([t.Property("groupBy")],i.prototype,"groupBy",void 0),n([t.Property("text")],i.prototype,"sortBy",void 0),n([t.Property("htmlAttributes")],i.prototype,"htmlAttributes",void 0),n([t.Property("tableName")],i.prototype,"tableName",void 0),i}(t.ChildProperty),O=function(O){function I(e,i){var s=O.call(this,e,i)||this;return s.curDSLevel=[],s.curViewDS=[],s.keyConfigs={moveDown:"downarrow",moveUp:"uparrow",select:"enter",back:"backspace"},s.animateOptions={},s.aniObj=new t.Animation(s.animateOptions),s}return r(I,O),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.reRender();break;case"headerTitle":this.curDSLevel.length||this.header(this.headerTitle,!1);break;case"showHeader":this.header(this.headerTitle,!1);break;case"dataSource":this.reRender();break;case"sortOrder":case"showIcon":this.listBaseOption.showIcon=this.showIcon,this.curViewDS=this.getSubDS(),this.resetCurrentList()}}},I.prototype.setHTMLAttribute=function(){Object.keys(this.htmlAttributes).length&&t.attributes(this.element,this.htmlAttributes)},I.prototype.setCSSClass=function(e){this.cssClass&&t.addClass([this.element],this.cssClass.split(" ")),e&&t.removeClass([this.element],e.split(" "))},I.prototype.setSize=function(){this.element.style.height=t.formatUnit(this.height),this.element.style.width=t.formatUnit(this.width)},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(g):e.classList.add(g)},I.prototype.header=function(e,i){if(void 0===this.headerEle&&this.showHeader){this.headerEle=t.createElement("div",{className:f});var s=t.createElement("span",{className:y,innerHTML:this.headerTitle}),r=t.createElement("div",{className:v,innerHTML:s.outerHTML}),n=t.createElement("div",{className:S+" "+C+" e-but-back",attrs:{style:"display:none;"}});this.headerEle.appendChild(n),this.headerEle.appendChild(r),this.element.classList.add("e-has-header"),t.prepend([this.headerEle],this.element)}else if(this.headerEle)if(this.showHeader){this.headerEle.style.display="";r=this.headerEle.querySelector("."+y),n=this.headerEle.querySelector("."+C);r.innerHTML=e,n.style.display=!0===i?"":"none"}else this.headerEle.style.display="none"},I.prototype.switchView=function(e,t,i){var s=this;if(e&&t){var r=e.style.position,n="hidden"!==this.element.style.overflow?this.element.style.overflow:"";e.style.position="absolute",e.classList.add("e-view");var a=void 0,d=this.animation.duration;if(this.animation.effect)a=this.enableRtl?l[this.animation.effect]:o[this.animation.effect];else{a=o.SlideLeft,i=this.enableRtl,d=0}this.element.style.overflow="hidden",this.aniObj.animate(e,{name:!0===i?a[0]:a[1],duration:d,timingFunction:this.animation.easing,end:function(t){e.style.display="none",s.element.style.overflow=n,e.style.position=r,e.classList.remove("e-view")}}),t.style.display="",this.aniObj.animate(t,{name:!0===i?a[2]:a[3],duration:d,timingFunction:this.animation.easing,end:function(){s.trigger("actionComplete")}}),this.curUL=t}},I.prototype.preRender=function(){this.listBaseOption={template:this.template,groupTemplate:this.groupTemplate,expandCollapse:!0,listClass:"",ariaAttributes:{itemRole:"listitem",listRole:"list",itemText:"",groupItemRole:"group",wrapperRole:"presentation"},fields:this.fields.properties,sortOrder:this.sortOrder,showIcon:this.showIcon}},I.prototype.clickHandler=function(e){var i=e.target,s=i.classList;if(s.contains(C)||s.contains(y))this.back();else{var r=t.closest(i.parentNode,"."+u);null===r&&(r=i),this.setSelectLI(r,e)}},I.prototype.hoverHandler=function(e){var i=t.closest(e.target.parentNode,"."+u);this.setHoverLI(i)},I.prototype.leaveHandler=function(e){this.removeHover()},I.prototype.keyActionHandler=function(e){switch(e.preventDefault(),e.action){case"moveDown":this.hoverSiblingLI();break;case"moveUp":this.hoverSiblingLI(!0);break;case"select":this.setSelectLI(this.curUL.querySelector("."+d),e);break;case"back":this.back()}},I.prototype.swipeActionHandler=function(e){"Right"===e.swipeDirection&&this.back()},I.prototype.wireEvents=function(){t.EventHandler.add(this.element,"click",this.clickHandler,this),t.EventHandler.add(this.element,"mouseover",this.hoverHandler,this),t.EventHandler.add(this.element,"mouseout",this.leaveHandler,this),this.keyboardModule=new t.KeyboardEvents(this.element,{keyAction:this.keyActionHandler.bind(this),keyConfigs:this.keyConfigs}),this.touchModule=new t.Touch(this.element,{swipe:this.swipeActionHandler.bind(this)})},I.prototype.unWireEvents=function(){t.EventHandler.remove(this.element,"click",this.clickHandler),t.EventHandler.remove(this.element,"mouseover",this.hoverHandler),t.EventHandler.remove(this.element,"mouseout",this.leaveHandler),this.keyboardModule.destroy(),this.touchModule.destroy()},I.prototype.removeHover=function(){var e=this.element.querySelector("."+d);e&&e.classList.remove(d)},I.prototype.removeSelect=function(){for(var e=0,t=this.element.querySelectorAll("."+c);e<t.length;e++){var i=t[e];i.removeAttribute("aria-selected"),""!==i.className&&i.classList.remove(c),this.selectedItems=void 0}},I.prototype.isValidLI=function(e){return e&&e.classList.contains(u)&&!e.classList.contains(p)&&!e.classList.contains(g)},I.prototype.setSelectLI=function(e,i){if(this.isValidLI(e)&&!e.classList.contains(c)&&this.enable){this.removeSelect(),e.classList.add(c),e.setAttribute("aria-selected","true"),this.removeHover();var r=this.getItemData(e),n=s(r,this.listBaseOption.fields);t.isNullOrUndefined(r)&&"string"==typeof this.dataSource[0]?this.selectedItems={item:e,text:e.innerText.trim(),data:this.dataSource}:this.selectedItems={item:e,text:n[this.listBaseOption.fields.text],data:r};var o={};t.merge(o,this.selectedItems),i&&t.merge(o,{isInteracted:!0,event:i}),this.trigger("select",o),this.selectedLI=e,this.renderSubList(e)}},I.prototype.setHoverLI=function(e){if(this.isValidLI(e)&&!e.classList.contains(d)&&this.enable){var i=this.element.querySelectorAll("."+d);i&&i.length&&t.removeClass(i,d),e.classList.contains(c)||e.classList.add(d)}},I.prototype.hoverSiblingLI=function(t){var i,s=this.curUL.querySelector("."+d);if(s||(s=this.curUL.querySelector("."+c)),s)i=e.ListBase.getSiblingLI(this.curUL.querySelectorAll("."+u),s,t);else if(t){var r=this.curUL.querySelectorAll("."+u);i=r[r.length-1]}else i=this.curUL.querySelector("."+u);this.setHoverLI(i)},I.prototype.getSubDS=function(){var e=this.curDSLevel;if(e.length){for(var t=this.localData,i=0,r=e;i<r.length;i++){var n=r[i];this.curDSJSON=this.findItemFromDS(t,{id:n});var o=s(this.curDSJSON,this.listBaseOption.fields);t=this.curDSJSON?o[this.fields.child]:t}return t}return this.localData},I.prototype.getItemData=function(e){var t=this.getElementUID(e),i=this.dataSource;return this.findItemFromDS(i,t)},I.prototype.findItemFromDS=function(e,i,r){var n,o=this;return e&&e.length&&i?e.some(function(l){var a=s(l,o.listBaseOption.fields);if(!i.id&&!i.text||i.id&&a[o.fields.id]!==i.id||i.text&&a[o.fields.text]!==i.text)if(!t.isNullOrUndefined(i.id)&&t.isNullOrUndefined(a[o.fields.id])){o.element.querySelector('[data-uid="'+i.id+'"]').innerText.trim()===a[o.fields.text]&&(n=l)}else a.hasOwnProperty(o.fields.child)&&a[o.fields.child].length&&(n=o.findItemFromDS(a[o.fields.child],i,r));else n=r?e:l;return!!n}):n=e,n},I.prototype.getQuery=function(){var t=[],s=this.query?this.query:new i.Query;if(!this.query){for(var r=0,n=Object.keys(this.fields.properties);r<n.length;r++){var o=n[r];"tableName"!==o&&this.fields[o]&&this.fields[o]!==e.ListBase.defaultMappedFields[o]&&-1===t.indexOf(this.fields[o])&&t.push(this.fields[o])}s.select(t),this.fields.properties.hasOwnProperty("tableName")&&s.from(this.fields.tableName)}return s},I.prototype.setViewDataSource=function(t){void 0===t&&(t=this.localData),t&&this.fields.groupBy?this.curViewDS=e.ListBase.groupDataSource(t,this.fields,this.sortOrder):t&&"None"!==this.sortOrder?this.curViewDS=e.ListBase.getDataSource(t,e.ListBase.addSorting(this.sortOrder,this.fields.sortBy)):this.curViewDS=t},I.prototype.isInAnimation=function(){return this.curUL.classList.contains(".e-animate")},I.prototype.setLocalData=function(){var s=this;if(this.trigger("actionBegin"),this.dataSource instanceof i.DataManager)this.dataSource.executeQuery(this.getQuery()).then(function(e){s.isDestroyed||(s.localData=e.result,s.renderList(),s.trigger("actionComplete",e))}).catch(function(e){s.isDestroyed||s.trigger("actionFailure",e)});else if(this.dataSource&&this.dataSource.length)this.localData=this.dataSource,this.renderList(),this.trigger("actionComplete",{data:this.localData});else{var r=this.element.querySelector("ul");r&&(t.remove(r),this.setProperties({dataSource:e.ListBase.createJsonFromElement(r)},!0),this.localData=this.dataSource,this.renderList(),this.trigger("actionComplete",{data:this.localData}))}},I.prototype.reRender=function(){this.element.innerHTML="",this.curUL=this.headerEle=void 0,this.setLocalData(),this.header()},I.prototype.resetCurrentList=function(){this.setViewDataSource(this.curViewDS),this.contentContainer.innerHTML="",this.createList(),this.renderIntoDom(this.curUL)},I.prototype.createList=function(){this.ulElement=this.curUL=e.ListBase.createList(this.curViewDS,this.listBaseOption),this.liCollection=this.curUL.querySelectorAll("."+u)},I.prototype.renderSubList=function(i){var r=i.getAttribute("data-uid");if(i.classList.contains(m)&&r){var n=t.closest(i.parentNode,"."+h),o=this.element.querySelector("[pid='"+r+"']");this.curDSLevel.push(r),this.setViewDataSource(this.getSubDS()),o||((o=e.ListBase.createListFromJson(this.curViewDS,this.listBaseOption,this.curDSLevel.length)).setAttribute("pID",r),o.style.display="none",this.renderIntoDom(o)),this.switchView(n,o),this.liCollection=this.curUL.querySelectorAll("."+u);var l=s(this.selectedItems.data,this.listBaseOption.fields);this.header(l[this.listBaseOption.fields.text],!0),this.selectedLI=void 0}},I.prototype.renderIntoDom=function(e){this.contentContainer.appendChild(e)},I.prototype.renderList=function(){this.setViewDataSource(),this.createList(),this.contentContainer=t.createElement("div",{className:b}),this.element.appendChild(this.contentContainer),this.renderIntoDom(this.ulElement)},I.prototype.getElementUID=function(e){var t={};return e instanceof Element?t.id=e.getAttribute("data-uid"):t=e,t},I.prototype.render=function(){this.element.classList.add(a),t.attributes(this.element,{role:"list"}),this.setCSSClass(),this.setEnableRTL(),this.setEnable(),this.setSize(),this.wireEvents(),this.header(),this.setLocalData(),this.setHTMLAttribute(),this.rippleFn=t.rippleEffect(this.element,{selector:"."+u})},I.prototype.destroy=function(){this.unWireEvents();var e=[a,this.cssClass,g,"e-rtl","e-has-header"];t.removeClass([this.element],e),this.rippleFn(),O.prototype.destroy.call(this)},I.prototype.back=function(){var e=this.curDSLevel[this.curDSLevel.length-1];if(void 0!==e&&!this.isInAnimation()){this.curDSLevel.pop(),this.setViewDataSource(this.getSubDS());var t=this.element.querySelector("[data-uid='"+e+"']"),i=this.curUL;t?t=t.parentElement:(this.createList(),this.renderIntoDom(this.ulElement),t=this.curUL);var r=s(this.curDSJSON,this.listBaseOption.fields)[this.fields.text];this.switchView(i,t,!0),this.removeSelect(),this.liCollection=this.curUL.querySelectorAll("."+u),this.header(this.curDSLevel.length?r:this.headerTitle,!!this.curDSLevel.length)}},I.prototype.selectItem=function(e){if(!t.isNullOrUndefined(e)){var i=this.getItemData(e),r=s(i,this.listBaseOption.fields);if(i){var n=this.element.querySelector('[data-uid="'+r[this.fields.id]+'"]');if(t.isNullOrUndefined(n))for(var o=this.element.querySelectorAll("."+u),l=0;l<o.length;l++)o[l].innerText.trim()===i.text&&(n=o[l]);this.setSelectLI(n)}}},I.prototype.getSelectedItem=function(){return this.selectedItems},I.prototype.findItem=function(e){return this.findItemFromDS(this.dataSource,e)},I.prototype.enableItem=function(e){this.setItemState(e,!0)},I.prototype.disableItem=function(e){this.setItemState(e,!1)},I.prototype.setItemState=function(e,t){var i=this.getItemData(e),r=s(i,this.listBaseOption.fields);if(i){var n=this.element.querySelector('[data-uid="'+r[this.fields.id]+'"]');t?(n&&n.classList.remove(g),delete i[this.fields.enabled]):t||(n&&n.classList.add(g),i[this.fields.enabled]=!1)}},I.prototype.showItem=function(e){this.showHideItem(e,!1,"")},I.prototype.hideItem=function(e){this.showHideItem(e,!0,"none")},I.prototype.showHideItem=function(e,t,i){var r=this.getItemData(e),n=s(r,this.listBaseOption.fields);if(r){var o=this.element.querySelector('[data-uid="'+n[this.fields.id]+'"]');o&&(o.style.display=i),t?r[this.fields.isVisible]=!1:delete r[this.fields.isVisible]}},I.prototype.addItem=function(e,t){var i=this.findItemFromDS(this.dataSource,t),r=s(i,this.listBaseOption.fields)[this.fields.child];r||(r=[]),r=r.concat(e),i instanceof Array?(this.dataSource=this.localData=i.concat(e),this.setViewDataSource()):i[this.fields.child]=r,this.resetCurrentList()},I.prototype.removeItem=function(e){var i=this,r=this.getElementUID(e),n=this.findItemFromDS(this.dataSource,r,!0);if(n&&e){var o,l;n.some(function(e,t,n){var a=s(e,i.listBaseOption.fields);return!(!r.id&&!r.text||r.id&&a[i.fields.id]!==r.id||r.text&&a[i.fields.text]!==r.text)&&(o=n,l=t,!0)}),t.isNullOrUndefined(this.selectedItems)||this.selectedItems.data!==o[l]||(this.selectedItems=void 0),o.splice(l,1),this.curViewDS=o,this.resetCurrentList(),this.selectItem(this.selectedItems)}},I.prototype.getModuleName=function(){return"listview"},I.prototype.getPersistData=function(){return this.addOnPersist(["cssClass","enableRtl","htmlAttributes","enable","fields","animation","headerTitle","sortOrder","showIcon","height","width"])},n([t.Property()],I.prototype,"cssClass",void 0),n([t.Property({})],I.prototype,"htmlAttributes",void 0),n([t.Property(!0)],I.prototype,"enable",void 0),n([t.Property([])],I.prototype,"dataSource",void 0),n([t.Property()],I.prototype,"query",void 0),n([t.Complex(e.ListBase.defaultMappedFields,L)],I.prototype,"fields",void 0),n([t.Property({effect:"SlideLeft",duration:400,easing:"ease"})],I.prototype,"animation",void 0),n([t.Property("None")],I.prototype,"sortOrder",void 0),n([t.Property(!1)],I.prototype,"showIcon",void 0),n([t.Property("")],I.prototype,"headerTitle",void 0),n([t.Property(!1)],I.prototype,"showHeader",void 0),n([t.Property("")],I.prototype,"height",void 0),n([t.Property("")],I.prototype,"width",void 0),n([t.Property(null)],I.prototype,"template",void 0),n([t.Property(null)],I.prototype,"groupTemplate",void 0),n([t.Event()],I.prototype,"select",void 0),n([t.Event()],I.prototype,"actionBegin",void 0),n([t.Event()],I.prototype,"actionComplete",void 0),n([t.Event()],I.prototype,"actionFailure",void 0),I=n([t.NotifyPropertyChanges],I)}(t.Component);e.FieldSettings=L,e.ListView=O,e.getFieldValues=s,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ej2-lists.umd.min.js.map |
@@ -449,4 +449,4 @@ import { Animation, ChildProperty, Complex, Component, Event, EventHandler, KeyboardEvents, NotifyPropertyChanges, Property, Touch, addClass, append, attributes, closest, compile, createElement, extend, formatUnit, getValue, isNullOrUndefined, isVisible, merge, prepend, remove, removeClass, rippleEffect } from '@syncfusion/ej2-base'; | ||
else { | ||
let value = (typeof item === 'string' || typeof item === 'number') ? item : fieldData[fields.value]; | ||
append(compiledString(item), li); | ||
let value = fieldData[fields.value]; | ||
li.setAttribute('data-value', value); | ||
@@ -453,0 +453,0 @@ li.setAttribute('role', 'option'); |
/*! | ||
* filename: index.d.ts | ||
* version : 15.4.22 | ||
* version : 15.4.23 | ||
* Copyright Syncfusion Inc. 2001 - 2017. All rights reserved. | ||
@@ -5,0 +5,0 @@ * Use of this code is subject to the terms of our license. |
{ | ||
"name": "@syncfusion/ej2-lists", | ||
"version": "15.4.23", | ||
"version": "15.4.24", | ||
"description": "Essential JS 2 List Components", | ||
@@ -5,0 +5,0 @@ "author": "Syncfusion Inc.", |
@@ -381,4 +381,4 @@ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-data"], function (require, exports, ej2_base_1, ej2_base_2, ej2_base_3, ej2_data_1) { | ||
else { | ||
var value = (typeof item === 'string' || typeof item === 'number') ? item : fieldData[fields.value]; | ||
ej2_base_2.append(compiledString(item), li); | ||
var value = fieldData[fields.value]; | ||
li.setAttribute('data-value', value); | ||
@@ -385,0 +385,0 @@ li.setAttribute('role', 'option'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2854279
16336