@hazyflame/ej2-dropdowns
Version:
Essential JS 2 DropDown Components
10 lines • 351 kB
JavaScript
/*!
* filename: ej2-dropdowns.umd.min.js
* version : 19.1.69
* Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
* Use of this code is subject to the terms of our license.
* A copy of the current license can be obtained at any time by e-mailing
* licensing@syncfusion.com. Any infringement will be prosecuted under
* applicable laws.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-base"),require("@syncfusion/ej2-data"),require("@syncfusion/ej2-lists"),require("@syncfusion/ej2-popups"),require("@syncfusion/ej2-inputs"),require("@syncfusion/ej2-buttons"),require("@syncfusion/ej2-navigations")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-base","@syncfusion/ej2-data","@syncfusion/ej2-lists","@syncfusion/ej2-popups","@syncfusion/ej2-inputs","@syncfusion/ej2-buttons","@syncfusion/ej2-navigations"],t):t(e.ej={},e.ej2Base,e.ej2Data,e.ej2Lists,e.ej2Popups,e.ej2Inputs,e.ej2Buttons,e.ej2Navigations)}(this,function(e,t,i,s,l,o,n,r){"use strict";function a(e,t,i,s,l,o){C+=String.fromCharCode(e),setTimeout(function(){C=""},1e3);var n;if(C=s?C.toLowerCase():C,x===l&&b===C){for(var r=0;r<S.length;r++)if(S[r].classList.contains(E)){n=r;break}return n+=1,S[n]}var a=t,h=C.length,p=void 0;r=i=i?i+1:0;S=[];do{r===a.length&&(r=-1),p=a[n=-1===r?0:r],(o?s?p.textContent.trim().toLowerCase():p.textContent.trim():s?p.innerText.toLowerCase():p.innerText).substr(0,h)===C&&S.push(a[n]),r++}while(r!==i);return b=C,x=l,S[0]}function h(e,t,i,s){var l=t;s=void 0===s||null===s||s;var o={item:null,index:null};if(e&&e.length){for(var n=e.length,r=s?e.toLocaleLowerCase():e,a=0,h=l;a<h.length;a++){var p=h[a],u=(s?p.textContent.toLocaleLowerCase():p.textContent).replace(/^\s+|\s+$/g,"");if("Equal"===i&&u===r||"StartsWith"===i&&u.substr(0,n)===r)return o.item=p,o.index=a,{item:p,index:a}}return o}return o}function p(e,t,i,s,l){if(""!==t){var o=i?"gim":"gm";t=/^[a-zA-Z0-9- ]*$/.test(t)?t:t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var n="StartsWith"===s?"^("+t+")":"EndsWith"===s?"("+t+")$":"("+t+")";u(e,new RegExp(n,o),l)}}function u(e,t,i){for(var s=0;e.childNodes&&s<e.childNodes.length;s++){if(3===e.childNodes[s].nodeType&&""!==e.childNodes[s].textContent.trim()){if(e=i&&e.classList.contains("e-highlight")?e.parentElement:e,i&&e.getAttribute("data-value"))e.innerHTML=e.getAttribute("data-value").replace(t,'<span class="e-highlight">$1</span>');else{var l=e.childNodes[s].nodeValue.trim().replace(t,'<span class="e-highlight">$1</span>');e.childNodes[s].nodeValue="",e.innerHTML=e.innerHTML.trim()+l}break}u(e.childNodes[s],t,i)}}function c(e){for(var t=e.querySelectorAll(".e-highlight"),i=t.length-1;i>=0;i--){var s=t[i].parentNode,l=document.createTextNode(t[i].textContent);s.replaceChild(l,t[i])}}function d(e,i,s,l,o,n,r){var a=t.createElement("span",{className:Se}),h=t.createElement("label",{className:Ee});t.isNullOrUndefined(s.id)||""===s.id||(h.id="label_"+s.id.replace(/ /g,"_"),t.attributes(s,{"aria-labelledby":h.id})),t.isNullOrUndefined(l.placeholder)||""===l.placeholder||(h.innerText=t.SanitizeHtmlHelper.sanitize(l.placeholder),l.removeAttribute("placeholder")),h.innerText=t.SanitizeHtmlHelper.sanitize(r),i.appendChild(a),i.appendChild(h),e.classList.add("e-float-input"),m(o,h),"Always"===n&&(h.classList.contains(we)&&t.removeClass([h],we),t.addClass([h],xe))}function m(e,i){e&&e.length>0?(t.addClass([i],xe),t.removeClass([i],we)):(t.removeClass([i],xe),t.addClass([i],we))}function f(e,i,s,l,o,n,r){var a,h=i.querySelector("."+Ee),p=i.querySelector("."+Se);t.isNullOrUndefined(h)?v(o,l,a=null!==r?r:""):(a=h.innerText,t.detach(s.querySelector("."+Ee)),v(o,l,a),t.isNullOrUndefined(p)||t.detach(s.querySelector("."+Se))),e.classList.remove("e-float-input")}function v(e,t,i){e&&e.length?t.placeholder="":t.placeholder=i}function y(e,i){e.classList.add("e-input-focus");var s=i.querySelector("."+Ee);t.isNullOrUndefined(s)||(t.addClass([s],xe),s.classList.contains(we)&&t.removeClass([s],we))}function g(e,i,s,l,o){e.classList.remove("e-input-focus");var n=i.querySelector("."+Ee);s&&s.length<=0&&"Auto"===l&&!t.isNullOrUndefined(n)&&(n.classList.contains(xe)&&t.removeClass([n],xe),t.addClass([n],we))}var C="",b="",S=[],E="e-active",x="",w=function(){var e=function(t,i){return(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])})(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)}}(),O=function(e,t,i,s){var l,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 r=e.length-1;r>=0;r--)(l=e[r])&&(n=(o<3?l(n):o>3?l(t,i,n):l(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n},A=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return w(i,e),O([t.Property()],i.prototype,"text",void 0),O([t.Property()],i.prototype,"value",void 0),O([t.Property()],i.prototype,"iconCss",void 0),O([t.Property()],i.prototype,"groupBy",void 0),O([t.Property()],i.prototype,"htmlAttributes",void 0),i}(t.ChildProperty),B={root:"e-dropdownbase",rtl:"e-rtl",content:"e-content",selected:"e-active",hover:"e-hover",noData:"e-nodata",fixedHead:"e-fixed-head",focus:"e-item-focus",li:"e-list-item",group:"e-list-group-item",disabled:"e-disabled",grouping:"e-dd-group"},k="ItemTemplate",D="ValueTemplate",I="GroupTemplate",T="HeaderTemplate",L="FooterTemplate",N="NoRecordsTemplate",P="ActionFailureTemplate",F=function(e){function l(t,i){var s=e.call(this,t,i)||this;return s.preventChange=!1,s.isAngular=!1,s.isPreventChange=!1,s}return w(l,e),l.prototype.getPropObject=function(e,t,i){var s=new Object,l=new Object,o=function(e){return e};s[o(e)]=t[o(e)],l[o(e)]=i[o(e)];var n=new Object;return n.newProperty=s,n.oldProperty=l,n},l.prototype.getValueByText=function(e,i,s){var l=null;return t.isNullOrUndefined(this.listData)||(l=i?this.checkValueCase(e,!0,s):this.checkValueCase(e,!1,s)),l},l.prototype.checkValueCase=function(e,i,s,l){var o=this,n=null;l&&(n=e);var r=this.listData,a=this.fields,h=this.typeOfData(r).typeof;if("string"===h||"number"===h||"boolean"===h)for(var p=0,u=r;p<u.length;p++){var c=u[p];t.isNullOrUndefined(c)||(s?n=this.checkingAccent(String(c),e,i):i?this.checkIgnoreCase(String(c),e)&&(n=this.getItemValue(String(c),e,i)):this.checkNonIgnoreCase(String(c),e)&&(n=this.getItemValue(String(c),e,i,l)))}else i?r.filter(function(i){var s=t.getValue(a.value,i);!t.isNullOrUndefined(s)&&o.checkIgnoreCase(t.getValue(a.text,i).toString(),e)&&(n=t.getValue(a.value,i))}):l?r.filter(function(e){var i=t.getValue(a.value,e);t.isNullOrUndefined(i)||t.isNullOrUndefined(n)||i.toString()!==n.toString()||(n=t.getValue(a.text,e))}):r.filter(function(i){o.checkNonIgnoreCase(t.getValue(a.text,i),e)&&(n=t.getValue(a.value,i))});return n},l.prototype.checkingAccent=function(e,t,s){var l=i.DataUtil.ignoreDiacritics(String(e)),o=i.DataUtil.ignoreDiacritics(t.toString()),n=null;return s?this.checkIgnoreCase(l,o)&&(n=this.getItemValue(String(e),t,s)):this.checkNonIgnoreCase(String(e),t)&&(n=this.getItemValue(String(e),t,s)),n},l.prototype.checkIgnoreCase=function(e,t){return String(e).toLowerCase()===t.toString().toLowerCase()},l.prototype.checkNonIgnoreCase=function(e,t){return String(e)===t.toString()},l.prototype.getItemValue=function(e,t,i,s){var l=this.listData,o=this.typeOfData(l).typeof;return s?e.toString():i?"string"===o?String(e):this.getFormattedValue(String(e)):"string"===o?t:this.getFormattedValue(t)},l.prototype.templateCompiler=function(e){var i=!1;if(e)try{i=!!t.selectAll(e,document).length}catch(e){i=!1}return i},l.prototype.l10nUpdate=function(e){var i="listbox"===this.getModuleName()?this.ulElement:this.list;if("No records found"!==this.noRecordsTemplate||"Request failed"!==this.actionFailureTemplate){this.DropDownBaseresetBlazorTemplates(!1,!1,!0,!0);var s=e?this.actionFailureTemplate:this.noRecordsTemplate,l=e?this.actionFailureTemplateId:this.noRecordsTemplateId;i.innerHTML="";var o=(this.templateCompiler(s)?t.compile(t.select(s,document).innerHTML.trim()):t.compile(s))({},this,e?"actionFailureTemplate":"noRecordsTemplate",l,this.isStringTemplate,null,i);if(o&&o.length>0)for(var n=0;n<o.length;n++)i.appendChild(o[n]);this.renderReactTemplates(),this.DropDownBaseupdateBlazorTemplates(!1,!1,!e,e,!1,!1,!1,!1)}else{var r=new t.L10n(this.getLocaleName(),{},this.locale);""!==r.getConstant("actionFailureTemplate")?this.l10n=r:this.l10n=new t.L10n("listbox"===this.getModuleName()?"listbox":"dropdowns",{noRecordsTemplate:"No records found",actionFailureTemplate:"Request failed"},this.locale);var a=e?this.l10n.getConstant("actionFailureTemplate"):this.l10n.getConstant("noRecordsTemplate");if("listbox"===this.getModuleName()){var h=this.createElement("li");h.textContent=a,i.appendChild(h),h.classList.add("e-list-nrt")}else i.innerHTML=a}},l.prototype.getLocaleName=function(){return"drop-down-base"},l.prototype.getTextByValue=function(e){return this.checkValueCase(e,!1,!1,!0)},l.prototype.getFormattedValue=function(e){if(this.listData&&this.listData.length){var i=this.typeOfData(this.listData);if(t.isBlazor()&&t.isNullOrUndefined(e)||"null"===e)return null;if("number"==typeof t.getValue(this.fields.value?this.fields.value:"value",i.item)||"number"===i.typeof)return parseFloat(e);if("boolean"==typeof t.getValue(this.fields.value?this.fields.value:"value",i.item)||"boolean"===i.typeof)return"true"===e||""+e=="true"}return e},l.prototype.setEnableRtl=function(){this.list&&this.enableRtlElements.push(this.list),this.enableRtl?t.addClass(this.enableRtlElements,B.rtl):t.removeClass(this.enableRtlElements,B.rtl)},l.prototype.initialize=function(){if(this.bindEvent=!0,this.actionFailureTemplateId=""+this.element.id+P,"UL"===this.element.tagName){var e=s.ListBase.createJsonFromElement(this.element);this.setProperties({fields:{text:"text",value:"text"}},!0),this.resetList(e,this.fields)}else if("SELECT"===this.element.tagName){(this.dataSource instanceof Array?this.dataSource.length>0:!t.isNullOrUndefined(this.dataSource))||this.renderItemsBySelect()}else this.setListData(this.dataSource,this.fields,this.query)},l.prototype.DropDownBaseupdateBlazorTemplates=function(e,i,s,l,o,n,r,a){this.isStringTemplate||(this.itemTemplate&&e&&t.updateBlazorTemplate(this.itemTemplateId,k,this,a),this.groupTemplate&&i&&t.updateBlazorTemplate(this.groupTemplateId,I,this,a),this.noRecordsTemplate&&s&&t.updateBlazorTemplate(this.noRecordsTemplateId,N,this,a),this.actionFailureTemplate&&l&&t.updateBlazorTemplate(this.actionFailureTemplateId,P,this,a),o&&t.updateBlazorTemplate(this.valueTemplateId,D,this,a),n&&t.updateBlazorTemplate(this.headerTemplateId,T,this),r&&t.updateBlazorTemplate(this.footerTemplateId,L,this))},l.prototype.DropDownBaseresetBlazorTemplates=function(e,i,s,l,o,n,r){this.isStringTemplate||(this.itemTemplate&&e&&t.resetBlazorTemplate(this.itemTemplateId,k),this.groupTemplate&&i&&t.resetBlazorTemplate(this.groupTemplateId,I),this.noRecordsTemplate&&s&&t.resetBlazorTemplate(this.noRecordsTemplateId,N),this.actionFailureTemplate&&l&&t.resetBlazorTemplate(this.actionFailureTemplateId,P),o&&t.resetBlazorTemplate(this.valueTemplateId,D),n&&t.resetBlazorTemplate(this.headerTemplateId,T),r&&t.resetBlazorTemplate(this.footerTemplateId,L))},l.prototype.getPersistData=function(){return this.addOnPersist([])},l.prototype.setEnabled=function(){this.element.setAttribute("aria-disabled",this.enabled?"false":"true")},l.prototype.updateDataAttribute=function(e){for(var i=["class","style","id","type"],s={},l=0;l<this.element.attributes.length;l++)-1!==i.indexOf(this.element.attributes[l].name)||"dropdownlist"===this.getModuleName()&&"readonly"===this.element.attributes[l].name||(s[this.element.attributes[l].name]=this.element.getAttribute(this.element.attributes[l].name));t.extend(s,e,s),this.setProperties({htmlAttributes:s},!0)},l.prototype.renderItemsBySelect=function(){var e=this.element,t={value:"value",text:"text"},i=[],s=e.querySelectorAll("select>optgroup"),l=e.querySelectorAll("select>option");if(this.getJSONfromOption(i,l,t),s.length){for(var o=0;o<s.length;o++){var n=s[o],r={};r[t.text]=n.label,r.isHeader=!0;var a=n.querySelectorAll("option");i.push(r),this.getJSONfromOption(i,a,t)}e.querySelectorAll("select>option")}this.updateFields(t.text,t.value,this.fields.groupBy,this.fields.htmlAttributes,this.fields.iconCss),this.resetList(i,t)},l.prototype.updateFields=function(e,i,s,l,o){var n={fields:{text:e,value:i,groupBy:t.isNullOrUndefined(s)?this.fields&&this.fields.groupBy:s,htmlAttributes:t.isNullOrUndefined(l)?this.fields&&this.fields.htmlAttributes:l,iconCss:t.isNullOrUndefined(o)?this.fields&&this.fields.iconCss:o}};this.setProperties(n,!0)},l.prototype.getJSONfromOption=function(e,i,s){for(var l=0,o=i;l<o.length;l++){var n=o[l],r={};r[s.text]=n.innerText,r[s.value]=t.isNullOrUndefined(n.getAttribute(s.value))?n.innerText:n.getAttribute(s.value),e.push(r)}},l.prototype.preRender=function(){this.scrollTimer=-1,this.enableRtlElements=[],this.isRequested=!1,this.isDataFetched=!1,this.itemTemplateId=""+this.element.id+k,this.valueTemplateId=""+this.element.id+D,this.groupTemplateId=""+this.element.id+I,this.headerTemplateId=""+this.element.id+T,this.footerTemplateId=""+this.element.id+L,this.noRecordsTemplateId=""+this.element.id+N},l.prototype.setListData=function(e,t,s){var l=this;t=t||this.fields;var o;this.isActive=!0;var n={cancel:!1,data:e,query:s};this.isPreventChange=!(!this.isAngular||!this.preventChange)||this.isPreventChange,this.trigger("actionBegin",n,function(s){if(!s.cancel)if(l.showSpinner(),e instanceof i.DataManager){if(l.isRequested=!0,l.isDataFetched)return void l.emptyDataRequest(t);s.data.executeQuery(l.getQuery(s.query)).then(function(e){l.isPreventChange=!(!l.isAngular||!l.preventChange)||l.isPreventChange,l.trigger("actionComplete",e,function(e){if(!e.cancel){var i=e.result;0===i.length&&(l.isDataFetched=!0),o=l.renderItems(i,t),l.onActionComplete(o,i,e),l.groupTemplate&&l.renderGroupTemplate(o),l.isRequested=!1,l.bindChildItems(i,o,t,e)}})}).catch(function(e){l.isRequested=!1,l.onActionFailure(e),l.hideSpinner()})}else{var n=new i.DataManager(s.data),r={cancel:!1,result:l.getQuery(s.query).executeLocal(n)};l.isPreventChange=!(!l.isAngular||!l.preventChange)||l.isPreventChange,l.trigger("actionComplete",r,function(e){e.cancel||(o=l.renderItems(e.result,t),l.onActionComplete(o,e.result),l.groupTemplate&&l.renderGroupTemplate(o),l.bindChildItems(e.result,o,t))})}})},l.prototype.bindChildItems=function(e,i,s,l){var o=this;e.length>=100&&"autocomplete"===this.getModuleName()?setTimeout(function(){var n=o.remainingItems(o.sortedData,s);t.append(n,i),o.DropDownBaseupdateBlazorTemplates(!0,!1,!1,!1),o.liCollections=o.list.querySelectorAll("."+B.li),o.updateListValues(),o.raiseDataBound(e,l)},0):this.raiseDataBound(e,l)},l.prototype.updateListValues=function(){},l.prototype.findListElement=function(e,t,i,s){var l=null;if(e)for(var o=[].slice.call(e.querySelectorAll(t)),n=0;n<o.length;n++)if(o[n].getAttribute(i)===s+""){l=o[n];break}return l},l.prototype.raiseDataBound=function(e,t){this.hideSpinner();var i={items:e,e:t};this.trigger("dataBound",i)},l.prototype.remainingItems=function(e,t){var l=new i.DataManager(e).executeLocal((new i.Query).skip(100));if(this.itemTemplate){var o=this.templateListItem(l,t);return[].slice.call(o.childNodes)}var n=this.typeOfData(l).typeof;return"string"===n||"number"===n||"boolean"===n?s.ListBase.createListItemFromArray(this.createElement,l,!0,this.listOption(l,t),this):s.ListBase.createListItemFromJson(this.createElement,l,this.listOption(l,t),1,!0,this)},l.prototype.emptyDataRequest=function(e){var t=[];this.onActionComplete(this.renderItems(t,e),t),this.isRequested=!1,this.hideSpinner()},l.prototype.showSpinner=function(){},l.prototype.hideSpinner=function(){},l.prototype.onActionFailure=function(e){this.liCollections=[],this.trigger("actionFailure",e),this.l10nUpdate(!0),t.addClass([this.list],B.noData)},l.prototype.onActionComplete=function(e,i,s){this.listData=i,t.isBlazor()&&this.isServerRendered&&"listbox"===this.getModuleName()?(t.remove(this.list.querySelector(".e-list-parent")),t.remove(this.list.querySelector(".e-hidden-select"))):(this.isReact&&this.clearTemplate(["itemTemplate","groupTemplate","actionFailureTemplate","noRecordsTemplate"]),this.list.innerHTML=""),this.fixedHeaderElement=t.isNullOrUndefined(this.fixedHeaderElement)?this.fixedHeaderElement:null,this.list.appendChild(e),this.liCollections=this.list.querySelectorAll("."+B.li),this.ulElement=this.list.querySelector("ul"),this.postRender(this.list,i,this.bindEvent)},l.prototype.postRender=function(e,i,s){var l=e.querySelector("."+B.li),o=e.querySelector("."+B.selected);l&&!o&&l.classList.add(B.focus),i.length<=0?(this.l10nUpdate(),t.addClass([e],B.noData)):e.classList.remove(B.noData)},l.prototype.getQuery=function(e){return e||(this.query?this.query:new i.Query)},l.prototype.renderGroupTemplate=function(e){if(null!==this.fields.groupBy&&this.dataSource||this.element.querySelector("."+B.group)){var i=this.dataSource,l={groupTemplateID:this.groupTemplateId,isStringTemplate:this.isStringTemplate},o=e.querySelectorAll("."+B.group);if(this.templateCompiler(this.groupTemplate)){var n=t.select(this.groupTemplate,document).innerHTML.trim();s.ListBase.renderGroupTemplate(n,i,this.fields.properties,o,l,this)}else s.ListBase.renderGroupTemplate(this.groupTemplate,i,this.fields.properties,o,l,this);this.DropDownBaseupdateBlazorTemplates(!1,!0,!1,!1,!1,!1,!1,!1)}},l.prototype.createListItems=function(e,l){e&&l.groupBy||this.element.querySelector("optgroup")?(l.groupBy&&("None"!==this.sortOrder&&(e=this.getSortedDataSource(e)),e=s.ListBase.groupDataSource(e,l.properties,this.sortOrder)),t.addClass([this.list],B.grouping)):e=this.getSortedDataSource(e);var o=this.listOption(e,l),n=e.length>100?new i.DataManager(e).executeLocal((new i.Query).take(100)):e;return this.sortedData=e,s.ListBase.createList(this.createElement,"autocomplete"===this.getModuleName()?n:e,o,!0,this)},l.prototype.listOption=function(e,i){var s=!t.isNullOrUndefined(i.iconCss),l=t.isNullOrUndefined(i.properties)?i:i.properties,o=null!==i.text||null!==i.value?{fields:l,showIcon:s,ariaAttributes:{groupItemRole:"presentation"}}:{fields:{value:"text"}};return t.extend({},o,i,!0)},l.prototype.setFloatingHeader=function(e){t.isNullOrUndefined(this.fixedHeaderElement)&&(this.fixedHeaderElement=this.createElement("div",{className:B.fixedHead}),this.list.querySelector("li").classList.contains(B.group)||(this.fixedHeaderElement.style.display="none"),t.prepend([this.fixedHeaderElement],this.list),this.setFixedHeader()),t.isNullOrUndefined(this.fixedHeaderElement)||"0"!==this.fixedHeaderElement.style.zIndex||this.setFixedHeader(),this.scrollStop(e)},l.prototype.scrollStop=function(e){for(var i=t.isNullOrUndefined(e)?this.list:e.target,s=parseInt(getComputedStyle(this.getValidLi(),null).getPropertyValue("height"),10),l=Math.round(i.scrollTop/s),o=this.list.querySelectorAll("li:not(.e-hide-listitem)"),n=l;n>-1;n--){if(!t.isNullOrUndefined(o[n])&&o[n].classList.contains(B.group)){var r=o[n];this.fixedHeaderElement.innerHTML=r.innerHTML,this.fixedHeaderElement.style.top=i.scrollTop+"px",this.fixedHeaderElement.style.display="block";break}this.fixedHeaderElement.style.display="none",this.fixedHeaderElement.style.top="none"}},l.prototype.getValidLi=function(){return this.liCollections[0]},l.prototype.renderItems=function(e,t){var l;if(this.itemTemplate&&e){var o=e;o&&t.groupBy?("None"!==this.sortOrder&&(o=this.getSortedDataSource(o)),o=s.ListBase.groupDataSource(o,t.properties,this.sortOrder)):o=this.getSortedDataSource(o),this.sortedData=o;var n=o.length>100?new i.DataManager(o).executeLocal((new i.Query).take(100)):o;l=this.templateListItem("autocomplete"===this.getModuleName()?n:o,t);var r="listbox"===this.getModuleName();this.DropDownBaseupdateBlazorTemplates(!0,!1,!1,!1,!1,!1,!1,r)}else l=this.createListItems(e,t);return l},l.prototype.templateListItem=function(e,i){this.DropDownBaseresetBlazorTemplates(!0,!1,!1,!1);var l=this.listOption(e,i);l.templateID=this.itemTemplateId,l.isStringTemplate=this.isStringTemplate;if(this.templateCompiler(this.itemTemplate)){var o=t.select(this.itemTemplate,document).innerHTML.trim();return s.ListBase.renderContentTemplate(this.createElement,o,e,i.properties,l,this)}return s.ListBase.renderContentTemplate(this.createElement,this.itemTemplate,e,i.properties,l,this)},l.prototype.typeOfData=function(e){for(var i={typeof:null,item:null},s=0;!t.isNullOrUndefined(e)&&s<e.length;s++)if(!t.isNullOrUndefined(e[s])){if(!("string"==typeof e[s]||"number"==typeof e[s]||"boolean"==typeof e[s]?t.isNullOrUndefined(e[s]):t.isNullOrUndefined(t.getValue(this.fields.value?this.fields.value:"value",e[s]))))return i={typeof:typeof e[s],item:e[s]}}return i},l.prototype.setFixedHeader=function(){this.list.parentElement.style.display="block";var e=0;if(this.list&&this.list.parentElement&&(e=parseInt(document.defaultView.getComputedStyle(this.list.parentElement,null).getPropertyValue("border-width"),10),isNaN(e))){e=parseInt(document.defaultView.getComputedStyle(this.list.parentElement,null).getPropertyValue("border-top-width"),10)+parseInt(document.defaultView.getComputedStyle(this.list.parentElement,null).getPropertyValue("border-bottom-width"),10)+parseInt(document.defaultView.getComputedStyle(this.list.parentElement,null).getPropertyValue("border-left-width"),10)+parseInt(document.defaultView.getComputedStyle(this.list.parentElement,null).getPropertyValue("border-right-width"),10)}var i=this.getValidLi().offsetWidth-e;this.fixedHeaderElement.style.width=i.toString()+"px",t.setStyleAttribute(this.fixedHeaderElement,{zIndex:10});var s=this.ulElement.querySelector("."+B.group+":not(.e-hide-listitem)");this.fixedHeaderElement.innerHTML=s.innerHTML},l.prototype.getSortedDataSource=function(e){if(e&&"None"!==this.sortOrder){var t=this.fields.text?this.fields.text:"text";"string"!==this.typeOfData(e).typeof&&"number"!==this.typeOfData(e).typeof&&"boolean"!==this.typeOfData(e).typeof||(t=""),e=s.ListBase.getDataSource(e,s.ListBase.addSorting(this.sortOrder,t))}return e},l.prototype.getIndexByValue=function(e){for(var i,s=this.getItems(),l=0;l<s.length;l++)if(!t.isNullOrUndefined(e)&&s[l].getAttribute("data-value")===e.toString()){i=l;break}return i},l.prototype.dispatchEvent=function(e,t){var i=document.createEvent("HTMLEvents");i.initEvent(t,!1,!0),e.dispatchEvent(i)},l.prototype.setFields=function(){this.fields.value&&!this.fields.text?this.updateFields(this.fields.value,this.fields.value):!this.fields.value&&this.fields.text?this.updateFields(this.fields.text,this.fields.text):this.fields.value||this.fields.text||this.updateFields("text","text")},l.prototype.resetList=function(e,i,s){if(this.list){if("SELECT"===this.element.tagName&&this.element.options.length>0||"UL"===this.element.tagName&&this.element.childNodes.length>0){!(e instanceof Array?e.length>0:!t.isNullOrUndefined(e))&&this.selectData&&this.selectData.length>0&&(e=this.selectData)}this.setListData(e,i,s)}},l.prototype.updateSelectElementData=function(e){e&&t.isNullOrUndefined(this.selectData)&&this.listData&&this.listData.length>0&&(this.selectData=this.listData)},l.prototype.updateSelection=function(){},l.prototype.renderList=function(){this.render()},l.prototype.updateDataSource=function(e){this.resetList(this.dataSource)},l.prototype.setUpdateInitial=function(e,t){this.isDataFetched=!1;for(var i={},s=0;e.length>s;s++)t[e[s]]&&"fields"===e[s]?(this.setFields(),i[e[s]]=t[e[s]]):t[e[s]]&&(i[e[s]]=t[e[s]]);Object.keys(i).length>0&&(-1===Object.keys(i).indexOf("dataSource")&&(i.dataSource=this.dataSource),this.updateDataSource(i))},l.prototype.onPropertyChanged=function(e,i){"dropdownbase"===this.getModuleName()&&this.setUpdateInitial(["fields","query","dataSource"],e),this.setUpdateInitial(["sortOrder","itemTemplate"],e);for(var s=0,l=Object.keys(e);s<l.length;s++){switch(l[s]){case"query":case"sortOrder":case"dataSource":case"itemTemplate":break;case"enableRtl":this.setEnableRtl();break;case"enabled":this.setEnabled();break;case"groupTemplate":if(this.renderGroupTemplate(this.list),this.ulElement&&this.fixedHeaderElement){var o=this.ulElement.querySelector("."+B.group);this.fixedHeaderElement.innerHTML=o.innerHTML}break;case"locale":this.list&&!t.isNullOrUndefined(this.liCollections)&&0===this.liCollections.length&&this.l10nUpdate();break;case"zIndex":this.setProperties({zIndex:e.zIndex},!0),this.setZIndex()}}},l.prototype.render=function(e){this.list=this.createElement("div",{className:B.content,attrs:{tabindex:"0"}}),this.list.classList.add(B.root),this.setFields();var i={duration:300,selector:"."+B.li};this.rippleFun=t.rippleEffect(this.list,i);var s=this.element.querySelector("select>optgroup");if(!this.fields.groupBy&&t.isNullOrUndefined(s)||this.isGroupChecking||t.EventHandler.add(this.list,"scroll",this.setFloatingHeader,this),"dropdownbase"===this.getModuleName()){this.element.getAttribute("tabindex")&&this.list.setAttribute("tabindex",this.element.getAttribute("tabindex")),t.removeClass([this.element],B.root),this.element.style.display="none";var l=this.createElement("div");this.element.parentElement.insertBefore(l,this.element),l.appendChild(this.element),l.appendChild(this.list)}this.setEnableRtl(),this.setEnabled(),e||this.initialize()},l.prototype.getModuleName=function(){return"dropdownbase"},l.prototype.getItems=function(){return this.ulElement.querySelectorAll("."+B.li)},l.prototype.addItem=function(e,i){if((!this.list||this.list.textContent===this.noRecordsTemplate&&"listbox"!==this.getModuleName())&&this.renderList(),"None"!==this.sortOrder&&t.isNullOrUndefined(i)){var l=[].slice.call(this.listData);l.push(e),l=this.getSortedDataSource(l),i=this.fields.groupBy?(l=s.ListBase.groupDataSource(l,this.fields.properties,this.sortOrder)).indexOf(e):l.indexOf(e)}this.DropDownBaseresetBlazorTemplates(!0,!1,!1,!1);var o=this.getItems().length,n=this.list.querySelector("."+B.selected);e=e instanceof Array?e:[e];var r;r=t.isNullOrUndefined(i)||i<0||i>o-1?o:i;var a=this.fields;e&&a.groupBy&&(e=s.ListBase.groupDataSource(e,a.properties));for(var h=[],p=0;p<e.length;p++){var u=e[p],c=u.isHeader,d=this.createElement("li",{className:c?B.group:B.li,id:"option-add-"+p}),m=u instanceof Object?t.getValue(a.text,u):u;if(c&&(d.innerText=m),this.itemTemplate&&!c){var f=t.compile(this.itemTemplate)(u,this,"itemTemplate",this.itemTemplateId,this.isStringTemplate,null,d);f&&t.append(f,d),this.DropDownBaseupdateBlazorTemplates(!0,!1,!1,!1)}else c||d.appendChild(document.createTextNode(m));d.setAttribute("data-value",u instanceof Object?t.getValue(a.value,u):u),d.setAttribute("role","option"),this.notify("addItem",{module:"CheckBoxSelection",item:d}),h.push(d),this.listData.push(u),"None"===this.sortOrder&&t.isNullOrUndefined(i)&&0===r&&(r=null),this.updateActionCompleteData(d,u,r),this.trigger("beforeItemRender",{element:d,item:u})}if(0===o&&t.isNullOrUndefined(this.list.querySelector("ul")))this.list.innerHTML="",this.list.classList.remove(B.noData),this.list.appendChild(this.ulElement),this.liCollections=h,t.append(h,this.ulElement),this.updateAddItemList(this.list,o);else{"listbox"===this.getModuleName()&&0===o&&(this.ulElement.innerHTML="");var v=[];for(p=0;p<e.length;p++){for(var y=this.ulElement.querySelectorAll(".e-list-group-item"),g=0;g<y.length;g++)v[g]=y[g].innerText;if(v.indexOf(h[p].innerText)>-1&&a.groupBy){for(g=0;g<y.length;g++)if(v[g]===h[p].innerText){"None"===this.sortOrder?this.ulElement.insertBefore(h[p+1],y[g+1]):this.ulElement.insertBefore(h[p+1],this.ulElement.childNodes[i]),p+=1;break}}else this.liCollections[r]?this.liCollections[r].parentNode.insertBefore(h[p],this.liCollections[r]):this.ulElement.appendChild(h[p]);var C=[].slice.call(this.liCollections);C.splice(r,0,h[p]),this.liCollections=C,r+=1,"multiselect"===this.getModuleName()&&this.updateDataList()}}(n||0===i)&&this.updateSelection()},l.prototype.validationAttribute=function(e,t){var i=e.getAttribute("name")?e.getAttribute("name"):e.getAttribute("id");t.setAttribute("name",i),e.removeAttribute("name");for(var s=["required","aria-required","form"],l=0;l<s.length;l++)if(e.getAttribute(s[l])){var o=e.getAttribute(s[l]);t.setAttribute(s[l],o),e.removeAttribute(s[l])}},l.prototype.setZIndex=function(){},l.prototype.updateActionCompleteData=function(e,t,i){},l.prototype.updateAddItemList=function(e,t){},l.prototype.updateDataList=function(){},l.prototype.getDataByValue=function(e){if(!t.isNullOrUndefined(this.listData)){var i=this.typeOfData(this.listData).typeof;if("string"===i||"number"===i||"boolean"===i)for(var s=0,l=this.listData;s<l.length;s++){var o=l[s];if(!t.isNullOrUndefined(o)&&o===e)return o}else for(var n=0,r=this.listData;n<r.length;n++){o=r[n];if(!t.isNullOrUndefined(o)&&t.getValue(this.fields.value?this.fields.value:"value",o)===e)return o}}return null},l.prototype.destroy=function(){document.body.contains(this.list)&&(t.EventHandler.remove(this.list,"scroll",this.setFloatingHeader),t.isNullOrUndefined(this.rippleFun)||this.rippleFun(),t.detach(this.list)),e.prototype.destroy.call(this)},O([t.Complex({text:null,value:null,iconCss:null,groupBy:null},A)],l.prototype,"fields",void 0),O([t.Property(!1)],l.prototype,"enablePersistence",void 0),O([t.Property(null)],l.prototype,"itemTemplate",void 0),O([t.Property(null)],l.prototype,"groupTemplate",void 0),O([t.Property("No records found")],l.prototype,"noRecordsTemplate",void 0),O([t.Property("Request failed")],l.prototype,"actionFailureTemplate",void 0),O([t.Property("None")],l.prototype,"sortOrder",void 0),O([t.Property(!0)],l.prototype,"enabled",void 0),O([t.Property([])],l.prototype,"dataSource",void 0),O([t.Property(null)],l.prototype,"query",void 0),O([t.Property("StartsWith")],l.prototype,"filterType",void 0),O([t.Property(!0)],l.prototype,"ignoreCase",void 0),O([t.Property(1e3)],l.prototype,"zIndex",void 0),O([t.Property(!1)],l.prototype,"ignoreAccent",void 0),O([t.Property()],l.prototype,"locale",void 0),O([t.Event()],l.prototype,"actionBegin",void 0),O([t.Event()],l.prototype,"actionComplete",void 0),O([t.Event()],l.prototype,"actionFailure",void 0),O([t.Event()],l.prototype,"select",void 0),O([t.Event()],l.prototype,"dataBound",void 0),O([t.Event()],l.prototype,"created",void 0),O([t.Event()],l.prototype,"destroyed",void 0),l=O([t.NotifyPropertyChanges],l)}(t.Component),W=function(){var e=function(t,i){return(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])})(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)}}(),H=function(e,t,i,s){var l,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 r=e.length-1;r>=0;r--)(l=e[r])&&(n=(o<3?l(n):o>3?l(t,i,n):l(t,i))||n);return o>3&&n&&Object.defineProperty(t,i,n),n},V={root:"e-dropdownlist",hover:B.hover,selected:B.selected,rtl:B.rtl,li:B.li,disable:B.disabled,base:B.root,focus:B.focus,input:"e-input-group",inputFocus:"e-input-focus",icon:"e-input-group-icon e-ddl-icon",iconAnimation:"e-icon-anim",value:"e-input-value",device:"e-ddl-device",backIcon:"e-input-group-icon e-back-icon e-icons",filterBarClearIcon:"e-input-group-icon e-clear-icon e-icons",filterInput:"e-input-filter",filterParent:"e-filter-parent",mobileFilter:"e-ddl-device-filter",footer:"e-ddl-footer",header:"e-ddl-header",clearIcon:"e-clear-icon",clearIconHide:"e-clear-icon-hide",popupFullScreen:"e-popup-full-page",disableIcon:"e-ddl-disable-icon",hiddenElement:"e-ddl-hidden"},U={container:null,buttons:[]},M=function(e){function s(t,i){var s=e.call(this,t,i)||this;return s.previousValue=null,s.isListSearched=!1,s.preventChange=!1,s.isAngular=!1,s}return W(s,e),s.prototype.preRender=function(){var i=t.isBlazor()&&this.isServerRendered;this.isServerBlazor=!!i,this.valueTempElement=null,this.isServerBlazor?this.initializeData():(this.element.style.opacity="0",this.initializeData(),e.prototype.preRender.call(this)),this.activeIndex=this.index,this.queryString=""},s.prototype.initializeData=function(){this.isPopupOpen=!1,this.isDocumentClick=!1,this.isInteracted=!1,this.isFilterFocus=!1,this.beforePopupOpen=!1,this.initial=!0,this.initRemoteRender=!1,this.isNotSearchList=!1,this.isTyped=!1,this.isSelected=!1,this.preventFocus=!1,this.preventAutoFill=!1,this.isValidKey=!1,this.typedString="",this.isEscapeKey=!1,this.isPreventBlur=!1,this.isTabKey=!1,this.actionCompleteData={isUpdated:!1},this.actionData={isUpdated:!1},this.prevSelectPoints={},this.isSelectCustom=!1,this.isDropDownClick=!1,this.preventAltUp=!1,this.isCustomFilter=!1,this.isSecondClick=!1,this.keyConfigure={tab:"tab",enter:"13",escape:"27",end:"35",home:"36",down:"40",up:"38",pageUp:"33",pageDown:"34",open:"alt+40",close:"shift+tab",hide:"alt+38",space:"32"}},s.prototype.setZIndex=function(){this.popupObj&&this.popupObj.setProperties({zIndex:this.zIndex})},s.prototype.renderList=function(t){this.isServerBlazor?this.interopAdaptor.invokeMethodAsync("OnServerRenderList",this.beforePopupOpen,!1):(e.prototype.render.call(this,t),this.unWireListEvents(),this.wireListEvents())},s.prototype.floatLabelChange=function(){if("dropdownlist"===this.getModuleName()&&"Auto"===this.floatLabelType){var e=this.inputWrapper.container.querySelector(".e-float-text");""!==this.inputElement.value||this.isInteracted?t.classList(e,["e-label-top"],["e-label-bottom"]):t.classList(e,["e-label-bottom"],["e-label-top"])}},s.prototype.resetHandler=function(e){e.preventDefault(),this.clearAll(e)},s.prototype.resetFocusElement=function(){if(this.removeHover(),this.removeSelection(),this.removeFocus(),this.list.scrollTop=0,"autocomplete"!==this.getModuleName()&&!t.isNullOrUndefined(this.ulElement)){var e=this.ulElement.querySelector("."+V.li);e&&e.classList.add(V.focus)}},s.prototype.clearAll=function(e,s){!t.isNullOrUndefined(s)&&(t.isNullOrUndefined(s)||!t.isNullOrUndefined(s.dataSource)&&(s.dataSource instanceof i.DataManager||0!==s.dataSource.length))||(this.isActive=!0,this.resetSelection(s));var l=this.getItemData();this.previousValue!==l.value&&this.onChangeEvent(e)},s.prototype.resetSelection=function(e){this.list&&(t.isNullOrUndefined(e)||!t.isNullOrUndefined(e.dataSource)&&(e.dataSource instanceof i.DataManager||0!==e.dataSource.length)?(!this.allowFiltering||"autocomplete"===this.getModuleName()||t.isNullOrUndefined(this.actionCompleteData.ulElement)||t.isNullOrUndefined(this.actionCompleteData.list)||this.onActionComplete(this.actionCompleteData.ulElement.cloneNode(!0),this.actionCompleteData.list),this.resetFocusElement()):(this.selectedLI=null,this.actionCompleteData.isUpdated=!1,this.actionCompleteData.ulElement=null,this.actionCompleteData.list=null,this.resetList(e.dataSource))),this.isServerBlazor||(this.hiddenElement.innerHTML=""),this.inputElement.value="",this.value=null,this.itemData=null,this.text=null,this.index=null,this.activeIndex=null,this.item=null,this.queryString="",this.valueTempElement&&(t.detach(this.valueTempElement),this.inputElement.style.display="block",this.valueTempElement=null),this.setSelection(null,null),this.isSelectCustom=!1,this.updateIconState(),this.cloneElements()},s.prototype.setHTMLAttributes=function(){if(Object.keys(this.htmlAttributes).length)for(var e=0,i=Object.keys(this.htmlAttributes);e<i.length;e++){var s=i[e];if("class"===s){var l=this.htmlAttributes[s].replace(/\s+/g," ").trim();""!==l&&t.addClass([this.inputWrapper.container],l.split(" "))}else if("disabled"===s&&"disabled"===this.htmlAttributes[s])this.enabled=!1,this.setEnable();else if("readonly"!==s||t.isNullOrUndefined(this.htmlAttributes[s]))if("style"===s)this.inputWrapper.container.setAttribute("style",this.htmlAttributes[s]);else{var n=["title","id","placeholder","aria-placeholder","role","autocorrect","autocomplete","autocapitalize","spellcheck","minlength","maxlength"];"autocomplete"!==this.getModuleName()&&"combobox"!==this.getModuleName()||n.push("tabindex"),["name","required"].indexOf(s)>-1||0===s.indexOf("data")?this.hiddenElement.setAttribute(s,this.htmlAttributes[s]):n.indexOf(s)>-1?"placeholder"===s?o.Input.setPlaceholder(this.htmlAttributes[s],this.inputElement):this.inputElement.setAttribute(s,this.htmlAttributes[s]):this.inputWrapper.container.setAttribute(s,this.htmlAttributes[s])}else this.readonly=!0,this.dataBind()}"autocomplete"!==this.getModuleName()&&"combobox"!==this.getModuleName()||this.inputWrapper.container.removeAttribute("tabindex")},s.prototype.getAriaAttributes=function(){return{"aria-disabled":"false","aria-owns":this.element.id+"_options",role:"listbox","aria-haspopup":"true","aria-expanded":"false","aria-activedescendant":"null","aria-live":"polite","aria-labelledby":this.hiddenElement.id}},s.prototype.setEnableRtl=function(){o.Input.setEnableRtl(this.enableRtl,[this.inputElement.parentElement]),this.popupObj&&(this.popupObj.enableRtl=this.enableRtl,this.popupObj.dataBind())},s.prototype.setEnable=function(){o.Input.setEnabled(this.enabled,this.inputElement),this.enabled?(t.removeClass([this.inputWrapper.container],V.disable),this.inputElement.setAttribute("aria-disabled","false"),this.targetElement().setAttribute("tabindex",this.tabIndex)):(this.hidePopup(),t.addClass([this.inputWrapper.container],V.disable),this.inputElement.setAttribute("aria-disabled","true"),this.targetElement().tabIndex=-1)},s.prototype.getPersistData=function(){return this.addOnPersist(["value"])},s.prototype.getLocaleName=function(){return"drop-down-list"},s.prototype.preventTabIndex=function(e){"dropdownlist"===this.getModuleName()&&(e.tabIndex=-1)},s.prototype.targetElement=function(){return this.inputWrapper.container},s.prototype.getNgDirective=function(){return"EJS-DROPDOWNLIST"},s.prototype.getElementByText=function(e){return this.getElementByValue(this.getValueByText(e))},s.prototype.getElementByValue=function(e){for(var t,i=0,s=this.getItems();i<s.length;i++){var l=s[i];if(this.getFormattedValue(l.getAttribute("data-value"))===e){t=l;break}}return t},s.prototype.initValue=function(){this.renderList(),this.dataSource instanceof i.DataManager?this.initRemoteRender=!0:this.updateValues()},s.prototype.updateValues=function(){if(t.isNullOrUndefined(this.value))if(this.text&&t.isNullOrUndefined(this.value)){var e=this.getElementByText(this.text);if(t.isNullOrUndefined(e))return void this.setProperties({text:null});this.setSelection(e,null)}else this.setSelection(this.liCollections[this.activeIndex],null);else this.setSelection(this.getElementByValue(this.value),null);this.setHiddenValue(),o.Input.setValue(this.text,this.inputElement,this.floatLabelType,this.showClearButton)},s.prototype.onBlur=function(e){if(this.enabled){var i=e.relatedTarget,s=e.target,l=this.isPreventBlur;this.isPreventBlur=!1,!l||this.isDocumentClick||!this.isPopupOpen||t.isNullOrUndefined(s)&&(this.isFilterLayout()||!t.isNullOrUndefined(i))?this.isDocumentClick||!t.isNullOrUndefined(this.popupObj)&&document.body.contains(this.popupObj.element)&&this.popupObj.element.classList.contains(V.mobileFilter)?this.beforePopupOpen||(this.isDocumentClick=!1):(("dropdownlist"===this.getModuleName()&&!this.isFilterFocus&&i!==this.inputElement&&(document.activeElement!==i||document.activeElement===i&&s.classList.contains(V.inputFocus))||t.isNullOrUndefined(i)&&"dropdownlist"===this.getModuleName()&&this.allowFiltering&&s!==this.inputWrapper.container||"dropdownlist"!==this.getModuleName()&&!this.inputWrapper.container.contains(i)||this.isTabKey)&&(this.isDocumentClick=!!this.isPopupOpen,this.focusOutAction(e),this.isTabKey=!1),!this.isRequested||this.isPopupOpen||this.isPreventBlur||(this.isActive=!1,this.beforePopupOpen=!1)):"dropdownlist"===this.getModuleName()&&this.allowFiltering&&this.isPopupOpen?this.filterInput.focus():this.targetElement().focus()}},s.prototype.focusOutAction=function(e){this.isInteracted=!1,this.focusOut(e),this.onFocusOut()},s.prototype.onFocusOut=function(){this.enabled&&(this.isSelected&&(this.isSelectCustom=!1,this.onChangeEvent(null)),this.floatLabelChange(),this.dispatchEvent(this.hiddenElement,"change"),"dropdownlist"===this.getModuleName()&&"INPUT"!==this.element.tagName&&this.dispatchEvent(this.inputElement,"blur"),this.inputWrapper.clearButton&&t.addClass([this.inputWrapper.clearButton],V.clearIconHide),this.trigger("blur"))},s.prototype.onFocus=function(e){if(!this.isInteracted){this.isInteracted=!0;var t={isInteracted:!!e,event:e};this.trigger("focus",t)}this.updateIconState()},s.prototype.resetValueHandler=function(e){var i=t.closest(this.inputElement,"form");if(i&&e.target===i){var s=this.element.tagName===this.getNgDirective()?null:this.inputElement.getAttribute("value");this.text=s}},s.prototype.wireEvent=function(){t.EventHandler.add(this.inputWrapper.container,"mousedown",this.dropDownClick,this),t.EventHandler.add(this.inputWrapper.container,"focus",this.focusIn,this),t.EventHandler.add(this.inputWrapper.container,"keypress",this.onSearch,this),this.bindCommonEvent()},s.prototype.bindCommonEvent=function(){t.EventHandler.add(this.targetElement(),"blur",this.onBlur,this);var e=t.closest(this.inputElement,"form");e&&t.EventHandler.add(e,"reset",this.resetValueHandler,this),t.Browser.isDevice?this.keyboardModule=new t.KeyboardEvents(this.targetElement(),{keyAction:this.mobileKeyActionHandler.bind(this),keyConfigs:this.keyConfigure,eventName:"keydown"}):this.keyboardModule=new t.KeyboardEvents(this.targetElement(),{keyAction:this.keyActionHandler.bind(this),keyConfigs:this.keyConfigure,eventName:"keydown"}),this.bindClearEvent()},s.prototype.bindClearEvent=function(){this.showClearButton&&t.EventHandler.add(this.inputWrapper.clearButton,"mousedown",this.resetHandler,this)},s.prototype.unBindCommonEvent=function(){this.targetElement()&&t.EventHandler.remove(this.targetElement(),"blur",this.onBlur);var e=this.inputElement&&t.closest(this.inputElement,"form");e&&t.EventHandler.remove(e,"reset",this.resetValueHandler),t.Browser.isDevice||this.keyboardModule.destroy(),this.showClearButton&&t.EventHandler.remove(this.inputWrapper.clearButton,"mousedown",this.resetHandler)},s.prototype.updateIconState=function(){this.showClearButton&&(""===this.inputElement.value||this.readonly?t.addClass([this.inputWrapper.clearButton],V.clearIconHide):t.removeClass([this.inputWrapper.clearButton],V.clearIconHide))},s.prototype.wireListEvents=function(){t.EventHandler.add(this.list,"click",this.onMouseClick,this),t.EventHandler.add(this.list,"mouseover",this.onMouseOver,this),t.EventHandler.add(this.list,"mouseout",this.onMouseLeave,this)},s.prototype.onSearch=function(e){32!==e.charCode&&13!==e.charCode&&(void 0===this.list&&(this.isServerBlazor?(this.isServerIncrementalSearch=!0,this.interopAdaptor.invokeMethodAsync("OnServerRenderList",!0,!1)):this.renderList()),this.searchKeyEvent=e,this.onServerIncrementalSearch(e))},s.prototype.onServerIncrementalSearch=function(e){this.isRequested||t.isNullOrUndefined(this.list)||t.isNullOrUndefined(this.list.querySelector("li"))||!this.enabled||this.readonly||this.incrementalSearch(e)},s.prototype.onMouseClick=function(e){var i=e.target,s=t.closest(i,"."+B.li);if(this.isValidLI(s))if(this.setSelection(s,e),t.Browser.isDevice&&this.isFilterLayout())history.back();else{this.closePopup(100)}},s.prototype.onMouseOver=function(e){var i=t.closest(e.target,"."+B.li);this.setHover(i)},s.prototype.setHover=function(e){this.enabled&&this.isValidLI(e)&&!e.classList.contains(B.hover)&&(this.removeHover(),t.addClass([e],B.hover))},s.prototype.onMouseLeave=function(){this.removeHover()},s.prototype.removeHover=function(){if(this.list){var e=this.isServerBlazor&&this.popupObj&&this.popupObj.element?this.popupObj.element.querySelectorAll("."+B.hover):this.list.querySelectorAll("."+B.hover);e&&e.length&&t.removeClass(e,B.hover)}},s.prototype.isValidLI=function(e){return e&&e.hasAttribute("role")&&"option"===e.getAttribute("role")},s.prototype.incrementalSearch=function(e){if(this.liCollections.length>0){var i=a(e.charCode,this.liCollections,this.activeIndex,!0,this.element.id,this.isServerBlazor);t.isNullOrUndefined(i)||(this.setSelection(i,e),this.setScrollPosition())}},s.prototype.hideSpinner=function(){t.isNullOrUndefined(this.spinnerElement)||(l.hideSpinner(this.spinnerElement),t.removeClass([this.spinnerElement],V.disableIcon),this.spinnerElement.innerHTML="",this.spinnerElement=null)},s.prototype.showSpinner=function(){t.isNullOrUndefined(this.spinnerElement)&&(this.spinnerElement=t.Browser.isDevice&&!t.isNullOrUndefined(this.filterInputObj)&&this.filterInputObj.buttons[1]||!t.isNullOrUndefined(this.filterInputObj)&&this.filterInputObj.buttons[0]||this.inputWrapper.buttons[0],t.addClass([this.spinnerElement],V.disableIcon),l.createSpinner({target:this.spinnerElement,width:t.Browser.isDevice?"16px":"14px"},this.createElement),l.showSpinner(this.spinnerElement))},s.prototype.keyActionHandler=function(e){if(this.enabled){var i="pageUp"===e.action||"pageDown"===e.action,s="dropdownlist"!==this.getModuleName()&&("home"===e.action||"end"===e.action);this.isEscapeKey="escape"===e.action,this.isTabKey=!this.isPopupOpen&&"tab"===e.action;var l="down"===e.action||"up"===e.action||"home"===e.action||"end"===e.action,o="down"===e.action||"up"===e.action||"pageUp"===e.action||"pageDown"===e.action||"home"===e.action||"end"===e.action;if((!(this.isEditTextBox()||i||s)||this.isPopupOpen)&&!this.readonly){var n="tab"===e.action||"close"===e.action;if(void 0!==this.list||this.isRequested||n||"escape"===e.action||(this.searchKeyEvent=e,this.renderList()),((!this.isServerBlazor||"open"!==e.action&&"space"!==e.action)&&t.isNullOrUndefined(this.list)||!t.isNullOrUndefined(this.liCollections)&&o&&0===this.liCollections.length||this.isRequested)&&(!this.isServerBlazor||!l))return;switch((n&&"autocomplete"!==this.getModuleName()&&this.isPopupOpen||"escape"===e.action)&&e.preventDefault(),this.isSelected="escape"!==e.action&&this.isSelected,this.isTyped=!o&&"escape"!==e.action&&this.isTyped,e.action){case"down":case"up":this.updateUpDownAction(e);break;case"pageUp":this.pageUpSelection(this.activeIndex-this.getPageCount(),e),e.preventDefault();break;case"pageDown":this.pageDownSelection(this.activeIndex+this.getPageCount(),e),e.preventDefault();break;case"home":case"end":this.updateHomeEndAction(e);break;case"space":"dropdownlist"===this.getModuleName()&&(this.beforePopupOpen||this.showPopup());break;case"open":this.showPopup();break;case"hide":this.preventAltUp=this.isPopupOpen,this.hidePopup(e),this.focusDropDown(e);break;case"enter":this.selectCurrentItem(e);break;case"tab":this.selectCurrentValueOnTab(e);break;case"escape":case"close":this.isPopupOpen&&(this.hidePopup(e),this.focusDropDown(e))}}}},s.prototype.updateUpDownAction=function(e){if(this.isServerBlazor&&t.isNullOrUndefined(this.list))this.isServerNavigation=!0,this.interopAdaptor.invokeMethodAsync("OnServerRenderList",!0,!1);else{this.isServerNavigation=!1;var i=this.list.querySelector("."+V.focus);if(this.isSelectFocusItem(i))this.setSelection(i,e);else{var s="down"===e.action?this.activeIndex+1:this.activeIndex-1,l=0;"autocomplete"===this.getModuleName()&&(l="down"===e.action&&t.isNullOrUndefined(this.activeIndex)?0:this.liCollections.length-1,s=s<0?this.liCollections.length-1:s===this.liCollections.length?0:s);var o=t.isNullOrUndefined(this.activeIndex)?this.liCollections[l]:this.liCollections[s];t.isNullOrUndefined(o)||this.setSelection(o,e)}e.preventDefault()}},s.prototype.updateHomeEndAction=function(e){if("dropdownlist"===this.getModuleName())if(this.isServerBlazor&&t.isNullOrUndefined(this.list))this.isServerNavigation=!0,this.interopAdaptor.invokeMethodAsync("OnServerRenderList",!0,!1);else{this.isServerNavigation=!1;var i=0;if(i="home"===e.action?0:this.getItems().length-1,e.preventDefault(),this.activeIndex===i)return;this.setSelection(this.liCollections[i],e)}},s.prototype.selectCurrentValueOnTab=function(e){"autocomplete"===this.getModuleName()?this.selectCurrentItem(e):this.isPopupOpen&&(this.hidePopup(e),this.focusDropDown(e))},s.prototype.mobileKeyActionHandler=function(e){if(this.enabled&&(!this.isEditTextBox()||this.isPopupOpen)&&!this.readonly){if(void 0!==this.list||this.isRequested||(this.searchKeyEvent=e,this.renderList()),t.isNullOrUndefined(this.list)||!t.isNullOrUndefined(this.liCollections)&&0===this.liCollections.length||this.isRequested)return;"enter"===e.action&&this.selectCurrentItem(e)}},s.prototype.selectCurrentItem=function(e){if(this.isPopupOpen){var t=this.list.querySelector("."+V.focus);t&&(this.setSelection(t,e),this.isTyped=!1),this.isSelected&&(this.isSelectCustom=!1,this.onChangeEvent(e)),this.hidePopup(),this.focusDropDown(e)}else this.showPopup()},s.prototype.isSelectFocusItem=function(e){return!t.isNullOrUndefined(e)},s.prototype.getPageCount=function(){var e=this.list.classList.contains(B.noData)?null:getComputedStyle(this.getItems()[0],null).getPropertyValue("height");return Math.round(this.list.getBoundingClientRect().height/parseInt(e,10))},s.prototype.pageUpSelection=function(e,t){var i=e>=0?this.liCollections[e+1]:this.liCollections[0];this.setSelection(i,t)},s.prototype.pageDownSelection=function(e,t){var i=this.getItems(),s=e<=i.length?this.liCollections[e-1]:this.liCollections[i.length-1];this.setSelection(s,t)},s.prototype.unWireEvent=function(){t.EventHandler.remove(this.inputWrapper.container,"mousedown",this.dropDownClick),t.EventHandler.remove(this.inputWrapper.container,"keypress",this.onSearch),t.EventHandler.remove(this.inputWrapper.container,"focus",this.