{"size": 6990, "ext": "js", "max_stars_repo_path": "assets/sap/ui/mdc/ActionToolbar.js", "max_stars_repo_name": "jekyll-openui5/jekyll-openui5", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "assets/sap/ui/mdc/ActionToolbar.js", "max_issues_repo_name": "jekyll-openui5/jekyll-openui5", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "assets/sap/ui/mdc/ActionToolbar.js", "max_forks_repo_name": "jekyll-openui5/jekyll-openui5", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 998.5714285714, "max_line_length": 6837, "alphanum_fraction": 0.7948497854}
/*
 * ! OpenUI5
 * (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
 * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
 */
sap.ui.define(["sap/m/OverflowToolbar","sap/m/OverflowToolbarRenderer","sap/m/OverflowToolbarPriority","sap/m/ToolbarSpacer","sap/m/ToolbarSeparator","sap/ui/mdc/enum/ActionToolbarActionAlignment","sap/ui/mdc/p13n/subcontroller/ActionToolbarController","sap/ui/mdc/p13n/Engine"],function(O,a,b,T,c,A,d,E){"use strict";var e=O.extend("sap.ui.mdc.ActionToolbar",{metadata:{library:"sap.ui.mdc",designtime:"sap/ui/mdc/designtime/actiontoolbar/ActionToolbar.designtime",defaultAggregation:"actions",properties:{useAsHeader:{type:"boolean",group:"Behavior",defaultValue:true}},aggregations:{begin:{type:"sap.ui.core.Control",multiple:true},between:{type:"sap.ui.core.Control",multiple:true},actions:{type:"sap.ui.mdc.actiontoolbar.ActionToolbarAction",multiple:true},end:{type:"sap.ui.core.Control",multiple:true}}},renderer:a});var f=["begin","between","actions","end"];var g=function(){var C={canOverflow:true,getCustomImportance:function(){return b.NeverOverflow;}};return C;};e.prototype.init=function(){O.prototype.init.apply(this,arguments);this._oBeginSeparator=new c({visible:false});this._oBeginSeparator.getOverflowToolbarConfig=g;this._oEndActionsBeginSeparator=new c({visible:false});this._oEndActionsBeginSeparator.getOverflowToolbarConfig=g;this._oEndActionsEndSeparator=new c({visible:false});this._oEndActionsEndSeparator.getOverflowToolbarConfig=g;this._oSpacer=new T();this.setUseAsHeader(true);E.getInstance().registerAdaptation(this,{controller:{actionsKey:d}});};e.prototype.exit=function(){O.prototype.exit.apply(this,arguments);if(this._oBeginSeparator){this._oBeginSeparator.destroy();}if(this._oEndActionsBeginSeparator){this._oEndActionsBeginSeparator.destroy();}if(this._oEndActionsEndSeparator){this._oEndActionsEndSeparator.destroy();}if(this._oSpacer){this._oSpacer.destroy();}};e.prototype.addAggregation=function(s,C){if(s==="content"){throw new Error("Mutator functions of the content aggregation of the ActionToolbar '"+this.getId()+"' must not be used.");}var h=arguments;if(f.includes(s)){this._registerControlListener(C);this._resetAndInvalidateToolbar(false);if(C){this._moveControlInSuitableCollection(C,this._getControlPriority(C));}this._informNewFlexibleContentAdded(C);var v=this._callToolbarMethod("addAggregation",h);this._updateSeparators();return v;}return O.prototype.addAggregation.apply(this,arguments);};e.prototype.destroyAggregation=function(s){if(s==="content"){throw new Error("Mutator functions of the content aggregation of the ActionToolbar '"+this.getId()+"' must not be used.");}if(f.includes(s)){var C=this.removeAllAggregation(s);for(var i=0;i<C.length;i++){C[i].destroy();}this._updateSeparators();return this;}return O.prototype.destroyAggregation.apply(this,arguments);};e.prototype.insertAggregation=function(s,C,i){if(s==="content"){throw new Error("Mutator functions of the content aggregation of the ActionToolbar '"+this.getId()+"' must not be used.");}if(f.includes(s)){this._registerControlListener(C);this._resetAndInvalidateToolbar(false);if(C){this._moveControlInSuitableCollection(C,this._getControlPriority(C));}this._informNewFlexibleContentAdded(C);var v=this._callToolbarMethod("insertAggregation",arguments);this._updateSeparators();return v;}return O.prototype.insertAggregation.apply(this,arguments);};e.prototype.removeAllAggregation=function(s){if(s==="content"){throw new Error("Mutator functions of the content aggregation of the ActionToolbar '"+this.getId()+"' must not be used.");}return O.prototype.removeAllAggregation.apply(this,arguments);};e.prototype.removeAggregation=function(s,o){if(s==="content"){throw new Error("Mutator functions of the content aggregation of the ActionToolbar '"+this.getId()+"' must not be used.");}if(f.includes(s)){var C=this._callToolbarMethod("removeAggregation",arguments);if(C){this._getPopover().removeAssociatedContent(C.getId());}this._resetAndInvalidateToolbar(false);this._deregisterControlListener(C);this._removeContentFromControlsCollections(C);this._updateSeparators();return C;}return O.prototype.removeAggregation.apply(this,arguments);};e.prototype.setUseAsHeader=function(h){this.setProperty("useAsHeader",h,true);this.toggleStyleClass("sapMTBHeader-CTX",!!h);return this;};e.prototype.getEndActionsBegin=function(){return this.getActionsWithLayoutInformation({aggregationName:"end",alignment:A.Begin});};e.prototype.getEndActionsEnd=function(){return this.getActionsWithLayoutInformation({aggregationName:"end",alignment:A.End});};e.prototype.getActionsWithLayoutInformation=function(l){return this.getActions().filter(function(o){var h=o.getLayoutInformation();return h.aggregationName===l.aggregationName&&h.alignment===l.alignment;});};e.prototype.onAfterRendering=function(){O.prototype.onAfterRendering.apply(this,arguments);this._updateSeparators();};e.prototype._onContentPropertyChangedOverflowToolbar=function(o){if(this._bIsBeingDestroyed){return;}O.prototype._onContentPropertyChangedOverflowToolbar.apply(this,arguments);if(o.getParameter("name")==="visible"||o.getParameter("name")==="width"&&o.getSource()!=this._oBeginSeparator){this._updateSeparators();}};e.prototype._hasVisible=function(h){var p=this.getAggregation("_popover")?this.getAggregation("_popover")._getAllContent():[];var v=h.filter(function(C){return p.indexOf(C)===-1;});return v.some(function(C){var H=C.getWidth?C.getWidth()!=="0px":true;return C.getVisible()&&H;});};e.prototype._updateSeparators=function(){var h=this._hasVisible(this.getEnd());if(this._oBeginSeparator){var H=this._hasVisible(this.getBegin());var i=this._hasVisible(this.getBetween());this._oBeginSeparator.setVisible(H&&i);}if(this._oEndActionsBeginSeparator){var j=this._hasVisible(this.getEndActionsBegin());this._oEndActionsBeginSeparator.setVisible(h&&j);}if(this._oEndActionsEndSeparator){var k=this._hasVisible(this.getEndActionsEnd());this._oEndActionsEndSeparator.setVisible(h&&k);}};e.prototype.indexOfContent=function(o){return this.getContent().indexOf(o);};e.prototype.getContent=function(){var C=this.getBegin();C.push(this._oBeginSeparator);C=C.concat(this.getBetween());C.push(this._oSpacer);C=C.concat(this.getEndActionsBegin());C.push(this._oEndActionsBeginSeparator);C=C.concat(this.getEnd());C.push(this._oEndActionsEndSeparator);C=C.concat(this.getEndActionsEnd());return C;};e.prototype.getCurrentState=function(){var h=[],i;this.getActions().forEach(function(o,I){i=o&&o.getId();if(o.getVisible()){h.push({name:i,alignment:o.getLayoutInformation().alignment});}});return{items:h};};e.prototype.initPropertyHelper=function(){return Promise.resolve({getProperties:function(){var i=[];this.getActions().forEach(function(o){i.push({name:o.getId(),alignment:o.getLayoutInformation().alignment,getName:function(){return o.getId();},getLabel:function(){return o.getLabel();},visible:true});});return i;}.bind(this)});};return e;});
