This commit is contained in:
Achim D. Brucker 2015-05-13 22:34:52 +02:00
parent ad9d6a25bb
commit 186cd5b532
1461 changed files with 408715 additions and 0 deletions

View File

@ -0,0 +1,15 @@
{ "aBuildFiles" : [ "library" ],
"aFiles" : [ "library" ],
"oExtends" : "Base",
"sBaseFileId" : "library",
"sBaseLibraryId" : "sap/ui/core",
"sBaseThemeId" : "base",
"sEntity" : "Framework",
"sId" : "UI5",
"sLabel" : "SAP Development Toolkit for HTML5",
"sRuntimePathPattern" : "/%frameworkId%/%libId%/themes/%themeId%/%fileId%.css",
"sRuntimeResourcePathPattern" : "%../%%frameworkId%/%libId%/themes/%themeId%",
"sSourcePathPattern" : "/%frameworkId%/%libId%/themes/%themeId%/%fileId%.less",
"sVendor" : "SAP",
"sCompiler" : "Less"
}

View File

@ -0,0 +1,184 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides functionality for activity detection
sap.ui.define(['jquery.sap.global'],
function(jQuery) {
"use strict";
if (typeof window.jQuery.sap.act === "object" || typeof window.jQuery.sap.act === "function" ) {
return;
}
// Date.now = Date.now || function() {
// return new Date().getTime();
// };
/**
* @public
* @name jQuery.sap.act
* @namespace
* @static
*/
var _act = {},
_active = true,
_deactivatetimer = null,
_I_MAX_IDLE_TIME = 10000, //max. idle time in ms
_deactivateSupported = !!window.addEventListener, //Just skip IE8
_aActivateListeners = [],
_activityDetected = false,
_domChangeObserver = null;
function _onDeactivate(){
_deactivatetimer = null;
if (_activityDetected) {
_onActivate();
return;
}
_active = false;
//_triggerEvent(_aDeactivateListeners); //Maybe provide later
_domChangeObserver.observe(document.documentElement, {childList: true, attributes: true, subtree: true, characterData: true});
}
function _onActivate(){
// Never activate when document is not visible to the user
if (document.hidden === true) {
// In case of IE<10 document.visible is undefined, else it is either true or false
return;
}
if (!_active) {
_active = true;
_triggerEvent(_aActivateListeners);
_domChangeObserver.disconnect();
}
if (_deactivatetimer) {
_activityDetected = true;
} else {
_deactivatetimer = setTimeout(_onDeactivate, _I_MAX_IDLE_TIME);
_activityDetected = false;
}
}
function _triggerEvent(aListeners){
if (aListeners.length == 0) {
return;
}
var aEventListeners = aListeners.slice();
setTimeout(function(){
var oInfo;
for (var i = 0, iL = aEventListeners.length; i < iL; i++) {
oInfo = aEventListeners[i];
oInfo.fFunction.call(oInfo.oListener || window);
}
}, 0);
}
/**
* Registers the given handler to the activity event, which is fired when an activity was detected after a certain period of inactivity.
*
* The Event is not fired for Internet Explorer 8.
*
* @param {Function} fnFunction The function to call, when an activity event occurs.
* @param {Object} [oListener] The 'this' context of the handler function.
* @protected
*
* @function
* @name jQuery.sap.act#attachActivate
*/
_act.attachActivate = function(fnFunction, oListener){
_aActivateListeners.push({oListener: oListener, fFunction:fnFunction});
};
/**
* Deregisters a previously registered handler from the activity event.
*
* @param {Function} fnFunction The function to call, when an activity event occurs.
* @param {Object} [oListener] The 'this' context of the handler function.
* @protected
*
* @function
* @name jQuery.sap.act#detachActivate
*/
_act.detachActivate = function(fnFunction, oListener){
for (var i = 0, iL = _aActivateListeners.length; i < iL; i++) {
if (_aActivateListeners[i].fFunction === fnFunction && _aActivateListeners[i].oListener === oListener) {
_aActivateListeners.splice(i,1);
break;
}
}
};
/**
* Checks whether recently an activity was detected.
*
* Not supported for Internet Explorer 8.
*
* @return true if recently an activity was detected, false otherwise
* @protected
*
* @function
* @name jQuery.sap.act#isActive
*/
_act.isActive = !_deactivateSupported ? function(){ return true; } : function(){ return _active; };
/**
* Reports an activity.
*
* @public
*
* @function
* @name jQuery.sap.act#refresh
*/
_act.refresh = !_deactivateSupported ? function(){} : _onActivate;
// Setup and registering handlers
if (_deactivateSupported) {
var aEvents = ["resize", "orientationchange", "mousemove", "mousedown", "mouseup", //"mouseout", "mouseover",
"touchstart", "touchmove", "touchend", "touchcancel", "paste", "cut", "keydown", "keyup",
"DOMMouseScroll", "mousewheel"];
for (var i = 0; i < aEvents.length; i++) {
window.addEventListener(aEvents[i], _act.refresh, true);
}
if (window.MutationObserver) {
_domChangeObserver = new window.MutationObserver(_act.refresh);
} else if (window.WebKitMutationObserver) {
_domChangeObserver = new window.WebKitMutationObserver(_act.refresh);
} else {
_domChangeObserver = {
observe : function(){
document.documentElement.addEventListener("DOMSubtreeModified", _act.refresh);
},
disconnect : function(){
document.documentElement.removeEventListener("DOMSubtreeModified", _act.refresh);
}
};
}
if (typeof (document.hidden) === "boolean") {
document.addEventListener("visibilitychange", function() {
// Only trigger refresh if document has changed to visible
if (document.hidden !== true) {
_act.refresh();
}
}, false);
}
_onActivate();
}
jQuery.sap.act = _act;
return jQuery;
}, /* bExport= */ false);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global'],function(q){"use strict";if(typeof window.jQuery.sap.act==="object"||typeof window.jQuery.sap.act==="function"){return;}var _={},a=true,b=null,c=10000,d=!!window.addEventListener,e=[],f=false,g=null;function h(){b=null;if(f){j();return;}a=false;g.observe(document.documentElement,{childList:true,attributes:true,subtree:true,characterData:true});}function j(){if(document.hidden===true){return;}if(!a){a=true;k(e);g.disconnect();}if(b){f=true;}else{b=setTimeout(h,c);f=false;}}function k(l){if(l.length==0){return;}var m=l.slice();setTimeout(function(){var I;for(var i=0,L=m.length;i<L;i++){I=m[i];I.fFunction.call(I.oListener||window);}},0);}_.attachActivate=function(F,l){e.push({oListener:l,fFunction:F});};_.detachActivate=function(F,l){for(var i=0,L=e.length;i<L;i++){if(e[i].fFunction===F&&e[i].oListener===l){e.splice(i,1);break;}}};_.isActive=!d?function(){return true;}:function(){return a;};_.refresh=!d?function(){}:j;if(d){var E=["resize","orientationchange","mousemove","mousedown","mouseup","touchstart","touchmove","touchend","touchcancel","paste","cut","keydown","keyup","DOMMouseScroll","mousewheel"];for(var i=0;i<E.length;i++){window.addEventListener(E[i],_.refresh,true);}if(window.MutationObserver){g=new window.MutationObserver(_.refresh);}else if(window.WebKitMutationObserver){g=new window.WebKitMutationObserver(_.refresh);}else{g={observe:function(){document.documentElement.addEventListener("DOMSubtreeModified",_.refresh);},disconnect:function(){document.documentElement.removeEventListener("DOMSubtreeModified",_.refresh);}};}if(typeof(document.hidden)==="boolean"){document.addEventListener("visibilitychange",function(){if(document.hidden!==true){_.refresh();}},false);}j();}q.sap.act=_;return q;},false);

View File

@ -0,0 +1,727 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', 'jquery.sap.strings'],
function(jQuery/* , jQuerySap1 */) {
"use strict";
(function($, window){ // TODO remove inner scope function, rename jQuery to $
//suffix of virtual hash
var skipSuffix = "_skip",
//the regular expression for matching the unique id in the hash
rIdRegex = /\|id-[0-9]+-[0-9]+/,
//the regular expression for matching the suffix in the hash
skipRegex = new RegExp(skipSuffix + "[0-9]*$"),
//array of routes
routes = [],
//array represents the current history stack
hashHistory = [],
//mark if the change of the hash is from the code or from pressing the back or forward button
mSkipHandler = {},
//index of the skip suffix
skipIndex = 0,
//the current hash of the history handling
currentHash,
//the hash format separator
sIdSeperator = "|",
//array that buffers the changed to the hash in order to make them handled one by one
aHashChangeBuffer = [],
//marker if the handling hash change is in processing
bInProcessing = false,
//default handler which will be called when url contains an empty hash
defaultHandler,
//avoid calling the history initialization twice
bInitialized = false;
/**
* jQuery.sap.history is deprecated. Please use {@link sap.ui.core.routing.Route} instead.
*
* Initialize the history handling and set the routes and default handler.
* This should be only called once with the mSettings set in the right format. If the mSettings is not an object,
* you have another chance to call this function again to initialize the history handling. But once the mSettings
* is set with an object, you can only call the addRoute and setDefaultHandler to set the data.
*
* @deprecated since 1.19.1. Please use {@link sap.ui.core.routing.Route} instead.
* @param {object} mSettings The map that contains data in format:
* <pre>
* {
* routes: [{
* path: string //identifier for one kind of hash
* handler: function //function what will be called when the changed hash is matched against the path.
* //first parameter: the json data passed in when calling the addHistory
* //second parameter: the type of the navigation {@link jQuery.sap.history.NavType}
* }],
* defaultHandler: function //this function will be called when empty hash is matched
* //first parameter: the type of the navigation {@link jQuery.sap.history.NavType}
* }
* </pre>
* @public
* @name jQuery.sap.history
* @class Enables the back and forward buttons in browser to navigate back or forth through the browser history stack.<br/><br/>
*
* It also supports adding virtual history which used only to mark some intermediate state in order to navigate back to the previous state.
* And this state will be skipped from the browser history stack immediately after a new history state is added to the history stack after this state <br/><br/>
*
* By providing the hash saved from the return value of calling jQuery.sap.history.addHistory, jQuery.sap.history.backToHash will navigate back directly to the
* history state with the same hash. <br/><br/>
*
* Please use jQuery.sap.history.back() to go one step back in the history stack instead of using window.history.back(), because it handles the empty history stack
* situation and will call the defaultHandler for this case. <br/><br/>
*
*
* Example for the usage of history handling:
* <pre>
* //Initialization
* jQuery.sap.history({
* routes: [], //please refer to the jQuery.sap.history function comment for the format.
* defaultHandler: function(){
* //code here
* }
* });
*
* //add history
* var hash = jQuery.sap.history.addHistory("IDENTIFIER", jsonData);
*
* //add virtual history
* jQuery.sap.history.addVirtualHistory();
*
* //back to hash
* jQuery.sap.history.backToHash(hash);
*
* //back one step along the history stack
* jQuery.sap.history.back();
* </pre>
*
*/
$.sap.history = function(mSettings){
//if mSetting is not a object map, return
if (!jQuery.isPlainObject(mSettings)) {
return;
}
if (!bInitialized) {
var jWindowDom = $(window),
//using href instead of hash to avoid the escape problem in firefox
sHash = (window.location.href.split("#")[1] || "");
jWindowDom.bind('hashchange', detectHashChange);
if ($.isArray(mSettings.routes)) {
var i, route;
for (i = 0 ; i < mSettings.routes.length ; i++) {
route = mSettings.routes[i];
if (route.path && route.handler) {
$.sap.history.addRoute(route.path, route.handler);
}
}
}
if (jQuery.isFunction(mSettings.defaultHandler)) {
defaultHandler = mSettings.defaultHandler;
}
//push the current hash to the history stack
hashHistory.push(sHash);
//goes in from bookmark
if (sHash.length > 1) {
jWindowDom.trigger("hashchange", [true]);
} else {
currentHash = sHash;
}
bInitialized = true;
}
};
/**
* This function adds a history record. It will not trigger the related handler of the routes, the changes have to be done by the
* developer. Normally, a history record should be added when changes are done already.
*
* @param {string} sIdf The identifier defined in the routes which will be matched in order to call the corresponding handler
* @param {object} oStateData The object passed to the corresponding handler when the identifier is matched with the url hash
* @param {boolean} bBookmarkable Default value is set to true. If this is set to false, the default handler will be called when this identifier and data are matched
* @param {boolean} [bVirtual] This states if the history is a virtual history that should be skipped when going forward or backward in the history stack.
* @returns {string} sHash The complete hash string which contains the identifier, stringified data, optional uid, and bookmarkable digit. This hash can be passed into
* the backToHash function when navigating back to this state is intended.
*
* @function
* @public
* @name jQuery.sap.history#addHistory
*/
$.sap.history.addHistory = function(sIdf, oStateData, bBookmarkable, bVirtual){
var uid, sHash;
if (bBookmarkable === undefined) {
bBookmarkable = true;
}
if (!bVirtual) {
sHash = preGenHash(sIdf, oStateData);
uid = getAppendId(sHash);
if (uid) {
sHash += (sIdSeperator + uid);
}
sHash += (sIdSeperator + (bBookmarkable ? "1" : "0"));
} else {
sHash = getNextSuffix(currentHash);
}
aHashChangeBuffer.push(sHash);
mSkipHandler[sHash] = true;
window.location.hash = sHash;
return sHash;
};
/**
* This function adds a virtual history record based on the current hash. A virtual record is only for marking the current state of the application,
* and when the back button clicked it will return to the previous state. It is used when the marked state shouldn't be seen by the user when user click
* the back or forward button of the browser. For example, when showing a context menu a virtual history record should be added and this record will be skipped
* when user navigates back and it will return directly to the previous history record. If you avoid adding the virtual history record, it will return to one
* history record before the one your virtual record is based on. That's why virtual record is necessary.
*
* @function
* @public
* @name jQuery.sap.history#addVirtualHistory
*/
$.sap.history.addVirtualHistory = function(){
$.sap.history.addHistory("", undefined, false, true);
};
/**
* Adds a route to the history handling.
*
* @param {string} sIdf The identifier that is matched with the hash in the url in order to call the corresponding handler.
* @param {function} fn The function that will be called when the identifier is matched with the hash.
* @param {object} [oThis] If oThis is provided, the fn function's this keyword will be bound to this object.
*
* @returns {object} It returns the this object to enable chaining.
*
* @function
* @public
* @name jQuery.sap.history#addRoute
*/
$.sap.history.addRoute = function(sIdf, fn, oThis){
if (oThis) {
fn = jQuery.proxy(fn, oThis);
}
var oRoute = {};
oRoute.sIdentifier = sIdf;
oRoute['action'] = fn;
routes.push(oRoute);
return this;
};
/**
* Set the default handler which will be called when there's an empty hash in the url.
*
* @param {function} fn The function that will be set as the default handler
* @public
*
* @function
* @name jQuery.sap.history#setDefaultHandler
*/
$.sap.history.setDefaultHandler = function(fn){
defaultHandler = fn;
};
$.sap.history.getDefaultHandler = function(){
return defaultHandler;
};
/**
* This function calculate the number of back steps to the specific sHash passed as parameter,
* and then go back to the history state with this hash.
*
* @param {string} sHash The hash string needs to be navigated. This is normally returned when you call the addhistory method.
* @public
*
* @function
* @name jQuery.sap.history#backToHash
*/
$.sap.history.backToHash = function(sHash){
sHash = sHash || "";
var iSteps;
//back is called directly after restoring the bookmark. Since there's no history stored, call the default handler.
if (hashHistory.length === 1) {
if ($.isFunction(defaultHandler)) {
defaultHandler();
}
} else {
iSteps = calculateStepsToHash(currentHash, sHash);
if (iSteps < 0) {
window.history.go(iSteps);
} else {
jQuery.sap.log.error("jQuery.sap.history.backToHash: " + sHash + "is not in the history stack or it's after the current hash");
}
}
};
/**
* This function will navigate back to the recent history state which has the sPath identifier. It is usually used to navigate back along one
* specific route and jump over the intermediate history state if there are any.
*
* @param {string} sPath The route identifier to which the history navigates back.
* @public
*
* @function
* @name jQuery.sap.history#backThroughPath
*/
$.sap.history.backThroughPath = function(sPath){
sPath = sPath || "";
sPath = window.encodeURIComponent(sPath);
var iSteps;
//back is called directly after restoring the bookmark. Since there's no history stored, call the default handler.
if (hashHistory.length === 1) {
if ($.isFunction(defaultHandler)) {
defaultHandler();
}
} else {
iSteps = calculateStepsToHash(currentHash, sPath, true);
if (iSteps < 0) {
window.history.go(iSteps);
} else {
jQuery.sap.log.error("jQuery.sap.history.backThroughPath: there's no history state which has the " + sPath + " identifier in the history stack before the current hash");
}
}
};
/**
* This function navigates back through the history stack. The number of steps is set by the parameter iSteps. It also handles the situation when it's called while there's nothing in the history stack.
* Normally this happens when the application is restored from the bookmark. If there's nothing in the history stack, the default handler will be called with NavType jQuery.sap.history.NavType.Back.
*
* @param {int} [iSteps] how many steps you want to go back, by default the value is 1.
* @public
*
* @function
* @name jQuery.sap.history#back
*/
$.sap.history.back = function(iSteps){
//back is called directly after restoring the bookmark. Since there's no history stored, call the default handler.
if (hashHistory.length === 1) {
if ($.isFunction(defaultHandler)) {
defaultHandler($.sap.history.NavType.Back);
}
} else {
if (!iSteps) {
iSteps = 1;
}
window.history.go(-1 * iSteps);
}
};
/**
* @public
* @name jQuery.sap.history.NavType
* @namespace
* @static
*/
$.sap.history.NavType = {};
/**
* This indicates that the new hash is achieved by pressing the back button.
* @type {string}
* @public
* @constant
* @name jQuery.sap.history.NavType.Back
*/
$.sap.history.NavType.Back = "_back";
/**
* This indicates that the new hash is achieved by pressing the forward button.
* @type {string}
* @public
* @constant
* @name jQuery.sap.history.NavType.Forward
*/
$.sap.history.NavType.Forward = "_forward";
/**
* This indicates that the new hash is restored from the bookmark.
* @type {string}
* @public
* @constant
* @name jQuery.sap.history.NavType.Bookmark
*/
$.sap.history.NavType.Bookmark = "_bookmark";
/**
* This indicates that the new hash is achieved by some unknown direction.
* This happens when the user navigates out of the application and then click on the forward button
* in the browser to navigate back to the application.
* @type {string}
* @public
* @constant
* @name jQuery.sap.history.NavType.Unknown
*/
$.sap.history.NavType.Unknown = "_unknown";
/**
* This function calculates the number of steps from the sCurrentHash to sToHash. If the sCurrentHash or the sToHash is not in the history stack, it returns 0.
*
* @private
*/
function calculateStepsToHash(sCurrentHash, sToHash, bPrefix){
var iCurrentIndex = $.inArray(sCurrentHash, hashHistory),
iToIndex,
i,
tempHash;
if (iCurrentIndex > 0) {
if (bPrefix) {
for (i = iCurrentIndex - 1; i >= 0 ; i--) {
tempHash = hashHistory[i];
if (tempHash.indexOf(sToHash) === 0 && !isVirtualHash(tempHash)) {
return i - iCurrentIndex;
}
}
} else {
iToIndex = $.inArray(sToHash, hashHistory);
//When back to home is needed, and application is started with nonempty hash but it's nonbookmarkable
if ((iToIndex === -1) && sToHash.length === 0) {
return -1 * iCurrentIndex;
}
if ((iToIndex > -1) && (iToIndex < iCurrentIndex)) {
return iToIndex - iCurrentIndex;
}
}
}
return 0;
}
/**
* This function is bound to the window's hashchange event, and it detects the change of the hash.
* When history is added by calling the addHistory or addVirtualHistory function, it will not call the real onHashChange function
* because changes are already done. Only when a hash is navigated by clicking the back or forward buttons in the browser,
* the onHashChange will be called.
*
* @private
*/
function detectHashChange(oEvent, bManual){
//Firefox will decode the hash when it's set to the window.location.hash,
//so we need to parse the href instead of reading the window.location.hash
var sHash = (window.location.href.split("#")[1] || "");
sHash = formatHash(sHash);
if (bManual || !mSkipHandler[sHash]) {
aHashChangeBuffer.push(sHash);
}
if (!bInProcessing) {
bInProcessing = true;
if (aHashChangeBuffer.length > 0) {
var newHash = aHashChangeBuffer.shift();
if (mSkipHandler[newHash]) {
reorganizeHistoryArray(newHash);
delete mSkipHandler[newHash];
} else {
onHashChange(newHash);
}
currentHash = newHash;
}
bInProcessing = false;
}
}
/**
* This function removes the leading # sign if there's any. If the bRemoveId is set to true, it will also remove the unique
* id inside the hash.
*
* @private
*/
function formatHash(hash, bRemoveId){
var sRes = hash, iSharpIndex = hash ? hash.indexOf("#") : -1;
if (iSharpIndex === 0) {
sRes = sRes.slice(iSharpIndex + 1);
}
if (bRemoveId) {
sRes = sRes.replace(rIdRegex, "");
}
return sRes;
}
/**
* This function returns a hash with suffix added to the end based on the sHash parameter. It handles as well when the current
* hash is already with suffix. It returns a new suffix with an unique number in the end.
*
* @private
*/
function getNextSuffix(sHash){
var sPath = sHash ? sHash : "";
if (isVirtualHash(sPath)) {
var iIndex = sPath.lastIndexOf(skipSuffix);
sPath = sPath.slice(0, iIndex);
}
return sPath + skipSuffix + skipIndex++;
}
/**
* This function encode the identifier and data into a string.
*
* @private
*/
function preGenHash(sIdf, oStateData){
var sEncodedIdf = window.encodeURIComponent(sIdf);
var sEncodedData = window.encodeURIComponent(window.JSON.stringify(oStateData));
return sEncodedIdf + sIdSeperator + sEncodedData;
}
/**
* This function checks if the combination of the identifier and data is unique in the current history stack.
* If yes, it returns an empty string. Otherwise it returns an unique id.
*
* @private
*/
function getAppendId(sHash){
var iIndex = $.inArray(currentHash, hashHistory),
i, sHistory;
if (iIndex > -1) {
for (i = 0 ; i < iIndex + 1 ; i++) {
sHistory = hashHistory[i];
if (sHistory.slice(0, sHistory.length - 2) === sHash) {
return jQuery.sap.uid();
}
}
}
return "";
}
/**
* This function manages the internal array of history records.
*
* @private
*/
function reorganizeHistoryArray(sHash){
var iIndex = $.inArray(currentHash, hashHistory);
if ( !(iIndex === -1 || iIndex === hashHistory.length - 1) ) {
hashHistory.splice(iIndex + 1, hashHistory.length - 1 - iIndex);
}
hashHistory.push(sHash);
}
/**
* This method judges if a hash is a virtual hash that needs to be skipped.
*
* @private
*/
function isVirtualHash(sHash){
return skipRegex.test(sHash);
}
/**
* This function calculates the steps forward or backward that need to skip the virtual history states.
*
* @private
*/
function calcStepsToRealHistory(sCurrentHash, bForward){
var iIndex = $.inArray(sCurrentHash, hashHistory),
i;
if (iIndex !== -1) {
if (bForward) {
for (i = iIndex ; i < hashHistory.length ; i++) {
if (!isVirtualHash(hashHistory[i])) {
return i - iIndex;
}
}
} else {
for (i = iIndex ; i >= 0 ; i--) {
if (!isVirtualHash(hashHistory[i])) {
return i - iIndex;
}
}
return -1 * (iIndex + 1);
}
}
}
/**
* This is the main function that handles the hash change event.
*
* @private
*/
function onHashChange(sHash){
var oRoute, iStep, oParsedHash, iNewHashIndex, sNavType;
//handle the nonbookmarkable hash
if (currentHash === undefined) {
//url with hash opened from bookmark
oParsedHash = parseHashToObject(sHash);
if (!oParsedHash || !oParsedHash.bBookmarkable) {
if (jQuery.isFunction(defaultHandler)) {
defaultHandler($.sap.history.NavType.Bookmark);
}
return;
}
}
if (sHash.length === 0) {
if (jQuery.isFunction(defaultHandler)) {
defaultHandler($.sap.history.NavType.Back);
}
} else {
//application restored from bookmark with non-empty hash, and later navigates back to the first hash token
//the defaultHandler should be triggered
iNewHashIndex = jQuery.inArray(sHash, hashHistory);
if (iNewHashIndex === 0) {
oParsedHash = parseHashToObject(sHash);
if (!oParsedHash || !oParsedHash.bBookmarkable) {
if (jQuery.isFunction(defaultHandler)) {
defaultHandler($.sap.history.NavType.Back);
}
return;
}
}
//need to handle when iNewHashIndex equals -1.
//This happens when user navigates out the current application, and later navigates back.
//In this case, the hashHistory is an empty array.
if (isVirtualHash(sHash)) {
//this is a virtual history, should do the skipping calculation
if (isVirtualHash(currentHash)) {
//go back to the first one that is not virtual
iStep = calcStepsToRealHistory(sHash, false);
window.history.go(iStep);
} else {
var sameFamilyRegex = new RegExp(jQuery.sap.escapeRegExp(currentHash + skipSuffix) + "[0-9]*$");
if (sameFamilyRegex.test(sHash)) {
//going forward
//search forward in history for the first non-virtual hash
//if there is, change to that one window.history.go
//if not, stay and return false
iStep = calcStepsToRealHistory(sHash, true);
if (iStep) {
window.history.go(iStep);
} else {
window.history.back();
}
} else {
//going backward
//search backward for the first non-virtual hash and there must be one
iStep = calcStepsToRealHistory(sHash, false);
window.history.go(iStep);
}
}
} else {
if (iNewHashIndex === -1) {
sNavType = $.sap.history.NavType.Unknown;
hashHistory.push(sHash);
} else {
if (jQuery.inArray(currentHash, hashHistory, iNewHashIndex + 1) === -1) {
sNavType = $.sap.history.NavType.Forward;
} else {
sNavType = $.sap.history.NavType.Back;
}
}
oParsedHash = parseHashToObject(sHash);
if (oParsedHash) {
oRoute = findRouteByIdentifier(oParsedHash.sIdentifier);
if (oRoute) {
oRoute.action.apply(null, [oParsedHash.oStateData, sNavType]);
}
} else {
jQuery.sap.log.error("hash format error! The current Hash: " + sHash);
}
}
}
}
/**
* This function returns the route object matched by the identifier passed as parameter.
* @private
*/
function findRouteByIdentifier(sIdf){
var i;
for (i = 0 ; i < routes.length ; i++) {
if (routes[i].sIdentifier === sIdf) {
return routes[i];
}
}
}
/**
* This function parses the hash from the url to a concrete project in the format:
* {
* sIdentifier: string,
* oStateData: object,
* uid: string (optional),
* bBookmarkable: boolean
*
* }
* @private
*/
function parseHashToObject(sHash){
if (isVirtualHash(sHash)) {
var i = sHash.lastIndexOf(skipSuffix);
sHash = sHash.slice(0, i);
}
var aParts = sHash.split(sIdSeperator), oReturn = {};
if (aParts.length === 4 || aParts.length === 3) {
oReturn.sIdentifier = window.decodeURIComponent(aParts[0]);
oReturn.oStateData = window.JSON.parse(window.decodeURIComponent(aParts[1]));
if (aParts.length === 4) {
oReturn.uid = aParts[2];
}
oReturn.bBookmarkable = aParts[aParts.length - 1] === "0" ? false : true;
return oReturn;
} else {
//here can be empty hash only with a skipable suffix
return null;
}
}
})(jQuery, this);
return jQuery;
}, /* bExport= */ false);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','jquery.sap.strings'],function(q){"use strict";(function($,w){var s="_skip",r=/\|id-[0-9]+-[0-9]+/,a=new RegExp(s+"[0-9]*$"),b=[],h=[],S={},c=0,d,I="|",H=[],e=false,f,g=false;$.sap.history=function(z){if(!q.isPlainObject(z)){return;}if(!g){var W=$(w),A=(w.location.href.split("#")[1]||"");W.bind('hashchange',k);if($.isArray(z.routes)){var i,B;for(i=0;i<z.routes.length;i++){B=z.routes[i];if(B.path&&B.handler){$.sap.history.addRoute(B.path,B.handler);}}}if(q.isFunction(z.defaultHandler)){f=z.defaultHandler;}h.push(A);if(A.length>1){W.trigger("hashchange",[true]);}else{d=A;}g=true;}};$.sap.history.addHistory=function(i,z,B,V){var A,C;if(B===undefined){B=true;}if(!V){C=p(i,z);A=n(C);if(A){C+=(I+A);}C+=(I+(B?"1":"0"));}else{C=m(d);}H.push(C);S[C]=true;w.location.hash=C;return C;};$.sap.history.addVirtualHistory=function(){$.sap.history.addHistory("",undefined,false,true);};$.sap.history.addRoute=function(i,z,T){if(T){z=q.proxy(z,T);}var R={};R.sIdentifier=i;R['action']=z;b.push(R);return this;};$.sap.history.setDefaultHandler=function(i){f=i;};$.sap.history.getDefaultHandler=function(){return f;};$.sap.history.backToHash=function(i){i=i||"";var z;if(h.length===1){if($.isFunction(f)){f();}}else{z=j(d,i);if(z<0){w.history.go(z);}else{q.sap.log.error("jQuery.sap.history.backToHash: "+i+"is not in the history stack or it's after the current hash");}}};$.sap.history.backThroughPath=function(P){P=P||"";P=w.encodeURIComponent(P);var i;if(h.length===1){if($.isFunction(f)){f();}}else{i=j(d,P,true);if(i<0){w.history.go(i);}else{q.sap.log.error("jQuery.sap.history.backThroughPath: there's no history state which has the "+P+" identifier in the history stack before the current hash");}}};$.sap.history.back=function(i){if(h.length===1){if($.isFunction(f)){f($.sap.history.NavType.Back);}}else{if(!i){i=1;}w.history.go(-1*i);}};$.sap.history.NavType={};$.sap.history.NavType.Back="_back";$.sap.history.NavType.Forward="_forward";$.sap.history.NavType.Bookmark="_bookmark";$.sap.history.NavType.Unknown="_unknown";function j(C,T,P){var z=$.inArray(C,h),A,i,B;if(z>0){if(P){for(i=z-1;i>=0;i--){B=h[i];if(B.indexOf(T)===0&&!t(B)){return i-z;}}}else{A=$.inArray(T,h);if((A===-1)&&T.length===0){return-1*z;}if((A>-1)&&(A<z)){return A-z;}}}return 0;}function k(E,M){var i=(w.location.href.split("#")[1]||"");i=l(i);if(M||!S[i]){H.push(i);}if(!e){e=true;if(H.length>0){var z=H.shift();if(S[z]){o(z);delete S[z];}else{v(z);}d=z;}e=false;}}function l(i,R){var z=i,A=i?i.indexOf("#"):-1;if(A===0){z=z.slice(A+1);}if(R){z=z.replace(r,"");}return z;}function m(i){var P=i?i:"";if(t(P)){var z=P.lastIndexOf(s);P=P.slice(0,z);}return P+s+c++;}function p(i,z){var E=w.encodeURIComponent(i);var A=w.encodeURIComponent(w.JSON.stringify(z));return E+I+A;}function n(z){var A=$.inArray(d,h),i,B;if(A>-1){for(i=0;i<A+1;i++){B=h[i];if(B.slice(0,B.length-2)===z){return q.sap.uid();}}}return"";}function o(i){var z=$.inArray(d,h);if(!(z===-1||z===h.length-1)){h.splice(z+1,h.length-1-z);}h.push(i);}function t(i){return a.test(i);}function u(C,F){var z=$.inArray(C,h),i;if(z!==-1){if(F){for(i=z;i<h.length;i++){if(!t(h[i])){return i-z;}}}else{for(i=z;i>=0;i--){if(!t(h[i])){return i-z;}}return-1*(z+1);}}}function v(i){var R,z,P,N,A;if(d===undefined){P=y(i);if(!P||!P.bBookmarkable){if(q.isFunction(f)){f($.sap.history.NavType.Bookmark);}return;}}if(i.length===0){if(q.isFunction(f)){f($.sap.history.NavType.Back);}}else{N=q.inArray(i,h);if(N===0){P=y(i);if(!P||!P.bBookmarkable){if(q.isFunction(f)){f($.sap.history.NavType.Back);}return;}}if(t(i)){if(t(d)){z=u(i,false);w.history.go(z);}else{var B=new RegExp(q.sap.escapeRegExp(d+s)+"[0-9]*$");if(B.test(i)){z=u(i,true);if(z){w.history.go(z);}else{w.history.back();}}else{z=u(i,false);w.history.go(z);}}}else{if(N===-1){A=$.sap.history.NavType.Unknown;h.push(i);}else{if(q.inArray(d,h,N+1)===-1){A=$.sap.history.NavType.Forward;}else{A=$.sap.history.NavType.Back;}}P=y(i);if(P){R=x(P.sIdentifier);if(R){R.action.apply(null,[P.oStateData,A]);}}else{q.sap.log.error("hash format error! The current Hash: "+i);}}}}function x(z){var i;for(i=0;i<b.length;i++){if(b[i].sIdentifier===z){return b[i];}}}function y(z){if(t(z)){var i=z.lastIndexOf(s);z=z.slice(0,i);}var P=z.split(I),R={};if(P.length===4||P.length===3){R.sIdentifier=w.decodeURIComponent(P[0]);R.oStateData=w.JSON.parse(w.decodeURIComponent(P[1]));if(P.length===4){R.uid=P[2];}R.bBookmarkable=P[P.length-1]==="0"?false:true;return R;}else{return null;}}})(q,this);return q;},false);

View File

@ -0,0 +1,4 @@
/*!
* ${copyright}
*/
jQuery.sap.declare("jquery.sap.logger",false);

View File

@ -0,0 +1,192 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides ECMA Script 6 Polyfill
(function(jQuery) {
"use strict";
/*
* No Documentation by intention.
* This class represents a polyfill for ECMA Script 6 Promises
* see http://www.html5rocks.com/en/tutorials/es6/promises/
*/
var Promise = function(fAction) {
if (typeof (fAction) != "function") {
throw new TypeError("Argument is not a function");
}
this._deferred = new jQuery.Deferred();
try {
var that = this;
fAction(function(oVal){
_finalize(that, oVal, true); //force async resolve
}, function(oVal){
_finalize(that, oVal, false); //force async reject
});
} catch (e) { //Error in action rejects the promise
_finalize(this, e, false);
}
};
// *** Instance Promise functions ***
Promise.prototype.then = function(fOnFulfilled, fOnRejected){
var oFollowUpPromise = new Promise(_dummy);
this._deferred.then(_doWrap(fOnFulfilled, oFollowUpPromise, true), _doWrap(fOnRejected, oFollowUpPromise, false));
return oFollowUpPromise;
};
Promise.prototype["catch"] = function(fOnRejected){
return this.then(undefined, fOnRejected);
};
// *** Static Promise functions ***
Promise.all = function(aPromises){
return new Promise(function(fResolve, fReject){
if (!jQuery.isArray(aPromises)) {
fReject(new TypeError("invalid argument"));
return;
}
if (aPromises.length == 0) {
fResolve([]);
return;
}
var bFailed = false,
aValues = new Array(aPromises.length),
iCount = 0;
function _check(iIdx){
Promise.resolve(aPromises[iIdx]).then(function(oObj){
if (!bFailed) {
iCount++;
aValues[iIdx] = oObj;
if (iCount == aPromises.length) {
fResolve(aValues);
}
}
}, function(oObj){
if (!bFailed) {
bFailed = true;
fReject(oObj);
}
});
}
for (var i = 0; i < aPromises.length; i++) {
_check(i);
}
});
};
Promise.race = function(aPromises){
return new Promise(function(fResolve, fReject){
if (!jQuery.isArray(aPromises)) {
fReject(new TypeError("invalid argument"));
}
var bFinal = false;
for (var i = 0; i < aPromises.length; i++) {
/*eslint-disable no-loop-func */
Promise.resolve(aPromises[i]).then(function(oObj){
if (!bFinal) {
bFinal = true;
fResolve(oObj);
}
}, function(oObj){
if (!bFinal) {
bFinal = true;
fReject(oObj);
}
});
/*eslint-enable no-loop-func */
}
});
};
Promise.resolve = function(oObj){
return oObj instanceof Promise ? oObj : _resolve(new Promise(_dummy), oObj);
};
Promise.reject = function(oObj){
return _finalize(new Promise(_dummy), oObj, false);
};
// *** Helper functions ***
function _dummy(){}
function _isThenable(oObj){
return oObj && oObj.then && typeof (oObj.then) == "function";
}
function _finalize(oPromise, oObj, bResolve){
setTimeout(function(){
if (_isThenable(oObj) && bResolve) { //Assimilation
_resolve(oPromise, oObj);
} else {
oPromise._deferred[bResolve ? "resolve" : "reject"](oObj);
}
}, 0);
return oPromise;
}
function _resolve(oPromise, oObj){
if (_isThenable(oObj)) {
var bFinal = false;
try {
oObj.then(function(oVal){
_finalize(oPromise, oVal, true);
bFinal = true;
}, function(oVal){
_finalize(oPromise, oVal, false);
bFinal = true;
});
} catch (e) {
if (!bFinal) {
_finalize(oPromise, e, false);
} else {
jQuery.sap.log.debug("Promise: Error in then: " + e); //Error is ignored
}
}
} else {
_finalize(oPromise, oObj, true);
}
return oPromise;
}
function _doWrap(fAction, oPromise, bResolve){
return function(oObj){
if (!fAction) {
_finalize(oPromise, oObj, bResolve);
} else {
try {
_resolve(oPromise, fAction(oObj));
} catch (e) { //catch error in fAction
_finalize(oPromise, e, false);
}
}
};
}
// *** Polyfill ***
if (!window.Promise) {
window.Promise = Promise;
}
if (window.sap && window.sap.__ui5PublishPromisePolyfill) { //For testing purposes
window._UI5Promise = Promise;
}
})(jQuery);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
(function(q){"use strict";var P=function(A){if(typeof(A)!="function"){throw new TypeError("Argument is not a function");}this._deferred=new q.Deferred();try{var t=this;A(function(v){b(t,v,true);},function(v){b(t,v,false);});}catch(e){b(this,e,false);}};P.prototype.then=function(o,O){var f=new P(_);this._deferred.then(d(o,f,true),d(O,f,false));return f;};P.prototype["catch"]=function(o){return this.then(undefined,o);};P.all=function(p){return new P(function(r,R){if(!q.isArray(p)){R(new TypeError("invalid argument"));return;}if(p.length==0){r([]);return;}var f=false,v=new Array(p.length),C=0;function e(I){P.resolve(p[I]).then(function(o){if(!f){C++;v[I]=o;if(C==p.length){r(v);}}},function(o){if(!f){f=true;R(o);}});}for(var i=0;i<p.length;i++){e(i);}});};P.race=function(p){return new P(function(r,R){if(!q.isArray(p)){R(new TypeError("invalid argument"));}var f=false;for(var i=0;i<p.length;i++){P.resolve(p[i]).then(function(o){if(!f){f=true;r(o);}},function(o){if(!f){f=true;R(o);}});}});};P.resolve=function(o){return o instanceof P?o:c(new P(_),o);};P.reject=function(o){return b(new P(_),o,false);};function _(){}function a(o){return o&&o.then&&typeof(o.then)=="function";}function b(p,o,r){setTimeout(function(){if(a(o)&&r){c(p,o);}else{p._deferred[r?"resolve":"reject"](o);}},0);return p;}function c(p,o){if(a(o)){var f=false;try{o.then(function(v){b(p,v,true);f=true;},function(v){b(p,v,false);f=true;});}catch(e){if(!f){b(p,e,false);}else{q.sap.log.debug("Promise: Error in then: "+e);}}}else{b(p,o,true);}return p;}function d(A,p,r){return function(o){if(!A){b(p,o,r);}else{try{c(p,A(o));}catch(e){b(p,e,false);}}};}if(!window.Promise){window.Promise=P;}if(window.sap&&window.sap.__ui5PublishPromisePolyfill){window._UI5Promise=P;}})(jQuery);

View File

@ -0,0 +1,376 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
/*
* Provides methods to store and retrieve data based on Web Storage API.
*/
sap.ui.define(['jquery.sap.global'],
function(jQuery) {
"use strict";
/**
* Check whether the current environment supports JSON.parse and JSON stringify.
* @private
*/
var bSupportJSON = !!(window.JSON && JSON.parse && JSON.stringify);
/**
* Prefix added to all storage keys (typically IDs) passed by the applications
* when they are calling state storage methods. The goal of such prefix is to
* leave space for saving data (with the same key) also scenarios other than
* state saving.
* @private
*/
var sStateStorageKeyPrefix = "state.key_";
/**
* @interface A Storage API for JavaScript.
*
* Provides methods to store data on the client using Web Storage API support by the browser. The data
* received by this API must be already serialized, in string format. Similarly, the API returns the retrieved
* data in serialized string format, so it is the responsibility of the caller to de-serialize it, if applicable.
*
* Attention: The Web Storage API stores the data on the client. Therefore do not use this API for confidential information.
*
* One can get access to the 'default' storage by using {@link jQuery.sap.storage} directly
* or alternatively via factory functionality available as <code>jQuery.sap.storage(jQuery.sap.storage.Type.session)</code>
* returning an object implementing this interface.
*
* A typical intended usage of this API is the storage of a string representing the state of a control.
* In such usage, the data is stored in the browser session, and
* the methods to be used are {@link #put} and {@link #get}.
* The method {@link #remove} can be used to delete the previously saved state.
*
* In sake of completeness, the method {@link #clear} is available.
* However, it should be called only in very particular situations,
* when a global erasing of data is required. If only keys with certain prefix
* should be deleted the method {@link #removeAll} should be used.
*
* @author SAP SE
* @version 1.28.5
* @since 0.11.0
* @public
* @name jQuery.sap.storage.Storage
*/
/**
*
* Constructor for an instance of jQuery.sap.storage.Storage
*
* @param {jQuery.sap.storage.Type | Storage} [pStorage=jQuery.sap.storage.Type.session] the type this storage should be of or an Object implementing the typical Storage API for direct usage.
* @param {string} [sStorageKeyPrefix='state.key_'] the prefix to use in this storage.
*
* @private
*/
var fnStorage = function(pStorage, sStorageKeyPrefix){
var sType = "unknown",
sPrefix = sStorageKeyPrefix || sStateStorageKeyPrefix;
sPrefix += "-";
var sTestKey = sPrefix + "___sapui5TEST___",
oStorage;
if (!pStorage || typeof (pStorage) === "string") {
sType = pStorage || "session";
try {
oStorage = window[sType + "Storage"];
} catch (e) {
oStorage = null;
}
try { // Test for QUOTA_EXCEEDED_ERR (Happens e.g. in mobile Safari when private browsing active)
if (oStorage) {
oStorage.setItem(sTestKey, "1");
oStorage.removeItem(sTestKey);
}
} catch (e) {
oStorage = null;
}
} else if (typeof (pStorage) === "object") {
sType = pStorage.getType ? pStorage.getType() : "unknown";
oStorage = pStorage;
}
var bStorageAvailable = !!oStorage;
/**
* Returns whether the given storage is suppported.
*
* @return {boolean} true if storage is supported, false otherwise (e.g. due to browser security settings)
* @public
* @name jQuery.sap.storage.Storage#isSupported
* @function
*/
this.isSupported = function(){
if (!bStorageAvailable) { //No storage available at all or not accessible
return false;
}
if (typeof (oStorage.isSupported) == "function") { //Possibility to define for custom storage
return oStorage.isSupported();
}
return true;
};
/**
* Stores the passed state string in the session, under the key
* sStorageKeyPrefix + sId.
*
* sStorageKeyPrefix is the id prefix defined for the storage instance (@see jQuery.sap#storage)
*
* @param {string} sId Id for the state to store
* @param {string} sStateToStore content to store
* @return {boolean} true if the data were successfully stored, false otherwise
* @public
* @name jQuery.sap.storage.Storage#put
* @function
*/
this.put = function(sId, sStateToStore) {
//precondition: non-empty sId and available storage feature
jQuery.sap.assert(typeof sId === "string" && sId, "sId must be a non-empty string");
jQuery.sap.assert(typeof sStateToStore === "string" || bSupportJSON, "sStateToStore must be string or JSON must be supported");
if (this.isSupported() && sId) {
try {
oStorage.setItem(sPrefix + sId, bSupportJSON ? JSON.stringify(sStateToStore) : sStateToStore);
return true;
} catch (e) {
return false;
}
} else {
return false;
}
};
/**
* Retrieves the state string stored in the session under the key
* sStorageKeyPrefix + sId.
*
* sStorageKeyPrefix is the id prefix defined for the storage instance (@see jQuery.sap#storage)
*
* @param {string} sId Id for the state to retrieve
* @return {string} the string from the storage, if the retrieval
* was successful, and null otherwise
* @public
* @name jQuery.sap.storage.Storage#get
* @function
*/
this.get = function(sId) {
//precondition: non-empty sId and available storage feature
jQuery.sap.assert(typeof sId === "string" && sId, "sId must be a non-empty string");
if (this.isSupported() && sId ) {
try {
var sItem = oStorage.getItem(sPrefix + sId);
return bSupportJSON ? JSON.parse(sItem) : sItem;
} catch (e) {
return null;
}
} else {
return null;
}
};
/**
* Deletes the state string stored in the session under the key
* sStorageKeyPrefix + sId.s
*
* sStorageKeyPrefix is the id prefix defined for the storage instance (@see jQuery.sap#storage)
*
* @param {string} sId Id for the state to delete
* @return {boolean} true if the deletion
* was successful or the data doesn't exist under the specified key,
* and false if the feature is unavailable or a problem occurred
* @public
* @name jQuery.sap.storage.Storage#remove
* @function
*/
this.remove = function(sId) {
//precondition: non-empty sId and available storage feature
jQuery.sap.assert(typeof sId === "string" && sId, "sId must be a non-empty string");
if (this.isSupported() && sId) {
try {
oStorage.removeItem(sPrefix + sId);
return true;
} catch (e) {
return false;
}
} else {
return false;
}
};
/**
* Deletes all state strings stored in the session under the key prefix
* sStorageKeyPrefix + sIdPrefix.
*
* sStorageKeyPrefix is the id prefix defined for the storage instance (@see jQuery.sap#storage)
*
* @param {string} sIdPrefix Id prefix for the states to delete
* @return {boolean} true if the deletion
* was successful or the data doesn't exist under the specified key,
* and false if the feature is unavailable or a problem occurred
* @since 1.13.0
* @public
* @name jQuery.sap.storage.Storage#removeAll
* @function
*/
this.removeAll = function(sIdPrefix) {
//precondition: available storage feature (in case of IE8 typeof native functions returns "object")
if (this.isSupported() && oStorage.length && (document.addEventListener ? /function/ : /function|object/).test(typeof (oStorage.key))) {
try {
var len = oStorage.length;
var aKeysToRemove = [];
var key, i;
var p = sPrefix + (sIdPrefix || "");
for (i = 0; i < len; i++) {
key = oStorage.key(i);
if (key && key.indexOf(p) == 0) {
aKeysToRemove.push(key);
}
}
for (i = 0; i < aKeysToRemove.length; i++) {
oStorage.removeItem(aKeysToRemove[i]);
}
return true;
} catch (e) {
return false;
}
} else {
return false;
}
};
/**
* Deletes all the entries saved in the session (Independent of the current Storage instance!).
*
* CAUTION: This method should be called only in very particular situations,
* when a global erasing of data is required. Given that the method deletes
* the data saved under any ID, it should not be called when managing data
* for specific controls.
*
* @return {boolean} true if execution of removal
* was successful or the data to remove doesn't exist,
* and false if the feature is unavailable or a problem occurred
* @public
* @name jQuery.sap.storage.Storage#clear
* @function
*/
this.clear = function() {
//precondition: available storage feature
if (this.isSupported()) {
try {
oStorage.clear();
return true;
} catch (e) {
return false;
}
} else {
return false;
}
};
/**
* Returns the type of the storage.
* @returns {jQuery.sap.storage.Type | string} the type of the storage or "unknown"
* @public
* @name jQuery.sap.storage.Storage#getType
* @function
*/
this.getType = function(){
return sType;
};
};
/**
* A map holding instances of different 'standard' storages.
* Used to limit number of created storage objects.
* @private
*/
var mStorages = {};
/**
* Returns a {@link jQuery.sap.storage.Storage Storage} object for a given HTML5 storage (type) and,
* as a convenience, provides static functions to access the default (session) storage.
*
* When called as a function, it returns an instance of {@link jQuery.sap.storage.Storage}, providing access
* to the storage of the given {@link jQuery.sap.storage.Type} or to the given HTML5 Storage object.
*
* The default session storage can be easily accessed with methods {@link jQuery.sap.storage.get},
* {@link jQuery.sap.storage.put}, {@link jQuery.sap.storage.remove}, {@link jQuery.sap.storage.clear},
* {@link jQuery.sap.storage.getType} and {@link jQuery.sap.storage.removeAll}
*
* @param {jQuery.sap.storage.Type | Storage}
* oStorage the type specifying the storage to use or an object implementing the browser's Storage API.
* @param {string} [sIdPrefix] Prefix used for the Ids. If not set a default prefix is used.
* @returns {jQuery.sap.storage.Storage}
*
* @version 1.28.5
* @since 0.11.0
* @namespace
* @type Function
* @public
*
* @borrows jQuery.sap.storage.Storage#get as get
* @borrows jQuery.sap.storage.Storage#put as put
* @borrows jQuery.sap.storage.Storage#remove as remove
* @borrows jQuery.sap.storage.Storage#clear as clear
* @borrows jQuery.sap.storage.Storage#getType as getType
* @borrows jQuery.sap.storage.Storage#removeAll as removeAll
* @borrows jQuery.sap.storage.Storage#isSupported as isSupported
*/
jQuery.sap.storage = function(oStorage, sIdPrefix){
// if nothing or the default was passed in, simply return ourself
if (!oStorage) {
oStorage = jQuery.sap.storage.Type.session;
}
if (typeof (oStorage) === "string" && jQuery.sap.storage.Type[oStorage]) {
var sKey = oStorage;
if (sIdPrefix && sIdPrefix != sStateStorageKeyPrefix) {
sKey = oStorage + "_" + sIdPrefix;
}
return mStorages[sKey] || (mStorages[sKey] = new fnStorage(oStorage, sIdPrefix));
}
// OK, tough but probably good for issue identification. As something was passed in, let's at least ensure our used API is fulfilled.
jQuery.sap.assert(oStorage instanceof Object && oStorage.clear && oStorage.setItem && oStorage.getItem && oStorage.removeItem, "storage: duck typing the storage");
return new fnStorage(oStorage, sIdPrefix);
};
/**
* Enumeration of the storage types supported by {@link jQuery.sap.storage.Storage}
* @class
* @static
* @public
* @version 1.28.5
* @since 0.11.0
*/
jQuery.sap.storage.Type = {
/**
* Indicates usage of the browser's localStorage feature
* @public
*/
local: "local",
/**
* Indicates usage of the browser's sessionStorage feature
* @public
*/
session: "session",
/**
* Indicates usage of the browser's globalStorage feature
* @public
*/
global: "global"
};
// ensure the storage constructor applied to our storage object
fnStorage.apply(jQuery.sap.storage);
mStorages[jQuery.sap.storage.Type.session] = jQuery.sap.storage;
return jQuery;
}, /* bExport= */ false);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global'],function(q){"use strict";var s=!!(window.JSON&&JSON.parse&&JSON.stringify);var S="state.key_";var f=function(a,b){var t="unknown",P=b||S;P+="-";var T=P+"___sapui5TEST___",o;if(!a||typeof(a)==="string"){t=a||"session";try{o=window[t+"Storage"];}catch(e){o=null;}try{if(o){o.setItem(T,"1");o.removeItem(T);}}catch(e){o=null;}}else if(typeof(a)==="object"){t=a.getType?a.getType():"unknown";o=a;}var c=!!o;this.isSupported=function(){if(!c){return false;}if(typeof(o.isSupported)=="function"){return o.isSupported();}return true;};this.put=function(i,d){if(this.isSupported()&&i){try{o.setItem(P+i,s?JSON.stringify(d):d);return true;}catch(e){return false;}}else{return false;}};this.get=function(i){if(this.isSupported()&&i){try{var I=o.getItem(P+i);return s?JSON.parse(I):I;}catch(e){return null;}}else{return null;}};this.remove=function(i){if(this.isSupported()&&i){try{o.removeItem(P+i);return true;}catch(e){return false;}}else{return false;}};this.removeAll=function(I){if(this.isSupported()&&o.length&&(document.addEventListener?/function/:/function|object/).test(typeof(o.key))){try{var l=o.length;var k=[];var d,i;var p=P+(I||"");for(i=0;i<l;i++){d=o.key(i);if(d&&d.indexOf(p)==0){k.push(d);}}for(i=0;i<k.length;i++){o.removeItem(k[i]);}return true;}catch(e){return false;}}else{return false;}};this.clear=function(){if(this.isSupported()){try{o.clear();return true;}catch(e){return false;}}else{return false;}};this.getType=function(){return t;};};var m={};q.sap.storage=function(o,i){if(!o){o=q.sap.storage.Type.session;}if(typeof(o)==="string"&&q.sap.storage.Type[o]){var k=o;if(i&&i!=S){k=o+"_"+i;}return m[k]||(m[k]=new f(o,i));}return new f(o,i);};q.sap.storage.Type={local:"local",session:"session",global:"global"};f.apply(q.sap.storage);m[q.sap.storage.Type.session]=q.sap.storage;return q;},false);

View File

@ -0,0 +1,199 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides xml parsing and error checking functionality.
sap.ui.define(['jquery.sap.global', 'sap/ui/Device'],
function(jQuery, Device) {
"use strict";
/*global ActiveXObject */
/**
* Parses the specified XML formatted string text using native parsing
* function of the browser and returns a valid XML document. If an error
* occurred during parsing a parse error object is returned as property (parseError) of the
* returned XML document object. The parse error object has the following error
* information parameters: errorCode, url, reason, srcText, line, linepos, filepos
*
* @param {string}
* sXMLText the XML data as string
* @return {object} the parsed XML document with a parseError property as described in
* getParseError. An error occurred if the errorCode property of the parseError is != 0.
* @public
*/
jQuery.sap.parseXML = function parseXML(sXMLText) {
var oXMLDocument;
if (window.DOMParser) {
var oParser = new DOMParser();
try {
oXMLDocument = oParser.parseFromString(sXMLText, "text/xml");
} catch (e) {
var oParseError = jQuery.sap.getParseError(oXMLDocument);
oXMLDocument = {};
oParseError.reason = e.message;
oXMLDocument.parseError = oParseError;
return oXMLDocument;
}
} else {
oXMLDocument = new ActiveXObject("Microsoft.XMLDOM");
oXMLDocument.async = false;
oXMLDocument.loadXML(sXMLText);
}
var oParseError = jQuery.sap.getParseError(oXMLDocument);
if (oParseError) {
if (!oXMLDocument.parseError) {
oXMLDocument.parseError = oParseError;
}
}
return oXMLDocument;
};
/**
* Serializes the specified XML document into a string representation.
*
* @param {string}
* oXMLDocument the XML document object to be serialized as string
* @return {object} the serialized XML string
* @public
*/
jQuery.sap.serializeXML = function serializeXML(oXMLDocument) {
var sXMLString = "";
if (window.ActiveXObject) {
sXMLString = oXMLDocument.xml;
if (sXMLString) {
return sXMLString;
}
}
if (window.XMLSerializer) {
var serializer = new XMLSerializer();
sXMLString = serializer.serializeToString(oXMLDocument);
}
return sXMLString;
};
jQuery.sap.isEqualNode = function(oNode1, oNode2) {
if (oNode1 === oNode2) {
return true;
}
if (!oNode1 || !oNode2) {
return false;
}
if (oNode1.isEqualNode) {
return oNode1.isEqualNode(oNode2);
}
if (oNode1.nodeType != oNode2.nodeType) {
return false;
}
if (oNode1.nodeValue != oNode2.nodeValue) {
return false;
}
if (oNode1.baseName != oNode2.baseName) {
return false;
}
if (oNode1.nodeName != oNode2.nodeName) {
return false;
}
if (oNode1.nameSpaceURI != oNode2.nameSpaceURI) {
return false;
}
if (oNode1.prefix != oNode2.prefix) {
return false;
}
if (oNode1.nodeType != 1) {
return true; //ELEMENT_NODE
}
if (oNode1.attributes.length != oNode2.attributes.length) {
return false;
}
for (var i = 0; i < oNode1.attributes.length; i++) {
if (!jQuery.sap.isEqualNode(oNode1.attributes[i], oNode2.attributes[i])) {
return false;
}
}
if (oNode1.childNodes.length != oNode2.childNodes.length) {
return false;
}
for (var i = 0; i < oNode1.childNodes.length; i++) {
if (!jQuery.sap.isEqualNode(oNode1.childNodes[i], oNode2.childNodes[i])) {
return false;
}
}
return true;
};
/**
* Extracts parse error information from the specified document (if any). If
* an error was found the returned object has the following error
* information parameters: errorCode, url, reason, srcText, line, linepos,
* filepos
*
* @return oParseError if errors were found, or an object with an errorCode of 0 only
* @private
*/
jQuery.sap.getParseError = function getParseError(oDocument) {
var oParseError = {
errorCode : -1,
url : "",
reason : "unknown error",
srcText : "",
line : -1,
linepos : -1,
filepos : -1
};
// IE
if (!!Device.browser.internet_explorer && oDocument && oDocument.parseError
&& oDocument.parseError.errorCode != 0) {
return oDocument.parseError;
}
// Firefox
if (!!Device.browser.firefox && oDocument && oDocument.documentElement
&& oDocument.documentElement.tagName == "parsererror") {
var sErrorText = oDocument.documentElement.firstChild.nodeValue, rParserError = /XML Parsing Error: (.*)\nLocation: (.*)\nLine Number (\d+), Column (\d+):(.*)/;
if (rParserError.test(sErrorText)) {
oParseError.reason = RegExp.$1;
oParseError.url = RegExp.$2;
oParseError.line = parseInt(RegExp.$3, 10);
oParseError.linepos = parseInt(RegExp.$4, 10);
oParseError.srcText = RegExp.$5;
}
return oParseError;
}
// Safari
if (!!Device.browser.webkit && oDocument && oDocument.documentElement
&& oDocument.documentElement.tagName == "html"
&& oDocument.getElementsByTagName("parsererror").length > 0) {
var sErrorText = jQuery.sap.serializeXML(oDocument), rParserError = /error on line (\d+) at column (\d+): ([^<]*)/;
if (rParserError.test(sErrorText)) {
oParseError.reason = RegExp.$3;
oParseError.url = "";
oParseError.line = parseInt(RegExp.$1, 10);
oParseError.linepos = parseInt(RegExp.$2, 10);
oParseError.srcText = "";
}
return oParseError;
}
if (!oDocument || !oDocument.documentElement) {
return oParseError;
}
return {
errorCode : 0
};
};
return jQuery;
}, /* bExport= */ false);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','sap/ui/Device'],function(q,D){"use strict";q.sap.parseXML=function parseXML(x){var X;if(window.DOMParser){var p=new DOMParser();try{X=p.parseFromString(x,"text/xml");}catch(e){var P=q.sap.getParseError(X);X={};P.reason=e.message;X.parseError=P;return X;}}else{X=new ActiveXObject("Microsoft.XMLDOM");X.async=false;X.loadXML(x);}var P=q.sap.getParseError(X);if(P){if(!X.parseError){X.parseError=P;}}return X;};q.sap.serializeXML=function serializeXML(x){var X="";if(window.ActiveXObject){X=x.xml;if(X){return X;}}if(window.XMLSerializer){var s=new XMLSerializer();X=s.serializeToString(x);}return X;};q.sap.isEqualNode=function(n,N){if(n===N){return true;}if(!n||!N){return false;}if(n.isEqualNode){return n.isEqualNode(N);}if(n.nodeType!=N.nodeType){return false;}if(n.nodeValue!=N.nodeValue){return false;}if(n.baseName!=N.baseName){return false;}if(n.nodeName!=N.nodeName){return false;}if(n.nameSpaceURI!=N.nameSpaceURI){return false;}if(n.prefix!=N.prefix){return false;}if(n.nodeType!=1){return true;}if(n.attributes.length!=N.attributes.length){return false;}for(var i=0;i<n.attributes.length;i++){if(!q.sap.isEqualNode(n.attributes[i],N.attributes[i])){return false;}}if(n.childNodes.length!=N.childNodes.length){return false;}for(var i=0;i<n.childNodes.length;i++){if(!q.sap.isEqualNode(n.childNodes[i],N.childNodes[i])){return false;}}return true;};q.sap.getParseError=function getParseError(d){var p={errorCode:-1,url:"",reason:"unknown error",srcText:"",line:-1,linepos:-1,filepos:-1};if(!!D.browser.internet_explorer&&d&&d.parseError&&d.parseError.errorCode!=0){return d.parseError;}if(!!D.browser.firefox&&d&&d.documentElement&&d.documentElement.tagName=="parsererror"){var e=d.documentElement.firstChild.nodeValue,r=/XML Parsing Error: (.*)\nLocation: (.*)\nLine Number (\d+), Column (\d+):(.*)/;if(r.test(e)){p.reason=RegExp.$1;p.url=RegExp.$2;p.line=parseInt(RegExp.$3,10);p.linepos=parseInt(RegExp.$4,10);p.srcText=RegExp.$5;}return p;}if(!!D.browser.webkit&&d&&d.documentElement&&d.documentElement.tagName=="html"&&d.getElementsByTagName("parsererror").length>0){var e=q.sap.serializeXML(d),r=/error on line (\d+) at column (\d+): ([^<]*)/;if(r.test(e)){p.reason=RegExp.$3;p.url="";p.line=parseInt(RegExp.$1,10);p.linepos=parseInt(RegExp.$2,10);p.srcText="";}return p;}if(!d||!d.documentElement){return p;}return{errorCode:0};};return q;},false);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,5 @@
{
"sEntity" : "Library",
"sId" : "sap/m",
"sVersion" : "1.28.5"
}

View File

@ -0,0 +1,82 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.ActionListItem.
sap.ui.define(['jquery.sap.global', './ListItemBase', './library', 'sap/ui/core/EnabledPropagator'],
function(jQuery, ListItemBase, library, EnabledPropagator) {
"use strict";
/**
* Constructor for a new ActionListItem.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* ActionListItem should be used to fire actions when tapped.
* @extends sap.m.ListItemBase
*
* @author SAP SE
* @version 1.28.5
*
* @constructor
* @public
* @alias sap.m.ActionListItem
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var ActionListItem = ListItemBase.extend("sap.m.ActionListItem", /** @lends sap.m.ActionListItem.prototype */ { metadata : {
library : "sap.m",
properties : {
/**
* Text of the action list item.
*/
text : {type : "string", group : "Misc", defaultValue : null}
}
}});
/**
* Initializes member variables which are needed later on.
*
* @private
*/
ActionListItem.prototype.init = function() {
this.setType(sap.m.ListType.Active);
ListItemBase.prototype.init.apply(this, arguments);
};
/**
* Determines item specific mode
*
* ActionListItems are not selectable because they are command controls (like Button or Link) so triggering the associated command, rather than selection is
* appropriate to happen upon user action on these items. By overwriting isSelectable (inherited from ListItemBase) we exclude the item from processing
* specific to selectable list-items.
*
* @protected
* @overwrite
*/
ActionListItem.prototype.getMode = function() {
return sap.m.ListMode.None;
};
/**
* Event handler called when the space key is pressed.
*
* ActionListItems are command controls so keydown [SPACE] should have the same effect as keydown [ENTER] (i.e. triggering the associated command, instead of
* selection)
*
* @param {jQuery.Event} oEvent
* @private
*/
ActionListItem.prototype.onsapspace = ActionListItem.prototype.onsapenter;
return ActionListItem;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./ListItemBase','./library','sap/ui/core/EnabledPropagator'],function(q,L,l,E){"use strict";var A=L.extend("sap.m.ActionListItem",{metadata:{library:"sap.m",properties:{text:{type:"string",group:"Misc",defaultValue:null}}}});A.prototype.init=function(){this.setType(sap.m.ListType.Active);L.prototype.init.apply(this,arguments);};A.prototype.getMode=function(){return sap.m.ListMode.None;};A.prototype.onsapspace=A.prototype.onsapenter;return A;},true);

View File

@ -0,0 +1,47 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', './ListItemBaseRenderer', 'sap/ui/core/Renderer'],
function(jQuery, ListItemBaseRenderer, Renderer) {
"use strict";
/**
* ActionListItem renderer.
* @namespace
*/
var ActionListItemRenderer = Renderer.extend(ListItemBaseRenderer);
/**
* Renders the HTML for the given control, using the provided
* {@link sap.ui.core.RenderManager}.
*
* @param {sap.ui.core.RenderManager}
* oRenderManager the RenderManager that can be used for writing to the
* Render-Output-Buffer
* @param {sap.ui.core.Control}
* oControl an object representation of the control that should be
* rendered
*/
ActionListItemRenderer.renderLIAttributes = function(rm, oLI) {
rm.addClass("sapMALI");
};
ActionListItemRenderer.renderLIContent = function(rm, oLI) {
var isText = oLI.getText();
// List item label
if (isText) {
rm.write("<div class='sapMALIText'>");
rm.writeEscaped(isText);
rm.write("</div>");
}
};
return ActionListItemRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./ListItemBaseRenderer','sap/ui/core/Renderer'],function(q,L,R){"use strict";var A=R.extend(L);A.renderLIAttributes=function(r,l){r.addClass("sapMALI");};A.renderLIContent=function(r,l){var i=l.getText();if(i){r.write("<div class='sapMALIText'>");r.writeEscaped(i);r.write("</div>");}};return A;},true);

View File

@ -0,0 +1,231 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.ActionSelect.
sap.ui.define(['jquery.sap.global', './Select', './library'],
function(jQuery, Select, library) {
"use strict";
/**
* Constructor for a new ActionSelect.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* The ActionSelect control provides a list of predefined items that allows end users to choose options and additionally trigger some actions.
* @extends sap.m.Select
*
* @author SAP SE
* @version 1.28.5
*
* @constructor
* @public
* @since 1.16
* @alias sap.m.ActionSelect
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var ActionSelect = Select.extend("sap.m.ActionSelect", /** @lends sap.m.ActionSelect.prototype */ { metadata : {
library : "sap.m",
associations : {
/**
* Buttons to be added to the ActionSelect content.
*/
buttons : {type : "sap.m.Button", multiple : true, singularName : "button"}
}
}});
ActionSelect.prototype.init = function() {
Select.prototype.init.call(this);
this.getList().addEventDelegate({
onfocusin: this.onfocusinList
}, this);
};
/* =========================================================== */
/* Internal methods and properties */
/* =========================================================== */
/* ----------------------------------------------------------- */
/* Private methods */
/* ----------------------------------------------------------- */
/**
* Determines whether the ActionSelect has content or not.
*
* @return {boolean}
* @override
* @private
*/
ActionSelect.prototype.hasContent = function() {
return Select.prototype.hasContent.call(this) || !!this.getButtons().length;
};
/**
* Add additional content.
*
* @override
* @private
*/
ActionSelect.prototype.addContent = function() {
var oCore = sap.ui.getCore(),
oPicker = this.getPicker();
this.getButtons().forEach(function(sButtonId) {
oPicker.addContent(oCore.byId(sButtonId));
});
};
/* =========================================================== */
/* Lifecycle methods */
/* =========================================================== */
/**
* Called after the ActionSelect picker pop-up is render.
*
* @override
* @protected
*/
ActionSelect.prototype.onAfterRenderingPicker = function() {
Select.prototype.onAfterRenderingPicker.call(this);
this.getPicker().addStyleClass(sap.m.ActionSelectRenderer.CSS_CLASS + "Picker");
};
/* =========================================================== */
/* API methods */
/* =========================================================== */
/* ----------------------------------------------------------- */
/* Public methods */
/* ----------------------------------------------------------- */
/**
* Button to be removed from the ActionSelect content.
*
* @param {int | string | sap.m.Button} vButton The button to remove or its index or id.
* @returns {string} The id of the removed button or null.
* @public
*/
ActionSelect.prototype.removeButton = function(vButton) {
var oPicker = this.getPicker();
if (oPicker) {
if (typeof vButton === "number") {
vButton = this.getButtons()[vButton];
}
oPicker.removeContent(vButton);
}
return this.removeAssociation("buttons", vButton);
};
/**
* Remove all buttons from the ActionSelect.
*
* @returns {string[]} An array with the ids of the removed elements (might be empty).
* @public
*/
ActionSelect.prototype.removeAllButtons = function() {
var oPicker = this.getPicker();
if (oPicker) {
this.getButtons().forEach(function(sButtonId) {
oPicker.removeContent(sButtonId);
});
}
return this.removeAllAssociation("buttons");
};
//Keyboard Navigation for Action buttons
/**
* Handler for SHIFT-TAB key - 'tab previous' sap ui5 key event.
*
* @param oEvent - key event
* @private
*
*/
ActionSelect.prototype.onsaptabprevious = function(oEvent) {
// check whether event is marked or not
if ( oEvent.isMarked() || !this.getEnabled()) {
return;
}
// mark the event for components that needs to know if the event was handled
oEvent.setMarked();
var aButtons = this.getButtons();
var oPicker = this.getPicker();
if (oPicker && oPicker.isOpen() && aButtons.length > 0) {
sap.ui.getCore().byId(aButtons[aButtons.length - 1]).focus();
oEvent.preventDefault();
}
};
/**
* Handler for TAB key - sap 'tab next' key event.
*
* @param oEvent - key event
* @private
*
*/
ActionSelect.prototype.onsaptabnext = function(oEvent) {
// check whether event is marked or not
if ( oEvent.isMarked() || !this.getEnabled()) {
return;
}
// mark the event for components that needs to know if the event was handled
oEvent.setMarked();
var aButtons = this.getButtons();
var oPicker = this.getPicker();
if (oPicker && oPicker.isOpen() && aButtons.length > 0) {
sap.ui.getCore().byId(aButtons[0]).focus();
oEvent.preventDefault();
}
};
/**
* Handle the focus leave event.
*
* @param {jQuery.Event} oEvent The event object.
* @private
*/
ActionSelect.prototype.onsapfocusleave = function(oEvent) {
// Keep focus on Action Select's input field if does not go to
// the buttons in Action sheet part of the ActionSelect
var aButtons = this.getButtons();
var bKeepFocus = (aButtons.indexOf(oEvent.relatedControlId) == -1);
if (bKeepFocus) {
Select.prototype.onsapfocusleave.apply(this, arguments);
}
};
/**
* Handler for focus in event on The Selection List.
*
* @param oEvent - key event
* @private
*/
ActionSelect.prototype.onfocusinList = function(oEvent) {
if (document.activeElement !== this.getList().getDomRef()) {
this.focus();
}
};
return ActionSelect;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./Select','./library'],function(q,S,l){"use strict";var A=S.extend("sap.m.ActionSelect",{metadata:{library:"sap.m",associations:{buttons:{type:"sap.m.Button",multiple:true,singularName:"button"}}}});A.prototype.init=function(){S.prototype.init.call(this);this.getList().addEventDelegate({onfocusin:this.onfocusinList},this);};A.prototype.hasContent=function(){return S.prototype.hasContent.call(this)||!!this.getButtons().length;};A.prototype.addContent=function(){var c=sap.ui.getCore(),p=this.getPicker();this.getButtons().forEach(function(b){p.addContent(c.byId(b));});};A.prototype.onAfterRenderingPicker=function(){S.prototype.onAfterRenderingPicker.call(this);this.getPicker().addStyleClass(sap.m.ActionSelectRenderer.CSS_CLASS+"Picker");};A.prototype.removeButton=function(b){var p=this.getPicker();if(p){if(typeof b==="number"){b=this.getButtons()[b];}p.removeContent(b);}return this.removeAssociation("buttons",b);};A.prototype.removeAllButtons=function(){var p=this.getPicker();if(p){this.getButtons().forEach(function(b){p.removeContent(b);});}return this.removeAllAssociation("buttons");};A.prototype.onsaptabprevious=function(e){if(e.isMarked()||!this.getEnabled()){return;}e.setMarked();var b=this.getButtons();var p=this.getPicker();if(p&&p.isOpen()&&b.length>0){sap.ui.getCore().byId(b[b.length-1]).focus();e.preventDefault();}};A.prototype.onsaptabnext=function(e){if(e.isMarked()||!this.getEnabled()){return;}e.setMarked();var b=this.getButtons();var p=this.getPicker();if(p&&p.isOpen()&&b.length>0){sap.ui.getCore().byId(b[0]).focus();e.preventDefault();}};A.prototype.onsapfocusleave=function(e){var b=this.getButtons();var k=(b.indexOf(e.relatedControlId)==-1);if(k){S.prototype.onsapfocusleave.apply(this,arguments);}};A.prototype.onfocusinList=function(e){if(document.activeElement!==this.getList().getDomRef()){this.focus();}};return A;},true);

View File

@ -0,0 +1,33 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', 'sap/ui/core/Renderer', './SelectRenderer'],
function(jQuery, Renderer, SelectRenderer) {
"use strict";
var ActionSelectRenderer = Renderer.extend(SelectRenderer);
/**
* CSS class to be applied to the HTML root element of the ActionSelect control.
*
* @type {string}
*/
ActionSelectRenderer.CSS_CLASS = "sapMActionSelect";
/**
* Apply a CSS class to the HTML root element of the ActionSelect control.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oActionSelect An object representation of the control that should be rendered.
* @override
* @protected
*/
ActionSelectRenderer.addStyleClass = function(oRm, oActionSelect) {
oRm.addClass(ActionSelectRenderer.CSS_CLASS);
};
return ActionSelectRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','sap/ui/core/Renderer','./SelectRenderer'],function(q,R,S){"use strict";var A=R.extend(S);A.CSS_CLASS="sapMActionSelect";A.addStyleClass=function(r,a){r.addClass(A.CSS_CLASS);};return A;},true);

View File

@ -0,0 +1,582 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.ActionSheet.
sap.ui.define(['jquery.sap.global', './Dialog', './Popover', './library', 'sap/ui/core/Control', 'sap/ui/core/delegate/ItemNavigation'],
function(jQuery, Dialog, Popover, library, Control, ItemNavigation) {
"use strict";
/**
* Constructor for a new ActionSheet.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* ActionSheet is a special kind of control which contains one or more sap.m.Button(s) and the ActionSheet will be closed when one of the buttons is tapped. It looks similar as a sap.m.Dialog in iPhone and Android while as a sap.m.Popover in iPad.
* @extends sap.ui.core.Control
*
* @author SAP SE
* @version 1.28.5
*
* @constructor
* @public
* @since 1.9.1
* @alias sap.m.ActionSheet
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var ActionSheet = Control.extend("sap.m.ActionSheet", /** @lends sap.m.ActionSheet.prototype */ { metadata : {
library : "sap.m",
properties : {
/**
* The ActionSheet behaves as a sap.m.Popover in iPad and this property is the information about on which side will the popover be placed at. Possible values are sap.m.PlacementType.Left, sap.m.PlacementType.Right, sap.m.PlacementType.Top, sap.m.PlacementType.Bottom. The default value is sap.m.PlacementType.Bottom.
*/
placement : {type : "sap.m.PlacementType", group : "Appearance", defaultValue : sap.m.PlacementType.Bottom},
/**
* If this is set to true, there will be a cancel button shown below the action buttons. There won't be any cancel button shown in iPad regardless of this property. The default value is set to true.
*/
showCancelButton : {type : "boolean", group : "Appearance", defaultValue : true},
/**
* This is the text displayed in the cancelButton. Default value is "Cancel", and it's translated according to the current locale setting. This property will be ignored when running either in iPad or showCancelButton is set to false.
*/
cancelButtonText : {type : "string", group : "Appearance", defaultValue : null},
/**
* Title will be shown in the header area in iPhone and every Android devices. This property will be ignored in tablets and desktop browser.
*/
title : {type : "string", group : "Appearance", defaultValue : null}
},
aggregations : {
/**
* These buttons are added to the content area in ActionSheet control. When button is tapped, the ActionSheet is closed before the tap event listener is called.
*/
buttons : {type : "sap.m.Button", multiple : true, singularName : "button"},
/**
* The internally managed cancel button.
*/
_cancelButton : {type : "sap.m.Button", multiple : false, visibility : "hidden"}
},
events : {
/**
* This event is fired when the cancelButton is tapped. For iPad, this event is also fired when showCancelButton is set to true, and Popover is closed by tapping outside.
* @deprecated Since version 1.20.0.
* This event is deprecated, use the cancelButtonPress event instead.
*/
cancelButtonTap : {deprecated: true},
/**
* This event will be fired before the ActionSheet is opened.
*/
beforeOpen : {},
/**
* This event will be fired after the ActionSheet is opened.
*/
afterOpen : {},
/**
* This event will be fired before the ActionSheet is closed.
*/
beforeClose : {},
/**
* This event will be fired after the ActionSheet is closed.
*/
afterClose : {},
/**
* This event is fired when the cancelButton is clicked. For iPad, this event is also fired when showCancelButton is set to true, and Popover is closed by clicking outside.
*/
cancelButtonPress : {}
}
}});
ActionSheet.prototype.init = function() {
// Delegate keyboard processing to ItemNavigation, see commons.SegmentedButton
this._oItemNavigation = new ItemNavigation();
this._oItemNavigation.setCycling(false);
this.addDelegate(this._oItemNavigation);
};
ActionSheet.prototype.exit = function(){
if (this._parent) {
this._parent.destroy();
this._parent = null;
}
if (this._oCancelButton) {
this._oCancelButton.destroy();
this._oCancelButton = null;
}
if (this._oItemNavigation) {
this.removeDelegate(this._oItemNavigation);
this._oItemNavigation.destroy();
delete this._oItemNavigation;
}
};
// keyboard navigation
ActionSheet.prototype._setItemNavigation = function() {
var aButtons = this._getAllButtons(),
aDomRefs = [],
oDomRef = this.getDomRef();
if (oDomRef) {
this._oItemNavigation.setRootDomRef(oDomRef);
for (var i = 0; i < aButtons.length; i++) {
if (aButtons[i].getEnabled()) {
aDomRefs.push(aButtons[i].getFocusDomRef());
}
}
if (this._oCancelButton) {
aDomRefs.push(this._oCancelButton.getFocusDomRef());
}
this._oItemNavigation.setItemDomRefs(aDomRefs);
this._oItemNavigation.setSelectedIndex(0);
this._oItemNavigation.setPageSize(5);
}
};
ActionSheet.prototype.onAfterRendering = function() {
this._setItemNavigation();
this.$().on("keyup.ActionSheet", jQuery.proxy(this.onKeyUp, this));
};
ActionSheet.prototype.onBeforeRendering = function() {
if (this.getDomRef()) {
this.$().off("keyup.ActionSheet");
}
};
ActionSheet.prototype.onKeyUp = function(event) {
if ( event.which == jQuery.sap.KeyCodes.ESCAPE) {
this.close();
event.stopPropagation();
event.preventDefault();
}
};
ActionSheet.prototype.sapfocusleave = function() {
this.close();
};
/**
* Calling this method will make the ActionSheet visible on the screen.
*
* @param {object} oControl
* The ActionSheet behaves as a sap.m.Popover in iPad and the control parameter is the object to which the popover will be placed. It can be not only a UI5 control, but also an existing dom reference. The side of the placement depends on the placement property set in the popover. In other platforms, ActionSheet behaves as a standard dialog and this parameter is ignored because dialog is aligned to the screen.
* @type void
* @public
* @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
*/
ActionSheet.prototype.openBy = function(oControl){
var that = this;
//Generate a translate3d string with the given y offset
function genTransformCSS(y){
return "translate3d(0px, " + (y > 0 ? y : 0) + "px, 0px)";
}
if (!this._parent) {
var oOldParent = this.getParent();
// ActionSheet may already have a parent for dependent aggregation.
// This parent must be cleared before adding it to the popup instance, otherwise ActionSheet closes immediately after opening for the first time.
// TODO: after ManagedObject.prototype._removeChild function is fixed for removing control from dependents aggregation, remove this.
if (oOldParent) {
this.setParent(null);
}
if (!sap.ui.Device.system.phone) {
//create a Popover instance for iPad
this._parent = new Popover({
placement: this.getPlacement(),
showHeader: false,
content: [this],
beforeOpen: function(){
that.fireBeforeOpen();
},
afterOpen: function(){
that.focus();
that.fireAfterOpen();
},
beforeClose: function(){
that.fireBeforeClose();
},
afterClose: function(){
if (that.getShowCancelButton()) {
that.fireCancelButtonTap(); // (This event is deprecated, use the "cancelButtonPress" event instead)
that.fireCancelButtonPress();
}
that.fireAfterClose();
}
}).addStyleClass("sapMActionSheetPopover");
if (sap.ui.Device.browser.internet_explorer) {
this._parent._fnSetArrowPosition = jQuery.proxy(function(){
Popover.prototype._setArrowPosition.apply(this);
var $this = this.$(),
fContentWidth = $this.children(".sapMPopoverCont")[0].getBoundingClientRect().width;
jQuery.each($this.find(".sapMActionSheet > .sapMBtn"), function(index, oButtonDom){
var $button = jQuery(oButtonDom),
fButtonWidth;
$button.css("width", "");
fButtonWidth = oButtonDom.getBoundingClientRect().width;
if (fButtonWidth <= fContentWidth) {
$button.css("width", "100%");
}
});
}, this._parent);
}
} else {
//create a Dialog instance for the rest
this._parent = new Dialog({
title: this.getTitle(),
type: sap.m.DialogType.Standard,
content: [this],
beforeOpen: function(){
that.fireBeforeOpen();
},
afterOpen: function(){
that.focus();
that.fireAfterOpen();
},
beforeClose: function(oEvent){
that.fireBeforeClose({
origin: oEvent.getParameter("origin")
});
},
afterClose: function(oEvent){
that.fireAfterClose({
origin: oEvent.getParameter("origin")
});
}
}).addStyleClass("sapMActionSheetDialog");
if (this.getTitle()) {
this._parent.addStyleClass("sapMActionSheetDialogWithTitle");
}
if (!sap.ui.Device.system.phone) {
this._parent.setBeginButton(this._getCancelButton());
}
//need to modify some internal methods of Dialog for phone, because
//the actionsheet won't be sized full screen if the content is smaller than the whole screen.
//Then the transform animation need to be set at runtime with some height calculation.
if (sap.ui.Device.system.phone) {
//remove the transparent property from blocklayer
this._parent.oPopup.setModal(true);
this._parent._setDimensions = function(){
var $this = this.$(),
$content = this.$("cont");
//CSS reset
$this.css({
"width": "100%",
"max-height": "100%",
"left": "0px",
"right": "",
"bottom": ""
});
$content.css("max-height", "");
};
this._parent._openAnimation = function($this, iRealDuration, fnOpened){
var $window = jQuery(window),
iWindowHeight = $window.height(),
sStartTransform = genTransformCSS(iWindowHeight);
//need to set the transform css before its visible, in order to trigger the animation properly.
$this.css({
"top": "0px",
"-webkit-transform": sStartTransform,
"-moz-transform": sStartTransform,
"transform": sStartTransform,
"display": "block"
});
$this.bind("webkitTransitionEnd transitionend", function(){
jQuery(this).unbind("webkitTransitionEnd transitionend");
$this.removeClass("sapMDialogSliding");
fnOpened();
});
//need a timeout to trigger the animation
setTimeout(function(){
var iTop = iWindowHeight - $this.outerHeight(),
//calculation for the end point of the animation
sEndTransform = genTransformCSS(iTop);
$this.addClass("sapMDialogSliding") // Windows Phone: class should be added before CSS, otherwise no animation
.removeClass("sapMDialogHidden")
.css({
"-webkit-transform": sEndTransform,
"-moz-transform": sEndTransform,
"transform": sEndTransform
});
}, 0);
};
this._parent._closeAnimation = function($this, iRealDuration, fnClosed){
var $window = jQuery(window),
sTransform = genTransformCSS($window.height());
$this.bind("webkitTransitionEnd transitionend", function(){
jQuery(this).unbind("webkitTransitionEnd transitionend");
$this.removeClass("sapMDialogSliding");
fnClosed();
});
$this.addClass("sapMDialogSliding") // Windows Phone: class should be added before CSS, otherwise no animation
.css({
"-webkit-transform": sTransform,
"-moz-transform": sTransform,
"transform": sTransform
});
};
//set the animation to the interal oPopup instance on Dialog
this._parent.oPopup.setAnimations(jQuery.proxy(this._parent._openAnimation, this._parent), jQuery.proxy(this._parent._closeAnimation, this._parent));
//also need to change the logic for adjusting scrollable area.
this._parent._adjustScrollingPane = function(){
var $this = this.$(),
iHeight = $this.height(),
iHeaderHeight = $this.children("header.sapMIBar").outerHeight(true),
$content = this.$("cont");
$content.css("max-height", iHeight - iHeaderHeight);
if (this._oScroller) {
this._oScroller.refresh();
}
};
//only need to recalculate the transform offset when window resizes, doesn't need to reposition using Popup.js again for iPhone.
this._parent._fnOrientationChange = jQuery.proxy(function(){
this._setDimensions();
var $window = jQuery(window),
iWindowHeight = $window.height(),
$this = this.$(),
iTop = iWindowHeight - $this.outerHeight(),
sTransform = genTransformCSS(iTop);
$this.css({
"-webkit-transform": sTransform,
"-moz-transform": sTransform,
"transform": sTransform
});
this._adjustScrollingPane();
}, this._parent);
}
}
// Check if this control has already a parent. If yes, add the _parent control into the dependents aggregation
// to enable model propagation and lifecycle management.
if (oOldParent) {
oOldParent.addDependent(this._parent);
}
}
//open the ActionSheet
if (!sap.ui.Device.system.phone) {
this._parent.openBy(oControl);
} else {
this._parent.open();
}
};
/**
* Calling this method will make the ActionSheet disappear from the screen.
*
* @type void
* @public
* @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
*/
ActionSheet.prototype.close = function(oControl){
if (this._parent) {
this._parent.close();
}
};
/**
* The method checks if the ActionSheet is open. It returns true when the ActionSheet is currently open (this includes opening and closing animations), otherwise it returns false.
*
* @type boolean
* @public
* @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
*/
ActionSheet.prototype.isOpen = function(oControl){
return !!this._parent && this._parent.isOpen();
};
ActionSheet.prototype._createCancelButton = function(){
if (!this._oCancelButton) {
var sCancelButtonText = (this.getCancelButtonText()) ? this.getCancelButtonText() : sap.ui.getCore().getLibraryResourceBundle("sap.m").getText("ACTIONSHEET_CANCELBUTTON_TEXT"),
that = this;
// var sButtonStyle = (sap.ui.Device.os.ios) ? sap.m.ButtonType.Unstyled : sap.m.ButtonType.Default;
this._oCancelButton = new sap.m.Button(this.getId() + '-cancelBtn', {
text: sCancelButtonText,
type: sap.m.ButtonType.Reject,
press : function() {
if (sap.ui.Device.system.phone && that._parent) {
that._parent._oCloseTrigger = this;
}
that.close();
that.fireCancelButtonTap(); // (This event is deprecated, use the "cancelButtonPress" event instead)
that.fireCancelButtonPress();
}
}).addStyleClass("sapMActionSheetButton sapMActionSheetCancelButton sapMBtnTransparent sapMBtnInverted");
if (sap.ui.Device.system.phone) {
this.setAggregation("_cancelButton", this._oCancelButton, true);
}
}
return this;
};
ActionSheet.prototype._getCancelButton = function(){
if (sap.ui.Device.system.phone && this.getShowCancelButton()) {
this._createCancelButton();
return this._oCancelButton;
}
return null;
};
ActionSheet.prototype.setCancelButtonText = function(sText) {
this.setProperty("cancelButtonText", sText, true);
if (this._oCancelButton) {
this._oCancelButton.setText(sText);
}
return this;
};
ActionSheet.prototype._preProcessActionButton = function(oButton){
var sType = oButton.getType();
if (sType !== sap.m.ButtonType.Accept && sType !== sap.m.ButtonType.Reject) {
oButton.setType(sap.m.ButtonType.Transparent);
}
oButton.addStyleClass("sapMBtnInverted"); // dark background
return this;
};
ActionSheet.prototype.setShowCancelButton = function(bValue){
if (this._parent) {
if (sap.ui.Device.system.phone) {
//if iPhone, we need to rerender to show or hide the cancel button
this.setProperty("showCancelButton", bValue, false);
}
} else {
this.setProperty("showCancelButton", bValue, true);
}
return this;
};
ActionSheet.prototype.setTitle = function(sTitle){
this.setProperty("title", sTitle, true);
if (this._parent && sap.ui.Device.system.phone) {
this._parent.setTitle(sTitle);
}
if (this._parent) {
if (sTitle) {
this._parent.addStyleClass("sapMActionSheetDialogWithTitle");
} else {
this._parent.removeStyleClass("sapMActionSheetDialogWithTitle");
}
}
return this;
};
ActionSheet.prototype.setPlacement = function(sPlacement){
this.setProperty("placement", sPlacement, true);
if (!sap.ui.Device.system.phone) {
if (this._parent) {
this._parent.setPlacement(sPlacement);
}
}
return this;
};
ActionSheet.prototype._buttonSelected = function(){
if (sap.ui.Device.system.phone && this._parent) {
this._parent._oCloseTrigger = this;
}
this.close();
};
/* Override API methods */
ActionSheet.prototype.addButton = function(oButton) {
this.addAggregation("buttons",oButton, false);
this._preProcessActionButton(oButton);
oButton.attachPress(this._buttonSelected, this);
return this;
};
ActionSheet.prototype.insertButton = function(oButton, iIndex) {
this.insertAggregation("buttons",oButton, iIndex, false);
this._preProcessActionButton(oButton);
oButton.attachPress(this._buttonSelected, this);
return this;
};
ActionSheet.prototype.removeButton = function(oButton) {
var result = this.removeAggregation("buttons",oButton, false);
if (result) {
result.detachPress(this._buttonSelected, this);
}
return result;
};
ActionSheet.prototype.removeAllButtons = function() {
var result = this.removeAllAggregation("buttons", false),
that = this;
jQuery.each(result, function(i, oButton) {
oButton.detachPress(that._buttonSelected, that);
});
return result;
};
ActionSheet.prototype.clone = function() {
var aButtons = this.getButtons();
for ( var i = 0; i < aButtons.length; i++) {
var oButton = aButtons[i];
oButton.detachPress(this._buttonSelected, this);
}
var oClone = Control.prototype.clone.apply(this, arguments);
for ( var i = 0; i < aButtons.length; i++) {
var oButton = aButtons[i];
oButton.attachPress(this._buttonSelected, this);
}
return oClone;
};
/**
* A hook for controls that extend action sheet to determine how the buttons array is formed
* @returns {sap.m.Button[]}
* @private
*/
ActionSheet.prototype._getAllButtons = function() {
return this.getButtons();
};
return ActionSheet;
}, /* bExport= */ true);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,68 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global'],
function(jQuery) {
"use strict";
/**
* ActionSheet renderer.
* @namespace
*/
var ActionSheetRenderer = {
};
/**
* Renders the HTML for the given control, using the provided {@link sap.ui.core.RenderManager}.
*
* @param {sap.ui.core.RenderManager} oRm the RenderManager that can be used for writing to the render output buffer
* @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered
*/
ActionSheetRenderer.render = function(oRm, oControl){
var aActionButtons = oControl._getAllButtons(),
i, bMixedButtons, oButton;
for (i = 0 ; i < aActionButtons.length ; i++) {
oButton = aActionButtons[i];
if (oButton.getIcon()) {
bMixedButtons = true;
} else {
oButton.addStyleClass("sapMActionSheetButtonNoIcon");
}
}
// write the HTML into the render manager
oRm.write("<div");
oRm.writeControlData(oControl);
oRm.addClass("sapMActionSheet");
if (bMixedButtons) {
oRm.addClass("sapMActionSheetMixedButtons");
}
oRm.writeClasses();
var sTooltip = oControl.getTooltip_AsString();
if (sTooltip) {
oRm.writeAttributeEscaped("title", sTooltip);
}
oRm.write(">");
for (i = 0 ; i < aActionButtons.length ; i++) {
oRm.renderControl(aActionButtons[i].addStyleClass("sapMActionSheetButton"));
}
if (sap.ui.Device.system.phone && oControl.getShowCancelButton()) {
oRm.renderControl(oControl._getCancelButton());
}
oRm.write("</div>");
};
return ActionSheetRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global'],function(q){"use strict";var A={};A.render=function(r,c){var a=c._getAllButtons(),i,m,b;for(i=0;i<a.length;i++){b=a[i];if(b.getIcon()){m=true;}else{b.addStyleClass("sapMActionSheetButtonNoIcon");}}r.write("<div");r.writeControlData(c);r.addClass("sapMActionSheet");if(m){r.addClass("sapMActionSheetMixedButtons");}r.writeClasses();var t=c.getTooltip_AsString();if(t){r.writeAttributeEscaped("title",t);}r.write(">");for(i=0;i<a.length;i++){r.renderControl(a[i].addStyleClass("sapMActionSheetButton"));}if(sap.ui.Device.system.phone&&c.getShowCancelButton()){r.renderControl(c._getCancelButton());}r.write("</div>");};return A;},true);

View File

@ -0,0 +1,196 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.App.
sap.ui.define(['jquery.sap.global', './NavContainer', './library'],
function(jQuery, NavContainer, library) {
"use strict";
/**
* Constructor for a new App.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* App is the root element of a UI5 mobile application. It inherits from NavContainer and thus provides its navigation capabilities.
* It also adds certain header tags to the HTML page which are considered useful for mobile apps.
* @extends sap.m.NavContainer
*
* @author SAP SE
* @version 1.28.5
*
* @constructor
* @public
* @alias sap.m.App
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var App = NavContainer.extend("sap.m.App", /** @lends sap.m.App.prototype */ { metadata : {
library : "sap.m",
properties : {
/**
* The icon to be displayed on the home screen of iOS devices after the user does "add to home screen".
*
* Note that only the first attempt to set the homeIcon will be executed, subsequent settings are ignored.
*
* This icon must be in PNG format. The property can either hold the URL of one single icon which is used for all devices (and possibly scaled, which looks not perfect), or an object holding icon URLs for the different required sizes.
*
* A desktop icon (used for bookmarks and overriding the favicon) can also be configured. This requires an object to be given and the "icon" property of this object then defines the desktop bookmark icon. For this icon, PNG is not supported by Internet Explorer. The ICO format is supported by all browsers. ICO is also preferred for this desktop icon setting because the file can contain different images for different resolutions.
*
* One example is:
*
* app.setHomeIcon({
* 'phone':'phone-icon.png',
* 'phone@2':'phone-retina.png',
* 'tablet':'tablet-icon.png',
* 'tablet@2':'tablet-retina.png',
* 'icon':'desktop.ico'
* });
*
* The respective image sizes are 57/114 px for the phone and 72/144 px for the tablet.
* If an object is given but one of the sizes is not given, the largest given icon will be used for this size.
*
* On Android these icons may or may not be used by the device. Apparently chances can be improved by adding glare effect and rounded corners, setting the file name so it ends with "-precomposed.png" and setting the "homeIconPrecomposed" property to "true".
*/
homeIcon : {type : "any", group : "Misc", defaultValue : null},
/**
* Background color of the App. If set, this color will override the default background defined by the theme. So this should only be set when really required.
* Any configured background image will be placed above this colored background. But any theme adaptation in the Theme Designer will override this setting.
* Use the "backgroundRepeat" property to define whether this image should be stretched to cover the complete App or whether it should be tiled.
* @since 1.11.2
*/
backgroundColor : {type : "string", group : "Appearance", defaultValue : null},
/**
* Background image of the App. If set, this image will override the default background defined by the theme. So this should only be set when really required.
* This background image will be placed above any color set for the background. But any theme adaptation in the Theme Designer will override this image setting.
* Use the "backgroundRepeat" property to define whether this image should be stretched to cover the complete App or whether it should be tiled.
* @since 1.11.2
*/
backgroundImage : {type : "sap.ui.core.URI", group : "Appearance", defaultValue : null},
/**
* Whether the background image (if configured) should be proportionally stretched to cover the whole App (false) or whether it should be tiled (true).
* @since 1.11.2
*/
backgroundRepeat : {type : "boolean", group : "Appearance", defaultValue : false},
/**
* Opacity of the background image. The opacity can be set between 0 (fully transparent) and 1 fully opaque).
* This can be used to make the application content better readable by making the background image partly transparent.
* @since 1.11.2
*/
backgroundOpacity : {type : "float", group : "Appearance", defaultValue : 1}
},
events : {
/**
* Fired when the orientation (portrait/landscape) of the device is changed.
* @deprecated Since version 1.20.0.
* use sap.ui.Device.orientation.attachHandler(...)
*/
orientationChange : {deprecated: true,
parameters : {
/**
* Whether the device is in landscape orientation.
*/
landscape : {type : "boolean"}
}
}
}
}});
App.prototype.init = function() {
NavContainer.prototype.init.apply(this, arguments);
this.addStyleClass("sapMApp");
jQuery.sap.initMobile({
viewport: !this._debugZoomAndScroll,
statusBar: "default",
hideBrowser: true,
preventScroll: !this._debugZoomAndScroll,
rootId: this.getId()
});
jQuery(window).bind("resize", jQuery.proxy(this._handleOrientationChange, this));
};
App.prototype.onBeforeRendering = function() {
if (NavContainer.prototype.onBeforeRendering) {
NavContainer.prototype.onBeforeRendering.apply(this, arguments);
}
jQuery.sap.initMobile({
homeIcon: this.getHomeIcon()
});
};
App.prototype.onAfterRendering = function() {
if (NavContainer.prototype.onAfterRendering) {
NavContainer.prototype.onAfterRendering.apply(this, arguments);
}
var ref = this.getDomRef().parentNode;
// set all parent elements to 100% height this *should* be done by the application in CSS, but people tend to forget it...
if (ref && !ref._sapui5_heightFixed) {
ref._sapui5_heightFixed = true;
while (ref && ref !== document.documentElement) {
var $ref = jQuery(ref);
if ($ref.attr("data-sap-ui-root-content")) { // Shell as parent does this already
break;
}
if (!ref.style.height) {
ref.style.height = "100%";
}
ref = ref.parentNode;
}
}
};
/**
* Termination of the App control
* @private
*/
App.prototype.exit = function() {
jQuery(window).unbind("resize", this._handleOrientationChange);
if (this._sInitTimer) {
jQuery.sap.clearDelayedCall(this._sInitTimer);
}
};
App.prototype._handleOrientationChange = function() {
var $window = jQuery(window);
var isLandscape = $window.width() > $window.height();
if (this._oldIsLandscape !== isLandscape) {
this.fireOrientationChange({landscape: isLandscape});
this._oldIsLandscape = isLandscape;
}
};
// TODO: later, introduce tabs as a kind of separation between histories
// API methods
App.prototype.setBackgroundOpacity = function(fOpacity) {
if (fOpacity > 1 || fOpacity < 0) {
jQuery.sap.log.warning("Invalid value " + fOpacity + " for App.setBackgroundOpacity() ignored. Valid values are: floats between 0 and 1.");
return this;
}
this.$("BG").css("opacity", fOpacity);
return this.setProperty("backgroundOpacity", fOpacity, true); // no rerendering - live opacity change looks cooler
};
return App;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./NavContainer','./library'],function(q,N,l){"use strict";var A=N.extend("sap.m.App",{metadata:{library:"sap.m",properties:{homeIcon:{type:"any",group:"Misc",defaultValue:null},backgroundColor:{type:"string",group:"Appearance",defaultValue:null},backgroundImage:{type:"sap.ui.core.URI",group:"Appearance",defaultValue:null},backgroundRepeat:{type:"boolean",group:"Appearance",defaultValue:false},backgroundOpacity:{type:"float",group:"Appearance",defaultValue:1}},events:{orientationChange:{deprecated:true,parameters:{landscape:{type:"boolean"}}}}}});A.prototype.init=function(){N.prototype.init.apply(this,arguments);this.addStyleClass("sapMApp");q.sap.initMobile({viewport:!this._debugZoomAndScroll,statusBar:"default",hideBrowser:true,preventScroll:!this._debugZoomAndScroll,rootId:this.getId()});q(window).bind("resize",q.proxy(this._handleOrientationChange,this));};A.prototype.onBeforeRendering=function(){if(N.prototype.onBeforeRendering){N.prototype.onBeforeRendering.apply(this,arguments);}q.sap.initMobile({homeIcon:this.getHomeIcon()});};A.prototype.onAfterRendering=function(){if(N.prototype.onAfterRendering){N.prototype.onAfterRendering.apply(this,arguments);}var r=this.getDomRef().parentNode;if(r&&!r._sapui5_heightFixed){r._sapui5_heightFixed=true;while(r&&r!==document.documentElement){var $=q(r);if($.attr("data-sap-ui-root-content")){break;}if(!r.style.height){r.style.height="100%";}r=r.parentNode;}}};A.prototype.exit=function(){q(window).unbind("resize",this._handleOrientationChange);if(this._sInitTimer){q.sap.clearDelayedCall(this._sInitTimer);}};A.prototype._handleOrientationChange=function(){var $=q(window);var i=$.width()>$.height();if(this._oldIsLandscape!==i){this.fireOrientationChange({landscape:i});this._oldIsLandscape=i;}};A.prototype.setBackgroundOpacity=function(o){if(o>1||o<0){q.sap.log.warning("Invalid value "+o+" for App.setBackgroundOpacity() ignored. Valid values are: floats between 0 and 1.");return this;}this.$("BG").css("opacity",o);return this.setProperty("backgroundOpacity",o,true);};return A;},true);

View File

@ -0,0 +1,32 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', './NavContainerRenderer', 'sap/ui/core/Renderer'],
function(jQuery, NavContainerRenderer, Renderer) {
"use strict";
/**
* App renderer.
* @namespace
*/
var AppRenderer = {
};
var AppRenderer = Renderer.extend(NavContainerRenderer);
AppRenderer.renderAttributes = function(rm, oControl) {
sap.m.BackgroundHelper.addBackgroundColorStyles(rm, oControl.getBackgroundColor(), oControl.getBackgroundImage());
};
AppRenderer.renderBeforeContent = function(rm, oControl) {
sap.m.BackgroundHelper.renderBackgroundImageTag(rm, oControl, "sapMAppBG", oControl.getBackgroundImage(), oControl.getBackgroundRepeat(), oControl.getBackgroundOpacity());
};
return AppRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./NavContainerRenderer','sap/ui/core/Renderer'],function(q,N,R){"use strict";var A={};var A=R.extend(N);A.renderAttributes=function(r,c){sap.m.BackgroundHelper.addBackgroundColorStyles(r,c.getBackgroundColor(),c.getBackgroundImage());};A.renderBeforeContent=function(r,c){sap.m.BackgroundHelper.renderBackgroundImageTag(r,c,"sapMAppBG",c.getBackgroundImage(),c.getBackgroundRepeat(),c.getBackgroundOpacity());};return A;},true);

View File

@ -0,0 +1,436 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.Bar.
sap.ui.define(['jquery.sap.global', './BarInPageEnabler', './library', 'sap/ui/core/Control'],
function(jQuery, BarInPageEnabler, library, Control) {
"use strict";
/**
* Constructor for a new Bar.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* A bar that may be used as a header of a page. It has the capability to center a content like a title, while having few controls on the left and right side.
* @extends sap.ui.core.Control
* @implements sap.m.IBar
*
* @author SAP SE
* @version 1.28.5
*
* @constructor
* @public
* @alias sap.m.Bar
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var Bar = Control.extend("sap.m.Bar", /** @lends sap.m.Bar.prototype */ { metadata : {
interfaces : [
"sap.m.IBar"
],
library : "sap.m",
properties : {
/**
* If this flag is set to true, contentMiddle will be rendered as a HBox and layoutData can be used to allocate available space
* @deprecated Since version 1.16.
* This property is no longer supported, instead, contentMiddle will always occupy 100% width when no contentLeft and contentRight are being set.
*/
enableFlexBox : {type : "boolean", group : "Misc", defaultValue : false, deprecated: true},
/**
* A boolean value indicating whether the bar is partially translucent.
* It is only applied for touch devices.
* @since 1.12
* @deprecated Since version 1.18.6.
* This property has no effect since release 1.18.6 and should not be used. Translucent bar may overlay an input and make it difficult to edit.
*/
translucent : {type : "boolean", group : "Appearance", defaultValue : false, deprecated: true},
/**
* The design of the bar. If set to auto it is dependent on the place, where the bar is placed.
* @since 1.22
*/
design : {type : "sap.m.BarDesign", group : "Appearance", defaultValue : sap.m.BarDesign.Auto}
},
aggregations : {
/**
* this is the left content area, usually containing a button or an app icon. If this is overlapped by the right content, its content will disappear and text will show an elipsis.
*/
contentLeft : {type : "sap.ui.core.Control", multiple : true, singularName : "contentLeft"},
/**
* This is the middle content area. Controls such as label, segmented buttons or select should be placed here. Content that is placed here will be centrally positioned, if there is enough space. If the right or left content overlaps the middle content, the middle content will be centered in the space between the left and the right content.
*/
contentMiddle : {type : "sap.ui.core.Control", multiple : true, singularName : "contentMiddle"},
/**
* this is the right content area. Controls such as action buttons or search field could be placed here.
*/
contentRight : {type : "sap.ui.core.Control", multiple : true, singularName : "contentRight"}
}
}});
/**
* @private
*/
Bar.prototype.onBeforeRendering = function() {
this._removeAllListeners();
};
Bar.prototype.onAfterRendering = function() {
this._handleResize();
};
/**
* Called when the control is initialized.
* @private
*/
Bar.prototype.init = function() {
this.data("sap-ui-fastnavgroup", "true", true); // Define group for F6 handling
};
/**
* Called when the control is destroyed.
* Clean up resize listeners and destroy flexbox,
* emties cache
* @private
*/
Bar.prototype.exit = function() {
this._removeAllListeners();
if (this._oflexBox) {
this._oflexBox.destroy();
this._oflexBox = null;
}
this._$MidBarPlaceHolder = null;
this._$RightBar = null;
this._$LeftBar = null;
};
/**
* @private
*/
Bar._aResizeHandlers = ["_sResizeListenerId", "_sResizeListenerIdMid", "_sResizeListenerIdRight", "_sResizeListenerIdLeft"];
/**
* removes all resize listeners, that the bar could have registered.
* @private
*/
Bar.prototype._removeAllListeners = function() {
var that = this;
Bar._aResizeHandlers.forEach(function(sItem) {
that._removeListenerFailsave(sItem);
});
};
/**
* Removes a listener with the specified name and sets it to null, if the listener is defined.
* @param sListenerName the name of the listener that has to be removed
*
* @private
*/
Bar.prototype._removeListenerFailsave = function(sListenerName) {
if (this[sListenerName]) {
sap.ui.core.ResizeHandler.deregister(this[sListenerName]);
this[sListenerName] = null;
}
};
/**
* Invoked, when bar is rerendered, its size changed, or the size of one for the content bars changed.
* @private
*/
Bar.prototype._handleResize = function() {
this._removeAllListeners();
var bContentLeft = !!this.getContentLeft().length,
bContentMiddle = !!this.getContentMiddle().length,
bContentRight = !!this.getContentRight().length;
//Invisible bars also do not need resize listeners
if (!this.getVisible()) {
return;
}
//No content was set yet - no need to listen to resizes
if (!bContentLeft && !bContentMiddle && !bContentRight) {
return;
}
this._$LeftBar = this.$("BarLeft");
this._$RightBar = this.$("BarRight");
this._$MidBarPlaceHolder = this.$("BarPH");
this._updatePosition(bContentLeft, bContentMiddle, bContentRight);
this._sResizeListenerId = sap.ui.core.ResizeHandler.register(this.getDomRef(), jQuery.proxy(this._handleResize, this));
if (this.getEnableFlexBox()) {
return;
}
if (bContentLeft) {
this._sResizeListenerIdLeft = sap.ui.core.ResizeHandler.register(this._$LeftBar[0], jQuery.proxy(this._handleResize, this));
}
if (bContentMiddle) {
this._sResizeListenerIdMid = sap.ui.core.ResizeHandler.register(this._$MidBarPlaceHolder[0], jQuery.proxy(this._handleResize, this));
}
if (bContentRight) {
this._sResizeListenerIdRight = sap.ui.core.ResizeHandler.register(this._$RightBar[0], jQuery.proxy(this._handleResize, this));
}
};
/**
* Repositions the bar.
* If there is only one aggregation filled, this aggregation will take 100% of the bars space.
* @param bContentLeft indicates if there is left content in the bar
* @param bContentMiddle indicates if there is middle content in the bar
* @param bContentRight indicates if there is right content in the bar
* @private
*/
Bar.prototype._updatePosition = function(bContentLeft, bContentMiddle, bContentRight) {
if (!bContentLeft && !bContentRight) {
this._$MidBarPlaceHolder.css({ width : '100%'});
return;
}
if (bContentLeft && !bContentMiddle && !bContentRight) {
this._$LeftBar.css({ width : '100%'});
return;
}
if (!bContentLeft && !bContentMiddle && bContentRight) {
this._$RightBar.css({ width : '100%'});
return;
}
var iBarWidth = this.$().outerWidth(true);
// reset to default
this._$RightBar.css({ width : "" });
this._$LeftBar.css({ width : "" });
this._$MidBarPlaceHolder.css({ position : "", width : "", visibility : 'hidden' });
var iRightBarWidth = this._$RightBar.outerWidth(true);
//right bar is bigger than the bar - only show the right bar
if (iRightBarWidth > iBarWidth) {
if (bContentLeft) {
this._$LeftBar.css({ width : "0px" });
}
if (bContentMiddle) {
this._$MidBarPlaceHolder.css({ width : "0px" });
}
this._$RightBar.css({ width : iBarWidth + "px"});
return;
}
var iLeftBarWidth = this._getBarContainerWidth(this._$LeftBar);
// handle the case when left and right content are wider than the bar itself
if (iBarWidth < (iLeftBarWidth + iRightBarWidth)) {
// this scenario happens mostly when a very long title text is set in the left content area
// hence we make sure the rightContent always has enough space and reduce the left content area width accordingly
iLeftBarWidth = iBarWidth - iRightBarWidth;
this._$LeftBar.width(iLeftBarWidth);
this._$MidBarPlaceHolder.width(0);
return;
}
//middle bar will be shown
this._$MidBarPlaceHolder.css(this._getMidBarCss(iRightBarWidth, iBarWidth, iLeftBarWidth));
};
/**
* Returns the css for the contentMiddle aggregation. It is centered if there is enough space for it to fit between the left and right content.
* If not it will be centered between those two.
* @param iRightBarWidth the width in pixel
* @param iBarWidth the width in pixel
* @param iLeftBarWidth the width in pixel
* @returns {object} the new _$MidBarPlaceHolder css value
* @private
*/
Bar.prototype._getMidBarCss = function(iRightBarWidth, iBarWidth, iLeftBarWidth) {
var iMidBarPlaceholderWidth = this._$MidBarPlaceHolder.outerWidth(true),
bRtl = sap.ui.getCore().getConfiguration().getRTL(),
sLeftOrRight = bRtl ? "right" : "left",
oMidBarCss = { visibility : "" };
if (this.getEnableFlexBox()) {
iMidBarPlaceholderWidth = iBarWidth - iLeftBarWidth - iRightBarWidth - parseInt(this._$MidBarPlaceHolder.css('margin-left'), 10) - parseInt(this._$MidBarPlaceHolder.css('margin-right'), 10);
oMidBarCss.position = "absolute";
oMidBarCss.width = iMidBarPlaceholderWidth + "px";
oMidBarCss[sLeftOrRight] = iLeftBarWidth;
//calculation for flex is done
return oMidBarCss;
}
var iSpaceBetweenLeftAndRight = iBarWidth - iLeftBarWidth - iRightBarWidth,
iMidBarStartingPoint = (iBarWidth / 2) - (iMidBarPlaceholderWidth / 2),
bLeftContentIsOverlapping = iLeftBarWidth > iMidBarStartingPoint,
iMidBarEndPoint = (iBarWidth / 2) + (iMidBarPlaceholderWidth / 2),
bRightContentIsOverlapping = (iBarWidth - iRightBarWidth) < iMidBarEndPoint;
if (iSpaceBetweenLeftAndRight > 0 && (bLeftContentIsOverlapping || bRightContentIsOverlapping)) {
//Left or Right content is overlapping the Middle content
// place the middle positioned element directly next to the end of left content area
oMidBarCss.position = "absolute";
//Use the remaining space
oMidBarCss.width = iSpaceBetweenLeftAndRight + "px";
oMidBarCss.left = bRtl ? iRightBarWidth : iLeftBarWidth;
}
return oMidBarCss;
};
/**
* Gets the width of a container.
* @static
* @param $Container a container with children
* @returns {number} the width of one of the bar containers
* @private
*/
Bar.prototype._getBarContainerWidth = function($Container) {
var i,
iContainerWidth = 0,
aContainerChildren = $Container.children(),
iContainerChildrenTotalWidth = 0;
// Chrome browser has a problem in providing the correct div size when image inside does not have width explicitly set
//since ff version 24 the calculation is correct, since we don't support older versions we won't check it
if (sap.ui.Device.browser.webkit || sap.ui.Device.browser.firefox) {
for (i = 0; i < aContainerChildren.length; i++) {
iContainerChildrenTotalWidth += jQuery(aContainerChildren[i]).outerWidth(true);
}
iContainerWidth = $Container.outerWidth(true);
} else {
// IE has a rounding issue with JQuery.outerWidth
var oContainerChildrenStyle;
for (i = 0; i < aContainerChildren.length; i++) {
oContainerChildrenStyle = window.getComputedStyle(aContainerChildren[i]);
if (oContainerChildrenStyle.width == "auto") {
iContainerChildrenTotalWidth += jQuery(aContainerChildren[i]).width() + 1; //add an additional 1 pixel because of rounding issue.
} else {
iContainerChildrenTotalWidth += parseFloat(oContainerChildrenStyle.width);
}
iContainerChildrenTotalWidth += parseFloat(oContainerChildrenStyle.marginLeft);
iContainerChildrenTotalWidth += parseFloat(oContainerChildrenStyle.marginRight);
iContainerChildrenTotalWidth += parseFloat(oContainerChildrenStyle.paddingLeft);
iContainerChildrenTotalWidth += parseFloat(oContainerChildrenStyle.paddingRight);
}
var oContainerComputedStyle = window.getComputedStyle($Container[0]);
iContainerWidth += parseFloat(oContainerComputedStyle.width);
iContainerWidth += parseFloat(oContainerComputedStyle.marginLeft);
iContainerWidth += parseFloat(oContainerComputedStyle.marginRight);
iContainerWidth += parseFloat(oContainerComputedStyle.paddingLeft);
iContainerWidth += parseFloat(oContainerComputedStyle.paddingRight);
}
if (iContainerWidth < iContainerChildrenTotalWidth) {
iContainerWidth = iContainerChildrenTotalWidth;
}
return iContainerWidth;
};
/////////////////
//Bar in page delegation
/////////////////
/**
* Determines whether the bar is sensitive to the container context.
*
* Implementation of the IBar interface.
* @returns {boolean} isContextSensitive
* @protected
*/
Bar.prototype.isContextSensitive = BarInPageEnabler.prototype.isContextSensitive;
/**
* Sets the HTML tag of the root element.
* @param {sap.m.IBarHTMLTag} sTag
* @returns {sap.m.IBar} this for chaining
* @protected
*/
Bar.prototype.setHTMLTag = BarInPageEnabler.prototype.setHTMLTag;
/**
* Gets the HTML tag of the root element.
* @returns {sap.m.IBarHTMLTag} the HTML-tag
* @protected
*/
Bar.prototype.getHTMLTag = BarInPageEnabler.prototype.getHTMLTag;
/**
* Sets classes and tag according to the context in the page. Possible contexts are header, footer, subheader.
* @returns {sap.m.IBar} this for chaining
* @protected
*/
Bar.prototype.applyTagAndContextClassFor = BarInPageEnabler.prototype.applyTagAndContextClassFor;
return Bar;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./BarInPageEnabler','./library','sap/ui/core/Control'],function(q,B,l,C){"use strict";var a=C.extend("sap.m.Bar",{metadata:{interfaces:["sap.m.IBar"],library:"sap.m",properties:{enableFlexBox:{type:"boolean",group:"Misc",defaultValue:false,deprecated:true},translucent:{type:"boolean",group:"Appearance",defaultValue:false,deprecated:true},design:{type:"sap.m.BarDesign",group:"Appearance",defaultValue:sap.m.BarDesign.Auto}},aggregations:{contentLeft:{type:"sap.ui.core.Control",multiple:true,singularName:"contentLeft"},contentMiddle:{type:"sap.ui.core.Control",multiple:true,singularName:"contentMiddle"},contentRight:{type:"sap.ui.core.Control",multiple:true,singularName:"contentRight"}}}});a.prototype.onBeforeRendering=function(){this._removeAllListeners();};a.prototype.onAfterRendering=function(){this._handleResize();};a.prototype.init=function(){this.data("sap-ui-fastnavgroup","true",true);};a.prototype.exit=function(){this._removeAllListeners();if(this._oflexBox){this._oflexBox.destroy();this._oflexBox=null;}this._$MidBarPlaceHolder=null;this._$RightBar=null;this._$LeftBar=null;};a._aResizeHandlers=["_sResizeListenerId","_sResizeListenerIdMid","_sResizeListenerIdRight","_sResizeListenerIdLeft"];a.prototype._removeAllListeners=function(){var t=this;a._aResizeHandlers.forEach(function(i){t._removeListenerFailsave(i);});};a.prototype._removeListenerFailsave=function(L){if(this[L]){sap.ui.core.ResizeHandler.deregister(this[L]);this[L]=null;}};a.prototype._handleResize=function(){this._removeAllListeners();var c=!!this.getContentLeft().length,b=!!this.getContentMiddle().length,d=!!this.getContentRight().length;if(!this.getVisible()){return;}if(!c&&!b&&!d){return;}this._$LeftBar=this.$("BarLeft");this._$RightBar=this.$("BarRight");this._$MidBarPlaceHolder=this.$("BarPH");this._updatePosition(c,b,d);this._sResizeListenerId=sap.ui.core.ResizeHandler.register(this.getDomRef(),q.proxy(this._handleResize,this));if(this.getEnableFlexBox()){return;}if(c){this._sResizeListenerIdLeft=sap.ui.core.ResizeHandler.register(this._$LeftBar[0],q.proxy(this._handleResize,this));}if(b){this._sResizeListenerIdMid=sap.ui.core.ResizeHandler.register(this._$MidBarPlaceHolder[0],q.proxy(this._handleResize,this));}if(d){this._sResizeListenerIdRight=sap.ui.core.ResizeHandler.register(this._$RightBar[0],q.proxy(this._handleResize,this));}};a.prototype._updatePosition=function(c,b,d){if(!c&&!d){this._$MidBarPlaceHolder.css({width:'100%'});return;}if(c&&!b&&!d){this._$LeftBar.css({width:'100%'});return;}if(!c&&!b&&d){this._$RightBar.css({width:'100%'});return;}var i=this.$().outerWidth(true);this._$RightBar.css({width:""});this._$LeftBar.css({width:""});this._$MidBarPlaceHolder.css({position:"",width:"",visibility:'hidden'});var r=this._$RightBar.outerWidth(true);if(r>i){if(c){this._$LeftBar.css({width:"0px"});}if(b){this._$MidBarPlaceHolder.css({width:"0px"});}this._$RightBar.css({width:i+"px"});return;}var L=this._getBarContainerWidth(this._$LeftBar);if(i<(L+r)){L=i-r;this._$LeftBar.width(L);this._$MidBarPlaceHolder.width(0);return;}this._$MidBarPlaceHolder.css(this._getMidBarCss(r,i,L));};a.prototype._getMidBarCss=function(r,b,L){var m=this._$MidBarPlaceHolder.outerWidth(true),R=sap.ui.getCore().getConfiguration().getRTL(),s=R?"right":"left",M={visibility:""};if(this.getEnableFlexBox()){m=b-L-r-parseInt(this._$MidBarPlaceHolder.css('margin-left'),10)-parseInt(this._$MidBarPlaceHolder.css('margin-right'),10);M.position="absolute";M.width=m+"px";M[s]=L;return M;}var S=b-L-r,i=(b/2)-(m/2),c=L>i,d=(b/2)+(m/2),e=(b-r)<d;if(S>0&&(c||e)){M.position="absolute";M.width=S+"px";M.left=R?r:L;}return M;};a.prototype._getBarContainerWidth=function(c){var i,b=0,d=c.children(),e=0;if(sap.ui.Device.browser.webkit||sap.ui.Device.browser.firefox){for(i=0;i<d.length;i++){e+=q(d[i]).outerWidth(true);}b=c.outerWidth(true);}else{var o;for(i=0;i<d.length;i++){o=window.getComputedStyle(d[i]);if(o.width=="auto"){e+=q(d[i]).width()+1;}else{e+=parseFloat(o.width);}e+=parseFloat(o.marginLeft);e+=parseFloat(o.marginRight);e+=parseFloat(o.paddingLeft);e+=parseFloat(o.paddingRight);}var f=window.getComputedStyle(c[0]);b+=parseFloat(f.width);b+=parseFloat(f.marginLeft);b+=parseFloat(f.marginRight);b+=parseFloat(f.paddingLeft);b+=parseFloat(f.paddingRight);}if(b<e){b=e;}return b;};a.prototype.isContextSensitive=B.prototype.isContextSensitive;a.prototype.setHTMLTag=B.prototype.setHTMLTag;a.prototype.getHTMLTag=B.prototype.getHTMLTag;a.prototype.applyTagAndContextClassFor=B.prototype.applyTagAndContextClassFor;return a;},true);

View File

@ -0,0 +1,190 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides helper sap.m.BarInPageEnabler
sap.ui.define(['sap/ui/base/Object'],
function(Object) {
"use strict";
var mContexts = {
footer : {
contextClass : "sapMFooter-CTX",
tag : "Footer",
ariaLabel: "BAR_ARIA_DESCRIPTION_FOOTER"
},
header : {
contextClass : "sapMHeader-CTX",
tag : "Header",
ariaLabel: "BAR_ARIA_DESCRIPTION_HEADER"
},
subheader : {
contextClass : "sapMSubHeader-CTX",
tag : "Header",
ariaLabel: "BAR_ARIA_DESCRIPTION_SUBHEADER"
}
};
var IBAR_CSS_CLASS = "sapMIBar";
/**
* @class Helper Class for implementing the IBar interface. Should be created once per IBar instance.
* @version 1.22
* @protected
* @alias sap.m.IBarInPageEnabler
*/
var BarInPageEnabler = Object.extend("sap.m.BarInPageEnabler", /** @lends sap.m.BarInPageEnabler.prototype */ {
/**
* Determines whether the bar is sensitive to the container context.
*
* Implementation of the IBar interface.
* @returns {boolean} isContextSensitive
* @protected
*/
isContextSensitive : function() {
return this.getDesign && this.getDesign() === "Auto";
},
/**
* Sets the HTML tag of the root element.
* @param {string} sTag
* @returns {sap.m.IBar} this for chaining
* @protected
*/
setHTMLTag : function (sNewTag) {
if (sNewTag === this.sTag) {
return this;
}
this.sTag = sNewTag;
return this;
},
/**
* Gets the HTML tag of the root domref.
* @returns {string} the HTML-tag
* @protected
*/
getHTMLTag : function () {
if (!this.hasOwnProperty("sTag")) {
//Div is the default
this.sTag = sap.m.IBarHTMLTag.Div;
}
return this.sTag;
},
/**
* Sets classes and tag according to the context in the page.
*
* Possible contexts are header, footer, subheader.
* @param {string} sContext allowed values are header, footer, subheader.
* @returns {sap.m.IBar} this for chaining
* @protected
*/
applyTagAndContextClassFor : function (sContext) {
var oOptions = mContexts[sContext];
if (!oOptions) {
jQuery.sap.log.error("The context " + sContext + " is not known", this);
return this;
}
this._sAriaLabel = oOptions.ariaLabel;
if (!this.isContextSensitive || !this.setHTMLTag) {
jQuery.sap.log.error("The bar control you are using does not implement all the members of the IBar interface", this);
return this;
}
//If this class does not gets added by the renderer, add it here
if (!this.getRenderer().shouldAddIBarContext()) {
this.addStyleClass(IBAR_CSS_CLASS + "-CTX");
}
this.setHTMLTag(oOptions.tag);
if (this.isContextSensitive()) {
this.addStyleClass(oOptions.contextClass);
}
return this;
},
//Rendering
/**
* Renders the HTML for the given control, using the provided {@link sap.ui.core.RenderManager}.
* @protected
* @param {sap.ui.core.RenderManager} oRM the RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered.
*/
render : function(oRM, oControl) {
var sTag = oControl.getHTMLTag().toLowerCase(),
sLabelID = oControl.getId() + "-ariaLabel";
oRM.write("<" + sTag);
oRM.addClass(IBAR_CSS_CLASS);
//ARIA
if (oControl._sAriaLabel) {
oRM.writeAttribute("aria-labelledby", sLabelID);
}
if (this.shouldAddIBarContext(oControl)) {
oRM.addClass(IBAR_CSS_CLASS + "-CTX");
}
oRM.writeControlData(oControl);
// call the hooks
BarInPageEnabler.renderTooltip(oRM, oControl);
this.decorateRootElement(oRM, oControl);
oRM.writeClasses();
oRM.writeStyles();
oRM.write(">");
//ARIA
if (oControl._sAriaLabel) {
var oMessageBundle = sap.ui.getCore().getLibraryResourceBundle("sap.m");
oRM.write("<label id='" + sLabelID + "' style='display:none;' aria-hidden='true'>" + oMessageBundle.getText(oControl._sAriaLabel) + "</label>");
}
this.renderBarContent(oRM, oControl);
oRM.write("</" + sTag + ">");
}
});
/**
* Renders the tooltip for the given control
* @protected
* @param {sap.ui.core.RenderManager} oRM the RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered.
*/
BarInPageEnabler.renderTooltip = function(oRM, oControl) {
var sTooltip = oControl.getTooltip_AsString();
if (sTooltip) {
oRM.writeAttributeEscaped("title", sTooltip);
}
};
/**
* Adds the sapMBarChildClass to a control.
* @param {sap.ui.core.Control} oControl
* @protected
* @static
*/
BarInPageEnabler.addChildClassTo = function (oControl) {
oControl.addStyleClass("sapMBarChild");
};
return BarInPageEnabler;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['sap/ui/base/Object'],function(O){"use strict";var c={footer:{contextClass:"sapMFooter-CTX",tag:"Footer",ariaLabel:"BAR_ARIA_DESCRIPTION_FOOTER"},header:{contextClass:"sapMHeader-CTX",tag:"Header",ariaLabel:"BAR_ARIA_DESCRIPTION_HEADER"},subheader:{contextClass:"sapMSubHeader-CTX",tag:"Header",ariaLabel:"BAR_ARIA_DESCRIPTION_SUBHEADER"}};var I="sapMIBar";var B=O.extend("sap.m.BarInPageEnabler",{isContextSensitive:function(){return this.getDesign&&this.getDesign()==="Auto";},setHTMLTag:function(n){if(n===this.sTag){return this;}this.sTag=n;return this;},getHTMLTag:function(){if(!this.hasOwnProperty("sTag")){this.sTag=sap.m.IBarHTMLTag.Div;}return this.sTag;},applyTagAndContextClassFor:function(C){var o=c[C];if(!o){jQuery.sap.log.error("The context "+C+" is not known",this);return this;}this._sAriaLabel=o.ariaLabel;if(!this.isContextSensitive||!this.setHTMLTag){jQuery.sap.log.error("The bar control you are using does not implement all the members of the IBar interface",this);return this;}if(!this.getRenderer().shouldAddIBarContext()){this.addStyleClass(I+"-CTX");}this.setHTMLTag(o.tag);if(this.isContextSensitive()){this.addStyleClass(o.contextClass);}return this;},render:function(r,C){var t=C.getHTMLTag().toLowerCase(),l=C.getId()+"-ariaLabel";r.write("<"+t);r.addClass(I);if(C._sAriaLabel){r.writeAttribute("aria-labelledby",l);}if(this.shouldAddIBarContext(C)){r.addClass(I+"-CTX");}r.writeControlData(C);B.renderTooltip(r,C);this.decorateRootElement(r,C);r.writeClasses();r.writeStyles();r.write(">");if(C._sAriaLabel){var m=sap.ui.getCore().getLibraryResourceBundle("sap.m");r.write("<label id='"+l+"' style='display:none;' aria-hidden='true'>"+m.getText(C._sAriaLabel)+"</label>");}this.renderBarContent(r,C);r.write("</"+t+">");}});B.renderTooltip=function(r,C){var t=C.getTooltip_AsString();if(t){r.writeAttributeEscaped("title",t);}};B.addChildClassTo=function(C){C.addStyleClass("sapMBarChild");};return B;},true);

View File

@ -0,0 +1,163 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', './BarInPageEnabler'],
function(jQuery, BarInPageEnabler) {
"use strict";
/**
* Bar renderer.
* @namespace
*/
var BarRenderer = {};
/////////////////
//Bar in page delegation
/////////////////
/**
* Renders the HTML for the given control, using the provided {@link sap.ui.core.RenderManager}.
* @protected
* @param {sap.ui.core.RenderManager} oRM the RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered.
*/
BarRenderer.render = BarInPageEnabler.prototype.render;
/////////////////
//Bar specific rendering + implementation of enabler hooks
/////////////////
/**
* Add classes attributes and styles to the root tag
*
* @param {sap.ui.core.RenderManager} oRM the RenderManager that can be used for writing to the Render-Output-Buffer
* @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered
*/
BarRenderer.decorateRootElement = function (oRM, oControl) {
oRM.addClass("sapMBar");
oRM.addClass(this.getContext(oControl));
oRM.writeAccessibilityState(oControl, {
role: "toolbar"
});
if (oControl.getTranslucent() && (sap.ui.Device.support.touch || jQuery.sap.simulateMobileOnDesktop)) {
oRM.addClass("sapMBarTranslucent");
}
oRM.addClass("sapMBar-CTX");
};
/**
* Determines, if the IBarContext classes should be added to the control
* @private
*/
BarRenderer.shouldAddIBarContext = function () {
return true;
};
/**
* Renders the HTML for the given control, using the provided {@link sap.ui.core.RenderManager}.
*
* @param {sap.ui.core.RenderManager} oRM the RenderManager that can be used for writing to the Render-Output-Buffer
* @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered
*/
BarRenderer.renderBarContent = function(oRM, oControl) {
var sClosingDiv = "</div>";
//left content area
oRM.write("<div id='" + oControl.getId() + "-BarLeft' ");
oRM.addClass('sapMBarLeft');
oRM.addClass('sapMBarContainer');
oRM.writeClasses();
oRM.write(">");
this.renderAllControls(oControl.getContentLeft(), oRM, oControl);
oRM.write(sClosingDiv);
//middle content area
oRM.write("<div id='" + oControl.getId() + "-BarMiddle' ");
oRM.addClass('sapMBarMiddle');
oRM.writeClasses();
oRM.write(">");
if (oControl.getEnableFlexBox()) {
oControl._oflexBox = oControl._oflexBox || new sap.m.HBox(oControl.getId() + "-BarPH", {alignItems: "Center"}).addStyleClass("sapMBarPH").setParent(oControl, null, true);
oControl.getContentMiddle().forEach(function(oMidContent) {
oControl._oflexBox.addItem(oMidContent);
});
oRM.renderControl(oControl._oflexBox);
} else {
oRM.write("<div id='" + oControl.getId() + "-BarPH' ");
oRM.addClass('sapMBarPH');
oRM.addClass('sapMBarContainer');
oRM.writeClasses();
oRM.write(">");
this.renderAllControls(oControl.getContentMiddle(), oRM, oControl);
oRM.write(sClosingDiv);
}
oRM.write(sClosingDiv);
//right content area
oRM.write("<div id='" + oControl.getId() + "-BarRight'");
oRM.addClass('sapMBarRight');
oRM.addClass('sapMBarContainer');
if (sap.ui.getCore().getConfiguration().getRTL()) {
oRM.addClass("sapMRTL");
}
oRM.writeClasses();
oRM.write(">");
this.renderAllControls(oControl.getContentRight(), oRM, oControl);
oRM.write(sClosingDiv);
};
/**
* Makes the render manager renderAllControls in an array
* @param {sap.ui.core.Control} aControls the Controls to be rendered
* @param {sap.ui.core.RenderManager} oRM the RenderManager that can be used for writing to the Render-Output-Buffer
* @param {sap.m.Bar} oBar an object representation of the control that should be rendered
*/
BarRenderer.renderAllControls = function (aControls, oRM, oBar) {
aControls.forEach(function (oControl) {
sap.m.BarInPageEnabler.addChildClassTo(oControl, oBar);
oRM.renderControl(oControl);
});
};
BarRenderer._mContexts = {
Header : "sapMHeader-CTX",
SubHeader : "sapMSubHeader-CTX",
Footer : "sapMFooter-CTX",
Default : "sapMContent-CTX"
};
/**
* Determines wich tag or context class the bar should have.
* @protected
* @param {sap.m.BarBase} oControl the Bar control.
* @returns {string} the context class
*/
BarRenderer.getContext = function(oControl) {
var sDesign = oControl.getDesign(),
mContexts = BarRenderer._mContexts;
return mContexts[sDesign] || mContexts.Default;
};
return BarRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,7 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./BarInPageEnabler'],function(q,B){"use strict";var a={};a.render=B.prototype.render;a.decorateRootElement=function(r,c){r.addClass("sapMBar");r.addClass(this.getContext(c));r.writeAccessibilityState(c,{role:"toolbar"});if(c.getTranslucent()&&(sap.ui.Device.support.touch||q.sap.simulateMobileOnDesktop)){r.addClass("sapMBarTranslucent");}r.addClass("sapMBar-CTX");};a.shouldAddIBarContext=function(){return true;};a.renderBarContent=function(r,c){var C="</div>";r.write("<div id='"+c.getId()+"-BarLeft' ");r.addClass('sapMBarLeft');r.addClass('sapMBarContainer');r.writeClasses();r.write(">");this.renderAllControls(c.getContentLeft(),r,c);r.write(C);r.write("<div id='"+c.getId()+"-BarMiddle' ");r.addClass('sapMBarMiddle');r.writeClasses();r.write(">");if(c.getEnableFlexBox()){c._oflexBox=c._oflexBox||new sap.m.HBox(c.getId()+"-BarPH",{alignItems:"Center"}).addStyleClass("sapMBarPH").setParent(c,null,true);c.getContentMiddle().forEach(function(m){c._oflexBox.addItem(m);});r.renderControl(c._oflexBox);}else{r.write("<div id='"+c.getId()+"-BarPH' ");r.addClass('sapMBarPH');r.addClass('sapMBarContainer');r.writeClasses();r.write(">");this.renderAllControls(c.getContentMiddle(),r,c);r.write(C);}r.write(C);r.write("<div id='"+c.getId()+"-BarRight'");r.addClass('sapMBarRight');r.addClass('sapMBarContainer');if(sap.ui.getCore().getConfiguration().getRTL()){r.addClass("sapMRTL");}r.writeClasses();r.write(">");this.renderAllControls(c.getContentRight(),r,c);r.write(C);};a.renderAllControls=function(c,r,b){c.forEach(function(C){sap.m.BarInPageEnabler.addChildClassTo(C,b);r.renderControl(C);});};a._mContexts={Header:"sapMHeader-CTX",SubHeader:"sapMSubHeader-CTX",Footer:"sapMFooter-CTX",Default:"sapMContent-CTX"};a.getContext=function(c){var d=c.getDesign(),C=a._mContexts;return C[d]||C.Default;};return a;},true);

View File

@ -0,0 +1,408 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.BusyDialog.
sap.ui.define(['jquery.sap.global', './library', 'sap/ui/core/Control', 'sap/ui/core/Popup', 'sap/ui/core/theming/Parameters'],
function(jQuery, library, Control, Popup, Parameters) {
"use strict";
/**
* Constructor for a new BusyDialog.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* Busy Dialog is used to indicate that the system is busy with some task and the user has to wait. During this time the UI is blocked.
* @extends sap.ui.core.Control
*
* @author SAP SE
* @version 1.28.5
*
* @constructor
* @public
* @alias sap.m.BusyDialog
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var BusyDialog = Control.extend("sap.m.BusyDialog", /** @lends sap.m.BusyDialog.prototype */ { metadata : {
library : "sap.m",
properties : {
/**
* Optional text shown inside the popup.
*/
text : {type : "string", group : "Appearance", defaultValue : null},
/**
* Sets a title to the busy dialog. Default is no title.
*/
title : {type : "string", group : "Appearance", defaultValue : null},
/**
* Icon that is displayed in the dialog header. This icon is invisible in iOS platform and it's density aware that you can use the density convention (@2, @1.5, etc.) to provide higher resolution image for higher density screen.
*/
customIcon : {type : "sap.ui.core.URI", group : "Appearance", defaultValue : null},
/**
* Defines the rotation speed of the given image. If a gif is used, the speed has to be set to 0. The unit is in ms.
*/
customIconRotationSpeed : {type : "int", group : "Appearance", defaultValue : 1000},
/**
* If this is set to false, the src image will be loaded directly without attempting to fetch the density perfect image for high density device.
*
* By default, this is set to true but then one or more requests are sent trying to get the density perfect version of image if this version of image doesn't exist on the server.
*
* If bandwidth is the key for the application, set this value to false.
*/
customIconDensityAware : {type : "boolean", defaultValue : true},
/**
* Width of the provided icon. By default 44px are used.
*/
customIconWidth : {type : "sap.ui.core.CSSSize", group : "Appearance", defaultValue : "30px"},
/**
* Height of the provided icon. By default 44px are used.
*/
customIconHeight : {type : "sap.ui.core.CSSSize", group : "Appearance", defaultValue : "44px"},
/**
* The text of the cancel button. The default text is "Cancel" (translated to the respective language).
*/
cancelButtonText : {type : "string", group : "Misc", defaultValue : null},
/**
* A cancel button will be rendered inside the busy dialog if this property is set to true.
*/
showCancelButton : {type : "boolean", group : "Appearance", defaultValue : false}
},
aggregations : {
/**
* The hidden aggregation for internal maintained label.
*/
_busyLabel : {type : "sap.ui.core.Control", multiple : false, visibility : "hidden"},
/**
* The hidden aggregation for internal maintained busyIndicator.
*/
_busyIndicator : {type : "sap.ui.core.Control", multiple : false, visibility : "hidden"},
/**
* The hidden aggregation for internal maintained toolbar which contains the cancel button.
*/
_toolbar : {type : "sap.ui.core.Control", multiple : false, visibility : "hidden"},
/**
* The hidden aggregation for internal maintained button.
*/
_cancelButton : {type : "sap.ui.core.Control", multiple : false, visibility : "hidden"}
},
events : {
/**
* This event will be fired when the busy dialog is closed.
*/
close : {
parameters : {
/**
* this parameter is for an app to differ for a "close" event if it was fired because user pressed cancel button or because the operation was terminated.
* This parameter is set to true if the close event is fired by user interaction.
*/
cancelPressed : {type : "boolean"}
}
}
}
}});
BusyDialog.prototype.init = function(){
var that = this;
this._$window = jQuery(window);
this._busyIndicator = new sap.m.BusyIndicator(this.getId() + '-busyInd', {visible: false}).addStyleClass('sapMBsyInd');
this.setAggregation("_busyIndicator", this._busyIndicator, true);
this.iOldWinHeight = 0;
this._oPopup = new Popup();
this._oPopup.setShadow(false);
this._oPopup.setModal(true, 'sapMDialogBLyInit');
this._oPopup.setAnimations(this.openAnimation, this.closeAnimation);
//the orientationchange event listener
this._fOrientationChange = jQuery.proxy(this._reposition, this);
this._oPopup._applyPosition = function(oPosition){
that._setDimensions();
Popup.prototype._applyPosition.call(this, oPosition);
};
this._oPopup._showBlockLayer = function(){
Popup.prototype._showBlockLayer.call(this);
var $BlockRef = jQuery("#sap-ui-blocklayer-popup");
$BlockRef.toggleClass("sapMDialogBLyInit", true);
};
this._oPopup._hideBlockLayer = function(){
var $BlockRef = jQuery("#sap-ui-blocklayer-popup");
var $BlockBarRef = jQuery("#sap-ui-blocklayer-popup-bar");//$BlockRef.next('div');
/*$BlockRef.one("webkitTransitionEnd", function(){*/
$BlockBarRef.css({'visibility': '', 'display': 'none'});
$BlockRef.toggleClass('sapMDialogBLyInit', false);
$BlockRef.css("top", "");
Popup.prototype._hideBlockLayer.call(this);
/*});*/
/*$BlockRef.toggleClass('sapMDialogBLyShown', false);*/
};
//keyboard support for desktop environments
if (sap.ui.Device.system.desktop) {
var fnOnEscape = jQuery.proxy(function(oEvent) {
this.close(true);
//event should not trigger any further actions
oEvent.stopPropagation();
}, this);
//use pseudo event 'onsapescape' to implement keyboard-trigger for closing this dialog
this._oPopup.onsapescape = fnOnEscape;
}
};
BusyDialog.prototype.openAnimation = function($Ref, iRealDuration, fnOpened) {
fnOpened();
};
BusyDialog.prototype.closeAnimation = function($Ref, iRealDuration, fnClose) {
fnClose();
};
/**
* Destroys the dialog control
* @private
*/
BusyDialog.prototype.exit = function(){
this._oPopup.close();
this._oPopup.destroy();
this._oPopup = null;
this._$window.unbind("resize", this._fOrientationChange);
};
/**
* Opens the busy popup.
*
* @type sap.m.BusyDialog
* @public
* @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
*/
BusyDialog.prototype.open = function(){
jQuery.sap.log.debug("sap.m.BusyDialog.open called at " + new Date().getTime());
var oPopup = this._oPopup;
if (oPopup.isOpen()) {
return this;
}
// Open popup
oPopup.setContent(this);
oPopup.attachOpened(this._handleOpened, this);
oPopup.setPosition("center center", "center center", document, "0 0", "fit");
this._bOpenRequested = true;
this._openNowIfPossibleAndRequested();
return this;
};
BusyDialog.prototype._openNowIfPossibleAndRequested = function(){
if (!this._bOpenRequested) {
return;
}
// If body/Core are not available yet, give them some more time and open later if still required
if (!document.body || !sap.ui.getCore().isInitialized()) {
jQuery.sap.delayedCall(50, this, "_openNowIfPossibleAndRequested");
return;
}
this._bOpenRequested = false; // opening request is handled
this._oPopup.open();
};
/**
* Close the busy popup.
*
* @type sap.m.BusyDialog
* @public
* @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
*/
BusyDialog.prototype.close = function(bFromCancelButton){
this._bOpenRequested = false;
var oPopup = this._oPopup;
var eOpenState = this._oPopup.getOpenState();
if (!(eOpenState === sap.ui.core.OpenState.CLOSED || eOpenState === sap.ui.core.OpenState.CLOSING)) {
oPopup.attachClosed(this._handleClosed, this);
jQuery.sap.log.debug("sap.m.BusyDialog.close called at " + new Date().getTime());
oPopup.close();
// stop busy indicator
this._busyIndicator.setVisible(false);
this.fireClose({
cancelPressed: !!bFromCancelButton
});
}
return this;
};
BusyDialog.prototype.setText = function(sText){
this.setProperty("text", sText, true);
if (!this._oLabel) {
this._oLabel = new sap.m.Label(this.getId() + "-busyLabel", {}).addStyleClass("sapMBusyDialogLabel");
this.setAggregation("_busyLabel", this._oLabel, true);
}
this._oLabel.setText(sText);
return this;
};
BusyDialog.prototype.setCustomIcon = function(oIcon){
this.setProperty("customIcon", oIcon, true);
this._busyIndicator.setCustomIcon(oIcon);
return this;
};
BusyDialog.prototype.setCustomIconRotationSpeed = function(iSpeed){
this.setProperty("customIconRotationSpeed", iSpeed, true);
this._busyIndicator.setCustomIconRotationSpeed(iSpeed);
return this;
};
BusyDialog.prototype.setCustomIconDensityAware = function(bAware){
this.setProperty("customIconDensityAware", bAware, true);
this._busyIndicator.setCustomIconDensityAware(bAware);
return this;
};
BusyDialog.prototype.setCustomIconWidth = function(sWidth){
this.setProperty("customIconWidth", sWidth, true);
this._busyIndicator.setCustomIconWidth(sWidth);
return this;
};
BusyDialog.prototype.setCustomIconHeight = function(sHeight){
this.setProperty("customIconHeight", sHeight, true);
this._busyIndicator.setCustomIconHeight(sHeight);
return this;
};
BusyDialog.prototype.setShowCancelButton = function(bShow){
this.setProperty("showCancelButton", bShow, false);
if (bShow) {
this._createCancelButton();
}
return this;
};
BusyDialog.prototype.setCancelButtonText = function(sText){
this.setProperty("cancelButtonText", sText, true);
this._createCancelButton();
this._oButton.setText(sText);
return this;
};
BusyDialog.prototype._createCancelButton = function(){
if (!this._oButton) {
var that = this;
var sButtonText = (this.getCancelButtonText()) ? this.getCancelButtonText() : sap.ui.getCore().getLibraryResourceBundle("sap.m").getText("BUSYDIALOG_CANCELBUTTON_TEXT");
this._oButton = new sap.m.Button(this.getId() + 'busyCancelBtn', {
text: sButtonText,
type: sap.m.ButtonType.Transparent,
press : function() {
that.close(true);
}
}).addStyleClass("sapMDialogBtn");
if (sap.ui.Device.system.phone) {
this._oButton.addStyleClass("sapMDialogBtnPhone");
this.setAggregation("_cancelButton", this._oButton, true);
} else {
this._oButtonToolBar = new sap.m.Toolbar(this.getId() + "-toolbar", {
content: [
new sap.m.ToolbarSpacer(this.getId() + "-toolbarspacer"),
this._oButton
]
}).addStyleClass("sapMTBNoBorders").addStyleClass("sapMBusyDialogFooter").applyTagAndContextClassFor("footer");
this.setAggregation("_toolbar", this._oButtonToolBar, true);
}
}
};
BusyDialog.prototype._reposition = function() {
var ePopupState = this._oPopup.getOpenState();
if (!(ePopupState === sap.ui.core.OpenState.OPEN)) {
return;
}
this._oPopup._applyPosition(this._oPopup._oLastPosition);
};
BusyDialog.prototype._handleOpened = function(){
this._oPopup.detachOpened(this._handleOpened, this);
// start busy indicator
this._busyIndicator.setVisible(true);
// bind to window resize
// In android, the orientationchange fires before the size of the window changes
// that's why the resize event is used here.
this._$window.bind("resize", this._fOrientationChange);
};
BusyDialog.prototype._handleClosed = function(){
this._oPopup.detachClosed(this._handleClosed, this);
this._$window.unbind("resize", this._fOrientationChange);
};
BusyDialog.prototype._setDimensions = function() {
// Derive width and height from viewport
var iWindowHeight = this._$window.height();
var $this = this.$();
//reset
$this.css({
"left": "0px",
"top": "0px",
"max-height": this._$window.height() + "px"
});
if (iWindowHeight <= this.iOldWinHeight) {
if (!this.$().hasClass("sapMBsyDSmall")) {
this._checkSize(iWindowHeight);
}
}
if (iWindowHeight > this.iOldWinHeight) {
if ((this.$().hasClass("sapMBsyDSmall"))) {
this._checkSize(iWindowHeight);
}
}
if (this.iOldWinHeight == 0) {
this._checkSize(iWindowHeight);
}
this.iOldWinHeight = this._$window.height();
};
BusyDialog.prototype._checkSize = function(iWindowHeight) {
if (iWindowHeight < this.$()[0].scrollHeight) {
this.$().toggleClass("sapMBsyDSmall", true);
} else {
this.$().toggleClass("sapMBsyDSmall", false);
this.$().css("width", "18.75em");
}
};
return BusyDialog;
}, /* bExport= */ true);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,73 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global'],
function(jQuery) {
"use strict";
/**
* BusyDialog renderer.
* @namespace
*/
var BusyDialogRenderer = {
};
/**
* Renders the HTML for the given control, using the provided {@link sap.ui.core.RenderManager}.
*
* @param {sap.ui.core.RenderManager} oRm the RenderManager that can be used for writing to the Render-Output-Buffer
* @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered
*/
BusyDialogRenderer.render = function(oRm, oControl){
// write the HTML into the render manager
oRm.write("<div");
oRm.writeControlData(oControl);
oRm.addClass("sapMBusyDialog sapMCommonDialog");
if (jQuery.device.is.iphone) {
oRm.addClass("sapMDialogHidden");
}
if (!oControl.getText() && !oControl.getTitle() && !oControl.getShowCancelButton()) {
oRm.addClass("sapMBusyDialogSimple");
}
// test dialog with sap-ui-xx-formfactor=compact
if (sap.m._bSizeCompact) {
oRm.addClass("sapUiSizeCompact");
}
oRm.writeClasses();
var sTooltip = oControl.getTooltip_AsString();
if (sTooltip) {
oRm.writeAttributeEscaped("title", sTooltip);
}
oRm.write(">");
if (oControl.getTitle()) {
oRm.write("<header class=\"sapMDialogTitle\">");
oRm.writeEscaped(oControl.getTitle());
oRm.write("</header>");
}
oRm.renderControl(oControl._oLabel);
oRm.renderControl(oControl._busyIndicator);
if (oControl.getShowCancelButton()) {
if (sap.ui.Device.system.phone) {
oRm.write("<footer class='sapMBusyDialogFooter sapMFooter-CTX'>");
oRm.renderControl(oControl._oButton);
oRm.write("</footer>");
} else {
oRm.renderControl(oControl._oButtonToolBar);
}
}
oRm.write("</div>");
};
return BusyDialogRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global'],function(q){"use strict";var B={};B.render=function(r,c){r.write("<div");r.writeControlData(c);r.addClass("sapMBusyDialog sapMCommonDialog");if(q.device.is.iphone){r.addClass("sapMDialogHidden");}if(!c.getText()&&!c.getTitle()&&!c.getShowCancelButton()){r.addClass("sapMBusyDialogSimple");}if(sap.m._bSizeCompact){r.addClass("sapUiSizeCompact");}r.writeClasses();var t=c.getTooltip_AsString();if(t){r.writeAttributeEscaped("title",t);}r.write(">");if(c.getTitle()){r.write("<header class=\"sapMDialogTitle\">");r.writeEscaped(c.getTitle());r.write("</header>");}r.renderControl(c._oLabel);r.renderControl(c._busyIndicator);if(c.getShowCancelButton()){if(sap.ui.Device.system.phone){r.write("<footer class='sapMBusyDialogFooter sapMFooter-CTX'>");r.renderControl(c._oButton);r.write("</footer>");}else{r.renderControl(c._oButtonToolBar);}}r.write("</div>");};return B;},true);

View File

@ -0,0 +1,449 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.BusyIndicator.
sap.ui.define(['jquery.sap.global', './library', 'sap/ui/core/Control', 'sap/ui/core/theming/Parameters'],
function(jQuery, library, Control, Parameters) {
"use strict";
/**
* Constructor for a new BusyIndicator.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* Control to indicate that the system is busy with some task and the user has to wait.
* @extends sap.ui.core.Control
*
* @author SAP SE
* @version 1.28.5
*
* @constructor
* @public
* @alias sap.m.BusyIndicator
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var BusyIndicator = Control.extend("sap.m.BusyIndicator", /** @lends sap.m.BusyIndicator.prototype */ { metadata : {
library : "sap.m",
properties : {
/**
* Defines the text displayed next to the busy indicator (optional)
*/
text : {type : "string", group : "Data", defaultValue : null},
/**
* Options for the text direction are RTL and LTR. Alternatively, the control can inherit the text direction from its parent container.
*/
textDirection : {type : "sap.ui.core.TextDirection", group : "Appearance", defaultValue : sap.ui.core.TextDirection.Inherit},
/**
* Set to false to make the control invisible.
*/
visible : {type : "boolean", group : "Appearance", defaultValue : true},
/**
* Icon URL if an icon is used as the busy indicator.
*/
customIcon : {type : "sap.ui.core.URI", group : "Misc", defaultValue : null},
/**
* Defines the rotation speed of the given image. If a .gif is used, the speed has to be set to 0. The unit is in ms.
*/
customIconRotationSpeed : {type : "int", group : "Appearance", defaultValue : 1000},
/**
* If this is set to false, the src image will be loaded directly without attempting to fetch the density perfect image for high density device.
*
* By default, this is set to true but then one or more requests are sent trying to get the density perfect version of image if this version of image doesn't exist on the server.
*
* If bandwidth is the key for the application, set this value to false.
*/
customIconDensityAware : {type : "boolean", defaultValue : true},
/**
* Width of the provided icon. By default 44px are used.
*/
customIconWidth : {type : "sap.ui.core.CSSSize", group : "Appearance", defaultValue : "44px"},
/**
* Height of the provided icon. By default 44px are used.
*/
customIconHeight : {type : "sap.ui.core.CSSSize", group : "Appearance", defaultValue : "44px"},
/**
* Defines the size of the busy indicator.
*/
size : {type : "sap.ui.core.CSSSize", group : "Misc", defaultValue : null},
/**
* The design defines how the BusyIndicator should look like. There are 3 possibilities:
* auto: automatically sets the design according to the context
* dark: dark theme, useful within a light context
* light: light theme, useful within a dark context
*/
design : {type : "string", group : "Appearance", defaultValue : 'auto'}
},
associations: {
/**
* Association to controls / ids which label this control (see WAI-ARIA attribute aria-labelledby).
* @since 1.27.0
*/
ariaLabelledBy: { type: "sap.ui.core.Control", multiple: true, singularName: "ariaLabelledBy" }
},
aggregations : {
/**
* The hidden aggregation for internal maintained icon image.
*/
_iconImage : {type : "sap.ui.core.Control", multiple : false, visibility : "hidden"},
/**
* The hidden aggregation for internal maintained busy label.
*/
_busyLabel : {type : "sap.ui.core.Control", multiple : false, visibility : "hidden"}
}
}});
BusyIndicator.prototype.init = function(){
// Blue crystal design: rotating arc
// bugs.webkit.org: id=82647, id=74801 dynamically created SVG does not animate
// do not use SVG in ios and android < 4.2
if (sap.ui.Device.browser.chrome
|| sap.ui.Device.os.blackberry
|| sap.ui.Device.os.android && sap.ui.Device.os.version > 4.1) {
// Browsers with correct SMIL animation show SVG (crisp rendering)
this._bUseSvg = true;
} else {
// Fall-back for other browsers: show canvas animation (aliased rendering)
this._bUseCanvas = true;
}
this._sBColor = Parameters.get("sapUiPageBG") || "rgba(0, 0, 0, 0)";
};
BusyIndicator.prototype.exit = function(){
this._cancelAnimation();
};
// Request canvas animation
if (window.requestAnimationFrame) {
BusyIndicator.prototype._requestAnimation = function(fCallback){
return window.requestAnimationFrame(fCallback);
};
} else if (window.webkitRequestAnimationFrame) {
BusyIndicator.prototype._requestAnimation = function(fCallback, oDOM){
return window.webkitRequestAnimationFrame(fCallback, oDOM);
};
} else if (window.mozRequestAnimationFrame) {
BusyIndicator.prototype._requestAnimation = function(fCallback){
return window.mozRequestAnimationFrame(fCallback);
};
} else {
BusyIndicator.prototype._requestAnimation = function(fCallback){
return window.setTimeout(fCallback, 1000 / 60);
};
}
// Stop canvas animation
BusyIndicator.prototype._cancelAnimation = function(){
if (!this._animationId) { return;}
if (window.cancelAnimationFrame) {
window.cancelAnimationFrame(this._animationId);
} else if (window.webkitCancelAnimationFrame) {
window.webkitCancelAnimationFrame(this._animationId);
} else if (window.mozCancelAnimationFrame) {
window.mozCancelAnimationFrame(this._animationId);
} else {
window.clearTimeout(this._animationId);
}
this._animationId = undefined;
};
// Do the next animation step
BusyIndicator.prototype._animateCanvas = function(){
if (!this.oCanvas) { return; }
var clientWidth = this.oCanvas.clientWidth,
clientHeight = this.oCanvas.clientHeight;
if (!this.getVisible() || !clientWidth || !clientHeight) {
// if the indicator becomes invisible, client width and height are set to 0.
// Stop animation
this._animationId = undefined;
return;
}
// Adjust the canvas size to avoid aliasing artifacts
// This is needed only once after first rendering and only for custom size
if (clientWidth != this.oCanvas.width) {
this.oCanvas.setAttribute("width", clientWidth);
}
if (clientHeight != this.oCanvas.height) {
this.oCanvas.setAttribute("height", clientHeight);
}
var context = this.oCanvas.getContext("2d"),
w = this.oCanvas.width,
h = this.oCanvas.height,
x = Math.round(w / 2),
y = Math.round(h / 2),
r = Math.round(x * 0.7),
t = new Date(),
startAngle = 0.9 * (t.getSeconds() + t.getMilliseconds() / 1000) * 2 * Math.PI,
endAngle = startAngle + 1.25 * Math.PI, // 225 grad
counterClock = false,
strokeStyle = window.getComputedStyle(this.oCanvas).color,
lineWidth = Math.round(w / 10) * 2;
context.clearRect(0,0,w,h);
// clearRect does not clear canvas in Android browser 4.1,
// workaround: draw a white circle underneath
if (sap.ui.Device.os.android && sap.ui.Device.os.version == 4.1 && !sap.ui.Device.browser.chrome) {
context.strokeStyle = this._sBColor;
context.lineWidth = lineWidth + 2;
context.beginPath();
context.arc(x, y, r, 0, 2 * Math.PI);
context.stroke();
}
context.strokeStyle = strokeStyle;
context.lineWidth = lineWidth;
context.beginPath();
context.arc(x, y, r, startAngle, endAngle, counterClock);
context.stroke();
this._animationId = this._requestAnimation(this._fAnimateCallback, this.oCanvas);
};
// Start the canvas based animation
BusyIndicator.prototype._doCanvas = function(){
this.oCanvas = this.getDomRef("canvas");
this._fAnimateCallback = jQuery.proxy(this._animateCanvas, this);
this._animationId = this._requestAnimation(this._fAnimateCallback, this.oCanvas);
};
// Start/stop SVG animation
// Though SVG animates itself, stop it when invisible to avoid unneeded layer updates
BusyIndicator.prototype._setSvg = function(){
var oSvg = this.getDomRef("svg");
if (oSvg) {
if ( this.getVisible() ) {
oSvg.unpauseAnimations();
} else {
oSvg.pauseAnimations();
}
}
};
// Create internal icon image
BusyIndicator.prototype._createCustomIcon = function(sName, sValue){
var that = this;
if (!this._iconImage) {
this._iconImage = new sap.m.Image(this.getId() + "-icon", {
width: "44px",
height: "44px"
}).addStyleClass('sapMBsyIndIcon');
this._iconImage.addDelegate({onAfterRendering : function() {
that._setRotationSpeed();
}
});
this.setAggregation("_iconImage", this._iconImage, true);
}
this._iconImage[sName](sValue);
this._setRotationSpeed();
};
// Create internal label
BusyIndicator.prototype._createLabel = function(sName, sValue){
if (!this._oLabel) {
this._oLabel = new sap.m.Label(this.getId() + "-label", {labelFor: this.getId()}).addStyleClass("sapMBsyIndLabel");
this.setAggregation("_busyLabel", this._oLabel);
}
this._oLabel[sName](sValue);
};
// Set the rotation speed of the image
BusyIndicator.prototype._setRotationSpeed = function(){
if (!this._iconImage) {
return;
}
if (jQuery.support.cssAnimations) {
var $icon = this._iconImage.$();
var sRotationSpeed = this.getCustomIconRotationSpeed() + "ms";
$icon.css("-webkit-animation-duration", sRotationSpeed)
.css("animation-duration", sRotationSpeed);
//Bug in Chrome: After changing height of image -> changing the rotationspeed will have no affect
//chrome needs a rerendering of this element.
$icon.css("display", "none");
setTimeout(function() {
$icon.css("display", "inline");
}, 0);
} else { // IE9
this._rotateCustomIcon();
}
};
//Animate custom icon in IE9
BusyIndicator.prototype._rotateCustomIcon = function(){
if (!this._iconImage) {
return;
}
var $icon = this._iconImage.$();
// stop if the custom icon is not available or hidden:
if (!$icon[0] || !$icon[0].offsetWidth) {
return;
}
var iRotationSpeed = this.getCustomIconRotationSpeed();
if (!iRotationSpeed) {
return;
}
if (!this._fnRotateCustomIcon) {
this._fnRotateCustomIcon = jQuery.proxy(this._rotateCustomIcon, this);
}
var fnRotateCustomIcon = this._fnRotateCustomIcon;
if (!this._$CustomRotator) {
this._$CustomRotator = jQuery({deg: 0});
}
var $rotator = this._$CustomRotator;
if ($rotator.running) {
return;
}
// restart animation
$rotator[0].deg = 0;
$rotator.animate({deg: 360}, {
duration: iRotationSpeed,
easing: "linear",
step: function(now) {
$rotator.running = true;
$icon.css("-ms-transform", 'rotate(' + now + 'deg)');
},
complete: function(){
$rotator.running = false;
window.setTimeout(fnRotateCustomIcon, 10);
}
});
};
BusyIndicator.prototype.onBeforeRendering = function(){
this._cancelAnimation();
};
BusyIndicator.prototype.onAfterRendering = function(){
// SVG animates itself, canvas animates by JavaScript:
if (this._bUseCanvas) {
this._doCanvas();
} else {
this._setSvg();
}
};
BusyIndicator.prototype.setText = function(sText){
this.setProperty("text", sText, true);
this._createLabel("setText", sText);
return this;
};
BusyIndicator.prototype.setTextDirection = function(sDirection){
this.setProperty("textDirection", sDirection, true);
this._createLabel("setTextDirection", sDirection);
return this;
};
BusyIndicator.prototype.setCustomIcon = function(iSrc){
this.setProperty("customIcon", iSrc, false);
this._createCustomIcon("setSrc", iSrc);
return this;
};
BusyIndicator.prototype.setCustomIconRotationSpeed = function(iSpeed){
if (isNaN(iSpeed) || iSpeed < 0) {
iSpeed = 0;
}
if (iSpeed !== this.getCustomIconRotationSpeed()) {
this.setProperty("customIconRotationSpeed", iSpeed, true);
this._setRotationSpeed();
}
return this;
};
BusyIndicator.prototype.setCustomIconDensityAware = function(bAware){
this.setProperty("customIconDensityAware", bAware, true);
this._createCustomIcon("setDensityAware", bAware);
return this;
};
BusyIndicator.prototype.setCustomIconWidth = function(sWidth){
this.setProperty("customIconWidth", sWidth, true);
this._createCustomIcon("setWidth", sWidth);
return this;
};
BusyIndicator.prototype.setCustomIconHeight = function(sHeight){
this.setProperty("customIconHeight", sHeight, true);
this._createCustomIcon("setHeight", sHeight);
return this;
};
BusyIndicator.prototype.setDesign = function(sDesign) {
this.setProperty("design", sDesign, true);
this.$().toggleClass("sapMBusyIndicatorLight", (this.getDesign() === "light"));
this.$().toggleClass("sapMBusyIndicatorDark", (this.getDesign() === "dark"));
return this;
};
/**
* Setter for property <code>visible</code>.
*
* Default value is <code>true</code>
*
* The default implementation of the "setVisible" function is enhanced
* in order to toggle the "visibility:hidden;" attribute over the control.
*
* @param {boolean} bVisible new value for property <code>visible</code>
* @return {sap.m.BusyIndicator} <code>this</code> to allow method chaining
* @public
*/
BusyIndicator.prototype.setVisible = function(bVisible){
var oDomRef = this.getDomRef();
//only suppress rerendering when it's already rendered
this.setProperty("visible", bVisible, !!oDomRef);
if (oDomRef) {
this.getDomRef().style.visibility = bVisible ? "visible" : "hidden";
if (this._bUseCanvas) {
if (bVisible && !this._animationId) {
this._animateCanvas();
}
} else {
this._setSvg();
}
}
return this;
};
return BusyIndicator;
}, /* bExport= */ true);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,108 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global'],
function(jQuery) {
"use strict";
/**
* BusyIndicator renderer.
* @namespace
*/
var BusyIndicatorRenderer = {
};
/**
* Renders the HTML for the given control, using the provided {@link sap.ui.core.RenderManager}.
*
* @param {sap.ui.core.RenderManager} oRenderManager the RenderManager that can be used for writing to the Render-Output-Buffer
* @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered
*/
BusyIndicatorRenderer.render = function(oRm, oControl){
var sSize = oControl.getSize();
var iDesignClass = "";
if (oControl.getDesign() == "auto") {
iDesignClass = "sapMBusyIndicator";
} else {
iDesignClass = oControl.getDesign() == "dark" ? "sapMBusyIndicatorDark" : "sapMBusyIndicatorLight";
}
oRm.write("<div");
oRm.writeControlData(oControl);
oRm.addClass(iDesignClass);
oRm.writeClasses();
var sTooltip = oControl.getTooltip_AsString();
if (sTooltip) {
oRm.writeAttributeEscaped("title", sTooltip);
}
if (!oControl.getVisible()) {
oRm.addStyle("visibility", "hidden");
oRm.writeStyles();
}
oRm.writeAccessibilityState(oControl, {
role : "progressbar",
valuemin: "0", // required by the ARIA specification
valuemax: "100" // required by the ARIA specification
});
oRm.write(">");
if (oControl.getCustomIcon()) {
oRm.renderControl(oControl._iconImage);
} else if (oControl._bUseSvg) {
this._renderSvg(oRm, oControl, sSize);
} else {
this._renderCanvas(oRm, oControl, sSize);
}
if (oControl.getText()) {
oRm.renderControl(oControl._oLabel);
}
oRm.write("</div>");
};
// SVG based loading indicator
BusyIndicatorRenderer._renderSvg = function(oRm, oControl, sSize){
oRm.write('<svg');
oRm.writeAttribute('id', oControl.getId() + '-svg');
oRm.writeAttribute('viewBox','0 0 100 100');
oRm.writeAttribute('class','sapMBusySvg');
if (sSize) {
oRm.addStyle('width', sSize);
oRm.addStyle('height', sSize);
oRm.writeStyles();
}
oRm.write('><g transform = translate(50,50)>');
oRm.write('<path d="M0,-36A36,36 0 1,0 36,0" stroke-width="20%" fill="none" class="sapMSpinSvg">');
oRm.write('<animateTransform attributeName="transform" attributeType="XML" type="rotate" ');
oRm.write('from="0" to="360" dur="1.1s" repeatCount="indefinite" />');
oRm.write('</path></g></svg>');
};
// Canvas based loading indicator
BusyIndicatorRenderer._renderCanvas = function(oRm, oControl, sSize){
oRm.write('<canvas');
oRm.writeAttribute("id", oControl.getId() + "-canvas");
oRm.writeAttribute("class","sapMSpinCanvas");
oRm.writeAttribute("width","32"); // initially 2em * 16px
oRm.writeAttribute("height","32");
if (sSize) {
oRm.addStyle('width', sSize);
oRm.addStyle('height', sSize);
oRm.writeStyles();
}
oRm.write('></canvas>');
};
return BusyIndicatorRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global'],function(q){"use strict";var B={};B.render=function(r,c){var s=c.getSize();var d="";if(c.getDesign()=="auto"){d="sapMBusyIndicator";}else{d=c.getDesign()=="dark"?"sapMBusyIndicatorDark":"sapMBusyIndicatorLight";}r.write("<div");r.writeControlData(c);r.addClass(d);r.writeClasses();var t=c.getTooltip_AsString();if(t){r.writeAttributeEscaped("title",t);}if(!c.getVisible()){r.addStyle("visibility","hidden");r.writeStyles();}r.writeAccessibilityState(c,{role:"progressbar",valuemin:"0",valuemax:"100"});r.write(">");if(c.getCustomIcon()){r.renderControl(c._iconImage);}else if(c._bUseSvg){this._renderSvg(r,c,s);}else{this._renderCanvas(r,c,s);}if(c.getText()){r.renderControl(c._oLabel);}r.write("</div>");};B._renderSvg=function(r,c,s){r.write('<svg');r.writeAttribute('id',c.getId()+'-svg');r.writeAttribute('viewBox','0 0 100 100');r.writeAttribute('class','sapMBusySvg');if(s){r.addStyle('width',s);r.addStyle('height',s);r.writeStyles();}r.write('><g transform = translate(50,50)>');r.write('<path d="M0,-36A36,36 0 1,0 36,0" stroke-width="20%" fill="none" class="sapMSpinSvg">');r.write('<animateTransform attributeName="transform" attributeType="XML" type="rotate" ');r.write('from="0" to="360" dur="1.1s" repeatCount="indefinite" />');r.write('</path></g></svg>');};B._renderCanvas=function(r,c,s){r.write('<canvas');r.writeAttribute("id",c.getId()+"-canvas");r.writeAttribute("class","sapMSpinCanvas");r.writeAttribute("width","32");r.writeAttribute("height","32");if(s){r.addStyle('width',s);r.addStyle('height',s);r.writeStyles();}r.write('></canvas>');};return B;},true);

View File

@ -0,0 +1,707 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.Button.
sap.ui.define(['jquery.sap.global', './library', 'sap/ui/core/Control', 'sap/ui/core/EnabledPropagator', 'sap/ui/core/IconPool', 'sap/ui/core/theming/Parameters'],
function(jQuery, library, Control, EnabledPropagator, IconPool, Parameters) {
"use strict";
/**
* Constructor for a new Button.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* Enables users to trigger actions. For the button UI, you can define some text or an icon, or both.
* @extends sap.ui.core.Control
*
* @author SAP SE
* @version 1.28.5
*
* @constructor
* @public
* @alias sap.m.Button
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var Button = Control.extend("sap.m.Button", /** @lends sap.m.Button.prototype */ { metadata : {
library : "sap.m",
properties : {
/**
* Button text
*/
text : {type : "string", group : "Misc", defaultValue : null},
/**
* Type of a button (e.g. Default, Accept, Reject, Back, etc.)
*/
type : {type : "sap.m.ButtonType", group : "Appearance", defaultValue : sap.m.ButtonType.Default},
/**
* Defines the width of the button.
*/
width : {type : "sap.ui.core.CSSSize", group : "Misc", defaultValue : null},
/**
* Boolean property to enable the control (default is true). Buttons that are disabled have other colors than enabled ones, depending on custom settings
*/
enabled : {type : "boolean", group : "Behavior", defaultValue : true},
/**
* Icon to be displayed as graphical element within the button. This can be an image or an icon from the icon font.
*/
icon : {type : "sap.ui.core.URI", group : "Appearance", defaultValue : null},
/**
* If set to true (default), the display sequence is 1. icon 2. control text
*/
iconFirst : {type : "boolean", group : "Appearance", defaultValue : true},
/**
* The source property when this icon is tapped. Graphical element is changed to the new source as long as the icon is tapped.
*/
activeIcon : {type : "sap.ui.core.URI", group : "Misc", defaultValue : null},
/**
* By default, this is set to true but then one or more requests are sent trying to get the density perfect version of image if this version of image doesn't exist on the server.
*
* If only one version of image is provided, set this value to false to avoid the attempt of fetching density perfect image.
*/
iconDensityAware : {type : "boolean", group : "Misc", defaultValue : true},
/**
* This property specifies the element's text directionality with enumerated options. By default, the control inherits text direction from the DOM.
* @since 1.28.0
*/
textDirection : {type : "sap.ui.core.TextDirection", group : "Appearance", defaultValue : sap.ui.core.TextDirection.Inherit}
},
associations : {
/**
* Association to controls / ids which describe this control (see WAI-ARIA attribute aria-describedby).
*/
ariaDescribedBy : {type : "sap.ui.core.Control", multiple : true, singularName : "ariaDescribedBy"},
/**
* Association to controls / ids which label this control (see WAI-ARIA attribute aria-labelledby).
*/
ariaLabelledBy : {type : "sap.ui.core.Control", multiple : true, singularName : "ariaLabelledBy"}
},
events : {
/**
* Event is fired when the user taps the control.
* @deprecated Since version 1.20.0.
* This event is deprecated, use the press event instead.
*/
tap : {deprecated: true},
/**
* Event is fired when the user clicks on the control.
*/
press : {}
}
}});
EnabledPropagator.call(Button.prototype);
/**
* Function is called when exiting the control.
*
* @private
*/
Button.prototype.exit = function() {
// destroy image controls if initialized
if (this._image) {
this._image.destroy();
}
if (this._iconBtn) {
this._iconBtn.destroy();
}
};
/**
* Function is called when touchstart occurs on button .
* @param {jQuery.Event} oEvent - the touch event.
* @private
*/
Button.prototype.ontouchstart = function(oEvent) {
// mark the event for components that needs to know if the event was handled by the button
oEvent.setMarked();
// change the source only when the first finger is on the control, the
// following fingers doesn't affect
if (oEvent.targetTouches.length === 1) {
// set active button state
this._activeButton();
// set target which started the event
this._target = oEvent.target;
}
};
/**
* Function is called when touchend occurs on button .
* @param {jQuery.Event} oEvent - the touch event.
* @private
*/
Button.prototype.ontouchend = function() {
// set inactive button state
this._inactiveButton();
};
/**
* Function is called when touchcancel occurs .
* @param {jQuery.Event} oEvent - the touch event.
* @private
*/
Button.prototype.ontouchcancel = function() {
// set inactive button state
this._inactiveButton();
};
/**
* Function is called when tap occurs on button.
* @param {jQuery.Event} oEvent - the touch event.
* @private
*/
Button.prototype.ontap = function(oEvent) {
// mark the event for components that needs to know if the event was handled by the button
oEvent.setMarked();
// fire tap event
if (this.getEnabled()) {
// if target is empty set target (specially for selenium test)
if (!this._target) {
this._target = oEvent.target;
}
// check if target which started the event is the same
if ((!!this._target) && (this._target === oEvent.target)) {
this.fireTap({/* no parameters */}); // (This event is deprecated, use the "press" event instead)
this.firePress({/* no parameters */});
}
}
// reset target which started the event
delete this._target;
};
/**
* Handle the key down event for SPACE and ENTER.
* This implementation differs from that of commons button.
* Commons listens to the click event and ignores touchstart.
* @param {jQuery.Event} oEvent - the keyboard event.
* @private
*/
Button.prototype.onkeydown = function(oEvent) {
if (oEvent.which === jQuery.sap.KeyCodes.SPACE || oEvent.which === jQuery.sap.KeyCodes.ENTER) {
// mark the event for components that needs to know if the event was handled by the button
oEvent.setMarked();
// set active button state
this._activeButton();
// set target which started the event
this._target = oEvent.target;
}
};
/**
* Handle the key up event for SPACE and ENTER.
*
* @param {jQuery.Event} oEvent - the keyboard event.
* @private
*/
Button.prototype.onkeyup = function(oEvent) {
// if keydown isn't caught by button, ignore the keyup.
if (!this._target) {
return;
}
this._target = null;
if (oEvent.which === jQuery.sap.KeyCodes.SPACE || oEvent.which === jQuery.sap.KeyCodes.ENTER) {
// mark the event for components that needs to know if the event was handled by the button
oEvent.setMarked();
// set inactive button state
this._inactiveButton();
this.firePress({/* no parameters */});
}
};
/**
* Ensure that the active button state is removed by focus loss.
*
* @param {jQuery.Event} oEvent - the focus event
* @private
*/
Button.prototype.onfocusout = function() {
// set inactive button state
this._inactiveButton();
};
/**
* Function is called when button is active.
*
* @private
*/
Button.prototype._activeButton = function() {
if (!this._isUnstyled()) {
this.$("inner").addClass("sapMBtnActive");
}
// handling active icon
if (this.getEnabled()) {
if (this.getIcon() && this.getActiveIcon() && this._image instanceof sap.m.Image) {
this._image.setSrc(this.getActiveIcon());
}
}
};
/**
* Function is called when button is inactive.
*
* @private
*/
Button.prototype._inactiveButton = function() {
if (!this._isUnstyled()) {
this.$("inner").removeClass("sapMBtnActive");
}
// handling active icon
if (this.getEnabled()) {
if (this.getIcon() && this.getActiveIcon() && this._image instanceof sap.m.Image) {
this._image.setSrc(this.getIcon());
}
}
};
/**
* Function to determine if the button is hoverable
*
* @return {sap.m.Button} this to allow method chaining
* @private
*/
Button.prototype._isHoverable = function() {
return this.getEnabled() && sap.ui.Device.system.desktop;
};
/**
* Function is called when image control needs to be loaded.
*
* @param {string} sImgId - id to be used for the image
* @param {sap.ui.core.URI} sSrc - URI indicating the image to use as image source
* @param {sap.ui.core.URI} sActiveSrc - URI indicating the image to use as active image source
* @param {boolean} bIconDensityAware - value for DensityAware attribute of images
* @return {sap.m.Button} this to allow method chaining
* @private
*/
Button.prototype._getImage = function(sImgId, sSrc, sActiveSrc, bIconDensityAware) {
// check if image source has changed - if yes destroy and reset image control
if (this._image && (this._image.getSrc() !== sSrc)) {
this._image.destroy();
this._image = undefined;
}
// update or create image control
var oImage = this._image;
if (!!oImage) {
oImage.setSrc(sSrc);
if (oImage instanceof sap.m.Image) {
oImage.setActiveSrc(sActiveSrc);
oImage.setDensityAware(bIconDensityAware);
}
} else {
oImage = IconPool.createControlByURI({
id: sImgId,
src : sSrc,
activeSrc : sActiveSrc,
densityAware : bIconDensityAware
}, sap.m.Image).addStyleClass("sapMBtnCustomIcon").setParent(this, null, true);
}
// add style classes to the object
oImage.addStyleClass("sapMBtnIcon");
// remove previous set style classes
if (oImage.hasStyleClass("sapMBtnIconLeft")) {
oImage.removeStyleClass("sapMBtnIconLeft");
}
if (oImage.hasStyleClass("sapMBtnIconRight")) {
oImage.removeStyleClass("sapMBtnIconRight");
}
if (oImage.hasStyleClass("sapMBtnBackIconLeft")) {
oImage.removeStyleClass("sapMBtnBackIconLeft");
}
if (this._getText()) {
// check and set absolute position depending on icon and icon position
if (this.getIconFirst()) {
if (this.getType() === sap.m.ButtonType.Back || this.getType() === sap.m.ButtonType.Up) {
oImage.addStyleClass("sapMBtnBackIconLeft");
} else {
oImage.addStyleClass("sapMBtnIconLeft");
}
} else {
oImage.addStyleClass("sapMBtnIconRight");
}
}
this._image = oImage;
return this._image;
};
/**
* Function is called when internal image control needs to be loaded.
*
* @param {string} sImgId - id to be used for the image
* @param {sap.ui.core.URI} sSrc - URI indicating the image to use as image source
* @return {sap.m.Button} this to allow method chaining
* @private
*/
Button.prototype._getInternalIconBtn = function(sImgId, sSrc) {
var oIcon = this._iconBtn;
// update or create image control
if (!!oIcon) {
oIcon.setSrc(sSrc);
} else {
oIcon = IconPool.createControlByURI(sSrc, sap.m.Image);
}
// add style classes to the object
oIcon.addStyleClass("sapMBtnIcon");
if (this._getText()) {
oIcon.addStyleClass("sapMBtnIconLeft");
}
this._iconBtn = oIcon;
return this._iconBtn;
};
/**
* Function is called to determine if the button is.unstyled
*
* @return {sap.m.Button} this to allow method chaining
* @private
*/
Button.prototype._isUnstyled = function() {
var bUnstyled = false;
if (this.getType() === sap.m.ButtonType.Unstyled) {
bUnstyled = true;
}
return bUnstyled;
};
/**
* Property setter for the text
*
* @param {string} sText - new value of the Text attribute
* @return {sap.m.Button} this to allow method chaining
* @public
*/
Button.prototype.setText = function(sText) {
var sValue = this.getText();
if (sText === null || sText === undefined) {
sText = "";
}
if (sValue !== sText) {
var oDomRef = this.getDomRef("content");
var bShouldSupressRendering = !!oDomRef;
// Render control if element is not available in the DOM
this.setProperty("text", sText, bShouldSupressRendering);
if (bShouldSupressRendering) {
// Get text to have the type conversation for non-string values done by the framework
sText = this.getText();
oDomRef.innerHTML = jQuery.sap.escapeHTML(sText);
// Check if an icon is set
if (this.getIcon()) {
// Remove all text padding classes
this._removeTextPadding();
// Add the text padding classes
if (sText.length > 0) {
this._addTextPadding(this.getIconFirst());
}
// extend minimum button size if icon is set without text for button types back and up
if (this.$().hasClass("sapMBtnBack")) {
this.$().removeClass("sapMBtnBack");
}
if ((this.getType() === sap.m.ButtonType.Back || this.getType() === sap.m.ButtonType.Up) && this.getIcon() && !this.getText()) {
this.$().addClass("sapMBtnBack");
}
}
}
}
return this;
};
/**
* Property setter for the icon
*
* @param {sap.ui.core.URI} sIcon - new value of the Icon property
* @return {sap.m.Button} this to allow method chaining
* @public
*/
Button.prototype.setIcon = function(sIcon) {
var sValue = this.getIcon();
if (sIcon === null || sIcon === undefined) {
sIcon = "";
}
if (sValue !== sIcon) {
var oDomRef = this.getDomRef("img");
var bShouldSupressRendering = !!oDomRef;
// Check if old and new icon URI is equal
if (IconPool.isIconURI(sIcon) === IconPool.isIconURI(sValue)) {
bShouldSupressRendering = true;
} else {
bShouldSupressRendering = false;
}
// Control needs to be re-rendered when icon should be removed
if (sIcon.length === 0) {
bShouldSupressRendering = false;
}
// Render control if element is not available in the DOM
this.setProperty("icon", sIcon, bShouldSupressRendering);
if (bShouldSupressRendering && this._image) {
this._image.setSrc(sIcon);
}
}
return this;
};
/**
* Property setter for the icon first
*
* @param {boolean} bIconFirst - true IFF the icon goes before the text
* @return {sap.m.Button} this to allow method chaining
* @public
*/
Button.prototype.setIconFirst = function(bIconFirst) {
var sValue = this.getIconFirst();
if (sValue !== bIconFirst) {
var oDomRef = this.getDomRef("img");
var bShouldSupressRendering = !!oDomRef;
// Render control if element is not available in the DOM
this.setProperty("iconFirst", bIconFirst, bShouldSupressRendering);
if (bShouldSupressRendering) {
// remove previous set style classes
if (this.$("img").hasClass("sapMBtnIconLeft")) {
this.$("img").removeClass("sapMBtnIconLeft");
}
if (this.$("img").hasClass("sapMBtnIconRight")) {
this.$("img").removeClass("sapMBtnIconRight");
}
if (this.$("img").hasClass("sapMBtnBackIconLeft")) {
this.$("img").removeClass("sapMBtnBackIconLeft");
}
if (this.$("content").hasClass("sapMBtnContentLeft")) {
this.$("content").removeClass("sapMBtnContentLeft");
}
if (this.$("content").hasClass("sapMBtnContentRight")) {
this.$("content").removeClass("sapMBtnContentRight");
}
if (this.$("content").hasClass("sapMBtnBackContentRight")) {
this.$("content").removeClass("sapMBtnBackContentRight");
}
if (this._getText()) {
// check and set absolute position depending on icon and icon position
if (bIconFirst) {
if (this.getType() === sap.m.ButtonType.Back || this.getType() === sap.m.ButtonType.Up) {
this.$("img").addClass("sapMBtnBackIconLeft");
this.$("content").addClass("sapMBtnBackContentRight");
} else {
this.$("img").addClass("sapMBtnIconLeft");
this.$("content").addClass("sapMBtnContentRight");
}
} else {
if (this.getType() === sap.m.ButtonType.Back || this.getType() === sap.m.ButtonType.Up) {
this.$("content").addClass("sapMBtnContentRight");
} else {
this.$("content").addClass("sapMBtnContentLeft");
}
this.$("img").addClass("sapMBtnIconRight");
}
}
// Remove all text padding classes
this._removeTextPadding();
// Add the text padding classes
if (this._getText().length > 0) {
this._addTextPadding(bIconFirst);
}
}
}
return this;
};
/**
* Function is called to remove the padding classes for the text
*
* @private
*/
Button.prototype._removeTextPadding = function() {
// Search and remove padding classes
if (this.$("inner").hasClass("sapMBtnPaddingLeft")) {
this.$("inner").removeClass("sapMBtnPaddingLeft");
} else if (this.$("inner").hasClass("sapMBtnPaddingRight")) {
this.$("inner").removeClass("sapMBtnPaddingRight");
}
// Search and remove padding between icon and text
if (!this._getText()) {
if (this.$("content").hasClass("sapMBtnContentLeft")) {
this.$("content").removeClass("sapMBtnContentLeft");
}
if (this.$("content").hasClass("sapMBtnContentRight")) {
this.$("content").removeClass("sapMBtnContentRight");
}
if (this.$("content").hasClass("sapMBtnBackContentRight")) {
this.$("content").removeClass("sapMBtnBackContentRight");
}
}
};
/**
* Function is called to add the padding classes for the text
*
* @param {boolean} bIconFirst - true IFF the icon goes before the text
* @private
*/
Button.prototype._addTextPadding = function( bIconFirst) {
var sType = this.getType();
// Add text padding classes
if (bIconFirst) {
this.$("inner").addClass("sapMBtnPaddingRight");
} else if (sType != sap.m.ButtonType.Back && sType != sap.m.ButtonType.Up) {
this.$("inner").addClass("sapMBtnPaddingLeft");
}
// Add text padding classes between icon and text
if (this._getText()) {
if (this.getIcon()) {
if (this.getIconFirst()) {
if (this.getType() === sap.m.ButtonType.Back || this.getType() === sap.m.ButtonType.Up) {
this.$("content").addClass("sapMBtnBackContentRight");
} else {
this.$("content").addClass("sapMBtnContentRight");
}
} else {
if (this.getType() === sap.m.ButtonType.Back || this.getType() === sap.m.ButtonType.Up) {
this.$("content").addClass("sapMBtnContentRight");
}
this.$("content").addClass("sapMBtnContentLeft");
}
} else if (this.getType() === sap.m.ButtonType.Back || this.getType() === sap.m.ButtonType.Up) {
this.$("content").addClass("sapMBtnContentRight");
}
}
};
/**
* Defines to which DOM reference the Popup should be docked
*
* @protected
* @return {DomNode} the DOM reference that Popup should dock to
*/
Button.prototype.getPopupAnchorDomRef = function() {
return this.getDomRef("inner");
};
// A hook to be used by controls that extend sap.m.Button and want to display the text in a different way
Button.prototype._getText = function() {
return this.getText();
};
Button.prototype.setType = function(sType) {
this.setProperty("type", sType);
// Aria desciption for type
var sTypeText = "";
var oRb;
switch (sType) {
case sap.m.ButtonType.Accept:
if (!sap.m.Button._oStaticAcceptText) {
oRb = sap.ui.getCore().getLibraryResourceBundle("sap.m");
sTypeText = oRb.getText("BUTTON_ARIA_TYPE_ACCEPT");
sap.m.Button._oStaticAcceptText = new sap.ui.core.InvisibleText({text: sTypeText});
sap.m.Button._oStaticAcceptText.toStatic(); //Put to Static UiArea
}
break;
case sap.m.ButtonType.Reject:
if (!sap.m.Button._oStaticRejectText) {
oRb = sap.ui.getCore().getLibraryResourceBundle("sap.m");
sTypeText = oRb.getText("BUTTON_ARIA_TYPE_REJECT");
sap.m.Button._oStaticRejectText = new sap.ui.core.InvisibleText({text: sTypeText});
sap.m.Button._oStaticRejectText.toStatic(); //Put to Static UiArea
}
break;
case sap.m.ButtonType.Emphasized:
if (!sap.m.Button._oStaticEmphasizedText) {
oRb = sap.ui.getCore().getLibraryResourceBundle("sap.m");
sTypeText = oRb.getText("BUTTON_ARIA_TYPE_EMPHASIZED");
sap.m.Button._oStaticEmphasizedText = new sap.ui.core.InvisibleText({text: sTypeText});
sap.m.Button._oStaticEmphasizedText.toStatic(); //Put to Static UiArea
}
break;
default: // No need to do anything for other button types
break;
}
return this;
};
return Button;
}, /* bExport= */ true);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,250 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global'],
function(jQuery) {
"use strict";
/**
* Button renderer.
* @namespace
*/
var ButtonRenderer = {};
/**
* Renders the HTML for the given control, using the provided
* {@link sap.ui.core.RenderManager}.
*
* @param {sap.ui.core.RenderManager} oRm
* the RenderManager that can be used for writing to
* the Render-Output-Buffer
* @param {sap.ui.core.Control} oButton
* the button to be rendered
*/
ButtonRenderer.render = function(oRm, oButton) {
// get control properties
var sType = oButton.getType();
var bEnabled = oButton.getEnabled();
var sWidth = oButton.getWidth();
var sTooltip = oButton.getTooltip_AsString();
var sTextDir = oButton.getTextDirection();
// get icon from icon pool
var sBackURI = sap.ui.core.IconPool.getIconURI("nav-back");
// start button tag
oRm.write("<button type=\"button\"");
oRm.writeControlData(oButton);
// button container style class
if (!oButton._isUnstyled()) {
oRm.addClass("sapMBtn");
// extend minimum button size if icon is set without text for button types back and up
if ((sType === sap.m.ButtonType.Back || sType === sap.m.ButtonType.Up) && oButton.getIcon() && !oButton._getText()) {
oRm.addClass("sapMBtnBack");
}
}
//ARIA attributes
var mAccProps = {};
var sTextId = "";
switch (sType) {
case sap.m.ButtonType.Accept:
sTextId = sap.m.Button._oStaticAcceptText.getId();
break;
case sap.m.ButtonType.Reject:
sTextId = sap.m.Button._oStaticRejectText.getId();
break;
case sap.m.ButtonType.Emphasized:
sTextId = sap.m.Button._oStaticEmphasizedText.getId();
break;
default: // No need to do anything for other button types
break;
}
if (sTextId) {
mAccProps["describedby"] = {value: sTextId, append: true};
}
//descendants (e.g. ToggleButton) callback
if (this.renderAccessibilityAttributes) {
this.renderAccessibilityAttributes(oRm, oButton, mAccProps);
}
oRm.writeAccessibilityState(oButton, mAccProps);
// check if the button is disabled
if (!bEnabled) {
oRm.writeAttribute("disabled", "disabled");
if (!oButton._isUnstyled()) {
oRm.addClass("sapMBtnDisabled");
}
} else {
switch (sType) {
case sap.m.ButtonType.Accept:
case sap.m.ButtonType.Reject:
case sap.m.ButtonType.Emphasized:
oRm.addClass("sapMBtnInverted");
break;
default: // No need to do anything for other button types
break;
}
}
// add tooltip if available
if (sTooltip) {
oRm.writeAttributeEscaped("title", sTooltip);
}
oRm.writeClasses();
// set user defined width
if (sWidth != "" || sWidth.toLowerCase() === "auto") {
oRm.addStyle("width", sWidth);
oRm.writeStyles();
}
// close button tag
oRm.write(">");
// start inner button tag
oRm.write("<div");
oRm.writeAttribute("id", oButton.getId() + "-inner");
// button style class
if (!oButton._isUnstyled()) {
oRm.addClass("sapMBtnInner");
}
// check if button is hoverable
if (oButton._isHoverable()) {
oRm.addClass("sapMBtnHoverable");
}
// check if button is focusable (not disabled)
if (bEnabled) {
oRm.addClass("sapMFocusable");
}
//get render attributes of depended buttons (e.g. ToggleButton)
if (this.renderButtonAttributes) {
this.renderButtonAttributes(oRm, oButton);
}
// set padding depending on icons left or right or none
if (!oButton._isUnstyled()) {
if (!oButton.getIcon()) {
if (sType != sap.m.ButtonType.Back && sType != sap.m.ButtonType.Up) {
oRm.addClass("sapMBtnPaddingLeft");
}
if (oButton._getText()) {
oRm.addClass("sapMBtnPaddingRight");
}
} else {
if (oButton.getIcon() && oButton._getText() && oButton.getIconFirst()) {
oRm.addClass("sapMBtnPaddingRight");
}
if (oButton.getIcon() && oButton._getText() && !oButton.getIconFirst()) {
if (sType != sap.m.ButtonType.Back && sType != sap.m.ButtonType.Up) {
oRm.addClass("sapMBtnPaddingLeft");
}
}
}
}
// set button specific styles
if (!oButton._isUnstyled() && sType !== "") {
// set button specific styles
oRm.addClass("sapMBtn" + jQuery.sap.escapeHTML(sType));
}
// add all classes to inner button tag
oRm.writeClasses();
// close inner button tag
oRm.write(">");
// set image for internal image control (back)
if (sType === sap.m.ButtonType.Back || sType === sap.m.ButtonType.Up) {
this.writeInternalIconPoolHtml(oRm, oButton, sBackURI);
}
// write icon
if (oButton.getIcon()) {
this.writeImgHtml(oRm, oButton);
}
// write button text
if (oButton._getText()) {
oRm.write("<span");
oRm.addClass("sapMBtnContent");
// check if textDirection property is not set to default "Inherit" and add "dir" attribute
if (sTextDir !== sap.ui.core.TextDirection.Inherit) {
oRm.writeAttribute("dir", sTextDir.toLowerCase());
}
// Check and add padding between icon and text
if (oButton.getIcon()) {
if (oButton.getIconFirst()) {
if (sType === sap.m.ButtonType.Back || sType === sap.m.ButtonType.Up) {
oRm.addClass("sapMBtnBackContentRight");
} else {
oRm.addClass("sapMBtnContentRight");
}
} else {
if (sType === sap.m.ButtonType.Back || sType === sap.m.ButtonType.Up) {
oRm.addClass("sapMBtnContentRight");
}
oRm.addClass("sapMBtnContentLeft");
}
} else if (sType === sap.m.ButtonType.Back || sType === sap.m.ButtonType.Up) {
oRm.addClass("sapMBtnContentRight");
}
oRm.writeClasses();
oRm.writeAttribute("id", oButton.getId() + "-content");
oRm.write(">");
oRm.writeEscaped(oButton._getText());
oRm.write("</span>");
}
// end inner button tag
oRm.write("</div>");
// end button tag
oRm.write("</button>");
};
/**
* HTML for image
*
* @param {sap.ui.core.RenderManager} oRm
* the RenderManager that can be used for writing to
* the Render-Output-Buffer
* @param {sap.ui.core.Control} oButton
* the button to be rendered
* @private
*/
ButtonRenderer.writeImgHtml = function(oRm, oButton) {
oRm.renderControl(oButton._getImage((oButton.getId() + "-img"), oButton.getIcon(), oButton.getActiveIcon(), oButton.getIconDensityAware()));
};
/**
* @param {sap.ui.core.RenderManager} oRm
* the RenderManager that can be used for writing to
* the Render-Output-Buffer
* @param {sap.ui.core.Control} oButton
* the button to be rendered
* @param {sap.ui.core.URI} sURI
* URI of the icon to be written
* HTML for internal image (icon pool)
*/
ButtonRenderer.writeInternalIconPoolHtml = function(oRm, oButton, sURI) {
oRm.renderControl(oButton._getInternalIconBtn((oButton.getId() + "-iconBtn"), sURI));
};
return ButtonRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global'],function(q){"use strict";var B={};B.render=function(r,b){var t=b.getType();var e=b.getEnabled();var w=b.getWidth();var T=b.getTooltip_AsString();var s=b.getTextDirection();var a=sap.ui.core.IconPool.getIconURI("nav-back");r.write("<button type=\"button\"");r.writeControlData(b);if(!b._isUnstyled()){r.addClass("sapMBtn");if((t===sap.m.ButtonType.Back||t===sap.m.ButtonType.Up)&&b.getIcon()&&!b._getText()){r.addClass("sapMBtnBack");}}var A={};var c="";switch(t){case sap.m.ButtonType.Accept:c=sap.m.Button._oStaticAcceptText.getId();break;case sap.m.ButtonType.Reject:c=sap.m.Button._oStaticRejectText.getId();break;case sap.m.ButtonType.Emphasized:c=sap.m.Button._oStaticEmphasizedText.getId();break;default:break;}if(c){A["describedby"]={value:c,append:true};}if(this.renderAccessibilityAttributes){this.renderAccessibilityAttributes(r,b,A);}r.writeAccessibilityState(b,A);if(!e){r.writeAttribute("disabled","disabled");if(!b._isUnstyled()){r.addClass("sapMBtnDisabled");}}else{switch(t){case sap.m.ButtonType.Accept:case sap.m.ButtonType.Reject:case sap.m.ButtonType.Emphasized:r.addClass("sapMBtnInverted");break;default:break;}}if(T){r.writeAttributeEscaped("title",T);}r.writeClasses();if(w!=""||w.toLowerCase()==="auto"){r.addStyle("width",w);r.writeStyles();}r.write(">");r.write("<div");r.writeAttribute("id",b.getId()+"-inner");if(!b._isUnstyled()){r.addClass("sapMBtnInner");}if(b._isHoverable()){r.addClass("sapMBtnHoverable");}if(e){r.addClass("sapMFocusable");}if(this.renderButtonAttributes){this.renderButtonAttributes(r,b);}if(!b._isUnstyled()){if(!b.getIcon()){if(t!=sap.m.ButtonType.Back&&t!=sap.m.ButtonType.Up){r.addClass("sapMBtnPaddingLeft");}if(b._getText()){r.addClass("sapMBtnPaddingRight");}}else{if(b.getIcon()&&b._getText()&&b.getIconFirst()){r.addClass("sapMBtnPaddingRight");}if(b.getIcon()&&b._getText()&&!b.getIconFirst()){if(t!=sap.m.ButtonType.Back&&t!=sap.m.ButtonType.Up){r.addClass("sapMBtnPaddingLeft");}}}}if(!b._isUnstyled()&&t!==""){r.addClass("sapMBtn"+q.sap.escapeHTML(t));}r.writeClasses();r.write(">");if(t===sap.m.ButtonType.Back||t===sap.m.ButtonType.Up){this.writeInternalIconPoolHtml(r,b,a);}if(b.getIcon()){this.writeImgHtml(r,b);}if(b._getText()){r.write("<span");r.addClass("sapMBtnContent");if(s!==sap.ui.core.TextDirection.Inherit){r.writeAttribute("dir",s.toLowerCase());}if(b.getIcon()){if(b.getIconFirst()){if(t===sap.m.ButtonType.Back||t===sap.m.ButtonType.Up){r.addClass("sapMBtnBackContentRight");}else{r.addClass("sapMBtnContentRight");}}else{if(t===sap.m.ButtonType.Back||t===sap.m.ButtonType.Up){r.addClass("sapMBtnContentRight");}r.addClass("sapMBtnContentLeft");}}else if(t===sap.m.ButtonType.Back||t===sap.m.ButtonType.Up){r.addClass("sapMBtnContentRight");}r.writeClasses();r.writeAttribute("id",b.getId()+"-content");r.write(">");r.writeEscaped(b._getText());r.write("</span>");}r.write("</div>");r.write("</button>");};B.writeImgHtml=function(r,b){r.renderControl(b._getImage((b.getId()+"-img"),b.getIcon(),b.getActiveIcon(),b.getIconDensityAware()));};B.writeInternalIconPoolHtml=function(r,b,u){r.renderControl(b._getInternalIconBtn((b.getId()+"-iconBtn"),u));};return B;},true);

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,148 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global'],
function(jQuery) {
"use strict";
/**
* Carousel renderer.
* @namespace
*/
var CarouselRenderer = {
};
/**
* Renders the Carousel's HTML, using the provided {@link sap.ui.core.RenderManager}.
*
* @param {sap.ui.core.RenderManager} oRm the RenderManager that can be used for writing to the render output buffer
* @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered
*/
CarouselRenderer.render = function(rm, oCarousel){
//Outer carousel div
rm.write("<div");
rm.writeControlData(oCarousel);
// custom F6 handling
rm.writeAttribute("data-sap-ui-customfastnavgroup", "true");
rm.addStyle("width", oCarousel.getWidth());
rm.addStyle("height", oCarousel.getHeight());
rm.writeStyles();
rm.addClass("sapMCrsl");
//'sapMCrslFluid' is originally from mobify-carousel
rm.addClass("sapMCrslFluid");
// add all classes (also custom classes) to carousel tag
rm.writeClasses();
var sTooltip = oCarousel.getTooltip_AsString();
if (sTooltip) {
rm.writeAttributeEscaped("title", sTooltip);
}
rm.writeAttributeEscaped("tabindex","0");
// ARIA
rm.writeAccessibilityState(oCarousel, {
role: "list"
});
rm.write(">");
var aPages = oCarousel.getPages();
var iPageCount = aPages.length;
var sPageIndicatorPlacement = oCarousel.getShowPageIndicator() ?
oCarousel.getPageIndicatorPlacement() : null;
//visual indicator
if (sPageIndicatorPlacement === sap.m.PlacementType.Top) {
this._renderPageIndicator(rm, iPageCount);
}
//inner carousel div
rm.write("<div class='sapMCrslInner'>");
//do housekeeping
oCarousel._cleanUpScrollContainer();
var fnRenderPage = function(oPage, iIndex) {
//item div
rm.write("<div class='sapMCrslItem");
if (sPageIndicatorPlacement === sap.m.PlacementType.Bottom) {
rm.write(" sapMCrslBottomOffset");
}
rm.write("' id='" + oCarousel.sId + "-" + oPage.sId + "-slide'");
// ARIA
rm.writeAccessibilityState(oPage, {
role:"listitem"
});
rm.write(">");
rm.renderControl(oCarousel._createScrollContainer(oPage, iIndex));
rm.write("</div>");
};
//Render Pages
aPages.forEach(fnRenderPage);
rm.write("</div>");
//inner div ends
if (sap.ui.Device.system.desktop && iPageCount > 1) {
//heads up controls for desktop browsers
rm.write("<div class='sapMCrslControls sapMCrslHud'>");
rm.write("<a class='sapMCrslPrev' href='#' data-slide='prev' tabindex='-1'><div class='sapMCrslHudInner'>");
rm.renderControl(oCarousel._getNavigationArrow('left'));
rm.write("</div></a>");
rm.write("<a class='sapMCrslNext' href='#' data-slide='next' tabindex='-1'><div class='sapMCrslHudInner'>");
rm.renderControl(oCarousel._getNavigationArrow('right'));
rm.write("</div></a>");
rm.write("</div>");
}
//visual indicator
if (sPageIndicatorPlacement === sap.m.PlacementType.Bottom) {
this._renderPageIndicator(rm, iPageCount, true);
}
rm.write("</div>");
//page-wrap ends
};
/**
* Renders the page indicator, using the provided {@link sap.ui.core.RenderManager}.
* Page indicator is only rendered if there is more than one carousel page
*
* @param {sap.ui.core.RenderManager} oRm the RenderManager that can be used for writing to the render output buffer
* @param aPages array of controls to be rendered
* @private
*/
CarouselRenderer._renderPageIndicator = function(rm, iPageCount, bBottom){
var oResourceBundle = sap.ui.getCore().getLibraryResourceBundle('sap.m');
//page indicator div
if (iPageCount > 1) {
rm.write("<div class='sapMCrslControls sapMCrslBulleted" +
(bBottom ? " sapMCrslBottomOffset" : "") +
"'>");
for ( var i = 1; i <= iPageCount; i++) {
//item span
rm.write("<span role='img' data-slide=" + i + " aria-label='" + oResourceBundle.getText('CAROUSEL_POSITION', [i, iPageCount]) + "'>" + i + "</span>");
}
rm.write("</div>");
}
};
return CarouselRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global'],function(q){"use strict";var C={};C.render=function(r,c){r.write("<div");r.writeControlData(c);r.writeAttribute("data-sap-ui-customfastnavgroup","true");r.addStyle("width",c.getWidth());r.addStyle("height",c.getHeight());r.writeStyles();r.addClass("sapMCrsl");r.addClass("sapMCrslFluid");r.writeClasses();var t=c.getTooltip_AsString();if(t){r.writeAttributeEscaped("title",t);}r.writeAttributeEscaped("tabindex","0");r.writeAccessibilityState(c,{role:"list"});r.write(">");var p=c.getPages();var P=p.length;var s=c.getShowPageIndicator()?c.getPageIndicatorPlacement():null;if(s===sap.m.PlacementType.Top){this._renderPageIndicator(r,P);}r.write("<div class='sapMCrslInner'>");c._cleanUpScrollContainer();var R=function(o,i){r.write("<div class='sapMCrslItem");if(s===sap.m.PlacementType.Bottom){r.write(" sapMCrslBottomOffset");}r.write("' id='"+c.sId+"-"+o.sId+"-slide'");r.writeAccessibilityState(o,{role:"listitem"});r.write(">");r.renderControl(c._createScrollContainer(o,i));r.write("</div>");};p.forEach(R);r.write("</div>");if(sap.ui.Device.system.desktop&&P>1){r.write("<div class='sapMCrslControls sapMCrslHud'>");r.write("<a class='sapMCrslPrev' href='#' data-slide='prev' tabindex='-1'><div class='sapMCrslHudInner'>");r.renderControl(c._getNavigationArrow('left'));r.write("</div></a>");r.write("<a class='sapMCrslNext' href='#' data-slide='next' tabindex='-1'><div class='sapMCrslHudInner'>");r.renderControl(c._getNavigationArrow('right'));r.write("</div></a>");r.write("</div>");}if(s===sap.m.PlacementType.Bottom){this._renderPageIndicator(r,P,true);}r.write("</div>");};C._renderPageIndicator=function(r,p,b){var R=sap.ui.getCore().getLibraryResourceBundle('sap.m');if(p>1){r.write("<div class='sapMCrslControls sapMCrslBulleted"+(b?" sapMCrslBottomOffset":"")+"'>");for(var i=1;i<=p;i++){r.write("<span role='img' data-slide="+i+" aria-label='"+R.getText('CAROUSEL_POSITION',[i,p])+"'>"+i+"</span>");}r.write("</div>");}};return C;},true);

View File

@ -0,0 +1,286 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.CheckBox.
sap.ui.define(['jquery.sap.global', './Label', './library', 'sap/ui/core/Control', 'sap/ui/core/EnabledPropagator'],
function(jQuery, Label, library, Control, EnabledPropagator) {
"use strict";
/**
* Constructor for a new CheckBox.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* CheckBox control
* @extends sap.ui.core.Control
*
* @author SAP SE
* @version 1.28.5
*
* @constructor
* @public
* @alias sap.m.CheckBox
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var CheckBox = Control.extend("sap.m.CheckBox", /** @lends sap.m.CheckBox.prototype */ { metadata : {
library : "sap.m",
properties : {
/**
* Contains the state of the control whether it is flagged with a check mark, or not
*/
selected : {type : "boolean", group : "Data", defaultValue : false},
/**
* Using this property, the control could be disabled, if required.
*/
enabled : {type : "boolean", group : "Behavior", defaultValue : true},
/**
* The 'name' property to be used in the HTML code, for example for HTML forms that send data to the server via submit.
*/
name : {type : "string", group : "Misc", defaultValue : null},
/**
* Defines the text displayed next to the check box
*/
text : {type : "string", group : "Appearance", defaultValue : null},
/**
* Options for the text direction are RTL and LTR. Alternatively, the control can inherit the text direction from its parent container.
*/
textDirection : {type : "sap.ui.core.TextDirection", group : "Appearance", defaultValue : sap.ui.core.TextDirection.Inherit},
/**
* Aligns the text of the checkbox. Available alignment settings are "Begin", "Center", "End", "Left", and "Right".
*/
textAlign : {type : "sap.ui.core.TextAlign", group : "Appearance", defaultValue : sap.ui.core.TextAlign.Begin},
/**
* Width of Label
*/
width : {type : "sap.ui.core.CSSSize", group : "Dimension", defaultValue : ''},
/**
* this is a flag to switch on activeHandling, when it is switched off, there will not be visual changes on active state. Default value is 'true'
*/
activeHandling : {type : "boolean", group : "Misc", defaultValue : true},
/**
* Specifies whether the user shall be allowed to select the check box
* @since 1.25
*/
editable : {type : "boolean", group : "Behavior", defaultValue : true}
},
associations : {
/**
* Association to controls / ids which describe this control (see WAI-ARIA attribute aria-describedby).
*/
ariaDescribedBy: {type: "sap.ui.core.Control", multiple: true, singularName: "ariaDescribedBy"},
/**
* Association to controls / ids which label this control (see WAI-ARIA attribute aria-labelledby).
*/
ariaLabelledBy: {type: "sap.ui.core.Control", multiple: true, singularName: "ariaLabelledBy"}
},
events : {
/**
* Event is triggered when the control status is changed by the user by selecting or deselecting the checkbox.
*/
select : {
parameters : {
/**
* Checks whether the CheckBox is flagged or not flagged.
*/
selected : {type : "boolean"}
}
}
}
}});
EnabledPropagator.call(CheckBox.prototype);
CheckBox.prototype.init = function() {
this.addActiveState(this);
jQuery.sap.require("sap.ui.core.IconPool");
sap.ui.core.IconPool.insertFontFaceStyle();
};
CheckBox.prototype.onAfterRendering = function() {
if (!this.getText() && !this.$().attr("aria-labelledby")) {
this.$().attr("aria-label", " ");
}
};
/**
* Called when the control is touched.
*
* @private
*/
CheckBox.prototype.ontouchstart = function(oEvent) {
//for control who need to know if they should handle events from the CheckBox control
oEvent.originalEvent._sapui_handledByControl = true;
};
CheckBox.prototype.setSelected = function(bSelected) {
bSelected = !!bSelected;
if (bSelected == this.getSelected()) {
return this;
}
this.$("CbBg").toggleClass("sapMCbMarkChecked", bSelected);
this.$().attr("aria-checked", bSelected);
var oCheckBox = this.getDomRef("CB");
if (oCheckBox) {
bSelected ? oCheckBox.setAttribute('checked', 'checked') : oCheckBox.removeAttribute('checked');
}
this.setProperty("selected", bSelected, true);
return this;
};
/**
* Function is called when CheckBox is tapped.
*
* @private
*/
CheckBox.prototype.ontap = function(oEvent) {
if (this.getEnabled() && this.getEditable()) {
var bSelected = !this.getSelected();
this.setSelected(bSelected);
this.fireSelect({selected:bSelected});
}
};
/**
* add ActiveState to non-supported mobile platform
* @private
*/
CheckBox.prototype.addActiveState = function(oControl) {
if (sap.ui.Device.os.blackberry || (sap.ui.Device.os.android && (sap.ui.Device.os.versionStr.match(/[23]\./)))) {
oControl.addDelegate({
ontouchstart: function(oEvent){
jQuery(oControl.getDomRef()).addClass("sapMActive");
},
ontouchend: function(oEvent){
jQuery(oControl.getDomRef()).removeClass("sapMActive");
}
});
}
};
/**
* sets a property of the label, and creates the label if it has not been initialized
* @private
*/
CheckBox.prototype._setLabelProperty = function (sPropertyName, vPropertyValue, bSupressRerendering) {
var bHasLabel = !!this._oLabel,
sUpperPropertyName = jQuery.sap.charToUpperCase(sPropertyName, 0);
this.setProperty(sPropertyName, vPropertyValue, bHasLabel && bSupressRerendering);
if (!bHasLabel) {
this._oLabel = new Label(this.getId() + "-label", {labelFor: this.getId()})
.addStyleClass("sapMCbLabel")
.setParent(this, null, true);
}
this._oLabel["set" + sUpperPropertyName](this["get" + sUpperPropertyName]()); // e.g. this._oLabel.setText(value);
return this;
};
CheckBox.prototype.setText = function(sText){
this._setLabelProperty("text", sText, true);
};
CheckBox.prototype.setWidth = function(sWidth){
this._setLabelProperty("width", sWidth, true);
};
CheckBox.prototype.setTextDirection = function(sDirection){
this._setLabelProperty("textDirection", sDirection);
};
CheckBox.prototype.setTextAlign = function(sAlign){
this._setLabelProperty("textAlign", sAlign);
};
CheckBox.prototype.exit = function() {
delete this._iTabIndex;
if (this._oLabel) {
this._oLabel.destroy();
}
};
/**
* Event handler called when the space key is pressed.
*
* @param {jQuery.Event} oEvent
* @private
*/
CheckBox.prototype.onsapspace = function(oEvent) {
this.ontap(oEvent);
// stop browsers default behavior
if (oEvent) {
oEvent.preventDefault();
oEvent.stopPropagation();
}
};
/**
* Event handler called when the enter key is pressed.
*
* @param {jQuery.Event} oEvent
* @private
*/
CheckBox.prototype.onsapenter = function(oEvent) {
this.ontap(oEvent);
};
/**
* Sets the tab index of the control
*
* @param {int} iTabIndex greater than or equal -1
* @return {sap.m.CheckBox}
* @since 1.16
* @protected
*/
CheckBox.prototype.setTabIndex = function(iTabIndex) {
this._iTabIndex = iTabIndex;
this.$("CbBg").attr("tabindex", iTabIndex);
return this;
};
/**
* Gets the tab index of the control
*
* @return {integer} tabIndex for Checkbox
* @since 1.22
* @protected
*/
CheckBox.prototype.getTabIndex = function() {
if ( this.hasOwnProperty("_iTabIndex") ) {
return this._iTabIndex;
}
return this.getEnabled() ? 0 : -1 ;
};
return CheckBox;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./Label','./library','sap/ui/core/Control','sap/ui/core/EnabledPropagator'],function(q,L,l,C,E){"use strict";var a=C.extend("sap.m.CheckBox",{metadata:{library:"sap.m",properties:{selected:{type:"boolean",group:"Data",defaultValue:false},enabled:{type:"boolean",group:"Behavior",defaultValue:true},name:{type:"string",group:"Misc",defaultValue:null},text:{type:"string",group:"Appearance",defaultValue:null},textDirection:{type:"sap.ui.core.TextDirection",group:"Appearance",defaultValue:sap.ui.core.TextDirection.Inherit},textAlign:{type:"sap.ui.core.TextAlign",group:"Appearance",defaultValue:sap.ui.core.TextAlign.Begin},width:{type:"sap.ui.core.CSSSize",group:"Dimension",defaultValue:''},activeHandling:{type:"boolean",group:"Misc",defaultValue:true},editable:{type:"boolean",group:"Behavior",defaultValue:true}},associations:{ariaDescribedBy:{type:"sap.ui.core.Control",multiple:true,singularName:"ariaDescribedBy"},ariaLabelledBy:{type:"sap.ui.core.Control",multiple:true,singularName:"ariaLabelledBy"}},events:{select:{parameters:{selected:{type:"boolean"}}}}}});E.call(a.prototype);a.prototype.init=function(){this.addActiveState(this);q.sap.require("sap.ui.core.IconPool");sap.ui.core.IconPool.insertFontFaceStyle();};a.prototype.onAfterRendering=function(){if(!this.getText()&&!this.$().attr("aria-labelledby")){this.$().attr("aria-label"," ");}};a.prototype.ontouchstart=function(e){e.originalEvent._sapui_handledByControl=true;};a.prototype.setSelected=function(s){s=!!s;if(s==this.getSelected()){return this;}this.$("CbBg").toggleClass("sapMCbMarkChecked",s);this.$().attr("aria-checked",s);var c=this.getDomRef("CB");if(c){s?c.setAttribute('checked','checked'):c.removeAttribute('checked');}this.setProperty("selected",s,true);return this;};a.prototype.ontap=function(e){if(this.getEnabled()&&this.getEditable()){var s=!this.getSelected();this.setSelected(s);this.fireSelect({selected:s});}};a.prototype.addActiveState=function(c){if(sap.ui.Device.os.blackberry||(sap.ui.Device.os.android&&(sap.ui.Device.os.versionStr.match(/[23]\./)))){c.addDelegate({ontouchstart:function(e){q(c.getDomRef()).addClass("sapMActive");},ontouchend:function(e){q(c.getDomRef()).removeClass("sapMActive");}});}};a.prototype._setLabelProperty=function(p,P,s){var h=!!this._oLabel,u=q.sap.charToUpperCase(p,0);this.setProperty(p,P,h&&s);if(!h){this._oLabel=new L(this.getId()+"-label",{labelFor:this.getId()}).addStyleClass("sapMCbLabel").setParent(this,null,true);}this._oLabel["set"+u](this["get"+u]());return this;};a.prototype.setText=function(t){this._setLabelProperty("text",t,true);};a.prototype.setWidth=function(w){this._setLabelProperty("width",w,true);};a.prototype.setTextDirection=function(d){this._setLabelProperty("textDirection",d);};a.prototype.setTextAlign=function(A){this._setLabelProperty("textAlign",A);};a.prototype.exit=function(){delete this._iTabIndex;if(this._oLabel){this._oLabel.destroy();}};a.prototype.onsapspace=function(e){this.ontap(e);if(e){e.preventDefault();e.stopPropagation();}};a.prototype.onsapenter=function(e){this.ontap(e);};a.prototype.setTabIndex=function(t){this._iTabIndex=t;this.$("CbBg").attr("tabindex",t);return this;};a.prototype.getTabIndex=function(){if(this.hasOwnProperty("_iTabIndex")){return this._iTabIndex;}return this.getEnabled()?0:-1;};return a;},true);

View File

@ -0,0 +1,120 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', 'sap/ui/core/ValueStateSupport'],
function(jQuery, ValueStateSupport) {
"use strict";
/**
* CheckBox renderer.
* @namespace
*/
var CheckBoxRenderer = {
};
/**
* Renders the HTML for the given control, using the provided {@link sap.ui.core.RenderManager}.
*
* @param {sap.ui.core.RenderManager} oRm the RenderManager that can be used for writing to the Render-Output-Buffer
* @param {sap.ui.core.Control} oCheckBox an object representation of the control that should be rendered
*/
CheckBoxRenderer.render = function(oRm, oCheckBox){
// get control properties
var bEnabled = oCheckBox.getEnabled();
var bEditable = oCheckBox.getEditable();
var bInteractible = oCheckBox.getEnabled() && oCheckBox.getEditable();
// CheckBox wrapper
oRm.write("<div");
oRm.addClass("sapMCb");
if (bInteractible) {
oRm.addClass("sapMPointer");
}
if (!bEditable) {
oRm.addClass("sapMCbRo");
}
if (!bEnabled) {
oRm.addClass("sapMCbBgDis");
}
oRm.writeControlData(oCheckBox);
oRm.writeClasses();
var sTooltip = ValueStateSupport.enrichTooltip(oCheckBox, oCheckBox.getTooltip_AsString());
if (sTooltip) {
oRm.writeAttributeEscaped("title", sTooltip);
}
if (bEnabled) {
oRm.writeAttribute("tabindex", oCheckBox.getTabIndex());
}
//ARIA attributes
oRm.writeAccessibilityState(oCheckBox, {
role: 'checkbox',
selected: null,
checked: oCheckBox.getSelected()
});
oRm.write(">"); // DIV element
// write the HTML into the render manager
oRm.write("<div id='");
oRm.write(oCheckBox.getId() + "-CbBg'");
// CheckBox style class
oRm.addClass("sapMCbBg");
if (bEnabled && bEditable && sap.ui.Device.system.desktop) {
oRm.addClass("sapMCbHoverable");
}
if (!oCheckBox.getActiveHandling()) {
oRm.addClass("sapMCbActiveStateOff");
}
oRm.addClass("sapMCbMark"); // TODO: sapMCbMark is redundant, remove it and simplify CSS
if (oCheckBox.getSelected()) {
oRm.addClass("sapMCbMarkChecked");
}
oRm.writeClasses();
oRm.write(">"); // DIV element
oRm.write("<input type='CheckBox' id='");
oRm.write(oCheckBox.getId() + "-CB'");
if (oCheckBox.getSelected()) {
oRm.writeAttribute("checked", "checked");
}
if (oCheckBox.getName()) {
oRm.writeAttributeEscaped('name', oCheckBox.getName());
}
if (!bEnabled) {
oRm.write(" disabled=\"disabled\"");
}
if (!bEditable) {
oRm.write(" readonly=\"readonly\"");
}
oRm.write(" /></div>");
oRm.renderControl(oCheckBox._oLabel);
oRm.write("</div>");
};
return CheckBoxRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','sap/ui/core/ValueStateSupport'],function(q,V){"use strict";var C={};C.render=function(r,c){var e=c.getEnabled();var E=c.getEditable();var i=c.getEnabled()&&c.getEditable();r.write("<div");r.addClass("sapMCb");if(i){r.addClass("sapMPointer");}if(!E){r.addClass("sapMCbRo");}if(!e){r.addClass("sapMCbBgDis");}r.writeControlData(c);r.writeClasses();var t=V.enrichTooltip(c,c.getTooltip_AsString());if(t){r.writeAttributeEscaped("title",t);}if(e){r.writeAttribute("tabindex",c.getTabIndex());}r.writeAccessibilityState(c,{role:'checkbox',selected:null,checked:c.getSelected()});r.write(">");r.write("<div id='");r.write(c.getId()+"-CbBg'");r.addClass("sapMCbBg");if(e&&E&&sap.ui.Device.system.desktop){r.addClass("sapMCbHoverable");}if(!c.getActiveHandling()){r.addClass("sapMCbActiveStateOff");}r.addClass("sapMCbMark");if(c.getSelected()){r.addClass("sapMCbMarkChecked");}r.writeClasses();r.write(">");r.write("<input type='CheckBox' id='");r.write(c.getId()+"-CB'");if(c.getSelected()){r.writeAttribute("checked","checked");}if(c.getName()){r.writeAttributeEscaped('name',c.getName());}if(!e){r.write(" disabled=\"disabled\"");}if(!E){r.write(" readonly=\"readonly\"");}r.write(" /></div>");r.renderControl(c._oLabel);r.write("</div>");};return C;},true);

View File

@ -0,0 +1,664 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.Column.
sap.ui.define(['jquery.sap.global', './library', 'sap/ui/core/Element', 'sap/ui/core/Renderer'],
function(jQuery, library, Element, Renderer) {
"use strict";
/**
* Constructor for a new Column.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* The column allows to define column specific properties that will be applied when rendering the List.
* @extends sap.ui.core.Element
*
* @author SAP SE
* @version 1.28.5
*
* @constructor
* @public
* @since 1.12
* @alias sap.m.Column
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var Column = Element.extend("sap.m.Column", /** @lends sap.m.Column.prototype */ { metadata : {
library : "sap.m",
properties : {
/**
* Defines the width of the column. If you leave it empty then this column covers the remaining space.
*/
width : {type : "sap.ui.core.CSSSize", group : "Dimension", defaultValue : null},
/**
* Horizontal alignment of the column content. Available alignment settings are "Begin", "Center", "End", "Left", and "Right".
*
* NOTE: Control with a "textAlign" property inherits the horizontal alignment.
*/
hAlign : {type : "sap.ui.core.TextAlign", group : "Appearance", defaultValue : sap.ui.core.TextAlign.Begin},
/**
* Vertical alignment of the cells in a column. Possible values are "Inherit", "Top", "Middle", "Bottom"
* This property does not affect the vertical alignment of header and footer.
*/
vAlign : {type : "sap.ui.core.VerticalAlign", group : "Appearance", defaultValue : sap.ui.core.VerticalAlign.Inherit},
/**
* CSS class name for column contents(header, cells and footer of column). This property can be used for different column styling. If column is shown as pop-in then this class name is applied to related pop-in row.
*/
styleClass : {type : "string", group : "Appearance", defaultValue : null},
/**
* Specifies whether or not the column is visible. Invisible columns are not rendered.
*/
visible : {type : "boolean", group : "Appearance", defaultValue : true},
/**
* By default column is always shown. If you set this property, control checks the minimum width of the screen to show or hide this column.
* As you can give specific CSS sizes(e.g: "480px" or "40em"), you can also use sap.m.ScreenSize enumeration(e.g: "Phone", "Tablet", "Desktop", "Small", "Medium", "Large", ....).
*
* sap.m.Column.MediaQuery1->Range1 = 199
*
* This property can be used for responsive design. e.g: "40em"(or "640px" or "Tablet") setting shows this column in iPad(and Desktop) but hides in iPhone.
* Please also see "demandPopin" property
*/
minScreenWidth : {type : "string", group : "Behavior", defaultValue : null},
/**
* According to your minScreenWidth settings, the column can be hidden in different screen sizes.
* Setting this property to true, shows this column as pop-in instead of hiding it.
*/
demandPopin : {type : "boolean", group : "Behavior", defaultValue : false},
/**
* Horizontal alignment of the pop-in content. Available alignment settings are "Begin", "Center", "End", "Left", and "Right".
*
* NOTE: Controls with a text align do not inherit the horizontal alignment.
* @deprecated Since version 1.14.
* Use popinDisplay property instead.
*/
popinHAlign : {type : "sap.ui.core.TextAlign", group : "Appearance", defaultValue : sap.ui.core.TextAlign.Begin, deprecated: true},
/**
* Defines the display options of pop-in.
* Possible values are
* 1 - "Block"(Header is displayed in first line and value field in next line.)
* 2 - "Inline" (Value field is displayed next to the header in same line.)
* @since 1.13.2
*/
popinDisplay : {type : "sap.m.PopinDisplay", group : "Appearance", defaultValue : sap.m.PopinDisplay.Block},
/**
* Set "true" to merge repeating cells(duplicates) into one.
* Also see "mergeFunctionName" property to customize.
* Note: this property gets disabled if any column is in pop-in!
* @since 1.16
*/
mergeDuplicates : {type : "boolean", group : "Behavior", defaultValue : false},
/**
* Defines the value getter(serialization) function if "mergeDuplicates" property is set "true"
* Control itself uses this function to compare values of two repeating cells.
* Default value "getText" is suitable for Label and Text control.
* e.g. For "Icon" control "getSrc" can be used.
* Note: You can pass one string parameter to given function after "#" sign. e.g. "data#myparameter"
* @since 1.16
*/
mergeFunctionName : {type : "string", group : "Misc", defaultValue : 'getText'}
},
defaultAggregation : "header",
aggregations : {
/**
* Control to be displayed in the column header.
*/
header : {type : "sap.ui.core.Control", multiple : false},
/**
* Control to be displayed in the column footer.
*/
footer : {type : "sap.ui.core.Control", multiple : false}
}
}});
// default index
Column.prototype._index = -1;
// predefined screen size
Column.prototype._screen = "";
// default media value
Column.prototype._media = null;
Column.prototype._clearMedia = function() {
if (this._media && this._minWidth) {
sap.ui.Device.media.removeRangeSet(this.getId());
this._media = null;
}
};
Column.prototype._addMedia = function() {
if (this._minWidth) {
sap.ui.Device.media.initRangeSet(this.getId(), [parseFloat(this._minWidth)]);
sap.ui.Device.media.attachHandler(this._notifyResize, this, this.getId());
this._media = sap.ui.Device.media.getCurrentRange(this.getId());
if (this._media) {
this._media.triggered = false;
this._media.matches = !!this._media.from;
}
}
};
/**
* Notify parent to re-render
* Also fire media event for listeners
*
* @private
*/
Column.prototype._notifyResize = function(oMedia) {
// ignore the first call
if (!this._media.triggered) {
this._media.triggered = true;
return;
}
// keep media info
this._media = oMedia;
this._media.triggered = true;
this._media.matches = !!oMedia.from;
// wait all events to come
jQuery.sap.delayedCall(0, this, function() {
var parent = this.getParent();
this.fireEvent("media", this);
if (parent && parent.onColumnResize) {
parent.onColumnResize(this);
}
});
};
Column.prototype._validateMinWidth = function(sWidth) {
if (Object.prototype.toString.call(sWidth) != "[object String]") {
throw new Error('expected string for property "minScreenWidth" of ' + this);
}
if (Object.keys(sap.m.ScreenSizes).indexOf(sWidth.toLowerCase()) != -1) {
return;
}
if (!/^\d+(\.\d+)?(px|em|rem)$/i.test(sWidth)) {
throw new Error('invalid CSS size("px", "em", "rem" required) or sap.m.ScreenSize enumeration for property "minScreenWidth" of ' + this);
}
};
// Checks the given width(px or em), if it is a predefined screen value
Column.prototype._isWidthPredefined = function(sWidth) {
var that = this,
unit = sWidth.replace(/[^a-z]/g, ""),
baseFontSize = parseFloat(sap.m.BaseFontSize) || 16;
jQuery.each(sap.m.ScreenSizes, function(screen, size) {
if (unit != "px") {
size /= baseFontSize;
}
if (size + unit == sWidth) {
that._minWidth = this + "px";
that._screen = screen;
return false;
}
});
};
/**
* Apply text alignment of the Column to Text/Label/Link...
*
* TODO: This is so ugly to check content functions
* instead we should document how to use our controls
* to inherit text-alignment and we should add a new
* sap.ui.core.TextAlign type called "Inherit"
*
* @param {sap.ui.core.Control} oControl List control
* @param {String} [sAlign] TextAlign enumeration
* @return {sap.ui.core.Control} oControl
* @protected
*/
Column.prototype.applyAlignTo = function(oControl, sAlign) {
sAlign = sAlign || this.getHAlign();
if (sAlign === sap.ui.core.TextAlign.Initial ||
!oControl.getMetadata().getProperties().textAlign ||
oControl.getTextAlign() === sAlign) {
return oControl;
}
oControl.setProperty("textAlign", sAlign, true);
var oDomRef = oControl.getDomRef();
sAlign = this.getCssAlign(sAlign);
if (oDomRef && sAlign) {
oDomRef.style.textAlign = sAlign;
}
return oControl;
};
/**
* Returns CSS alignment according to column hAlign setting or given parameter
* for Begin/End values checks the locale settings
*
* @param {String} [sAlign] TextAlign enumeration
* @return {String} left|center|right
* @protected
*/
Column.prototype.getCssAlign = function(sAlign) {
sAlign = sAlign || this.getHAlign();
var mTextAlign = sap.ui.core.TextAlign;
if (sAlign === mTextAlign.Begin || sAlign === mTextAlign.End || sAlign === mTextAlign.Initial) {
sAlign = Renderer.getTextAlign(sAlign);
}
return sAlign.toLowerCase();
};
// Returns styleClass property with extra responsive class if second parameter is set true
Column.prototype.getStyleClass = function(bResponsive) {
var cls = this.getProperty("styleClass");
if (!bResponsive) {
return cls;
}
if (this._screen && (!this.getDemandPopin() || !window.matchMedia)) {
cls += " sapMSize-" + this._screen;
} else if (this._media && !this._media.matches) {
cls += " sapMListTblNone";
}
return cls;
};
/**
* Returns visible probability of the column
*
* @param {boolean} [bReturnCache] Whether return cache or new result
* @return {boolean}
* @protected
*/
Column.prototype.isNeverVisible = function(bReturnCache) {
if (bReturnCache) {
return this._isNeverVisible;
}
if (!this._minWidth) {
this._isNeverVisible = false;
return this._isNeverVisible;
}
var width = parseFloat(this._minWidth),
unit = this._minWidth.replace(/[^a-z]/g, ""),
baseFontSize = parseFloat(sap.m.BaseFontSize) || 16;
if (unit != "px") {
width *= baseFontSize;
}
this._isNeverVisible = (width > Math.max(window.screen.width, window.screen.height));
return this._isNeverVisible;
};
/**
* Sets the visible column index
* Negative index values can be used to clear
*
* @param {int} nIndex index of the visible column
* @protected
*/
Column.prototype.setIndex = function(nIndex) {
this._index = +nIndex;
};
/**
* Sets the order of the column
* Does not do the visual effect
* Table should be invalidate to re-render
*
* @param {int} nOrder order of the column
* @protected
*/
Column.prototype.setOrder = function(nOrder) {
this._order = +nOrder;
};
/**
* Gets the order of the column
*
* @returns {int} nOrder order of the column
* @protected
*/
Column.prototype.getOrder = function() {
return this.hasOwnProperty("_order") ? this._order : this.getInitialOrder();
};
/**
* Sets the initial order of the column
*
* @param {int} nOrder initial order of the column
* @protected
*/
Column.prototype.setInitialOrder = function(nOrder) {
this._initialOrder = +nOrder;
};
/**
* Gets the initial order of the column
*
* @returns {int} initial order of the column
* @protected
*/
Column.prototype.getInitialOrder = function() {
if (this.hasOwnProperty("_initialOrder")) {
return this._initialOrder;
}
var oParent = this.getParent();
if (oParent && oParent.indexOfColumn) {
return oParent.indexOfColumn(this);
}
return -1;
};
/**
* Display or hide the column from given table
* This does not set the visibility property of the column
*
* @param {Object} oTableDomRef Table DOM reference
* @param {boolean} [bDisplay] whether visible or not
* @protected
*/
Column.prototype.setDisplay = function(oTableDomRef, bDisplay) {
if (!oTableDomRef || this._index < 0) {
return;
}
// go with native we need speed
var i = this._index + 1,
parent = this.getParent(),
display = bDisplay ? "table-cell" : "none",
header = oTableDomRef.querySelector("tr > th:nth-child(" + i + ")"),
cells = oTableDomRef.querySelectorAll("tr > td:nth-child(" + i + ")"),
length = cells.length;
// set display and aria
header.style.display = display;
header.setAttribute("aria-hidden", !bDisplay);
for (i = 0; i < length; i++) {
cells[i].style.display = display;
cells[i].setAttribute("aria-hidden", !bDisplay);
}
// let the parent know the visibility change
if (parent && parent.setTableHeaderVisibility) {
// make it sure rendering phase is done with timeout
setTimeout(function() {
parent.setTableHeaderVisibility(bDisplay);
}, 0);
}
};
/**
* Display or hide the column from given table via checking media query changes
*
* @param {Object} oTableDomRef Table DOM reference
* @protected
*/
Column.prototype.setDisplayViaMedia = function(oTableDomRef) {
var oParent = this.getParent(),
bDisplay = this._media && this._media.matches;
if (!this.getDemandPopin() && this._screen && oParent && oParent.setTableHeaderVisibility) {
// this means CSS media queries already change the column visibility
// let the parent know the visibility change
// make it sure rendering phase is done with timeout
setTimeout(function() {
oParent.setTableHeaderVisibility(bDisplay);
}, 0);
} else {
this.setDisplay(oTableDomRef, bDisplay);
}
};
Column.prototype.setVisible = function(bVisible) {
var oParent = this.getParent(),
oTableDomRef = oParent && oParent.getTableDomRef && oParent.getTableDomRef(),
bSupressInvalidate = oTableDomRef && this._index >= 0;
this.setProperty("visible", bVisible, bSupressInvalidate);
if (bSupressInvalidate) {
this.setDisplay(oTableDomRef, bVisible);
}
return this;
};
/*
* Decides if we need media query or not according to given settings
* Checks the given width is known screen size
*/
Column.prototype.setMinScreenWidth = function(sWidth) {
// check if setting the old value
if (sWidth == this.getMinScreenWidth()) {
return this;
}
// first validate the value
this._validateMinWidth(sWidth);
// initialize
this._clearMedia();
this._minWidth = 0;
this._screen = "";
if (sWidth) {
// check given width is known screen-size
sWidth = sWidth.toLowerCase();
var width = sap.m.ScreenSizes[sWidth];
if (width) {
width += "px";
this._screen = sWidth;
} else {
this._isWidthPredefined(sWidth);
width = sWidth;
}
// keep the minimum width value
this._minWidth = width;
/*
// OLD: if pop-in is requested or if unknown screen-size is given then go with JS media queries
// NEW: We always need JS media queries to detect table header visibility
if (this.getDemandPopin() || !this._screen) {
this._addMedia();
}
*/
this._addMedia();
}
return this.setProperty("minScreenWidth", sWidth);
};
/*
* Decides if we need media query or not according to given settings
* if pop-in is demanded then we always need JS media queries
* if not demanded but if screen size is known CSS media query can handle
*/
Column.prototype.setDemandPopin = function(bValue) {
// check if setting the old value
if (bValue == this.getDemandPopin()) {
return this;
}
// minimum width should have been set
if (!this.getMinScreenWidth()) {
return this.setProperty("demandPopin", bValue, true);
}
return this.setProperty("demandPopin", bValue);
};
/**
* Checks the column will be shown as pop-in
*
* @protected
*/
Column.prototype.isPopin = function() {
if (!this.getDemandPopin()) {
return false;
}
if (this._media) {
return !this._media.matches;
}
return false;
};
/**
* Checks the column will be hidden
*
* @protected
*/
Column.prototype.isHidden = function() {
if (this._media) {
return !this._media.matches;
}
if (this._screen && this._minWidth) {
return parseFloat(this._minWidth) > window.innerWidth;
}
return false;
};
/**
* Sets the last value of the column if mergeDuplicates property is true
*
* @param {any} value Any Value
* @returns {sap.m.Column}
* @since 1.16
* @protected
*/
Column.prototype.setLastValue = function(value) {
if (this.getMergeDuplicates()) {
this._lastValue = value;
}
return this;
};
/**
* Clears the last value of the column if mergeDuplicates property is true
*
* @returns {sap.m.Column}
* @since 1.20.4
* @protected
*/
Column.prototype.clearLastValue = function() {
return this.setLastValue(NaN);
};
/**
* Gets the last value of the column
*
* @since 1.16
* @protected
*/
Column.prototype.getLastValue = function() {
return this._lastValue;
};
/**
* Gets called from the Table when the all items are removed
*
* @since 1.16
* @protected
*/
Column.prototype.onItemsRemoved = function() {
this.clearLastValue();
};
/**
* Determines whether the given width is relative or not
*
* @private
* @returns {boolean}
*/
Column.prototype.isRelativeWidth = function() {
return /^(|auto|[-+]?\d+\.?\d*%|inherit)$/i.test(this.getWidth());
};
/**
* Determines whether box-sizing content-box works for columns or not
* Native android browsers does not honour content-box for fixed table layout
* https://bugs.webkit.org/show_bug.cgi?id=18565
*
* @protected
* @readonly
* @static
*/
Column.bContentBoxSupport = (function() {
var iWidth = 5,
sTable = "<table style='table-layout:fixed; width:" + iWidth + "px; position:absolute; left:-999px; top:-999px'>" +
"<tr><td style='width:" + iWidth + "px; padding:1px; border:1px solid transparent;'></td></tr>" +
"</table>",
$Table = jQuery(sTable);
jQuery(document.documentElement).append($Table);
var iContentWidth = $Table.find("td").width();
$Table.remove();
return (iContentWidth == iWidth);
})();
/**
* Gets called from the parent after all cells in column are rendered
*
* @param {jQuery} $Table Table jQuery reference
* @param {Boolean} [bAutoTableLayout] Table layout
* @see sap.m.Column#bContentBoxSupport
* @protected
*/
Column.prototype.onColumnRendered = function($Table, bAutoTableLayout) {
// native android browsers does not honour box-sizing content-box for fixed table layout
// if there is no content-box support and column is visible and not in popin then run the workaround
if (bAutoTableLayout ||
Column.bContentBoxSupport ||
!this.getVisible() ||
this.isRelativeWidth() ||
this.isPopin() ||
this.isNeverVisible()) {
return;
}
var $Header = $Table.find("th").eq(this._index),
iOuterWidth = $Header.outerWidth(),
iContentWidth = $Header.width(),
iWidth = 2 * iOuterWidth - iContentWidth;
// set the outer-width as column width
$Header.attr("data-sap-width", iWidth + "px");
$Header.width(iWidth);
};
return Column;
}, /* bExport= */ true);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,271 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.ColumnListItem.
sap.ui.define(['jquery.sap.global', './ListItemBase', './library'],
function(jQuery, ListItemBase, library) {
"use strict";
/**
* Constructor for a new ColumnListItem.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* ColumnListItem can be used with cells aggregation to create rows for the Table control.
* The columns aggregation of the Table should match with the cells aggregation.
*
* NOTE: This control does not respect the counter property of the ListItemBase.
* @extends sap.m.ListItemBase
*
* @author SAP SE
* @version 1.28.5
*
* @constructor
* @public
* @since 1.12
* @alias sap.m.ColumnListItem
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var ColumnListItem = ListItemBase.extend("sap.m.ColumnListItem", /** @lends sap.m.ColumnListItem.prototype */ { metadata : {
library : "sap.m",
properties : {
/**
* Sets the vertical alignment of the all cells in a table row(including selection and navigation). Possible values are "Inherit", "Top", "Middle", "Bottom"
* Note: Column's "vAlign" property is stronger than this one.
* @since 1.20
*/
vAlign : {type : "sap.ui.core.VerticalAlign", group : "Appearance", defaultValue : sap.ui.core.VerticalAlign.Inherit}
},
defaultAggregation : "cells",
aggregations : {
/**
* Every item inside the cells aggregation defines one column of the row.
* The order of the cells aggregation must match the order of the columns aggregation of the Table.
*/
cells : {type : "sap.ui.core.Control", multiple : true, singularName : "cell", bindable : "bindable"}
}
}});
// prototype lookup for pop-in id
ColumnListItem.prototype._popinId = "";
// initialization hook
ColumnListItem.prototype.init = function() {
sap.m.ListItemBase.prototype.init.call(this);
this._bNeedsTypeColumn = false;
this._aClonedHeaders = [];
};
ColumnListItem.prototype.onAfterRendering = function() {
sap.m.ListItemBase.prototype.onAfterRendering.call(this);
this._checkTypeColumn();
};
// informs the table when item's type column requirement is changed
ColumnListItem.prototype._checkTypeColumn = function(bNeedsTypeColumn) {
if (bNeedsTypeColumn == undefined) {
bNeedsTypeColumn = this.needsTypeColumn();
}
if (this._bNeedsTypeColumn != bNeedsTypeColumn) {
this._bNeedsTypeColumn = bNeedsTypeColumn;
this.informList("TypeColumnChange", bNeedsTypeColumn);
}
};
// determines whether type column for this item is necessary or not
ColumnListItem.prototype.needsTypeColumn = function() {
var sType = this.getType(),
mType = sap.m.ListType;
return this.getVisible() && (
sType == mType.Detail ||
sType == mType.Navigation ||
sType == mType.DetailAndActive
);
};
// returns responsible table control for the item
ColumnListItem.prototype.getTable = function() {
var oParent = this.getParent();
if (oParent instanceof sap.m.Table) {
return oParent;
}
// support old list with columns aggregation
if (oParent && oParent.getMetadata().getName() == "sap.m.Table") {
return oParent;
}
};
/**
* Returns pop-in DOMRef as a jQuery Object
*
* @protected
* @since 1.26
*/
ColumnListItem.prototype.$Popin = function() {
return jQuery.sap.byId(this._popinId);
};
/**
* Pemove pop-in from DOM
* @protected
*/
ColumnListItem.prototype.removePopin = function() {
this.$Popin().remove();
this._popinId = "";
};
/**
* Determines whether control has pop-in or not
* @protected
*/
ColumnListItem.prototype.hasPopin = function() {
return !!(this._popinId);
};
// Adds cloned header to the local collection
sap.m.ColumnListItem.prototype.addClonedHeader = function(oHeader) {
return this._aClonedHeaders.push(oHeader);
};
// Destroys cloned headers that are generated for popin
sap.m.ColumnListItem.prototype.destroyClonedHeaders = function() {
this._aClonedHeaders.forEach(function(oClone) {
oClone.destroy(true);
});
this._aClonedHeaders.length = 0;
};
/*
* Remove pop-in from DOM when setVisible false is called
* @overwite
*/
ColumnListItem.prototype.setVisible = function(bVisible) {
ListItemBase.prototype.setVisible.call(this, bVisible);
if (!bVisible) {
this.removePopin();
}
return this;
};
// update the aria-selected for the cells
ColumnListItem.prototype.updateSelectedDOM = function(bSelected, $LI) {
ListItemBase.prototype.updateSelectedDOM.apply(this, arguments);
$LI.children().attr("aria-selected", bSelected);
};
// remove pop-in on destroy
ColumnListItem.prototype.exit = function() {
ListItemBase.prototype.exit.call(this);
this._checkTypeColumn(false);
this.destroyClonedHeaders();
this.removePopin();
};
// active feedback for pop-in
ColumnListItem.prototype._activeHandlingInheritor = function() {
this._toggleActiveClass(true);
};
// inactive feedback for pop-in
ColumnListItem.prototype._inactiveHandlingInheritor = function() {
this._toggleActiveClass(false);
};
/*
* Common code for the two methods _inactiveHandlingInheritor,_activeHandlingInheritor
*
* @param {boolean} bSwitch Determine whether the class should be added or removed.
*/
ColumnListItem.prototype._toggleActiveClass = function(bSwitch){
this.$Popin().toggleClass("sapMLIBActive", bSwitch);
};
/**
* Handles event delegation for pop-ins
*
* @static
* @protected
*
* @param {jQuery.Event} oEvent jQuery event object
* @param {HTMLElement} oContainerDomRef max parent element to search in DOM to find pop-in
* @returns {sap.m.ColumnListItem|undefined} returns related list item when event handler is called
*/
ColumnListItem.handleEvents = function(oEvent, oContainerDomRef) {
var oColumnLI = this.getItemByPopinEvent(oEvent, oContainerDomRef);
if (oColumnLI) {
// try to find scrControl from event
oEvent.srcControl = jQuery(oEvent.target).control(0) || oColumnLI;
// call the related event handler
if (oColumnLI["on" + oEvent.type]) {
// 2nd parameter is introduced to inform popin event
oColumnLI["on" + oEvent.type](oEvent, true);
// return ListItem
return oColumnLI;
}
}
};
/**
* Returns related list item from event which is coming from pop-in
*
* @static
* @protected
* @since 1.26
*
* @param {jQuery.Event} oEvent jQuery event object
* @param {HTMLElement} oContainerDomRef max parent element to search in DOM to find pop-in
* @returns {sap.m.ColumnListItem|undefined}
*/
ColumnListItem.getItemByPopinEvent = function(oEvent, oContainerDomRef) {
var $Popin = jQuery(oEvent.target).closest(".sapMListTblSubRow", oContainerDomRef);
if ($Popin.length) {
return sap.ui.getCore().byId($Popin.prev().attr("id"));
}
};
/**
* Checks whether popin is focused or not
*
* @static
* @protected
*
* @param {jQuery.Event} oEvent jQuery event object
*/
ColumnListItem.isPopinFocused = function(oEvent) {
return jQuery(document.activeElement).hasClass("sapMListTblSubRow");
};
/**
* Returns the tabbable DOM elements as a jQuery collection
* When popin is available this separated dom should also be included
*
* @returns {jQuery} jQuery object
* @protected
* @since 1.26
*/
ColumnListItem.prototype.getTabbables = function() {
return this.$().add(this.$Popin()).find(":sapTabbable");
};
return ColumnListItem;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./ListItemBase','./library'],function(q,L,l){"use strict";var C=L.extend("sap.m.ColumnListItem",{metadata:{library:"sap.m",properties:{vAlign:{type:"sap.ui.core.VerticalAlign",group:"Appearance",defaultValue:sap.ui.core.VerticalAlign.Inherit}},defaultAggregation:"cells",aggregations:{cells:{type:"sap.ui.core.Control",multiple:true,singularName:"cell",bindable:"bindable"}}}});C.prototype._popinId="";C.prototype.init=function(){sap.m.ListItemBase.prototype.init.call(this);this._bNeedsTypeColumn=false;this._aClonedHeaders=[];};C.prototype.onAfterRendering=function(){sap.m.ListItemBase.prototype.onAfterRendering.call(this);this._checkTypeColumn();};C.prototype._checkTypeColumn=function(n){if(n==undefined){n=this.needsTypeColumn();}if(this._bNeedsTypeColumn!=n){this._bNeedsTypeColumn=n;this.informList("TypeColumnChange",n);}};C.prototype.needsTypeColumn=function(){var t=this.getType(),T=sap.m.ListType;return this.getVisible()&&(t==T.Detail||t==T.Navigation||t==T.DetailAndActive);};C.prototype.getTable=function(){var p=this.getParent();if(p instanceof sap.m.Table){return p;}if(p&&p.getMetadata().getName()=="sap.m.Table"){return p;}};C.prototype.$Popin=function(){return q.sap.byId(this._popinId);};C.prototype.removePopin=function(){this.$Popin().remove();this._popinId="";};C.prototype.hasPopin=function(){return!!(this._popinId);};sap.m.ColumnListItem.prototype.addClonedHeader=function(h){return this._aClonedHeaders.push(h);};sap.m.ColumnListItem.prototype.destroyClonedHeaders=function(){this._aClonedHeaders.forEach(function(c){c.destroy(true);});this._aClonedHeaders.length=0;};C.prototype.setVisible=function(v){L.prototype.setVisible.call(this,v);if(!v){this.removePopin();}return this;};C.prototype.updateSelectedDOM=function(s,$){L.prototype.updateSelectedDOM.apply(this,arguments);$.children().attr("aria-selected",s);};C.prototype.exit=function(){L.prototype.exit.call(this);this._checkTypeColumn(false);this.destroyClonedHeaders();this.removePopin();};C.prototype._activeHandlingInheritor=function(){this._toggleActiveClass(true);};C.prototype._inactiveHandlingInheritor=function(){this._toggleActiveClass(false);};C.prototype._toggleActiveClass=function(s){this.$Popin().toggleClass("sapMLIBActive",s);};C.handleEvents=function(e,c){var o=this.getItemByPopinEvent(e,c);if(o){e.srcControl=q(e.target).control(0)||o;if(o["on"+e.type]){o["on"+e.type](e,true);return o;}}};C.getItemByPopinEvent=function(e,c){var p=q(e.target).closest(".sapMListTblSubRow",c);if(p.length){return sap.ui.getCore().byId(p.prev().attr("id"));}};C.isPopinFocused=function(e){return q(document.activeElement).hasClass("sapMListTblSubRow");};C.prototype.getTabbables=function(){return this.$().add(this.$Popin()).find(":sapTabbable");};return C;},true);

View File

@ -0,0 +1,296 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', './ListItemBaseRenderer', './ListRenderer', 'sap/ui/core/Renderer'],
function(jQuery, ListItemBaseRenderer, ListRenderer, Renderer) {
"use strict";
/**
* ColumnListItem renderer.
* @namespace
*/
var ColumnListItemRenderer = Renderer.extend(ListItemBaseRenderer);
ColumnListItemRenderer.render = function(rm, oLI) {
var oTable = oLI.getTable();
if (!oTable) {
return;
}
ListItemBaseRenderer.render.apply(this, arguments);
if (oLI.getVisible() && oTable.hasPopin()) {
this.renderPopin(rm, oLI, oTable);
}
};
ColumnListItemRenderer.openItemTag = function(rm, oLI) {
rm.write("<tr");
};
ColumnListItemRenderer.closeItemTag = function(rm, oLI) {
rm.write("</tr>");
};
ColumnListItemRenderer.handleNoFlex = function(rm, oLI) {
};
// render type content always within a cell
ColumnListItemRenderer.renderType = function(rm, oLI) {
rm.write('<td role="gridcell" class="sapMListTblNavCol"');
if (oLI.getSelected()) {
rm.writeAttribute("aria-selected", "true");
}
if (!oLI.needsTypeColumn()) {
rm.writeAttribute("aria-hidden", "true");
}
rm.write('>');
// let the list item base render the type
ListItemBaseRenderer.renderType.apply(this, arguments);
rm.write('</td>');
};
// wrap mode content with a cell
ColumnListItemRenderer.renderModeContent = function(rm, oLI) {
rm.write('<td role="gridcell" class="sapMListTblSelCol"');
oLI.getSelected() && rm.writeAttribute("aria-selected", "true");
rm.write('>');
// let the list item base render the mode control
ListItemBaseRenderer.renderModeContent.apply(this, arguments);
rm.write('</td>');
};
// ColumnListItem does not respect counter property of the LIB
ColumnListItemRenderer.renderCounter = function(rm, oLI) {
};
// Returns aria accessibility role
ColumnListItemRenderer.getAriaRole = function(oLI) {
return "row";
};
// Returns the inner aria labelledby ids for the accessibility
ColumnListItemRenderer.getAriaLabelledBy = function(oLI) {
var oTable = oLI.getTable();
if (!oTable || !oTable.hasPopin()) {
return;
}
// when table has pop-in let the screen readers announce it
return oLI.getId() + " " + oLI.getId() + "-sub";
};
/**
* Renders the HTML for the given control, using the provided
* {@link sap.ui.core.RenderManager}.
*
* @param {sap.ui.core.RenderManager}
* oRenderManager the RenderManager that can be used for writing to
* the Render-Output-Buffer
* @param {sap.ui.core.Control}
* oControl an object representation of the control that should be
* rendered
*/
ColumnListItemRenderer.renderLIAttributes = function(rm, oLI) {
rm.addClass("sapMListTblRow");
var vAlign = oLI.getVAlign();
if (vAlign != sap.ui.core.VerticalAlign.Inherit) {
rm.addClass("sapMListTblRow" + vAlign);
}
};
/**
* Overwriting hook method of ListItemBase
*
* @public
*
* @param {sap.ui.core.RenderManager} rm RenderManager
* @param {sap.m.ListItemBase} oLI List item
*/
ColumnListItemRenderer.renderLIContentWrapper = function(rm, oLI) {
var oTable = oLI.getTable();
if (!oTable) {
return;
}
var aColumns = oTable.getColumns(true),
aCells = oLI.getCells(),
bSelected = oLI.getSelected();
// remove cloned headers
oLI.destroyClonedHeaders();
aColumns.forEach(function(oColumn, i) {
var cls,
oHeader,
bRenderCell = true,
oCell = aCells[oColumn.getInitialOrder()];
if (!oCell || !oColumn.getVisible() || oColumn.isNeverVisible(true) || oColumn.isPopin()) {
return;
}
rm.write("<td");
rm.addClass("sapMListTblCell");
rm.writeAttribute("id", oLI.getId() + "_cell" + i);
rm.writeAttribute("role", "gridcell");
if (bSelected) {
// write aria-selected explicitly for the cells
rm.writeAttribute("aria-selected", "true");
}
// check column properties
if (oColumn) {
cls = oColumn.getStyleClass(true);
cls && rm.addClass(cls);
// aria for virtual keyboard mode
oHeader = oColumn.getHeader();
if (oHeader) {
rm.writeAttribute("aria-describedby", oHeader.getId());
}
// merge duplicate cells
if (!oTable.hasPopin() && oColumn.getMergeDuplicates()) {
var sFuncWithParam = oColumn.getMergeFunctionName(),
aFuncWithParam = sFuncWithParam.split("#"),
sFuncParam = aFuncWithParam[1],
sFuncName = aFuncWithParam[0];
if (typeof oCell[sFuncName] != "function") {
jQuery.sap.log.warning("mergeFunctionName property is defined on " + oColumn + " but this is not function of " + oCell);
} else {
var lastColumnValue = oColumn.getLastValue(),
cellValue = oCell[sFuncName](sFuncParam);
if (lastColumnValue === cellValue) {
// it is not necessary to render cell content but
// screen readers need content to announce it
bRenderCell = sap.ui.getCore().getConfiguration().getAccessibility();
oCell.addStyleClass("sapMListTblCellDupCnt");
rm.addClass("sapMListTblCellDup");
} else {
oColumn.setLastValue(cellValue);
}
}
}
oColumn.getVAlign() != "Inherit" && rm.addStyle("vertical-align", oColumn.getVAlign().toLowerCase());
var sAlign = oColumn.getCssAlign();
if (sAlign) {
rm.addStyle("text-align", sAlign);
}
rm.writeStyles();
}
rm.writeClasses();
rm.write(">");
if (bRenderCell) {
rm.renderControl(oColumn.applyAlignTo(oCell));
}
rm.write("</td>");
});
};
/**
* Renders pop-ins for Table Rows
*
* @private
*
* @param {sap.ui.core.RenderManager} rm RenderManager
* @param {sap.m.ListItemBase} oLI List item
* @param {sap.m.Table} oTable Table control
*/
ColumnListItemRenderer.renderPopin = function(rm, oLI, oTable) {
oLI._popinId = oLI.getId() + "-sub";
rm.write("<tr class='sapMListTblSubRow'");
rm.writeAttribute("id", oLI._popinId);
rm.writeAttribute("role", "row");
// logical parent of the popin is the base row
rm.writeAttribute("aria-owns", oLI.getId());
rm.write("><td");
rm.writeAttribute("role", "gridcell");
rm.writeAttribute("colspan", oTable.getColCount());
rm.write("><div class='sapMListTblSubCnt'>");
var aCells = oLI.getCells(),
aColumns = oTable.getColumns(true);
aColumns.forEach(function(oColumn) {
if (!oColumn.getVisible() || !oColumn.isPopin()) {
return;
}
var oCell = aCells[oColumn.getInitialOrder()],
oHeader = oColumn.getHeader();
if (!oHeader && !oCell) {
return;
}
var sStyleClass = oColumn.getStyleClass(),
sPopinDisplay = oColumn.getPopinDisplay();
/* row start */
rm.write("<div");
rm.addClass("sapMListTblSubCntRow");
sStyleClass && rm.addClass(sStyleClass);
rm.writeClasses();
rm.write(">");
/* header cell */
if (oHeader && sPopinDisplay != sap.m.PopinDisplay.WithoutHeader) {
rm.write("<div");
rm.addClass("sapMListTblSubCntHdr");
rm.writeClasses();
rm.write(">");
oHeader = oHeader.clone();
oColumn.addDependent(oHeader);
oLI.addClonedHeader(oHeader);
oColumn.applyAlignTo(oHeader, "Begin");
rm.renderControl(oHeader);
rm.write("</div>");
/* separator cell */
rm.write("<div class='sapMListTblSubCntSpr'>:</div>");
}
/* value cell */
if (oCell) {
rm.write("<div");
rm.addClass("sapMListTblSubCntVal");
rm.addClass("sapMListTblSubCntVal" + sPopinDisplay);
rm.writeClasses();
rm.write(">");
oColumn.applyAlignTo(oCell, "Begin");
rm.renderControl(oCell);
rm.write("</div>");
}
/* row end */
rm.write("</div>");
});
rm.write("</div></td></tr>");
};
return ColumnListItemRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./ListItemBaseRenderer','./ListRenderer','sap/ui/core/Renderer'],function(q,L,a,R){"use strict";var C=R.extend(L);C.render=function(r,l){var t=l.getTable();if(!t){return;}L.render.apply(this,arguments);if(l.getVisible()&&t.hasPopin()){this.renderPopin(r,l,t);}};C.openItemTag=function(r,l){r.write("<tr");};C.closeItemTag=function(r,l){r.write("</tr>");};C.handleNoFlex=function(r,l){};C.renderType=function(r,l){r.write('<td role="gridcell" class="sapMListTblNavCol"');if(l.getSelected()){r.writeAttribute("aria-selected","true");}if(!l.needsTypeColumn()){r.writeAttribute("aria-hidden","true");}r.write('>');L.renderType.apply(this,arguments);r.write('</td>');};C.renderModeContent=function(r,l){r.write('<td role="gridcell" class="sapMListTblSelCol"');l.getSelected()&&r.writeAttribute("aria-selected","true");r.write('>');L.renderModeContent.apply(this,arguments);r.write('</td>');};C.renderCounter=function(r,l){};C.getAriaRole=function(l){return"row";};C.getAriaLabelledBy=function(l){var t=l.getTable();if(!t||!t.hasPopin()){return;}return l.getId()+" "+l.getId()+"-sub";};C.renderLIAttributes=function(r,l){r.addClass("sapMListTblRow");var A=l.getVAlign();if(A!=sap.ui.core.VerticalAlign.Inherit){r.addClass("sapMListTblRow"+A);}};C.renderLIContentWrapper=function(r,l){var t=l.getTable();if(!t){return;}var c=t.getColumns(true),b=l.getCells(),s=l.getSelected();l.destroyClonedHeaders();c.forEach(function(o,i){var d,h,e=true,f=b[o.getInitialOrder()];if(!f||!o.getVisible()||o.isNeverVisible(true)||o.isPopin()){return;}r.write("<td");r.addClass("sapMListTblCell");r.writeAttribute("id",l.getId()+"_cell"+i);r.writeAttribute("role","gridcell");if(s){r.writeAttribute("aria-selected","true");}if(o){d=o.getStyleClass(true);d&&r.addClass(d);h=o.getHeader();if(h){r.writeAttribute("aria-describedby",h.getId());}if(!t.hasPopin()&&o.getMergeDuplicates()){var F=o.getMergeFunctionName(),g=F.split("#"),j=g[1],k=g[0];if(typeof f[k]!="function"){q.sap.log.warning("mergeFunctionName property is defined on "+o+" but this is not function of "+f);}else{var m=o.getLastValue(),n=f[k](j);if(m===n){e=sap.ui.getCore().getConfiguration().getAccessibility();f.addStyleClass("sapMListTblCellDupCnt");r.addClass("sapMListTblCellDup");}else{o.setLastValue(n);}}}o.getVAlign()!="Inherit"&&r.addStyle("vertical-align",o.getVAlign().toLowerCase());var A=o.getCssAlign();if(A){r.addStyle("text-align",A);}r.writeStyles();}r.writeClasses();r.write(">");if(e){r.renderControl(o.applyAlignTo(f));}r.write("</td>");});};C.renderPopin=function(r,l,t){l._popinId=l.getId()+"-sub";r.write("<tr class='sapMListTblSubRow'");r.writeAttribute("id",l._popinId);r.writeAttribute("role","row");r.writeAttribute("aria-owns",l.getId());r.write("><td");r.writeAttribute("role","gridcell");r.writeAttribute("colspan",t.getColCount());r.write("><div class='sapMListTblSubCnt'>");var c=l.getCells(),b=t.getColumns(true);b.forEach(function(o){if(!o.getVisible()||!o.isPopin()){return;}var d=c[o.getInitialOrder()],h=o.getHeader();if(!h&&!d){return;}var s=o.getStyleClass(),p=o.getPopinDisplay();r.write("<div");r.addClass("sapMListTblSubCntRow");s&&r.addClass(s);r.writeClasses();r.write(">");if(h&&p!=sap.m.PopinDisplay.WithoutHeader){r.write("<div");r.addClass("sapMListTblSubCntHdr");r.writeClasses();r.write(">");h=h.clone();o.addDependent(h);l.addClonedHeader(h);o.applyAlignTo(h,"Begin");r.renderControl(h);r.write("</div>");r.write("<div class='sapMListTblSubCntSpr'>:</div>");}if(d){r.write("<div");r.addClass("sapMListTblSubCntVal");r.addClass("sapMListTblSubCntVal"+p);r.writeClasses();r.write(">");o.applyAlignTo(d,"Begin");r.renderControl(d);r.write("</div>");}r.write("</div>");});r.write("</div></td></tr>");};return C;},true);

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,874 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.ComboBoxBase.
sap.ui.define(['jquery.sap.global', './Bar', './ComboBoxBaseRenderer', './Dialog', './InputBase', './List', './Popover', './library', 'sap/ui/core/EnabledPropagator', 'sap/ui/core/IconPool'],
function(jQuery, Bar, ComboBoxBaseRenderer, Dialog, InputBase, List, Popover, library, EnabledPropagator, IconPool) {
"use strict";
/**
* Constructor for a new ComboBoxBase.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* An abstract class for ComboBoxes.
* @extends sap.m.InputBase
*
* @author SAP SE
* @version 1.28.5
*
* @constructor
* @public
* @since 1.22.0
* @alias sap.m.ComboBoxBase
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var ComboBoxBase = InputBase.extend("sap.m.ComboBoxBase", /** @lends sap.m.ComboBoxBase.prototype */ { metadata: {
"abstract": true,
library: "sap.m",
properties: {
/**
* Defines the maximum width of the text field. This value can be provided in %, em, px and all CSS units.
*/
maxWidth: { type: "sap.ui.core.CSSSize", group: "Dimension", defaultValue: "100%" }
},
defaultAggregation: "items",
aggregations: {
/**
* Aggregation of items to be displayed.
*/
items: { type: "sap.ui.core.Item", multiple: true, singularName: "item", bindable: "bindable" },
/**
* Internal aggregation to hold the inner picker pop-up.
*/
picker: { type: "sap.ui.core.Control", multiple: false, visibility: "hidden" }
}
}});
IconPool.insertFontFaceStyle();
EnabledPropagator.apply(ComboBoxBase.prototype, [true]);
/* =========================================================== */
/* Private methods and properties */
/* =========================================================== */
/* ----------------------------------------------------------- */
/* Private methods */
/* ----------------------------------------------------------- */
/**
* Given an item, retrieve the corresponding list item.
*
* @param {sap.ui.core.Item} vItem
* @returns {sap.m.StandardListItem | null}
*/
ComboBoxBase.prototype.getListItem = function(oItem) {
return (oItem && oItem.data(sap.m.ComboBoxBaseRenderer.CSS_CLASS + "ListItem")) || null;
};
/**
* Map an item type of sap.ui.core.Item to an item type of sap.m.StandardListItem.
*
* @param {sap.ui.core.Item} oItem
* @returns {sap.m.StandardListItem | null}
* @private
*/
ComboBoxBase.prototype._mapItemToListItem = function(oItem) {
if (!oItem) {
return null;
}
var CSS_CLASS = ComboBoxBaseRenderer.CSS_CLASS,
sListItem = CSS_CLASS + "Item",
sListItemEnabled = oItem.getEnabled() ? "Enabled" : "Disabled",
sListItemSelected = (oItem === this.getSelectedItem()) ? sListItem + "Selected" : "",
oListItem = this.getListItem(oItem),
bItemVisible = oListItem ? oListItem.getVisible() : true;
oListItem = new sap.m.StandardListItem().addStyleClass(sListItem + " " + sListItem + sListItemEnabled + " " + sListItemSelected);
oListItem.setVisible(bItemVisible);
oListItem.setTitle(oItem.getText());
oListItem.setType(oItem.getEnabled() ? sap.m.ListType.Active : sap.m.ListType.Inactive);
oListItem.setTooltip(oItem.getTooltip());
oItem.data(CSS_CLASS + "ListItem", oListItem);
return oListItem;
};
/**
* Given an item type of sap.m.StandardListItem, find the corresponding item type of sap.ui.core.Item.
*
* @param {sap.m.StandardListItem} oListItem
* @param {array} [aItems]
* @returns {sap.ui.core.Item | null}
* @private
*/
ComboBoxBase.prototype._findMappedItem = function(oListItem, aItems) {
for (var i = 0, aItems = aItems || this.getItems(), aItemsLength = aItems.length; i < aItemsLength; i++) {
if (this.getListItem(aItems[i]) === oListItem) {
return aItems[i];
}
}
return null;
};
/**
* Fill the List.
*
* @param {sap.ui.core.Item[]} aItems
* @private
*/
ComboBoxBase.prototype._fillList = function(aItems) {
var oSelectedItem = this.getSelectedItem();
for (var i = 0, oListItem, oItem; i < aItems.length; i++) {
oItem = aItems[i];
// add a private property to the added item containing a reference
// to the corresponding mapped item
oListItem = this._mapItemToListItem(oItem);
// add the mapped item type of sap.m.StandardListItem to the List
this.getList().addAggregation("items", oListItem, true); // note: suppress re-rendering
// add active state to the selected item
if (oItem === oSelectedItem) {
this.getList().setSelectedItem(oListItem, true);
}
}
};
/**
* Destroy the items in the List.
*
* @private
*/
ComboBoxBase.prototype._clearList = function() {
if (this.getList()) {
this.getList().destroyAggregation("items", true); // note: suppress re-rendering
}
};
/**
* Getter for the control's List.
*
* @returns {sap.m.List}
* @private
*/
ComboBoxBase.prototype.getList = function() {
return this._oList;
};
/* =========================================================== */
/* Lifecycle methods */
/* =========================================================== */
/**
* Initialization hook.
*
* @private
*/
ComboBoxBase.prototype.init = function() {
InputBase.prototype.init.apply(this, arguments);
// set the picker pop-up type
this.setPickerType("Popover");
// initialize list
this.createList();
};
/**
* Cleans up before destruction.
*
* @private
*/
ComboBoxBase.prototype.exit = function() {
InputBase.prototype.exit.apply(this, arguments);
if (this.getList()) {
this.getList().destroy();
this._oList = null;
}
};
/* =========================================================== */
/* Event handlers */
/* =========================================================== */
/**
* Handle the touch start event on the control.
*
* @param {jQuery.Event} oEvent The event object.
* @private
*/
ComboBoxBase.prototype.ontouchstart = function(oEvent) {
if (!this.getEnabled() || !this.getEditable()) {
return;
}
// mark the event for components that needs to know if the event was handled
oEvent.setMarked();
if (this.isOpenArea(oEvent.target)) {
// add the active state to the control's field
this.addStyleClass(ComboBoxBaseRenderer.CSS_CLASS + "Pressed");
}
};
/**
* Handle the touch end event on the control.
*
* @param {jQuery.Event} oEvent The event object.
* @private
*/
ComboBoxBase.prototype.ontouchend = function(oEvent) {
if (!this.getEnabled() || !this.getEditable()) {
return;
}
// mark the event for components that needs to know if the event was handled
oEvent.setMarked();
if ((!this.isOpen() || !this.hasContent()) && this.isOpenArea(oEvent.target)) {
// remove the active state of the control's field
this.removeStyleClass(ComboBoxBaseRenderer.CSS_CLASS + "Pressed");
}
};
/**
* Handle the tap event on the control.
*
* @param {jQuery.Event} oEvent The event object.
* @private
*/
ComboBoxBase.prototype.ontap = function(oEvent) {
var CSS_CLASS = ComboBoxBaseRenderer.CSS_CLASS;
// a non editable or disabled ComboBox, the picker pop-up cannot be opened
if (!this.getEnabled() || !this.getEditable()) {
return;
}
// mark the event for components that needs to know if the event was handled
oEvent.setMarked();
if (this.isOpenArea(oEvent.target)) {
if (this.isOpen()) {
this.close();
this.removeStyleClass(CSS_CLASS + "Pressed");
return;
}
if (this.hasContent()) {
this.open();
}
}
if (this.isOpen()) {
// add the active state to the control's field
this.addStyleClass(CSS_CLASS + "Pressed");
}
};
/* ----------------------------------------------------------- */
/* Keyboard handling */
/* ----------------------------------------------------------- */
/**
* Handle when F4 or Alt + DOWN arrow are pressed.
*
* @param {jQuery.Event} oEvent The event object.
* @private
*/
ComboBoxBase.prototype.onsapshow = function(oEvent) {
// a non editable or disabled ComboBox, the picker pop-up cannot be opened
if (!this.getEnabled() || !this.getEditable()) {
return;
}
// mark the event for components that needs to know if the event was handled
oEvent.setMarked();
// note: prevent browser address bar to be open in ie9, when F4 is pressed
if (oEvent.keyCode === jQuery.sap.KeyCodes.F4) {
oEvent.preventDefault();
}
if (this.isOpen()) {
this.close();
return;
}
// select all text
this.selectText(0, this.getValue().length);
// open only if the combobox has items
if (this.hasContent()) {
this.open();
}
};
/**
* Handle when escape is pressed.
*
* If picker pop-up is closed, cancel changes and revert to the value which
* the input field had when it got the focus.
* If List is open, close list.
*
* @param {jQuery.Event} oEvent The event object.
* @private
*/
ComboBoxBase.prototype.onsapescape = function(oEvent) {
// a non editable or disabled ComboBox, the value cannot be changed
if (this.getEnabled() && this.getEditable() && this.isOpen()) {
// mark the event for components that needs to know if the event was handled
oEvent.setMarked();
// note: fix for Firefox
oEvent.preventDefault();
this.close();
} else { // the picker is closed
// cancel changes and revert to the value which the Input field had when it got the focus
InputBase.prototype.onsapescape.apply(this, arguments);
}
};
/**
* Handle when Alt + UP arrow are pressed.
*
* @param {jQuery.Event} oEvent The event object.
* @private
* @function
*/
ComboBoxBase.prototype.onsaphide = ComboBoxBase.prototype.onsapshow;
/* =========================================================== */
/* API methods */
/* =========================================================== */
/* ----------------------------------------------------------- */
/* protected methods */
/* ----------------------------------------------------------- */
/*
* Hook method, can be used to add additional content to the control's picker pop-up.
*
* @param {sap.m.Dialog | sap.m.Popover} [oPicker]
* @protected
*/
ComboBoxBase.prototype.addContent = function(oPicker) {};
/**
* Setter for property <code>_sPickerType</code>.
*
* @param {string} sPickerType
* @protected
*/
ComboBoxBase.prototype.setPickerType = function(sPickerType) {
this._sPickerType = sPickerType;
};
/**
* Getter for property <code>_sPickerType</code>
*
* @returns {string}
* @protected
*/
ComboBoxBase.prototype.getPickerType = function() {
return this._sPickerType;
};
/**
* Creates a picker.
* To be overwritten by subclasses.
*
* @param {string} sPickerType
* @returns {sap.m.Popover | sap.m.Dialog} The picker pop-up to be used.
* @protected
*/
ComboBoxBase.prototype.createPicker = function() {};
/**
* Getter for the control's picker pop-up.
*
* @returns {sap.m.Dialog | sap.m.Popover | null} The picker instance, creating it if necessary by calling <code>createPicker()</code> method.
* @protected
*/
ComboBoxBase.prototype.getPicker = function() {
if (this.bIsDestroyed) {
return null;
}
// initialize the control's picker
return this.createPicker(this.getPickerType());
};
/*
* Determines whether the control has content or not.
*
* @returns {boolean}
* @protected
*/
ComboBoxBase.prototype.hasContent = function() {
return !!this.getItems().length;
};
/*
* Retrieves the first enabled item from the aggregation named <code>items</code>.
*
* @param {array} [aItems]
* @returns {sap.ui.core.Item | null}
* @protected
*/
ComboBoxBase.prototype.findFirstEnabledItem = function(aItems) {
aItems = aItems || this.getItems();
for (var i = 0; i < aItems.length; i++) {
if (aItems[i].getEnabled()) {
return aItems[i];
}
}
return null;
};
/*
* Retrieves the last enabled item from the aggregation named <code>items</code>.
*
* @param {array} [aItems]
* @returns {sap.ui.core.Item | null}
* @protected
*/
ComboBoxBase.prototype.findLastEnabledItem = function(aItems) {
aItems = aItems || this.getItems();
return this.findFirstEnabledItem(aItems.reverse());
};
/*
* Open the control's picker pop-up.
*
* @returns {sap.m.ComboBoxBase} <code>this</code> to allow method chaining.
* @protected
*/
ComboBoxBase.prototype.open = function() {
var oPicker = this.getPicker();
if (oPicker) {
oPicker.open();
}
return this;
};
/*
* Getter for visible <code>items</code>.
*
* @return {sap.ui.core.Item[]}
* @protected
*/
ComboBoxBase.prototype.getVisibleItems = function() {
for (var i = 0, oListItem, aItems = this.getItems(), aVisibleItems = []; i < aItems.length; i++) {
oListItem = this.getListItem(aItems[i]);
if (oListItem && oListItem.getVisible()) {
aVisibleItems.push(aItems[i]);
}
}
return aVisibleItems;
};
/*
* Check whether an item is selected or not.
* To be overwritten by subclasses.
*
* @param {sap.ui.core.Item} oItem
* @returns {boolean} Whether the item is selected.
* @protected
* @since 1.24.0
* @name sap.m.ComboBoxBase#isItemSelected
* @function
*/
ComboBoxBase.prototype.isItemSelected = function() {};
/*
* Get key of each item from the aggregation named items.
*
* @param {sap.ui.core.Item[]} [aItems]
* @return {string[]}
* @protected
* @since 1.24.0
* @name sap.m.ComboBoxBase#getKeys
* @function
*/
ComboBoxBase.prototype.getKeys = function(aItems) {
for (var i = 0, aKeys = [], aItems = aItems || this.getItems(); i < aItems.length; i++) {
aKeys[i] = aItems[i].getKey();
}
return aKeys;
};
/*
* Retrieves the selectables items from the aggregation named <code>items</code>.
*
* @returns {sap.ui.core.Item[]} An array containing the selectables items.
* @protected
*/
ComboBoxBase.prototype.getSelectableItems = function() {
return this.getEnabledItems(this.getVisibleItems());
};
/*
* Getter for the control's picker pop-up open area element.
*
* @returns {Element | null} Returns the element that is used as trigger to open the control's picker pop-up.
* @protected
*/
ComboBoxBase.prototype.getOpenArea = function() {
return this.getDomRef("arrow");
};
/*
* Checks whether the provided element is the open area.
*
* @param {Element} oDomRef
* @returns {boolean}
* @protected
*/
ComboBoxBase.prototype.isOpenArea = function(oDomRef) {
var oOpenAreaDomRef = this.getOpenArea();
return oOpenAreaDomRef && oOpenAreaDomRef.contains(oDomRef);
};
/*
* Retrieves a item by searching for the given property/value from the aggregation named <code>items</code>.
* If duplicate values exist, the first item matching the value is returned.
*
* @param {string} sProperty An item property.
* @param {string} sValue An item value that specifies the item to retrieve.
* @returns {sap.ui.core.Item | null} The matched item or null.
* @protected
*/
ComboBoxBase.prototype.findItem = function(sProperty, sValue) {
var sMethod = "get" + sProperty.charAt(0).toUpperCase() + sProperty.slice(1);
for (var i = 0, aItems = this.getItems(); i < aItems.length; i++) {
if (aItems[i][sMethod]() === sValue) {
return aItems[i];
}
}
return null;
};
/*
* Retrieves the item with the given value from the aggregation named <code>items</code>.
* If duplicate values exist, the first item matching the value is returned.
*
* @param {string} sText An item value that specifies the item to retrieve.
* @returns {sap.ui.core.Item | null} The matched item or null.
* @protected
*/
ComboBoxBase.prototype.getItemByText = function(sText) {
return this.findItem("text", sText);
};
/*
* Scrolls an item into the visual viewport.
*
* @protected
*/
ComboBoxBase.prototype.scrollToItem = function(oItem) {
var oPicker = this.getPicker(),
oPickerDomRef = oPicker.getDomRef("cont"),
oItemDomRef = oItem && oItem.getDomRef();
if (!oPicker || !oPickerDomRef || !oItemDomRef) {
return;
}
var iPickerScrollTop = oPickerDomRef.scrollTop,
iItemOffsetTop = oItemDomRef.offsetTop,
iPickerHeight = oPickerDomRef.clientHeight,
iItemHeight = oItemDomRef.offsetHeight;
if (iPickerScrollTop > iItemOffsetTop) {
// scroll up
oPickerDomRef.scrollTop = iItemOffsetTop;
// bottom edge of item > bottom edge of viewport
} else if ((iItemOffsetTop + iItemHeight) > (iPickerScrollTop + iPickerHeight)) {
// scroll down, the item is partly below the viewport of the List
oPickerDomRef.scrollTop = Math.ceil(iItemOffsetTop + iItemHeight - iPickerHeight);
}
};
/*
* Clear the filter
*
* @protected
*/
ComboBoxBase.prototype.clearFilter = function() {
for (var i = 0, oListItem, aItems = this.getItems(); i < aItems.length; i++) {
oListItem = this.getListItem(aItems[i]);
oListItem.setVisible(true);
}
};
/*
* Clear the selection.
* To be overwritten by subclasses.
*
* @protected
*/
ComboBoxBase.prototype.clearSelection = function() {};
/* ----------------------------------------------------------- */
/* public methods */
/* ----------------------------------------------------------- */
/**
* Getter for property <code>value</code>.
* Defines the value of the control's input field.
*
* Default value is empty/<code>undefined</code>
*
* @return {string} the value of property <code>value</code>
* @public
*/
ComboBoxBase.prototype.getValue = function() {
var oDomRef = this.getFocusDomRef();
// if the input field is rendered
if (oDomRef) {
// return the live value
return oDomRef.value;
}
// else return the value from the model
return this.getProperty("value");
};
/**
* Adds some item <code>oItem</code> to the aggregation named <code>items</code>.
*
* @param {sap.ui.core.Item} oItem The item to add; if empty, nothing is added.
* @returns {sap.m.ComboBoxBase} <code>this</code> to allow method chaining.
* @public
*/
ComboBoxBase.prototype.addItem = function(oItem) {
this.addAggregation("items", oItem);
if (this.getList()) {
this.getList().addItem(this._mapItemToListItem(oItem));
}
return this;
};
/**
* Inserts an item into the aggregation named <code>items</code>.
*
* @param {sap.ui.core.Item} oItem The item to insert; if empty, nothing is inserted.
* @param {int} iIndex The <code>0</code>-based index the item should be inserted at; for
* a negative value of <code>iIndex</code>, the item is inserted at position 0; for a value
* greater than the current size of the aggregation, the item is inserted at
* the last position.
* @returns {sap.m.ComboBoxBase} <code>this</code> to allow method chaining.
* @public
*/
ComboBoxBase.prototype.insertItem = function(oItem, iIndex) {
this.insertAggregation("items", oItem, iIndex);
if (this.getList()) {
this.getList().insertItem(this._mapItemToListItem(oItem), iIndex);
}
return this;
};
/**
* Retrieves the item from the aggregation named <code>items</code> at the given 0-based index.
*
* @param {int} iIndex Index of the item to return.
* @returns {sap.ui.core.Item} Item at the given index, or null if none.
* @public
* @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
*/
ComboBoxBase.prototype.getItemAt = function(iIndex) {
return this.getItems()[ +iIndex] || null;
};
/**
* Retrieves the first item from the aggregation named <code>items</code>.
*
* @returns {sap.ui.core.Item} The first item, or null if there are no items.
* @public
* @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
*/
ComboBoxBase.prototype.getFirstItem = function() {
return this.getItems()[0] || null;
};
/**
* Retrieves the last item from the aggregation named <code>items</code>.
*
* @returns {sap.ui.core.Item} The last item, or null if there are no items.
* @public
* @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
*/
ComboBoxBase.prototype.getLastItem = function() {
var aItems = this.getItems();
return aItems[aItems.length - 1] || null;
};
/**
* Retrieves the enabled items from the given array of items or from
* this control's aggregation named <code>items</code>.
*
* @param {sap.ui.core.Item[]} [aItems=getItems()] Items to filter.
* @return {sap.ui.core.Item[]} An array containing the enabled items.
* @public
* @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
*/
ComboBoxBase.prototype.getEnabledItems = function(aItems) {
aItems = aItems || this.getItems();
return aItems.filter(function(oItem) {
return oItem.getEnabled();
});
};
/**
* Retrieves the item with the given key from the aggregation named <code>items</code>.
* If duplicate keys exist, the first item matching the key is returned.
*
* @param {string} sKey An item key that specifies the item to retrieve.
* @returns {sap.ui.core.Item}
* @public
* @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
*/
ComboBoxBase.prototype.getItemByKey = function(sKey) {
return this.findItem("key", sKey);
};
/**
* Whether the control's picker pop-up is open. It returns true when the control's picker pop-up is currently open,
* this includes opening and closing animations.
*
* @returns {boolean} Determines whether the control's picker pop-up is currently open (this includes opening and closing animations).
* @public
* @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
*/
ComboBoxBase.prototype.isOpen = function() {
var oPicker = this.getAggregation("picker");
return !!(oPicker && oPicker.isOpen());
};
/**
* Closes the control's picker pop-up.
*
* @returns {sap.m.ComboBoxBase} <code>this</code> to allow method chaining.
* @public
* @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
*/
ComboBoxBase.prototype.close = function() {
var oPicker = this.getAggregation("picker");
if (oPicker) {
oPicker.close();
}
return this;
};
/**
* Removes an item from the aggregation named <code>items</code>.
*
* @param {int | string | sap.ui.core.Item} vItem The item to remove or its index or id.
* @returns {sap.ui.core.Item} The removed item or null.
* @public
*/
ComboBoxBase.prototype.removeItem = function(vItem) {
// remove the item from the aggregation items
vItem = this.removeAggregation("items", vItem);
// remove the corresponding mapped item from the List
if (this.getList()) {
this.getList().removeItem(this.getListItem(vItem));
}
// return the removed item or null
return vItem;
};
/**
* Removes all the controls in the aggregation named <code>items</code>.
* Additionally unregisters them from the hosting UIArea and clears the selection.
*
* @returns {sap.ui.core.Item[]} An array of the removed items (might be empty).
* @public
*/
ComboBoxBase.prototype.removeAllItems = function() {
var aItems = this.removeAllAggregation("items");
// clear the selection
this.clearSelection();
if (this.getList()) {
this.getList().removeAllItems();
}
return aItems;
};
/**
* Destroys all the items in the aggregation named <code>items</code>.
*
* @returns {sap.m.ComboBox} <code>this</code> to allow method chaining.
* @public
*/
ComboBoxBase.prototype.destroyItems = function() {
this.destroyAggregation("items");
if (this.getList()) {
this.getList().destroyItems();
}
return this;
};
return ComboBoxBase;
}, /* bExport= */ true);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,140 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', './InputBaseRenderer', 'sap/ui/core/Renderer'],
function(jQuery, InputBaseRenderer, Renderer) {
"use strict";
/**
* ComboBoxBase renderer.
*
* @namespace
*/
var ComboBoxBaseRenderer = Renderer.extend(InputBaseRenderer);
/**
* CSS class to be applied to the root element of the ComboBoxBase.
*
* @readonly
* @const {string}
*/
ComboBoxBaseRenderer.CSS_CLASS = "sapMComboBoxBase";
/**
* Writes attributes to the control's root element.
* To be overwritten by subclasses.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxBaseRenderer.writeOuterAttributes = function(oRm, oControl) {
// note: in IE browsers, JAWS 15.0 announce the ComboBox only if
// the role combobox is set to the control's root element
oRm.writeAttribute("role", "combobox");
};
/**
* Add attributes to the input element.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxBaseRenderer.writeInnerAttributes = function(oRm, oControl) {
oRm.writeAttribute("autocomplete", "off");
oRm.writeAttribute("autocorrect", "off");
oRm.writeAttribute("autocapitalize", "off");
};
/**
* Writes the accessibility state.
* To be overwritten by subclasses.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxBaseRenderer.writeAccessibilityState = function(oRm, oControl) {
InputBaseRenderer.writeAccessibilityState.apply(this, arguments);
oRm.writeAccessibilityState(oControl, {
role: "combobox",
expanded: oControl.isOpen(),
autocomplete: "both"
});
};
/**
* Add extra styles for input container.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxBaseRenderer.addOuterStyles = function(oRm, oControl) {
oRm.addStyle("max-width", oControl.getMaxWidth());
};
/**
* Add classes to the ComboBox.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxBaseRenderer.addOuterClasses = function(oRm, oControl) {
var CSS_CLASS = ComboBoxBaseRenderer.CSS_CLASS;
oRm.addClass(CSS_CLASS);
oRm.addClass(CSS_CLASS + "Input");
if (!oControl.getEnabled()) {
oRm.addClass(CSS_CLASS + "Disabled");
}
if (!oControl.getEditable()) {
oRm.addClass(CSS_CLASS + "Readonly");
}
};
/**
* Add inner classes to the ComboBox's input element.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxBaseRenderer.addInnerClasses = function(oRm, oControl) {
var CSS_CLASS = ComboBoxBaseRenderer.CSS_CLASS;
oRm.addClass(CSS_CLASS + "InputInner");
if (!oControl.getEditable()) {
oRm.addClass(CSS_CLASS + "InputInnerReadonly");
}
};
/**
* Renders the ComboBox's arrow, using the provided {@link sap.ui.core.RenderManager}.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxBaseRenderer.writeInnerContent = function(oRm, oControl) {
oRm.write('<button tabindex="-1"');
oRm.writeAttribute("id", oControl.getId() + "-arrow");
this.addButtonClasses(oRm, oControl);
oRm.writeClasses();
oRm.write("></button>");
};
/**
* Add CSS classes to the combo box arrow button, using the provided {@link sap.ui.core.RenderManager}.
* To be overwritten by subclasses.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxBaseRenderer.addButtonClasses = function(oRm, oControl) {
oRm.addClass(ComboBoxBaseRenderer.CSS_CLASS + "Arrow");
};
return ComboBoxBaseRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./InputBaseRenderer','sap/ui/core/Renderer'],function(q,I,R){"use strict";var C=R.extend(I);C.CSS_CLASS="sapMComboBoxBase";C.writeOuterAttributes=function(r,c){r.writeAttribute("role","combobox");};C.writeInnerAttributes=function(r,c){r.writeAttribute("autocomplete","off");r.writeAttribute("autocorrect","off");r.writeAttribute("autocapitalize","off");};C.writeAccessibilityState=function(r,c){I.writeAccessibilityState.apply(this,arguments);r.writeAccessibilityState(c,{role:"combobox",expanded:c.isOpen(),autocomplete:"both"});};C.addOuterStyles=function(r,c){r.addStyle("max-width",c.getMaxWidth());};C.addOuterClasses=function(r,c){var a=C.CSS_CLASS;r.addClass(a);r.addClass(a+"Input");if(!c.getEnabled()){r.addClass(a+"Disabled");}if(!c.getEditable()){r.addClass(a+"Readonly");}};C.addInnerClasses=function(r,c){var a=C.CSS_CLASS;r.addClass(a+"InputInner");if(!c.getEditable()){r.addClass(a+"InputInnerReadonly");}};C.writeInnerContent=function(r,c){r.write('<button tabindex="-1"');r.writeAttribute("id",c.getId()+"-arrow");this.addButtonClasses(r,c);r.writeClasses();r.write("></button>");};C.addButtonClasses=function(r,c){r.addClass(C.CSS_CLASS+"Arrow");};return C;},true);

View File

@ -0,0 +1,70 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', './ComboBoxBaseRenderer', 'sap/ui/core/Renderer'],
function(jQuery, ComboBoxBaseRenderer, Renderer) {
"use strict";
/**
* ComboBox renderer.
*
* @namespace
*/
var ComboBoxRenderer = Renderer.extend(sap.m.ComboBoxBaseRenderer);
/**
* CSS class to be applied to the root element of the ComboBox.
*
* @readonly
* @const {string}
*/
ComboBoxRenderer.CSS_CLASS = "sapMComboBox";
/**
* Add classes to the ComboBox.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxRenderer.addOuterClasses = function(oRm, oControl) {
var CSS_CLASS = ComboBoxRenderer.CSS_CLASS,
sValueState = oControl.getValueState();
sap.m.ComboBoxBaseRenderer.addOuterClasses.apply(this, arguments);
oRm.addClass(CSS_CLASS);
oRm.addClass(CSS_CLASS + "Input");
if (sValueState !== sap.ui.core.ValueState.None) {
oRm.addClass(CSS_CLASS + "State");
oRm.addClass(CSS_CLASS + sValueState);
}
};
/**
* Add inner classes to the ComboBox's input element.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxRenderer.addInnerClasses = function(oRm, oControl) {
sap.m.ComboBoxBaseRenderer.addInnerClasses.apply(this, arguments);
oRm.addClass(ComboBoxRenderer.CSS_CLASS + "InputInner");
};
/**
* Add CSS classes to the combo box arrow button, using the provided {@link sap.ui.core.RenderManager}.
* To be overwritten by subclasses.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
ComboBoxRenderer.addButtonClasses = function(oRm, oControl) {
sap.m.ComboBoxBaseRenderer.addButtonClasses.apply(this, arguments);
oRm.addClass(ComboBoxRenderer.CSS_CLASS + "Arrow");
};
return ComboBoxRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./ComboBoxBaseRenderer','sap/ui/core/Renderer'],function(q,C,R){"use strict";var a=R.extend(sap.m.ComboBoxBaseRenderer);a.CSS_CLASS="sapMComboBox";a.addOuterClasses=function(r,c){var b=a.CSS_CLASS,v=c.getValueState();sap.m.ComboBoxBaseRenderer.addOuterClasses.apply(this,arguments);r.addClass(b);r.addClass(b+"Input");if(v!==sap.ui.core.ValueState.None){r.addClass(b+"State");r.addClass(b+v);}};a.addInnerClasses=function(r,c){sap.m.ComboBoxBaseRenderer.addInnerClasses.apply(this,arguments);r.addClass(a.CSS_CLASS+"InputInner");};a.addButtonClasses=function(r,c){sap.m.ComboBoxBaseRenderer.addButtonClasses.apply(this,arguments);r.addClass(a.CSS_CLASS+"Arrow");};return a;},true);

View File

@ -0,0 +1,52 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.CustomListItem.
sap.ui.define(['jquery.sap.global', './ListItemBase', './library'],
function(jQuery, ListItemBase, library) {
"use strict";
/**
* Constructor for a new CustomListItem.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* This control with a content aggregation can be used to customize standard list items that we don't provide. List mode and ListItem type are applied to CustomListItems as well.
* Note: Even the content aggregation allows any control, complex responsive layout controls (e.g. Table, Form) should not be aggregated as content.
*
* @extends sap.m.ListItemBase
*
* @author SAP SE
* @version 1.28.5
*
* @constructor
* @public
* @alias sap.m.CustomListItem
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var CustomListItem = ListItemBase.extend("sap.m.CustomListItem", /** @lends sap.m.CustomListItem.prototype */ { metadata : {
library : "sap.m",
defaultAggregation : "content",
aggregations : {
/**
* The content of this list item
*/
content : {type : "sap.ui.core.Control", multiple : true, singularName : "content", bindable : "bindable"}
}
}});
return CustomListItem;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./ListItemBase','./library'],function(q,L,l){"use strict";var C=L.extend("sap.m.CustomListItem",{metadata:{library:"sap.m",defaultAggregation:"content",aggregations:{content:{type:"sap.ui.core.Control",multiple:true,singularName:"content",bindable:"bindable"}}}});return C;},true);

View File

@ -0,0 +1,43 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', './ListItemBaseRenderer', 'sap/ui/core/Renderer'],
function(jQuery, ListItemBaseRenderer, Renderer) {
"use strict";
/**
* CustomListItem renderer.
* @namespace
*/
var CustomListItemRenderer = Renderer.extend(ListItemBaseRenderer);
/**
* Renders the HTML for the given control, using the provided
* {@link sap.ui.core.RenderManager}.
*
* @param {sap.ui.core.RenderManager}
* oRenderManager the RenderManager that can be used for writing to
* the Render-Output-Buffer
* @param {sap.ui.core.Control}
* oControl an object representation of the control that should be
* rendered
*/
CustomListItemRenderer.renderLIAttributes = function(rm, oLI) {
rm.addClass("sapMCLI");
};
CustomListItemRenderer.renderLIContent = function(rm, oLI) {
var aContent = oLI.getContent();
var cLength = aContent.length;
for ( var i = 0; i < cLength; i++) {
rm.renderControl(aContent[i]);
}
};
return CustomListItemRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./ListItemBaseRenderer','sap/ui/core/Renderer'],function(q,L,R){"use strict";var C=R.extend(L);C.renderLIAttributes=function(r,l){r.addClass("sapMCLI");};C.renderLIContent=function(r,l){var c=l.getContent();var a=c.length;for(var i=0;i<a;i++){r.renderControl(c[i]);}};return C;},true);

View File

@ -0,0 +1,50 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.CustomTile.
sap.ui.define(['jquery.sap.global', './Tile', './library'],
function(jQuery, Tile, library) {
"use strict";
/**
* Constructor for a new CustomTile.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* Use the Custom Tile to show a application specific content in the tile.
* The tile width is 8.5em and height is 10em
* @extends sap.m.Tile
* @version 1.28.5
*
* @constructor
* @public
* @since 1.12
* @alias sap.m.CustomTile
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var CustomTile = Tile.extend("sap.m.CustomTile", /** @lends sap.m.CustomTile.prototype */ { metadata : {
library : "sap.m",
defaultAggregation : "content",
aggregations : {
/**
* Defines the Content of the CustomTile
*/
content : {type : "sap.ui.core.Control", multiple : false}
}
}});
return CustomTile;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./Tile','./library'],function(q,T,l){"use strict";var C=T.extend("sap.m.CustomTile",{metadata:{library:"sap.m",defaultAggregation:"content",aggregations:{content:{type:"sap.ui.core.Control",multiple:false}}}});return C;},true);

View File

@ -0,0 +1,56 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', './TileRenderer'],
function(jQuery, TileRenderer) {
"use strict";
/**
* CustomTile renderer.
* @namespace
*/
var CustomTileRenderer = sap.ui.core.Renderer.extend(TileRenderer);
/**
* Renders the HTML for the given control, using the provided {@link sap.ui.core.RenderManager}.
*
* @param {sap.ui.core.RenderManager}
* oRm the RenderManager that can be used for writing to the render output buffer
* @param {sap.ui.core.Control}
* oControl an object representation of the control that should be rendered
*/
CustomTileRenderer.render = function(rm, oControl) {
rm.write("<div tabindex=\"0\"");
rm.writeControlData(oControl);
rm.addClass("sapMCustomTile");
rm.writeClasses();
if (oControl._invisible) {
rm.addStyle("visibility", "hidden");
rm.writeStyles();
}
/* WAI ARIA if in TileContainer context */
if (oControl.getParent() instanceof sap.m.TileContainer) {
rm.writeAccessibilityState({
role: "option",
posinset: oControl._getTileIndex(),
setsize: oControl._getTilesCount()
});
}
rm.write(">");
rm.write("<div id=\"" + oControl.getId() + "-remove\" class=\"sapMTCRemove\"></div>");
rm.write("<div class=\"sapMCustomTileContent\">");
this._renderContent(rm,oControl);
rm.write("</div></div>");
};
CustomTileRenderer._renderContent = function (rm, oTile) {
rm.renderControl(oTile.getContent());
};
return CustomTileRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./TileRenderer'],function(q,T){"use strict";var C=sap.ui.core.Renderer.extend(T);C.render=function(r,c){r.write("<div tabindex=\"0\"");r.writeControlData(c);r.addClass("sapMCustomTile");r.writeClasses();if(c._invisible){r.addStyle("visibility","hidden");r.writeStyles();}if(c.getParent()instanceof sap.m.TileContainer){r.writeAccessibilityState({role:"option",posinset:c._getTileIndex(),setsize:c._getTilesCount()});}r.write(">");r.write("<div id=\""+c.getId()+"-remove\" class=\"sapMTCRemove\"></div>");r.write("<div class=\"sapMCustomTileContent\">");this._renderContent(r,c);r.write("</div></div>");};C._renderContent=function(r,t){r.renderControl(t.getContent());};return C;},true);

View File

@ -0,0 +1,841 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.DatePicker.
sap.ui.define(['jquery.sap.global', './InputBase', './library', 'sap/ui/model/type/Date'],
function(jQuery, InputBase, library, Date1) {
"use strict";
/**
* Constructor for a new DatePicker.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* This is an date input control with a calendar DatePicker.
* It internal uses the sap.ui.unified.Calendar. So the sap.ui.unified library should be loaded from applications using this control. (Otherwise it will be loaded by opening the DatePicker.)
* @extends sap.m.InputBase
* @version 1.28.5
*
* @constructor
* @public
* @since 1.22.0
* @alias sap.m.DatePicker
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var DatePicker = InputBase.extend("sap.m.DatePicker", /** @lends sap.m.DatePicker.prototype */ { metadata : {
library : "sap.m",
properties : {
/**
* Displays date value in this given format in text field. Default value is taken from locale settings.
* If you use data-binding on value property with type sap.ui.model.type.Date then you can ignore this property or latter wins.
*/
displayFormat : {type : "string", group : "Appearance", defaultValue : null},
/**
* Given value property should match with valueFormat to parse date. Default value is taken from locale settings.
* You can set and get value in this format.
* If you use data-binding on value property with type sap.ui.model.type.Date you can ignore this property or latter wins.
*/
valueFormat : {type : "string", group : "Data", defaultValue : null},
/**
* This property as JavaScript Date Object can be used to assign a new value which is independent from valueFormat.
* If this property is used, the value property should not be changed from the caller.
*/
dateValue : {type : "object", group : "Data", defaultValue : null}
}
}});
(function() {
DatePicker.prototype.init = function() {
InputBase.prototype.init.apply(this, arguments);
this._inputProxy = jQuery.proxy(_onInput, this);
this._bIntervalSelection = false;
this._bValid = true;
this._oMinDate = new Date(1, 0, 1);
this._oMinDate.setFullYear(1); // otherwise year 1 will be converted to year 1901
this._oMaxDate = new Date(9999, 11, 31);
this._bMobile = !sap.ui.Device.system.desktop;
};
DatePicker.prototype.exit = function() {
InputBase.prototype.exit.apply(this, arguments);
if (this._oPopup) {
if (this._oPopup.isOpen()) {
this._oPopup.close();
}
delete this._oPopup;
}
if (this._oCalendar) {
this._oCalendar.destroy();
delete this._oCalendar;
}
this._sUsedDisplayPattern = undefined;
this._sDisplayFormat = undefined;
this._sUsedValuePattern = undefined;
this._sValueFormat = undefined;
};
DatePicker.prototype.onAfterRendering = function() {
InputBase.prototype.onAfterRendering.apply(this, arguments);
this.bindToInputEvent(this._inputProxy);
};
DatePicker.prototype.invalidate = function(oOrigin) {
if (!oOrigin || oOrigin != this._oCalendar) {
// Calendar is only invalidated by DatePicker itself -> so don't invalidate DatePicker
sap.ui.core.Control.prototype.invalidate.apply(this, arguments);
}
};
/**
* Defines the width of the DatePicker. Default value is 100%
*
* @param {string} sWidth new value for <code>width</code>
* @returns {sap.m.DatePicker} <code>this</code> to allow method chaining
* @public
*/
DatePicker.prototype.setWidth = function(sWidth) {
return InputBase.prototype.setWidth.call(this, sWidth || "100%");
};
DatePicker.prototype.getWidth = function(sWidth) {
return this.getProperty("width") || "100%";
};
DatePicker.prototype.applyFocusInfo = function(oFocusInfo) {
this._bFocusNoPopup = true;
InputBase.prototype.applyFocusInfo.apply(this, arguments);
};
DatePicker.prototype.onfocusin = function(oEvent) {
InputBase.prototype.onfocusin.apply(this, arguments);
if (this._bMobile && !jQuery(oEvent.target).hasClass("sapUiIcon") && !this._bFocusNoPopup &&
this.getEditable() && this.getEnabled()) {
// on mobile devices open calendar
var that = this;
if (!this._oPopup || !this._oPopup.isOpen()) {
_open(that);
}
}
this._bFocusNoPopup = undefined;
};
DatePicker.prototype.onsapshow = function(oEvent) {
var that = this;
_toggleOpen(that);
oEvent.preventDefault(); // otherwise IE opens the address bar history
};
// ALT-UP and ALT-DOWN should behave the same
DatePicker.prototype.onsaphide = DatePicker.prototype.onsapshow;
DatePicker.prototype.onsappageup = function(oEvent){
//increase by one day
var that = this;
_increaseDate(that, 1, "day");
oEvent.preventDefault(); // do not move cursor
};
DatePicker.prototype.onsappageupmodifiers = function(oEvent){
var that = this;
if (!oEvent.ctrlKey && oEvent.shiftKey) {
// increase by one month
_increaseDate(that, 1, "month");
} else {
// increase by one year
_increaseDate(that, 1, "year");
}
oEvent.preventDefault(); // do not move cursor
};
DatePicker.prototype.onsappagedown = function(oEvent){
//decrease by one day
var that = this;
_increaseDate(that, -1, "day");
oEvent.preventDefault(); // do not move cursor
};
DatePicker.prototype.onsappagedownmodifiers = function(oEvent){
var that = this;
if (!oEvent.ctrlKey && oEvent.shiftKey) {
// decrease by one month
_increaseDate(that, -1, "month");
} else {
// decrease by one year
_increaseDate(that, -1, "year");
}
oEvent.preventDefault(); // do not move cursor
};
DatePicker.prototype.onkeypress = function(oEvent){
if (oEvent.charCode) {
var that = this;
var oFormatter = _getFormatter(that, true);
var sChar = String.fromCharCode(oEvent.charCode);
if (sChar && oFormatter.sAllowedCharacters && oFormatter.sAllowedCharacters.indexOf(sChar) < 0) {
oEvent.preventDefault();
}
}
};
DatePicker.prototype.onclick = function(oEvent) {
var that = this;
if (jQuery(oEvent.target).hasClass("sapUiIcon")) {
_toggleOpen(that);
} else if (this._bMobile && (!this._oPopup || !this._oPopup.isOpen()) &&
this.getEditable() && this.getEnabled()) {
_open(that);
}
};
DatePicker.prototype.setValue = function(sValue) {
sValue = this.validateProperty("value", sValue); // to convert null and undefined to ""
var sOldValue = this.getValue();
if (sValue == sOldValue) {
return this;
} else {
this._lastValue = sValue;
}
// set the property in any case but check validity on output
this.setProperty("value", sValue, true); // no rerendering
this._bValid = true;
// convert to date object
var oDate;
if (sValue) {
oDate = this._parseValue(sValue);
if (!oDate || oDate.getTime() < this._oMinDate.getTime() || oDate.getTime() > this._oMaxDate.getTime()) {
this._bValid = false;
jQuery.sap.log.warning("Value can not be converted to a valid date", this);
}
}
if (this._bValid) {
this.setProperty("dateValue", oDate, true); // no rerendering
}
// do not call InputBase.setValue because the displayed value and the output value might have different pattern
if (this.getDomRef()) {
// convert to output
var sOutputValue;
if (oDate) {
sOutputValue = this._formatValue(oDate);
} else {
sOutputValue = sValue;
}
if (this._$input.val() !== sOutputValue) {
this._$input.val(sOutputValue);
this._setLabelVisibility();
this._curpos = this._$input.cursorPos();
}
}
return this;
};
DatePicker.prototype.setDateValue = function(oDate) {
if (jQuery.sap.equal(this.getDateValue(), oDate)) {
return this;
}
if (oDate && !(oDate instanceof Date)) {
throw new Error("Date must be a JavaScript date object; " + this);
}
if (oDate && (oDate.getTime() < this._oMinDate.getTime() || oDate.getTime() > this._oMaxDate.getTime())) {
this._bValid = false;
jQuery.sap.assert(this._bValid, "Date must be in valid range");
}else {
this._bValid = true;
this.setProperty("dateValue", oDate, true); // no rerendering
}
// convert date object to value
var sValue = this._formatValue(oDate, true);
if (sValue !== this.getValue()) {
this._lastValue = sValue;
}
// set the property in any case but check validity on output
this.setProperty("value", sValue, true); // no rerendering
if (this.getDomRef()) {
// convert to output
var sOutputValue = this._formatValue(oDate);
if (this._$input.val() !== sOutputValue) {
this._$input.val(sOutputValue);
this._setLabelVisibility();
this._curpos = this._$input.cursorPos();
}
}
return this;
};
DatePicker.prototype.setValueFormat = function(sValueFormat) {
// if valueFormat changes the value must be parsed again
this.setProperty("valueFormat", sValueFormat, true); // no rerendering
var sValue = this.getValue();
if (sValue) {
var oDate = this._parseValue(sValue);
if (!oDate || oDate.getTime() < this._oMinDate.getTime() || oDate.getTime() > this._oMaxDate.getTime()) {
this._bValid = false;
jQuery.sap.log.warning("Value can not be converted to a valid date", this);
}else {
this._bValid = true;
this.setProperty("dateValue", oDate, true); // no rerendering
}
}
return this;
};
DatePicker.prototype.setDisplayFormat = function(sDisplayFormat) {
// if displayFormat changes the value must be formatted again
this.setProperty("displayFormat", sDisplayFormat, true); // no rerendering
var sOutputValue = this._formatValue(this.getDateValue());
if (this.getDomRef() && (this._$input.val() !== sOutputValue)) {
this._$input.val(sOutputValue);
this._curpos = this._$input.cursorPos();
}
return this;
};
DatePicker.prototype.onChange = function(oEvent) {
// don't call InputBase onChange because this calls setValue what would trigger a new formatting
// check the control is editable or not
if (!this.getEditable() || !this.getEnabled()) {
return;
}
// set date before fire change event
var sValue = this._$input.val();
var sOldValue = this._formatValue(this.getDateValue());
if (sValue == sOldValue && this._bValid) {
// only needed if value really changed
return;
}
var oDate;
this._bValid = true;
if (sValue != "") {
oDate = this._parseValue(sValue, true);
if (!oDate || oDate.getTime() < this._oMinDate.getTime() || oDate.getTime() > this._oMaxDate.getTime()) {
this._bValid = false;
oDate = undefined;
}else {
// check if Formatter changed the value (it correct some wrong inputs or known patterns)
sValue = this._formatValue(oDate);
}
}
if (this.getDomRef() && (this._$input.val() !== sValue)) {
this._$input.val(sValue);
this._curpos = this._$input.cursorPos();
if (this._$label) {
// because value property might not be updated between typing
this._$label.css("display", sValue ? "none" : "inline");
}
}
if (oDate) {
// get the value in valueFormat
sValue = this._formatValue(oDate, true);
}
// compare with the old known value
if (sValue !== this._lastValue) {
this.setProperty("value", sValue, true); // no rerendering
if (this._bValid) {
this.setProperty("dateValue", oDate, true); // no rerendering
}
// remember the last value on change
this._lastValue = sValue;
this.fireChangeEvent(sValue, {valid: this._bValid});
if (this._oPopup && this._oPopup.isOpen()) {
this._oCalendar.focusDate(oDate);
var oStartDate = this._oDateRange.getStartDate();
if ((!oStartDate && oDate) || (oStartDate && oDate && oStartDate.getTime() != oDate.getTime())) {
this._oDateRange.setStartDate(new Date(oDate.getTime()));
} else if (oStartDate && !oDate) {
this._oDateRange.setStartDate(undefined);
}
}
}
};
// overwrite _getInputValue to do the conversion there
DatePicker.prototype._getInputValue = function(sValue) {
sValue = (typeof sValue == "undefined") ? this._$input.val() : sValue.toString();
var oDate = this._parseValue(sValue, true);
sValue = this._formatValue(oDate, true);
return sValue;
};
// overwrite _getInputValue to do the output conversion
DatePicker.prototype.updateDomValue = function(sValue) {
// dom value updated other than value property
this._bCheckDomValue = true;
sValue = (typeof sValue == "undefined") ? this._$input.val() : sValue.toString();
this._curpos = this._$input.cursorPos();
var oDate = this._parseValue(sValue, true);
sValue = this._formatValue(oDate);
// update the DOM value when necessary
// otherwise cursor can goto end of text unnecessarily
if (this.isActive() && (this._$input.val() !== sValue)) {
this._$input.val(sValue);
this._$input.cursorPos(this._curpos);
}
// update synthetic placeholder visibility
this._setLabelVisibility();
return this;
};
DatePicker.prototype._parseValue = function(sValue, bDisplayFormat) {
var oFormat;
var that = this;
oFormat = _getFormatter(that, bDisplayFormat);
// convert to date object
var oDate = oFormat.parse(sValue);
return oDate;
};
// converts the date to the output format, but if bValueFormat set it converts it to the input format
DatePicker.prototype._formatValue = function(oDate, bValueFormat) {
var sValue = "";
if (oDate) {
var oFormat;
var that = this;
oFormat = _getFormatter(that, !bValueFormat);
// convert to date object
sValue = oFormat.format(oDate);
}
return sValue;
};
DatePicker.prototype._getPlaceholder = function() {
var sPlaceholder = this.getPlaceholder();
if (!sPlaceholder) {
var oBinding = this.getBinding("value");
if (oBinding && oBinding.oType && (oBinding.oType instanceof Date1)) {
sPlaceholder = oBinding.oType.getOutputPattern();
} else {
sPlaceholder = this.getDisplayFormat();
}
if (!sPlaceholder) {
sPlaceholder = "medium";
}
if (sPlaceholder == "short" || sPlaceholder == "medium" || sPlaceholder == "long") {
var oLocale = sap.ui.getCore().getConfiguration().getFormatSettings().getFormatLocale();
var oLocaleData = sap.ui.core.LocaleData.getInstance(oLocale);
sPlaceholder = oLocaleData.getDatePattern(sPlaceholder);
}
}
return sPlaceholder;
};
function _open(oThis){
if (!oThis._oPopup) {
jQuery.sap.require("sap.ui.core.Popup");
oThis._oPopup = new sap.ui.core.Popup();
oThis._oPopup.setAutoClose(true);
oThis._oPopup.setDurations(0, 0); // no animations
oThis._oPopup.attachOpened(_handleOpened, oThis);
// oThis._oPopup.attachClosed(_handleClosed, oThis);
}
if (!oThis._oCalendar) {
sap.ui.getCore().loadLibrary("sap.ui.unified");
jQuery.sap.require("sap.ui.unified.library");
oThis._oCalendar = new sap.ui.unified.Calendar(oThis.getId() + "-cal", {intervalSelection: oThis._bIntervalSelection});
oThis._oDateRange = new sap.ui.unified.DateRange();
oThis._oCalendar.addSelectedDate(oThis._oDateRange);
oThis._oCalendar.attachSelect(oThis._selectDate, oThis);
oThis._oCalendar.attachCancel(_cancel, oThis);
oThis._oCalendar.attachEvent("_renderMonth", _resizeCalendar, oThis);
oThis._oPopup.setContent(oThis._oCalendar);
if (oThis.$().closest(".sapUiSizeCompact").length > 0) {
oThis._oCalendar.addStyleClass("sapUiSizeCompact");
}
oThis._oCalendar.setPopupMode(true);
oThis._oCalendar.setParent(oThis, undefined, true); // don't invalidate DatePicker
}
var sValue = oThis._formatValue(oThis.getDateValue());
if (sValue != oThis._$input.val()) {
oThis.onChange(); // to check manually typed in text
}
oThis._fillDateRange();
oThis._oPopup.setAutoCloseAreas([oThis.getDomRef()]);
var eDock = sap.ui.core.Popup.Dock;
var sAt;
if (oThis.getTextAlign() == sap.ui.core.TextAlign.End) {
sAt = eDock.EndBottom + "-4"; // as m.Input has some padding around
oThis._oPopup.open(0, eDock.EndTop, sAt, oThis, null, "fit", true);
}else {
sAt = eDock.BeginBottom + "-4"; // as m.Input has some padding around
oThis._oPopup.open(0, eDock.BeginTop, sAt, oThis, null, "fit", true);
}
}
DatePicker.prototype._fillDateRange = function(){
var oDate = this.getDateValue();
if (oDate) {
this._oCalendar.focusDate(new Date(oDate.getTime()));
if (!this._oDateRange.getStartDate() || this._oDateRange.getStartDate().getTime() != oDate.getTime()) {
this._oDateRange.setStartDate(new Date(oDate.getTime()));
}
} else if (this._oDateRange.getStartDate()) {
this._oDateRange.setStartDate(undefined);
}
};
function _toggleOpen(oThis){
if (oThis.getEditable() && oThis.getEnabled()) {
if (!oThis._oPopup || !oThis._oPopup.isOpen()) {
_open(oThis);
} else {
oThis._oPopup.close();
}
}
}
DatePicker.prototype._selectDate = function(oEvent){
var aSelectedDates = this._oCalendar.getSelectedDates();
var oDateOld = this.getDateValue();
var oDate;
var sValue = "";
this._oPopup.close();
this._bFocusNoPopup = true;
this.focus();
if (aSelectedDates.length > 0) {
oDate = aSelectedDates[0].getStartDate();
}
// do not use this.onChange() because output pattern will change date (e.g. only last 2 number of year -> 1966 -> 2066 )
if (!jQuery.sap.equal(oDate, oDateOld)) {
this.setDateValue(oDate);
// compare Dates because value can be the same if only 2 digits for year
sValue = this.getValue();
this.fireChangeEvent(sValue, {valid: true});
if (this.getDomRef()) { // as control could be destroyed during update binding
this._curpos = this._$input.val().length;
this._$input.cursorPos(this._curpos);
}
}else if (!this._bValid){
// wrong input before open calendar
sValue = this._formatValue(oDate);
if (sValue != this._$input.val()) {
this._bValid = true;
if (this.getDomRef()) { // as control could be destroyed during update binding
this._$input.val(sValue);
}
this.fireChangeEvent(sValue, {valid: true});
}
}
};
function _cancel(oEvent) {
if (this._oPopup && this._oPopup.isOpen()) {
this._oPopup.close();
this._bFocusNoPopup = true;
this.focus();
}
}
/*
function _handleClosed(oEvent) {
};
*/
function _increaseDate(oThis, iNumber, sUnit) {
var oOldDate = oThis.getDateValue();
var iCurpos = oThis._$input.cursorPos();
if (oOldDate && oThis.getEditable() && oThis.getEnabled()) {
// use a new date object to have a real updated property
var oDate = new Date(oOldDate.getTime());
switch (sUnit) {
case "day":
oDate.setDate(oDate.getDate() + iNumber);
break;
case "month":
oDate.setMonth(oDate.getMonth() + iNumber);
var iMonth = (oOldDate.getMonth() + iNumber) % 12;
if (iMonth < 0) {
iMonth = 12 + iMonth;
}
while (oDate.getMonth() != iMonth) {
// day don't exist in this month (e.g. 31th)
oDate.setDate(oDate.getDate() - 1);
}
break;
case "year":
oDate.setFullYear(oDate.getFullYear() + iNumber);
while (oDate.getMonth() != oOldDate.getMonth()) {
// day don't exist in this month (February 28th)
oDate.setDate(oDate.getDate() - 1);
}
break;
default:
break;
}
if (oDate.getTime() < oThis._oMinDate.getTime()) {
oDate = new Date(oThis._oMinDate.getTime());
}else if (oDate.getTime() > oThis._oMaxDate.getTime()){
oDate = new Date(oThis._oMaxDate.getTime());
}
oThis.setDateValue(oDate);
oThis._curpos = iCurpos;
oThis._$input.cursorPos(oThis._curpos);
var sValue = oThis.getValue();
oThis.fireChangeEvent(sValue, {valid: true});
}
}
function _onInput(oEvent){
// do not use sap.m.InputBase.prototype._setLabelVisibility because value is not updated during typing
if (this.getDomRef() && this._$label) {
var sValue = this._$input.val();
this._$label.css("display", sValue ? "none" : "inline");
}
}
function _handleOpened(oEvent) {
this._renderedDays = this._oCalendar.$("days").children(".sapUiCalDay").length;
}
function _resizeCalendar(oEvent){
var iDays = oEvent.getParameter("days");
if (iDays > this._renderedDays) {
// calendar gets larger, so it could move out of the page -> reposition
this._renderedDays = iDays;
this._oPopup._applyPosition(this._oPopup._oLastPosition);
}
}
function _getFormatter(oThis, bDisplayFormat) {
var sPattern = "";
var bRelative = false;
var oFormat;
var oBinding = oThis.getBinding("value");
if (oBinding && oBinding.oType && (oBinding.oType instanceof Date1)) {
sPattern = oBinding.oType.getOutputPattern();
bRelative = !!oBinding.oType.oOutputFormat.oFormatOptions.relative;
}
/* eslint-disable no-lonely-if */
if (!sPattern) {
// not databinding is used -> use given format
if (bDisplayFormat) {
sPattern = ( oThis.getDisplayFormat() || "medium" );
} else {
sPattern = ( oThis.getValueFormat() || "short" );
}
}
if (bDisplayFormat) {
if (sPattern == oThis._sUsedDisplayPattern) {
oFormat = oThis._sDisplayFormat;
}
} else {
if (sPattern == oThis._sUsedValuePattern) {
oFormat = oThis._sValueFormat;
}
}
if (!oFormat) {
if (sPattern == "short" || sPattern == "medium" || sPattern == "long") {
oFormat = sap.ui.core.format.DateFormat.getInstance({style: sPattern, strictParsing: true, relative: bRelative});
} else {
oFormat = sap.ui.core.format.DateFormat.getInstance({pattern: sPattern, strictParsing: true, relative: bRelative});
}
if (bDisplayFormat) {
oThis._sUsedDisplayPattern = sPattern;
oThis._sDisplayFormat = oFormat;
} else {
oThis._sUsedValuePattern = sPattern;
oThis._sValueFormat = oFormat;
}
}
return oFormat;
}
}());
/**
* This event gets fired when the input operation has finished and the value has changed.
*
* @name sap.m.DatePicker#change
* @event
* @param {sap.ui.base.Event} oControlEvent
* @param {sap.ui.base.EventProvider} oControlEvent.getSource
* @param {object} oControlEvent.getParameters
* @param {string} oControlEvent.getParameters.value The new value of the input.
* @param {boolean} oControlEvent.getParameters.valid Indicator for a valid date.
* @public
*/
/**
* Fire event change to attached listeners.
*
* Expects following event parameters:
* <ul>
* <li>'value' of type <code>string</code> The new value of the input.</li>
* <li>'valid' of type <code>boolean</code> Indicator for a valid date.</li>
* </ul>
*
* @param {Map} [mArguments] the arguments to pass along with the event.
* @return {sap.m.DatePicker} <code>this</code> to allow method chaining
* @protected
* @name sap.m.DatePicker#fireChange
* @function
*/
return DatePicker;
}, /* bExport= */ true);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,117 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', 'sap/ui/core/Renderer', './InputBaseRenderer'],
function(jQuery, Renderer, InputBaseRenderer) {
"use strict";
/**
* DatePicker renderer.
* @namespace
*/
var DatePickerRenderer = Renderer.extend(InputBaseRenderer);
/**
* Adds control specific class
*
* @param {sap.ui.core.RenderManager} oRm the RenderManager that can be used for writing to the render output buffer
* @param {sap.m.DatePicker} oDP an object representation of the control that should be rendered
*/
DatePickerRenderer.addOuterClasses = function(oRm, oDP) {
oRm.addClass("sapMDP");
oRm.addClass("sapMInputVH"); // just reuse styling of value help icon
if (sap.ui.Device.browser.internet_explorer && sap.ui.Device.browser.version < 11) {
oRm.addClass("sapMInputIE9");
}
};
/**
* add extra content to Input
*
* @param {sap.ui.core.RenderManager} oRm the RenderManager that can be used for writing to the render output buffer
* @param {sap.m.DatePicker} oDP an object representation of the control that should be rendered
*/
DatePickerRenderer.writeInnerContent = function(oRm, oDP) {
if (oDP.getEnabled() && oDP.getEditable()) {
var aClasses = ["sapMInputValHelpInner"];
var mAttributes = {};
mAttributes["id"] = oDP.getId() + "-icon";
mAttributes["tabindex"] = "-1"; // to get focus events on it, needed for popup autoclose handling
oRm.write('<div class="sapMInputValHelp">');
oRm.writeIcon("sap-icon://appointment-2", aClasses, mAttributes);
oRm.write("</div>");
}
// invisible span with description for keyboard navigation
var rb = sap.ui.getCore().getLibraryResourceBundle("sap.ui.unified");
// ResourceBundle always returns the key if the text is not found
// ResourceBundle always returns the key if the text is not found
var sText = rb.getText("DATEPICKER_DATE_TYPE");
var sTooltip = sap.ui.core.ValueStateSupport.enrichTooltip(oDP, oDP.getTooltip_AsString());
if (sTooltip) {
// add tooltip to description because it is not read by JAWS from title-attribute if a label is assigned
sText = sText + ". " + sTooltip;
}
oRm.write('<SPAN id="' + oDP.getId() + '-Descr" style="visibility: hidden; display: none;">');
oRm.writeEscaped(sText);
oRm.write('</SPAN>');
};
/**
* Write the value of the input.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.m.DatePicker} oDP An object representation of the control that should be rendered.
*/
DatePickerRenderer.writeInnerValue = function(oRm, oDP) {
oRm.writeAttributeEscaped("value", oDP._formatValue(oDP.getDateValue()));
};
/**
* This method is reserved for derived classes to add extra attributes for the input element.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.m.DatePicker} oDP An object representation of the control that should be rendered.
*/
DatePickerRenderer.writeInnerAttributes = function(oRm, oDP) {
if (oDP._bMobile) {
// prevent keyboard in mobile devices
oRm.writeAttribute("readonly", "readonly");
}
};
DatePickerRenderer.writeAccessibilityState = function(oRm, oDP) {
var mProps = {
role: "combobox",
multiline: false,
autocomplete: "none",
haspopup: true,
owns: oDP.getId() + "-cal",
describedby: {value: oDP.getId() + "-Descr", append: true}};
if (oDP.getValueState() == sap.ui.core.ValueState.Error) {
mProps["invalid"] = true;
}
oRm.writeAccessibilityState(oDP, mProps);
};
return DatePickerRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','sap/ui/core/Renderer','./InputBaseRenderer'],function(q,R,I){"use strict";var D=R.extend(I);D.addOuterClasses=function(r,d){r.addClass("sapMDP");r.addClass("sapMInputVH");if(sap.ui.Device.browser.internet_explorer&&sap.ui.Device.browser.version<11){r.addClass("sapMInputIE9");}};D.writeInnerContent=function(r,d){if(d.getEnabled()&&d.getEditable()){var c=["sapMInputValHelpInner"];var a={};a["id"]=d.getId()+"-icon";a["tabindex"]="-1";r.write('<div class="sapMInputValHelp">');r.writeIcon("sap-icon://appointment-2",c,a);r.write("</div>");}var b=sap.ui.getCore().getLibraryResourceBundle("sap.ui.unified");var t=b.getText("DATEPICKER_DATE_TYPE");var T=sap.ui.core.ValueStateSupport.enrichTooltip(d,d.getTooltip_AsString());if(T){t=t+". "+T;}r.write('<SPAN id="'+d.getId()+'-Descr" style="visibility: hidden; display: none;">');r.writeEscaped(t);r.write('</SPAN>');};D.writeInnerValue=function(r,d){r.writeAttributeEscaped("value",d._formatValue(d.getDateValue()));};D.writeInnerAttributes=function(r,d){if(d._bMobile){r.writeAttribute("readonly","readonly");}};D.writeAccessibilityState=function(r,d){var p={role:"combobox",multiline:false,autocomplete:"none",haspopup:true,owns:d.getId()+"-cal",describedby:{value:d.getId()+"-Descr",append:true}};if(d.getValueState()==sap.ui.core.ValueState.Error){p["invalid"]=true;}r.writeAccessibilityState(d,p);};return D;},true);

View File

@ -0,0 +1,710 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.DateRangeSelection.
sap.ui.define(['jquery.sap.global', './DatePicker', './library'],
function(jQuery, DatePicker, library) {
"use strict";
/**
* Constructor for a new DateRangeSelection.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* This is a date range selection control. It internal uses the sap.ui.unified.Calendar. So the sap.ui.unified library should be loaded from applications using this control.
* @extends sap.m.DatePicker
* @version 1.28.5
*
* @constructor
* @public
* @alias sap.m.DateRangeSelection
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var DateRangeSelection = DatePicker.extend("sap.m.DateRangeSelection", /** @lends sap.m.DateRangeSelection.prototype */ { metadata : {
library : "sap.m",
properties : {
/**
* Delimiter of starting and ending date. Default value is "-".
* If no delimiter is given the one defined for the used locale is used.
*/
delimiter : {type : "string", group : "Misc", defaultValue : '-'},
/**
* Ending date of the range.
*/
secondDateValue : {type : "object", group : "Data", defaultValue : null},
/**
* Starting date of the range.
* @deprecated Since version 1.22.
* Former property for starting date - since next release will be not supported. Use dateValue instead.
*/
from : {type : "object", group : "Misc", defaultValue : null, deprecated: true},
/**
* Ending date of the range.
* @deprecated Since version 1.22.
* Former property for ending date - since next release will be not supported. Use secondDateValue instead.
*/
to : {type : "object", group : "Misc", defaultValue : null, deprecated: true}
},
events : {
/**
* Event thrown in case of change of date range.
*/
change : {
parameters : {
/**
* Current starting date after change.
*/
from : {type : "object"},
/**
* Current ending date after change.
*/
to : {type : "object"}
}
}
}
}});
/**
* This file defines behavior for the control
* @public
*/
(function() {
DateRangeSelection.prototype.init = function(){
DatePicker.prototype.init.apply(this, arguments);
this._bIntervalSelection = true;
};
DateRangeSelection.prototype.onkeypress = function(oEvent){
if (oEvent.charCode) {
var that = this;
var oFormatter = _getFormatter(that);
var sDelimiter = _getDelimiter(that);
var sAllowedCharacters = oFormatter.sAllowedCharacters + sDelimiter + " ";
var sChar = String.fromCharCode(oEvent.charCode);
if (sChar && oFormatter.sAllowedCharacters && sAllowedCharacters.indexOf(sChar) < 0) {
oEvent.preventDefault();
}
}
};
DateRangeSelection.prototype._getPlaceholder = function() {
var sPlaceholder = this.getPlaceholder();
if (!sPlaceholder) {
sPlaceholder = this.getDisplayFormat();
if (!sPlaceholder) {
sPlaceholder = "medium";
}
if (sPlaceholder === "short" || sPlaceholder === "medium" || sPlaceholder === "long") {
var oLocale = sap.ui.getCore().getConfiguration().getFormatSettings().getFormatLocale();
var oLocaleData = sap.ui.core.LocaleData.getInstance(oLocale);
sPlaceholder = oLocaleData.getDatePattern(sPlaceholder);
}
var that = this;
var sDelimiter = _getDelimiter(that);
if (sDelimiter && sDelimiter !== "") {
sPlaceholder = sPlaceholder + " " + sDelimiter + " " + sPlaceholder;
}
}
return sPlaceholder;
};
// Overwrite DatePicker's setValue to support two date range processing
DateRangeSelection.prototype.setValue = function(sValue) {
if (sValue !== this.getValue()) {
this._lastValue = sValue;
} else {
return this;
}
// Set the property in any case but check validity on output
this.setProperty("value", sValue, true);
this._bValid = true;
// Convert to date object(s)
var aDates = [undefined, undefined];
if (sValue) {
aDates = this._parseValue(sValue);
aDates = _dateRangeValidityCheck(this, aDates[0], aDates[1]);
if (!aDates[0]) {
this._bValid = false;
jQuery.sap.log.warning("Value can not be converted to a valid dates", this);
}
}
if (this._bValid) {
this.setProperty("dateValue", aDates[0], true);
this.setProperty("secondDateValue", aDates[1], true);
}
// Do not call InputBase.setValue because the displayed value and the output value might have different pattern
if (this.getDomRef()) {
// Convert to output
var sOutputValue = this._formatValue(aDates[0], aDates[1]);
if (this._$input.val() !== sOutputValue) {
this._$input.val(sOutputValue);
this._setLabelVisibility();
this._curpos = this._$input.cursorPos();
}
}
return this;
};
//Following setters/getters are due to backward compatibility with original primary version of composite sap.m.DateRangeSelection,
//that consisted of original primary sap.m.DateRangeSelection
DateRangeSelection.prototype.setFrom = function(oFrom) {
this.setDateValue(oFrom);
};
DateRangeSelection.prototype.getFrom = function() {
return this.getDateValue();
};
DateRangeSelection.prototype.setTo = function(oTo) {
this.setSecondDateValue(oTo);
};
DateRangeSelection.prototype.getTo = function() {
return this.getSecondDateValue();
};
// Overwrite DatePicker's setDateValue to support two date range processing
/**
* Setter for property <code>dateValue</code>.
*
* Starting date of the range.
* Default value is empty/undefined
*
* @param {object} oDateValue new value for property dateValue
* @returns {sap.m.DateRangeSelection} <code>this</code> to allow method chaining.
* @protected
*/
DateRangeSelection.prototype.setDateValue = function(oDateValue) {
if (jQuery.sap.equal(this.getDateValue(), oDateValue)) {
return this;
}
if (oDateValue && (oDateValue.getTime() < this._oMinDate.getTime() || oDateValue.getTime() > this._oMaxDate.getTime())) {
this._bValid = false;
jQuery.sap.assert(this._bValid, "Date must be in valid range");
}else {
this._bValid = true;
this.setProperty("dateValue", oDateValue, true); // no rerendering
}
var oSecondDateValue = this.getSecondDateValue();
// Convert date object(s) to value
var sValue = this._formatValue(oDateValue, oSecondDateValue);
if (sValue !== this.getValue()) {
this._lastValue = sValue;
}
// Set the property in any case but check validity on output
this.setProperty("value", sValue, true);
if (this.getDomRef()) {
// convert to output
var sOutputValue = this._formatValue(oDateValue, oSecondDateValue);
if (this._$input.val() !== sOutputValue) {
this._$input.val(sOutputValue);
this._setLabelVisibility();
this._curpos = this._$input.cursorPos();
}
}
return this;
};
DateRangeSelection.prototype.setSecondDateValue = function(oSecondDateValue) {
if (jQuery.sap.equal(this.getSecondDateValue(), oSecondDateValue)) {
return this;
}
if (oSecondDateValue && (oSecondDateValue.getTime() < this._oMinDate.getTime() || oSecondDateValue.getTime() > this._oMaxDate.getTime())) {
this._bValid = false;
jQuery.sap.assert(this._bValid, "Date must be in valid range");
}else {
this._bValid = true;
this.setProperty("secondDateValue", oSecondDateValue, true); // no rerendering
}
var oDateValue = this.getDateValue();
// Convert date object(s) to value
var sValue = this._formatValue(oDateValue, oSecondDateValue);
if (sValue !== this.getValue()) {
this._lastValue = sValue;
}
// Set the property in any case but check validity on output
this.setProperty("value", sValue, true);
if (this.getDomRef()) {
// convert to output
var sOutputValue = this._formatValue(oDateValue, oSecondDateValue);
if (this._$input.val() !== sOutputValue) {
this._$input.val(sOutputValue);
this._setLabelVisibility();
this._curpos = this._$input.cursorPos();
}
}
return this;
};
//Support of two date range version added into original DatePicker's version
DateRangeSelection.prototype._parseValue = function(sValue) {
var oFormat;
var aDates = [];
var oDate1, oDate2;
//If we have version of control with delimiter, then sValue should consist of two dates delimited with delimiter,
//hence we have to split the value to these dates
var that = this;
var sDelimiter = _getDelimiter(that);
if ((sDelimiter && sDelimiter !== "") && sValue) {
aDates = sValue.split(sDelimiter);
if (aDates.length === 2) {
// if delimiter only appears once in value (not part of date pattern) remove " " to be more flexible for input
if (aDates[0].slice(aDates[0].length - 1,aDates[0].length) == " ") {
aDates[0] = aDates[0].slice(0, aDates[0].length - 1);
}
if (aDates[1].slice(0,1) == " ") {
aDates[1] = aDates[1].slice(1);
}
} else {
aDates = sValue.split(" " + sDelimiter + " ");// Delimiter appears more than once -> try with separators
}
if (aDates.length < 2) {
// no delimiter found -> maybe only " " is used
var aDates2 = sValue.split(" ");
if (aDates2.length === 2) {
aDates = aDates2;
}
}
}
if (sValue && aDates.length <= 2) {
oFormat = _getFormatter(that);
//Convert to date object(s)
if ((!sDelimiter || sDelimiter === "") || aDates.length === 1) {
oDate1 = oFormat.parse(sValue);
} else if (aDates.length === 2) {
oDate1 = oFormat.parse(aDates[0]);
oDate2 = oFormat.parse(aDates[1]);
if (!oDate1 || !oDate2) {
// at least one date can not be parsed -> whole value is incorrect
oDate1 = undefined;
oDate2 = undefined;
}
}
}
return [oDate1, oDate2];
};
//Support of two date range version added into original DatePicker's version
DateRangeSelection.prototype._formatValue = function(oDateValue, oSecondDateValue) {
var sValue = "";
var that = this;
var sDelimiter = _getDelimiter(that);
if (oDateValue) {
var oFormat;
oFormat = _getFormatter(that);
if (sDelimiter && sDelimiter !== "" && oSecondDateValue) {
sValue = oFormat.format(oDateValue) + " " + sDelimiter + " " + oFormat.format(oSecondDateValue);
} else {
sValue = oFormat.format(oDateValue);
}
}
return sValue;
};
DateRangeSelection.prototype.onChange = function() {
// check the control is editable or not
if (!this.getEditable() || !this.getEnabled()) {
return;
}
var sValue = this._$input.val();
var aDates = [undefined, undefined];
this._bValid = true;
if (sValue != "") {
aDates = this._parseValue(sValue);
aDates = _dateRangeValidityCheck(this, aDates[0], aDates[1]);
if (aDates[0]) {
sValue = this._formatValue( aDates[0], aDates[1] ); // to have the right output format if entered different
} else {
this._bValid = false;
}
}
if (sValue !== this._lastValue) {
if (this.getDomRef() && (this._$input.val() !== sValue)) {
this._$input.val(sValue);
this._curpos = this._$input.cursorPos();
}
this.setProperty("value", sValue, true);
if (this._bValid) {
this.setProperty("dateValue", aDates[0], true);
this.setProperty("secondDateValue", aDates[1], true);
}
this._setLabelVisibility();
this._lastValue = sValue;
if (this._oPopup && this._oPopup.isOpen()) {
var oStartDate = this.getDateValue();
if (oStartDate) {
if (!this._oDateRange.getStartDate() || this._oDateRange.getStartDate().getTime() !== oStartDate.getTime()) {
this._oDateRange.setStartDate(new Date(oStartDate.getTime()));
this._oCalendar.focusDate(oStartDate);
}
} else {
if (this._oDateRange.getStartDate()) {
this._oDateRange.setStartDate(undefined);
}
}
var oEndDate = this.getSecondDateValue();
if (oEndDate) {
if (!this._oDateRange.getEndDate() || this._oDateRange.getEndDate().getTime() !== oEndDate.getTime()) {
this._oDateRange.setEndDate(new Date(oEndDate.getTime()));
this._oCalendar.focusDate(oEndDate);
}
} else {
if (this._oDateRange.getEndDate()) {
this._oDateRange.setEndDate(undefined);
}
}
}
var that = this;
_fireChange(that, this._bValid);
}
};
// Overwrite DatePicker's _getInputValue to support two date range processing
DateRangeSelection.prototype._getInputValue = function(sValue) {
sValue = (typeof sValue == "undefined") ? this._$input.val() : sValue.toString();
var aDates = this._parseValue(sValue);
sValue = this._formatValue( aDates[0], aDates[1]);
return sValue;
};
// overwrite _getInputValue to do the output conversion
DateRangeSelection.prototype.updateDomValue = function(sValue) {
// dom value updated other than value property
this._bCheckDomValue = true;
sValue = (typeof sValue == "undefined") ? this._$input.val() : sValue.toString();
this._curpos = this._$input.cursorPos();
var aDates = this._parseValue(sValue);
sValue = this._formatValue( aDates[0], aDates[1]);
// update the DOM value when necessary
// otherwise cursor can goto end of text unnecessarily
if (this.isActive() && (this._$input.val() !== sValue)) {
this._$input.val(sValue);
this._$input.cursorPos(this._curpos);
}
// update synthetic placeholder visibility
this._setLabelVisibility();
return this;
};
// overwrite InputBase function because this calls _getInputValue what calls _parseValue what updates the properties
// This should be redesigned at all, because parsing should not update the properties in every case
DateRangeSelection.prototype._setLabelVisibility = function() {
if (!this._bShowLabelAsPlaceholder || !this._$label || !this.isActive()) {
return;
}
var sValue = this._$input.val();
this._$label.css("display", sValue ? "none" : "inline");
};
//Do nothing in case of PageUp
DateRangeSelection.prototype.onsappageup = function(){}; //EXC_JSLINT_021
DateRangeSelection.prototype.onsappageupmodifiers = function(){}; //EXC_JSLINT_021
//Do nothing in case of PageDown
DateRangeSelection.prototype.onsappagedown = function(){}; //EXC_JSLINT_021
DateRangeSelection.prototype.onsappagedownmodifiers = function(){}; //EXC_JSLINT_021
//Support of two date range version of Calendar added into original DatePicker's version
DateRangeSelection.prototype._fillDateRange = function(){
DatePicker.prototype._fillDateRange.apply(this, arguments);
var oEndDate = this.getSecondDateValue();
if (oEndDate) {
if (!this._oDateRange.getEndDate() || this._oDateRange.getEndDate().getTime() !== oEndDate.getTime()) {
this._oDateRange.setEndDate(new Date(oEndDate.getTime()));
}
} else {
if (this._oDateRange.getEndDate()) {
this._oDateRange.setEndDate(undefined);
}
}
};
DateRangeSelection.prototype._selectDate = function(oEvent){
var aSelectedDates = this._oCalendar.getSelectedDates();
if (aSelectedDates.length > 0) {
var oDate1 = aSelectedDates[0].getStartDate();
var oDate2 = aSelectedDates[0].getEndDate();
if (oDate1 && oDate2) {
var oDate1Old = this.getDateValue();
var oDate2Old = this.getSecondDateValue();
this._oPopup.close();
this._bFocusNoPopup = true;
this.focus();
var sValue;
var that = this;
if (!jQuery.sap.equal(oDate1, oDate1Old) || !jQuery.sap.equal(oDate2, oDate2Old)) {
// compare Dates because value can be the same if only 2 digits for year
if (jQuery.sap.equal(oDate2, oDate2Old)) {
this.setDateValue(oDate1);
} else {
this.setProperty("dateValue", oDate1, true); // no rerendering
this.setSecondDateValue(oDate2);
}
sValue = this.getValue();
_fireChange(that, true);
this._curpos = sValue.length;
this._$input.cursorPos(this._curpos);
}else if (!this._bValid){
// wrong input before open calendar
sValue = this._formatValue( oDate1, oDate2 );
if (sValue != this._$input.val()) {
this._bValid = true;
if (this.getDomRef()) { // as control could be destroyed during update binding
this._$input.val(sValue);
}
_fireChange(that, true);
}
}
//To prevent opening keyboard on mobile device after dates are selected
if (sap.ui.Device.browser.mobile) {
window.document.activeElement.blur();
}
}
}
};
function _fireChange(oThis, bValid) {
oThis.fireChangeEvent(oThis.getValue(), {
from: oThis.getDateValue(),
to: oThis.getSecondDateValue(),
valid: bValid
});
}
function _dateRangeValidityCheck(oThis, oDate, oSecondDate) {
if (oDate && oSecondDate && oDate.getTime() > oSecondDate.getTime()) {
// dates are in wrong oder -> just switch
var oTmpDate = oDate;
oDate = oSecondDate;
oSecondDate = oTmpDate;
}
if ((oDate && ( oDate.getTime() < oThis._oMinDate.getTime() || oDate.getTime() > oThis._oMaxDate.getTime())) ||
(oSecondDate && ( oSecondDate.getTime() < oThis._oMinDate.getTime() || oSecondDate.getTime() > oThis._oMaxDate.getTime()))) {
return [undefined, undefined];
}else {
return [oDate, oSecondDate];
}
}
function _getDelimiter(oThis) {
var sDelimiter = oThis.getDelimiter();
if (!sDelimiter) {
if (!oThis._sLocaleDelimiter) {
var oLocale = sap.ui.getCore().getConfiguration().getFormatSettings().getFormatLocale();
var oLocaleData = sap.ui.core.LocaleData.getInstance(oLocale);
var sPattern = oLocaleData.getIntervalPattern();
var iIndex1 = sPattern.indexOf("{0}") + 3;
var iIndex2 = sPattern.indexOf("{1}");
sDelimiter = sPattern.slice(iIndex1, iIndex2);
if (sDelimiter.length > 1) {
if (sDelimiter.slice(0,1) == " ") {
sDelimiter = sDelimiter.slice(1);
}
if (sDelimiter.slice(sDelimiter.length - 1,sDelimiter.length) == " ") {
sDelimiter = sDelimiter.slice(0, sDelimiter.length - 1);
}
}
oThis._sLocaleDelimiter = sDelimiter;
} else {
sDelimiter = oThis._sLocaleDelimiter;
}
}
return sDelimiter;
}
function _getFormatter(oThis) {
var sPattern = ( oThis.getDisplayFormat() || "medium" );
var oFormat;
if (sPattern == oThis._sUsedDisplayPattern) {
oFormat = oThis._sDisplayFormat;
} else {
if (sPattern === "short" || sPattern === "medium" || sPattern === "long") {
oFormat = sap.ui.core.format.DateFormat.getInstance({style: sPattern, strictParsing: true});
} else {
oFormat = sap.ui.core.format.DateFormat.getInstance({pattern: sPattern, strictParsing: true});
}
oThis._sUsedDisplayPattern = sPattern;
oThis._sDisplayFormat = oFormat;
}
return oFormat;
}
// to overwrite JS doc
/**
* Getter for property <code>dateValue</code>.
*
* Starting date of the range.
* Default value is empty/undefined
*
* @returns {object} the value of property secondDateValue
* @protected
* @name sap.m.DateRangeSelection#getDateValue
* @function
*/
/**
* Setter for property <code>valueFormat</code>.
*
* Property <code>valueFormat</code> is not supported in <code>sap.m.DateRangeSelection</code> control.
*
* @protected
* @name sap.m.DateRangeSelection#setValueFormat
* @function
*/
/**
* Getter for property <code>valueFormat</code>.
*
* Property <code>valueFormat</code> is not supported in <code>sap.m.DateRangeSelection</code> control.
*
* @protected
* @name sap.m.DateRangeSelection#getValueFormat
* @function
*/
/**
* On change of date range event.
*
* @name sap.m.DateRangeSelection#change
* @event
* @param {sap.ui.base.Event} oControlEvent
* @param {sap.ui.base.EventProvider} oControlEvent.getSource
* @param {object} oControlEvent.getParameters
* @param {string} oControlEvent.getParameters.value The new value of the input.
* @param {boolean} oControlEvent.getParameters.valid Indicator for a valid date.
* @param {object} oControlEvent.getParameters.from Current starting date after change.
* @param {object} oControlEvent.getParameters.to Current ending date after change.
* @public
*/
/**
* Fire event change to attached listeners.
*
* Expects following event parameters:
* <ul>
* <li>'value' of type <code>string</code> The new value of the input.</li>
* <li>'valid' of type <code>boolean</code> Indicator for a valid date.</li>
* <li>'from' of type <code>object</code> Current starting date after change-</li>
* <li>'to' of type <code>object</code> Current ending date after change.</li>
* </ul>
*
* @param {Map} [mArguments] the arguments to pass along with the event.
* @return {sap.m.DateRangeSelection} <code>this</code> to allow method chaining
* @protected
* @name sap.m.DateRangeSelection#fireChange
* @function
*/
}());
return DateRangeSelection;
}, /* bExport= */ true);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,32 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', 'sap/ui/core/Renderer', './DatePickerRenderer'],
function(jQuery, Renderer, DatePickerRenderer) {
"use strict";
/**
* DateRangeSelection renderer.
* @namespace
*/
var DateRangeSelectionRenderer = Renderer.extend(DatePickerRenderer);
/**
* Write the value of the input.
*
* @public
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
DateRangeSelectionRenderer.writeInnerValue = function(oRm, oControl) {
oRm.writeAttributeEscaped("value", oControl._formatValue(oControl.getDateValue(), oControl.getSecondDateValue()));
};
return DateRangeSelectionRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','sap/ui/core/Renderer','./DatePickerRenderer'],function(q,R,D){"use strict";var a=R.extend(D);a.writeInnerValue=function(r,c){r.writeAttributeEscaped("value",c._formatValue(c.getDateValue(),c.getSecondDateValue()));};return a;},true);

View File

@ -0,0 +1,931 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.DateTimeInput.
sap.ui.define(['jquery.sap.global', './InputBase', './InstanceManager', './library', 'sap/ui/core/IconPool', 'sap/ui/core/theming/Parameters', 'sap/ui/model/type/Date', 'sap/ui/thirdparty/mobiscroll/js/mobiscroll-core', 'sap/ui/thirdparty/mobiscroll/js/mobiscroll-datetime', 'sap/ui/thirdparty/mobiscroll/js/mobiscroll-scroller'],
function(jQuery, InputBase, InstanceManager, library, IconPool, Parameters, Date1, mobiscrollcore, mobiscrolldatetime, mobiscrollscroller) {
"use strict";
/**
* Constructor for a new DateTimeInput.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* Allows end users to interact with date and/or time and select from a date and/or time pad.
* Note: Since 1.22, this control should not be used as a date picker(type property "Date"), instead please use dedicated sap.m.DatePicker control.
* @extends sap.m.InputBase
*
* @author SAP SE
* @version 1.28.5
*
* @constructor
* @public
* @since 1.9.1
* @alias sap.m.DateTimeInput
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var DateTimeInput = InputBase.extend("sap.m.DateTimeInput", /** @lends sap.m.DateTimeInput.prototype */ { metadata : {
library : "sap.m",
properties : {
/**
* Type of DateTimeInput (e.g. Date, Time, DateTime)
*/
type : {type : "sap.m.DateTimeInputType", group : "Data", defaultValue : sap.m.DateTimeInputType.Date},
/**
* Displays date value in this given format in text field. Default value is taken from locale settings.
* If you use data-binding on value property with type sap.ui.model.type.Date then you can ignore this property or latter wins.
* If user browser supports native picker then this property is overwritten by browser with locale settings.
*/
displayFormat : {type : "string", group : "Appearance", defaultValue : null},
/**
* Given value property should match with valueFormat to parse date. Default value is taken from locale settings.
* You can only set and get value in this format.
* If you use data-binding on value property with type sap.ui.model.type.Date you can ignore this property or latter wins.
*/
valueFormat : {type : "string", group : "Data", defaultValue : null},
/**
* This property as JavaScript Date Object can be used to assign a new value which is independent from valueFormat.
*/
dateValue : {type : "object", group : "Data", defaultValue : null}
},
events : {
/**
* This event gets fired when the selection has finished and the value has changed.
*/
change : {
parameters : {
/**
* The string value of the control in given valueFormat(or locale format).
*/
value : {type : "string"},
/**
* The value of control as JavaScript Date Object or null if value is empty.
*/
dateValue : {type : "object"}
}
}
}
}});
!(function(oPrototype, $, oDevice) {
var oi18n = sap.m.getLocaleData();
$.extend(oPrototype, {
_origin : "value",
_super : InputBase.prototype,
_types : {
Date : {
valueFormat : oi18n.getDatePattern("short"),
displayFormat : oi18n.getDatePattern("medium")
},
Time : {
valueFormat : oi18n.getTimePattern("short"),
displayFormat : oi18n.getTimePattern("short")
},
DateTime : {
valueFormat : oi18n.getDateTimePattern("short"), // does not include pattern but e.g "{1} {0}"
displayFormat : oi18n.getDateTimePattern("short") // does not include pattern but e.g "{1} {0}"
}
}
});
// am-pm picker is hard-coded so use 24 hour format when language is not English
if (sap.m.getLocale().getLanguage() != "en") {
["valueFormat", "displayFormat"].forEach(function(sFormatType) {
var oTime = oPrototype._types.Time;
var sFormat = oTime[sFormatType];
if (sFormat.indexOf("a") != -1) {
oTime[sFormatType] = sFormat.replace(/a+/i, "").replace(/h+/i, "HH").trim();
}
});
}
// build DateTime formats from Date And Time values
["Time", "Date"].forEach(function(sType, nIndex) {
["valueFormat", "displayFormat"].forEach(function(sFormat) {
var oTypes = oPrototype._types;
oTypes.DateTime[sFormat] = oTypes.DateTime[sFormat].replace("{" + nIndex + "}", oTypes[sType][sFormat]);
});
});
}(DateTimeInput.prototype, jQuery, sap.ui.Device));
/**
* @overwrite sap.m.InputBase#onBeforeRendering
*/
DateTimeInput.prototype.onBeforeRendering = function() {
this._destroyCustomPicker();
this._super.onBeforeRendering.call(this);
if (!this.mProperties.hasOwnProperty("type")) {
this.setType("Date");
}
};
/**
* @overwrite sap.m.InputBase#onAfterRendering
*/
DateTimeInput.prototype.onAfterRendering = function() {
this._super.onAfterRendering.call(this);
this._$input.scroller(this._getScrollerConfig());
this._showValue();
};
/**
* @overwrite sap.m.InputBase#exit
*/
DateTimeInput.prototype.exit = function() {
this._destroyCustomPicker();
this._super.exit.call(this);
};
/**
* <pre>
* Setter for property <code>width</code>
*
* Default value is 100%
* </pre>
*
* @public
* @overwrite sap.m.InputBase#setWidth
* @param {sap.ui.core.CSSSize} sWidth new value for property <code>width</code>
* @returns {sap.m.DateTimeInput} this to allow method chaining
*/
DateTimeInput.prototype.setWidth = function(sWidth) {
return this._super.setWidth.call(this, sWidth || "100%");
};
/**
* <pre>
* Getter for property <code>width</code>. Defines the width of the DateTimeInput, this value can be provided in %, em, px and all possible CSS units.
*
* Default value is 100%
* </pre>
*
* @public
* @overwrite sap.m.InputBase#getWidth
* @returns {sap.ui.core.CSSSize} the value of property width
*/
DateTimeInput.prototype.getWidth = function() {
return this.getProperty("width") || "100%";
};
/**
* <pre>
* This function can be used to assign new value and this is relevant with <code>valueFormat</code> property(see valueFormat) but independent from what is going to display on the field(see displayFormat).
* Another way to assign new value is using dateValue property in JsView(see dateValue).
* If you use both at the same time, latter wins.
*
* Also "Now" literal can be assigned as a parameter to show the current date and/or time.
* </pre>
*
* @public
* @see sap.m.DateTimeInput#getValueFormat
* @see sap.m.DateTimeInput#getDisplayFormat
* @see sap.m.DateTimeInput#getDateValue
* @param {string} sValue new value for property <code>value</code>
* @returns {sap.m.DateTimeInput} this to allow method chaining
*/
DateTimeInput.prototype.setValue = function(sValue) {
sValue = this.validateProperty("value", sValue);
if (sValue.toLowerCase() == "now") {
return this.setDateValue(new Date());
}
if (sValue === this.getValue()) {
return this;
}
this.setProperty("value", sValue);
this._origin = "value";
this._getFormatFromBinding();
return this;
};
// set the dateValue property if oValue parameter is defined
DateTimeInput.prototype.setDateValue = function(oValue) {
if (!oValue || oValue === this.getDateValue()) {
return this;
}
this._isDate(oValue);
this._origin = "dateValue";
this.setProperty("dateValue", oValue);
if (!this.getDomRef()) {
// set the string value property from date object if control is not yet rendered
this.setProperty("value", sap.ui.core.format.DateFormat.getDateInstance({
pattern : this.getValueFormat()
}).format(oValue), true);
}
return this;
};
// returns assigned dateValue property or converts value to JS Date Object.
DateTimeInput.prototype.getDateValue = function() {
if (this._origin == "dateValue") {
return this.getProperty("dateValue");
}
var sValue = this.getProperty("value");
if (!sValue) {
return null;
}
return sap.ui.core.format.DateFormat.getDateInstance({
pattern : this.getValueFormat()
}).parse(sValue);
};
DateTimeInput.prototype.getDisplayFormat = function() {
return this.getProperty("displayFormat") || this._types[this.getType()].displayFormat;
};
DateTimeInput.prototype.getValueFormat = function() {
return this.getProperty("valueFormat") || this._types[this.getType()].valueFormat;
};
DateTimeInput.prototype.onfocusin = function() {
this.$().toggleClass("sapMFocus", true);
this._setLabelVisibility();
// open message when focus is back to input field
this.openValueStateMessage();
};
// Check given is JS Date Object and throw error if not
DateTimeInput.prototype._isDate = function(oValue) {
if (!sap.m.isDate(oValue)) {
throw new Error("Type Error: Expected JavaScript Date Object for property dateValue of " + this);
}
return true;
};
/** *
* Change event handler of the Input field
* Also gets called programmatically without parameter to update input value
*
* @overwrite sap.m.InputBase#onChange
*/
DateTimeInput.prototype.onChange = function(oEvent) {
var oDate = null,
sNewValue = this._$input.val(),
sOldValue = this.getProperty("value");
if (sNewValue) {
oDate = this._$input.scroller("getDate");
this.getType() == "Date" && oDate.setHours(0, 0, 0, 0);
// reformat for CLDR
oEvent && this._reformat && this._$input.val(
sap.ui.core.format.DateFormat.getDateInstance({
pattern : this.getDisplayFormat()
}).format(oDate)
);
if (!isNaN(oDate)) {
sNewValue = sap.ui.core.format.DateFormat.getDateInstance({
pattern : this.getValueFormat()
}).format(oDate);
} else {
sNewValue = "";
oDate = null;
}
}
if (sOldValue == sNewValue) {
return;
}
this.setProperty("value", sNewValue, true);
this.setProperty("dateValue", oDate, true);
this._setLabelVisibility();
if (oEvent && oEvent.type != "focus") {
this.fireChangeEvent(sNewValue, {
dateValue: oDate,
// backwards compatibility
newDateValue: oDate
});
}
};
/**
* Destroy custom picker if available
*/
DateTimeInput.prototype._destroyCustomPicker = function() {
if (this._$input) {
this._$input.scroller("hide");
this._$input.scroller("destroy");
}
};
DateTimeInput.prototype._setInputValue = function(sValue) {
this._$input.val(sValue);
this._setLabelVisibility();
this.onChange();
};
/**
* Do the required conversion and set input value
*/
DateTimeInput.prototype._showValue = function() {
var date = this.getProperty(this._origin);
if (!date) {
return;
}
if (this._origin == "value") {
date = sap.ui.core.format.DateFormat.getDateInstance({
pattern : this.getValueFormat()
}).parse(date);
if (!date) {
jQuery.sap.log.error( "Format Error: value property " + this.getValue()
+ " does not match with valueFormat " + this.getValueFormat()
+ " of " + this );
this._setInputValue("");
return;
}
} else {
this._isDate(date);
}
this._$input.scroller("setDate", date, false);
this._setInputValue(
sap.ui.core.format.DateFormat.getDateInstance({
pattern : this.getDisplayFormat()
}).format(date)
);
};
/**
* Check data-binding for value property
* Get according pattern from type settings
*/
DateTimeInput.prototype._getFormatFromBinding = function() {
var oBindingInfo = this.getBindingInfo("value");
if (!oBindingInfo) {
return;
}
var oBindingType = oBindingInfo.type;
if (!oBindingType || !(oBindingType instanceof Date1)) {
return;
}
var sFormat = oBindingType.getOutputPattern();
this.setProperty("valueFormat", sFormat, true);
this.setProperty("displayFormat", sFormat, true);
return sFormat;
};
/**
* Opens scroller via keyboard [F4] or [ALT]+[DOWN]
*/
DateTimeInput.prototype.onsapshow = function(oEvent) {
this._$input.scroller("show");
oEvent.preventDefault();
oEvent.setMarked();
};
/**
* Opens scroller via keyboard [ALT]+[UP]
*/
DateTimeInput.prototype.onsaphide = DateTimeInput.prototype.onsapshow;
/**
* Enables custom date time and adds related methods to prototype
*/
(function($, oDevice) {
var oDefaults = {},
oCore = sap.ui.getCore(),
oLocale = sap.m.getLocale(),
sLanguage = oLocale.getLanguage(),
oLocaleData = sap.m.getLocaleData(),
oResourceBundle = oCore.getLibraryResourceBundle("sap.m"),
_ = function(sText) {
return $.sap.encodeHTML(oResourceBundle.getText("MOBISCROLL_" + sText));
},
rgxExcludeLiteral = "(?=([^']*'[^']*')*[^']*$)",
sCssPath = $.sap.getModulePath("sap.ui.thirdparty.mobiscroll", "/css/"),
oSettings = {
endYear : new Date().getFullYear() + 10,
lang : sLanguage
},
oi18n = {
setText : _("SET"),
cancelText : _("CANCEL"),
monthText : _("MONTH"),
dayText : _("DAY"),
yearText : _("YEAR"),
hourText : _("HOURS"),
minuteText : _("MINUTES"),
secText : _("SECONDS"),
nowText : _("NOW"),
dayNames : oLocaleData.getDaysStandAlone("wide"),
dayNamesShort : oLocaleData.getDaysStandAlone("abbreviated"),
monthNames : oLocaleData.getMonthsStandAlone("wide"),
monthNamesShort : oLocaleData.getMonthsStandAlone("abbreviated")
},
oThemeParams = Parameters.get();
// inject resources
$.sap.includeStyleSheet(sCssPath + "mobiscroll-core.css");
// do not 'calculate' dependency names or analyzer will ignore them
// get default settings
oDefaults = $("<input>").scroller({}).scroller("getInst").settings;
var device = ["phone", "tablet", "desktop"].filter(function(d) {
return oDevice.system[d];
})[0],
ucfirst = function(str) {
if (!str) {
return "";
}
return str.charAt(0).toUpperCase() + str.substr(1);
},
setDefaultsByTheme = function(key, type, prefix) {
var value = oThemeParams["sapUiDTICustom" + ucfirst(prefix) + ucfirst(key)];
if (value) {
if (type == "bool") {
oSettings[key] = (value.toLowerCase() == "true" ? true : false);
} else if (type == "int") {
value = parseInt(value, 10);
!isNaN(value) && (oSettings[key] = value);
} else {
oSettings[key] = value;
}
}
if (!prefix && device) {
setDefaultsByTheme(key, type, device);
}
};
oSettings.mode = "mixed";
oSettings.display = "modal";
oSettings.theme = "sapMDTICustom";
setDefaultsByTheme("mode");
setDefaultsByTheme("display");
setDefaultsByTheme("rows", "int");
setDefaultsByTheme("width", "int");
setDefaultsByTheme("height", "int");
setDefaultsByTheme("showLabel", "bool");
setDefaultsByTheme("headerText", "bool");
if (oSettings.headerText) {
// mobiscroll needs text to replace
oSettings.headerText = "{value}";
}
// load custom fonts
IconPool.insertFontFaceStyle();
// enable language settings
$.scroller.i18n[sLanguage] = $.extend({}, oi18n);
// enable instance management
// Add custom datetime methods to prototype
$.extend(DateTimeInput.prototype, {
/**
* This method gets called from sap.m.InstanceManager,
* to close the opened mobiscroll dialog when the back button is clicked
*/
close : function() {
this._$input.scroller("hide");
},
/**
* Mobiscroll title reformatter to support all cldr formats
* We can only get string value onChange/onWheel event
*/
_setScrollerHeader : function(sValue) {
try {
var oConfig = this._$input.scroller("getInst").settings,
sFormat = !this.getType().indexOf("Date") ? oConfig.dateFormat : oConfig.timeFormat,
oDate = $.mobiscroll.parseDate(sFormat, sValue);
return $.sap.encodeHTML(sap.ui.core.format.DateFormat.getDateInstance({
pattern : this.getDisplayFormat()
}).format(oDate));
} catch (e) {
return sValue;
}
},
/**
* Auto close for bubbles
*/
_autoClose : function(oEvent) {
var oDomRef = this.getDomRef();
if (oDomRef && oDomRef.contains(oEvent.target)) {
oEvent.stopPropagation();
oEvent.preventDefault();
return;
}
var oDialog = document.querySelector(".sapMDTICustom .dwwr");
if (oDialog && !oDialog.contains(oEvent.target)) {
this._$input.scroller("hide");
}
},
/**
* Restrict max width of the dialog
*/
_restrictMaxWidth : function($dialog) {
//TODO : Find a better way to find out 22 instead of hard coding
$dialog[0].querySelector(".dwwr").style.maxWidth = (document.documentElement.clientWidth - 22) + "px";
},
/**
* Handle window resize event
*/
_handleResize : function(oEvent) {
this._restrictMaxWidth(oEvent.data.$dialog);
},
/**
* Handle key down event for buttons
*/
_handleBtnKeyDown : function(oEvent) {
if (oEvent.which === $.sap.KeyCodes.ENTER) {
if (oEvent.target && $(oEvent.target.parentElement).hasClass("dwb-c")) {
// This means that "Return" was pressed with the
// 'Cancel' button having the focus: 'Cancel' wins.
this._$input.scroller("cancel");
} else {
this._$input.scroller("select");
}
} else if (oEvent.which === $.sap.KeyCodes.ESCAPE) {
this._$input.scroller("cancel");
} else if (oEvent.which === $.sap.KeyCodes.F4) {
this._$input.scroller("select");
}
},
/**
* Date-time conversion for mobiscroll configuration
*/
_getScrollerConfig : function() {
var that = this,
sType = this.getType(),
sFormat = this.getDisplayFormat(),
fnAutoCloseProxy = $.proxy(this._autoClose, this),
fnHandleResize = $.proxy(this._handleResize, this),
fnHandleBtnKeyDown = $.proxy(this._handleBtnKeyDown, this),
fnFocusInFirst, fnFocusInLast, fnClick,
$focusLeft = $("<span class='sapMFirstFE' tabindex='0'/>"),
$focusRight = $("<span class='sapMLastFE' tabindex='0'/>"),
fnKeyDown, $dialogToClean,
oConfig = $.extend({}, oSettings, {
preset : sType.toLowerCase(),
showOnFocus : false,
showOnTap: true,
disabled : !that.getEnabled() || !that.getEditable(),
onShow : function($dialog) {
// Special treatment for IE: with jQuery < 1.9 focus is fired twice in IE
// Therefore, mobiscroll may open the scroller again, immediately after it
// has been closed
if (oDevice.browser.msie) {
if (that._popupIsShown) {
return;
}
that._popupIsShown = true;
}
InstanceManager.addDialogInstance(that);
$(window).on("resize.sapMDTICustom", {$dialog : $dialog}, fnHandleResize);
//Fix a bug in mobiscroll-core.js line 805 (mobiscroll 2.7.2): their
//'keydown.dw' handler always triggers a select, even if return was
//pressed on the cancel button
$(window).unbind('keydown.dw');
$dialog.on('keydown.dw', fnHandleBtnKeyDown);
if (oSettings.display == "bubble") {
document.addEventListener(oDevice.support.touch ? "touchstart" : "mousedown", fnAutoCloseProxy, true);
}
if (oDevice.system.desktop) {
// Amend keyboard navigation: see sap.m.Dialog.onfocusin for
// an analogous procedure
var $scrollerCont = $dialog.find('.dwcc'),
$buttonBar = $dialog.find('.dwbc'),
aFocusables = $scrollerCont.find(":focusable.dwww");
$focusLeft.insertBefore($scrollerCont);
fnFocusInLast = $.proxy(that._getFocusInHandler($buttonBar, false), that);
$focusLeft.focusin(fnFocusInLast);
$focusRight.insertAfter($buttonBar);
fnFocusInFirst = $.proxy(that._getFocusInHandler($scrollerCont, true), that);
$focusRight.focusin(fnFocusInFirst);
// Make sure, the first scroller column has initial focus
$.sap.focus($scrollerCont.firstFocusableDomRef());
// CSN 0120061532 0001326801 2014: mobiscroll scrollers don't
// get focus when clicked upon
fnClick = function(oEvent){
//The target itself is not focusable. Need to focus the
//scroller parent marked by a 'dwww' class
$.sap.focus($(oEvent.target).parents(".dwww"));
};
$dialog.click(fnClick);
// Support other keyboard events as well, e.g. LEFT, RIGHT
$dialogToClean = $dialog;
fnKeyDown = $.proxy(that._getKeyDownHandler(aFocusables), that);
$dialog.keydown(fnKeyDown);
}
},
onClose : function() {
// Special treatment for IE: with jQuery < 1.9 focus is fired twice in IE
// Therefore, mobiscroll may open the scroller again, immediately after it
// has been closed
if (oDevice.browser.msie) {
that._popupIsShown = false;
}
InstanceManager.removeDialogInstance(that);
$(window).off("resize.sapMDTICustom", fnHandleResize);
if (oSettings.display == "bubble") {
document.removeEventListener(oDevice.support.touch ? "touchstart" : "mousedown", fnAutoCloseProxy, true);
}
// clean up listeners
$focusLeft.unbind('focusin', fnFocusInLast);
$focusRight.unbind('focusin', fnFocusInFirst);
if ($dialogToClean) {
$dialogToClean.unbind('keydown', fnKeyDown);
$dialogToClean.unbind('keydown.dw', fnHandleBtnKeyDown);
$dialogToClean.unbind('click', fnClick);
}
},
onSelect : function() {
// fire change event on selection
that.onChange({});
},
onMarkupReady : function($dialog, inst) {
that._restrictMaxWidth($dialog);
$dialog.addClass("sapMDTICustom" + that.getType());
if (oSettings.headerText !== false) {
$dialog.addClass("sapMDTICustomHdr");
}
}
});
if (sType == "Date") {
sFormat = this._convertDatePattern(sFormat);
$.extend(oConfig, {
timeWheels : "",
dateFormat : sFormat,
dateOrder : this._getLongDatePattern(sFormat.replace(/'.*?'/g, "")).replace(/[^ymd ]/ig, "")
});
} else if (sType == "Time") {
sFormat = this._convertTimePattern(sFormat);
$.extend(oConfig, {
dateOrder : "",
timeFormat : sFormat,
timeWheels : sFormat.replace(/'.*?'/g, "").replace(/[^hisa]/ig, "")
});
} else if (sType == "DateTime") {
sFormat = this._convertDatePattern(this._convertTimePattern(sFormat));
// date-time hack
$.extend(oConfig, {
dateFormat : sFormat,
dateOrder : this._getLongDatePattern(sFormat.replace(/'.*?'/g, "")).replace(/[^ymd ]/ig, ""),
rows : this._getRowForDateTime(),
timeWheels : sFormat,
timeFormat : "",
separator : ""
});
}
// check given format is not supported by mobiscroll
if (/[^ymdhisa\W]/i.test(sFormat)) {
this._reformat = true;
if (oSettings.headerText !== false) {
oConfig.headerText = $.proxy(this._setScrollerHeader, this);
}
} else {
this._reformat = false;
}
return oConfig;
},
/**
* Until mobiscroll fixes min height(360px) problem for date time
* we just decrease the row count to 3
*/
_getRowForDateTime : function() {
var rows = oSettings.rows || oDefaults.rows;
if (!rows || rows <= 3) {
return 3;
}
return Math.min(window.innerWidth, window.innerHeight) < 360 ? 3 : rows;
},
/**
* Returns a handler function to focus first or last focusable component
* within a given jQuery element to be used as a handler for
* the 'focusin' event.
*
* @param $parent the element whose children shall be focussed
* @param first if true return a function to focus the $parent's first
* focusable element, otherwise return a function to focus $parent's last
* focusable element.
*/
_getFocusInHandler : function($parent, first) {
return function() {
var oElementToFocus = first ? $parent.firstFocusableDomRef() : $parent.lastFocusableDomRef();
$.sap.focus(oElementToFocus);
};
},
/**
* Returns a handler function to deal with key events for keyboard
* navigation, that are not yet dealt with by the underlying mobiscroll
* dialog.
*
* @param aFocusables array of focusable elements within the mobiscroll dialog
*/
_getKeyDownHandler : function(aFocusables) {
return function(oEvent){
var iKeyCode = oEvent.which,
bShift = oEvent.shiftKey,
bAlt = oEvent.altKey,
bCtrl = oEvent.ctrlKey;
if (!bAlt && !bShift && !bCtrl) {
// No modifiers pressed
switch (iKeyCode) {
// RIGHT
case $.sap.KeyCodes.ARROW_RIGHT:
// Moves focus one column right to the selected field, e.g. from Hours to Minutes.
// When focus is on the last column, move focus to the first column.
var current = aFocusables.index(document.activeElement),
$next = aFocusables.eq(current + 1).length ? aFocusables.eq(current + 1) : aFocusables.eq(0);
$next.focus();
break;
case $.sap.KeyCodes.ARROW_LEFT:
// Moves focus one column left to the selected field, e.g. from Minutes to Hours.
// When focus is on the first column, move focus to the last column.
var current = aFocusables.index(document.activeElement),
$previous = aFocusables.eq(current - 1).length ? aFocusables.eq(current - 1) : aFocusables.eq(aFocusables.length - 1);
$previous.focus();
break;
case $.sap.KeyCodes.HOME:
// Moves focus to the first column of the same row and same month
aFocusables[0].focus();
break;
case $.sap.KeyCodes.END:
// Moves focus to the last column of the same row and same month
aFocusables[aFocusables.length - 1].focus();
break;
default:
break;
}
} else if (bAlt && !bShift && !bCtrl) {
// ALT pressed
switch (iKeyCode) {
case $.sap.KeyCodes.ARROW_UP:
case $.sap.KeyCodes.ARROW_DOWN:
// Keeps the current state and closes the dialog. Same as clicking “OK”.
this._$input.scroller("select");
break;
default:
break;
}
}
};
},
/**
* cache often used regular expressions
*/
_rgxYear : new RegExp("y+" + rgxExcludeLiteral, "ig"),
_rgxMonth : new RegExp("m+" + rgxExcludeLiteral, "ig"),
_rgxDay : new RegExp("d+" + rgxExcludeLiteral, "g"),
_rgxMinute : new RegExp("m" + rgxExcludeLiteral, "g"),
_rgxAmPm : new RegExp("a" + rgxExcludeLiteral, "g"),
_rgxDayOfWeekLong : new RegExp("EEEE" + rgxExcludeLiteral, "g"),
_rgxDayOfWeekShort : new RegExp("E+" + rgxExcludeLiteral, "g"),
/**
* Convert date pattern to long month name, 4 digit year, 2 digit day
*/
_getLongDatePattern : function(sPattern) {
sPattern = (sPattern || this.getDisplayFormat()).replace(this._rgxYear, "YY");
return sPattern.replace(this._rgxMonth, "MM").replace(this._rgxDay, "dd");
},
/**
* Converts the time pattern from CLDR to the mobiscroll time picker
* m is short month name, i = minute
*/
_convertTimePattern : function(sPattern) {
sPattern = sPattern || this.getDisplayFormat();
return sPattern.replace(this._rgxMinute, "i").replace(this._rgxAmPm, "A");
},
/**
* Converts the date pattern from CLDR to the one of the jQuery datePicker
* Month is coded in the different way
* TODO: Copied from core talk with core team to call method from somewhere else shared
* TODO: This implementation ignores the literals usage case, talk also with core team
*/
_convertDatePattern : function(sPattern) {
sPattern = sPattern || this.getDisplayFormat();
var iIndex1 = sPattern.indexOf("M"),
iIndex2 = sPattern.lastIndexOf("M"),
sFormat = sPattern,
sNewMonth;
if (iIndex1 == -1) {
// no month defined with M, maybe using L (standalone)
iIndex1 = sPattern.indexOf("L");
iIndex2 = sPattern.lastIndexOf("L");
}
if (iIndex1 > -1) {
switch (iIndex2 - iIndex1) {
case 0:
sNewMonth = "m";
break;
case 1:
sNewMonth = "mm";
break;
case 2:
sNewMonth = "M";
break;
case 5:
// narrow state not available in jQuery DatePicker -> use shortest one
sNewMonth = "m";
break;
default:
sNewMonth = "MM";
break;
}
sFormat = sPattern.substring(0, iIndex1) + sNewMonth + sPattern.substring(iIndex2 + 1);
}
var sNewYear;
iIndex1 = sFormat.indexOf("y");
if (iIndex1 > -1) {
iIndex2 = sFormat.lastIndexOf("y");
if (iIndex2 - iIndex1 == 1) {
// two chanrs
sNewYear = "y";
} else {
sNewYear = "yy";
}
sFormat = sFormat.substring(0, iIndex1) + sNewYear + sFormat.substring(iIndex2 + 1);
}
var sNewYearDay;
iIndex1 = sFormat.indexOf("D");
if (iIndex1 > -1) {
iIndex2 = sFormat.lastIndexOf("D");
if (iIndex2 - iIndex1 == 1) {
// two chanrs
sNewYearDay = "o";
} else {
sNewYearDay = "oo";
}
sFormat = sFormat.substring(0, iIndex1) + sNewYearDay + sFormat.substring(iIndex2 + 1);
}
// EEEE = DD = day of week(long)
// EEE, EE, E = D = day of week(short)
sFormat = sFormat.replace(this._rgxDayOfWeekLong, "DD").replace(this._rgxDayOfWeekShort, "D");
return sFormat;
}
});
})(jQuery, sap.ui.Device);
return DateTimeInput;
}, /* bExport= */ true);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,55 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', 'sap/ui/core/Renderer', './InputBaseRenderer'],
function(jQuery, Renderer, InputBaseRenderer) {
"use strict";
/**
* DateTimeInput renderer.
* @namespace
*
* For a common look & feel,
* DateTimeInputRenderer extends the InputRenderer
*/
var DateTimeInputRenderer = Renderer.extend(InputBaseRenderer);
/**
* Adds control specific class
*
* @param {sap.ui.core.RenderManager} oRm the RenderManager that can be used for writing to the render output buffer
* @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered
*/
DateTimeInputRenderer.addOuterClasses = function(oRm, oControl) {
oRm.addClass("sapMDTI");
};
/**
* Add pointer cursor to date-time input
*
* @param {sap.ui.core.RenderManager} oRm the RenderManager that can be used for writing to the render output buffer
* @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered
*/
DateTimeInputRenderer.addCursorClass = function(oRm, oControl) {
if (oControl.getEnabled() && oControl.getEditable()) {
oRm.addClass("sapMPointer");
}
};
/**
* Add extra styles for input container
*
* @param {sap.ui.core.RenderManager} oRm the RenderManager that can be used for writing to the render output buffer
* @param {sap.ui.core.Control} oControl an object representation of the control that should be rendered
*/
DateTimeInputRenderer.addOuterStyles = function(oRm, oControl) {
oRm.addStyle("width", oControl.getWidth());
};
return DateTimeInputRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','sap/ui/core/Renderer','./InputBaseRenderer'],function(q,R,I){"use strict";var D=R.extend(I);D.addOuterClasses=function(r,c){r.addClass("sapMDTI");};D.addCursorClass=function(r,c){if(c.getEnabled()&&c.getEditable()){r.addClass("sapMPointer");}};D.addOuterStyles=function(r,c){r.addStyle("width",c.getWidth());};return D;},true);

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,174 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global', './BarRenderer'],
function(jQuery, BarRenderer) {
"use strict";
/**
* Dialog renderer.
*
* @namespace
*/
var DialogRenderer = {};
/**
* Renders the HTML for the given control, using the provided {@link sap.ui.core.RenderManager}.
*
* @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer.
* @param {sap.ui.core.Control} oControl An object representation of the control that should be rendered.
*/
DialogRenderer.render = function(oRm, oControl) {
var id = oControl.getId(),
sType = oControl.getType(),
oHeader = oControl._getAnyHeader(),
oSubHeader = oControl.getSubHeader(),
bMessage = (sType === sap.m.DialogType.Message),
oLeftButton = oControl.getBeginButton(),
oRightButton = oControl.getEndButton(),
bHorizontalScrolling = oControl.getHorizontalScrolling(),
bVerticalScrolling = oControl.getVerticalScrolling(),
sState = oControl.getState();
if (oHeader) {
oHeader.applyTagAndContextClassFor("header");
}
if (oSubHeader) {
oSubHeader.applyTagAndContextClassFor("subheader");
}
// write the HTML into the render manager
oRm.write("<div");
oRm.writeControlData(oControl);
oRm.addClass("sapMDialog");
oRm.addClass("sapMDialog-CTX");
oRm.addClass("sapMPopup-CTX");
oRm.addClass(sap.m.Dialog._mStateClasses[sState]);
// ARIA
if (sState === "Error" || sState === "Warning") {
oRm.writeAccessibilityState(oControl, {
role: "alertdialog"
});
} else {
oRm.writeAccessibilityState(oControl, {
role: "dialog"
});
}
if (oHeader !== null && oHeader !== undefined) {
oRm.writeAccessibilityState(oControl, {
labelledby: oHeader.getId()
});
}
if (oControl._forceDisableScrolling) {
oRm.addClass("sapMDialogWithScrollCont");
}
if (oSubHeader) {
oRm.addClass("sapMDialogWithSubHeader");
}
if (bMessage) {
oRm.addClass("sapMMessageDialog");
}
if (!bVerticalScrolling) {
oRm.addClass("sapMDialogVerScrollDisabled");
}
if (!bHorizontalScrolling) {
oRm.addClass("sapMDialogHorScrollDisabled");
}
if (sap.ui.Device.system.phone) {
oRm.addClass("sapMDialogPhone");
}
// test dialog with sap-ui-xx-formfactor=compact
if (sap.m._bSizeCompact) {
oRm.addClass("sapUiSizeCompact");
}
oRm.writeClasses();
var sTooltip = oControl.getTooltip_AsString();
if (sTooltip) {
oRm.writeAttributeEscaped("title", sTooltip);
}
oRm.writeAttribute("tabindex", "-1");
oRm.write(">");
if (sap.ui.Device.system.desktop) {
// Invisible element which is used to determine when desktop keyboard navigation
// has reached the first focusable element of a dialog and went beyond. In that case, the controller
// will focus the last focusable element.
oRm.write('<span id="' + oControl.getId() + '-firstfe" tabindex="0"/>');
}
if (oHeader) {
oRm.renderControl(oHeader);
}
if (oSubHeader) {
oRm.renderControl(oSubHeader.addStyleClass("sapMDialogSubHeader"));
}
oRm.write('<section id="' + id + '-cont" style="width:' + oControl.getContentWidth() + '" class="sapMDialogSection">');
oRm.write('<div id="' + id + '-scroll" class="sapMDialogScroll">');
oRm.write('<div id="' + id + '-scrollCont" class="sapMDialogScrollCont">');
var aContent = oControl.getContent();
for (var i = 0; i < aContent.length; i++) {
oRm.renderControl(aContent[i]);
}
oRm.write("</div>");
oRm.write("</div>");
oRm.write("</section>");
if (oControl._oToolbar && oControl._oToolbar.getContent().length > 1) {
oRm.renderControl(oControl._oToolbar);
} else if (oLeftButton || oRightButton) {
oRm.write('<footer id="' + id + '-footer" class="sapMDialogActions sapMBar-CTX sapMFooter-CTX sapMIBar-CTX">');
// Render actions
if (oLeftButton) {
oRm.write('<div class="sapMDialogAction">');
oRm.renderControl(oLeftButton.addStyleClass("sapMDialogBtn", true));
oRm.write("</div>");
}
if (oRightButton) {
oRm.write('<div class="sapMDialogAction">');
oRm.renderControl(oRightButton.addStyleClass("sapMDialogBtn", true));
oRm.write("</div>");
}
oRm.write("</footer>");
}
if (sap.ui.Device.system.desktop) {
// Invisible element which is used to determine when desktop keyboard navigation
// has reached the last focusable element of a dialog and went beyond. In that case, the controller
// will focus the first focusable element.
oRm.write('<span id="' + oControl.getId() + '-lastfe" tabindex="0"/>');
}
oRm.write("</div>");
};
return DialogRenderer;
}, /* bExport= */ true);

View File

@ -0,0 +1,6 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
sap.ui.define(['jquery.sap.global','./BarRenderer'],function(q,B){"use strict";var D={};D.render=function(r,c){var a=c.getId(),t=c.getType(),h=c._getAnyHeader(),s=c.getSubHeader(),m=(t===sap.m.DialogType.Message),l=c.getBeginButton(),R=c.getEndButton(),H=c.getHorizontalScrolling(),v=c.getVerticalScrolling(),S=c.getState();if(h){h.applyTagAndContextClassFor("header");}if(s){s.applyTagAndContextClassFor("subheader");}r.write("<div");r.writeControlData(c);r.addClass("sapMDialog");r.addClass("sapMDialog-CTX");r.addClass("sapMPopup-CTX");r.addClass(sap.m.Dialog._mStateClasses[S]);if(S==="Error"||S==="Warning"){r.writeAccessibilityState(c,{role:"alertdialog"});}else{r.writeAccessibilityState(c,{role:"dialog"});}if(h!==null&&h!==undefined){r.writeAccessibilityState(c,{labelledby:h.getId()});}if(c._forceDisableScrolling){r.addClass("sapMDialogWithScrollCont");}if(s){r.addClass("sapMDialogWithSubHeader");}if(m){r.addClass("sapMMessageDialog");}if(!v){r.addClass("sapMDialogVerScrollDisabled");}if(!H){r.addClass("sapMDialogHorScrollDisabled");}if(sap.ui.Device.system.phone){r.addClass("sapMDialogPhone");}if(sap.m._bSizeCompact){r.addClass("sapUiSizeCompact");}r.writeClasses();var T=c.getTooltip_AsString();if(T){r.writeAttributeEscaped("title",T);}r.writeAttribute("tabindex","-1");r.write(">");if(sap.ui.Device.system.desktop){r.write('<span id="'+c.getId()+'-firstfe" tabindex="0"/>');}if(h){r.renderControl(h);}if(s){r.renderControl(s.addStyleClass("sapMDialogSubHeader"));}r.write('<section id="'+a+'-cont" style="width:'+c.getContentWidth()+'" class="sapMDialogSection">');r.write('<div id="'+a+'-scroll" class="sapMDialogScroll">');r.write('<div id="'+a+'-scrollCont" class="sapMDialogScrollCont">');var C=c.getContent();for(var i=0;i<C.length;i++){r.renderControl(C[i]);}r.write("</div>");r.write("</div>");r.write("</section>");if(c._oToolbar&&c._oToolbar.getContent().length>1){r.renderControl(c._oToolbar);}else if(l||R){r.write('<footer id="'+a+'-footer" class="sapMDialogActions sapMBar-CTX sapMFooter-CTX sapMIBar-CTX">');if(l){r.write('<div class="sapMDialogAction">');r.renderControl(l.addStyleClass("sapMDialogBtn",true));r.write("</div>");}if(R){r.write('<div class="sapMDialogAction">');r.renderControl(R.addStyleClass("sapMDialogBtn",true));r.write("</div>");}r.write("</footer>");}if(sap.ui.Device.system.desktop){r.write('<span id="'+c.getId()+'-lastfe" tabindex="0"/>');}r.write("</div>");};return D;},true);

View File

@ -0,0 +1,56 @@
/*!
* SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
* (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
*/
// Provides control sap.m.DisplayListItem.
sap.ui.define(['jquery.sap.global', './ListItemBase', './library'],
function(jQuery, ListItemBase, library) {
"use strict";
/**
* Constructor for a new DisplayListItem.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
*
* @class
* The display list item consists of a label and a value.
* @extends sap.m.ListItemBase
*
* @author SAP SE
* @version 1.28.5
*
* @constructor
* @public
* @alias sap.m.DisplayListItem
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var DisplayListItem = ListItemBase.extend("sap.m.DisplayListItem", /** @lends sap.m.DisplayListItem.prototype */ { metadata : {
library : "sap.m",
properties : {
/**
* List item label
*/
label : {type : "string", group : "Misc", defaultValue : null},
/**
* List item value
*/
value : {type : "string", group : "Data", defaultValue : null},
/**
* This property specifies the value text directionality with enumerated options. By default, the control inherits text direction from the DOM.
* @since 1.28.0
*/
valueTextDirection : {type : "sap.ui.core.TextDirection", group : "Appearance", defaultValue : sap.ui.core.TextDirection.Inherit}
}
}});
return DisplayListItem;
}, /* bExport= */ true);

Some files were not shown because too many files have changed in this diff Show More