/*! * UI development toolkit for HTML5 (OpenUI5) * (c) Copyright 2009-2018 SAP SE or an SAP affiliate company. * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. */ sap.ui.define(['./Dialog','./ComboBoxTextField','./Toolbar','./Button','./Bar','./Text','./Title','sap/ui/core/InvisibleText','sap/ui/core/IconPool','sap/ui/core/ValueStateSupport','sap/base/Log','./library','sap/ui/Device','sap/ui/core/library','./ComboBoxBaseRenderer',"sap/ui/dom/containsOrEquals","sap/ui/events/KeyCodes","sap/ui/thirdparty/jquery","sap/base/security/encodeXML","sap/base/strings/escapeRegExp"],function(D,C,T,B,a,b,c,I,d,V,L,l,e,f,g,h,K,q,j,k){"use strict";var P=l.PlacementType;var m=f.ValueState;var n=C.extend("sap.m.ComboBoxBase",{metadata:{library:"sap.m","abstract":true,defaultAggregation:"items",properties:{showSecondaryValues:{type:"boolean",group:"Misc",defaultValue:false}},aggregations:{items:{type:"sap.ui.core.Item",multiple:true,singularName:"item",bindable:"bindable"},picker:{type:"sap.ui.core.PopupInterface",multiple:false,visibility:"hidden"}},events:{loadItems:{}}}});n.DEFAULT_TEXT_FILTER=function(i,o,p){var s,r,M;if(!o[p]){return false;}s=o[p]().toLowerCase();r=i.toLowerCase();M=new RegExp('(^|\\s)'+k(r)+".*",'g');return M.test(s);};n.prototype.oncompositionstart=function(){this._bIsComposingCharacter=true;};n.prototype.oncompositionend=function(E){this._bIsComposingCharacter=false;this._sComposition=E.target.value;if(!e.browser.edge&&!e.browser.firefox){C.prototype.handleInput.apply(this,arguments);this.handleInputValidation(E,this.isComposingCharacter());}};n.prototype.isComposingCharacter=function(){return this._bIsComposingCharacter;};n.prototype.updateItems=function(r){this.bItemsUpdated=false;this.destroyItems();this.updateAggregation("items");this.bItemsUpdated=true;if(this.hasLoadItemsEventListeners()){this.onItemsLoaded();}};n.prototype.setFilterFunction=function(F){if(F===null||F===undefined){this.fnFilter=null;return this;}if(typeof(F)!=="function"){L.warning("Passed filter is not a function and the default implementation will be used");}else{this.fnFilter=F;}return this;};n.prototype.highLightList=function(v,i){var o=v.length,v=v.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,'\\$&'),r=new RegExp("\\b"+v,"gi"),$;i.forEach(function(p){$=q(p.ref);$.html(this._boldItemRef.call(this,p.text,r,o));},this);};n.prototype._boldItemRef=function(i,r,o){r.lastIndex=0;var R,p=r.exec(i);if(p===null){return j(i);}var M=p.index;var t=""+j(i.slice(M,M+o))+"";var s=i.split(r);if(s.length===1){R=j(i);}else{R=s.map(function(u){return j(u);}).join(t);}return R;};n.prototype.refreshItems=function(){this.bItemsUpdated=false;this.refreshAggregation("items");};n.prototype.loadItems=function(i,o){var p=typeof i==="function";if(this.hasLoadItemsEventListeners()&&(this.getItems().length===0)){this._bOnItemsLoadedScheduled=false;if(p){o=q.extend({action:i,busyIndicator:true,busyIndicatorDelay:300},o);this.aMessageQueue.push(o);if((this.iLoadItemsEventInitialProcessingTimeoutID===-1)&&(o.busyIndicator)){this.iLoadItemsEventInitialProcessingTimeoutID=setTimeout(function onItemsNotLoadedAfterDelay(){this.setInternalBusyIndicatorDelay(0);this.setInternalBusyIndicator(true);}.bind(this),o.busyIndicatorDelay);}}if(!this.bProcessingLoadItemsEvent){this.bProcessingLoadItemsEvent=true;this.fireLoadItems();}}else if(p){i.call(this);}};n.prototype.onItemsLoaded=function(){this.bProcessingLoadItemsEvent=false;clearTimeout(this.iLoadItemsEventInitialProcessingTimeoutID);if(this.bInitialBusyIndicatorState!==this.getBusy()){this.setInternalBusyIndicator(this.bInitialBusyIndicatorState);}if(this.iInitialBusyIndicatorDelay!==this.getBusyIndicatorDelay()){this.setInternalBusyIndicatorDelay(this.iInitialBusyIndicatorDelay);}for(var i=0,o,N,p;i0;};n.prototype.findFirstEnabledItem=function(i){var o=this.getList();return o?o.findFirstEnabledItem(i):null;};n.prototype.findLastEnabledItem=function(i){var o=this.getList();return o?o.findLastEnabledItem(i):null;};n.prototype.open=function(){var p=this.getPicker();if(p){p.open();}return this;};n.prototype.getVisibleItems=function(){var o=this.getList();return o?o.getVisibleItems():[];};n.prototype.isItemSelected=function(){};n.prototype.getKeys=function(o){o=o||this.getItems();for(var i=0,p=[];it){o.scrollTop=t;}else if((t+v)>(s+u)){o.scrollTop=Math.ceil(t+v-u);}};n.prototype.clearFilter=function(){for(var i=0,o=this.getItems();i