@syncfusion/ej2-lists
Advanced tools
Comparing version 15.4.22 to 15.4.23
@@ -5,4 +5,23 @@ # Changelog | ||
### Common | ||
#### New Features | ||
- Added typing file for ES5 global scripts `(dist/global/index.d.ts)`. | ||
#### Breaking Changes | ||
- Modified the module bundle file name for ES6 bundling. | ||
### ListView | ||
#### Bug Fixes | ||
- `SelectItem` method is not working with option which only have text field. | ||
- Complex `dataSource` binding support for ListView `fields`. | ||
## 15.4.22-preview (2017-12-14) | ||
### ListView | ||
#### New Features | ||
@@ -9,0 +28,0 @@ |
/*! | ||
* filename: ej2-lists.umd.min.js | ||
* version : 15.4.22 | ||
* version : 15.4.23 | ||
* 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){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@syncfusion/ej2-base"),require("@syncfusion/ej2-data"));else if("function"==typeof define&&define.amd)define(["@syncfusion/ej2-base","@syncfusion/ej2-data"],t);else{var i="object"==typeof exports?t(require("@syncfusion/ej2-base"),require("@syncfusion/ej2-data")):t(e["@syncfusion/ej2-base"],e["@syncfusion/ej2-data"]);for(var s in i)("object"==typeof exports?exports:e)[s]=i[s]}}(this,function(e,t){return function(e){function t(s){if(i[s])return i[s].exports;var r=i[s]={exports:{},id:s,loaded:!1};return e[s].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){var s,r;s=[i,t,i(1),i(6)],void 0!==(r=function(e,t,i,s){"use strict";function r(e){for(var i in e)t.hasOwnProperty(i)||(t[i]=e[i])}Object.defineProperty(t,"__esModule",{value:!0}),r(i),r(s)}.apply(t,s))&&(e.exports=r)},function(e,t,i){var s,r;s=[i,t,i(2)],void 0!==(r=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var i in e)t.hasOwnProperty(i)||(t[i]=e[i])}(i)}.apply(t,s))&&(e.exports=r)},function(e,t,i){var s,r,o=this&&this.__extends||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=this&&this.__decorate||function(e,t,i,s){var r,o=arguments.length,n=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(n=(o<3?r(n):o>3?r(t,i,n):r(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n};s=[i,t,i(3),i(3),i(3),i(3),i(3),i(4),i(5)],void 0!==(r=function(e,t,i,s,r,a,l,d,c){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var h={None:[],SlideLeft:["SlideRightOut","SlideLeftOut","SlideLeftIn","SlideRightIn"],SlideDown:["SlideTopOut","SlideBottomOut","SlideBottomIn","SlideTopIn"],Zoom:["FadeOut","FadeZoomOut","FadeZoomIn","FadeIn"],Fade:["FadeOut","FadeOut","FadeIn","FadeIn"]},u={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",parentItem:"e-list-parent",listItem:"e-list-item",listItemText:"e-list-text",grpListItem:"e-list-group-item",hasChild:"e-has-child",view:"e-view",header:"e-list-header",headerText:"e-headertext",text:"e-text",disable:"e-disabled",content:"e-content",icon:"e-icons",backIcon:"e-icon-back"},m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),n([r.Property("id")],t.prototype,"id",void 0),n([r.Property("text")],t.prototype,"text",void 0),n([r.Property("isChecked")],t.prototype,"isChecked",void 0),n([r.Property("isVisible")],t.prototype,"isVisible",void 0),n([r.Property("enabled")],t.prototype,"enabled",void 0),n([r.Property("iconCss")],t.prototype,"iconCss",void 0),n([r.Property("child")],t.prototype,"child",void 0),n([r.Property("tooltip")],t.prototype,"tooltip",void 0),n([r.Property("groupBy")],t.prototype,"groupBy",void 0),n([r.Property("text")],t.prototype,"sortBy",void 0),n([r.Property("htmlAttributes")],t.prototype,"htmlAttributes",void 0),n([r.Property("tableName")],t.prototype,"tableName",void 0),t}(a.ChildProperty);t.FieldSettings=m;var f=function(e){function t(t,i){var s=e.call(this,t,i)||this;return s.curDSLevel=[],s.curViewDS=[],s.keyConfigs={moveDown:"downarrow",moveUp:"uparrow",select:"enter",back:"backspace"},s.animateOptions={},s.aniObj=new l.Animation(s.animateOptions),s}return o(t,e),t.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()}}},t.prototype.setHTMLAttribute=function(){Object.keys(this.htmlAttributes).length&&s.attributes(this.element,this.htmlAttributes)},t.prototype.setCSSClass=function(e){this.cssClass&&s.addClass([this.element],this.cssClass.split(" ")),e&&s.removeClass([this.element],e.split(" "))},t.prototype.setSize=function(){this.element.style.height=i.formatUnit(this.height),this.element.style.width=i.formatUnit(this.width)},t.prototype.setEnable=function(){this.enableElement(this.element,this.enable)},t.prototype.setEnableRTL=function(){this.enableRtl?this.element.classList.add("e-rtl"):this.element.classList.remove("e-rtl")},t.prototype.enableElement=function(e,t){t?e.classList.remove(p.disable):e.classList.add(p.disable)},t.prototype.header=function(e,t){if(void 0===this.headerEle&&this.showHeader){this.headerEle=s.createElement("div",{className:p.header});var i=s.createElement("span",{className:p.headerText,innerHTML:this.headerTitle}),r=s.createElement("div",{className:p.text,innerHTML:i.outerHTML}),o=s.createElement("div",{className:p.icon+" "+p.backIcon+" e-but-back",attrs:{style:"display:none;"}});this.headerEle.appendChild(o),this.headerEle.appendChild(r),this.element.classList.add("e-has-header"),s.prepend([this.headerEle],this.element)}else if(this.headerEle)if(this.showHeader){this.headerEle.style.display="";var r=this.headerEle.querySelector("."+p.headerText),o=this.headerEle.querySelector("."+p.backIcon);r.innerHTML=e,o.style.display=!0===t?"":"none"}else this.headerEle.style.display="none"},t.prototype.switchView=function(e,t,i){var s=this;if(e&&t){var r=e.style.position,o="hidden"!==this.element.style.overflow?this.element.style.overflow:"";e.style.position="absolute",e.classList.add("e-view");var n=void 0,a=this.animation.duration;if(this.animation.effect)n=this.enableRtl?u[this.animation.effect]:h[this.animation.effect];else{n=h.SlideLeft,i=this.enableRtl,a=0}this.element.style.overflow="hidden",this.aniObj.animate(e,{name:!0===i?n[0]:n[1],duration:a,timingFunction:this.animation.easing,end:function(t){e.style.display="none",s.element.style.overflow=o,e.style.position=r,e.classList.remove("e-view")}}),t.style.display="",this.aniObj.animate(t,{name:!0===i?n[2]:n[3],duration:a,timingFunction:this.animation.easing,end:function(){s.trigger("actionComplete")}}),this.curUL=t}},t.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}},t.prototype.clickHandler=function(e){var t=e.target,i=t.classList;if(i.contains(p.backIcon)||i.contains(p.headerText))this.back();else{var r=s.closest(t.parentNode,"."+p.listItem);null===r&&(r=t),this.setSelectLI(r,e)}},t.prototype.hoverHandler=function(e){var t=s.closest(e.target.parentNode,"."+p.listItem);this.setHoverLI(t)},t.prototype.leaveHandler=function(e){this.removeHover()},t.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("."+p.hover),e);break;case"back":this.back()}},t.prototype.swipeActionHandler=function(e){"Right"===e.swipeDirection&&this.back()},t.prototype.wireEvents=function(){r.EventHandler.add(this.element,"click",this.clickHandler,this),r.EventHandler.add(this.element,"mouseover",this.hoverHandler,this),r.EventHandler.add(this.element,"mouseout",this.leaveHandler,this),this.keyboardModule=new a.KeyboardEvents(this.element,{keyAction:this.keyActionHandler.bind(this),keyConfigs:this.keyConfigs}),this.touchModule=new l.Touch(this.element,{swipe:this.swipeActionHandler.bind(this)})},t.prototype.unWireEvents=function(){r.EventHandler.remove(this.element,"click",this.clickHandler),r.EventHandler.remove(this.element,"mouseover",this.hoverHandler),r.EventHandler.remove(this.element,"mouseout",this.leaveHandler),this.keyboardModule.destroy(),this.touchModule.destroy()},t.prototype.removeHover=function(){var e=this.element.querySelector("."+p.hover);e&&e.classList.remove(p.hover)},t.prototype.removeSelect=function(){for(var e=this.element.querySelectorAll("."+p.selected),t=0,i=e;t<i.length;t++){var s=i[t];s.removeAttribute("aria-selected"),""!==s.className&&s.classList.remove(p.selected),this.selectedItems=void 0}},t.prototype.isValidLI=function(e){return e&&e.classList.contains(p.listItem)&&!e.classList.contains(p.grpListItem)&&!e.classList.contains(p.disable)},t.prototype.setSelectLI=function(e,t){if(this.isValidLI(e)&&!e.classList.contains(p.selected)&&this.enable){this.removeSelect(),e.classList.add(p.selected),e.setAttribute("aria-selected","true"),this.removeHover();var s=this.getItemData(e);i.isNullOrUndefined(s)&&"string"==typeof this.dataSource[0]?this.selectedItems={item:e,text:e.innerText.trim(),data:this.dataSource}:this.selectedItems={item:e,text:i.getValue(this.listBaseOption.fields.text,s),data:s};var r={};i.merge(r,this.selectedItems),t&&i.merge(r,{isInteracted:!0,event:t}),this.trigger("select",r),this.selectedLI=e,this.renderSubList(e)}},t.prototype.setHoverLI=function(e){if(this.isValidLI(e)&&!e.classList.contains(p.hover)&&this.enable){var t=this.element.querySelectorAll("."+p.hover);t&&t.length&&s.removeClass(t,p.hover),e.classList.contains(p.selected)||e.classList.add(p.hover)}},t.prototype.hoverSiblingLI=function(e){var t,i=this.curUL.querySelector("."+p.hover);if(i||(i=this.curUL.querySelector("."+p.selected)),i)t=c.ListBase.getSiblingLI(this.curUL.querySelectorAll("."+p.listItem),i,e);else if(e){var s=this.curUL.querySelectorAll("."+p.listItem);t=s[s.length-1]}else t=this.curUL.querySelector("."+p.listItem);this.setHoverLI(t)},t.prototype.getSubDS=function(){var e=this.curDSLevel;if(e.length){for(var t=this.localData,i=0,s=e;i<s.length;i++){var r=s[i];this.curDSJSON=this.findItemFromDS(t,{id:r}),t=this.curDSJSON?this.curDSJSON[this.fields.child]:t}return t}return this.localData},t.prototype.getItemData=function(e){var t=this.getElementUID(e),i=this.dataSource;return this.findItemFromDS(i,t)},t.prototype.findItemFromDS=function(e,t,i){var s,r=this;return e&&e.length&&t?e.some(function(o){return!t.id&&!t.text||t.id&&o[r.fields.id]!==t.id||t.text&&o[r.fields.text]!==t.text?o.hasOwnProperty(r.fields.child)&&o[r.fields.child].length&&(s=r.findItemFromDS(o[r.fields.child],t,i)):s=i?e:o,!!s}):s=e,s},t.prototype.getQuery=function(){var e=[],t=this.query?this.query:new d.Query;if(!this.query){for(var i=0,s=Object.keys(this.fields.properties);i<s.length;i++){var r=s[i];"tableName"!==r&&this.fields[r]&&this.fields[r]!==c.ListBase.defaultMappedFields[r]&&-1===e.indexOf(this.fields[r])&&e.push(this.fields[r])}t.select(e),this.fields.properties.hasOwnProperty("tableName")&&t.from(this.fields.tableName)}return t},t.prototype.setViewDataSource=function(e){void 0===e&&(e=this.localData),e&&this.fields.groupBy?this.curViewDS=c.ListBase.groupDataSource(e,this.fields,this.sortOrder):e&&"None"!==this.sortOrder?this.curViewDS=c.ListBase.getDataSource(e,c.ListBase.addSorting(this.sortOrder,this.fields.sortBy)):this.curViewDS=e},t.prototype.isInAnimation=function(){return this.curUL.classList.contains(".e-animate")},t.prototype.setLocalData=function(){var e=this;if(this.trigger("actionBegin"),this.dataSource instanceof d.DataManager)this.dataSource.executeQuery(this.getQuery()).then(function(t){e.isDestroyed||(e.localData=t.result,e.renderList(),e.trigger("actionComplete",t))}).catch(function(t){e.isDestroyed||e.trigger("actionFailure",t)});else if(this.dataSource&&this.dataSource.length)this.localData=this.dataSource,this.renderList(),this.trigger("actionComplete",{data:this.localData});else{var t=this.element.querySelector("ul");t&&(s.remove(t),this.setProperties({dataSource:c.ListBase.createJsonFromElement(t)},!0),this.localData=this.dataSource,this.renderList(),this.trigger("actionComplete",{data:this.localData}))}},t.prototype.reRender=function(){this.element.innerHTML="",this.curUL=this.headerEle=void 0,this.setLocalData(),this.header()},t.prototype.resetCurrentList=function(){this.setViewDataSource(this.curViewDS),this.contentContainer.innerHTML="",this.createList(),this.renderIntoDom(this.curUL)},t.prototype.createList=function(){this.ulElement=this.curUL=c.ListBase.createList(this.curViewDS,this.listBaseOption),this.liCollection=this.curUL.querySelectorAll("."+p.listItem)},t.prototype.renderSubList=function(e){var t=e.getAttribute("data-uid");if(e.classList.contains(p.hasChild)&&t){var r=s.closest(e.parentNode,"."+p.parentItem),o=this.element.querySelector("[pid='"+t+"']");this.curDSLevel.push(t),this.setViewDataSource(this.getSubDS()),o||(o=c.ListBase.createListFromJson(this.curViewDS,this.listBaseOption,this.curDSLevel.length),o.setAttribute("pID",t),o.style.display="none",this.renderIntoDom(o)),this.switchView(r,o),this.liCollection=this.curUL.querySelectorAll("."+p.listItem),this.header(i.getValue(this.listBaseOption.fields.text,this.selectedItems.data),!0),this.selectedLI=void 0}},t.prototype.renderIntoDom=function(e){this.contentContainer.appendChild(e)},t.prototype.renderList=function(){this.setViewDataSource(),this.createList(),this.contentContainer=s.createElement("div",{className:p.content}),this.element.appendChild(this.contentContainer),this.renderIntoDom(this.ulElement)},t.prototype.getElementUID=function(e){var t={};return e instanceof Element?t.id=e.getAttribute("data-uid"):t=e,t},t.prototype.render=function(){this.element.classList.add(p.root),s.attributes(this.element,{role:"list"}),this.setCSSClass(),this.setEnableRTL(),this.setEnable(),this.setSize(),this.wireEvents(),this.header(),this.setLocalData(),this.setHTMLAttribute(),this.rippleFn=l.rippleEffect(this.element,{selector:"."+p.listItem})},t.prototype.destroy=function(){this.unWireEvents();var t=[p.root,this.cssClass,p.disable,"e-rtl","e-has-header"];s.removeClass([this.element],t),this.rippleFn(),e.prototype.destroy.call(this)},t.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+"']"),s=this.curUL;t?t=t.parentElement:(this.createList(),this.renderIntoDom(this.ulElement),t=this.curUL);var r=i.getValue(this.fields.text,this.curDSJSON);this.switchView(s,t,!0),this.removeSelect(),this.liCollection=this.curUL.querySelectorAll("."+p.listItem),this.header(this.curDSLevel.length?r:this.headerTitle,!!this.curDSLevel.length)}},t.prototype.selectItem=function(e){if(!i.isNullOrUndefined(e)){var t=this.getItemData(e);if(t){var s=this.element.querySelector('[data-uid="'+t[this.fields.id]+'"]');s&&this.setSelectLI(s)}}},t.prototype.getSelectedItem=function(){return this.selectedItems},t.prototype.findItem=function(e){return this.findItemFromDS(this.dataSource,e)},t.prototype.enableItem=function(e){var t=this.getItemData(e);if(t){var i=this.element.querySelector('[data-uid="'+t[this.fields.id]+'"]');i&&i.classList.remove(p.disable),delete t[this.fields.enabled]}},t.prototype.disableItem=function(e){var t=this.getItemData(e);if(t){var i=this.element.querySelector('[data-uid="'+t[this.fields.id]+'"]');i&&i.classList.add(p.disable),t[this.fields.enabled]=!1}},t.prototype.showItem=function(e){this.showHideItem(e,!1,"")},t.prototype.hideItem=function(e){this.showHideItem(e,!0,"none")},t.prototype.showHideItem=function(e,t,i){var s=this.getItemData(e);if(s){var r=this.element.querySelector('[data-uid="'+s[this.fields.id]+'"]');r&&(r.style.display=i),t?s[this.fields.isVisible]=!1:delete s[this.fields.isVisible]}},t.prototype.addItem=function(e,t){var i=this.findItemFromDS(this.dataSource,t),s=i[this.fields.child];s||(s=[]),s=s.concat(e),i instanceof Array?(this.dataSource=this.localData=i.concat(e),this.setViewDataSource()):i[this.fields.child]=s,this.resetCurrentList()},t.prototype.removeItem=function(e){var t=this,s=this.getElementUID(e),r=this.findItemFromDS(this.dataSource,s,!0);if(r&&e){var o,n;r.some(function(e,i,r){return!(!s.id&&!s.text||s.id&&e[t.fields.id]!==s.id||s.text&&e[t.fields.text]!==s.text)&&(o=r,n=i,!0)}),i.isNullOrUndefined(this.selectedItems)||this.selectedItems.data!==o[n]||(this.selectedItems=void 0),o.splice(n,1),this.curViewDS=o,this.resetCurrentList(),this.selectItem(this.selectedItems)}},t.prototype.getModuleName=function(){return"listview"},t.prototype.getPersistData=function(){return this.addOnPersist(["cssClass","enableRtl","htmlAttributes","enable","fields","animation","headerTitle","sortOrder","showIcon","height","width"])},n([r.Property()],t.prototype,"cssClass",void 0),n([r.Property({})],t.prototype,"htmlAttributes",void 0),n([r.Property(!0)],t.prototype,"enable",void 0),n([r.Property([])],t.prototype,"dataSource",void 0),n([r.Property()],t.prototype,"query",void 0),n([r.Complex(c.ListBase.defaultMappedFields,m)],t.prototype,"fields",void 0),n([r.Property({effect:"SlideLeft",duration:400,easing:"ease"})],t.prototype,"animation",void 0),n([r.Property("None")],t.prototype,"sortOrder",void 0),n([r.Property(!1)],t.prototype,"showIcon",void 0),n([r.Property("")],t.prototype,"headerTitle",void 0),n([r.Property(!1)],t.prototype,"showHeader",void 0),n([r.Property("")],t.prototype,"height",void 0),n([r.Property("")],t.prototype,"width",void 0),n([r.Property(null)],t.prototype,"template",void 0),n([r.Property(null)],t.prototype,"groupTemplate",void 0),n([r.Event()],t.prototype,"select",void 0),n([r.Event()],t.prototype,"actionBegin",void 0),n([r.Event()],t.prototype,"actionComplete",void 0),n([r.Event()],t.prototype,"actionFailure",void 0),t=n([a.NotifyPropertyChanges],t)}(r.Component);t.ListView=f}.apply(t,s))&&(e.exports=r)},function(t,i){t.exports=e},function(e,i){e.exports=t},function(e,t,i){var s,r;s=[i,t,i(3),i(3),i(3),i(4)],void 0!==(r=function(e,t,i,s,r,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.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(e){function n(e,t,s){var r=i.extend({},P,t),o=i.extend({},E,r.ariaAttributes),n=v(e).typeof;return"string"===n||"number"===n?a(e,s,t):c(e,t,o.level,s)}function a(e,t,i){return N(l(e,t,i),null,i)}function l(e,s,r){var o=[],n=i.extend({},P,r);t.cssClass=w(n.moduleName);for(var a=L(),l=0;l<e.length;l++)if(!i.isNullOrUndefined(e[l])){var d=void 0;if(n.itemCreating&&"function"==typeof n.itemCreating){var c={dataSource:e,curData:e[l],text:e[l],options:n};n.itemCreating(c)}if(d=s?x(e[l],null,null,[],null,a,l,r):D(e[l],null,null,r),n.itemCreated&&"function"==typeof n.itemCreated){var c={dataSource:e,curData:e[l],text:e[l],item:d,options:n};n.itemCreated(c)}o.push(d)}return o}function d(r,o,n,a){var l=i.extend({},P,o);t.cssClass=w(l.moduleName);var d,c=i.extend({},e.defaultMappedFields,l.fields),h=i.extend({},E,l.ariaAttributes);n&&(h.level=n);var u,p=[];Object.keys(r).length&&!v(r).item.hasOwnProperty(c.id)&&(d=L());for(var m=0;m<r.length;m++)if(!i.isNullOrUndefined(r[m])){if(l.itemCreating&&"function"==typeof l.itemCreating){var f={dataSource:r,curData:r[m],text:i.getValue(c.text,r[m]),options:l,fields:c};l.itemCreating(f)}var y=r[m];Object.keys(r).length&&r[m].hasOwnProperty(c.id)&&!i.isNullOrUndefined(r[m][c.id])&&(d=r[m].id);var g=[];if(l.showCheckBox&&g.push(s.createElement("input",{className:t.cssClass.check,attrs:{type:"checkbox"}})),!0===a)l.showIcon&&y.hasOwnProperty(c.iconCss)&&(i.isNullOrUndefined(y[c.iconCss])||g.push(s.createElement("span",{className:t.cssClass.icon+" "+y[c.iconCss]}))),u=x(y,c,l.itemClass,g,!(!y.hasOwnProperty("isHeader")||!y.isHeader),d,m,o);else{if(u=D(y,c,l.itemClass,o),u.classList.add(t.cssClass.level+"-"+h.level),u.setAttribute("aria-level",h.level.toString()),y.hasOwnProperty(c.tooltip)&&u.setAttribute("title",y[c.tooltip]),y.hasOwnProperty(c.htmlAttributes)&&y[c.htmlAttributes]&&b(u,y[c.htmlAttributes]),y.hasOwnProperty(c.enabled)&&!1===y[c.enabled]&&u.classList.add(t.cssClass.disabled),y.hasOwnProperty(c.isVisible)&&!1===y[c.isVisible]&&(u.style.display="none"),y.hasOwnProperty(c.imageUrl)&&!i.isNullOrUndefined(y[c.imageUrl])){var S={src:y[c.imageUrl]};y.hasOwnProperty(c.imageUrl)&&i.merge(S,y[c.imageAttributes]),s.prepend([s.createElement("img",{className:t.cssClass.image,attrs:S})],u.firstElementChild)}l.showIcon&&y.hasOwnProperty(c.iconCss)&&!l.template&&(i.isNullOrUndefined(y[c.iconCss])||s.prepend([s.createElement("div",{className:t.cssClass.icon+" "+y[c.iconCss]})],u.firstElementChild)),g.length&&s.prepend(g,u.firstElementChild),I(y,c,r,l,u,h.level)}if(l.itemCreated&&"function"==typeof l.itemCreated){var f={dataSource:r,curData:r[m],text:i.getValue(c.text,r[m]),item:u,options:l,fields:c};l.itemCreated(f)}p.push(u)}return p}function c(e,t,s,r){var o=i.extend({},P,t);return N(d(e,t,s,r),o.listClass,t)}function h(e,i,r){if(t.cssClass=w(P.moduleName),e&&e.length){var o,n,a=Array.prototype.slice.call(e);for(n=i?u(i,a):!0===r?a.length:-1,o=a[n+(!0===r?-1:1)];o&&(!s.isVisible(o)||o.classList.contains(t.cssClass.disabled));)n+=!0===r?-1:1,o=a[n];return o}}function u(e,t){if(t&&e){var i=t;return i=Array.prototype.slice.call(t),i.indexOf(e)}}function p(e,t,i){void 0===i&&(i="None");var s=(new o.Query).group(t.groupBy);s=m(i,"key",s);var r=f(e,s);e=[];for(var n=0;n<r.length;n++){var a=r[n].items,l={};l[t.text]=r[n].key,l.isHeader=!0,l.items=a,e.push(l);for(var d=0;d<a.length;d++)e.push(a[d])}return e}function m(e,t,i){return void 0===i&&(i=new o.Query),"Ascending"===e?i.sortBy(t,"ascending",!0):"Descending"===e&&i.sortBy(t,"descending",!0),i}function f(e,t){return new o.DataManager(e).executeLocal(t)}function y(t,s){var r=i.extend({},P,s),o=i.extend({},e.defaultMappedFields,r.fields),n=t.cloneNode(!0),a=[];n.classList.add("json-parent");var l=n.querySelectorAll(".json-parent>li");n.classList.remove("json-parent");for(var d=0;d<l.length;d++)!function(e){var t=l[e],i=t.querySelector("a"),r=t.querySelector("ul"),n={},d=i?i.childNodes:t.childNodes;Object.keys(d).forEach(function(e){d[Number(e)].hasChildNodes()||(n[o.text]=d[Number(e)].textContent)}),n[o.id]=L();var c=g(t);Object.keys(c).length&&(n[o.htmlAttributes]=c),i&&(c=g(i),Object.keys(c).length&&(n[o.urlAttributes]=c)),r&&(n[o.child]=y(r,s)),a.push(n)}(d);return a}function v(e){for(var t={typeof:null,item:null},s=0;s<e.length;s++)if(!i.isNullOrUndefined(e[s]))return t={typeof:typeof e[s],item:e[s]};return t}function b(e,t){var r={};i.merge(r,t),r.class&&(s.addClass([e],r.class.split(" ")),delete r.class),s.attributes(e,r)}function g(e){for(var t={},i=e.attributes,s=0;s<i.length;s++)t[i[s].nodeName]=i[s].nodeValue;return t}function S(e,o,n){t.cssClass=w(P.moduleName);for(var a=s.createElement("ul",{className:t.cssClass.ul,attrs:{role:"presentation"}}),l=r.compile(e),d=[],c=L(),h=0;h<o.length;h++){var u=o[h],p=u.isHeader,m=s.createElement("li",{id:c+"-"+h,className:p?t.cssClass.group:t.cssClass.li,attrs:{role:"presentation"}});if(p)m.innerText=i.getValue(n.text,u);else{s.append(l(u),m);var f=i.getValue(n.value,u);m.setAttribute("data-value",f),m.setAttribute("role","option")}d.push(m)}return s.append(d,a),a}function C(e,t,i,o){for(var n=r.compile(e),a=i.groupBy,l={},d=0,c=o;d<c.length;d++){var h=c[d];l[a]=h.textContent,h.innerHTML="",s.append(n(l),h)}return o}function L(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}function I(e,i,r,o,n,a){var l=e[i.child]||[],d=e[i.hasChildren];if(l.length&&(d=!0,n.classList.add(t.cssClass.hasChild),o.processSubChild)){var h=c(l,o,++a);n.appendChild(h)}if(o.expandCollapse&&d&&!o.template){n.firstElementChild.classList.contains(t.cssClass.textContent)&&n.firstElementChild.classList.add(t.cssClass.iconWrapper);("left"===o.expandIconPosition?s.prepend:s.append)([s.createElement("div",{className:"e-icons "+o.expandIconClass})],n.querySelector("."+t.cssClass.textContent))}}function x(e,r,o,n,a,l,d,c){var h,u=i.extend({},P,c),p=i.extend({},E,u.ariaAttributes),m=e,f=e;"string"!=typeof e&&"number"!=typeof e&&(h=e,m=i.getValue(r.text,e)||"",f=i.getValue(r.value,e));var y;y=i.isNullOrUndefined(h)||i.isNullOrUndefined(h[r.id])||""===h[r.id]?l+"-"+d:l;var v=s.createElement("li",{className:(!0===a?t.cssClass.group:t.cssClass.li)+" "+(i.isNullOrUndefined(o)?"":o),id:y,attrs:""!==p.groupItemRole&&""!==p.itemRole?{role:!0===a?p.groupItemRole:p.itemRole}:{}});return h&&h.hasOwnProperty(r.enabled)&&"false"===h[r.enabled].toString()&&v.classList.add(t.cssClass.disabled),a?v.innerText=m:(i.isNullOrUndefined(f)||v.setAttribute("data-value",f),v.setAttribute("role","option"),h&&h.hasOwnProperty(r.htmlAttributes)&&h[r.htmlAttributes]&&b(v,h[r.htmlAttributes]),n.length&&s.append(n,v),h&&h.hasOwnProperty(r.url)&&h[r.url]?v.appendChild(O(h,r,m)):v.appendChild(document.createTextNode(m))),v}function w(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 O(e,r,o){var n={href:e[r.url]};e.hasOwnProperty(r.urlAttributes)&&e[r.urlAttributes]&&i.merge(n,e[r.urlAttributes]);var a=s.createElement("a",{className:t.cssClass.text+" "+t.cssClass.url,innerHTML:o});return b(a,n),a}function D(e,o,n,a){var l,d,c,h=i.extend({},P,a),u=i.extend({},E,h.ariaAttributes),p=e;"string"!=typeof e&&(c=e,p=i.getValue(o.text,e)||"",l=e[o.id],d=!(!e.hasOwnProperty("isHeader")||!e.isHeader));var m=s.createElement("li",{className:(!0===d?t.cssClass.group:t.cssClass.li)+" "+(i.isNullOrUndefined(n)?"":n),attrs:""!==u.groupItemRole&&""!==u.itemRole?{role:!0===d?u.groupItemRole:u.itemRole}:{}});if(l&&m.setAttribute("data-uid",l),d&&a&&a.groupTemplate){var f=r.compile(a.groupTemplate);s.append(f(e),m)}else if(!d&&a&&a.template){var f=r.compile(a.template);s.append(f(e),m)}else{var y=s.createElement("div",{className:t.cssClass.textContent,attrs:""!==u.wrapperRole?{role:u.wrapperRole}:{}});c&&c.hasOwnProperty(o.url)&&c[o.url]?y.appendChild(O(c,o,p)):y.appendChild(s.createElement("span",{className:t.cssClass.text,innerHTML:p,attrs:""!==u.itemText?{role:u.itemText}:{}})),m.appendChild(y)}return m}function N(e,r,o){var n=i.extend({},P,o),a=i.extend({},E,n.ariaAttributes);t.cssClass=w(n.moduleName);var l=s.createElement("ul",{className:t.cssClass.ul+" "+(i.isNullOrUndefined(r)?"":r),attrs:""!==a.listRole?{role:a.listRole}:{}});return s.append(e,l),l}function A(e,r,o){var n=i.extend({},P,o);i.extend({},E,n.ariaAttributes);return t.cssClass=w(n.moduleName),("left"===n.expandIconPosition?s.prepend:s.append)([s.createElement("div",{className:"e-icons "+n.expandIconClass+" "+(i.isNullOrUndefined(r)?"":r)})],e.querySelector("."+t.cssClass.textContent)),e}e.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 E={level:1,listRole:"presentation",itemRole:"presentation",groupItemRole:"group",itemText:"list-item",wrapperRole:"presentation"},P={showCheckBox:!1,showIcon:!1,expandCollapse:!1,fields:e.defaultMappedFields,ariaAttributes:E,listClass:"",itemClass:"",processSubChild:!1,sortOrder:"None",template:null,groupTemplate:null,expandIconClass:"e-icon-collapsible",moduleName:"list",expandIconPosition:"right"};e.createList=n,e.createListFromArray=a,e.createListItemFromArray=l,e.createListItemFromJson=d,e.createListFromJson=c,e.getSiblingLI=h,e.indexOf=u,e.groupDataSource=p,e.addSorting=m,e.getDataSource=f,e.createJsonFromElement=y,e.renderContentTemplate=S,e.renderGroupTemplate=C,e.generateUL=N,e.generateIcon=A}(t.ListBase||(t.ListBase={}))}.apply(t,s))&&(e.exports=r)},function(e,t,i){var s,r;s=[i,t,i(5)],void 0!==(r=function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){for(var i in e)t.hasOwnProperty(i)||(t[i]=e[i])}(i)}.apply(t,s))&&(e.exports=r)}])}); | ||
!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})}); | ||
//# sourceMappingURL=ej2-lists.umd.min.js.map |
{ | ||
"name": "@syncfusion/ej2-lists", | ||
"version": "15.4.22", | ||
"version": "15.4.23", | ||
"description": "Essential JS 2 List Components", | ||
"author": "Syncfusion Inc.", | ||
"license": "SEE LICENSE IN license", | ||
"module": "dist/es6/index.js", | ||
"main": "./dist/ej2-lists.umd.min.js", | ||
"module": "./dist/es6/ej2-lists.es5.js", | ||
"es2015": "./dist/es6/ej2-lists.es2015.js", | ||
"dependencies": { | ||
"@syncfusion/ej2-base": "^15.4.21", | ||
"@syncfusion/ej2-data": "^15.4.22" | ||
"@syncfusion/ej2-base": "^15.4.23", | ||
"@syncfusion/ej2-data": "^15.4.23" | ||
}, | ||
@@ -12,0 +14,0 @@ "devDependencies": { |
@@ -249,1 +249,11 @@ import { Query } from '@syncfusion/ej2-data'; | ||
} | ||
/** | ||
* Used to get dataSource item from complex data using fields. | ||
* @param {{[key:string]:Object}|string[]|string} dataSource - Specifies an JSON or String data. | ||
* @param {FieldsMapping} fields - Fields that are mapped from the dataSource. | ||
*/ | ||
export declare function getFieldValues(dataItem: { | ||
[key: string]: Object; | ||
} | string | string[], fields: FieldsMapping): { | ||
[key: string]: Object; | ||
} | string | string[]; |
@@ -141,2 +141,3 @@ 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) { | ||
for (var i = 0; i < dataSource.length; i++) { | ||
var fieldData = getFieldValues(dataSource[i], fields); | ||
if (ej2_base_1.isNullOrUndefined(dataSource[i])) { | ||
@@ -149,3 +150,3 @@ continue; | ||
curData: dataSource[i], | ||
text: ej2_base_1.getValue(fields.text, dataSource[i]), | ||
text: fieldData[fields.text], | ||
options: curOpt, | ||
@@ -157,5 +158,5 @@ fields: fields | ||
var curItem = dataSource[i]; | ||
if (Object.keys(dataSource).length && dataSource[i].hasOwnProperty(fields.id) | ||
&& !ej2_base_1.isNullOrUndefined(dataSource[i][fields.id])) { | ||
id = dataSource[i].id; | ||
if (Object.keys(dataSource).length && fieldData.hasOwnProperty(fields.id) | ||
&& !ej2_base_1.isNullOrUndefined(fieldData[fields.id])) { | ||
id = fieldData.id; | ||
} | ||
@@ -167,5 +168,5 @@ var innerEle = []; | ||
if (isSingleLevel === true) { | ||
if (curOpt.showIcon && curItem.hasOwnProperty(fields.iconCss)) { | ||
if (!ej2_base_1.isNullOrUndefined(curItem[fields.iconCss])) { | ||
innerEle.push(ej2_base_2.createElement('span', { className: exports.cssClass.icon + ' ' + curItem[fields.iconCss] })); | ||
if (curOpt.showIcon && fieldData.hasOwnProperty(fields.iconCss)) { | ||
if (!ej2_base_1.isNullOrUndefined(fieldData[fields.iconCss])) { | ||
innerEle.push(ej2_base_2.createElement('span', { className: exports.cssClass.icon + ' ' + fieldData[fields.iconCss] })); | ||
} | ||
@@ -180,24 +181,24 @@ } | ||
li.setAttribute('aria-level', ariaAttributes.level.toString()); | ||
if (curItem.hasOwnProperty(fields.tooltip)) { | ||
li.setAttribute('title', curItem[fields.tooltip]); | ||
if (fieldData.hasOwnProperty(fields.tooltip)) { | ||
li.setAttribute('title', fieldData[fields.tooltip]); | ||
} | ||
if (curItem.hasOwnProperty(fields.htmlAttributes) && curItem[fields.htmlAttributes]) { | ||
setAttribute(li, curItem[fields.htmlAttributes]); | ||
if (fieldData.hasOwnProperty(fields.htmlAttributes) && fieldData[fields.htmlAttributes]) { | ||
setAttribute(li, fieldData[fields.htmlAttributes]); | ||
} | ||
if (curItem.hasOwnProperty(fields.enabled) && curItem[fields.enabled] === false) { | ||
if (fieldData.hasOwnProperty(fields.enabled) && fieldData[fields.enabled] === false) { | ||
li.classList.add(exports.cssClass.disabled); | ||
} | ||
if (curItem.hasOwnProperty(fields.isVisible) && curItem[fields.isVisible] === false) { | ||
if (fieldData.hasOwnProperty(fields.isVisible) && fieldData[fields.isVisible] === false) { | ||
li.style.display = 'none'; | ||
} | ||
if (curItem.hasOwnProperty(fields.imageUrl) && !ej2_base_1.isNullOrUndefined(curItem[fields.imageUrl])) { | ||
var attr = { src: curItem[fields.imageUrl] }; | ||
if (curItem.hasOwnProperty(fields.imageUrl)) { | ||
ej2_base_1.merge(attr, curItem[fields.imageAttributes]); | ||
if (fieldData.hasOwnProperty(fields.imageUrl) && !ej2_base_1.isNullOrUndefined(fieldData[fields.imageUrl])) { | ||
var attr = { src: fieldData[fields.imageUrl] }; | ||
if (fieldData.hasOwnProperty(fields.imageUrl)) { | ||
ej2_base_1.merge(attr, fieldData[fields.imageAttributes]); | ||
} | ||
ej2_base_2.prepend([ej2_base_2.createElement('img', { className: exports.cssClass.image, attrs: attr })], li.firstElementChild); | ||
} | ||
if (curOpt.showIcon && curItem.hasOwnProperty(fields.iconCss) && !curOpt.template) { | ||
if (!ej2_base_1.isNullOrUndefined(curItem[fields.iconCss])) { | ||
ej2_base_2.prepend([ej2_base_2.createElement('div', { className: exports.cssClass.icon + ' ' + curItem[fields.iconCss] })], li.firstElementChild); | ||
if (curOpt.showIcon && fieldData.hasOwnProperty(fields.iconCss) && !curOpt.template) { | ||
if (!ej2_base_1.isNullOrUndefined(fieldData[fields.iconCss])) { | ||
ej2_base_2.prepend([ej2_base_2.createElement('div', { className: exports.cssClass.icon + ' ' + fieldData[fields.iconCss] })], li.firstElementChild); | ||
} | ||
@@ -214,3 +215,3 @@ } | ||
curData: dataSource[i], | ||
text: ej2_base_1.getValue(fields.text, dataSource[i]), | ||
text: fieldData[fields.text], | ||
item: li, | ||
@@ -311,3 +312,3 @@ options: curOpt, | ||
curEle.classList.remove('json-parent'); | ||
var _loop_1 = function (i) { | ||
for (var i = 0; i < childs.length; i++) { | ||
var li = childs[i]; | ||
@@ -318,7 +319,8 @@ var anchor = li.querySelector('a'); | ||
var childNodes = anchor ? anchor.childNodes : li.childNodes; | ||
Object.keys(childNodes).forEach(function (key) { | ||
if (!(childNodes[Number(key)]).hasChildNodes()) { | ||
json[fields.text] = childNodes[Number(key)].textContent; | ||
var keys = Object.keys(childNodes); | ||
for (var i_1 = 0; i_1 < childNodes.length; i_1++) { | ||
if (!(childNodes[Number(keys[i_1])]).hasChildNodes()) { | ||
json[fields.text] = childNodes[Number(keys[i_1])].textContent; | ||
} | ||
}); | ||
} | ||
json[fields.id] = genUID(); | ||
@@ -339,5 +341,2 @@ var attributes_1 = getAllAttributes(li); | ||
jsonAr.push(json); | ||
}; | ||
for (var i = 0; i < childs.length; i++) { | ||
_loop_1(i); | ||
} | ||
@@ -380,2 +379,3 @@ return jsonAr; | ||
for (var i = 0; i < dataSource.length; i++) { | ||
var fieldData = getFieldValues(dataSource[i], fields); | ||
var item = dataSource[i]; | ||
@@ -388,7 +388,7 @@ var isHeader = item.isHeader; | ||
if (isHeader) { | ||
li.innerText = ej2_base_1.getValue(fields.text, item); | ||
li.innerText = fieldData[fields.text]; | ||
} | ||
else { | ||
ej2_base_2.append(compiledString(item), li); | ||
var value = ej2_base_1.getValue(fields.value, item); | ||
var value = fieldData[fields.value]; | ||
li.setAttribute('data-value', value); | ||
@@ -422,4 +422,5 @@ li.setAttribute('role', 'option'); | ||
function processSubChild(curItem, fields, ds, options, element, level) { | ||
var subDS = curItem[fields.child] || []; | ||
var hasChildren = curItem[fields.hasChildren]; | ||
var fieldData = getFieldValues(curItem, fields); | ||
var subDS = fieldData[fields.child] || []; | ||
var hasChildren = fieldData[fields.hasChildren]; | ||
if (subDS.length) { | ||
@@ -447,10 +448,11 @@ hasChildren = true; | ||
var dataSource; | ||
var fieldData = getFieldValues(item, fields); | ||
if (typeof item !== 'string' && typeof item !== 'number') { | ||
dataSource = item; | ||
text = ej2_base_1.getValue(fields.text, item) || ''; | ||
value = ej2_base_1.getValue(fields.value, item); | ||
text = fieldData[fields.text] || ''; | ||
value = fieldData[fields.value]; | ||
} | ||
var elementID; | ||
if (!ej2_base_1.isNullOrUndefined(dataSource) && !ej2_base_1.isNullOrUndefined(dataSource[fields.id]) | ||
&& dataSource[fields.id] !== '') { | ||
if (!ej2_base_1.isNullOrUndefined(dataSource) && !ej2_base_1.isNullOrUndefined(fieldData[fields.id]) | ||
&& fieldData[fields.id] !== '') { | ||
elementID = id; | ||
@@ -466,3 +468,3 @@ } | ||
}); | ||
if (dataSource && dataSource.hasOwnProperty(fields.enabled) && dataSource[fields.enabled].toString() === 'false') { | ||
if (dataSource && fieldData.hasOwnProperty(fields.enabled) && fieldData[fields.enabled].toString() === 'false') { | ||
li.classList.add(exports.cssClass.disabled); | ||
@@ -478,4 +480,4 @@ } | ||
li.setAttribute('role', 'option'); | ||
if (dataSource && dataSource.hasOwnProperty(fields.htmlAttributes) && dataSource[fields.htmlAttributes]) { | ||
setAttribute(li, dataSource[fields.htmlAttributes]); | ||
if (dataSource && fieldData.hasOwnProperty(fields.htmlAttributes) && fieldData[fields.htmlAttributes]) { | ||
setAttribute(li, fieldData[fields.htmlAttributes]); | ||
} | ||
@@ -485,3 +487,3 @@ if (innerElements.length) { | ||
} | ||
if (dataSource && dataSource.hasOwnProperty(fields.url) && dataSource[fields.url]) { | ||
if (dataSource && fieldData.hasOwnProperty(fields.url) && fieldData[fields.url]) { | ||
li.appendChild(anchorTag(dataSource, fields, text)); | ||
@@ -518,5 +520,6 @@ } | ||
function anchorTag(dataSource, fields, text) { | ||
var attr = { href: dataSource[fields.url] }; | ||
if (dataSource.hasOwnProperty(fields.urlAttributes) && dataSource[fields.urlAttributes]) { | ||
ej2_base_1.merge(attr, dataSource[fields.urlAttributes]); | ||
var fieldData = getFieldValues(dataSource, fields); | ||
var attr = { href: fieldData[fields.url] }; | ||
if (fieldData.hasOwnProperty(fields.urlAttributes) && fieldData[fields.urlAttributes]) { | ||
ej2_base_1.merge(attr, fieldData[fields.urlAttributes]); | ||
} | ||
@@ -534,6 +537,8 @@ var anchorTag = ej2_base_2.createElement('a', { className: exports.cssClass.text + ' ' + exports.cssClass.url, innerHTML: text }); | ||
var dataSource; | ||
var fieldData; | ||
if (typeof item !== 'string') { | ||
fieldData = getFieldValues(item, fields); | ||
dataSource = item; | ||
text = ej2_base_1.getValue(fields.text, item) || ''; | ||
uID = item[fields.id]; | ||
text = fieldData[fields.text] || ''; | ||
uID = fieldData[fields.id]; | ||
grpLI = (item.hasOwnProperty('isHeader') && item.isHeader) | ||
@@ -547,5 +552,3 @@ ? true : false; | ||
}); | ||
if (uID) { | ||
li.setAttribute('data-uid', uID); | ||
} | ||
!ej2_base_1.isNullOrUndefined(uID) ? li.setAttribute('data-uid', uID) : li.setAttribute('data-uid', genUID()); | ||
if (grpLI && options && options.groupTemplate) { | ||
@@ -562,3 +565,3 @@ var compiledString = ej2_base_3.compile(options.groupTemplate); | ||
attrs: (ariaAttributes.wrapperRole !== '' ? { role: ariaAttributes.wrapperRole } : {}) }); | ||
if (dataSource && dataSource.hasOwnProperty(fields.url) && dataSource[fields.url]) { | ||
if (dataSource && fieldData.hasOwnProperty(fields.url) && fieldData[fields.url]) { | ||
innerDiv.appendChild(anchorTag(dataSource, fields, text)); | ||
@@ -597,2 +600,33 @@ } | ||
})(ListBase = exports.ListBase || (exports.ListBase = {})); | ||
function getFieldValues(dataItem, fields) { | ||
var fieldData = {}; | ||
var value; | ||
if (ej2_base_1.isNullOrUndefined(dataItem)) { | ||
return dataItem; | ||
} | ||
else if (typeof (dataItem) === 'string' || typeof (dataItem) === 'number') { | ||
return dataItem; | ||
} | ||
else if (ej2_base_1.isNullOrUndefined(dataItem.isHeader)) { | ||
for (var _i = 0, _a = Object.keys(fields); _i < _a.length; _i++) { | ||
var field = _a[_i]; | ||
if (!ej2_base_1.isNullOrUndefined(fields[field]) && | ||
typeof (fields[field]) === 'string') { | ||
var property = fields[field].split('.'); | ||
var dataField = property.length > 1 ? property[0] : fields[field]; | ||
if (!ej2_base_1.isNullOrUndefined(dataItem[dataField])) { | ||
value = ej2_base_1.getValue(fields[field], dataItem); | ||
if (!ej2_base_1.isNullOrUndefined(value)) { | ||
fieldData[fields[field]] = value; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
else if (!ej2_base_1.isNullOrUndefined(dataItem.isHeader) && dataItem.isHeader) { | ||
fieldData = dataItem; | ||
} | ||
return fieldData; | ||
} | ||
exports.getFieldValues = getFieldValues; | ||
}); |
@@ -1,2 +0,2 @@ | ||
import { merge, formatUnit, isNullOrUndefined, getValue } from '@syncfusion/ej2-base';import { attributes, addClass, removeClass, createElement, prepend, closest, remove } from '@syncfusion/ej2-base';import { Component, EventHandler, BaseEventArgs, Property, Complex, Event } from '@syncfusion/ej2-base';import { NotifyPropertyChanges, INotifyPropertyChanged, ChildProperty, KeyboardEvents } from '@syncfusion/ej2-base';import { KeyboardEventArgs, EmitType } from '@syncfusion/ej2-base';import { Animation, AnimationOptions, Effect, rippleEffect, Touch, SwipeEventArgs } from '@syncfusion/ej2-base';import { DataManager, Query } from '@syncfusion/ej2-data';import { ListBase, ListBaseOptions, SortOrder } from '../common/list-base'; | ||
import { merge, formatUnit, isNullOrUndefined } from '@syncfusion/ej2-base';import { attributes, addClass, removeClass, createElement, prepend, closest, remove } from '@syncfusion/ej2-base';import { Component, EventHandler, BaseEventArgs, Property, Complex, Event } from '@syncfusion/ej2-base';import { NotifyPropertyChanges, INotifyPropertyChanged, ChildProperty, KeyboardEvents } from '@syncfusion/ej2-base';import { KeyboardEventArgs, EmitType } from '@syncfusion/ej2-base';import { Animation, AnimationOptions, Effect, rippleEffect, Touch, SwipeEventArgs } from '@syncfusion/ej2-base';import { DataManager, Query } from '@syncfusion/ej2-data';import { ListBase, ListBaseOptions, SortOrder, getFieldValues } from '../common/list-base'; | ||
import {AnimationSettings,SelectEventArgs} from "./list-view"; | ||
@@ -3,0 +3,0 @@ import {ComponentModel} from '@syncfusion/ej2-base'; |
@@ -301,2 +301,3 @@ import { Component, BaseEventArgs } from '@syncfusion/ej2-base'; | ||
disableItem(obj: Fields | HTMLElement): void; | ||
private setItemState(obj, isEnable); | ||
/** | ||
@@ -303,0 +304,0 @@ * A function helps to show an items based on given input. |
@@ -373,2 +373,3 @@ var __extends = (this && this.__extends) || (function () { | ||
var data = this.getItemData(li); | ||
var fieldData = list_base_1.getFieldValues(data, this.listBaseOption.fields); | ||
if (ej2_base_1.isNullOrUndefined(data) && typeof this.dataSource[0] === 'string') { | ||
@@ -384,3 +385,3 @@ this.selectedItems = { | ||
item: li, | ||
text: ej2_base_1.getValue(this.listBaseOption.fields.text, data), | ||
text: fieldData[this.listBaseOption.fields.text], | ||
data: data | ||
@@ -437,3 +438,4 @@ }; | ||
this.curDSJSON = this.findItemFromDS(ds, { id: key }); | ||
ds = this.curDSJSON ? this.curDSJSON[this.fields.child] : ds; | ||
var fieldData = list_base_1.getFieldValues(this.curDSJSON, this.listBaseOption.fields); | ||
ds = this.curDSJSON ? fieldData[this.fields.child] : ds; | ||
} | ||
@@ -454,10 +456,18 @@ return ds; | ||
dataSource.some(function (data) { | ||
var fieldData = list_base_1.getFieldValues(data, _this.listBaseOption.fields); | ||
if ((fields.id || fields.text) && | ||
(!fields.id || data[_this.fields.id] === fields.id) && | ||
(!fields.text || data[_this.fields.text] === fields.text)) { | ||
(!fields.id || fieldData[_this.fields.id] === fields.id) && | ||
(!fields.text || fieldData[_this.fields.text] === fields.text)) { | ||
resultJSON = (parent ? dataSource : data); | ||
} | ||
else if (data.hasOwnProperty(_this.fields.child) && data[_this.fields.child].length) { | ||
resultJSON = _this.findItemFromDS(data[_this.fields.child], fields, parent); | ||
else if (!ej2_base_1.isNullOrUndefined(fields.id) && ej2_base_1.isNullOrUndefined(fieldData[_this.fields.id])) { | ||
var li = _this.element.querySelector('[data-uid="' | ||
+ fields.id + '"]'); | ||
if (li.innerText.trim() === fieldData[_this.fields.text]) { | ||
resultJSON = data; | ||
} | ||
} | ||
else if (fieldData.hasOwnProperty(_this.fields.child) && fieldData[_this.fields.child].length) { | ||
resultJSON = _this.findItemFromDS(fieldData[_this.fields.child], fields, parent); | ||
} | ||
return !!resultJSON; | ||
@@ -571,3 +581,4 @@ }); | ||
this.liCollection = this.curUL.querySelectorAll('.' + classNames.listItem); | ||
this.header((ej2_base_1.getValue(this.listBaseOption.fields.text, this.selectedItems.data)), true); | ||
var fieldData = list_base_1.getFieldValues(this.selectedItems.data, this.listBaseOption.fields); | ||
this.header((fieldData[this.listBaseOption.fields.text]), true); | ||
this.selectedLI = undefined; | ||
@@ -636,3 +647,4 @@ } | ||
} | ||
var text = ej2_base_1.getValue(this.fields.text, this.curDSJSON); | ||
var fieldData = list_base_1.getFieldValues(this.curDSJSON, this.listBaseOption.fields); | ||
var text = fieldData[this.fields.text]; | ||
this.switchView(fromUL, toUL, true); | ||
@@ -646,8 +658,15 @@ this.removeSelect(); | ||
var resultJSON = this.getItemData(obj); | ||
var fieldData = list_base_1.getFieldValues(resultJSON, this.listBaseOption.fields); | ||
if (resultJSON) { | ||
var li = this.element.querySelector('[data-uid="' | ||
+ resultJSON[this.fields.id] + '"]'); | ||
if (li) { | ||
this.setSelectLI(li); | ||
+ fieldData[this.fields.id] + '"]'); | ||
if (ej2_base_1.isNullOrUndefined(li)) { | ||
var curLi = this.element.querySelectorAll('.' + classNames.listItem); | ||
for (var i = 0; i < curLi.length; i++) { | ||
if (curLi[i].innerText.trim() === resultJSON.text) { | ||
li = curLi[i]; | ||
} | ||
} | ||
} | ||
this.setSelectLI(li); | ||
} | ||
@@ -663,19 +682,24 @@ } | ||
ListView.prototype.enableItem = function (obj) { | ||
var resultJSON = this.getItemData(obj); | ||
if (resultJSON) { | ||
var li = this.element.querySelector('[data-uid="' + resultJSON[this.fields.id] + '"]'); | ||
if (li) { | ||
li.classList.remove(classNames.disable); | ||
} | ||
delete resultJSON[this.fields.enabled]; | ||
} | ||
this.setItemState(obj, true); | ||
}; | ||
ListView.prototype.disableItem = function (obj) { | ||
this.setItemState(obj, false); | ||
}; | ||
ListView.prototype.setItemState = function (obj, isEnable) { | ||
var resultJSON = this.getItemData(obj); | ||
var fieldData = list_base_1.getFieldValues(resultJSON, this.listBaseOption.fields); | ||
if (resultJSON) { | ||
var li = this.element.querySelector('[data-uid="' + resultJSON[this.fields.id] + '"]'); | ||
if (li) { | ||
li.classList.add(classNames.disable); | ||
var li = this.element.querySelector('[data-uid="' + fieldData[this.fields.id] + '"]'); | ||
if (isEnable) { | ||
if (li) { | ||
li.classList.remove(classNames.disable); | ||
} | ||
delete resultJSON[this.fields.enabled]; | ||
} | ||
resultJSON[this.fields.enabled] = false; | ||
else if (!isEnable) { | ||
if (li) { | ||
li.classList.add(classNames.disable); | ||
} | ||
resultJSON[this.fields.enabled] = false; | ||
} | ||
} | ||
@@ -691,4 +715,5 @@ }; | ||
var resultJSON = this.getItemData(obj); | ||
var fieldData = list_base_1.getFieldValues(resultJSON, this.listBaseOption.fields); | ||
if (resultJSON) { | ||
var li = this.element.querySelector('[data-uid="' + resultJSON[this.fields.id] + '"]'); | ||
var li = this.element.querySelector('[data-uid="' + fieldData[this.fields.id] + '"]'); | ||
if (li) { | ||
@@ -707,3 +732,4 @@ li.style.display = display; | ||
var ds = this.findItemFromDS(this.dataSource, fields); | ||
var child = ds[this.fields.child]; | ||
var fieldData = list_base_1.getFieldValues(ds, this.listBaseOption.fields); | ||
var child = fieldData[this.fields.child]; | ||
if (!child) { | ||
@@ -730,5 +756,6 @@ child = []; | ||
curDS.some(function (data, index, arr) { | ||
var fieldData = list_base_1.getFieldValues(data, _this.listBaseOption.fields); | ||
if ((fields.id || fields.text) && | ||
(!fields.id || data[_this.fields.id] === fields.id) && | ||
(!fields.text || data[_this.fields.text] === fields.text)) { | ||
(!fields.id || fieldData[_this.fields.id] === fields.id) && | ||
(!fields.text || fieldData[_this.fields.text] === fields.text)) { | ||
curAr_1 = arr; | ||
@@ -735,0 +762,0 @@ idx_1 = index; |
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 not supported yet
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 not supported yet
Sorry, the diff of this file is not supported yet
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
2805854
50
16301