/**
* Licensed Materials - Property of IBM
*
* IBM Cognos Products: BI Glass
*
* Copyright IBM Corp. 2016, 2017
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/api/ActionInterface',[], function () {
'use strict';
/**
* This class provides a means to declare a custom action controller for a button/menu item
* It plays the role of an interface, consumer can implement it.
*
* @interface
*/
var ActionInterface = function ActionInterface() {
/**
* Called when the custom button/menu item is Clicked/Tapped
*
* @public
* @param {Context}
*/
this.execute = function
/* context */
() {};
/**
* Optional:-
* Implement this method if the widget being added is a menu item.
* Determines based on the return value if the menu item should be visible or hidden.
*
* @public
* @param {Context}
* @return {Boolean} True - will show the menu item, False - will hide the menu item.
*/
this.isVisible = function
/* context */
() {};
};
return ActionInterface;
});
//# sourceMappingURL=ActionInterface.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2013, 2016
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/ui/core/Class',['underscore'], function (_) {
'use strict';
/**
* The Class implements the root of class hierarchy implementing the mechanism for
* creating new derived classes and calling inherited methods.
*/
// @class
// @abstract
var Class = function Class() {};
function createConstructor() {
return function () {
if (typeof this.init === 'function') {
this.init.apply(this, arguments);
}
};
}
// Create new widget class derived from the Class
// @static
// @param mixins [optional] An array of the mixin classes.
// @param def The definition of the derived class, methods, member variables. The
// special method 'init' is called at construction of the class instance.
//
Class.extend = function (mixins, def) {
if (arguments.length === 1) {
def = mixins;
mixins = null;
}
var baseProto = this.prototype,
parentProto = baseProto,
proto = Object.create(parentProto);
// create the constructor
var ctor = createConstructor();
// add the mixins
if (mixins) {
for (var i = 0, len = mixins.length; i < len; ++i) {
proto = _.extend(proto, mixins[i].prototype);
}
parentProto = proto;
proto = Object.create(proto);
if (typeof def.init !== 'function') {
// generate default init method for multi-class inheritance
def.init = function () {
ctor.inherited('init', this, arguments);
};
}
}
_.extend(proto, def);
ctor.prototype = proto;
// static method to allow for further extension
ctor.extend = this.extend;
// calling the inherited methods
ctor.inherited = function (name, that, args) {
if (name === 'init') {
// the 'init' method has a special case of calling inherited implementation
// it should call all the 'init' methods from the base class and mixins
if (typeof baseProto[name] === 'function') {
baseProto[name].apply(that, args);
}
_.each(mixins, function (m) {
if (typeof m.prototype[name] === 'function') {
m.prototype[name].apply(that, args);
}
});
} else if (typeof parentProto[name] === 'function') {
return parentProto[name].apply(that, args);
}
};
return ctor;
};
return Class;
});
//# sourceMappingURL=Class.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2013, 2016
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*
* @module /dashboard/data/Events
* @see Events
*/
define('baglass/core-client/js/core-client/ui/core/Events',['./Class'], function (Class) {
'use strict';
/**
* Events implements the Backbone-style eventing model objects
*
* @class Events
*/
var Events = Class.extend({
init: function init() {
this._events = {};
},
/**
* The 'on' method registers the handler and return DOJO-style event registration object with 'remove' method, which unregisters the handler.
*
* This implementation supports composite event names, such as 'eventBaseName:eventSecondaryName', for example: 'change:name'. Triggering 'change:name' event would invoke handlers registered to
* listen 'change' event as well as the handlers registered to listen the 'change:name' event. The special event name 'all' can be used to listen to all event types.
*/
on: function on(eventName, handler, context) {
if (typeof handler !== 'function') {
console.log('ERROR in Events.on: Invalid event handler');
}
if (!this._events[eventName]) {
this._events[eventName] = [];
}
this._events[eventName].push({
handler: handler,
context: context
});
var that = this;
return {
remove: function remove() {
that.off(eventName, handler, context);
}
};
},
/**
* Removes the specified handler from the listening to the events on this object. If eventName is not specified then unregister handler and context for all event types. If handler is not specified
* then unregister all event handlers for the specified context and event name. If context is not specified then unregister all event handlers for the specified handler and event name.
*
* Examples: obj.off('change:name', handler, context); // unregister handler in context from listening 'change:name' event obj.off(null, null, context); // unregister all event handlers for the
* specified context obj.off(); // unregister all event handlers
*/
off: function off(eventName, handler, context) {
var getEvents = function getEvents(evName, self) {
var events = self._events;
if (!evName) {
return events;
}
var parts = evName.split(':');
events = {};
events[parts[0]] = self._events[parts[0]];
if (parts.length > 1 && parts[1] !== '*') {
events[evName] = self._events[evName];
} else if (parts.length > 1 && parts[1] === '*') {
for (var name in self._events) {
if (name.indexOf(parts[0] + ':') === 0) {
events[name] = self._events[name];
}
}
}
return events;
};
var events = getEvents(eventName, this);
for (var name in events) {
var i = 0,
handlers = events[name];
if (!handlers) {
continue;
}
while (i < handlers.length) {
if ((handlers[i].handler === handler || !handler) && (handlers[i].context === context || !context)) {
handlers.splice(i, 1);
} else {
i++;
}
}
}
},
/**
* Triggers an event
*/
trigger: function trigger(eventName, event) {
var parts = eventName.split(':');
var handlers = [].concat(this._events['all'] || []).concat(this._events[parts[0]] || []);
if (parts.length > 1) {
handlers = handlers.concat(this._events[eventName] || []);
}
for (var i = 0; i < handlers.length; i++) {
if (typeof handlers[i].handler === 'function') {
handlers[i].handler.call(handlers[i].context, event, eventName);
}
}
}
});
// alias
Events.prototype.emit = Events.prototype.trigger;
//
return Events;
});
//# sourceMappingURL=Events.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2012, 2019
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*
* borrowed from cclcore.
* Common bidi javascript library - BidiUtils.
* Singleton containing useable bidi methods.
*/
/**
* This module contains a subset of BidiUtils from cclcore with some
* modifications to meet gemini's requirements for BiDi text. Elements passed
* in to the methods of this module is expected to contain only a single text
* node such as
or elements
*/
define('baglass/core-client/js/core-client/utils/BidiUtil',[], function () {
'use strict';
var AUTO = 'auto',
arabicLocales = {
'General Info': {
'Generated from': 'CLDR Version: 30.0.3',
'Generated by': 'BDL CLDR Reader Tool',
'Date': '16-03-17 12:40:12'
},
'Arabic Default Numbering Systems': {
'ar': 'arab',
'ar_AE': 'arab',
'ar_BH': 'arab',
'ar_DJ': 'arab',
'ar_DZ': 'latn',
'ar_EG': 'arab',
'ar_EH': 'latn',
'ar_ER': 'arab',
'ar_IL': 'arab',
'ar_IQ': 'arab',
'ar_JO': 'arab',
'ar_KM': 'arab',
'ar_KW': 'arab',
'ar_LB': 'arab',
'ar_LY': 'latn',
'ar_MA': 'latn',
'ar_MR': 'arab',
'ar_OM': 'arab',
'ar_PS': 'arab',
'ar_QA': 'arab',
'ar_SA': 'arab',
'ar_SD': 'arab',
'ar_SO': 'arab',
'ar_SS': 'arab',
'ar_SY': 'arab',
'ar_TD': 'arab',
'ar_TN': 'latn',
'ar_YE': 'arab'
}
},
cldrData = arabicLocales['Arabic Default Numbering Systems'];
var BidiUtil = function BidiUtil() {
this._isIE = this._detectIE(navigator.userAgent);
this.userPreferredTextDir = this._getUserPreferredTextDir() || AUTO;
this.LRE = '\u202A';
this.RLE = '\u202B';
this.PDF = '\u202C';
this.LRM = '\u200E';
};
BidiUtil.prototype._detectIE = function (useragent) {
return (/\b(MSIE|Trident|Edge)\b/.test(useragent)
);
};
// Private Methods
// Should not need to call these methods outside this module. Although real
// encapsulation is possible, defining as part of BidiUtil's prototype allows
// unit testing and faster scope chain access from public methods
/**
* Gets the user's preferred text direction from attribute passed in
* from server-side and stores it as member of this singleton as userPreferredTextDir
* @return {string} User's preferred text direction (i.e. ltr, rtl, auto)
*/
BidiUtil.prototype._getUserPreferredTextDir = function () {
if (!this.userPreferredTextDir) {
this.userPreferredTextDir = document.documentElement.getAttribute('data-pref-text-dir');
}
return this.userPreferredTextDir;
};
/**
* Normalizes the process of retrieving the value from or
* HTML elements
* @param {Element|HTMLInputElement} element - DOM element receiving text input
* @return {string} String value of the DOM element
*/
BidiUtil.prototype._getNodeValue = function (element) {
return element.value || element.tagName === 'INPUT' ? element.value : element.textContent;
};
/**
* Normalizes the process of setting the value to or
* HTML elements
* @param {Element|HTMLInputElement} element - DOM element receiving text input
* @param {string} value - String value to be set to element
*/
BidiUtil.prototype._setNodeValue = function (element, value) {
if (element.value || element.tagName === 'INPUT') {
element.value = value;
} else {
// setting the textContent removes any text of its child nodes
element.textContent = value;
}
};
/**
* Checks if the character passed in is an Arabic character.
* @param {string} charCode - Character code
* @return {boolean} True, if character is an Arabic character
*/
BidiUtil.prototype._isArabicChar = function (charCode) {
if (charCode >= 0x0600 && charCode <= 0x0669 || charCode >= 0x06fa && charCode <= 0x07ff || charCode >= 0xfb50 && charCode <= 0xfdff || charCode >= 0xfe70 && charCode <= 0xfefc) {
return true;
}
return false;
};
/**
* Checks if the character passed in is a Hebrew character.
* @param {string} charCode - Character code
* @return {boolean} True, if character is a Hebrew character
*/
BidiUtil.prototype._isHebrewChar = function (charCode) {
if (charCode >= 0x05d0 && charCode <= 0x05ff) {
return true;
}
return false;
};
/**
* Checks if the character passed in is a BiDi character.
* @param {number} charCode - Chracter code
* @return {boolean} True, if the character is a BiDi (Arabic or Hebrew) character
*/
BidiUtil.prototype._isBidiChar = function (charCode) {
return this._isArabicChar(charCode) || this._isHebrewChar(charCode);
};
/**
* Checks if the character passed in is a Latin character (Only treats
* capital and lower case alphabets as latin characters)
* @param {number} charCode - Character code
* @return {boolean} True, if the character is a Latin character
*/
BidiUtil.prototype._isLatinChar = function (charCode) {
if (charCode > 64 && charCode < 91 || charCode > 96 && charCode < 123) {
return true;
}
return false;
};
/**
* Event handler for 'input' event (events causing the value of the target
* element to change)
* Resolves the base text direction and sets the dir attribute
* @param {Event} event - DOM Event object
*/
BidiUtil.prototype._handleInputEvent = function (event) {
// NOTE: 'this' has been binded to be BidiUtil in _addBidiEventListeners function
this._resolveDirAttr(event.target);
};
/**
* Adds event listeners for events changing the value of the element being passed in
* @param {Element|HTMLInputElement} element - DOM element receiving text input
*/
BidiUtil.prototype._addBidiEventListeners = function (element) {
if (!element._hasBidiEventListeners) {
element._hasBidiEventListeners = true;
var eventTypes = ['keyup', 'cut', 'paste'];
for (var i = 0; i < eventTypes.length; ++i) {
element.addEventListener(eventTypes[i], this._handleInputEvent.bind(this), false);
}
}
};
/**
* Sets dir attribute of the DOM element passed in as parameter according to
* the direction of the first strong character in the text content of the element
* @param {Element|HTMLInputElement} element - DOM element receiving text input
*/
BidiUtil.prototype._resolveDirAttr = function (element) {
if (this._isIE && (this.userPreferredTextDir === AUTO || !this.userPreferredTextDir)) {
// IE doesn't support dir="auto" HTML attribute
var text = this._getNodeValue(element);
element.dir = this.resolveBaseTextDir(text);
} else {
// Chrome, Safari, and Firefox supports dir="auto" HTML attribute
// IE will only receive "ltr" or "rtl" in this block
element.dir = this.userPreferredTextDir || AUTO;
}
};
/**
* This function determines the positions where we should insert the LRM marker for correct display
* of Structured Text Value
* @param str
* @param isLocation
* @returns array
*/
BidiUtil.prototype._parseSTT = function (str, isLocation) {
var delimiter = isLocation ? '>' : ':/@=[]\'<>';
var segmentsPointers = [];
var sp_len = 0,
i;
for (i = 0; i < str.length; i++) {
if (delimiter.indexOf(str.charAt(i)) >= 0) {
segmentsPointers[sp_len] = i;
sp_len++;
}
}
return segmentsPointers;
};
// Public Methods
/**
* Simply resolves the dir attribute of the HTML element and adds BiDi specific
* event handlers if necessary
* @param {Element|HTMLInputElement} element - DOM element receiving text input
*/
BidiUtil.prototype.initElementForBidi = function (element) {
if (element) {
this._resolveDirAttr(element); // resolve dir attribute of the element
if (this._isIE) {
this._addBidiEventListeners(element);
}
}
};
/**
* Enforces text direction by adding UCC (Unicode Control Characters)
* @param {String} text - The text for which we should enforce text direction.
* @returns string
*/
BidiUtil.prototype.enforceTextDirection = function (text) {
if (text) {
var finalDir = this.resolveBaseTextDir(text);
var finalValue = text;
if (finalDir === 'ltr') {
finalValue = this.LRE + finalValue + this.PDF;
} else if (finalDir === 'rtl') {
finalValue = this.RLE + finalValue + this.PDF;
}
return finalValue;
}
return text;
};
/**
* Traverses the string passed in as parameter from the beginning and
* determines the direction of the text based on the first strong character
* @param {string} text - A bi-directional text
* @param {bool} isTextArea - Does the text belong to a textarea
* @return {string} Direction of the text
*/
BidiUtil.prototype.resolveBaseTextDir = function (text, isTextArea) {
var textDir = this.userPreferredTextDir;
if (!textDir) {
textDir = AUTO;
}
if (textDir === AUTO && (!isTextArea || this._isIE)) {
for (var i = 0; text && i < text.length; i++) {
var character = text.charCodeAt(i);
if (this._isBidiChar(character)) {
textDir = 'rtl';
break;
} else if (this._isLatinChar(character)) {
textDir = 'ltr';
break;
}
}
if (this._isIE && textDir === AUTO) {
textDir = '';
}
}
return textDir;
};
/**
* Enforces text direction for Structured Text value by adding UCC (Unicode Control Characters)
* We should add an LRM before each segment and also we should enforce text direction of each segment
* @param {String} text - The text for which we should enforce text direction.
* @returns string
*/
BidiUtil.prototype.enforceTextDirectionForSTT = function (text) {
if (text) {
text = this.removeMarkers(text);
var isLocation = (text.match(/ > /g) || []).length > 0;
var segmentsPointers = this._parseSTT(text, isLocation);
var result = '';
var n;
var marker = this.LRM;
var offset = isLocation ? 1 : 0;
if (segmentsPointers.length === 0) {
result = this.enforceTextDirection(text);
} else {
result = this.enforceTextDirection(text.substring(0, segmentsPointers[0] - offset));
}
for (var i = 0; i < segmentsPointers.length; i++) {
n = segmentsPointers[i];
if (n) {
var endIndex = i < segmentsPointers.length - 1 ? segmentsPointers[i + 1] - offset : text.length;
var segment = text.substring(n + 1 + offset, endIndex);
result = result + marker + text.substring(n - offset, n + offset + 1) + this.enforceTextDirection(segment);
}
}
return result;
}
return text;
};
/**
* Enforces text direction for Structured Text value by adding UCC (Unicode Control Characters)
* We should add an LRM before each segment and also we should enforce text direction of each segment
* @param {String} text - The text for which we should enforce text direction.
* @returns string
*/
BidiUtil.prototype.enforceTextDirectionForLocation = function (text) {
return this.enforceTextDirectionForSTT(text);
};
/**
* Removes all the markers from the text
* @param {String} text - The text
* @returns string
*/
BidiUtil.prototype.removeMarkers = function (text) {
return text.replace(/[\u202A\u202B\u202C\u200E]/g, '');
};
BidiUtil.prototype._isArabicLocale = function (locale) {
return locale.match(/^ar[-_].*$/i);
};
BidiUtil.prototype._useLatinNums = function (locale) {
if (!this._isArabicLocale(locale)) {
return true;
}
return cldrData[locale] && cldrData[locale] === 'latn';
};
/**
* Enforces numeric shaping for the given string
* @param {Object} text to be wrapped. Can be number or string object.
* @param {bool} isContextual. Should enforce contextual numeric shaping.
* @returns {string}
*/
BidiUtil.prototype.enforceNumericShaping = function (text, isContextual) {
if (this.bidiSupport && this.userPreferredContentLocale.startsWith('ar') && (typeof text === 'number' || typeof text === 'string')) {
var segmentDir = this.userPreferredTextDir;
if (this.userPreferredTextDir === AUTO) {
segmentDir = this.resolveBaseTextDir(text);
}
var locale = typeof navigator === 'undefined' ? '' : navigator.language || navigator.userLanguage || '';
locale = locale.replace('-', '_');
var finalText = text;
if (typeof text === 'number') {
finalText = text.toString();
}
var pattern = /([0-9])|([\u0660-\u0669])|([\u0590-\u05FF\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FF\u0750-\u077F\u08A0-\u08E3\u200F\u202B\u202E\u2067\uFB50-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFC\uFDFE-\uFDFF\uFE70-\uFEFE]+)|([^0-9\u0590-\u05FF\u0660-\u0669\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FF\u0750-\u077F\u08A0-\u08E3\u200F\u202B\u202E\u2067\uFB50-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFC\uFDFE-\uFDFF\uFE70-\uFEFE\u0600-\u0607\u0609-\u060A\u060C\u060E-\u061A\u064B-\u066C\u0670\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u08E4-\u08FF\uFD3E-\uFD3F\uFDD0-\uFDEF\uFDFD\uFEFF\u0000-\u0040\u005B-\u0060\u007B-\u007F\u0080-\u00A9\u00AB-\u00B4\u00B6-\u00B9\u00BB-\u00BF\u00D7\u00F7\u02B9-\u02BA\u02C2-\u02CF\u02D2-\u02DF\u02E5-\u02ED\u02EF-\u02FF\u2070\u2074-\u207E\u2080-\u208E\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A-\u213B\u2140-\u2144\u214A-\u214D\u2150-\u215F\u2189\uA720-\uA721\uA788\uFF01-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFE0-\uFFE6\uFFE8-\uFFEE]+)/g; // eslint-disable-line no-control-regex
var self = this;
return finalText.replace(pattern, function (curChs, latNum, araNum, rtlChs, ltrChs) {
if (araNum) {
if (isContextual && segmentDir === 'ltr' || !isContextual && self._useLatinNums(locale)) {
return araNum.charCodeAt(0) - 1632;
} else {
return araNum;
}
} else if (latNum) {
if (isContextual && segmentDir === 'rtl' || !isContextual && !self._useLatinNums(locale)) {
return String.fromCharCode(parseInt(latNum) + 1632);
} else {
return latNum;
}
} else if (rtlChs) {
segmentDir = 'rtl';
} else if (ltrChs) {
segmentDir = 'ltr';
}
return curChs;
});
}
return text;
};
/**
* Sets the text dir user preference
* @param {String} textDir - The text direction user preference.
* @param {String} bidiSupport - Is Bidi support enabled ?
*/
BidiUtil.prototype.setUserPreferredTextDir = function (textDir, bidiSupport) {
this.userPreferredTextDir = '';
this.bidiSupport = false;
if (bidiSupport === 'true') {
this.userPreferredTextDir = textDir.toLowerCase();
this.bidiSupport = true;
}
};
/**
* Sets the content locale user preference
* @param {String} contentLocale - The content locale user preference.
*/
BidiUtil.prototype.setUserPreferredContentLocale = function (contentLocale) {
this.userPreferredContentLocale = contentLocale;
};
return new BidiUtil();
});
//# sourceMappingURL=BidiUtil.js.map
//# sourceMappingURL=BidiUtil.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI
* (C) Copyright IBM Corp. 2014, 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule
* Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/utils/dom-utils',[], function () {
'use strict';
return {
getAncestorOfClass: function getAncestorOfClass(node, className) {
var doc = document;
while (node && node !== doc) {
if (node.className.split(' ').indexOf(className) >= 0) {
return node;
}
node = node.parentNode;
}
return null;
},
isTouchEvent: function isTouchEvent(ev) {
return ev.type.indexOf('touch') === 0;
},
isPointerTouch: function isPointerTouch(ev) {
return ev.gesture && ev.gesture.pointerType === 'touch';
},
isMultiTouchEvent: function isMultiTouchEvent(ev) {
var oev = ev.originalEvent || ev;
if (oev && oev.touches && oev.touches.length > 1) {
return true;
}
return false;
},
isGesture: function isGesture(ev) {
if (ev.gesture && ev.gesture.touches && ev.gesture.touches.length > 0) {
return true;
}
return false;
},
getEventPos: function getEventPos(ev) {
var pageValuesValid = function pageValuesValid(event) {
return event && (event.pageX || event.pageX === 0) && (event.pageY || event.pageY === 0);
};
var pos;
if (this.isGesture(ev)) {
var touches = ev.gesture.touches[0];
if (pageValuesValid(touches)) {
pos = {
pageX: touches.pageX,
pageY: touches.pageY
};
}
}
if (!pos && this.isTouchEvent(ev)) {
var oev = ev.originalEvent || ev;
if (oev && oev.touches.length > 0 && pageValuesValid(oev.touches[0])) {
pos = { pageX: oev.touches[0].pageX, pageY: oev.touches[0].pageY };
}
}
if (!pos && pageValuesValid(ev)) {
pos = { pageX: ev.pageX, pageY: ev.pageY };
}
if (!pos && pageValuesValid(ev.originalEvent)) {
pos = { pageX: ev.originalEvent.pageX, pageY: ev.originalEvent.pageY };
}
if (!pos) {
// could not find any valid numbers so return zero. Returning undefined values breaks some other code.
pos = { pageX: 0, pageY: 0 };
}
return pos;
},
getEventTarget: function getEventTarget(ev) {
if (this.isTouchEvent(ev)) {
var oev = ev.originalEvent || ev;
if (oev && oev.touches.length > 0) {
return oev.touches[0].target;
}
}
return ev.target;
},
withinElementBoundaries: function withinElementBoundaries(event, node) {
var pos = this.getEventPos(event);
var boundingRect = node.getBoundingClientRect();
var inXRange = pos.pageX >= boundingRect.left && pos.pageX <= boundingRect.right;
var inYRange = pos.pageY >= boundingRect.top && pos.pageY <= boundingRect.bottom;
return inXRange && inYRange;
}
};
});
//# sourceMappingURL=dom-utils.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI
* (C) Copyright IBM Corp. 2014, 2016
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*
* Drag-and-Drop Manager
*/
define('baglass/core-client/js/core-client/utils/dnd/DnDManager',['jquery', 'underscore', '../../ui/core/Class', '../dom-utils'], function ($, _, Class, utils) {
'use strict';
var DnDManager = null;
DnDManager = Class.extend({
dropTargets: null,
currentDropTarget: null,
init: function init() {
this.dropTargets = [];
this.currentDropTarget = {};
// Add the dialog blocker as a default drop zone to swallow and ignore any drop that happens on the backdrop
this.addDropTarget($('body')[0], '.dialogBlocker', {
accepts: function accepts() {
return true;
}
});
},
// Utility method that subscribes to the specified jQuery event
// and returns removable object, that can be inserted into the 'owned' collections
// of subscriptions
//
on: function on($el, types, selector, data, fn) {
$el.on(types, selector, data, fn);
return {
remove: function remove() {
$el.off(types, selector, fn);
}
};
},
/**
* Register a drop Zone with the drag and drop manage
*
*
* @param el - The drop zone element.
* @param selector - Selector to identify the drop zone sub regions. If not specified, there will only be one region which is the drop zone element.
* @param callbacks
* callbacks.accepts(dragObject) - Called to check if the dropzone accepts the payload.
* callbacks.onDragStart() - Called when a drag starts
* callbacks.onDragEnd() - Called when a drag ends
* callbacks.onDragEnter(dragObject, dropNode) - Called when we enter a drop zone
* callbacks.onDragMove(dragObject, dropNode) - Called when we move inside a drop zone
* callbacks.onDragLeave(dragObject, dropNode) - Called when we leave a drop zone
* callbacks.onDrop(dragObject, dropNode) - Called when a drop occurs.
* @returns {___anonymous1282_1365}
*/
addDropTarget: function addDropTarget(el, selector, callbacks) {
if (typeof selector !== 'string') {
callbacks = selector;
selector = null;
}
this.removeDropTarget(el);
this.dropTargets.push({
el: el,
selector: selector,
callbacks: callbacks
});
return {
remove: function () {
this.removeDropTarget(el);
}.bind(this)
};
},
/**
* Remove a registered drop target
* @param el
*/
removeDropTarget: function removeDropTarget(el) {
var target = _.find(this.dropTargets, function (t) {
return t.el === el;
});
if (target) {
this.dropTargets.splice(_.indexOf(this.dropTargets, target), 1);
}
},
_isScrollDropSupported: function _isScrollDropSupported() {
return this.currentDropTarget.target && this.currentDropTarget.target.callbacks.isScrollDropSupported ? true : false;
},
/**
*
* Check if the intention is scrolling and return the proper scrolling enabled drop zone.
* If we are dragging outside of the view port, the intention is to auto scroll. In this case we do the following:
* - if we have a drop zone, find the closest scrollable drop zone in the ancestors.
* - if there is no drop zone, select the last scrollable drop zone that was used.
*
* If we are dragging within the view and we have no drop zone, find the closest scrolling drop zone using the last drop target that was used.
* @param target
* @param isScrollDropSupported
* @param pos - current mouse position
*
* @returns the target or empty object.
*/
_validateDropTarget: function _validateDropTarget(target, isScrollDropSupported, pos) {
var foundTarget = target;
if (isScrollDropSupported) {
if (pos.x + 1 >= $(window).innerWidth() || pos.y + 1 >= $(window).height() || pos.x <= 1 || pos.y <= 1) {
// dragging outside of the viewport.. most likely the intent is to auto scroll a drop zone
if (foundTarget) {
foundTarget = this._getClosestTargetWithScrollSupport(foundTarget.node);
} else {
foundTarget = this.lastActiveScrollableTarget;
}
}
if (!foundTarget && this.currentDropTarget) {
foundTarget = this._getClosestTargetWithScrollSupport(this.currentDropTarget.node);
}
}
return foundTarget || {};
},
/**
* Scan the list containing the ancestors + self and return the first drop zone that suppports scrolling.
*
* @param dropTargetNode - the node of the drop target where to start the search
*
*/
_getClosestTargetWithScrollSupport: function _getClosestTargetWithScrollSupport(dropTargetNode) {
var parentsAndSelf = $(dropTargetNode).parents();
parentsAndSelf.splice(0, 0, dropTargetNode);
var target = null;
for (var i = 0; i < parentsAndSelf.length; i++) {
target = this._getDropTargetWithScrollSupport(parentsAndSelf[i]);
if (target) {
this.lastActiveScrollableTarget = target;
break;
}
}
return target;
},
/**
* Find the drop zone that support scrolling where the node match the given node parameter
*
* @param targetNode - node to match with the drop zone node.
*
*/
_getDropTargetWithScrollSupport: function _getDropTargetWithScrollSupport(targetNode) {
var foundTarget = null;
var dropTarget = _.find(this.dropTargets, function (target) {
var $elements = $(target.el);
if (target.selector) {
$elements = $elements.find(target.selector);
}
return _.find($elements, function (node) {
return node === targetNode && target.callbacks.isScrollDropSupported && (!target.callbacks.accepts || target.callbacks.accepts(this.dragObject));
}.bind(this));
}.bind(this));
if (dropTarget) {
foundTarget = {
target: dropTarget,
node: targetNode
};
}
return foundTarget;
},
/**
* Helper method that gets the current drop target from a position
* @param pos
* @param options -- options passed by the called when the startDrag method is called
* @returns {Object} - drop target
*/
getDropTargetFromPos: function getDropTargetFromPos(pos, options) {
var isScrollDropSupported = options && !options.disableScrollableDropZoneSupport;
var foundTarget = null;
var foundTargetArea = 0;
var foundTargetPriority = 0;
var nonActiveDropZones = [];
_.each(this.dropTargets, function (target) {
var $elements = $(target.el);
if (target.selector) {
$elements = $elements.find(target.selector);
}
_.each($elements, function (node) {
var info = this.getTargetMatchInformation(pos, node, target, foundTarget, foundTargetArea, foundTargetPriority);
if (info.isMatch) {
if (!target.callbacks.accepts || target.callbacks.accepts(this.dragObject)) {
foundTarget = {
target: target,
node: node
};
foundTargetArea = info.area;
foundTargetPriority = info.priority;
} else if (target.callbacks.receiveEventsWhenNotAccepting) {
nonActiveDropZones.push({
target: target,
node: node
});
}
}
}.bind(this));
}.bind(this));
foundTarget = this._validateDropTarget(foundTarget, isScrollDropSupported, pos);
if (foundTarget) {
foundTarget.nonActiveDropZones = nonActiveDropZones;
}
return foundTarget || {};
},
/**
* Return true if val is between lowerBound and (lowerBound + rangeSize).
*/
_isInRange: function _isInRange(val, lowerBound, rangeSize) {
return val >= lowerBound && val < lowerBound + rangeSize;
},
/**
* return the priority set for target or 0.
*/
_getPriority: function _getPriority(target) {
var priority = target.callbacks.priority;
if (typeof priority === 'function') {
priority = priority();
}
return priority || 0;
},
/**
* Helper function used by getDropTargetFromPos to decide if a drop target is found or not using the current mouse position
*/
getTargetMatchInformation: function getTargetMatchInformation(pos, node, target, foundTarget, foundTargetArea, foundTargetPriority) {
var matchInformation = {};
var $el = $(node);
var bounds = node.getBoundingClientRect();
var isVisible = $el.is(':visible');
if (isVisible) {
var xInRange = this._isInRange(pos.x, bounds.left, bounds.width);
var yInRange = this._isInRange(pos.y, bounds.top, bounds.height);
if (xInRange && yInRange) {
matchInformation = {
area: bounds.width * bounds.height,
priority: this._getPriority(target)
};
matchInformation.isMatch = !foundTarget || matchInformation.priority > foundTargetPriority || foundTargetArea > matchInformation.area && matchInformation.priority >= foundTargetPriority;
}
}
return matchInformation;
},
/**
* Helper method that gets the current drop target from a node
* @param pos
* @returns {Object} - drop target
*/
getDropTargetFromNode: function getDropTargetFromNode(node) {
var target = null;
for (var i = 0; i < this.dropTargets.length; i++) {
if (node === this.dropTargets[i].el) {
target = this.dropTargets[i];
break;
}
}
return target;
},
dragObject: null,
/**
* Called to start dragging
* @param options
* options.event ev - the event used to start the drag. e.g. mousedown, touchstart
* options.type - The type of the data being dropped.
* options.data - The data being dropped.
* options.avatar - the avatar node associated with the drag and drop operation
* options.avatarXOffset - the number of pixel added to the avatar left position
* options.avatarYOffset - the number of pixel added to the avatar top position
* options.restrictToXAxis - restrict moving on the x axis
* options.restrictToYAxis - restrict moving on the y axis
*
* options.callerCallbacks
* callerCallback.onDragStart(event, {dragObject}) - Called when the drag is started.
* callerCallback.onMove(event, {dragObject, dropNode}) - Called on every move event.
* callerCallback.onDragDone(event, {dragObject, dropNode, isDropped}) - Called when the drag is complete, whether we droppped or not.
*
* options.moveXThreshold - the number of pixel to move on the X axis before we allow the drag to start. A good example to use this is
* when want to enable a drag horizontally and still allow vertical scrolling/panning. In this case, we would set the moveXThreshold to something like 30.
* This will allow vertical scroll as long as we don't drag horizontally more that 30 pixels.
*
* options.moveYThreshold - the number of pixel to move on the Y axis before we allow the drag to start.
*
* @param moveThreshold - distance in pixel that will activate the move and the avatar
*/
startDrag: function startDrag(options) {
if (this.dragObject) {
// cannot start another drag operation until the previous one is finished
return;
}
$('body').addClass('preventSelection');
this.isDragStartCalled = false;
this.targetMap = {};
var isTouch = utils.isTouchEvent(options.event);
this.dragObject = {
type: options.type,
data: options.data,
avatar: options.avatar,
isTouch: isTouch || options.event.gesture !== undefined
};
var eventPos = utils.getEventPos(options.event);
this.dragObject.startPosition = {
x: eventPos.pageX,
y: eventPos.pageY
};
this.setAvatar(options.avatar, options);
this.callerCallbacks = options.callerCallbacks ? options.callerCallbacks : {};
var $target = $(window);
if (isTouch) {
$target = $(utils.getEventTarget(options.event));
}
this.attachedMoveHandler = this.on($target, 'mousemove touchmove', this.moveHandler.bind(this, options));
this.attachedUpHandler = this.on($target, 'mouseup touchend touchcancel', this.upHandler.bind(this));
if (options.event.type === 'mousedown') {
this.attachedScrollHandler = this.on($(options.event.target), 'scroll', this.scrollHandler.bind(this));
}
if (options.currentDropZoneNode) {
var target = this.getDropTargetFromNode(options.currentDropZoneNode);
if (target) {
this.currentDropTarget = {
target: target,
node: options.currentDropZoneNode
};
}
}
},
scrollHandler: function scrollHandler() /* event */{
// we are scrolling, do not track movement
// cancel drag
// IE does not fire mouseUp on scrollbar so drag move continues after releasing the mouse when it should not
this.resetDragging();
},
_setAvatarPosition: function _setAvatarPosition(options) {
if (this.avatar && this.dragObject.position) {
if (!this.avatar.parentNode) {
$('body').append(this.avatar);
}
var xOffset = options && options.avatarXOffset ? options.avatarXOffset : 1;
var yOffset = options && options.avatarYOffset ? options.avatarYOffset : 1;
$(this.avatar).css({
left: this.dragObject.position.x + xOffset + 'px',
top: this.dragObject.position.y + yOffset + 'px'
});
}
},
setAvatar: function setAvatar(avatar, options) {
this.avatar = avatar;
this._setAvatarPosition(options);
},
/**
* Move event main handler
* @param options - drag options
* @param ev
*/
moveHandler: function moveHandler(options, ev) {
//Always prevent the default behavior on drag move to prevent chrome auto scrolling
ev.preventDefault();
var eventPos = utils.getEventPos(ev);
var dx = eventPos.pageX;
var dy = eventPos.pageY;
this.dragObject.position = {
x: dx,
y: dy
};
if (options.restrictToXAxis) {
this.dragObject.position.y = this.dragObject.startPosition.y;
}
if (options.restrictToYAxis) {
this.dragObject.position.x = this.dragObject.startPosition.x;
}
if (!this.isDragStartCalled && this._isThresholdNotMet(options)) {
return;
}
this._setAvatarPosition(options);
var dropTarget = this.getDropTargetFromPos(this.dragObject.position, options);
this._callStartDrag(ev);
this._callMove(dropTarget, ev);
this._processCallbacks(dropTarget);
// Don't stop the propagation. This will interfere with hammer gestures like tap and hold.
// If there is an active tap/hold handlers, hammer needs to know when there is a move.
},
_processCallbacks: function _processCallbacks(dropTarget) {
var currentNonActiveDropZones = this.currentDropTarget.nonActiveDropZones;
// Process the callback for the active drop zone that accepted the drop
if (dropTarget.target !== this.currentDropTarget.target || dropTarget.node !== this.currentDropTarget.node) {
this._dropTargetCallback(this.currentDropTarget, 'onDragLeave');
this.currentDropTarget = dropTarget;
this._dropTargetCallback(this.currentDropTarget, 'onDragEnter');
} else {
this._dropTargetCallback(this.currentDropTarget, 'onDragMove');
}
// Process callback for drop zone that didn't accept but chose to receive the event anyway
this._processCallbacksForNonActiveDropzones(dropTarget.nonActiveDropZones, currentNonActiveDropZones);
},
_processCallbacksForNonActiveDropzones: function _processCallbacksForNonActiveDropzones(newDropZones, oldDropZones) {
_.each(newDropZones, function (dropZone) {
if (this._isDropZoneInArray(dropZone, oldDropZones)) {
this._dropTargetCallback(dropZone, 'onDragMove');
} else {
this._dropTargetCallback(dropZone, 'onDragEnter');
}
}.bind(this));
if (oldDropZones) {
_.each(oldDropZones, function (dropZone) {
if (!this._isDropZoneInArray(dropZone, newDropZones)) {
this._dropTargetCallback(dropZone, 'onDragLeave');
}
}.bind(this));
}
this.currentDropTarget.nonActiveDropZones = newDropZones;
},
_dropTargetCallback: function _dropTargetCallback(dropTarget, callbackName) {
if (dropTarget.target && dropTarget.target.callbacks[callbackName]) {
dropTarget.target.callbacks[callbackName](this.dragObject, dropTarget.node);
return true;
}
return false;
},
_isDropZoneInArray: function _isDropZoneInArray(dropZone, dropZoneArray) {
var found = false;
if (dropZoneArray) {
for (var i = 0; i < dropZoneArray.length; i++) {
if (dropZone.target === dropZoneArray[i].target) {
found = true;
break;
}
}
}
return found;
},
_isThresholdNotMet: function _isThresholdNotMet(options) {
var hasThreshold = options.moveXThreshold || options.moveYThreshold;
var isXThresholdNotMet = !options.moveXThreshold || options.moveXThreshold > Math.abs(this.dragObject.position.x - this.dragObject.startPosition.x);
var isYThresholdNotMet = !options.moveYThreshold || options.moveYThreshold > Math.abs(this.dragObject.position.y - this.dragObject.startPosition.y);
return hasThreshold && isXThresholdNotMet && isYThresholdNotMet;
},
_callMove: function _callMove(dropTarget, ev) {
if (this.callerCallbacks.onMove) {
this.callerCallbacks.onMove(ev, {
dragObject: this.dragObject,
dropTargetNode: dropTarget.node
});
}
},
_callStartDrag: function _callStartDrag(ev) {
if (this.callerCallbacks.onDragStart && !this.isDragStartCalled) {
this.callerCallbacks.onDragStart(ev, { dragObject: this.dragObject });
_.each(this.dropTargets, function (target) {
if (target.callbacks.onDragStart) {
target.callbacks.onDragStart(this.dragObject);
}
}.bind(this));
}
$('body').addClass('dragging');
this.isDragStartCalled = true;
},
/**
* mouseup/touchend main handler
*
* @param ev
*/
upHandler: function upHandler(ev) {
if (this.isDragStartCalled) {
var isDropped = false;
$('body').removeClass('dragging');
var dropTarget = this.currentDropTarget;
if (this._dropTargetCallback(dropTarget, 'onDrop')) {
isDropped = true;
}
if (this.callerCallbacks.onDragDone) {
this.callerCallbacks.onDragDone(ev, {
dragObject: this.dragObject,
dropTargetNode: isDropped ? dropTarget.node : null,
isDropped: isDropped
});
}
if (dropTarget.nonActiveDropZones) {
_.each(dropTarget.nonActiveDropZones, function (dropZone) {
this._dropTargetCallback(dropZone, 'onDrop');
}.bind(this));
}
_.each(this.dropTargets, function (target) {
if (target.callbacks.onDragEnd) {
target.callbacks.onDragEnd(this.dragObject);
}
}.bind(this));
}
this.resetDragging();
// Don't stop the propagation. This will interfere with hammer gestures like tap and hold.
// If there is an active tap/hold handlers, hammer needs to know when the touch ends.
},
resetDragging: function resetDragging() {
// Release the capture that we set in the mouse down.
// This is used to allow IE to keep firing the mouse event when the mouse leaves the window or iframe
if (document.releaseCapture) {
document.releaseCapture();
}
if (this.attachedMoveHandler) {
this.attachedMoveHandler.remove();
}
if (this.attachedUpHandler) {
this.attachedUpHandler.remove();
}
if (this.attachedScrollHandler) {
this.attachedScrollHandler.remove();
}
$('body').removeClass('preventSelection');
this.currentDropTarget = {};
this.dragObject = null;
this.isDragStartCalled = false;
this.targetMap = null;
this.lastActiveScrollableTarget = null;
$(this.avatar).remove();
}
});
return new DnDManager();
});
//# sourceMappingURL=DnDManager.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI
* (C) Copyright IBM Corp. 2014, 2016
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule
* Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/utils/EventHelper',['jquery', './BidiUtil', './dnd/DnDManager', 'underscore', 'hammerjs', 'jquery.hammer'], function ($, BidiUtil, DnDManager, _, hammer) {
// Setup jquery to create a hammer instance when we use hammer events.
var hammerGestures = [];
for (var name in hammer.gestures) {
if (hammer.gestures.hasOwnProperty(name)) {
hammerGestures.push(hammer.gestures[name].name);
}
}
var hammerDefaultOptions = {
'prevent_mouseevents': true,
'stop_browser_behavior': false
};
$.each(hammerGestures, function (index, name) {
$.event.special[name] = {
setup: function setup() {
var $el = $(this);
var inst = $el.data('hammer');
if (!inst) {
// create hammer instance with default values
$el.hammer(hammerDefaultOptions);
}
}
};
});
/**
* A jQuery function that can be used to attach the onClick event handler. This function will also attach the touch events required for touch devices to avoid the delay caused by simulated mouse
* events
*/
$.fn.onClick = function (handler) {
this.on('click', function (e) {
handler(e);
}).on('tap', function (e) {
handler(e);
// prevent the simulated clicks on touch devices
e.gesture.preventDefault();
});
return this;
};
// Get the box style to be applied to the inline editor
var getInlineEditBoxStyles = function getInlineEditBoxStyles($text, options) {
var cssProps = ['padding-top', 'padding-right', 'padding-bottom', 'padding-left', 'margin-top', 'margin-right', 'margin-bottom', 'margin-left', 'border-bottom-color', 'border-bottom-style', 'border-bottom-width', 'border-top-color', 'border-top-style', 'border-top-width', 'border-right-color', 'border-right-style', 'border-right-width', 'border-left-color', 'border-left-style', 'border-left-width', 'position', 'top', 'right', 'left', 'bottom', 'height', 'width', 'min-height', 'min-width', 'max-height', 'max-width'];
var cssValues = $text.css(cssProps);
// We don't want to set a zero height and width
if (cssValues.height === '0px') {
delete cssValues.height;
}
if (cssValues.width === '0px') {
delete cssValues.width;
}
// Set the maximum width to strech with the parent
if (options && options.maxSizeNode) {
var $node = $(options.maxSizeNode);
var width = options.maxSizeNode.style.width;
if (width) {
cssValues['max-width'] = '100%';
delete cssValues.width;
} else {
cssValues['max-width'] = $node.width() + 'px';
}
}
return cssValues;
};
// Get the css styles to be applied to the inline editor input element
var getInlineEditStyles = function getInlineEditStyles($text) {
var textCss = {
width: '0px',
'min-width': $text.css('fontSize')
};
// Get the text alignment and apply it to the text input
var textAlignment = $text.css('text-align');
if (textAlignment === 'center') {
textCss['margin'] = '0px auto';
} else if (textAlignment === 'right') {
textCss['margin'] = '0px 0px 0px auto';
}
return textCss;
};
// Get the text css style to be applied to the inline editor
var getInlineEditTextStyles = function getInlineEditTextStyles($text) {
return $text.css(['fontSize', 'fontFamily', 'fontWeight', 'letterSpacing', 'color']);
};
var _addInlineEditHandlers = function _addInlineEditHandlers($text, fCallback, options) {
var $inlineEdit = $text._$inlineEdit;
$text._updateWidth = function () {
if ($inlineEdit) {
var value = $inlineEdit.val() || '';
if (value !== $inlineEdit._hidden.text()) {
$inlineEdit._hidden.text(value);
$inlineEdit.width($inlineEdit._hidden.width() + 2);
}
}
};
$text._inlineEditChangedFn = function () {
var sText = $inlineEdit.val().trim();
if (sText.length === 0 && options.noEmptyText) {
sText = $text._previousInlineText;
}
$inlineEdit.removeClass('inlineText').off('keypress').off('keydown').off('blur');
var invokeCallback = false;
if ($text._previousInlineText !== sText) {
invokeCallback = true;
}
$text._previousInlineText = null;
$inlineEdit._hidden.remove();
$inlineEdit._hidden = null;
$inlineEdit.off();
$inlineEdit.hide();
$inlineEdit.parent().remove();
$inlineEdit = null;
$text._$inlineEdit = null;
$text.text(sText);
$text.removeClass('inEditMode');
$text.show().focus();
if (invokeCallback) {
fCallback(sText);
}
var onEditEnd = options && options.onEditEnd;
if (onEditEnd) {
onEditEnd();
}
}.bind($text);
var sText = $text.text();
$text._previousInlineText = sText; // keep a back up of the current string
if (!$inlineEdit) {
$text.addClass('inEditMode');
// Create a container node that will inherit the text container properties
// like margin, padding, border and position
var $inlineEditContainer = $('
\n';});
define('text!baglass/core-client/js/core-client/utils/templates/webfont.html',[],function () { return '';});
define('text!baglass/core-client/js/core-client/utils/templates/image.html',[],function () { return '';});
define('text!baglass/core-client/js/core-client/utils/templates/svg.html',[],function () { return '\n';});
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI
* (C) Copyright IBM Corp. 2015, 2019
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/utils/BrowserUtils',[], function () {
return {
isBrowser: {
ie: function ie() {
return this.isIE();
},
ieEdge: function ieEdge() {
return this.isIEEdge();
},
ie11: function ie11() {
return this.isIE11();
},
ff: function ff() {
return this.isFirefox();
},
chrome: function chrome() {
return this.isChrome();
},
safari: function safari() {
return this.isSafari();
},
iPad: function iPad() {
return this.isIPad();
}
},
isIE: function isIE() {
return (/\b(MSIE|Trident|Edge)\b/.test(this._getUserAgent())
);
},
isIE11: function isIE11() {
return (/Trident\/7\./.test(this._getUserAgent())
);
},
isIEEdge: function isIEEdge() {
return (/Edge/.test(this._getUserAgent())
);
},
isFirefox: function isFirefox() {
return (/.*Firefox.*/i.test(this._getUserAgent())
);
},
isChrome: function isChrome() {
return (/chrome/i.test(this._getUserAgent()) && !this.isIE()
);
},
isSafari: function isSafari() {
return (/^((?!chrome|android|crios|fxios).)*safari/i.test(this._getUserAgent()) && !this.isChrome() && !this.isIE() && !this.isIPad()
);
},
isIPad: function isIPad() {
return (/iPad/i.test(this._getUserAgent())
);
},
_getUserAgent: function _getUserAgent() {
return navigator.userAgent;
}
};
});
//# sourceMappingURL=BrowserUtils.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI
* (C) Copyright IBM Corp. 2015, 2021
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/utils/LegacyUtils',['jquery', 'underscore', './BrowserUtils'], function ($, _, BrowserUtils) {
return {
/**
* Launch a legacy Cognos application in a separate tab
*/
legacyLaunch: function legacyLaunch(glassContext, tool, object) {
this._openLegacyWindow(this._getLaunchParms(glassContext, tool, object));
},
/**
* Get the URL to launch a legacy Cognos application
*/
getLegacyLaunchUrl: function getLegacyLaunchUrl(glassContext, tool, object, action) {
return this._getUrl(this._getLaunchParms(glassContext, tool, object, action));
},
_getLaunchParms: function _getLaunchParms(glassContext, tool, object, action) {
var app = this.legacyApps[tool] || tool;
if (!_.isUndefined(app) && !_.isUndefined(app.launchParams)) {
return app.launchParams;
} else {
return {
'b_action': 'xts.run',
'm': 'portal/launch.xts',
'ui.gateway': glassContext.gateway + '/v1/disp',
'ui.tool': tool,
'ui.object': object,
'ui.action': action || 'new',
'launch.launchinWindow': 'true',
'backURL': 'disp?b_action=xts.run&m=portal/close.xts'
};
}
},
/*
* Based on the user's capabilities and browser vendor,
* determines whether the supplied tool can be used.
* @See LegacyUtils.legacyApps for supported tool types.
* @returns A boolean indicating whether the supplied tool can be used.
*/
canUseLegacyTool: function canUseLegacyTool(glassContext, tool) {
var toolInfo = this.legacyApps[tool] || tool;
if (!_.isUndefined(toolInfo)) {
var hasCapability = glassContext.hasCapability(toolInfo.capability);
if (hasCapability) {
var browsers = toolInfo.browsers;
if (!_.isUndefined(browsers)) {
for (var i = 0; i < browsers.length; i++) {
var isBrowserFunc = BrowserUtils.isBrowser[browsers[i]];
if (isBrowserFunc.call(BrowserUtils)) {
return true;
}
}
} else {
return true;
}
}
}
return false;
},
legacyApps: {
DashboardConsole: {
icon: 'common-workspace',
capability: 'canUseDashboardViewer',
browsers: ['ie', 'ff', 'chrome', 'safari']
},
QueryStudio: {
icon: 'common-query',
capability: 'canUseQueryStudio',
browsers: ['ie', 'ff']
},
AnalysisStudio: {
icon: 'common-analysis_studio',
capability: 'canUseAnalysisStudio',
browsers: ['ie', 'ff']
},
DrillThrough: {
icon: 'common-drill_through_definition',
capability: 'canUseDrillThroughAssistant',
launchParams: {
'b_action': 'xts.run',
'm': 'portal/cc_drillthrough.xts'
}
},
EventStudio: {
icon: 'common-agent',
capability: 'canUseEventStudio',
browsers: ['ie', 'ff', 'chrome']
},
Subscriptions: {
capability: 'DO_NOT_SHOW_IN_COMPANION_APPS',
launchParams: {
'b_action': 'xts.run',
'm': 'portal/subscriptions/subscriptions.xts'
}
},
MetricsManager: {
icon: 'common-metrics',
capability: 'canUseMetricStudio',
apps: {
MetricStudio: {
icon: 'common-metrics',
capability: 'canUseMetricStudio',
handler: function handler(evt) {
this._launchLegacyWindow(evt);
},
browsers: ['ie', 'ff']
},
metricsFileImportTask: {
icon: 'common-metricsImport',
capability: 'canUseMetricsManagerAdministration'
},
metricsMaintenanceTask: {
icon: 'common-metricsMaintenance',
capability: 'canUseMetricsManagerAdministration'
},
metricsExportTask: {
icon: 'common-metricsExport',
capability: 'canUseMetricsManagerAdministration'
},
metricsPackage: {
icon: 'common-metricsNewPackage',
capability: 'canUseMetricsManagerAdministration',
handler: function handler() {
var queryParams = {
'b_action': 'mms.run',
'pid': 'new_mpwizard_start'
};
this._openLegacyWindow(queryParams);
}
}
},
handler: function handler(evt) {
var queryParams = {
'b_action': 'xts.run',
'm': 'portal/newMetricsTasks/processNewTasks.xts',
'so.select': 'newmetricstaskspackage',
'so.return.m': 'portal/new_general.xts',
'm_new_class': evt.type
};
this._openLegacyWindow(queryParams);
}
},
PowerplayStudio: {
icon: 'common-powerPlayCube',
capability: 'canUsePowerPlay',
browsers: ['ie', 'ff', 'chrome', 'safari']
},
Controller: {
icon: 'common-controller',
capability: 'canUseControllerStudio',
browsers: ['ie']
},
Contributor: {
icon: 'common-planning',
capability: 'canUsePlanningContributor'
}
},
_openLegacyWindow: function _openLegacyWindow(queryParms) {
this._openWindow(this._getUrl(queryParms));
},
_openWindow: function _openWindow(url) {
window.open(url);
},
_launchLegacyWindow: function _launchLegacyWindow(evt) {
this.legacyLaunch(evt.glassContext, evt.type);
},
_getUrl: function _getUrl(queryParms) {
return 'v1/disp?' + $.param(queryParms, true);
}
};
});
//# sourceMappingURL=LegacyUtils.js.map
;
/**
* Licensed Materials - Property of IBM
*
* IBM Cognos Products: BI
*
* Copyright IBM Corp. 2015
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/nls/CommonsResources',{
"root": true,
"cs": true,
"da": true,
"de": true,
"es": true,
"fi": true,
"fr": true,
"hr": true,
"hu": true,
"it": true,
"ja": true,
"kk": true,
"ko": true,
"no": true,
"nb": true,
"nl": true,
"pl": true,
"pt": true,
"pt-br": true,
"ro": true,
"ru": true,
"sl": true,
"sv": true,
"th": true,
"tr": true,
"zh": true,
"zh-cn": true,
"zh-tw": true
});
//# sourceMappingURL=CommonsResources.js.map
;
/**
* Licensed Materials - Property of IBM
*
* IBM Cognos Products: BI Glass
*
* Copyright IBM Corp. 2018
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/nls/root/CommonsResources',{
"save": "Save",
"saveAs": "Save as",
"saveAsLabel": "Save as:",
"teamFolders": "Team Folders",
"open": "Open",
"openDialogTitle": "Open file",
"openDialogFooter": "Open and cancel button",
"saveDialogTitle": "Save as",
"saveDialogFooter": "Save and cancel button",
"shareDialogTitle": "Share",
"shareDialogCodeLabel": "Share URL",
"shareDialogText": "Copy this link to share this content with other users.",
"embedDialogTitle": "Embed",
"embedDialogCodeLabel": "Embed code",
"embedDialogText": "Copy this code to embed.",
"embedURLWidthLabel": "Width:",
"embedURLHeightLabel": "Height:",
"embedURLWidth": "Width",
"embedURLHeight": "Height",
"filesToOpen": "Files to open:",
"remove": "Remove",
"loading": "Loading",
"ok": "OK",
"cancel": "Cancel",
"close": "Close",
"datasetLoading": "Your data set %{name} is loading...",
"datasetFinishedLoading": "Your data set %{name} loaded successfully.",
"datasetLoadingFailed": "Your data set %{name} did not load.",
"datasetLoadingCancelled": "The loading of your data set %{name} was cancelled.",
"datasetRefreshing": "Your data set %{name} is refreshing...",
"datasetFinishedRefreshing": "Your data set %{name} refreshed successfully.",
"datasetRefreshFailed": "Your data set %{name} did not refresh.",
"datasetRefreshCancelled": "The refreshing of your data set %{name} was cancelled.",
"userID": "User ID",
"password": "Password",
"signOnMessage": "Please provide your credentials to use this data",
"rememberCre": "Remember my credentials",
"signOnDialogFooter": "Submit and cancel button",
"signOnTitle": "Credentials required: %{dataSource}",
"errMessage": "The credentials are missing or invalid.\n Please type your credentials for authentication.",
"submit": "Submit",
"datepicker_input_describedby": "Type a date in the format YYYY dash MM dash DD.",
"schedule_datepicker_label": "Date",
"schedule_datepicker_description": "Date Picker",
"time_picker_label": "Time",
"bs_timepicker_container": "Time picker widget",
"bs_timepicker_input_description": "Time picker",
"bs_timepicker_input_describedby": "Type a time in the format HH colon MM AM or PM.",
"bs_timepicker_hour_text": "Hour",
"bs_timepicker_minute_text": "Minute",
"bs_timepicker_meridian_text": "Meridian",
"bs_timepicker_increment_hour": "Increment hour",
"bs_timepicker_decrement_hour": "Decrement hour",
"bs_timepicker_increment_minute": "Increment minute",
"bs_timepicker_decrememt_minute": "Decrement minute",
"bs_timepicker_toggle_meridian": "Toggle meridian",
"unknown": "Unknown",
"EllapsedTimeDays": "%{days}d %{hours}h %{minutes}m %{seconds}s",
"EllapsedTimeHours": "%{hours}h %{minutes}m %{seconds}s",
"EllapsedTimeMinutes": "%{minutes}m %{seconds}s",
"EllapsedTimeSeconds": "%{seconds}s",
"confirmRefreshUpload": "Confirm replacement of existing data",
"msgConfirmRefreshUpload": "The file '%{fileName}' already exists. Do you want to replace its data with the data contained in the selected file?",
"promptDialogTitle": "Prompt",
"promptControlTitle": "Specify the prompt values for %{paramLabel}",
"copyText": "Copy",
"copySuccess": "Copied to Clipboard successfully",
"copyFail": "Copy to Clipboard failed",
"clear": "Clear",
"invert": "Invert",
"numSelected": "%{number} of %{total} selected",
"search_box_default_text": "Find",
"title": "Title",
"back": "Back",
"edit": "Edit",
"invalidInput": "Invalid input",
"owner": "Owner",
"createdWithColon": "Created:",
"modifiedWithColon": "Modified:",
"typeWithColon": "Type:",
"dataRefWithColon": "Data refreshed:",
"defaultSlideoutLabel": "Slideout",
"invalidNumber": "The value entered is not a number. Type a number.",
"exceedMaxLength": "The text is too long. Shorten to %{maxLength} characters.",
"invalidEmailMessage": "Email address is not valid.",
"numberOutOfRange": "The value entered must be a number between %{min} and %{max}",
"numberTooSmall": "The value entered must be a number greater than %{min}",
"numberTooBig": "The value entered must be a number less than %{max}",
"defaultCompleteMessage": "Operation completed.",
"defaultProgressMessage": "Operation in progress...",
"defaultFailMessage": "Operation failed.",
"defaultIndefiniteMessage": "Operation in progress...",
"defaultPauseMessage": "Operation paused.",
"progressHideBtn": "Hide",
"paginationControl": "Open Collapsed Slideout(s)",
"confirmCancelMessage": "Do you want to discard your changes?",
"confirmCancel": "Confirm cancel",
"pinSlideout": "pin",
"unpinSlideout": "Unpin",
"details": "Details",
"edit_palette": "Edit",
"duplicate_palette": "Duplicate",
"reverse_palette": "Reverse",
"delete_palette": "Delete ",
"palette_copy": "%{paletteName} copy",
"showMoreColors": "More",
"showLessColors": "Less",
"addCustomColor": "Select custom color",
"createPalette": "Create a custom palette",
"moreActionsForPalette": "More actions for %{paletteName}",
"showMoreColorPalette": "More"
});
/**
* Licensed Materials - Property of IBM
*
* IBM Cognos Products: BI
*
* Copyright IBM Corp. 2015, 2016
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/nls/StringResources',['i18n!./CommonsResources', '../utils/Lexicon'], function (CommonsResources, Lexicon) {
var lexicon = new Lexicon({
data: CommonsResources,
allowMissing: true,
verbose: false
});
return {
/**
* Get the string resource for the given key and interpolation options
*
* @param key The key of the string to return
* @param interpolationOptions Optional interpolation options (see poly.t documentation for details)
* @returns The string to display
*/
get: function get(key, interpolationOptions) {
var translated = lexicon.translate(key, interpolationOptions);
if (translated !== key) {
return translated;
}
return Lexicon.NOT_TRANSLATED + '(' + key + ')';
}
};
});
//# sourceMappingURL=StringResources.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI UI_Commons
* (C) Copyright IBM Corp. 2015, 2018
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/utils/Utils',['jquery', 'underscore', 'doT', 'text!../ui/template/LoadingWaitAnimation1.html', 'text!../ui/template/LoadingWaitAnimation2.html', 'text!../ui/template/MediumSpinner.html', 'text!./templates/webfont.html', 'text!./templates/image.html', 'text!./templates/svg.html', './LegacyUtils', '../nls/StringResources', './BrowserUtils'], function ($, _, doT, animation1, animation2, MediumSpinner, webfontTemplate, imageTemplate, svgTemplate, LegacyUtils, StringResources, BrowserUtils) {
/**
* The patterns we will use to match the icon field beign passed in.
*/
var matchPatterns = {
WFG: 'wfg',
WFT: 'wft',
WFBI: 'wfbi'
};
var imageIcons = {
PNG: '.png',
JPEG: '.jpeg',
JPG: '.jpg',
GIF: '.gif',
SVG: '.svg'
};
return {
ALERT_ID: 'com-ibm-ca-alert',
/** Sets the attribute only if value is defined.
*/
setAttr: function setAttr($plugin, sAttr, sValue) {
if (sValue) {
$plugin.attr(sAttr, sValue);
}
},
/** Adds the sClassname if it's defined to the element.
*
*/
addClass: function addClass($plugin, className) {
if (className) {
$plugin.addClass(className);
}
},
_embed: function _embed(svg) {
$('use', svg).each(function (i, use) {
var href = use.getAttribute('xlink:href') || use.getAttribute('href');
var useElement = $(href)[0];
if (useElement) {
var title = $('title', use)[0];
var viewBox = !svg.getAttribute('viewBox') && useElement.getAttribute('viewBox');
var newSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
$.each(use.attributes, function (index, attr) {
newSvg.setAttribute(attr.name, attr.value);
});
// conditionally set the viewBox on the SVG
if (viewBox) {
newSvg.setAttribute('viewBox', viewBox);
}
var clone = useElement.cloneNode(true);
while (clone.firstChild) {
if (clone.firstChild.tagName === 'title') {
clone.removeChild(clone.firstChild);
} else {
newSvg.appendChild(clone.firstChild);
}
}
var useParent = use.parentNode;
useParent.appendChild(newSvg);
if (title) {
useParent.appendChild(title);
}
useParent.removeChild(use);
}
});
},
/** Embed the SVG use icon in the SVG itself.
* @param parent of the SVG, can be a jQuery object or not.
*/
embedSVGIcon: function embedSVGIcon(parent) {
if (!BrowserUtils.isIE()) {
return parent;
}
var $svg = $('svg', parent);
if (!$svg.length) {
$svg = $(parent).filter('svg');
}
if ($svg.length) {
$svg.each(function (i, svg) {
this._embed(svg);
}.bind(this));
}
return parent;
},
/** Prepends an image to the specified jQuery $widget
* @public
* @param $widget either a jQuery in which to prepend the image/icon
* @param icon the icon to insert. Can be a web font, an image URL or an svg sprite reference
* @param iconTooltip the tooltip to use for this icon, if specified
* @param ariaLabel The value to use for aria-label or alt attributes. If not specified, defaults to iconTooltip
* @param right boolean. default is false. Set to true if the icon should be appended after the inner html.
* @param iconColor color of the icon to be used
*/
setIcon: function setIcon($widget, icon, iconTooltip, ariaLabel, right, iconColor) {
if (icon) {
if (!_.isBoolean(right)) {
right = false;
}
var label = ariaLabel ? ariaLabel : iconTooltip;
var template;
var svg = false;
if (this._isWebFont(icon)) {
template = doT.template(webfontTemplate);
} else if (this._isImageIcon(icon)) {
template = doT.template(imageTemplate);
} else {
svg = true;
template = doT.template(svgTemplate);
}
var html = template({
icon: icon,
tooltip: iconTooltip,
label: label,
color: iconColor,
fill: iconColor
});
var $html = $(html);
if (svg) {
this.embedSVGIcon($html);
}
if (right) {
$widget.append($html);
} else {
$widget.prepend($html);
}
}
},
/**
* Show a loading animation to handle long operation; If the large format is shown,
* an Aria alert element is inserted in the DOM for screen readers
* @param {Number} type of loading icon; 1 is small; anything else or undefined is large
* @returns A html object of the loading animation.
*/
getLoadingAnimation: function getLoadingAnimation(number) {
var $loadingIcon;
var html;
var options = {
loadingBarLabel: StringResources.get('loading')
};
if (number === 1) {
html = doT.template(animation1);
} else {
html = doT.template(animation2);
this.activateAriaAlert(options.loadingBarLabel);
}
$loadingIcon = $(html(options));
$loadingIcon.attr('aria-label', StringResources.get('loading'));
return $loadingIcon[0];
},
/**
* Show a loading Spinner animation to handle long operation.
* @return a html object of the Spinner animation.
*/
getSpinner: function getSpinner() {
var options = {
loadingBarLabel: StringResources.get('loading')
};
var html = doT.template(MediumSpinner);
var $loadingIcon = $(html(options));
$loadingIcon.attr('aria-label', StringResources.get('loading'));
return $loadingIcon[0];
},
/**
* Inserts or removes & adds an alert element at the DOM body level to be read by screen reader.
* @param {String} Message to be read by screen reader
*/
activateAriaAlert: function activateAriaAlert(sMessage) {
if (!sMessage || !sMessage.length) {
return;
}
var $divElem = $('#' + this.ALERT_ID);
if ($divElem.length) {
$divElem.remove();
}
$divElem = $('
', {
'id': this.ALERT_ID,
'style': 'position:absolute; top:-9000px;',
'role': 'alert',
'aria-live': 'assertive'
});
$divElem.text(sMessage);
$('body').append($divElem);
setTimeout(function () {
$divElem.remove();
}.bind(this), 100);
},
/**
* Closes the currently open dialog. Assumes the dialog has a cancel button.
* @public
*/
closeDialog: function closeDialog() {
$('.dialogBlocker').find('#cancel').trigger('primaryaction');
},
_isWebFont: function _isWebFont(icon) {
if (icon) {
for (var i in matchPatterns) {
var pattern = matchPatterns[i];
var regEx = new RegExp('^' + pattern, 'g');
if (icon.search(regEx) !== -1) {
return true;
}
}
}
return false;
},
_isImageIcon: function _isImageIcon(icon) {
if (icon) {
for (var i in imageIcons) {
var pattern = imageIcons[i];
var regEx = new RegExp(pattern, 'g');
if (icon.search(regEx) !== -1) {
return true;
}
}
}
return false;
},
/**
* Launch a legacy Cognos application in a separate tab
* @Deprected. See LegacyUtils.legacyLaunch
*/
legacyLaunch: function legacyLaunch(glassContext, tool, object, folder) {
return LegacyUtils.legacyLaunch(glassContext, tool, object, folder);
},
/**
* @public
* @property {String} EVENT_DIALOG - event property name.
*/
EVENT_DIALOG: 'eventDialog',
/**
* @public
* Sets the event property.
*
* @param {Object} event - The JQuery event object.
* @param {String} propertyName - The property name to associate with the event.
* @param {Object} propertyValue - The value of the property.
*
*/
setEventProperty: function setEventProperty(event, propertyName, propertyValue) {
var srcEvent = this._getSourceEvent(event);
srcEvent[propertyName] = propertyValue;
},
/**
* @public
* Gets the event property.
*
* @param {Object} event - The JQuery event object.
* @param {String} propertyName - The property name to associate with the event.
* @return {boolean} true if it is, false otherwise
*/
getEventProperty: function getEventProperty(event, propertyName) {
var srcEvent = this._getSourceEvent(event);
return srcEvent[propertyName] && srcEvent[propertyName] === true;
},
_getSourceEvent: function _getSourceEvent(event) {
var srcEvent;
if (event.gesture) {
srcEvent = event.gesture.srcEvent;
} else if (event.originalEvent) {
srcEvent = event.originalEvent;
} else {
srcEvent = event;
}
return srcEvent;
},
isIpad: function isIpad() {
if (navigator.userAgent.match(/iPad/i) !== null) {
$('body').addClass('mobile');
return true;
}
return false;
},
/**
* @public
* Determines if the functional control key is pressed. For windows, this will
* simply return true or false if crtl is pressed. For the Mac environment
* this will return true or false if the command key is pressed. This is
* because the crtl key maps to the command on a Mac. The
* control key on a Mac does not provide the functionality that it does
* in other environments (this is by Apple convention). The control key
* in the Mac environment normally acts as though it were a "right-click", rather than
* a secondary function key.
*
* @param {object} evt - a browser event object
* @return {boolean} true if command key for Mac is pressed, or control key on other platforms. False otherwise
*/
isControlKey: function isControlKey(evt) {
var agentRegEx = /Macintosh/;
if (agentRegEx.test(this._getBrowserUserAgent())) {
return evt.metaKey;
}
return evt.ctrlKey;
},
_getBrowserUserAgent: function _getBrowserUserAgent() {
return navigator.userAgent;
},
/**
* @description Detect if a given window is in an iframe.
* @param {Object} currentWindow (optional) - A window. If not provided, the current window will be used.
* @returns {Boolean} true if window is in an iframe; false otherwise.
*/
isInIframe: function isInIframe(currentWindow) {
try {
currentWindow = currentWindow || window;
return currentWindow.self !== currentWindow.top;
} catch (e) {
// Cross-domain iframe will throw security acception when
// attempting to access window.top.
return true;
}
},
/**
Returns a formated duration string
**/
formatDuration: function formatDuration(milliseconds) {
if (!milliseconds || isNaN(milliseconds)) {
return StringResources.get('unknown');
}
var seconds = Math.floor(milliseconds / 1000);
var minutes = Math.floor(seconds / 60);
var hours = Math.floor(minutes / 60);
var days = Math.floor(hours / 24);
seconds = seconds % 60;
minutes = minutes % 60;
hours = hours % 24;
if (days > 0) {
return StringResources.get('EllapsedTimeDays', {
'days': days,
'hours': hours,
'minutes': minutes,
'seconds': seconds
});
} else if (hours > 0) {
return StringResources.get('EllapsedTimeHours', {
'hours': hours,
'minutes': minutes,
'seconds': seconds
});
} else if (minutes > 0) {
return StringResources.get('EllapsedTimeMinutes', {
'minutes': minutes,
'seconds': seconds
});
} else {
return StringResources.get('EllapsedTimeSeconds', {
'seconds': seconds
});
}
},
/** Converts a rgb string to an hex representation of the color
* @param rgb rgb string
*/
rgbToHex: function rgbToHex(rgb) {
rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
return rgb && rgb.length === 4 ? '#' + ('0' + parseInt(rgb[1], 10).toString(16)).slice(-2) + ('0' + parseInt(rgb[2], 10).toString(16)).slice(-2) + ('0' + parseInt(rgb[3], 10).toString(16)).slice(-2) : '';
},
createTemporaryContainer: function createTemporaryContainer() {
var container = $(document.body).find('.reactTemporaryContainer');
if (container.length === 0) {
container = $('
');
$(document.body).append(container);
}
return container.get(0);
},
removeTemporaryContainer: function removeTemporaryContainer() {
$(document.body).find('.reactTemporaryContainer').remove();
},
reactRender: function reactRender(element, container) {
return new Promise(function (resolve, reject) {
require(['react-dom'], function (ReactDOM) {
try {
ReactDOM.render(element, container, resolve);
} catch (error) {
reject(error);
}
}, reject);
});
},
is24HrFormat: function is24HrFormat() {
throw new Error('This function has been removed; Use core-client/utils/DateTimeUtils.is24HrFormat');
},
/**
* @return the current Browser window object
*/
getCurrentWindow: function getCurrentWindow() {
return window;
},
createPerformanceMark: function createPerformanceMark() {
throw new Error('This function has been removed; Use core-client/utils/PerfUtils.createPerformanceMark');
},
clearPerformanceMark: function clearPerformanceMark() {
throw new Error('This function has been removed; Use core-client/utils/PerfUtils.clearPerformanceMark');
},
/**
* @public
* Traverse a JavaScript object and call matchCallback on each defined elements.
* @returns found object
*
* @param {object} obj JavaScript object to be traversed
* @param {function} matchCallback function which should return true when the element is matched
* @example
* utils.traverse([{id: 4}, {id: 5}], function(obj) {
return obj.id === 4;
});
*/
traverse: function traverse(obj, matchCallback) {
var queue = [obj];
while (queue.length) {
var current = queue.shift();
if (current && matchCallback(current)) {
return current;
}
if (_.isObject(current) || _.isArray(current)) {
queue = queue.concat(_.values(current));
}
}
}
};
});
//# sourceMappingURL=Utils.js.map
;
/**
* Licensed Materials - Property of IBM
*
* IBM Cognos Products: BI
*
* Copyright IBM Corp. 2015, 2017
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/ui/ToastMessage',['./core/Class', 'underscore', 'jquery', 'toastr', '../utils/Utils', '../nls/StringResources', 'jquery-ui'], function (Class, _, $, toastr, utils, stringResources) {
var ToastMessage = Class.extend(
/**
* @lends ToastMessage.prototype
*/
{
TIMEOUT: 3000,
MAX_TOAST: 5,
currentOptions: {},
/**
* @classdesc Class that allows you to create a toast message under the nav-bar. There is 4 type of toast :
* 1.'success' to specify a positive message that a certain action was successfuly completed. (Default toast)
* 2.'error' to specify an error after a certain action
* 3.'warning' to warn the user.
* 4.'info' to inform the user.
* @constructs
* @public
* @param {Object} [options] Options to override the behaviour of the toast.
* @param {String} [options.showMethod] : How the toast will show up (show, fadeIn, slideDown)
* @param {String} [options.hideMethod] : How the toast will hide (hide, fadeOut,slideUp)
* @param {String} [options.type] : Type of the toast (success, error, info, warning)
* @param {String} [options.btnLabel] : Give a label to the close button
* @param {Function} [options.callback] : Override the default callback for close button
* @param {Function} [options.onHidden] : Override the default callback when the toast is hidden
* @param {Function} [options.onShown] : Override the default callback when the toast is shown
* @param {Boolean} [options.preventDuplicates] : When true, it prevents a same toast from appearing twice
* @param {Number} [options.timeOut] : Optional value for custom timeout for the toast dismissal
* @returns An object with the options of the toast.
*
* @example : var toast = new ToastMessage({'type':'warning', 'btnLabel':'OK', 'callback':function(){console.log('worked');}});
*/
defaultOptions: {
'closeButton': true,
'newestOnTop': false,
'tapToDismiss': false,
'positionClass': 'toast-top-center',
'showDuration': '500',
'hideDuration': '500',
'showEasing': 'swing',
'hideEasing': 'linear',
'showMethod': 'slideDown',
'hideMethod': 'slideUp',
'type': 'success',
iconClasses: {
error: 'toast-error',
info: 'toast-info',
success: 'toast-success',
warning: 'toast-warning'
},
'secondaryLabel': stringResources.get('details')
},
init: function init(options) {
this.toastrOptions = {};
$.extend(true, this.toastrOptions, this.defaultOptions, options);
this.toastrOptions.timeOut = this.toastrOptions.timeOut || 0;
this.toastrOptions.extendedTimeOut = 0;
ToastMessage.inherited('init', this, arguments);
},
render: function render(message) {
var timestamp = $.now();
var msgId = 'toast-message' + timestamp;
var iconId = 'toast-icon' + timestamp;
if (_.isUndefined(toastr.options.type)) {
toastr.options.type = 'success';
}
var iconLabel = stringResources.get(toastr.options.type);
if (toastr.options.btnLabel) {
var $btn = $('', {
'aria-label': toastr.options.btnLabel,
'title': toastr.options.btnLabel,
'class': 'toast-close-label',
'type': 'button',
'role': 'button',
'tabIndex': '0'
});
$btn.text(toastr.options.btnLabel);
toastr.options.closeHtml = $btn[0];
} else {
var lblClose = stringResources.get('close');
var $temp = $('', {
'role': 'button',
'aria-label': lblClose,
'title': lblClose,
'class': 'toast-close-div',
'tabIndex': '0'
});
utils.setIcon($temp, 'common-close_icon', lblClose);
toastr.options.closeHtml = $temp[0];
}
toastr.options.type = toastr.options.type.toLowerCase();
var toastIcon = 'common-success';
message = _.escape(message);
if (this._isMessageLarge(message)) {
_.each(toastr.options.iconClasses, function (value, key) {
toastr.options.iconClasses[key] = value.concat(' large');
});
}
var $el;
switch (toastr.options.type) {
case 'info':
toastr.options.timeOut = toastr.options.timeOut === 0 ? this.TIMEOUT : toastr.options.timeOut;
$el = toastr.info(message);
toastIcon = 'common-info-moreinfo';
break;
case 'warning':
toastr.options.timeOut = toastr.options.timeOut || 0;
$el = toastr.warning(message);
toastIcon = 'common-warning';
break;
case 'error':
toastr.options.timeOut = toastr.options.timeOut || 0;
$el = toastr.error(message);
toastIcon = 'common-error';
break;
default:
toastr.options.timeOut = toastr.options.timeOut === 0 ? this.TIMEOUT : toastr.options.timeOut;
$el = toastr.success(message);
}
if ($el) {
/*
* Remove applicable container aria attributes added by Toastr
* micro library which caused all visible toasts to be read again.
*/
$el.parent().removeAttr('role aria-live');
utils.activateAriaAlert(message);
$el.attr('aria-labelledby', iconId + ' ' + msgId);
$el.find('.toast-message').attr('id', msgId);
var $iconToast = $('', {
'class': 'toast-icon',
'id': iconId,
'aria-label': iconLabel
});
$el.append($iconToast);
utils.setIcon($iconToast, toastIcon, iconLabel);
if (_.isFunction(toastr.options.callback)) {
$el.find('.toast-close-button').on('primaryaction', toastr.options.callback);
}
$($el).unbind('mouseenter mouseleave');
var $closeBtn = $el.find('.toast-close-button');
this._addSecondaryButton($closeBtn);
$closeBtn.on('primaryaction', function (e) {
$closeBtn.off('primaryaction');
$closeBtn.trigger('click');
this.setNextTabFocus($el);
if (e) {
e.stopPropagation();
}
}.bind(this));
$el.on('click', function (e) {
if (e) {
e.stopPropagation();
}
}.bind(this));
this._limitToast();
}
return $el;
},
/**
* @classdesc Show the toast you created on the screen
* @constructs
* @public
* @param {String} [message] Message of the toast
* @returns a jquery object of the toast message
* @example toast.show('A message');
*/
show: function show(message) {
toastr.options = this.toastrOptions;
return this.render(message);
},
/** @protected */
setNextTabFocus: function setNextTabFocus($el) {
var $focusEl = $el.next('.toast').find('.toast-close-button').first();
if ($focusEl.length === 0) {
$focusEl = $el.prev('.toast').find('.toast-close-button').first();
}
if ($focusEl.length === 0) {
//No toasts remain. Since Toasts are the last tab order, set focus to first tab in the document
$(':tabbable:first').focus();
} else {
$focusEl.focus();
}
},
_limitToast: function _limitToast() {
var toastShown = $(document).find('#toast-container').children();
if (toastShown.length > this.MAX_TOAST) {
var removableToast = toastShown.length - this.MAX_TOAST;
for (var i = 0; i < removableToast; i++) {
if (!$(toastShown[i]).hasClass('toast-progress')) {
toastr.clear($(toastShown[i]));
}
}
}
},
_addSecondaryButton: function _addSecondaryButton($closeBtn) {
var _this = this;
if (this.toastrOptions.secondaryCallback) {
var secondaryButton = $('');
secondaryButton.click(function () {
_this.toastrOptions.secondaryCallback();
$closeBtn.trigger('primaryaction');
});
$closeBtn.after(secondaryButton);
}
},
_isMessageLarge: function _isMessageLarge(message) {
var result = false;
var $tempDiv = $('' + message + '');
$tempDiv.css('width', 200);
$tempDiv.css('height', 'auto');
$tempDiv.css('font-size', 15);
$tempDiv.css('font-family', 'HelvNeue Roman for IBM');
$tempDiv.css('word-wrap', 'break-word');
var $container = $('');
$container.css('width', 200);
$container.css('position', 'absolute');
$container.css('left', -500);
$container.append($tempDiv);
$('body').append($container);
result = $tempDiv.height() > 30;
$container.remove();
return result;
}
});
ToastMessage.remove = function () {
$('#toast-container').children(':not(.toast-progress)').remove();
};
return ToastMessage;
});
//# sourceMappingURL=ToastMessage.js.map
;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Glass
* (C) Copyright IBM Corp. 2018
* US Government Users Restricted Rights - Use, duplication or disclosure
* restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/utils/CloseViewUtils',['jquery', 'baglass/nls/StringResources'], function ($, StringResources) {
var CloseViewUtils = /*#__PURE__*/function () {
function CloseViewUtils() {
_classCallCheck(this, CloseViewUtils);
}
_createClass(CloseViewUtils, null, [{
key: "waitForCloseConfirmation",
value: function waitForCloseConfirmation(glassContext, options) {
return new Promise(function (resolve, reject) {
options = options || {};
var message = options.unsaveMessage || StringResources.get('unsavedViewMsg2');
var title = options.title || StringResources.get('unsavedViewMsg1');
var buttons = [{
defaultId: 'ok',
text: StringResources.get('unsavedViewMsg3')
}, 'cancel'];
glassContext.showMessage(message, title, 'info', buttons, undefined, function (event) {
if (event.btn === 'ok') {
resolve();
}
reject();
}).then(function () {
$('.dialogButton.secondary').focus();
});
});
}
}]);
return CloseViewUtils;
}();
return CloseViewUtils;
});
//# sourceMappingURL=CloseViewUtils.js.map
;
/**
* Licensed Materials - Property of IBM
*
* "Restricted Materials of IBM"
*
* 5746-SM2
*
* (C) Copyright IBM Corp. 2016
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/ui/AccessibleView',['jquery', 'underscore', './View'], function ($, _, View) {
var AccessibleView = View.extend({
/**
* @classdesc Base class supporting keyboard accessibility by allowing the view to set focus within it's content and keep track of the launch point of the view.
* @constructs
* @public
* @param {Object} options - set of initial properties
* @param {DOMElement} [options.launchPoint] - the DOM UI element from which the view was launched. If not provided by the invoker, the last active element is used.
* @param {Boolean} [options.enableTabLooping]- Set to true to allow tab looping within the view.
*/
init: function init(options) {
AccessibleView.inherited('init', this, arguments);
_.extend(this, options);
if (this.launchPoint === undefined || this.launchPoint === null) {
this._launchPoint = document.activeElement;
} else {
this._launchPoint = this.launchPoint;
delete this.launchPoint;
}
this.$entryHeader = $('');
this.$exitHeader = $('');
this.$el.append(this.$entryHeader);
this.$el.append(this.$exitHeader);
this.$entryHeader.on('focus', this._enterView.bind(this));
this.$exitHeader.on('focus', this._setFocusToLaunchPoint.bind(this));
},
/**
* Returns the launch point or the DOM element which invoked the current view. Implementing classes may override this method if there are special cases leading to
* different launch points.
* @public
* @returns {String|DOM element|JQuery Object} the launch point which can be a String representing a JQuery selector, DOM element or Jquery Object
*/
getLaunchPoint: function getLaunchPoint() {
return this._launchPoint;
},
setInnerContent: function setInnerContent($content) {
if ($content instanceof $) {
$content.insertAfter(this.$exitHeader);
}
},
_enterView: function _enterView() {
var tabbableEls = this.$el.find(':tabbable');
tabbableEls.eq(2).focus();
},
/**
* Sets the launch point
* @public
* @param {String|DOM element|JQuery Object} - the launch point which can be a String representing a JQuery selector, DOM element or Jquery Object
*/
setLaunchPoint: function setLaunchPoint(launchPoint) {
this._launchPoint = launchPoint;
},
/**
* Enables keyboard tab looping on a container.
* @public
* @param {JQuery Object} - the jquery UI object you want to enable the looping on.
*/
enableLooping: function enableLooping($container) {
if ($container instanceof $ && this.enableTabLooping === true && $container.next().hasClass('tabLoopFooter') === false) {
this.$loopFooter = $('');
this.$loopFooter.insertAfter($container);
this.$loopFooter.on('focus', this._tabToFirstElementInView.bind($container));
this.$loopHeader = $('');
this.$loopHeader.insertBefore($container);
this.$loopHeader.on('focus', this._tabToLastElementInView.bind($container));
}
},
/**
* @private
* Action handler to shift the focus to the launch point when the root DOM node of the view gets the focus.
*/
_setFocusToLaunchPoint: function _setFocusToLaunchPoint() {
if (this.getLaunchPoint() !== undefined && this.getLaunchPoint() !== null) {
$(this.getLaunchPoint()).focus();
}
},
_tabToFirstElementInView: function _tabToFirstElementInView() {
var firstTabbableElement = this.find(':tabbable').first();
if (firstTabbableElement !== undefined && firstTabbableElement !== null) {
firstTabbableElement.focus();
}
},
_tabToLastElementInView: function _tabToLastElementInView() {
var lastTabbableElement = this.find(':tabbable').last();
if (lastTabbableElement !== undefined && lastTabbableElement !== null) {
lastTabbableElement.focus();
}
},
/**
* @public
* Removes the root container for the View from the natural tab order. Does not work for the content of the view.
* The contributors are responsible for ensuring that the content they put in the view is also taken our of the natural tab order.
*/
removeContainerOnlyFromTabOrder: function removeContainerOnlyFromTabOrder() {
this.$entryHeader.removeAttr('tabIndex');
this.$exitHeader.removeAttr('tabIndex');
if (this.$loopFooter) {
this.$loopFooter.removeAttr('tabIndex');
}
if (this.$loopHeader) {
this.$loopHeader.removeAttr('tabIndex');
}
},
/**
* @public
* Adds the root container for the View to the natural tab order. Does not work for the content of the view.
* The contributors are responsible for ensuring that the content they put in the view is also put back in the natural tab order.
*/
enterContainerOnlyInTabOrder: function enterContainerOnlyInTabOrder() {
this.$entryHeader.attr('tabindex', '0');
this.$exitHeader.attr('tabindex', '0');
if (this.$loopFooter) {
this.$loopFooter.attr('tabIndex', '0');
}
if (this.$loopHeader) {
this.$loopHeader.attr('tabIndex', '0');
}
},
remove: function remove() {
AccessibleView.inherited('remove', this, arguments);
}
});
return AccessibleView;
});
//# sourceMappingURL=AccessibleView.js.map
;
define('baglass/core-client/js/core-client/utils/PerfUtils',['underscore'], function (_) {
return {
/**
* @public
* Create a performance entry in the browser's performance entry buffer.
*
* @param {string} options.component - component name, for example, glass
* @param {String} options.name - entry name, for example, openPerspective
* @param {String} options.state - state, for example, start or stop
*/
createPerformanceMark: function createPerformanceMark(options) {
if (!_.isUndefined(options)) {
var performance = this._getPerformance();
if (!_.isUndefined(performance) && _.isFunction(performance.mark)) {
performance.mark(options.component + '-' + options.name + '-' + options.state);
}
}
},
/**
* @public
* Clear a performance entry in the browser's performance entry buffer.
*
* @param {string} options.component
* @param {String} options.name
* @param {String} options.state
*/
clearPerformanceMark: function clearPerformanceMark(options) {
if (!_.isUndefined(options)) {
var performance = this._getPerformance();
if (!_.isUndefined(performance) && _.isFunction(performance.clearMarks)) {
performance.clearMarks(options.component + '-' + options.name + '-' + options.state);
}
}
},
_getPerformance: function _getPerformance() {
return performance;
}
};
});
//# sourceMappingURL=PerfUtils.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Glass
* Copyright IBM Corp. 2015, 2018
* US Government Users Restricted Rights - Use, duplication or disclosure
* restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/ui/Slideout',['./AccessibleView', 'jquery', 'underscore', '../utils/ClassFactory', '../utils/Utils', '../utils/PerfUtils', '../nls/StringResources', 'jquery-ui', 'touch-punch'], function (View, $, _, ClassFactory, Utils, PerfUtils, StringResources) {
/**
* This Class is the Glass Slider
*/
var Slideout = null;
/**
* Sets the id of the slideout
*/
function __setId() {
if (!_.isString(this.id)) {
this.id = this.content && _.isString(this.content.module) ? this.content.module : _.uniqueId('undefinedModule');
}
}
function __isTargetInSlideout(slideout, target) {
var targetInSlideout = false;
while (slideout !== null) {
targetInSlideout = targetInSlideout || $.contains(slideout.$el.get(0), target);
slideout = slideout.child;
}
return targetInSlideout;
}
function __isUniqueOption(hidingOptions, optionToCheck) {
return hidingOptions.every(function (hidingOption) {
return ['force', 'hideOnly', 'depth', 'isEscape'].some(function (prop) {
return hidingOption[prop] !== optionToCheck[prop];
});
});
}
/**
* We cancel the hide if any of the following conditions applies:
* jshint maxcomplexity:14
*/
function __shouldSlideoutHide(slideout, event, lastMouseDownEvent) {
// - The event target is a child of the slideout
if (__isTargetInSlideout(slideout, event.target)) {
return false;
}
// - The event target is not a part of the body. This is to avoid closing the slideout when updating the content in the maximized content apps view
if (!$.contains(document.body, event.target)) {
return false;
}
// - preventDefault has been called.
if (event.isDefaultPrevented()) {
return false;
}
// - The container is hidden
if (slideout.$el.closest('.tabhidden').length !== 0) {
return false;
}
// - The event is a dialog event
if (Utils.getEventProperty(event, Utils.EVENT_DIALOG)) {
return false;
}
// - The mouse down event was in the slideout. This avoids closing the slideout if we click inside the slideout and drag the mouse outside the slideout.
// For example, by selecting the resizable handle, and then release the mouse outside of the slideout.
if (lastMouseDownEvent !== null && __isTargetInSlideout(slideout, lastMouseDownEvent.target)) {
return false;
}
return true;
}
/**
* creates the hideHandler only for the parent
*/
function __createHideHandler() {
var lastMouseDownEvent = null;
if (this.parent === null) {
this.hideHandler = function (event) {
if (event.type === 'mousedown' || event.type === 'touchstart') {
lastMouseDownEvent = event;
} else {
if (__shouldSlideoutHide(this, event, lastMouseDownEvent)) {
this.hide({
hideOnly: this.hideOnly
});
}
lastMouseDownEvent = null;
}
}.bind(this);
}
}
/**
* Complete the hide operation
* Wire off the hide handler if necessary and trigger the hide event
*/
function __completeHide() {
if (this.hideHandler !== null && !this.hasOpenChild()) {
$(document).off(this.closeEventPattern, this.hideHandler);
}
this.$el.children('.ui-resizable-handle').hide();
this.trigger('hide');
}
function __addChild(child, options) {
var _this = this;
if (!this.addChildLocked) {
this.addChildLocked = true;
this.removeChild().then(function () {
_this.child = child;
if (options.overlay) {
_this.$el.css('z-index', '2999');
$(_this.$el.parents()[0]).append(_this.child.$el);
} else {
_this.$el.children('.pane-child').append(_this.child.$el);
}
_this.child.render();
_this.child.setContent(options.content);
return _this.child.show();
}).then(function () {
_this.addChildLocked = false;
});
}
}
/**
* @public
*/
Slideout = View.extend(
/**
* @lends Slideout.prototype
*/
{
_ClassFactory: ClassFactory,
/**
* delay after which the animation is considered complete
*/
ANIMATION_TIMEOUT: 500,
/**
* Default limit for the number of slideout being shown before the collapse bar appears
*/
DISPLAY_LIMIT: 3,
/**
* This value has to be exactly the same as the value in slideout.css line 177 - the width of the pagination pane
*/
PAGINATION_WIDTH: 36,
open: false,
events: {
'primaryaction .pane-pagination-control': 'pageBack',
'primaryaction .pin-icon': '_togglePin'
},
closeEventPattern: 'mousedown.slideout touchstart.slideout clicktap.slideout',
/**
* This type is used to provide info on how the slideout is shown
* @typedef DisplayInfo
* @type Object
* @property {Slideout} firstToCollapse - first slideout to collapse if required
* @property {Number} width - width of the displayed slideouts
* @property {Slideout[]} visible - Array of displayed slideouts
* @property {Number} firstDisplayedAfterCollapsed - expected to be null when there is no slideout to collapse
* @property {Slideout[]} collapsed - Arrays of slideouts to collapse
*/
/**
* @classdesc class allowing to open/show/hide/close a slider
* @constructs
* @public
* @param {Object} options - set of initial properties
* @param {String} options.position - The position of the slideout; Supported values: left and right
* @param {GlassContext} options.glassContext - The glassContext of the application
* @param {Number} options.width - The width for the slideout
* @param {Number} [options.displayLimit] - Number of slideouts being shown without being collapsed where there is enough space
* @param {function} [options.onHide] - callback invoked when the slideout.hide is invoked
* @param {Object} [options.pinning] - pinning properties
* @param {boolean} [options.pinning.isPinned=false] - slideout is pinned when true
* @param {boolean} [options.pinning.float=true] - no-float class is applied when false
* @param {boolean} [options.pinning.display=false or true if isPinned is true] - default pin is shown when true
* @param {Number} [options.collapseRootIndex=0] - index of the slideout which is to be the root of the collapse
* @param {Boolean} [options.hideOnly=undefined] - indicates if the slideout is to be hidden only. Only applicable for the parent/whole slideout
* @param {Boolean} [options.hideOnParentClick=true] - indicates if the slideout is to be hidden only when closing it using the clicktap event. Only applicable for the parent/whole slideout
* @param {String} [options.label=Slideout] - specifies the label that will be used for the slideout by assistive technologies.
* @param {Boolean} [options.enableTabLooping=undefined] - if true, enable tab looping within the slideout.
* @param {Boolean} [options.resizable=false] - if true or object, the slideout will have a resizable handle.
* @param {function} [options.onResize] - callback invoked during slideout resize
* @param {function} [options.onResizeStart] - callback invoked at the beginning of slideout resize
* @param {function} [options.onResizeStop] - callback invoked at the end of slideout resize
* @param {Boolean} [options.resizable.min=300] - The minimum width the slideout should be allowed to resize to.
* @param {Boolean} [options.resizable.max=1000] - The maximum width the slideout should be allowed to resize to.
* @example
* To create a left slideout:
* new Slideout({
* glassContext: this.glassContext,
* position: 'left'
* });
*
* To create a left pinned slideout without the shown pin:
* new Slideout({
* glassContext: this.glassContext,
* position: 'left',
* pinning: {
* isPinned: true,
* display: false
* }
* });
*
* */
init: function init(options) {
this.child = null;
this.open = false;
this.parent = null;
Slideout.inherited('init', this, arguments);
$.extend(this, options);
this.hideHandler = null;
this._showing = null;
this.hideOnParentClick = this.hideOnParentClick !== false;
this._root = this.parent === null ? this : this.parent._root;
this._index = this.parent === null ? 0 : this.parent._index + 1;
this.__initPinningSettings();
this.__initDisplaySettings();
__setId.call(this);
__createHideHandler.call(this, options);
this._childToAdd = [];
this._paginationLaunchPoint = null;
if (this.label === undefined || this.label === null) {
this.label = _.uniqueId(StringResources.get('defaultSlideoutLabel'));
}
},
/**
* initializes the pinning info
* When the slideout is marked as pinned, the pin is shown by default
*/
__initPinningSettings: function __initPinningSettings() {
if (_.isUndefined(this.pinning)) {
this.pinning = {
isPinned: false,
float: true,
display: false
};
}
if (!_.isBoolean(this.pinning.isPinned)) {
this.pinning.isPinned = false;
}
if (!_.isBoolean(this.pinning.float)) {
this.pinning.float = true;
}
if (!_.isBoolean(this.pinning.display)) {
if (this.pinning.isPinned === true) {
this.pinning.display = true;
} else {
this.pinning.display = false;
}
}
},
/**
* initializes the display settings
*/
__initDisplaySettings: function __initDisplaySettings() {
this._displayIndex = this.parent !== null && this.overlay === true ? this.parent._displayIndex : this._index;
if (this.parent === null) {
this._root.displayLimit = _.isNumber(this.displayLimit) && this.displayLimit > 0 ? this.displayLimit : Slideout.prototype.DISPLAY_LIMIT;
this._root.collapseRootIndex = _.isNumber(this.collapseRootIndex) && this.collapseRootIndex >= 0 ? this.collapseRootIndex : 0;
}
this._displayInfo = {
firstDisplayedAfterCollapsed: null
};
},
/**
* Gets the slidedout id
* @public
*
*/
getRootId: function getRootId() {
return this.getRootParent().id;
},
/**
* Determines if the slideout is the last one
* @public
* @return {Boolean} true if it is, false otherwise
*/
isLast: function isLast() {
return this.child === null;
},
/**
* renders content to page
* @param content. Content to be displayed to the page
*
* */
setContent: function setContent(content) {
if (this.contentView) {
this.contentView.remove();
this.contentView = null;
}
this.content = content;
if (this.isRendered && _.isObject(this.content) && this.content.module) {
return this._createContent();
}
return Promise.resolve();
},
/**
* sets pinned value
* @param pinned. Boolean value
*
* */
setPinned: function setPinned(pinned) {
if (pinned === undefined) {
this.pinning.isPinned = false;
} else {
this.pinning.isPinned = pinned;
}
this._updatePinCss();
this.trigger('change:pinState', {
pinned: this.isPinned()
});
},
/**
* @return {Number} displayLimit - the number of slideouts being shown before the collapse bar is shown
*/
getDisplayLimit: function getDisplayLimit() {
return this._root.displayLimit;
},
_handleEscape: function _handleEscape() {
var paneContainer = this.$el.children('.pane-child');
var pane = paneContainer.children();
if (pane.length >= 1) {
this.removeChild();
} else {
this.hide({
hideOnly: this.hideOnly,
force: true,
isEscape: true
});
}
},
/**
* render slideout to the page
*
* */
render: function render() {
PerfUtils.createPerformanceMark({
'component': 'glass',
'name': 'renderSlideout',
'state': 'start'
});
this.isRendered = true;
this.$el.attr('role', 'group');
this.$el.attr('aria-label', this.label);
if (!this.parent) {
this.$el.addClass('root');
this._windowResizeHandler = this._collapseChildren.bind(this);
$(window).on('resize', this._windowResizeHandler);
this.$el.on('escapeaction', $.proxy(this._handleEscape, this));
}
this.fireResizeStart = true;
this.$el.on('resize', this._handleResize.bind(this));
this.$el.addClass('flyoutPane pane-' + this.position);
var $content = $('');
this.setInnerContent($content);
var $paginationControl = this.$el.find('.pane-pagination-control');
Utils.setIcon($paginationControl, 'common-chevron_left');
var paginationAriaLabel = StringResources.get('paginationControl');
$paginationControl.attr('aria-label', paginationAriaLabel);
if (this.width) {
this.setWidth(this.width);
}
if (this.resizable) {
this._setResizable($content);
}
if (this.isPinDisplayed()) {
this.$el.find('.pane-content').append('
');
var $pin = this.$el.find('.pin-icon');
var ariaLabel;
if (!this.isPinned()) {
$pin.addClass('transform-pin');
ariaLabel = StringResources.get('pinSlideout');
} else {
this.$el.find('.pane-content').addClass('pane-pinned');
ariaLabel = StringResources.get('unpinSlideout');
}
$pin.attr('aria-label', ariaLabel);
}
if (_.isObject(this.content) && this.content.module) {
return this._createContent();
} else {
return Promise.resolve();
}
},
_onResizeStop: function _onResizeStop(event) {
return function () {
this.onResizeStop && this.onResizeStop(event);
this.fireResizeStart = true;
}.bind(this);
},
_handleResize: function _handleResize(event) {
if (event.target === event.currentTarget) {
if (this.fireResizeStart) {
this.onResizeStart && this.onResizeStart(event);
this.fireResizeStart = false;
}
this.onResize && this.onResize(event);
clearTimeout(this.resizeTimeout);
this.resizeTimeout = setTimeout(this._onResizeStop(event), 200);
}
},
/**
* Adds and shows a child slideout
* It waits for 600ms till the slideout is open before adding it; otherwise showing the child may occur before the parent is actually
* shown. In this case the child is not displayed
* @public
* @param {object} [options] - same options as the constructor except for position, glassContext which are retrieved from the current slideout and extra properties
* @param {Boolean} [options.overlay=false] - the child is shown on the top of the parent if true
* @param {Number} [options.width] - Width of the child slideout - if slideout is an overlay and is smaller, will be overriden with the width of the parent
* @param {launchPoint} [options.launchPoint]- Optional, The UI dom element that launched the slideout. The last active element if not specified.
* @param {String} [options.label]- The aria-label for the slideout. If no label is provided a default label is used.
* @return {Slideout} Child slideout; It may be returned before the slideout is actually shown
*/
addChild: function addChild(options) {
var childOptions = _.isObject(options) ? options : {};
childOptions.overlay = childOptions.overlay === true;
if (childOptions.overlay && (_.isUndefined(childOptions.width) || childOptions.width < this.width)) {
childOptions.width = this.width;
}
var child = this._createSlideout({
glassContext: this.glassContext,
position: this.position,
overlay: childOptions.overlay,
hideOnParentClick: childOptions.hideOnParentClick,
width: childOptions.width,
onHide: childOptions.onHide,
pinning: childOptions.pinning,
launchPoint: childOptions.launchPoint,
label: childOptions.label,
parent: this,
enableTabLooping: childOptions.enableTabLooping,
resizable: childOptions.resizable
});
if (this.open) {
__addChild.call(this, child, childOptions);
} else {
this._childToAdd.push(function (child, childOptions) {
__addChild.call(this, child, childOptions);
}.bind(this, child, childOptions));
}
return child;
},
removeChild: function removeChild(options) {
if (this.child !== null) {
return this.child.hide(options);
} else {
return Promise.resolve();
}
},
/**
* @return true if the slideout is pinned, false otherwise
*/
isPinned: function isPinned() {
return this.pinning.isPinned;
},
isFloat: function isFloat() {
return this.pinning.float;
},
isPinDisplayed: function isPinDisplayed() {
return this.pinning.display;
},
_initializePinning: function _initializePinning() {
this.pinning = {
isPinned: false,
float: true,
display: false
};
},
/**
* Shows the rendered slideout.
* Attaches hide callback on the clicktap event
* Triggers 'done:show' event when the animation completes
* For Pinned slideouts that have the pinning.float set to false, the no-float class is added.
* See this._hide where it is removed
* @public
*
* **/
show: function show() {
var shown;
if (this.open || this.isBeingShown()) {
shown = this._showing;
} else {
shown = this._showing = Promise.delay(30).then(function () {
this.trigger('show');
return this._show();
}.bind(this)).then(this._setFocusOnLast.bind(this));
}
return shown;
},
_setFocusOnLast: function _setFocusOnLast() {
if (this.isLast()) {
try {
if (this.contentView) {
this._setFocusInContentView();
}
} catch (err) {
return err;
}
}
},
/**
* internal show method
*/
_show: function _show() {
this.$el.children('.ui-resizable-handle').show();
this.$el.children('.pane-content').removeClass('tabhidden');
this.$el.addClass('active');
this.$el.removeClass('inactive');
this.enterContainerOnlyInTabOrder();
this.open = true;
if (this.child !== null) {
this.child.show();
}
var childToAdd = _.last(this._childToAdd);
this._childToAdd = [];
if (_.isFunction(childToAdd)) {
childToAdd();
}
if (this.$el.hasClass('root')) {
this._button = $('.toolpane button.currentlySelected');
this._button.addClass('slideoutOpen');
}
if (this.hideHandler !== null) {
$(document).on(this.closeEventPattern, null, {
allowPropagationDefaultAction: true
}, this.hideHandler);
}
this._addShadowToFinalSlideoutChild();
if (this.parent !== null && this.hideOnParentClick === true) {
this.parent.$el.children('.pane-content').on('clicktap.removeChild', function () {
this.removeChild();
}.bind(this.parent));
}
// Wait for the animation to complete as interrupting an animation causes artifacts on FireFox
return this.whenAnimationDone('show').then(this._showHelper.bind(this));
},
_showHelper: function _showHelper() {
if (this.child === null) {
this._collapseChildren();
}
if (this.isPinned() && !this.isFloat() && !this.$el.hasClass('no-float')) {
this._updatePinCss();
}
this.trigger('done:show');
},
/**
* @return {Boolean} true if it is open
*/
isOpen: function isOpen() {
return this.open;
},
/**
* Checks if the slideout is currently being shown
* @return {Boolean} true it is showing
*/
isBeingShown: function isBeingShown() {
return this._showing !== null && this._showing.isPending();
},
/**
* Checks if the current slideout has any open child
* @return {boolean} true if there is at least one open child
*/
hasOpenChild: function hasOpenChild() {
var child = this.child;
var hasOpenChild = false;
while (child !== null && !hasOpenChild) {
hasOpenChild = child.open;
child = child.child;
}
return hasOpenChild;
},
/**
* hides content on the page. changes div from class 'active' to 'inactive'
* also removes the slideout element from the DOM after the animation is finished
*
* When a parent pinned is found, continue the hiding process to delete the children.
* Important limitation: a unpinned parent hides all the children, whatever their pin state.
*
*
* @public
*
* @param {Object} [options] set of hide options
* @param {boolean} [options.force=false] - hides pinned slideout
* @param {boolean} [options.hideOnly=false] - if true, keeps the slideout element in the DOM
* @param {Number} [options.depth=-1] - index of the last slideout to hide: this is only applicable when options.hideOnly is true; -1 or lower means all slideouts are hidden; 0 means only the current one is removed
* @param {boolean} [options.isEscape=false] - specified if the hide operation is to be executed in a escape context or not ; it is set to true in the escape handler of the root slideout
* @return {Promise} resolve when the slideout is hidden; rejected if it is not
* @example
* To hide a pinned slideout: slideout.hide({force: true});
* If hide() is called more than once before resolving, we store an array of promises to ensure they are all handled in seqeunce.
* Only one hide call per unique options signature will be executed (a unique options signature is defined as having at least one different option as defined above relative to all other options objects)
* **/
hide: function hide(options) {
var doHiding = function (options) {
var _this2 = this;
var force = _.isObject(options) && options.force === true;
var hideOnly = _.isObject(options) && options.hideOnly === true;
var depth = _.isObject(options) && _.isNumber(options.depth) && hideOnly ? options.depth : -1;
var fullHideOptions = $.extend({}, {
force: force,
hideOnly: hideOnly,
depth: depth
});
var isEscape = _.isObject(options) && options.isEscape === true;
return this._canHide({
isEscape: isEscape,
depth: depth
}).then(this._doHide.bind(this, fullHideOptions)).then(function () {
if (this._button && this === this.getRootParent()) {
this._button.removeClass('slideoutOpen');
this._button.removeClass('currentlySelected');
this._button = null;
}
}.bind(this)).finally(function () {
_this2._hidingPromises.shift();
_this2._hidingOptions.shift();
});
}.bind(this);
if (!this._hidingPromises || this._hidingPromises.length === 0) {
this._hidingPromises = [];
this._hidingOptions = [];
this._hidingPromises.push(doHiding(options));
this._hidingOptions.push(options || {});
} else if (__isUniqueOption(this._hidingOptions, options || {})) {
this._hidingOptions.push(options || {});
this._hidingPromises.push(_.last(this._hidingPromises).finally(function () {
return doHiding(options);
}));
}
return _.last(this._hidingPromises);
},
/**
* Checks if the slideout can be hidden
* Recursive method: it is stopped in one of the following cases:
* - the first canHide method does not return true or a rejected promise
* - the last slideout to hide is reached
* - the last child is reached
* @param {Object} - options
* @param {Boolean} - options.isEscape - true if it is an escaped hiding; false otherwise
* @param {Number} - options.depth - index of the last slideout to hide
* @return {promise} resolved when it can be hidden or it is already hidden; rejected otherwise;
*/
_canHide: function _canHide(options) {
return new Promise(function (resolve, reject) {
var needToInvokeCanHide = this.isOpen() && this.contentView && _.isFunction(this.contentView.canHide);
var canHideChild = function canHideChild(options) {
var isLastToHide = options.depth === 0;
options.depth--;
if (isLastToHide || this.isLast()) {
resolve();
} else {
return this.child._canHide(options).then(resolve, reject);
}
};
if (!needToInvokeCanHide) {
canHideChild.call(this, options);
} else {
var result = true;
try {
result = this.contentView.canHide(options);
} catch (error) {
console.error('Error while executing canHide method', error);
}
Promise.resolve(result).then(function (slideCanHide) {
if (slideCanHide === true || _.isUndefined(slideCanHide)) {
canHideChild.call(this, options).then(resolve, reject);
} else {
reject();
}
}.bind(this)).catch(function () {
reject();
});
}
}.bind(this));
},
/**
* does the hiding
*/
_doHide: function _doHide(options) {
return new Promise(function (resolve) {
if (!this.open) {
var removeMySelfOnly = options.depth === 0;
if (removeMySelfOnly) {
__completeHide.call(this);
resolve();
} else {
options.depth = options.depth - 1;
this._hideChild(options).then(function () {
__completeHide.call(this);
if (!options.hideOnly && (options.force || !this.isPinned())) {
this.remove();
}
resolve();
}.bind(this));
}
} else {
var transferFocus = $.contains(this.$el[0], document.activeElement);
var hidingSlideouts = [];
var slideoutToRemove = this._hideOnly(hidingSlideouts, options);
if (_.isEmpty(hidingSlideouts)) {
resolve();
} else {
Promise.all(hidingSlideouts).then(function () {
__completeHide.call(this);
if (!options.hideOnly) {
slideoutToRemove.remove();
}
if (transferFocus) {
this._setFocusToLaunchPoint();
}
resolve();
}.bind(this));
}
}
}.bind(this));
},
/**
* Hides the child when it is defined
* @param {object} options passed in the hide method with the set values for the depth, force and hideOnly properties
* @return {Promise} promise resolved when the child is hidden
*/
_hideChild: function _hideChild(options) {
if (this.child === null) {
return Promise.resolve('no child to hide');
} else {
var hidingSlideouts = [];
this._hideOnly(hidingSlideouts, options);
return Promise.all(hidingSlideouts);
}
},
/**
* Hides the slideouts only visually
* @Param {Array} hidingSlideouts - Array of promises which is populated by this method
* @param {object} options passed in the hide method with the set values for the depth, force and hideOnly properties
* @return {Slideout} slideout to remove if necessary
*/
_hideOnly: function _hideOnly(hidingSlideouts, options) {
var slideout = this;
var slideoutToRemove;
var index = 0;
var ignorePinning = options.force;
while (_.isObject(slideout) && (index <= options.depth || options.depth < 0)) {
if (ignorePinning || !slideout.isPinned()) {
if (_.isUndefined(slideoutToRemove)) {
slideoutToRemove = slideout;
ignorePinning = true;
}
hidingSlideouts.push(slideout._hide(options));
}
slideout = slideout.child;
index++;
}
if (!_.isEmpty(hidingSlideouts)) {
this._collapseChildren();
}
return slideoutToRemove;
},
/**
* Performs the hide of the current slideout only
* For pinned slideouts, the no-float class is removed avoid to have them shown when opening another one.
* @return promise - resolved when the animation is finished
*/
_hide: function _hide() {
var whenAnimationEnd = new Promise(function (resolve) {
if (!this.open) {
resolve('Slideout already hidden');
} else {
this.open = false;
if (this.$el.closest('html').length === 0) {
console.log('The slideout DOM element is already removed');
resolve('Slideout already removed');
} else {
if (this.parent) {
this.parent.$el.children('.pane-content').off('clicktap.removeChild');
}
this.whenAnimationDone('_hide').then(function () {
if (this.onHide) {
this.onHide();
}
resolve();
}.bind(this));
}
}
}.bind(this));
whenAnimationEnd.then(function () {
if (this.open === false) {
this.$el.children('.pane-content').addClass('tabhidden');
this.removeContainerOnlyFromTabOrder();
}
this._addShadowToFinalSlideoutChild();
}.bind(this));
if (this.isPinned()) {
this.$el.removeClass('no-float');
}
this.$el.removeClass('collapsed');
this.$el.removeClass('collapseRoot');
// Add the class notransition to let the browser complete it's animation before hiding the slideout
this.$el.addClass('notransition');
// Trigger a reflow, flushing the CSS changes
// eslint-disable-next-line
this.$el[0].offsetHeight;
this.$el.removeClass('active');
this.$el.addClass('inactive');
this.$el.removeClass('notransition');
return whenAnimationEnd;
},
/**
* removes Slideout AND its children from the DOM.
* if this is used directly on a slideout instance (eg. Slideout.remove())
* it WILL NOT pick up the animation and the slideout will disapear immediately
*/
remove: function remove() {
if (this.child) {
this.child.remove();
}
if (this.parent !== null) {
if (this.parent.child === this) {
this.parent.child = null;
}
}
if (this._windowResizeHandler) {
$(window).off('resize', this._windowResizeHandler);
this.$el.off('resize', this._handleResize);
}
if (this.hideHandler) {
$(document).off(this.closeEventPattern, this.hideHandler);
this.hideHandler = null;
}
if (this.contentView) {
this.contentView.remove();
}
this.$el.off('escapeaction');
if (this.open) {
this.trigger('hide');
}
this.trigger('remove');
Slideout.inherited('remove', this, arguments);
},
setWidth: function setWidth(slide_width) {
if ($.isPlainObject(slide_width)) {
this.$el.css(slide_width);
} else {
this.$el.css('width', slide_width);
}
},
/**
* Appends content view to DOM
*
* **/
_createContent: function _createContent() {
var options = this.content || {};
options.slideout = this;
options = this.glassContext.addToOptions(options);
return this._ClassFactory.instantiate(this.content.module, options).then(function (contentView) {
this.contentView = contentView;
this.$el.children('.pane-content').append(this.contentView.$el);
var setFocusInContentView = function setFocusInContentView() {
PerfUtils.createPerformanceMark({
'component': 'glass',
'name': 'renderSlideout',
'state': 'end'
});
if (this.isOpen() && !this.isBeingShown()) {
this._setFocusInContentView();
}
};
var result = this.contentView.render();
return Promise.resolve(result).then(function () {
setFocusInContentView.call(this);
this.enableLooping(this.contentView.$el);
}.bind(this)).catch(function (error) {
this.logger.error('Error While rendering the content view for the slideout', error);
return Promise.reject(error);
}.bind(this));
}.bind(this));
},
/**
* Sets the focus in the content view
*/
_setFocusInContentView: function _setFocusInContentView() {
if (_.isFunction(this.contentView.setFocus)) {
this.contentView.setFocus();
}
},
/**
* Get the root part slideout
*
* @return - root slideout object
*/
getRootParent: function getRootParent() {
return this._root;
},
getLaunchPoint: function getLaunchPoint() {
if (this._paginationLaunchPoint !== null) {
return this._paginationLaunchPoint;
}
return Slideout.inherited('getLaunchPoint', this);
},
/**
* Get the width of the slideout
*
* @return - width of the slideout
*/
getWidth: function getWidth() {
return this.$el.outerWidth();
},
/**
* Get the list children slideout including the current slider
*
* @return array of slideouts
*/
getChildrenWithSelf: function getChildrenWithSelf() {
var sliders = [this];
var slider = this;
while (slider.child) {
sliders.push(slider.child);
slider = slider.child;
}
return sliders;
},
/**
* Collapse panels if necessary
*/
_collapseChildren: function _collapseChildren() {
var displayInfo = this._findFirstToCollapse();
this.getRootParent()._displayInfo = displayInfo;
if (displayInfo.firstToCollapse !== null) {
var firstToCollapse = displayInfo.firstToCollapse;
displayInfo = this._findSlideoutsToCollapse(displayInfo);
_.each(displayInfo.visible, function (slideout) {
slideout.$el.children('.pane-content').removeClass('tabhidden');
slideout.enterContainerOnlyInTabOrder();
});
if (_.isEmpty(displayInfo.collapsed)) {
firstToCollapse.$el.children('.pane-pagination-control:not(.collapsed .pane-pagination-control)').removeClass('visible');
firstToCollapse.$el.children('.pane-pagination-control:not(.collapsed .pane-pagination-control)').removeAttr('tabindex');
_.each(displayInfo.visible, function (slideout) {
slideout._paginationLaunchPoint = null;
});
} else {
firstToCollapse.$el.addClass('collapseRoot');
if (!firstToCollapse.$el.hasClass('collapsed')) {
firstToCollapse.$el.addClass('animationPhase');
firstToCollapse.whenAnimationDone('collapseChildren').then(function () {
this.$el.children('.collapsed .pane-pagination-control').addClass('visible');
this.$el.children('.collapsed .pane-pagination-control').attr('tabindex', '0');
}.bind(firstToCollapse));
}
_.each(displayInfo.collapsed, function (slideout) {
slideout.$el.removeClass('active').addClass('collapsed');
slideout.$el.children('.pane-content').addClass('tabhidden');
if (slideout.$el[0] !== firstToCollapse.$el[0]) {
slideout.removeContainerOnlyFromTabOrder();
}
});
for (var i = 1; i < displayInfo.visible.length; i++) {
displayInfo.visible[i]._paginationLaunchPoint = null;
}
displayInfo.firstDisplayedAfterCollapsed._paginationLaunchPoint = firstToCollapse.$el.children('.collapsed .pane-pagination-control')[0];
}
}
},
/**
* Gets the available width to display the slideout
*/
_getAvailableWidth: function _getAvailableWidth() {
return this.getRootParent().$el.parent().innerWidth();
},
/**
* Finds the first slideout to be collapsed if this is necessary based on the _collapseRootIndex
*
* @return {DisplayInfo} displayInfo
*/
_findFirstToCollapse: function _findFirstToCollapse() {
var root = null;
var slideout = this.getRootParent();
var width = 0;
var visible = [];
var searchIsDone = false;
while (!searchIsDone) {
if (slideout.open) {
if (root === null) {
if (slideout._displayIndex >= this._root.collapseRootIndex) {
root = slideout;
} else if (_.isEmpty(visible) || _.last(visible)._displayIndex !== slideout._displayIndex) {
width += slideout.getWidth();
visible.push(slideout);
}
} else {
if (slideout._displayIndex === root._displayIndex) {
root = slideout;
} else {
searchIsDone = true;
}
}
}
slideout = slideout.child;
searchIsDone = slideout === null || searchIsDone;
}
return {
firstToCollapse: root,
visible: visible,
width: width,
firstDisplayedAfterCollapsed: null,
collapsed: []
};
},
/**
* Finds the slideouts to collapse given the display info.
* @param {object} displayInfo - Information containing the first slideout to collapse if this is necessary
* @return {object} displayInfo - Updated displayed information with an array of slideouts to collapse and the first visible slideout.
* The latter is null if there is no slideout to collapse
*/
_findSlideoutsToCollapse: function _findSlideoutsToCollapse(displayInfo) {
var lastSlideout = null;
var slideout;
var availableWidth = this.getRootParent()._getAvailableWidth();
var displayLimit = this.getDisplayLimit();
var visibleAfterCollapsed = [];
var forceCollapse = false;
if (displayInfo.firstToCollapse !== null) {
slideout = displayInfo.firstToCollapse;
while (slideout !== null) {
lastSlideout = slideout;
slideout = slideout.child;
}
slideout = lastSlideout;
var searchIsDone = false;
var last = true;
var displayedNbr = displayInfo.visible.length;
while (!searchIsDone) {
if (slideout.open === true) {
if (forceCollapse) {
displayInfo.collapsed.unshift(slideout);
} else {
if (last || displayInfo.width + slideout.getWidth() + Slideout.prototype.PAGINATION_WIDTH < availableWidth && displayedNbr < displayLimit) {
last = false;
slideout.$el.removeClass('collapsed').removeClass('collapseRoot').addClass('active');
if (_.isEmpty(visibleAfterCollapsed) || slideout._displayIndex !== _.first(visibleAfterCollapsed)._displayIndex) {
displayInfo.width += slideout.getWidth();
visibleAfterCollapsed.unshift(slideout);
displayedNbr++;
}
} else {
if (slideout._displayIndex === _.first(visibleAfterCollapsed)._displayIndex) {
slideout.$el.removeClass('collapsed').removeClass('collapseRoot').addClass('active');
} else {
displayInfo.firstDisplayedAfterCollapsed = _.first(visibleAfterCollapsed);
displayInfo.collapsed.unshift(slideout);
forceCollapse = true;
}
}
}
}
searchIsDone = slideout === displayInfo.firstToCollapse;
slideout = slideout.parent;
searchIsDone = slideout === null || searchIsDone;
}
}
displayInfo.visible = displayInfo.visible.concat(visibleAfterCollapsed);
return displayInfo;
},
/**
* for animating the pin icon on the slideout and also setting pinned boolean.
*/
_togglePin: function _togglePin() {
this.setPinned(!this.isPinned());
},
_updatePinCss: function _updatePinCss() {
var $pin = this.$el.find('.pin-icon');
var ariaLabel;
if (this.isPinned()) {
this.$el.find('.pane-content').addClass('pane-pinned');
if (!this.isFloat()) {
this.$el.addClass('notransition'); // Disable transitions
this.$el.addClass('no-float');
// Trigger a reflow, flushing the CSS changes
// eslint-disable-next-line
this.$el[0].offsetHeight;
this.$el.removeClass('notransition');
}
$pin.removeClass('transform-pin');
ariaLabel = StringResources.get('unpinSlideout');
$pin.attr('aria-label', ariaLabel);
} else {
this.$el.find('.pane-content').removeClass('pane-pinned');
this.$el.addClass('notransition'); // Disable transitions
this.$el.removeClass('no-float');
//Trigger a reflow, flushing the CSS changes
// eslint-disable-next-line
this.$el[0].offsetHeight;
this.$el.removeClass('notransition');
$pin.addClass('transform-pin');
ariaLabel = StringResources.get('pinSlideout');
$pin.attr('aria-label', ariaLabel);
}
},
/**
* Paginate back. This method will do the following:
* The child of the first visible slideout is hidden if it exists otherwise the first visible is hidden
*/
pageBack: function pageBack(event) {
if (!event.isDefaultPrevented() && this._root._displayInfo.firstDisplayedAfterCollapsed !== null) {
var firstVisible = this._root._displayInfo.firstDisplayedAfterCollapsed;
var slideoutToHide = firstVisible.child !== null ? firstVisible.child : firstVisible;
slideoutToHide.hide();
event.preventDefault();
slideoutToHide._setFocusToLaunchPoint();
}
},
/**
* Indicate when the the current css animation is complete
* Sets a timeout to avoid none-resolved promise - this is used by the unit tests
* where no css is loaded
* @return - a promise that will be resolved when the animation is complete
*/
whenAnimationDone: function whenAnimationDone(operation) {
return new Promise(function (resolve) {
this.$el.off('transitionend webkitTransitionEnd oTransitionEnd');
this.$el.on('transitionend webkitTransitionEnd oTransitionEnd', function () {
resolve();
});
}.bind(this)).timeout(this.ANIMATION_TIMEOUT).catch(Promise.TimeoutError, function () {
console.log('failed to detect the end of the slideout animation, force the resolve; operation: ' + operation);
return Promise.resolve();
});
},
/**
* Sets the shadow class to the final slideout; remove it for all the others
*/
_addShadowToFinalSlideoutChild: function _addShadowToFinalSlideoutChild() {
var current_slideout = this.getRootParent();
var lastOpenChild = current_slideout;
while (current_slideout.child !== null) {
current_slideout.$el.removeClass('shadow');
current_slideout = current_slideout.child;
if (current_slideout.open) {
lastOpenChild = current_slideout;
}
}
lastOpenChild.$el.addClass('shadow');
},
/**
* Create a slideout with the passed options
* @param {Object} options - slideout properties
* @return {Object}
*/
_createSlideout: function _createSlideout(options) {
return new Slideout(options);
},
_setResizable: function _setResizable($content) {
var isPosRight = this.position === 'right';
var $paneContent = $content.filter('.pane-content');
var $resizeHandle = $('
').addClass('resize-handle ui-resizable-handle ui-resizable-' + (isPosRight ? 'w' : 'e'));
var resizable = {
handles: [$resizeHandle],
minWidth: this.resizable.min || 300,
maxWidth: this.resizable.max || 1000,
direction: isPosRight ? 'left' : 'right'
};
if (isPosRight) {
$resizeHandle.insertBefore($paneContent);
} else {
$resizeHandle.insertAfter($paneContent);
}
Utils.setIcon($resizeHandle, 'common-handle');
this.$el.resizable(resizable);
}
});
return Slideout;
});
//# sourceMappingURL=Slideout.js.map
;
/*
* Licensed Materials - Property of IBM
*
* IBM Cognos Products: BI
*
* (C) Copyright IBM Corp. 2015, 2017
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/common/ui/SlideoutRegistry',['../../core-client/js/core-client/ui/core/Events', 'jquery', 'underscore', '../../core-client/js/core-client/ui/Slideout'], function (Events, $, _, Slideout) {
var ERROR_INVALID_PARAM = 'SlidoutRegistry:openSlideout - Invalid Slideout parameter';
var ERROR_INVALID_POSITION = 'SlidoutRegistry:openSlideout - Invalid Slideout position';
var ERROR_INVALID_CONTAINER = 'SlidoutRegistry:openSlideout - Undefined or invalid container';
var ERROR_ALREADY_OPEN = 'SlidoutRegistry:openSlideout - One slideout is already open';
var ERROR_CHANGE_CONTAINER_INVALID_CONTAINER = 'SlidoutRegistry:changeContainer - Undefined or invalid container';
var ERROR_CHANGE_CONTAINER_OPEN_SLIDEOUT = 'SlidoutRegistry:changeContainer - Slideout is open';
var ERROR_GET_OPEN_SLIDEOUT_INVALID_POSITION = 'SlidoutRegistry:getOpenSlideout - Invalid Slideout position';
/**
* Adds the slideout to the container. Prepend for left position, append for right one;
* @param {jquery} $container - container to update
* @param {SLideout} slideout - slideout to add
*
*/
var _addSlideoutToContainer = function _addSlideoutToContainer($container, slideout) {
if (slideout.position === 'left') {
$container.prepend(slideout.$el);
} else {
$container.append(slideout.$el);
}
};
/**
* Builds an error with a toString method
*/
var _buildError = function _buildError(error) {
error.toString = function () {
return error.msg;
};
return error;
};
/**
* @throws ERROR_INVALID_POSITION error when it is not left or right
*/
var _validatePosition = function _validatePosition(position) {
if (position !== 'right' && position !== 'left') {
throw _buildError({
msg: ERROR_INVALID_POSITION,
position: position
});
}
};
/**
* Opens the slideout from an slideout instance; It assumes that the slideout is not rendered when it is not registered
* @param {Slideout} slideout - the passed slideout
* @return {Slideout} The passed slideout
* @throws ERROR_ALREADY_OPEN or ERROR_INVALID_POSITION
*/
var _openSlideoutFromInstance = function _openSlideoutFromInstance(slideout) {
var position = slideout.position;
_validatePosition(position);
if (!_.isUndefined(this._open[position])) {
throw _buildError({
msg: ERROR_ALREADY_OPEN,
open: this._open[position]
});
}
if (_.isUndefined(this._registered[slideout.getRootId()])) {
slideout.render();
_addSlideoutToContainer(this.$container, slideout);
} else {
if (slideout.getRootParent() !== this._registered[slideout.getRootId()]) {
slideout = this._registered[slideout.getRootId()];
}
}
slideout.show();
return slideout;
};
/**
* Opens the slideout from an object spec
* @param {object} object - the specs of the slideout to show
* @return {Slideout}
* @throws ERROR_INVALID_POSITION or ERROR_ALREADY_OPEN
*/
var _openSlideoutFromObject = function _openSlideoutFromObject(object) {
var position = object.position;
var slideout;
if (this._registered[object.id]) {
slideout = this._registered[object.id];
} else {
_validatePosition(position);
if (!_.isUndefined(this._open[position])) {
throw _buildError({
msg: ERROR_ALREADY_OPEN
});
}
slideout = new Slideout(object);
slideout.render();
_addSlideoutToContainer(this.$container, slideout);
}
slideout.show();
return slideout;
};
/**
* Sets the callback on hide and remove.
* hide: Unflags the slideout as open and move it to be registered; removes itself from the slideout callback
* remove: Unregisters the slideout, Unflag it as open if necessary, remove itself and the hide callback
* @param {Slideout} Slideout - slideout instance to which we attach the callback
*/
var _setCallbacks = function _setCallbacks(slideout) {
var hideCallback = function (slideout) {
if (!slideout.hasOpenChild()) {
delete this._open[slideout.position];
this._registered[slideout.getRootId()] = slideout;
slideout.off('hide', hideCallback);
}
}.bind(this, slideout);
var removeCallback = function (slideout) {
if (this._open[slideout.position] === slideout) {
delete this._open[slideout.position];
}
delete this._registered[slideout.getRootId()];
slideout.off('remove', removeCallback);
slideout.off('hide', hideCallback);
}.bind(this, slideout);
slideout.on('hide', hideCallback);
slideout.on('remove', removeCallback);
};
/**
* @public
*/
var Registry = Events.extend(
/**
* @lends SlideoutRegistry.prototype
*/
{
/**
* @classdesc Class allowing to register a {@link Slideout} when opening it in a specific container
* @constructs
* @public
* @param {object} options - Init properties
* @param {Jquery} options.$container - container where the slideouts are to be shown
* application & application.appView
*/
init: function init(options) {
Registry.inherited('init', this, arguments);
$.extend(this, options);
this._open = {};
this._registered = {};
},
/**
* Opens the provided slideout
* @public
* @param {Object|Slideout} slideout - Object containing the properties of the slideout to show; See {@link Slideout}, Slideout object,
* @return {Slideout} slideout - the shown slideout; null if there is no container
* @throws ERROR_ALREADY_OPEN, ERROR_INVALID_POSITION or ERROR_INVALID_CONTAINER
*/
openSlideout: function openSlideout(slideout) {
var openSlideout;
if (!$.prototype.isPrototypeOf(this.$container)) {
throw _buildError({
msg: ERROR_INVALID_CONTAINER,
container: this.$container
});
}
if (Slideout.prototype.isPrototypeOf(slideout)) {
openSlideout = _openSlideoutFromInstance.call(this, slideout);
} else if (_.isObject(slideout)) {
openSlideout = _openSlideoutFromObject.call(this, slideout);
} else {
throw _buildError({
msg: ERROR_INVALID_PARAM,
parameter: slideout
});
}
this._open[openSlideout.position] = openSlideout.getRootParent();
_setCallbacks.call(this, this._open[openSlideout.position]);
return openSlideout;
},
/**
* Returns the open slideout for the given position
* @public
* @param {String} position - left or right
* @return {Slideout} the open slideout for the given position or undefined if none is open or if the position is invalid
* @throw ERROR_GET_OPEN_SLIDEOUT_INVALID_POSITION
*/
getOpenSlideout: function getOpenSlideout(position) {
if (position !== 'left' && position !== 'right') {
throw _buildError({
msg: ERROR_GET_OPEN_SLIDEOUT_INVALID_POSITION,
position: position
});
}
return this._open[position];
},
/**
* Returns array of the open slideouts from the 2 positions: left and right
* @public
* @return {Slideout[]} Array of open slideouts; Empty if none is open
*/
getOpenSlideouts: function getOpenSlideouts() {
var openSlideouts = [];
if (!_.isUndefined(this._open.left)) {
openSlideouts.push(this._open.left);
}
if (!_.isUndefined(this._open.right)) {
openSlideouts.push(this._open.right);
}
return openSlideouts;
},
/**
* Gets the registered slideout based on the id
* @public
* @param {String} id - id of the slideout
* @return {Slideout} undefined if not found or id is not a sting
*/
getRegisteredSlideout: function getRegisteredSlideout(id) {
var slideout;
if (_.isString(id)) {
slideout = this._registered[id];
}
return slideout;
},
/**
* Gets the registry container
* @return {jquery} Container as a jquery object
*/
getContainer: function getContainer() {
return this.$container;
},
/**
* Changes the container
* @public
* @param {jQuery} $newContainer - new container to move to
* @throws ERROR_INVALID_CONTAINER is $newContainer is invalid
*/
changeContainer: function changeContainer($newContainer) {
if (!$.prototype.isPrototypeOf($newContainer)) {
throw _buildError({
msg: ERROR_CHANGE_CONTAINER_INVALID_CONTAINER,
container: this.$container
});
}
if (this._open.left || this._open.right) {
throw _buildError({
msg: ERROR_CHANGE_CONTAINER_OPEN_SLIDEOUT,
open: this._open
});
}
_.each(this._registered, function (slideout
/*, id*/
) {
_addSlideoutToContainer($newContainer, slideout);
}, this);
this.$container = $newContainer;
},
_removeSlideout: function _removeSlideout(slideout) {
if (slideout) {
slideout.remove();
}
},
cleanupSlideouts: function cleanupSlideouts() {
_.each(this._open, function (slideout) {
if (slideout) {
slideout.remove();
}
});
_.each(this._registered, function (slideout) {
if (slideout) {
slideout.remove();
}
});
}
});
return Registry;
});
//# sourceMappingURL=SlideoutRegistry.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Glass
* (C) Copyright IBM Corp. 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/ajax/AjaxErrorFactory',['../core-client/js/core-client/errors/BaseError'], function (BaseError) {
var AjaxErrorFactory = {
/**
* Creates a an AjaxError from the jqXHR objects
* @public
* @param {Object} jqXHR - jquery XHR object
* @return {AjaxError} - instance of AjaxError that has code and requestInfo properties
*/
create: function create(jqXHR, textStatus, errorThrown) {
var AjaxError = BaseError.extend({
init: function init(status, options) {
AjaxError.inherited('init', this, arguments);
this.name = 'AjaxError';
this.jqXHR = options.requestInfo.jqXHR;
this.textStatus = options.requestInfo.textStatus;
this.errorThrown = options.requestInfo.errorThrown;
}
});
return new AjaxError(jqXHR.statusText, {
requestInfo: {
jqXHR: jqXHR,
textStatus: textStatus,
errorThrown: errorThrown
},
code: jqXHR.status
});
}
};
return AjaxErrorFactory;
});
//# sourceMappingURL=AjaxErrorFactory.js.map
;
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
/**
* Licensed Materials - Property of IBM
* IBM Business Analytics (C) Copyright IBM Corp. 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/services/AjaxService',['jquery', '../ajax/AjaxErrorFactory'], function ($, AjaxErrorFactory) {
var AjaxService = /*#__PURE__*/function () {
/**
* @description Constructor
* @param {Object} - (optional) options.logger - Logger
* @param {Object} - (optional) @deprecated options.errorDialog -
*/
function AjaxService(options) {
var _this = this;
_classCallCheck(this, AjaxService);
this._logWarning = function (msg) {
if (_this._logger && _this._logger.warn) {
_this._logger.warn('AjaxService', msg);
}
};
this._handleUrlTooLong = function (request, reqInfo, originalParams, urlReducer) {
var warnMsg = "Request too long. ".concat(JSON.stringify(request), ". Prepared URL length: ").concat(reqInfo.preparedReqLen, " exceeds max configured length ").concat(reqInfo.maxQuerySize, ".");
_this._logWarning(warnMsg);
var reducedParams = urlReducer(originalParams);
warnMsg = "URL reducer invoked and returned reduced params: ".concat(JSON.stringify(reducedParams), ".");
_this._logWarning(warnMsg);
reducedParams.skipUrlReducer = true;
return _this.ajax(reducedParams);
};
this._issueRequest = function (request, originalParams) {
var params = request.params;
if (params.urlReducer && !params.skipUrlReducer) {
return _this._checkUrlLength(request).then(function (reqInfo) {
if (reqInfo.urlTooLong) {
return _this._handleUrlTooLong(request, reqInfo, originalParams, params.urlReducer);
}
return _this.executeProcessedAjax(request.params);
});
}
return _this._sendRequest(request);
};
this._sendRequest = function (request) {
return new Promise(function (resolve, reject) {
_this._cntr++;
var requestId = 'xhr' + _this._cntr;
var jqXHR = _this.ajaxFn(request.params);
_this._inflightRequests[requestId] = jqXHR;
jqXHR.then(function (data, textStatus, jqXHR) {
resolve({
data: data,
textStatus: textStatus,
jqXHR: jqXHR
});
}).fail(function (jqXHR, textStatus, errorThrown) {
if (errorThrown !== 'abort') {
reject(_this._AjaxErrorFactory.create(jqXHR, textStatus, errorThrown));
} else {
resolve({
textStatus: textStatus,
jqXHR: jqXHR
});
}
}).done(function () {
if (_this._inflightRequests[requestId]) {
delete _this._inflightRequests[requestId];
}
});
});
};
this._logger = options && options.logger || console;
this._configService = options && options.configService;
this._errorMessageRenderer = options && options.errorDialog || undefined;
this._requestHandlers = [];
this._responseHandlers = [];
this._errorHandler = null;
this._cntr = 0;
this._inflightRequests = {};
}
/**
* @description Adds a handler to the request chain that will be called before every request.
* @param {Object} handler
* handler - Object with function: prepareRequest(params)
* @throws if handler is not provided, or does not provide a "prepareRequest" function.
*/
_createClass(AjaxService, [{
key: "addRequestHandler",
value: function addRequestHandler(handler) {
if (handler && typeof handler.prepareRequest === 'function') {
this._requestHandlers.push(handler);
} else {
throw new Error('Handler must implement function "prepareRequest"');
}
}
/**
* @description Adds a handler to the response chain which will be called on every response.
* @param {Object} handler
* handler - Object with function: handleResponse(data, textStatus, jqXHR)
* @throws if handler is not provided, or does not provide a "handleResponse" function.
*/
}, {
key: "addResponseHandler",
value: function addResponseHandler(handler) {
if (handler && typeof handler.handleResponse === 'function') {
this._responseHandlers.push(handler);
} else {
throw new Error('Handler must implement function "handleResponse"');
}
}
/**
* @description Sets a single handler which will be called on every error response.
* @param {Object} handler
* handler - Object with function: handleError(request, error)
* @throws if handler is not provided, or does not provide a "handleError" function.
*/
}, {
key: "setErrorHandler",
value: function setErrorHandler(handler) {
if (handler && typeof handler.handleError === 'function') {
this._errorHandler = handler;
} else {
throw new Error('Handler must implement function "handleError"');
}
}
}, {
key: "_buildRequestObject",
value: function _buildRequestObject(params) {
return {
params: params || {}
};
}
}, {
key: "ajax",
value:
/**
* @description Send an AJAX request.
* @param params jQuery style ajax params object
* @returns {Promise} (A+ Spec)
*/
function ajax(params) {
var request = this._buildRequestObject(params); // The _prepareRequest has request handlers that potentially modify the request.
// If there is a urlReducer, make a copy of the original params.
var originalParams = params && params.urlReducer ? _objectSpread({}, params) : null;
return this._prepareRequest(request).then(this._issueRequest.bind(this, request, originalParams)).then(this._handleResponse.bind(this, request), this._handleError.bind(this, request));
}
/**
* @description Send an AJAX request without running requestHandlers.
* @param params jQuery style ajax params object
* @returns {Promise} (A+ Spec)
*/
}, {
key: "executeProcessedAjax",
value: function executeProcessedAjax(params) {
var request = this._buildRequestObject(params);
return this._executeProcessedAjax(request);
}
}, {
key: "_executeProcessedAjax",
value: function _executeProcessedAjax(request) {
return this._sendRequest(request).then(this._handleResponse.bind(this, request), this._handleError.bind(this, request));
}
/**
* @description Prepare AJAX request with configured requestHandlers.
* @param params jQuery style ajax params object
* @returns {Promise} (A+ Spec)
*/
}, {
key: "prepareRequest",
value: function prepareRequest(params) {
var request = this._buildRequestObject(params);
return this._prepareRequest(request, true);
}
/**
* @description For GET requests, calculate length of URL plus data items as query params.
* For non-GET requests, calculate length of just URL part.
* @param preparedReq Request after registered req handlers have processed the req
* @returns {Integer} length
*/
}, {
key: "_getUrlAndParmsLength",
value: function _getUrlAndParmsLength(params) {
var url = params.url,
data = params.data,
method = params.method;
var urlLenth = url.length;
if (method === 'GET') {
// jQuery will move the content in .data onto URL as query parms.
var dataQueryItems = '';
if (typeof data === 'string') {
var dataItems = data.split('&');
dataQueryItems = dataItems.reduce(function (urlItems, item) {
var itemPair = item.split('=');
return "".concat(urlItems, "&").concat(itemPair[0], "=").concat(encodeURIComponent(itemPair[1]));
}, '');
} else if (Array.isArray(data)) {
dataQueryItems = data.reduce(function (urlItems, d) {
return "".concat(urlItems, "&").concat(encodeURIComponent(d.name), "=").concat(encodeURIComponent(d.value));
}, '');
} else if (_typeof(data) === 'object') {
for (var d in data) {
dataQueryItems = "".concat(dataQueryItems, "&").concat(encodeURIComponent(d), "=").concat(encodeURIComponent(data[d]));
}
}
return urlLenth + dataQueryItems.length;
}
return urlLenth;
}
}, {
key: "_checkUrlLength",
value: function _checkUrlLength(request) {
var _this2 = this;
return this._configService.getDatasetQuerySize().then(function (maxQuerySize) {
var preparedReqLen = _this2._getUrlAndParmsLength(request.params);
return {
urlTooLong: preparedReqLen > maxQuerySize,
maxQuerySize: maxQuerySize,
preparedReqLen: preparedReqLen
};
});
}
}, {
key: "_prepareRequest",
value: function _prepareRequest(request) {
var promise = Promise.resolve();
this._requestHandlers.forEach(function (handler) {
promise = promise.then(handler.prepareRequest.bind(handler, request));
});
return promise;
}
/**
* @description Cancels all in-flight requests. Errors reported by these requests (as 'aborted')
* will be swallowed.
*/
}, {
key: "cancelAllRequests",
value: function cancelAllRequests() {
var _this3 = this;
Object.keys(this._inflightRequests).forEach(function (key) {
try {
var jqXHR = _this3._inflightRequests[key];
jqXHR.abort();
} catch (err) {
if (_this3._logger && _this3._logger.error) {
_this3._logger.error('AjaxService.cancelAllRequests', err);
}
}
});
}
/**
* @description Displays an error dialog
* @deprecated
* @param {Object} jqXHR - the request
* @param {String} errMsg - text to display
*/
}, {
key: "showError",
value: function showError(jqXHR, errMsg) {
if (this._errorMessageRenderer && typeof this._errorMessageRenderer.showError === 'function') {
return this._errorMessageRenderer.showError(jqXHR, errMsg);
} else {
return Promise.reject(new Error('Unable to display error dialog: ' + errMsg));
}
}
}, {
key: "_handleResponse",
value: function _handleResponse(request, response) {
var promise = Promise.resolve();
this._responseHandlers.forEach(function (handler) {
promise = promise.then(handler.handleResponse.bind(handler, request, response));
});
return promise.then(function () {
return response;
});
}
}, {
key: "_handleError",
value: function _handleError(request, error) {
if (this._errorHandler) {
return this._errorHandler.handleError(request, error);
} else {
return Promise.reject(error);
}
}
}]);
return AjaxService;
}();
AjaxService.prototype.ajaxFn = $.ajax;
AjaxService.prototype._AjaxErrorFactory = AjaxErrorFactory;
return AjaxService;
});
//# sourceMappingURL=AjaxService.js.map
;
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Glass
* (C) Copyright IBM Corp. 2018
* US Government Users Restricted Rights - Use, duplication or disclosure
* restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/services/ClipboardService',['underscore'], function (_) {
/**
* @lends ClipboardService
**/
var ClipboardService = /*#__PURE__*/function () {
/**
* Contructor for ClipboardService
* @public
* @constructs ClipboardService
* @classdesc Shared clipboard service which has implemented following spec draft:
* - API will provide async set, get and clear
* - API will accept and return string/object/number data transparently without changing type
* - Stringification and parsing of clipboard data will be handled internally for convenience
* - TODO: Service will rehydrate from localStorage on creation in cases where new window
* is opened after copying or to prevent data loss/ overwriting when switching between apps
* - Example clipboard data (guideline, not yet decided):
* {
* dashboardSpec: ,
* reportingSpec: ,
* otherData:
* }
* @param {Boolean} initNow - Wether to initialize the service now at creation
* or later, defaults to false and follows regular
* glass paradigm of deferred initialization
* @param {Object} glassContext - glassContext
**/
function ClipboardService(initNow, glassContext) {
_classCallCheck(this, ClipboardService);
if (initNow) {
this.initialize(glassContext);
}
}
/**
* Initializer for clipboard service
* @public
* @param {Object} glassContext - glassContext
**/
_createClass(ClipboardService, [{
key: "initialize",
value: function initialize(glassContext) {
this.glassContext = glassContext;
this._clipboardData = '';
this._storedType = 'string';
}
/**
* Async set data in localStorage. In case of non-existent localStorage
* We save data simply to this._clipboardData in this shared service
* @public
* @param {String | Object} data - object containing the data to set
* @return {Promise} returns resolve or reject. Reject will propagate error, resolve is empty
*/
}, {
key: "set",
value: function set(data) {
var _this = this;
return new Promise(function (resolve, reject) {
try {
_this._set(data);
resolve();
} catch (e) {
reject(e);
}
});
}
/**
* Asynchronously get data in localStorage. In case of non-existent localStorage
* We get data from this._clipboardData in this shared service
* @public
* @return {Promise} returns a promise which resolves with {JSON} of all data
*/
}, {
key: "get",
value: function get() {
var _this2 = this;
return new Promise(function (resolve) {
resolve(_this2._get());
});
}
/**
* Asynchronously clears all data in this service and associated localstorage
* @public
* @return {Promise} returns a promise which resolves after clearing everything or rejects on err
*/
}, {
key: "clear",
value: function clear() {
var _this3 = this;
return new Promise(function (resolve) {
_this3._clipboardData = '';
_this3._storedType = 'string';
resolve();
});
}
/**
* sets clipboard data
* @private
**/
}, {
key: "_set",
value: function _set(str) {
if (_.isFunction(str)) {
throw new Error('Exception: Cannot encode functions for clipboard storage');
}
this._storedType = _typeof(str);
if (!_.isString(str)) {
str = JSON.stringify(str);
}
this._clipboardData = str;
}
/**
* gets clipboard data, attempting to return what was set
* @private
**/
}, {
key: "_get",
value: function _get() {
var ret = this._clipboardData;
if (this._storedType === 'object') {
ret = JSON.parse(this._clipboardData);
} else if (this._storedType === 'number') {
ret = Number(this._clipboardData);
}
return ret;
}
}]);
return ClipboardService;
}();
return ClipboardService;
});
//# sourceMappingURL=ClipboardService.js.map
;
define('text!baglass/app/templates/CoachMarkBubble.html',[],function () { return '
';});
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2015, 2018
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/CoachMark',['../core-client/js/core-client/ui/AccessibleView', 'jquery', 'text!./templates/CoachMarkBubble.html', 'text!./templates/CoachMarkPopover.html', '../nls/StringResources', 'doT', 'underscore', 'bootstrap', // currently required for usage of bspopover
'jquery-ui'], function (AccessibleView, $, CoachMarkBubble, CoachMarkPopover, StringResources, dot, _) {
/**
* Implements Coach marks functionality
* @private
*/
var CoachMark = AccessibleView.extend({
init: function init(options) {
this.persistence = options.glassContext.getCoreSvc('.CoachMarkService').getPersistence();
var label = StringResources.get('coachMarkLabel', {
title: _.escape(options.title)
});
var sHtml = dot.template(CoachMarkBubble)({
'label': label
});
this._$coachMark = $(sHtml);
options.launchPoint = this._$coachMark;
options.enableTabLooping = true;
CoachMark.inherited('init', this, arguments);
},
render: function render($container, isVisible) {
$('.coachMarkPopover').remove();
var $coachMark = this._$coachMark;
var containerId = $container.attr('id');
$coachMark.addClass('coachMark');
if (!isVisible) {
$coachMark.hide();
}
$coachMark.data('containerId', containerId);
$container.append($coachMark);
$container.addClass('coachMarkContainer');
var $toolBarParent = $container.closest('.toolpane');
if ($toolBarParent.hasClass('toolpaneLeft') || $toolBarParent.hasClass('toolpaneRight')) {
$coachMark.addClass('vertical');
}
if (!this.placement) {
this.placement = 'right';
if ($toolBarParent.hasClass('toolpaneRight')) {
this.placement = 'left';
} else if ($toolBarParent.hasClass('toolpaneTop')) {
this.placement = 'bottom';
} else if ($toolBarParent.hasClass('toolpaneBottom')) {
this.placement = 'top';
}
}
var turnOffText = StringResources.get('coachMarkTurnOffHints');
var closeText = StringResources.get('coachMarkClose');
var sHtml = dot.template(CoachMarkPopover)({
'turnOffText': turnOffText,
'closeText': closeText
});
var popoverOptions = {
placement: this.placement,
trigger: 'manual',
container: 'body',
title: this.title || {},
content: this.contents || {},
template: sHtml,
sanitize: false
};
this.$popover = $coachMark.popover(popoverOptions);
var popoverClickListener = function (event) {
if (event.which === $.ui.keyCode.ESCAPE || $('.coachMarkPopover:visible').length === 1) {
this.$popover.popover('hide');
removeEventListener('blur', popoverBlurListener);
removeEventListener('touchstart', popoverClickListener, true);
removeEventListener('click', popoverClickListener, true);
removeEventListener('resize', popoverClickListener, true);
$('body').off('keydown');
var $clickOnCoachMark = $(event.target).closest('.coachMark');
if ($clickOnCoachMark.length !== 0 && containerId === $clickOnCoachMark.data('containerId')) {
event.stopPropagation();
}
} else if ($('.coachMarkPopover').length === 0 || $('.coachMarkPopover:hidden').length === 1) {
this.$popover.popover('show');
}
}.bind(this); // required for contained iFrames (report studio)
var popoverBlurListener = function () {
if (document.activeElement && $(document.activeElement).is('iframe')) {
this.$popover.popover('hide');
}
}.bind(this);
var escapeListener = function (event) {
if (event.which === $.ui.keyCode.ESCAPE) {
this.getLaunchPoint().focus();
popoverClickListener(event);
}
}.bind(this);
this.$popover.on('shown.bs.popover', function () {
var $coachMarkPopover = $('.coachMarkPopover');
$('.coachMarkTitle', $coachMarkPopover).attr('id', 'coachTitle');
$('.coachMarkText', $coachMarkPopover).attr('id', 'coachText');
$('.coachMarkClose', $coachMarkPopover).focus();
this.enableLooping($('.coachMarkContent', $coachMarkPopover));
$('.coachMarkClose', $coachMarkPopover).on('primaryaction', function (event) {
this.$popover.popover('hide');
var readId = this.$popover.data('containerId');
if (readId) {
this.persistence.marksAsRead(readId); // hide this coach mark in all open perspectives
$('.coachMark').filter(function () {
return $(this).data('containerId') === readId;
}).hide();
} else {
$(event.target).closest('.coachMarkPopover').hide();
}
}.bind(this));
$('.actionableLink a', $coachMarkPopover).on('primaryaction', function () {
var userProfile = this.glassContext.getCoreSvc('.UserProfile');
userProfile.preferences[CoachMark.PREFERENCES_KEY] = CoachMark.HIDE_ALL;
$('.coachMark').hide();
this.$popover.popover('hide');
var saveData = {};
saveData[CoachMark.PREFERENCES_KEY] = CoachMark.HIDE_ALL;
userProfile.savePreferences(saveData);
}.bind(this));
addEventListener('click', popoverClickListener, true);
addEventListener('resize', popoverClickListener, true);
addEventListener('touchstart', popoverClickListener, true);
addEventListener('blur', popoverBlurListener);
$('body').on('keydown', escapeListener);
}.bind(this));
this.$popover.on('hidden.bs.popover', function () {
removeEventListener('blur', popoverBlurListener);
removeEventListener('touchstart', popoverClickListener, true);
removeEventListener('click', popoverClickListener, true);
removeEventListener('resize', popoverClickListener, true);
$('body').off('keydown');
}.bind(this));
this.$popover.on('primaryaction', function (event) {
event.stopPropagation();
this.$popover.popover('show');
}.bind(this));
}
});
CoachMark.PREFERENCES_KEY = 'showHints';
CoachMark.HIDE_ALL = 'hideAll';
return CoachMark;
});
//# sourceMappingURL=CoachMark.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Glass
* (C) Copyright IBM Corp. 2015, 2018
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/CoachMarkPersistence',['../core-client/js/core-client/ui/core/Class', 'jquery'], function (Class, $) {
/**
* Implement Coach marks persistence functionality
* @private
*/
var CoachMarkPersistence = Class.extend({
init: function init(options) {
this.glassContext = options.glassContext;
},
isRead: function isRead(id) {
var _this = this;
var showHints = this.glassContext.getCoreSvc('.UserProfile').preferences.showHints;
if (showHints === 'hideAll') {
return Promise.resolve(true);
} else {
if (this._readCoachMarks === undefined) {
return this._getHints().then(function (json) {
_this._readCoachMarks = json;
return _this._readCoachMarks[id] === true;
}).catch(function (err) {
_this._readCoachMarks = {};
var jqXHR = err.jqXHR;
if (jqXHR && jqXHR.status === 404) {
return false;
} else {
_this.glassContext.getCoreSvc('.Logger').error('Internal error: Unable to read coach mark' + err.jqXHR.responseText);
throw err;
}
});
} else {
return Promise.resolve(this._readCoachMarks[id] === true);
}
}
},
marksAsRead: function marksAsRead(id) {
var _this2 = this;
if (this._readCoachMarks) {
this._readCoachMarks[id] = true;
var jsonData = JSON.stringify(this._readCoachMarks);
return this.glassContext.getCoreSvc('.Ajax').ajax({
url: CoachMarkPersistence.SERVICE_URL,
type: 'PUT',
'headers': {
'Content-Type': 'application/json'
},
data: jsonData
}).catch(function (err) {
_this2.glassContext.getCoreSvc('.Logger').error('Internal error: Update coach mark status failed: ' + err.jqXHR.responseText);
throw err;
});
}
},
reset: function reset() {
var _this3 = this;
this._readCoachMarks = undefined;
return this.glassContext.getCoreSvc('.Ajax').ajax({
url: CoachMarkPersistence.SERVICE_URL,
type: 'DELETE'
}).then(function () {
$('.coachMark').show();
}).catch(function (err) {
_this3.glassContext.getCoreSvc('.Logger').error('Internal error: unable to delete coach marks status: ' + err.jqXHR.responseText);
throw err;
});
},
// Don't issue multiple, concurrent requests for the same info...
_getHints: function _getHints() {
var _this4 = this;
if (!this._hintsRequest) {
this._hintsRequest = this.glassContext.getCoreSvc('.Ajax').ajax({
url: CoachMarkPersistence.SERVICE_URL,
type: 'GET',
headers: {
'Accept': 'application/json'
}
}).then(function (results) {
_this4._hintsRequest = null;
return results.data;
});
}
return this._hintsRequest;
}
});
CoachMarkPersistence.SERVICE_URL = 'v1/users/~/items/uihints';
return CoachMarkPersistence;
});
//# sourceMappingURL=CoachMarkPersistence.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2018
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/services/CoachMarkService',['../../core-client/js/core-client/ui/core/Events', '../CoachMark', '../CoachMarkPersistence'], function (Events, CoachMark, CoachMarkPersistence) {
var CoachMarkService = Events.extend({
init: function init(glassContext) {
CoachMarkService.inherited('init', this, arguments);
this.renderer = CoachMark;
this.glassContext = glassContext;
this.persistence = new CoachMarkPersistence({
glassContext: glassContext
});
},
setRenderer: function setRenderer(renderer) {
this.renderer = renderer;
},
setPersistence: function setPersistence(persistence) {
this.persistence = persistence;
},
getRenderer: function getRenderer() {
return this.renderer;
},
getPersistence: function getPersistence() {
return this.persistence;
},
isCoachMarkEnabled: function isCoachMarkEnabled() {
if (typeof this.persistence.isEnabled === 'function') {
return this.persistence.isEnabled().then(function (enabled) {
if (enabled === true) {
return true;
} else {
return false;
}
}).fail(function () {
return false;
});
} else {
return Promise.resolve();
}
},
disableCoachMarks: function disableCoachMarks() {
this.trigger('disable:all', {});
if (typeof this.persistence.disable === 'function') {
return this.persistence.disable().then(function () {
return true;
}).catch(function () {
return false;
});
} else {
return Promise.resolve();
}
},
enableAndRestart: function enableAndRestart() {
this.trigger('enable:restart', {});
if (typeof this.persistence.restart === 'function') {
return this.persistence.restart().then(function () {
return true;
}).catch(function () {
return false;
});
} else {
return Promise.resolve();
}
},
enableAndContinue: function enableAndContinue() {
this.trigger('enable:continue', {});
if (typeof this.persistence.restart === 'function') {
return this.persistence.restart().then(function () {
return true;
}).catch(function () {
return false;
});
} else {
return Promise.resolve();
}
}
});
return CoachMarkService;
});
//# sourceMappingURL=CoachMarkService.js.map
;
/*
* Licensed Materials - Property of IBM
*
* IBM Cognos Products: BI Glass
*
* (C) Copyright IBM Corp. 2015, 2016
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/RestUrls',[], function () {
var VERSION = 'v1';
var RestUrls = {
JSON_CONTENT_TYPE: 'application/json; charset=utf-8',
JSON_DATA_TYPE: 'json',
INSTALL_ENV: VERSION + '/configuration/keys/Glass/installMode',
SSO_URL: VERSION + '/ui/sso'
};
return RestUrls;
});
//# sourceMappingURL=RestUrls.js.map
;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
/**
* Licensed Materials - Property of IBM
*
* IBM Cognos Products: Glass
*
* Copyright IBM Corp. 2019
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/services/ConfigService',['jquery', 'underscore', '../RestUrls', '../../nls/StringResources'], function ($, _, restUrls, StringResources) {
/**
* This Class is a utility class to provide Config api for glass
* @public
*/
var ConfigService = /*#__PURE__*/function () {
function ConfigService(options) {
_classCallCheck(this, ConfigService);
$.extend(this, options);
this.CONTENTLOCALES = ConfigService.CONTENTLOCALES;
this.PRODUCTLOCALES = ConfigService.PRODUCTLOCALES;
this.TIMEZONES = ConfigService.TIMEZONES;
this.LEGACYLAUNCHABLE = ConfigService.LEGACYLAUNCHABLE;
}
/**
* Initialize the config service with values harvested from elsewhere...
* @public
* @param {Object} context - Config names and values
*/
_createClass(ConfigService, [{
key: "initialize",
value: function initialize(context) {
if (_.isObject(context)) {
_.extend(this, _.pick(context, ConfigService.CONTENTLOCALES, ConfigService.PRODUCTLOCALES, ConfigService.TIMEZONES, ConfigService.LEGACYLAUNCHABLE, ConfigService.DEFAULTHOME, ConfigService.DEFAULTLOGIN, ConfigService.PRODUCTVERSION, ConfigService.SSOINFO, ConfigService.PORTAL_PAGES, ConfigService.DATA_SERVICE_QUERY_SIZE, ConfigService.INSTRUMENTATION_CONFIG, ConfigService.DIGITAL_CONTEXT_ENABLED, ConfigService.CLIENT_VALID_DOMAIN_LIST, ConfigService.XSS_CHECKING, ConfigService.CONF_MAPBOX_TOKEN, ConfigService.CONF_MAPBOX_ACCOUNTNAME, ConfigService.CONF_MAPBOX_SECRETTOKEN, ConfigService.MAINTENANCE_MESSAGE, ConfigService.MAINTENANCE_LINK, ConfigService.DISABLE_WHATSNEWSERVICE, ConfigService.DISABLE_ALERTBANNER, ConfigService.DISABLE_GLOBALTOAST));
if (this[ConfigService.SSOINFO]) {
this._processSSOInfo(this[ConfigService.SSOINFO]);
}
if (this[ConfigService.CONTENTLOCALES]) {
try {
this[ConfigService.CONTENTLOCALES] = JSON.parse(this[ConfigService.CONTENTLOCALES]);
} catch (error) {
this.glassContext.getCoreSvc('.Logger').error('Error parsing supportContentLocales JSON', error);
this[ConfigService.CONTENTLOCALES] = undefined;
}
}
if (context.featureRules) {
try {
var featureRules = JSON.parse(context.featureRules);
this.glassContext.getCoreSvc('.FeatureChecker').addRules(featureRules);
} catch (err) {
this.glassContext.getCoreSvc('.Logger').error(err);
}
}
} else {
throw new Error('Invalid configuration context');
}
}
/**
* Sets config values based on passed in key.
* @public
* @param {string} key - The key for the config value. Try using static keys from this class.
* @param {string} data - The data to store.
* @return {Promise} result of ajax call to set config value.
*/
}, {
key: "setConfigValue",
value: function setConfigValue(key, data) {
var _this = this;
var configData = {};
configData[key] = _.isObject(data) ? JSON.stringify(data) : data;
return this.glassContext.getCoreSvc('.Ajax').ajax({
url: ConfigService.BASE_URL + ConfigService.GLOBAL,
type: 'PUT',
contentType: 'application/json',
data: JSON.stringify(configData)
}).then(function () {
_this[key] = data;
}).catch(function (err) {
var error = new Error(ConfigService.ERR_SET_CONFIG_VALUES);
error.msg = error.message;
error.causedBy = err;
throw error;
});
}
/**
* Retrieve product version for the current user. Always return a resolved promise.
* @public
* @return {Promise} promise resolved to either a Json object with user's product version or undefined.
*/
}, {
key: "getProductVersion",
value: function getProductVersion() {
return this.getConfigValue(ConfigService.PRODUCTVERSION);
}
/**
* Synchronously retrieve product version for the current user.
* @public
* @return {string} String with user's product version or undefined.
*/
}, {
key: "getVersion",
value: function getVersion() {
return this.getConfigValueSync(ConfigService.PRODUCTVERSION);
}
/**
* Retrieve content locales for the current user. Always returns a resolved promise.
* @public
* @return {Promise} promise resolved to either a Json object with user's content locales or undefined.
*/
}, {
key: "getContentLocales",
value: function getContentLocales() {
return this._getConfigList(ConfigService.CONTENTLOCALES, true);
}
/**
* Retrieve product locales for the current user. Always returns a resolved promise.
* @public
* @return {Promise} promise resolved to either a Json object with user's product locales or undefined.
*/
}, {
key: "getProductLocales",
value: function getProductLocales() {
return this._getConfigList(ConfigService.PRODUCTLOCALES, true);
}
/**
* Retrieve time zone for the current user. Always returns a resolved promise.
* @public
* @return {Promise} promise resolved to either a Json object with user's time zones or undefined.
*/
}, {
key: "getTimeZones",
value: function getTimeZones() {
return this._getConfigList(ConfigService.TIMEZONES, true);
}
/**
* Retrieve the system legacy launchable value. Always returns a resolved promise.
* @public
* @return {Promise} promise resolved to a value representing the legacy value or undefined.
*/
}, {
key: "getLegacyLaunchable",
value: function getLegacyLaunchable() {
return this._getConfigList(ConfigService.LEGACYLAUNCHABLE);
}
/**
* Retrieve the system legacy launchable value. Always returns a resolved promise.
* @public
* @return {Promise} promise resolved to a value representing the legacy value or undefined.
*/
}, {
key: "getDefaultHome",
value: function getDefaultHome() {
return this._getConfigList(ConfigService.DEFAULTHOME);
}
/**
* Retrieve the system legacy launchable value. Always returns a resolved promise.
* @public
* @return {Promise} promise resolved to a value representing the legacy value or undefined.
*/
}, {
key: "getDefaultLogin",
value: function getDefaultLogin() {
return this.getConfigValue(ConfigService.DEFAULTLOGIN);
}
/**
* Retrieve the Dataset Service URL Query Size. Always returns a resolved promise.
* @public
* @return {Promise} promise resolved to a value representing the dataset service URL query size or undefined.
*/
}, {
key: "getDatasetQuerySize",
value: function getDatasetQuerySize() {
return this.getConfigValue(ConfigService.DATA_SERVICE_QUERY_SIZE);
}
/**
* Retrieve the XSS Checking Flag
* @public
* @return Boolean value representing the XSS checking flag or undefined.
*/
}, {
key: "getXSSChecking",
value: function getXSSChecking() {
return this[ConfigService.XSS_CHECKING];
}
/**
* Asynchronous retrieval of a given configName
* @public
* @param {String} configName
* @param {boolean} isLocalized
* @return {Promise} result of ajax call to set config value.
*/
}, {
key: "getConfigValue",
value: function getConfigValue(configName, isLocalized) {
return this._getHelper(configName, isLocalized, false);
}
/**
* Synchronous retrieval of a given configName from
* @public
* @param {String} configName
* @return {String} resulting config string or empty object
*/
}, {
key: "getConfigValueSync",
value: function getConfigValueSync(configName) {
return this._getHelperSync(configName);
}
/**
* Get SSO urlLoginParameters
* @public
* @return {String} the parameters or undefined
*/
}, {
key: "getAllowedUrlLoginParameters",
value: function getAllowedUrlLoginParameters() {
return this._getSSOInfo().urlLoginParameters;
}
/**
* Get SSO login url
* @public
* @return {String} the login url or undefined
*/
}, {
key: "getSSOLoginURL",
value: function getSSOLoginURL() {
if (this[ConfigService.SSO_LOGIN]) return this[ConfigService.SSO_LOGIN];
return this._getSSOInfo().login;
}
/**
* Get SSO logout url
* @public
* @return {String} the logout url or undefined
*/
}, {
key: "getSSOLogoutURL",
value: function getSSOLogoutURL() {
if (this[ConfigService.SSO_LOGOUT]) return this[ConfigService.SSO_LOGOUT];
return this._getSSOInfo().logout;
}
}, {
key: "getInstrumentationConfig",
value: function getInstrumentationConfig() {
return this.getConfigValueSync(ConfigService.INSTRUMENTATION_CONFIG);
}
/**
* Get Digital Context Enabled Flag
*/
}, {
key: "isDigitalContextEnabled",
value: function isDigitalContextEnabled() {
return this.getConfigValueSync(ConfigService.DIGITAL_CONTEXT_ENABLED);
}
}, {
key: "_getConfigList",
value: function _getConfigList(configName, isLocalized) {
return this._getHelper(configName, isLocalized, true);
}
}, {
key: "_getSSOInfo",
value: function _getSSOInfo() {
return this.getConfigValueSync(ConfigService.SSOINFO) || {};
}
}, {
key: "_getHelper",
value: function _getHelper(configName, isLocalized, isJSON) {
var _this2 = this;
if (!_.isUndefined(this[configName])) {
return Promise.resolve(this[configName]);
} else {
var apiURL = ConfigService.BASE_URL + configName;
var ups = this.glassContext.getCoreSvc('.UserProfile');
if (isLocalized) {
apiURL += ups.preferences.productLocale;
}
return this.glassContext.getCoreSvc('.Ajax').ajax({
url: apiURL,
type: 'GET'
}).then(function (ajaxResultObj) {
var ajaxResult = ajaxResultObj.data;
try {
var ajaxKey = configName;
if (isLocalized) {
ajaxKey += ups.preferences.productLocale;
}
if (isJSON) {
ajaxResult = JSON.parse(ajaxResult[ajaxKey]);
} else {
ajaxResult = ajaxResult[ajaxKey];
}
if (!_.isUndefined(ajaxResult)) {
_this2[configName] = ajaxResult;
}
} catch (err) {
var message = '"' + err.message + '" encountered while parsing ' + configName;
_this2.glassContext.getCoreSvc('.Logger').error(message);
}
return _this2[configName];
}).catchReturn();
}
}
}, {
key: "_getHelperSync",
value: function _getHelperSync(configName) {
return this[configName];
}
}, {
key: "_getFormats",
value: function _getFormats() {
return {
'HTML': StringResources.get('html'),
'PDF': StringResources.get('pdf'),
'CSV': StringResources.get('csv'),
'spreadsheetML': StringResources.get('spreadsheetML'),
'xlsxData': StringResources.get('xlsxData')
};
}
}, {
key: "_getBaseTextDirections",
value: function _getBaseTextDirections() {
return {
'RTL': StringResources.get('rtl'),
'LTR': StringResources.get('ltr'),
'AUTO': StringResources.get('contextual')
};
}
}, {
key: "_getShowHints",
value: function _getShowHints() {
return {
'showAll': StringResources.get('showAll'),
'hideAll': StringResources.get('hideAll')
};
}
}, {
key: "clearConfigs",
value: function clearConfigs() {
this._contentLocales = undefined;
this._productLocales = undefined;
this._timeZoneIDs = undefined;
this._defaultHome = undefined;
}
}, {
key: "setSSOURL",
value: function setSSOURL() {
var _this3 = this;
if (this[ConfigService.SSOINFO]) {
return Promise.try(function () {
return _this3._processSSOInfo(_this3[ConfigService.SSOINFO]);
});
} else {
// TODO: Remove this when ssoInfo is injected by Entry page...
return this.glassContext.getCoreSvc('.Ajax').ajax({
url: restUrls.SSO_URL,
type: 'GET',
contentType: restUrls.JSON_CONTENT_TYPE,
dataType: restUrls.JSON_DATA_TYPE
}).then(function (results) {
var ssoData = results.data;
_this3[ConfigService.SSOINFO] = ssoData;
return _this3._processSSOInfo(ssoData);
}).catch(function (err) {
_this3.glassContext.getCoreSvc('.Logger').error('Internal error: set SSO URL failed: ' + err.jqXHR.responseText);
throw err;
});
}
}
}, {
key: "_processSSOInfo",
value: function _processSSOInfo(ssoInfo) {
if (ssoInfo && (ssoInfo.login || ssoInfo.logout)) {
$.ajaxSetup({
headers: {
'X-CA-SSO': this.glassContext.ajaxCodes.SSO
}
});
}
}
}]);
return ConfigService;
}();
ConfigService.BASE_URL = 'v1/configuration/keys/';
ConfigService.CONTENTLOCALES = 'supportedContentLocales_';
ConfigService.PRODUCTLOCALES = 'supportedProductLocales_';
ConfigService.TIMEZONES = 'timeZones_';
ConfigService.LEGACYLAUNCHABLE = 'Configuration.LegacyLaunchable';
ConfigService.SSOINFO = 'ssoInfo';
ConfigService.DEFAULTHOME = 'Glass.welcomePage';
ConfigService.DEFAULTLOGIN = 'Glass.loginPage';
ConfigService.PRODUCTVERSION = 'InstallService.productVersion';
ConfigService.DIGITAL_CONTEXT_ENABLED = 'Glass.digitalContextEnabled';
ConfigService.PORTAL_PAGES = 'ContentApps/enableMyPortalPages';
ConfigService.GLOBAL = 'global';
ConfigService.ERR_SET_CONFIG_VALUES = 'setConfigValue failed';
ConfigService.DATA_SERVICE_QUERY_SIZE = 'DatasetService/urlQuerySize';
ConfigService.INSTRUMENTATION_CONFIG = 'instrumentationConfig';
ConfigService.CLIENT_VALID_DOMAIN_LIST = 'ClientValidDomainList';
ConfigService.XSS_CHECKING = 'CAF.caf_tpXSSCheckingUsed';
ConfigService.CONF_MAPBOX_TOKEN = 'Mapbox.token';
ConfigService.CONF_MAPBOX_SECRETTOKEN = 'Mapbox.secretToken';
ConfigService.CONF_MAPBOX_ACCOUNTNAME = 'Mapbox.accountName';
ConfigService.MAINTENANCE_MESSAGE = 'Glass.maintenanceMessage';
ConfigService.MAINTENANCE_LINK = 'Glass.maintenanceLink';
ConfigService.DISABLE_WHATSNEWSERVICE = 'Glass.disableWhatsNewAlerts';
ConfigService.DISABLE_ALERTBANNER = 'Glass.disableAlertBanner';
ConfigService.DISABLE_GLOBALTOAST = 'Glass.disableGlobalToast';
ConfigService.SSO_LOGIN = 'Glass.sso_login';
ConfigService.SSO_LOGOUT = 'Glass.sso_logout';
return ConfigService;
});
//# sourceMappingURL=ConfigService.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Business Analytics (C) Copyright IBM Corp. 2017, 2018
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/services/ContextService',[], function () {
/**
* @constructs ContextService
* @classdesc This Class exposes the glass context
* @public
*/
var ContextService = function ContextService(opt) {
this.glassContext = opt.glassContext;
};
ContextService.prototype.get = function (key) {
return this.glassContext.getCoreSvc('.UserProfile')[key];
};
return ContextService;
});
//# sourceMappingURL=ContextService.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Business Analytics (C) Copyright IBM Corp. 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/services/EventsService',['../core-client/js/core-client/ui/core/Events'], function (Events) {
'use strict';
var EventsService;
EventsService = Events.extend({// nothing special here - for future use
});
return EventsService;
});
//# sourceMappingURL=EventsService.js.map
;
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
/**
* Licensed Materials - Property of IBM
* IBM Business Analytics (C) Copyright IBM Corp. 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/services/FeatureChecker',[], function () {
'use strict';
var isObject = function isObject(obj) {
return _typeof(obj) === 'object' && !Array.isArray(obj);
};
/**
* @constructor
*/
var FeatureChecker = function FeatureChecker(rules) {
this._rules = rules || {};
};
/**
* @param {Object} rules - object describing feature rules.
*/
FeatureChecker.prototype.setRules = function (rules) {
this._rules = rules;
};
/**
* @description Update feature rules
* @param {Object} rules - object describing feature rules.
*/
FeatureChecker.prototype.addRules = function (rules) {
if (isObject(rules)) {
Object.keys(rules).forEach(function (category) {
if (isObject(rules[category])) {
if (this._rules[category]) {
Object.keys(rules[category]).forEach(function (flag) {
this._rules[category][flag] = rules[category][flag];
}.bind(this));
} else {
// Category doesn't exist; Simply add it.
this._rules[category] = rules[category];
}
}
}.bind(this));
}
};
/**
* Checks value against expected;
* @param {string} category - ba-header associated with the flag. ie: 'ba-save', 'ba-share', etc...
* @param {string} flag - flag associated with category
* @param {string} expected - expected values
* @return {boolean} true if category.flag === expected; false otherwise.
*/
FeatureChecker.prototype.checkValue = function (category, flag, expected) {
var ret = false;
if (category && flag && this._rules[category] && this._rules[category][flag] !== undefined) {
ret = this._rules[category][flag] === expected;
}
return ret;
};
/**
* Gets the value of a rule
* @param {string} category - ba-header associated with the flag. ie: 'ba-save', 'ba-share', etc...
* @param {string} flag - flag associated with category
* @return {string} value of category.flag, or null;
*/
FeatureChecker.prototype.getFeatureFlag = function (category, flag) {
var ret = null;
if (category && flag && this._rules[category]) {
ret = this._rules[category][flag];
}
return ret;
};
/**
* Gets all rules associated with a category
* @param {string} category - ba-header associated with the flag. ie: 'ba-save', 'ba-share', etc...
* @return {Object} value of category.flag, or undefined;
*/
FeatureChecker.prototype.getFeatureFlags = function (category) {
return category ? this._rules[category] : null;
};
/**
* Serialize the rules
* @return {string} JSON/string
*/
FeatureChecker.prototype.toJSON = function () {
return JSON.stringify(this._rules);
};
return FeatureChecker;
});
//# sourceMappingURL=FeatureChecker.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BA
* (C) Copyright IBM Corp. 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/FeatureRules',[], function () {
// Default feature flag set for the ba-glass application.
// Format:
/*
return {
category: {
flag: 'value',
other: 'value'
}
};
*/
return {
'ba-glass': {
'stringOnlyQS': 'enabled'
}
};
});
//# sourceMappingURL=FeatureRules.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Glass
* (C) Copyright IBM Corp. 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule
* Contract with IBM Corp.
*/
define('baglass/app/services/FetchService',['jquery', '../../core-client/js/core-client/ui/core/Class', '../../ajax/AjaxErrorFactory'], function ($, Class, AjaxErrorFactory) {
/**
* This Class is a utility class to provide RESTFul APIs for Glass
*/
var FetchService = Class.extend(
/**
* @lends FetchService
*/
{
/**
* @classdesc Class Implementating the Ajax service returning a promise
* @constructs
* @public
* @param {Object} options - options
* @param {GlassContext} options.glassContext - glass context
*
*/
init: function init(options) {
$.extend(this, options);
},
/**
* Sends an ajax request with jquery
* @public
* @param {String} url - url
* @param {Object} [options] - Ajax options
* @param {String} [options.type=GET] - method to invokes
* @param {Object} [options.data] - data to send in case of POST or PUT
* @param {String} [options.contentType=application/x-www-form-urlencoded; charset=UTF-8] - type of data sent
* @param {String} [options.dataType] - type of expected data
* @return {Promise} promise with the returned data
* @throws {AjaxError|Error}
*
*/
sendBaseRequest: function sendBaseRequest(url, options) {
options = $.extend(true, {}, options, {
url: url
});
return this.glassContext.getCoreSvc('.Ajax').ajax(options).then(function (results) {
return {
data: results.data,
code: results.jqXHR.status
};
}).catch(function (error) {
var jqXHR = error.jqXHR;
throw AjaxErrorFactory.create(jqXHR, jqXHR.statusText, error);
});
},
/**
* Sends a request and handles errors; the latter is the difference with sentBaseError
* It also sends a notification request when the initial one is successful
* @public
* @param {String} url - url
* @param {Object} options - Ajax options
* @param {String} [options.type=GET] - method to invokes
* @param {Object} [options.data] - data to send in case of POST or PUT
* @param {String} [options.contentType=application/x-www-form-urlencoded; charset=UTF-8] - type of data sent
* @param {String} [options.dataType] - type of expected data
* @return {Promise} promise with the returned data
* @throws {AjaxError|Error}
*/
send: function send(url, options) {
return this.sendBaseRequest(url, options);
},
post: function post(url, options) {
var getOptions = $.extend(true, {}, options, {
type: 'POST'
});
return this.send(url, getOptions);
},
put: function put(url, options) {
var getOptions = $.extend(true, {}, options, {
type: 'PUT'
});
return this.send(url, getOptions);
},
delete: function _delete(url, options) {
var getOptions = $.extend(true, {}, options, {
type: 'DELETE'
});
return this.send(url, getOptions);
},
get: function get(url, options) {
var getOptions = $.extend(true, {}, options, {
type: 'GET'
});
return this.send(url, getOptions);
}
});
return FetchService;
});
//# sourceMappingURL=FetchService.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Glass
* (C) Copyright IBM Corp. 2015, 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule
* Contract with IBM Corp.
*/
define('baglass/app/services/AjaxService',['jquery', '../../core-client/js/core-client/ui/core/Class'], function ($, Class) {
/**
* This Class is a utility class to provide RESTFul APIs for Glass
*/
var AjaxService = Class.extend({
init: function init(options) {
$.extend(this, options); // Inject RESTFul methods to class
$.each(['get', 'put', 'post', 'delete'], function (i, method) {
AjaxService.prototype[method] = function (path, options) {
var _options = $.extend({}, options);
_options.type = method;
_options.url = path;
return this.ajax(_options);
};
});
},
ajax: function ajax(options) {
var dfd = $.Deferred();
this.glassContext.getCoreSvc('.Ajax').ajax(options).then(function (results) {
dfd.resolve(results.data, results.textStatus, results.jqXHR);
}).catch(function (error) {
dfd.reject(dfd, error.jqXHR, error.textStatus, error.errorThrown);
});
return dfd.promise();
}
});
return AjaxService;
});
//# sourceMappingURL=AjaxService.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI
* (C) Copyright IBM Corp. 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/services/LogService',[], function () {
var Logger = function Logger() {
this.logLevelEnum = {
'debug': 50,
'info': 40,
'warn': 30,
'error': 20
};
this._level = this.logLevelEnum.error;
this._active = true;
this.localStorageKeys = {
'isActive': 'com.ibm.ba.config.logging.isActive',
'level': 'com.ibm.ba.config.logging.level'
};
var loggingConfigActive = this._getLocalStorage(this.localStorageKeys.isActive);
if (loggingConfigActive !== null) {
if (typeof loggingConfigActive.toLowerCase === 'function' && loggingConfigActive.toLowerCase() === 'true') {
this._active = true;
} else {
this._active = false;
}
}
var loggingConfigLevel = this._getLocalStorage(this.localStorageKeys.level);
if (loggingConfigLevel !== null) {
this._level = loggingConfigLevel;
}
};
Logger.prototype.turnOnLogging = function () {
this._active = true;
};
Logger.prototype.turnOffLogging = function () {
this._active = false;
};
Logger.prototype.isActive = function () {
return this._active;
};
Logger.prototype.getLevel = function () {
return parseInt(this._level);
};
Logger.prototype.setLevelError = function () {
this._level = this.logLevelEnum['error'];
};
Logger.prototype.setLevelWarn = function () {
this._level = this.logLevelEnum['warn'];
};
Logger.prototype.setLevelInfo = function () {
this._level = this.logLevelEnum['info'];
};
Logger.prototype.setLevelDebug = function () {
this._level = this.logLevelEnum['debug'];
};
Logger.prototype.error = function () {
if (this._active && this._level >= this.logLevelEnum['error']) {
console.error.apply(console, this._addStack(arguments));
}
};
Logger.prototype.warn = function () {
if (this._active && this._level >= this.logLevelEnum['warn']) {
console.warn.apply(console, arguments);
}
};
Logger.prototype.info = function () {
if (this._active && this._level >= this.logLevelEnum['info']) {
console.info.apply(console, arguments);
}
};
Logger.prototype.debug = function () {
if (this._active && this._level >= this.logLevelEnum['debug']) {
console.debug.apply(console, arguments);
}
};
Logger.prototype.log = function () {
if (this._active) {
console.log.apply(console, arguments);
}
};
Logger.prototype.saveConfig = function (level, active) {
if (level !== undefined) {
this._level = level;
}
if (active !== undefined) {
this._active = active;
}
this._setLocalStorage(this.localStorageKeys.isActive, this._active ? 'true' : 'false');
this._setLocalStorage(this.localStorageKeys.level, this._level);
};
Logger.prototype._setLocalStorage = function (key, value) {
try {
window.localStorage.setItem(key, value);
} catch (err) {
console.error(err);
}
};
Logger.prototype._getLocalStorage = function (key) {
var ret = null;
try {
ret = window.localStorage.getItem(key) || null;
} catch (err) {
console.error(err);
}
return ret;
}; // create a dummy error so error.stack will be defined in IE
Logger.prototype._addStack = function () {
var args = Array.prototype.slice.call(arguments);
var stack = new Error().stack || '';
if (stack === '') {
try {
// eslint-disable-next-line
var x = y.name;
} catch (e) {
stack = e.stack;
}
}
stack = stack.split('\n').map(function (line) {
return line.trim();
});
var arr = stack.splice(stack[0] === 'Error' ? 2 : 1);
args.push({
stack: arr
});
return args;
};
return Logger;
});
//# sourceMappingURL=LogService.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI
* (C) Copyright IBM Corp. 2018
* US Government Users Restricted Rights - Use, duplication or disclosure
* restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/utils/RequestIdleCallback',[], function () {
// Polyfill requestIdleCallback for IE11
var TIMEOUT = 50;
var polyfill = {
requestIdleCallback: function requestIdleCallback(callback) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return setTimeout(function () {
callback();
}, Math.floor(Math.random() * (options.timeout || TIMEOUT)));
}
};
if (!window.requestIdleCallback) {
window.requestIdleCallback = polyfill.requestIdleCallback;
}
return polyfill;
});
//# sourceMappingURL=RequestIdleCallback.js.map
;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
/**
* Licensed Materials - Property of IBM
* IBM Business Analytics (C) Copyright IBM Corp. 2018
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/services/PrefetchService',['underscore', '../utils/RequestIdleCallback'], function (_) {
var TIMEOUT = 50;
/**
* @lends PrefetchService
**/
var PrefetchService = /*#__PURE__*/function () {
/**
* Contructor for PrefetchService
* @public
* @constructs PrefetchService
* @classdesc The PrefetchService is used to lazily fetch resources that
* are not needed now, but may be needed in the future. By prefetching
* these resources in the background while the browser is otherwise idle,
* the user will not experience the lag associated with fetching them on-demand.
* @param {Object} glassContext - glassContext
**/
function PrefetchService(glassContext) {
_classCallCheck(this, PrefetchService);
this._FETCHED = {};
this.glassContext = glassContext;
}
/**
* @public
* @description Fetches resources in a given array... one at a time and
* when the browser is idle.
* @param {Array} resources - List of file-paths to require.
* @returns {Promise} resolved when we have tried to prefetch all resources.
*/
_createClass(PrefetchService, [{
key: "prefetchResources",
value: function prefetchResources(resources) {
var _this = this;
var chain = Promise.resolve();
if (_.isArray(resources)) {
resources.forEach(function (resource) {
if (_.isString(resource)) {
if (!_this._FETCHED[resource]) {
chain = chain.then(_this._requireResource.bind(_this, resource));
}
} else {
_this.glassContext.getCoreSvc('.Logger').warn("Resource ".concat(JSON.stringify(resource), " is not a string..."));
}
});
} else {
this.glassContext.getCoreSvc('.Logger').warn("Parameter ".concat(JSON.stringify(resources), " is not an array..."));
}
return chain;
}
}, {
key: "_requireResource",
value: function _requireResource(resource) {
var _this2 = this;
this._FETCHED[resource] = true;
return new Promise(function (resolve) {
window.requestIdleCallback(function () {
require([resource], resolve, function (err) {
_this2.glassContext.getCoreSvc('.Logger').warn("Failed to prefetch resource at path: ".concat(resource), err);
resolve();
});
}, {
timeout: TIMEOUT
});
});
}
}]);
return PrefetchService;
}();
return PrefetchService;
});
//# sourceMappingURL=PrefetchService.js.map
;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
/**
* Licensed Materials - Property of IBM
* IBM Business Analytics (C) Copyright IBM Corp. 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/services/ServiceRegistry',[], function () {
var DEFAULT_TIMEOUT = 30000;
var ServiceRegistry = /*#__PURE__*/function () {
/**
* Constructor
*
* Options allow injecting different implementations (helps with unit testing)
*
* Registry contains a map of services. Some services can be pre-populated at construction time.
* Others will be fetched when someone needs access to the service.
*
* @param options
* options.services map of pre-setup services
*/
function ServiceRegistry(options) {
_classCallCheck(this, ServiceRegistry);
this.services = options.services || {}; //pre-setup services
this.deprecated = {};
this._waitList = {};
this._declared = {};
}
/**
* get service from registry, follows async model Services can be lazy
* loaded
*
* @param {string } name of service to retrieve
* @param {number} [timeout] timeout value in ms
* @return {promise} resolved with service on success, rejected with error on failure
*/
_createClass(ServiceRegistry, [{
key: "getSvc",
value: function getSvc(name, timeout) {
var _this = this;
return new Promise(function (resolve, reject) {
try {
_this._get(name, resolve, reject, timeout);
} catch (err) {
reject(err);
}
});
}
/**
* @description Get service from registry synchronously. Avoid if possible and use Promise-based async/API.
* @throws if service is not found.
*
* @param {string } name - name of service to retrieve
* @return {object} the service
*/
}, {
key: "getSvcSync",
value: function getSvcSync(name) {
if (this.services[name]) {
return this.services[name];
}
throw new Error('Service "' + name + '" has not been registered');
}
/**
* get service from registry, follows async model Services can be lazy
* loaded
* @deprecated
* @param {string } name of service to retrieve
* @param {function} callback
* callback function invoked on service becoming available
* service obj is passed to the callback. Using this simpler
* model instead of jQuery Deferred objects to avoid
* dependency on jQuery
* @param {function} [errcb]
* Error callback, called if we are not able to get the service and timeout occurs
* @param {number} [timeout]
* timeout value in ms
*/
}, {
key: "get",
value: function get(name, callback, errcb, timeout) {
this._get(name, callback, errcb, timeout);
}
}, {
key: "exists",
value: function exists(name) {
return !!(name && this.services[name]);
}
/**
* @description Destroys an existing service and removes it from the registry.
* If the service was declared, but not registered, it is removed from the
* declared list as well.
*/
}, {
key: "deregister",
value: function deregister(name) {
if (this._declared[name]) {
delete this._declared[name];
}
if (this.exists(name)) {
if (typeof this.services[name].destroy === 'function') {
this.services[name].destroy();
}
delete this.services[name];
this._cleanupWaitList(name);
}
}
/**
* @description Declares a service that will be loaded when required.
* @param {String} name - the service name
* @param {String} modulePath - the path to the module to be loaded
* @param {Object} initializeWith - (optional) An object to be passed to the services' initialize function
*/
}, {
key: "declare",
value: function declare(name, modulePath, initializeWith) {
if (!name) {
throw new Error('Illegal service declaration: name missing');
}
if (!modulePath) {
throw new Error('Illegal service declaration: modulePath missing');
}
if (!this.exists(name)) {
if (this._declared[name] && this._declared[name].modulePath !== modulePath) {
throw new Error('Illegal service declaration. Attempted to re-declare a service with a different module path');
} else {
this._declared[name] = {
modulePath: modulePath,
initializeWith: initializeWith
};
if (this._waitList[name]) {
this._loadDeclaredService(name);
}
}
}
}
}, {
key: "declared",
value: function declared(name) {
return !!this._declared[name];
}
}, {
key: "_get",
value: function _get(name, callback, errcb, timeout) {
var _this2 = this;
var cb = function cb(svc) {
if (_this2.deprecated[name]) {
console.warn('The service \'' + name + '\' has been deprecated.');
if (_this2.deprecated[name]._replacedBy) {
console.info('The service \'' + name + '\' has been replaced by \'' + svc.replacedBy + '\'.');
}
}
if (callback) {
callback(svc);
}
};
if (!this.services[name]) {
if (name[0] === '.' || timeout) {
if (this._declared[name]) {
this._loadDeclaredService(name).then(cb);
} else {
//any service name that starts with . will be treated as an object that will be registered
//this is so that we don't do a require to fetch the service
//a timeout value is associated so that consumers don't wait endlessly
this._waitForRegister(name, cb, errcb, timeout || DEFAULT_TIMEOUT);
}
} else {
this._loadServiceByModuleName(name, cb, errcb);
}
} else {
cb(this.services[name]);
}
}
/**
* @deprecated Legacy behaviour; Not sure if this is ever used...
* @description Services with names not starting with '.' are assumed to
* be module paths. As a last-ditch effort, we attempt to require and
* construct the service here.
*/
}, {
key: "_loadServiceByModuleName",
value: function _loadServiceByModuleName(name, cb, errcb) {
var _this3 = this;
require([name], function (Service) {
if (!_this3.services[name]) {
// The service may have been registered while we were waiting for the requirejs/callback
_this3.register(name, new Service());
}
cb(_this3.services[name]);
}, function (err) {
var msg = 'Service module: \'' + name + '\' not found.';
if (errcb) {
var error = new Error(msg);
error.causedBy = err;
errcb(error);
} else {
console.error(msg);
}
});
}
}, {
key: "_loadDeclaredService",
value: function _loadDeclaredService(name) {
var _this4 = this;
var modulePath = this._declared[name].modulePath;
var initArg = this._declared[name].initializeWith;
delete this._declared[name];
return new Promise(function (resolve, reject) {
require([modulePath], function (Service) {
try {
if (!_this4.services[name]) {
// The service may have been registered while we were waiting for the requirejs/callback
var svc = new Service();
Promise.resolve().then(function () {
if (typeof svc.initialize === 'function') {
return svc.initialize(initArg);
}
}).then(function () {
_this4.register(name, svc);
resolve(svc);
});
} else {
resolve(_this4.services[name]);
}
} catch (err) {
reject(err);
}
}, reject);
});
}
}, {
key: "_waitForRegister",
value: function _waitForRegister(name, cb, errcb, timeout) {
var list = this._waitList[name] || [];
var timer = setTimeout(this._signalRegisterFailure.bind(this, name, cb, errcb), timeout);
list.push({
cb: cb,
errcb: errcb,
timer: timer
});
this._waitList[name] = list;
}
}, {
key: "_signalRegisterFailure",
value: function _signalRegisterFailure(name, cb, errcb) {
var list = this._waitList[name] || [];
for (var i = list.length - 1; i >= 0; i--) {
if (list[i].cb === cb) {
list.splice(i, 1);
}
}
this._waitList[name] = list;
var error = new Error('Service: \'' + name + '\' not found.');
if (errcb) {
errcb(error);
} else {
console.error(error);
}
}
}, {
key: "register",
value: function register(name, oSvc, options) {
var _this5 = this;
if (name && oSvc) {
var service = oSvc;
service._registry = this; //allow service to invoke other services
if (options && options.deprecated) {
this.deprecated[name] = {};
}
if (options && options.replacedBy) {
this.deprecated[name]._replacedBy = options.replacedBy;
}
if (this._declared[name]) {
delete this._declared[name];
}
if (typeof service.__initialize === 'function') {
Promise.resolve(service.__initialize()).then(function () {
_this5.services[name] = oSvc;
_this5._notifyWaitingConsumers(name, oSvc);
});
} else {
this.services[name] = oSvc;
this._notifyWaitingConsumers(name, oSvc);
}
}
}
}, {
key: "_notifyWaitingConsumers",
value: function _notifyWaitingConsumers(name, oSvc) {
var list = this._waitList[name] || [];
for (var i = 0; i < list.length; i++) {
var fn = list[i].cb;
if (list[i].timer) {
clearTimeout(list[i].timer);
}
fn(oSvc);
}
this._waitList[name] = [];
}
}, {
key: "_cleanupWaitList",
value: function _cleanupWaitList(name) {
var list = this._waitList[name] || [];
for (var i = list.length - 1; i >= 0; i--) {
if (list[i].timer) {
clearTimeout(list[i].timer);
}
}
this._waitList[name] = [];
}
}, {
key: "destroy",
value: function destroy() {
Object.keys(this.services).forEach(this.deregister.bind(this));
}
}]);
return ServiceRegistry;
}();
return ServiceRegistry;
});
//# sourceMappingURL=ServiceRegistry.js.map
;
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Glass
* (C) Copyright IBM Corp. 2015, 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/services/UserProfileService',['../../core-client/js/core-client/ui/core/Class', 'underscore'], function (Class, _) {
/**
* This Class exposes a javascript API for the userProfile REST service
*/
var UserProfileService = Class.extend({
init: function init(options) {
this.preferences = {};
_.extend(this, options);
},
updateContext: function updateContext(profile) {
_.extend(this, profile);
return Promise.resolve();
},
/* Get Methods */
getHomePagePref: function getHomePagePref() {
if (_typeof(this.preferences) != undefined) {
if (this.preferences.hasOwnProperty('homePage')) {
return this.preferences.homePage;
} else {
return null;
}
} else {
return null;
}
}
});
return UserProfileService;
});
//# sourceMappingURL=UserProfileService.js.map
;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: Glass
* (C) Copyright IBM Corp. 2022
* US Government Users Restricted Rights - Use, duplication or disclosure
* restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/services/WindowProxyService',['baglass/nls/StringResources'], function (StringResources) {
function _throwError(proxyService, url, isRemote) {
if (proxyService.config && proxyService.config.dialog) {
var callback = function callback(evt) {
if (evt.btn === 'ok') {
proxyService.context.close().then(function () {
proxyService.window.location.assign(proxyService.window.location.origin, isRemote);
});
}
};
proxyService.context.appController.showMessage(StringResources.get('invalidUrl'), StringResources.get('cannotOpenLocation'), 'error', ['ok', 'cancel'], 'small', callback, true, 'LocationDialog');
}
throw new Error('Invalid redirect detected: ' + url);
}
function _validateUrl(proxyService, targetUrl, isRemote) {
var _proxyService$context, _proxyService$context4;
/**
* check a redirect url against a reference one;
* related to https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
* */
var args = ["url: ".concat(targetUrl), "isRemote: ".concat(isRemote)];
(_proxyService$context = proxyService.context.getCoreSvc('.Logger')).debug.apply(_proxyService$context, ["validating url:"].concat(args));
var fromUrlObj = proxyService.window.location;
if (targetUrl) {
try {
var invalidCharsRE = /[^ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%\-._~:/?#[\]@!$&'()*+,;= ]/;
var hasJsRE = /javascript:|data:/;
var url = targetUrl.toString().toLowerCase().trim();
var hasInvalidCharacters = invalidCharsRE.exec(url) === null ? false : true;
var hasJs = hasJsRE.exec(url) === null ? false : true;
var hasFile = url.startsWith('//');
var targetUrlObj = document.createElement('a');
targetUrlObj.href = url;
var hasProtocol = targetUrlObj.protocol && targetUrlObj.protocol.startsWith('http');
var isValidURL = hasProtocol && !hasInvalidCharacters && !hasJs && !hasFile;
if (isValidURL && isRemote !== true) {
isValidURL = targetUrlObj.protocol === fromUrlObj.protocol && targetUrlObj.hostname === fromUrlObj.hostname && targetUrlObj.port === fromUrlObj.port;
}
if (isValidURL) {
var _proxyService$context2;
(_proxyService$context2 = proxyService.context.getCoreSvc('.Logger')).debug.apply(_proxyService$context2, ["Url validation success:"].concat(args));
return true;
}
} catch (e) {
var _proxyService$context3;
(_proxyService$context3 = proxyService.context.getCoreSvc('.Logger')).error.apply(_proxyService$context3, ['Url validation error:'].concat(args, [e]));
}
}
(_proxyService$context4 = proxyService.context.getCoreSvc('.Logger')).error.apply(_proxyService$context4, ["Url validation failed:"].concat(args));
return false;
}
function _assign(url, isRemote) {
this.context.getCoreSvc('.Logger').info('Navigating to:', "url: ".concat(url), "isRemote: ".concat(isRemote));
if (_validateUrl(this, url, isRemote)) {
return this.window.location.assign(url);
} else {
_throwError(this, url, isRemote);
}
}
function _replace(url, isRemote) {
this.context.getCoreSvc('.Logger').info('Navigating to:', "url: ".concat(url), "isRemote: ".concat(isRemote));
if (_validateUrl(this, url, isRemote)) {
return this.window.location.replace(url);
} else {
_throwError(this, url, isRemote);
}
}
function _reload() {
this.context.getCoreSvc('.Logger').debug('reloading page...');
return this.window.location.reload();
}
/*
Provides a standard means of tracking and validating programatic browser window location operations
by wrapping browser Window object.
*/
var WindowProxyService = /*#__PURE__*/function () {
function WindowProxyService() {
var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var nativeWindow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window;
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
dialog: false
};
_classCallCheck(this, WindowProxyService);
this.context = context;
this.config = config;
this.window = nativeWindow;
if (nativeWindow.Proxy) {
this.proxyWindow = this.proxy(nativeWindow);
this.context.window = this.proxyWindow;
} else {
this.context.getCoreSvc('.Logger').debug('Unable to initialize WindowProxyService. Unsupported browser.');
}
}
/*
* returns a new Window proxy for the supplied Window object
* @param {Object} nativeWindow - a browser window
*/
_createClass(WindowProxyService, [{
key: "proxy",
value: function proxy(nativeWindow) {
var _this = this;
this.context.getCoreSvc('.Logger').debug('Creating a new Window Proxy service for', nativeWindow);
var _location = Object.fromEntries(Object.entries(nativeWindow.location));
_location.assign = _assign.bind(this);
_location.reload = _reload.bind(this);
_location.replace = _replace.bind(this);
_location.toString = nativeWindow.location.toString.bind(nativeWindow.location);
var locationProxy = new Proxy(_location, {
set: function set(target, key, value) {
var urlAttributes = ['href', 'protocol', 'host', 'hostname', 'port', 'pathname', 'search', 'hash', 'origin'];
_this.context.getCoreSvc('.Logger').info("Setting window.location object '".concat(key, "' to ").concat(value, "..."));
if (urlAttributes.includes(key)) {
var _target = new window.URL(target.href);
try {
_target[key] = value;
if (_validateUrl(_this, _target.href)) {
nativeWindow.location[key] = value;
} else {
throw new Error();
}
} catch (e) {
_this.context.getCoreSvc('.Logger').error("Error setting window.location object '".concat(key, "' to ").concat(value, "."));
_throwError(_this, target.href);
}
} else {
nativeWindow.location[key] = value;
}
return true;
}
});
var windowProxy = new Proxy(nativeWindow, {
set: function set(target, key, value) {
_this.context.getCoreSvc('.Logger').info("Setting window object '".concat(key, "' to ").concat(value, "..."));
if (key === 'location') {
if (_validateUrl(_this, value)) {
nativeWindow.location = value;
} else {
_throwError(_this, value);
}
} else {
target[key] = value;
}
return true;
},
get: function get(target, key) {
return key === 'location' ? locationProxy : nativeWindow[key] instanceof Function ? nativeWindow[key].bind(nativeWindow) : nativeWindow[key];
}
});
return windowProxy;
}
}]);
return WindowProxyService;
}();
return WindowProxyService;
});
//# sourceMappingURL=WindowProxyService.js.map
;
/*
* Licensed Materials - Property of IBM
*
* IBM Cognos Products: BI
*
* (C) Copyright IBM Corp. 2015, 2019
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/common/ui/SlideoutController',['../../core-client/js/core-client/ui/core/Events', 'jquery', 'underscore', './SlideoutRegistry', '../../core-client/js/core-client/ui/Slideout'], function (Events, $, _, SlideoutRegistry, Slideout) {
/**
* Finds the open slideout
*/
var _findOpenSlideout = function _findOpenSlideout(position) {
var openSlideout = this.registry.application.getOpenSlideout(position);
if (!openSlideout) {
openSlideout = this.registry.appView.getOpenSlideout(position);
}
return openSlideout;
};
/**
* Creates the slideout or takes the passed one
* Verifies if it is already registered
* @param {String} sceop - requested scope
* @param {object|Slideout} slideout - slideout or object defining the slideout to open
* @return {object} object with the slideout to open and the right scope if it is registered
*/
var _createSlideoutToOpen = function _createSlideoutToOpen(scope, slideout) {
var newSlideout;
var realScope = scope;
if (Slideout.prototype.isPrototypeOf(slideout)) {
newSlideout = slideout;
} else {
newSlideout = new Slideout(slideout);
}
var registered = this.registry.application.getRegisteredSlideout(newSlideout.getRootId());
if (registered) {
realScope = 'application';
} else {
registered = this.registry.appView.getRegisteredSlideout(newSlideout.getRootId());
if (registered) {
realScope = 'appView';
}
}
if (registered && registered !== newSlideout.getRootParent()) {
newSlideout = registered;
}
return {
slideout: newSlideout,
scope: realScope
};
};
var _openSlideoutCount = 0;
var _openPerspectiveViewSlideoutCount = 0;
var _onSlideoutHide = function _onSlideoutHide(scope) {
if (scope === 'application') {
_openSlideoutCount = Math.max(0, _openSlideoutCount - 1);
} else if (scope === 'appView') {
_openPerspectiveViewSlideoutCount = Math.max(0, _openPerspectiveViewSlideoutCount - 1);
}
if (_openSlideoutCount === 0) {
$('body').removeClass('openedSlideout');
}
if (_openPerspectiveViewSlideoutCount === 0) {
$('body').removeClass('openedAppViewSlideout');
}
};
/**
* @public
*/
var Controller = Events.extend(
/**
* @lends Controller.prototype
*/
{
/**
* @classdesc Class Controlling the application & appView registries, see {SlideoutRegitry}
* @constructs
* @public
* @param {object} options - Init properties
* @param {object} options.registry - Object containing the application and appView registries
* @param {SlideoutRegistry} options.registry.application - Registry for the application
* @param {SlideoutRegistry} options.registry.appView - Registry for the appView
* application & application.appView
*/
init: function init(options) {
Controller.inherited('init', this, arguments);
$.extend(this, options);
_openPerspectiveViewSlideoutCount = 0;
},
/**
* Opens a slideout in a given scope; Hides the one that is potentially already open
* @param {String} scope - application or appView
* @param {object|Slideout} - slideout to open defined as an object or an instance
* @return {Slideout} the open slideout
* @thorw Error when the scope or the slideout position is invalid
*/
openSlideout: function openSlideout(scope, slideout) {
var reusedSlideout = this._checkForSlideoutInstanceReuse(scope, slideout);
if (reusedSlideout) {
return reusedSlideout;
}
var slideoutToOpen = _createSlideoutToOpen.call(this, scope, slideout);
var openSlideout = _findOpenSlideout.call(this, slideoutToOpen.slideout.position);
if (scope === 'application') {
_openSlideoutCount++;
$('body').addClass('openedSlideout');
} else if (scope === 'appView') {
_openPerspectiveViewSlideoutCount++;
$('body').addClass('openedAppViewSlideout');
}
if (openSlideout) {
openSlideout.hide({
hideOnly: openSlideout.hideOnly,
force: true
}).done(function () {
this.registry[slideoutToOpen.scope].openSlideout(slideoutToOpen.slideout);
this._checkNavBarButtons(slideoutToOpen);
}.bind(this));
} else {
this.registry[slideoutToOpen.scope].openSlideout(slideoutToOpen.slideout);
this._checkNavBarButtons(slideoutToOpen);
} // introduced a new class for appView, so now we need to remove the class from the body on hide of the slideout
// the handler needs to be triggered for appView now, but we don't want to remove/add the handle when the reuseSlideout flag is set
if (!slideout.reuseSlideout) {
slideoutToOpen.slideout.off('hide', null, 'slideoutHideHandler');
slideoutToOpen.slideout.on('hide', _onSlideoutHide.bind(this, scope), 'slideoutHideHandler');
}
return slideoutToOpen.slideout;
},
/**
* Check for an opened "appView" slideout that matches the new slideout id.
* When we have an appView slideout that is already open with the same id, then we will reuse the slideout instance
* This reused slideout is only enabled when the slidepout option "reuseSlideout=true" is used.
* @param {String} scope - application or appView
* @param {object|Slideout} - slideout to open defined as an object or an instance
* @return {Slideout} the open slideout or null if there is no match
*/
_checkForSlideoutInstanceReuse: function _checkForSlideoutInstanceReuse(scope, slideout) {
var id = slideout.id; // when we have an appView slideout that is already open with the same id,
// and "reuseSlideout" is true, then we will reuse the slideout instance
var appViewOpenedSlideout = this.registry.appView.getOpenSlideout(slideout.position);
if (appViewOpenedSlideout && scope === 'appView' && id === appViewOpenedSlideout.id && slideout.reuseSlideout) {
appViewOpenedSlideout.trigger('hide');
appViewOpenedSlideout.off();
appViewOpenedSlideout.setContent(slideout.content);
this.registry[scope].openSlideout(appViewOpenedSlideout); // appViewOpenedSlideout.getWidth()) {
appViewOpenedSlideout.setWidth(minWidth);
} // This seems to be called when a slideout is open, so we call it here just to be consistent.
this._checkNavBarButtons({
scope: scope,
slideout: appViewOpenedSlideout
});
return appViewOpenedSlideout;
}
return null;
},
_checkNavBarButtons: function _checkNavBarButtons(slideoutToOpen) {
if (slideoutToOpen.slideout.content) {
var buttonId = null;
if (slideoutToOpen.slideout.content.module.indexOf('bi/content_apps/MyContent') !== -1) {
buttonId = 'com.ibm.bi.contentApps.myContentFoldersSlideout';
} else if (slideoutToOpen.slideout.content.module.indexOf('bi/content_apps/TeamFolders') !== -1) {
buttonId = 'com.ibm.bi.contentApps.teamFoldersSlideout';
}
if (buttonId && slideoutToOpen.slideout.glassContext) {
var plugin = slideoutToOpen.slideout.glassContext.findPlugin(buttonId);
plugin.setPressed();
slideoutToOpen.slideout.on('hide', plugin.setUnpressed.bind(plugin));
}
}
},
/**
* Updates the containers of the registry
* @param $container
*/
updateRegistryContainer: function updateRegistryContainer($container) {
this.registry.application.changeContainer($container);
if (!this.registry.appView.getContainer()) {
this.registry.appView.changeContainer($container);
}
},
cleanupSlideoutRegistry: function cleanupSlideoutRegistry() {
this.registry.application.cleanupSlideouts();
this.registry.appView.cleanupSlideouts();
},
/**
* Closes all opened slide outs
*
* @return {promise} A promise resolved to true after all sliders are closed
*/
closeAllOpenedSlideouts: function closeAllOpenedSlideouts() {
var excludeAppViewSlideouts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
var promises = [];
var slideoutsToClose = this.registry.application.getOpenSlideouts();
if (!excludeAppViewSlideouts) {
slideoutsToClose = slideoutsToClose.concat(this.registry.appView.getOpenSlideouts());
}
slideoutsToClose.forEach(function (slideout) {
promises.push(slideout.hide({
force: true,
hideOnly: slideout.hideOnly
}));
});
return Promise.all(promises).then(function () {
return true;
});
}
});
return Controller;
});
//# sourceMappingURL=SlideoutController.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI
* (C) Copyright IBM Corp. 2018
* US Government Users Restricted Rights - Use, duplication or disclosure
* restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/AppEvents',[], function () {
var appViewEvent = function appViewEvent(suffix) {
return suffix ? 'appView' + suffix : 'appview';
};
return Object.freeze({
APPVIEW: appViewEvent(),
APPVIEW_LOADED: appViewEvent(':loaded')
});
});
//# sourceMappingURL=AppEvents.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI
* (C) Copyright IBM Corp. 2015, 2018
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/plugins/GlassPlugin',['../../core-client/js/core-client/ui/core/Class', '../../core-client/js/core-client/utils/Utils', '../../core-client/js/core-client/utils/ClassFactory', 'jquery', 'underscore', '../../utils/Utils', '../AppEvents'], function (Class, Utils, ClassFactory, $, _, GlassUtils, AppEvents) {
/**
*
* @public
*/
var GlassPlugin = Class.extend(
/**
* @lends GlassPlugin.prototype
*/
{
/**
* @constructs
* @classdesc This Class acts as a base class for the GlassPlugin API interface Glass Plugins should implement all public methods in this base class.
* Abstract methods need to be implemented.
* @public
* @param {Object} options - Option with itemSpec and glassContext
*
*/
init: function init(options) {
$.extend(true, this, options);
this.itemSpec = this.itemSpec || {};
this.$el = $('
');
GlassUtils.errorProtect(this, ['render', 'show', 'hide', 'changeLabel']);
},
/**
* Gets the container element of the plugin.
* @public
* @returns {Object} dom element shown in the perspective
*/
getRootElement: function getRootElement() {
return this.$el;
},
/**
* Render the plugin.
* @public
* @virtual
* @returns (Deferred) the returned value is the dom element
*/
render: function render() {
this.$el.text(_.unescape(this.itemSpec.label));
this._addClass(this.$el, this.itemSpec['class']);
this._setIcon(this.$el);
this.registerOneTimeCallback(AppEvents.APPVIEW_LOADED);
return Promise.resolve(this.$el.get()[0]);
},
/**
* Remove the plugin from it's container.
*/
remove: function remove() {
this.$el.remove();
},
/**
* attaches the event callbacks using the defined actionController
* @protected
*
*/
attachActionControllerCallbacks: function attachActionControllerCallbacks() {
console.debug('attachActionControllerCallbacks not implemented');
},
/**
* Enables the plugin
* @public
*/
enable: function enable() {
this._getContainer().removeClass('disabled');
this._getContainer().children().attr('tabindex', '0');
},
/**
* Disables the plugin
* @public
*/
disable: function disable() {
this._getContainer().addClass('disabled');
this._getContainer().children().attr('tabindex', '-1');
},
/**
* Makes the plugin visible
* @public
*/
show: function show() {
this._getContainer().show();
},
/**
* Hides the plugin
* @public
*/
hide: function hide() {
this._getContainer().hide();
},
/**
* returns the instance of the associated controller
* @protected
* @return {Promise} always resolved with the instance of the controller
*/
getController: function getController() {
var _this = this;
if (!this._loadingController) {
if (this.itemSpec.actionController) {
if (!_.isString(this.itemSpec.actionController)) {
this._loadingController = Promise.reject(new Error('actionController is not a string'));
} else {
this._loadingController = ClassFactory.instantiate(this.itemSpec.actionController.trim()).then(function (controller) {
_this._controller = controller;
if (_.isFunction(_this._controller.initialize)) {
return _this._controller.initialize({
glassContext: _this.glassContext,
target: {
plugin: _this,
itemId: _this.itemSpec.id
}
});
}
}).then(function () {
return _this._controller;
});
}
} else {
this._loadingController = Promise.resolve(this._controller);
}
}
return this._loadingController;
},
/**
* shows coachmark when defines.
* @protected
* @return {Promise} when resolved returns a boolean set to false when no coachMark is shown, true otherwise
*/
showCoachMark: function showCoachMark() {
var _this2 = this;
return new Promise(function (resolve) {
var coachMarkservice = _this2.glassContext.getCoreSvc('.CoachMarkService');
var Renderer = coachMarkservice.getRenderer();
var persistence = coachMarkservice.getPersistence();
var containerId = _this2.itemSpec.id + 'PluginContainer';
resolve(persistence.isRead(containerId).then(function (isRead) {
var coachMarkSpec = {};
$.extend(coachMarkSpec, _this2.itemSpec.coachMark);
return _this2.getController().then(function (controller) {
var shown = false;
if (_.isFunction(controller.getCoachMarkSpec)) {
var eventContext = {
glassContext: _this2.glassContext,
target: {
coachMark: coachMarkSpec,
itemId: _this2.itemSpec.id
}
};
coachMarkSpec = controller.getCoachMarkSpec(eventContext) || coachMarkSpec;
}
if (!_.isEmpty(coachMarkSpec)) {
_this2.glassContext.addToOptions(coachMarkSpec);
_this2.coachMark = new Renderer(coachMarkSpec);
shown = _this2._getContainer().hasClass('disabled') ? false : !isRead;
_this2.coachMark.render(_this2._getContainer(), shown);
}
return shown;
});
}));
});
},
_getContainer: function _getContainer() {
return this.$container;
},
/**
* Changes the label of the plugin; Label remains unchanged if the passed label is undefined
* @virtual
* @public
* @param {String} label new label
*/
changeLabel: function changeLabel(label) {
console.info('GlassPlugin.changeLabel no implemented - passed label is: ' + label);
},
/**
* Changes the icon of the plugin; icon remains unchanged if the passed icon is undefined.
* @virtual
* @public
* @param {String} icon The icon to insert. Can be a web font, an image URL or an svg sprite reference.
* @param {String} iconTooltip The tooltip to use for this icon, if specified
* @param {String} ariaLabel The value to use for aria-label or alt attributes. If not specified, defaults to iconTooltip
*/
changeIcon: function changeIcon(icon, iconTooltip, ariaLabel) {
if (icon) {
this.$el.find('svg.svgIcon, img, span.webfont').first().remove();
Utils.setIcon(this.$el, icon, iconTooltip, ariaLabel);
} else {
console.warn('Invalid plugin icon. Icon unchanged.');
}
},
/**
* Registers a onetime callback asso the passed eventName
* the callback is an anonymous method which call this.onEventListener if it is defined
* this is to be invoked in the render method of any sub class
* @protected
* @param {String} eventName - name of the event to attach the callback
*/
registerOneTimeCallback: function registerOneTimeCallback(eventName) {
var _this3 = this;
var result = this.glassContext.getCoreSvc('.Events').on(eventName, function (event, eventName) {
var callback = _.isFunction(_this3.onEventListener) ? _this3.onEventListener : function () {};
try {
callback.call(_this3, event, eventName);
} catch (error) {
_this3.glassContext.getCoreSvc('.Logger').error('GlassPlugin event callbak failure', event, eventName, error);
} finally {
result.remove();
}
}, this);
},
/**
* event listener: invokes the method(s) corresponding to the events
*
* @protected
* @return {promise}
*/
onEventListener: function onEventListener(event, eventName) {
var _this4 = this;
var logger = this.glassContext.getCoreSvc('.Logger');
return this.getController().then(function (controller) {
if (controller) {
switch (eventName) {
case AppEvents.APPVIEW_LOADED:
if (_this4.appView && _this4.appView === event.appView) {
_this4._onAppViewLoaded(controller, logger, event, eventName);
} else {
logger.info(AppEvents.APPVIEW_LOADED + ' is ignored due to mismatched appView', _this4.appView, event.appView);
}
break;
default:
logger.warn('unhandled event in plugin', _this4, event, eventName);
}
}
}).catch(function (error) {
logger.error('error on event callback', _this4, error);
});
},
/**
* callback corresponding to the appView:loaded event
* @private
*/
_onAppViewLoaded: function _onAppViewLoaded(controller, logger) {
if (_.isFunction(controller.onRender)) {
controller.onRender({
glassContext: this.glassContext,
target: {
plugin: this,
itemId: this.itemSpec.id
}
});
}
this.showCoachMark().catch(function (error) {
logger.error('failed to show coachmark', error);
});
},
/**
* ======================Private Helper functions useful for all Plugins==============================
*/
/** Sets the attribute only if value is defined.
*/
_setAttr: function _setAttr($plugin, sAttr, sValue) {
if (sValue) {
$plugin.attr(sAttr, sValue);
}
},
/** Adds the sClassname if it's defined to the element.
*/
_addClass: function _addClass($plugin, className) {
if (className) {
$plugin.addClass(className);
}
},
_setIcon: function _setIcon($widget) {
var icon = this.itemSpec.icon;
Utils.setIcon($widget, icon);
}
});
return GlassPlugin;
});
//# sourceMappingURL=GlassPlugin.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Watson Analytics (C) Copyright IBM Corp. 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/utils/Deferred',[], function () {
'use strict';
/**
* Create a Deferred from a Promise class
* The reason this function is in common-core is because this is used in client and serveside JS
* Instantiates the class and uses the promise instance and resolve/reject methods to create a deferred object.
* @return {[type]} [description]
*/
return function () {
var resolve, reject;
var promise = new Promise(function () {
resolve = arguments[0];
reject = arguments[1];
});
return {
resolve: resolve,
reject: reject,
promise: promise
};
};
});
//# sourceMappingURL=Deferred.js.map
;
/**
* Licensed Materials - Property of IBM
*
* "Restricted Materials of IBM"
*
* 5746-SM2
*
* (C) Copyright IBM Corp. 2015, 2016
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/plugins/MenuActionInterface',['../../core-client/js/core-client/ui/core/Class'], function (Class) {
/**
* This class lists all the methods corresponding to the actions supported by a menu
* It plays the role of an interface, consumer can extend it.
*
* @interface
*/
var MenuActionInterface = Class.extend({
/**
* method to be invoked on the press action for a menu item
* @param {context} which contains the following:
*
*
glassContext
*
target: object containing info on the target: plugin and itemId
*
*/
onSelectItem: function
/* context */
onSelectItem() {},
/**
* method to be invoked for a menu item
* @param {context} which contains the following:
*
*
glassContext
*
target: object containing info on the target: plugin and itemId
*
*/
onRenderItem: function
/* context */
onRenderItem() {},
/**
* Method invoked when rendering the menu to determine if the item should be displayed
* @param {context} which contains the following:
*
*
glassContext
*
target: object containing info on the target: plugin and itemId
*
activeObject: object for which the menu is displayed, used for the context menu
*
* @return true or false
*/
isItemVisible: function
/* context */
isItemVisible() {
return true;
},
/**
* Method invoked when rendering the menu to determine if the item should be selected
* @param {context} which contains the following:
*
*
glassContext
*
target: object containing info on the target: plugin and itemId
*
activeObject: object for which the menu is displayed, used for the context menu
*
* @return true or false
*/
isItemSelected: function
/* context */
isItemSelected() {
return false;
},
/**
* method to be invoked when the menu is rendered
* @param {context} which contains the following:
*
*
glassContext
*
target: object containing info on the target; one is the plugin
*
*/
onRender: function
/* context */
onRender() {},
/**
* method to be invoked when the menu is opened, before the menuItems are shown.
* @param {context} which contains the following:
*
*
glassContext
*
target: object containing info on the target; one is the plugin
*
*/
onOpen: function
/* context */
onOpen() {},
/**
* Method to be invoked when loading a coachmark.
* Can be used to dynamically set the coachmark's title
* or contents
* @param {Object} context - The context for this coach mark
* @param {Object} context.glassContext - The glass context.
* @param {Object} context.target - The coachMark target for which we want the spec
* @param {string} context.target.itemId - The id of the item for which we want the
* coach mark spec
* @param {Object} context.target.coachMark - The current spec of the coachMark, if any
* @returns {Object} A coach mark specification, including title and contents.
*/
getCoachMarkSpec: function
/* context */
getCoachMarkSpec() {},
/**
* Method invoked when rendering the menu to determine
* if the item should have a custom label instead of the default one from the spec.
* @param {context} which contains the following:
*
*
glassContext
*
target: object containing info on the target: plugin and itemId
*
* @returns {string} A custom label to override the default one that is in the spec.
* If returns undefined then the default label from the spec is used.
*/
getLabel: function
/* context */
getLabel() {}
});
return MenuActionInterface;
});
//# sourceMappingURL=MenuActionInterface.js.map
;
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
/**
* Licensed Materials - Property of IBM
*
* "Restricted Materials of IBM"
*
* 5746-SM2
*
* (C) Copyright IBM Corp. 2015, 2018
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/plugins/MenuActionControllerDispatcher',['underscore', 'jquery', './MenuActionInterface', '../../api/Context'], function (_, $, MenuActionInterface, Context) {
/**
* This class lists all the methods corresponding to the actions supported by a menu
* It plays the role of an interface, consumer can extend it.
*
* @interface
*/
var MenuActionInterfaceDispatcher = MenuActionInterface.extend({
/**
*constructor
*@actionControllers map of featureId with actionControllers:
*{
* featureId: path/to/controller
*}
*/
init: function init(actionControllers) {
this._oControllerMap = {};
this._oItemMap = {};
_.extend(this._oControllerMap, actionControllers);
},
/**
* Getter for the controller map
*/
getControllerMap: function getControllerMap() {
return this._oControllerMap;
},
/**
* Dispatches the callback invocation to the right controller
* @override
*
*/
onSelectItem: function onSelectItem(context) {
var sItemId = context.target.itemId;
var oController = this._findController(sItemId);
if (oController && _.isFunction(oController.onSelectItem)) {
oController.onSelectItem.call(oController, context);
} else if (oController && _.isFunction(oController.execute)) {
var apiContext = new Context(context.glassContext);
var apiOptions = this._getOptions(context);
oController.execute.call(oController, apiContext, apiOptions);
}
},
/**
* Invokes the onRender on right controller
* @override
*
*/
onRender: function onRender(context) {
_.each(this._oControllerMap, function (oController) {
if (oController && _.isFunction(oController.onRender)) {
oController.onRender.call(oController, $.extend(true, {}, context));
}
}, this);
},
/**
* Invokes the onOpen on right controller
* @override
*
*/
onOpen: function onOpen(context) {
var all = _.values(this._oControllerMap).map(function (oController) {
if (oController && _.isFunction(oController.onOpen)) {
return new Promise(function (resolve) {
resolve(oController.onOpen($.extend(true, {}, context)));
}).catch(function (e) {
context.glassContext.getCoreSvc('.Logger').warn(e);
});
}
});
return Promise.all(all);
},
/**
* Invokes the onRemoveItem on right controller
* @override
*
*/
onRemoveItem: function onRemoveItem(context) {
var sItemId = context.target.itemId;
var oController = this._findController(sItemId);
if (oController && _.isFunction(oController.onRemoveItem)) {
return oController.onRemoveItem.call(oController, $.extend(true, {}, context));
}
},
/**
* Invokes the onRenderItem on right controller
* @override
*
*/
onRenderItem: function onRenderItem(context) {
var sItemId = context.target.itemId;
var oController = this._findController(sItemId);
if (oController && _.isFunction(oController.onRenderItem)) {
oController.onRenderItem.call(oController, $.extend(true, {}, context));
}
},
_getOptions: function _getOptions(context) {
var options;
if (context.options) {
options = this._combineOptions(context);
} else {
options = context.target.plugin.itemSpec.items[context.target.specItemIndex].options;
}
return {
options: options
};
},
_combineOptions: function _combineOptions(context) {
var options;
var pluginOptions = this._checkValidityPluginOptions(context) ? context.target.plugin.itemSpec.items[context.target.specItemIndex].options : {}; // Array will be converted to Object here with index kept as keys
options = Object.assign({}, context.options);
if (pluginOptions) {
// contextOption shouldn't be overwritten when duplicated keys exists
for (var key in pluginOptions) {
if (key in options) {
continue;
}
options[key] = pluginOptions[key];
}
}
return options;
},
_checkValidityPluginOptions: function _checkValidityPluginOptions(context) {
var itemExists = context && context.target && context.target.plugin && context.target.plugin.itemSpec && context.target.plugin.itemSpec.items && Array.isArray(context.target.plugin.itemSpec.items);
var inRange = itemExists && context.target.specItemIndex !== undefined && context.target.specItemIndex !== null && context.target.specItemIndex >= 0 && context.target.specItemIndex < context.target.plugin.itemSpec.items.length;
var isValidOptions = itemExists && inRange && context.target.plugin.itemSpec.items[context.target.specItemIndex].options && _typeof(context.target.plugin.itemSpec.items[context.target.specItemIndex].options) === 'object';
return isValidOptions;
},
_invokeControllerIsItemVisible: function _invokeControllerIsItemVisible(context) {
var itemId = context.target.itemId;
var oController = this._findController(itemId);
var isVisible = !_.isUndefined(oController);
if (isVisible && _.isFunction(oController.isItemVisible)) {
isVisible = oController.isItemVisible.call(oController, context);
} else if (isVisible && _.isFunction(oController.isVisible)) {
var apiContext = new Context(context.glassContext);
var apiOptions = this._getOptions(context);
isVisible = oController.isVisible.call(oController, apiContext, apiOptions);
}
isVisible = _.isBoolean(isVisible) ? isVisible : false;
return isVisible;
},
/**
* invokes the isItemDisabled on the right controller
* @override
*/
isItemDisabled: function isItemDisabled(context) {
var itemId = context.target.itemId;
var oController = this._findController(itemId);
if (oController && _.isFunction(oController.isItemDisabled)) {
return oController.isItemDisabled.call(oController, context);
} else {
return false;
}
},
/**
* Invokes the isItemVisible on the right controller
* @override
*
*/
isItemVisible: function isItemVisible(context) {
var contentView = context.glassContext.getCurrentContentView();
var isVisible;
if (contentView && _.isFunction(contentView.isMenuItemVisible)) {
if (contentView.isMenuItemVisible(context) === true) {
isVisible = this._invokeControllerIsItemVisible(context);
} else {
isVisible = false;
}
} else {
isVisible = this._invokeControllerIsItemVisible(context);
}
return isVisible;
},
/**
* Invokes the isItemSelected on the right controller
* @override
*
*/
isItemSelected: function isItemSelected(context) {
var itemId = context.target.itemId;
var isSelected = false;
var oController = this._findController(itemId);
if (oController && _.isFunction(oController.isItemSelected)) {
isSelected = oController.isItemSelected.call(oController, context);
isSelected = _.isBoolean(isSelected) ? isSelected : false;
}
return isSelected;
},
/**
* Invokes the getLabel on right controller
* @override
*
*/
getLabel: function getLabel(context) {
var sItemId = context.target.itemId;
var oController = this._findController(sItemId);
if (oController && _.isFunction(oController.getLabel)) {
return oController.getLabel.call(oController, $.extend(true, {}, context));
}
},
/**
* convert the arrays of items into a map
*/
buildItemMap: function buildItemMap(aItems) {
_.reduce(aItems, function (oMap, item) {
if (item.id) {
oMap[item.id] = item;
}
return oMap;
}, this._oItemMap);
},
/**
* return the itemMap
*/
getItemMap: function getItemMap() {
return this._oItemMap;
},
/**
* Sets the glass menu
* @param glassMenu - glass menu widget
*/
setGlassMenu: function setGlassMenu(glassMenu) {
this._glassMenu = glassMenu;
},
_findController: function _findController(sItemId) {
var oController;
var oItem = this._oItemMap[sItemId];
if (oItem) {
oController = this._oControllerMap[oItem.featureId];
}
return oController;
}
});
return MenuActionInterfaceDispatcher;
});
//# sourceMappingURL=MenuActionControllerDispatcher.js.map
;
/**
* Licensed Materials - Property of IBM
*
* IBM Cognos Products: BI ui_commons
*
* Copyright IBM Corp. 2015, 2017
*
* US Government Users Restricted Rights - Use, duplication or disclosure
* restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/ui/Menu',['./AccessibleView', '../utils/Utils', '../nls/StringResources', '../utils/BidiUtil', 'underscore', 'jquery', 'jquery-ui'], function (View, uiUtils, StringResources, BidiUtil, _, $) {
/**
* This class represents a menu
*/
var Menu = View.extend({
/**
* @lends Menu.prototype
*/
tagName: 'nav',
events: {
'primaryaction .commonMenuItem': '_onSelectItem',
'primaryaction .moduleMenuItem': '_onSelectModuleItem',
'escapeaction': '_handleEscape'
},
/**
* @classdesc class representing a menu
* @augments AccessibleView
* @constructs
* @public
*
* @param {options}
* set of initial properties:
*
*
spec: specification of the menu
*
*
*/
init: function init(options) {
_.extend(this, options.spec);
this.enableTabLooping = true;
Menu.inherited('init', this, options.spec);
this.$el.attr('role', 'navigation');
this.closeMenu = this._closeMenu.bind(this);
},
/**
* Renders the menu
*
* @override
* @return promise; it is rejected when no specification is set
* for the menu
*
*
resolve Value = dom element representing the
* menu
*
*/
render: function render() {
try {
this.$el.empty();
this.$el.attr('class', '');
this.$el.addClass('commonMenu').addClass('commonMenuActive');
this._itemMap = {};
var $ul = $('
', {
'role': 'menu',
'tabIndex': '0'
}).addClass('commonMenuItems');
var hasIcon = _.filter(this.items, function (item) {
return item.icon !== '' && item.icon !== undefined;
});
_.each(this.items, function (item) {
var $item = $('', {
'role': 'group',
'tabIndex': '0'
}).addClass('commonMenuItem');
if (item.selected === true) {
$item.addClass('selected');
}
if (item.disabled) {
$item.addClass('disabled');
}
$item.addClass(item.id);
var domItemId = this._buildDomItemId();
this._itemMap[domItemId] = item;
$item.attr('id', domItemId);
if (item.module) {
$item.append(this._loadModule($item, item.module));
$item.removeClass('commonMenuItem');
$item.addClass('moduleMenuItem');
} else if (item.type === 'divider') {
// Make a special type divider as we have to remove tabIndex for accessibility
$item.addClass(item.type);
$item.attr('tabIndex', '-1');
} else {
var $a = $('').addClass('commonMenuLink');
var $span = $('');
var title = _.isString(item.label) ? item.label : '';
$a.attr('role', 'menuitem');
$item.attr('aria-label', title);
$span.text(title);
$span.attr('title', BidiUtil.enforceTextDirection(title));
$span.attr('dir', BidiUtil.resolveBaseTextDir(title));
if (hasIcon.length && item.indent !== false) {
$span.addClass('hasIcon');
}
if (item.badge) {
$('').addClass('badge').text(item.badge).appendTo($span);
}
$a.append($span);
uiUtils.setIcon($a, item.icon, item.iconTooltip, null, null, item.iconColor);
$item.append($a);
}
if (item.rightIcon) {
var $rightIconDiv = $('
').addClass('rightIcon').attr('title', item.rightIcon.title);
uiUtils.setIcon($rightIconDiv, item.rightIcon.icon);
$item.append($rightIconDiv);
}
if (item.removable) {
var label = item.removeIconLabel || StringResources.get('remove');
var $removeItem = $('', {
'role': 'button',
'aria-labelledby': domItemId,
'title': label,
'tabIndex': '0'
}).addClass('removeItemIcon');
$removeItem.focus(function (event) {
$(event.target).parent().addClass('hasFocus');
});
$removeItem.blur(function (event) {
$(event.target).parent().removeClass('hasFocus');
});
uiUtils.setIcon($removeItem, 'common-close_16');
$removeItem.on('primaryaction.bi.commons.ui.menu', this._handleRemoveItem.bind(this, $item));
$item.append($removeItem);
}
$ul.append($item);
if (item && _.isFunction(item.onRender)) {
item.onRender($item);
}
}, this);
if (!$ul.is(':empty')) {
this.$el.append($ul);
this.enableLooping($ul);
}
Menu._registerOpenMenu(this);
// DO NOT REMOVE THIS: this is required so that, the
// attached handler does not catch
// the click event that just happened.
setTimeout(function () {
this.setFocus();
this._attachCloseCallbacks();
}.bind(this), 200);
return Promise.resolve(this.el);
} catch (err) {
return Promise.reject(err);
}
},
/**
* Set the focus to an element within the view.
*
* @public
*/
setFocus: function setFocus() {
this.$el.find('.commonMenuItems').focus();
},
_handleRemoveItem: function _handleRemoveItem($item, event) {
var specItem = this._itemMap[$item.attr('id')];
event.stopPropagation();
if (specItem && _.isFunction(specItem.onRemove)) {
var result = specItem.onRemove();
Promise.resolve(result).then(function (removeMenuItem) {
if (removeMenuItem) {
this._setNextTabFocus($item);
$item.remove();
}
}.bind(this));
delete this._itemMap[$item.attr('id')];
}
},
_setNextTabFocus: function _setNextTabFocus($el) {
var $focusEl = $el.next('.commonMenuItem');
if ($focusEl.length === 0) {
$focusEl = $el.prev('.commonMenuItem');
}
$focusEl.focus();
},
_handleEscape: function _handleEscape(event) {
this._closeMenu(event, false);
this.getLaunchPoint().focus();
return false;
},
/**
* @private callback attached to all the items
* @param the
* corresponding event
*/
_onSelectItem: function _onSelectItem(event) {
var specItem = this._itemMap[event.currentTarget.id];
event.stopPropagation();
if (event.gesture) {
event.gesture.preventDefault();
}
this._closeMenu(event, false);
if (specItem && _.isFunction(specItem.onSelect)) {
specItem.onSelect();
}
},
_onSelectModuleItem: function _onSelectModuleItem(event) {
var specItem = this._itemMap[event.currentTarget.id];
event.stopPropagation();
this._closeMenu(event, true);
if (specItem && _.isFunction(specItem.onSelect)) {
specItem.onSelect();
}
},
/**
* @private Builds the displayed item id; format is
* this.viewId_item.
*/
_buildDomItemId: function _buildDomItemId() {
return this.viewId + '_' + _.uniqueId('item');
},
/**
* @private Closes the menu on a given set of events
*/
_attachCloseCallbacks: function _attachCloseCallbacks() {
$(document).on('primaryaction.bi.commons.ui.menu', this.closeMenu);
$(document).on('contextmenu.bi.commons.ui.menu', this.closeMenu);
$(window).on('resize.bi.commons.ui.menu', this.closeMenu);
},
/**
* @private closes the menu
*/
_closeMenu: function _closeMenu(event, stayOpen) {
if (stayOpen) {
return Promise.resolve();
}
if (_.isFunction(this.whenReadyToClose)) {
return this.whenReadyToClose(event).then(this.remove.bind(this), this.remove.bind(this));
} else {
this.remove();
return Promise.resolve();
}
},
_loadModule: function _loadModule(context, module) {
require([module], function (Module) {
var module = new Module({
'$el': context
});
return module.render();
}.bind(this));
},
remove: function remove() {
Menu._unregisterOpenMenu(this);
$(document).off('.bi.commons.ui.menu', this.closeMenu);
$(window).off('.bi.commons.ui.menu', this.closeMenu);
Menu.inherited('remove', this, arguments);
}
});
/**
* @private
*/
Menu._openMenus = [];
/**
* @private
*/
Menu._registerOpenMenu = function (menu) {
if (!_.contains(Menu._openMenus, menu)) {
Menu._openMenus.push(menu);
if (!$('body').hasClass('openedMenu')) {
$('body').addClass('openedMenu');
}
}
};
/**
* @private
*/
Menu._unregisterOpenMenu = function (menu) {
Menu._openMenus = _.reject(Menu._openMenus, function (m) {
return m === menu;
});
if (Menu._openMenus.length === 0) {
$('body').removeClass('openedMenu');
}
};
/**
* Triggers an event to notify all Menu instances to close themselves.
* @static
*/
Menu.hideOpenMenus = function () {
_.each(Menu._openMenus, function (menu) {
menu.closeMenu();
});
};
return Menu;
});
//# sourceMappingURL=Menu.js.map
;
/**
* Licensed Materials - Property of IBM
*
* IBM Cognos Products: BI Titan
*
* Copyright IBM Corp. 2015, 2017
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/plugins/GlassContextMenu',['./GlassPlugin', 'jquery', 'underscore', '../../core-client/js/core-client/utils/ClassFactory', '../../core-client/js/core-client/utils/Deferred', './MenuActionControllerDispatcher', '../../core-client/js/core-client/ui/Menu', '../../utils/Utils'], function (GlassPlugin, $, _, ClassFactory, Deferred, ControllerDispatcher, Menu, Utils) {
/**
* This Class renders a contextual menu defined in the perspective
*/
var GlassContextMenu = GlassPlugin.extend(
/**
* @lends ContextMenu.prototype
*/
{
_ClassFactory: ClassFactory,
/**
* @classdesc class representing a context menu
* @augments GlassPlugin
* @constructs
* @public
* @param {Object} options - set of initial properties
* @param {Object} options.glassContext - glassContext
* @param {Object} options.itemSpecs - specification of the menu to show
* @param {Object} options.activeObject - object for which the menu is shown
*
* */
init: function init(options) {
$.extend(true, this, options);
},
/**
* Get the container element of the plugin.
*/
getRootElement: function getRootElement() {
this.glassContext.getCoreSvc('.Logger').warn('GlassContextMenu::getRootElement() is being deprecated!');
return this.$el;
},
/**
* Gets the ContextMenu instance associated with this plugin
* @public
* @example
* //Used in the menu controller to reference the menu instance. Useful for getting menu's launchPoint
* onSelectItem: function(options) {
* var menu = options.target.plugin.getMenu()
* var launchPoint = menu.getLaunchPoint();
* }
*
* @returns {Menu} the ContextMenu instance
*/
getMenu: function getMenu() {
this.glassContext.getCoreSvc('.Logger').warn('GlassContextMenu::getMenu() is being deprecated!');
return this._menu;
},
/**
* Renders the plugin.
* @override
*/
render: function render() {
var deferred = new Deferred();
var aModulePromises = [];
var aFeatures = [];
var oControllerMap = {};
_.each(this.itemSpec.actionControllers, function (module, key) {
aModulePromises.push(this._createController(module, key));
aFeatures.push(key);
}.bind(this));
Utils.waitForAllOrSomePromises(aModulePromises).done(function () {
try {
Menu.hideOpenMenus();
_.each(aModulePromises, function (item, index) {
if (item.isFulfilled()) {
oControllerMap[aFeatures[index]] = item.responseModule;
}
});
this._oControllerDispatcher = this._createControllerDispatcher(oControllerMap);
var shownItems = [];
this._oControllerDispatcher.buildItemMap(this.itemSpec.items);
this._menu = this._createUIMenu(shownItems);
_.each(this.itemSpec.items, function (item, index) {
var oEventContext = {
glassContext: this.glassContext,
target: {
plugin: this,
itemId: item.id,
activeObject: this.activeObject,
specItemIndex: index
},
options: this.options
};
var isVisible = this._oControllerDispatcher.isItemVisible(oEventContext);
if (isVisible) {
var uiItem = {};
$.extend(true, uiItem, item);
uiItem.name = item.id;
uiItem.onSelect = this._oControllerDispatcher.onSelectItem.bind(this._oControllerDispatcher, oEventContext);
uiItem.disabled = this._oControllerDispatcher.isItemDisabled(oEventContext);
var customLabel = this._oControllerDispatcher.getLabel(oEventContext);
if (!_.isUndefined(customLabel)) {
uiItem.label = customLabel;
}
var isSelected = this._oControllerDispatcher.isItemSelected(oEventContext);
if (isSelected) {
uiItem.selected = true;
}
shownItems.push(uiItem);
}
}, this);
this._menu.render().then(function (domMenu) {
this.$el = $(domMenu);
var oEventContext = {
glassContext: this.glassContext,
target: {
plugin: this,
itemId: this.itemSpec.id,
activeObject: this.activeObject
}
};
this._oControllerDispatcher.onRender(oEventContext);
deferred.resolve(domMenu);
}.bind(this), function (reason) {
deferred.reject({
msg: GlassContextMenu.errors.FAILURE_RENDERING_MENU,
causedBy: reason
});
});
} catch (e) {
deferred.reject({
msg: GlassContextMenu.errors.FAILURE_RENDERING_MENU,
causedBy: e
});
}
}.bind(this)).fail(function (reason) {
deferred.reject({
msg: GlassContextMenu.errors.FAILURE_RENDERING_MENU,
causedBy: reason
});
});
return deferred.promise;
},
/**
* Creates the controller dispatcher providing the controller Map
* @private
* @param controllerMap
* @return Instance of the controller Dispatcher
*/
_createControllerDispatcher: function _createControllerDispatcher(controllerMap) {
return new ControllerDispatcher(controllerMap);
},
/**
* Creates the UI menu
* @private
* @param shownItems array of items to show
*/
_createUIMenu: function _createUIMenu(shownItems) {
return new Menu({
spec: {
items: shownItems
}
});
},
_createController: function _createController(module, key) {
var oEventContext = {
glassContext: this.glassContext,
target: {
plugin: this,
itemId: this.itemSpec.id
},
controllerConfig: this.itemSpec.controllerConfig && this.itemSpec.controllerConfig[key]
};
var _controller;
return this._ClassFactory.instantiate(module).then(function (controller) {
_controller = controller;
if (_.isFunction(_controller.initialize)) {
return _controller.initialize(oEventContext);
}
}).then(function () {
if (_.isFunction(_controller.onOpen)) {
return _controller.onOpen(oEventContext);
}
}).then(function () {
return _controller;
});
}
});
GlassContextMenu.errors = {
FAILURE_RENDERING_MENU: 'Failure when rendering the contextual menu',
FAILURE_CREATING_CONTROLLER: 'Failure creating one of the menu controllers'
};
return GlassContextMenu;
});
//# sourceMappingURL=GlassContextMenu.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI
* (C) Copyright IBM Corp. 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/utils/WorkArounds',['../core-client/js/core-client/utils/Utils'], function (Utils) {
return {
apply: function apply() {
this._locationOrigin();
},
/**
* From Bug: 178943: Wrong glass URL on Windows 10 Enterprise 2015 LTSB Edition / IE 11 combo
* In IE11 on Windows 10, window.location.origin is undefined. This work around fills in the origin on the global object.
*/
_locationOrigin: function _locationOrigin() {
var w = Utils.getCurrentWindow();
if (!w.location.origin) {
w.location.origin = w.location.protocol + '//' + w.location.hostname + (w.location.port ? ':' + w.location.port : '');
}
}
};
});
//# sourceMappingURL=WorkArounds.js.map
;
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("prop-types"),require("react"),require("underscore"),require("jquery"),require("mobx-state-tree"),require("baglass/core-client/js/core-client/utils/ClassFactory"),require("ca-ui-toolkit-core"),require("mobx-react"),require("mobx"),require("baglass/nls/StringResources"),require("baglass/utils/Utils"),require("baglass/core-client/js/core-client/errors/BaseError"),require("react-dom"),require("baglass/api/Url"),require("baglass/core-client/js/core-client/ui/KeyCodes"),require("baglass/core-client/js/core-client/ui/ToastMessage"),require("baglass/app/utils/CloseViewUtils"),require("baglass/common/ui/SlideoutRegistry"),require("baglass/api/Context"),require("baglass/services/AjaxService"),require("baglass/services/ClipboardService"),require("baglass/app/services/CoachMarkService"),require("baglass/app/services/ConfigService"),require("baglass/services/ContextService"),require("baglass/services/EventsService"),require("baglass/services/FeatureChecker"),require("baglass/app/FeatureRules"),require("baglass/app/services/FetchService"),require("baglass/app/services/AjaxService"),require("baglass/services/LogService"),require("baglass/services/PrefetchService"),require("baglass/services/ServiceRegistry"),require("baglass/app/services/UserProfileService"),require("baglass/services/WindowProxyService"),require("baglass/core-client/js/core-client/utils/PerfUtils"),require("baglass/core-client/js/core-client/ui/Slideout"),require("baglass/common/ui/SlideoutController"),require("baglass/app/plugins/GlassContextMenu"),require("baglass/core-client/js/core-client/ui/Menu"),require("baglass/utils/WorkArounds"));else if("function"==typeof define&&define.amd)define('baglass/glass.webpack.bundle',["prop-types","react","underscore","jquery","mobx-state-tree","baglass/core-client/js/core-client/utils/ClassFactory","ca-ui-toolkit-core","mobx-react","mobx","baglass/nls/StringResources","baglass/utils/Utils","baglass/core-client/js/core-client/errors/BaseError","react-dom","baglass/api/Url","baglass/core-client/js/core-client/ui/KeyCodes","baglass/core-client/js/core-client/ui/ToastMessage","baglass/app/utils/CloseViewUtils","baglass/common/ui/SlideoutRegistry","baglass/api/Context","baglass/services/AjaxService","baglass/services/ClipboardService","baglass/app/services/CoachMarkService","baglass/app/services/ConfigService","baglass/services/ContextService","baglass/services/EventsService","baglass/services/FeatureChecker","baglass/app/FeatureRules","baglass/app/services/FetchService","baglass/app/services/AjaxService","baglass/services/LogService","baglass/services/PrefetchService","baglass/services/ServiceRegistry","baglass/app/services/UserProfileService","baglass/services/WindowProxyService","baglass/core-client/js/core-client/utils/PerfUtils","baglass/core-client/js/core-client/ui/Slideout","baglass/common/ui/SlideoutController","baglass/app/plugins/GlassContextMenu","baglass/core-client/js/core-client/ui/Menu","baglass/utils/WorkArounds"],t);else{var n="object"==typeof exports?t(require("prop-types"),require("react"),require("underscore"),require("jquery"),require("mobx-state-tree"),require("baglass/core-client/js/core-client/utils/ClassFactory"),require("ca-ui-toolkit-core"),require("mobx-react"),require("mobx"),require("baglass/nls/StringResources"),require("baglass/utils/Utils"),require("baglass/core-client/js/core-client/errors/BaseError"),require("react-dom"),require("baglass/api/Url"),require("baglass/core-client/js/core-client/ui/KeyCodes"),require("baglass/core-client/js/core-client/ui/ToastMessage"),require("baglass/app/utils/CloseViewUtils"),require("baglass/common/ui/SlideoutRegistry"),require("baglass/api/Context"),require("baglass/services/AjaxService"),require("baglass/services/ClipboardService"),require("baglass/app/services/CoachMarkService"),require("baglass/app/services/ConfigService"),require("baglass/services/ContextService"),require("baglass/services/EventsService"),require("baglass/services/FeatureChecker"),require("baglass/app/FeatureRules"),require("baglass/app/services/FetchService"),require("baglass/app/services/AjaxService"),require("baglass/services/LogService"),require("baglass/services/PrefetchService"),require("baglass/services/ServiceRegistry"),require("baglass/app/services/UserProfileService"),require("baglass/services/WindowProxyService"),require("baglass/core-client/js/core-client/utils/PerfUtils"),require("baglass/core-client/js/core-client/ui/Slideout"),require("baglass/common/ui/SlideoutController"),require("baglass/app/plugins/GlassContextMenu"),require("baglass/core-client/js/core-client/ui/Menu"),require("baglass/utils/WorkArounds")):t(e["prop-types"],e.react,e.underscore,e.jquery,e["mobx-state-tree"],e["baglass/core-client/js/core-client/utils/ClassFactory"],e["ca-ui-toolkit-core"],e["mobx-react"],e.mobx,e["baglass/nls/StringResources"],e["baglass/utils/Utils"],e["baglass/core-client/js/core-client/errors/BaseError"],e["react-dom"],e["baglass/api/Url"],e["baglass/core-client/js/core-client/ui/KeyCodes"],e["baglass/core-client/js/core-client/ui/ToastMessage"],e["baglass/app/utils/CloseViewUtils"],e["baglass/common/ui/SlideoutRegistry"],e["baglass/api/Context"],e["baglass/services/AjaxService"],e["baglass/services/ClipboardService"],e["baglass/app/services/CoachMarkService"],e["baglass/app/services/ConfigService"],e["baglass/services/ContextService"],e["baglass/services/EventsService"],e["baglass/services/FeatureChecker"],e["baglass/app/FeatureRules"],e["baglass/app/services/FetchService"],e["baglass/app/services/AjaxService"],e["baglass/services/LogService"],e["baglass/services/PrefetchService"],e["baglass/services/ServiceRegistry"],e["baglass/app/services/UserProfileService"],e["baglass/services/WindowProxyService"],e["baglass/core-client/js/core-client/utils/PerfUtils"],e["baglass/core-client/js/core-client/ui/Slideout"],e["baglass/common/ui/SlideoutController"],e["baglass/app/plugins/GlassContextMenu"],e["baglass/core-client/js/core-client/ui/Menu"],e["baglass/utils/WorkArounds"]);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,(function(e,t,n,r,o,i,s,a,c,u,l,p,f,d,h,y,v,g,b,w,m,C,_,P,S,O,E,x,j,R,k,V,T,M,A,I,D,L,N,G){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/bi/js/glass/baglass/js/baglass/app/",n(n.s=52)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){"use strict";function r(e,t){for(var n=0;n0?t=this.generatePositionMap(e):t[r.default.LOOPS]=[],(t[r.default.TOP]||t[r.default.BOTTOM])&&(t.class="paneColumn",t[r.default.LOOPS]=[r.default.TOP,r.default.BOTTOM],t[r.default.PANE]={}),(t[r.default.LEFT]||t[r.default.RIGHT])&&(t[r.default.PANE]?(t[r.default.LEFT]&&(t[r.default.PANE][r.default.LEFT]=t[r.default.LEFT],delete t[r.default.LEFT]),t[r.default.RIGHT]&&(t[r.default.PANE][r.default.RIGHT]=t[r.default.RIGHT],delete t[r.default.RIGHT]),t[r.default.PANE].class="paneRow",t[r.default.PANE][r.default.LOOPS]=[r.default.LEFT,r.default.RIGHT],t[r.default.PANE][r.default.PANE]={}):(t.class="paneRow",t[r.default.LOOPS]=[r.default.LEFT,r.default.RIGHT],t[r.default.PANE]={})),t}}],(n=null)&&s(t.prototype,n),o&&s(t,o),Object.defineProperty(t,"prototype",{writable:!1}),e}()},function(e,t){e.exports=p},function(e,t,n){"use strict";n.r(t);var r=Object.freeze({APPVIEW:"appview",APPVIEW_LOADED:"appView:loaded"}),o=n(3),i=n.n(o),s=n(7),a=n.n(s);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){for(var n=0;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&Object.values(e.callback).filter((function(e){return e&&"function"==typeof e})).length>0&&e&&e.buttons&&Array.isArray(e.buttons)&&((e.buttons.includes("ok")||e.buttons.filter((function(e){return"ok"===e.defaultId})).length>0)&&this.registerCallbackForButton(e,"ok",t),(e.buttons.includes("cancel")||e.buttons.filter((function(e){return"cancel"===e.defaultId})).length>0)&&this.registerCallbackForButton(e,"cancel",t)),this.store.addDialog(e)},e.prototype.registerCallbackForButton=function(t,n,r){this.notifier.register(r+"-dialog-callback-"+n,(function(){t.callback.general&&e.invokeGeneralCallback(t,n),t.callback[n]&&t.callback[n]()}))},e.invokeGeneralCallback=function(e,t){e.callbackScope&&null!==e.callbackScope[t]&&void 0!==e.callbackScope[t]?e.callback.general.call(e.callbackScope[t],{btn:t}):e.callback.general({btn:t})},e.prototype.removeDialog=function(e){return o(this,void 0,void 0,(function(){var t,n,r;return i(this,(function(o){switch(o.label){case 0:if(t=this.store.dialogsInPlain,!(n=t&&t.length>0?t[t.length-1]:null))return[3,6];o.label=1;case 1:return o.trys.push([1,4,5,6]),!n.hasCallback||"ok"!==e&&"cancel"!==e?[3,3]:[4,this.notifier.notify(n.key+"-dialog-callback-"+e)];case 2:o.sent(),o.label=3;case 3:return[3,6];case 4:return r=o.sent(),this.glassContext.getCoreSvc(".Logger").error("Failed to execute callback function when a dialog is closed",r),[3,6];case 5:return this.store.removeDialog(),n.hasCallback&&(this.notifier.remove(n.key+"-dialog-callback-ok"),this.notifier.remove(n.key+"-dialog-callback-cancel")),[7];case 6:return[2]}}))}))},e.prototype.getDialogs=function(){return this.store.dialogsInPlain},e.prototype.getStore=function(){return this.store},e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)};return String(e)+t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&(n+="?"+a.default.param(o))}return n},e.prototype.getPerspectiveModel=function(e,t){return r(this,void 0,void 0,(function(){var n,r;return o(this,(function(o){switch(o.label){case 0:return void 0!==(n=this.getModelFromCache(e))?[2,n]:[4,this.glassContext.getCoreSvc(".Ajax").ajax({url:e,type:"GET",perspective:t})];case 1:return r=o.sent(),this.modelCache[e]=this.copyObject(r.data),[2,r.data]}}))}))},e}();t.default=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.glassContext=e,this.qsValueEncoders=[]}return e.prototype.encodeQSValue=function(e){for(var t=0;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0?n[0]:null},getToastInPlainById:function(t){return e.disabled?null:(0,o.toJS)(e.getToastById(t))},getToastsForPerspective:function(n){return e.toasts.filter((function(e){return e.scope===t.globalKeyword||e.scope===n})).sort((function(e,n){return e.scope===n.scope?0:e.scope===t.globalKeyword?1:-1}))},getToastsInPlainForPerspective:function(t){return(0,o.toJS)(e.getToastsForPerspective(t))}}})).actions((function(e){return{addToasts:function(n){Array.isArray(n)||(n=[n]);for(var r=0;r5&&(e.toastQueue=(0,o.observable)(e.toastQueue.slice(Math.max(e.toastQueue.length-5,0))))},removeToastById:function(t){var n=e.toasts.filter((function(e){return e.key!==t}));e.toastQueue=(0,o.observable)(n)},removeAllToasts:function(){e.toastQueue=(0,o.observable)([])}}}));t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=document.createElement("div");e.id="svgIcons",e.style.display="none",document.body.appendChild(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5),o=r.types.model({visible:r.types.optional(r.types.boolean,!0),disabled:r.types.optional(r.types.boolean,!1),iconId:r.types.optional(r.types.union(r.types.string,r.types.undefined),void 0),label:r.types.optional(r.types.union(r.types.string,r.types.undefined),void 0)}).actions((function(e){return{setVisible:function(t){e.visible=t},setDisabled:function(t){e.disabled=t},setLabel:function(t){e.label=t},setIconId:function(t){e.iconId=t}}}));t.default=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0){var t=e[0].getElementsByClassName("navbar");t.length>0&&t[0].classList.add("disabled");var n=e[0].getElementsByClassName("appbar");n.length>0&&n[0].classList.add("disabled")}},r.unlockGlass=function(){r.getCoreSvc(".Logger").warn("The unlockGlass API will no longer be supported after the R7 release. Please update your usage accordingly");var e=document.getElementsByClassName("appview");if(e.length>0){var t=e[0].getElementsByClassName("navbar");t.length>0&&t[0].classList.remove("disabled");var n=e[0].getElementsByClassName("appbar");n.length>0&&n[0].classList.remove("disabled")}},r.rootPane=n.$rootPane,(0,C.loadPerspectiveModels)(n.perspectives,r.getCoreSvc(".Perspective"),r.getCoreSvc(".Logger")),(0,w.default)(),P.default.apply(),r}return o(t,e),Object.defineProperty(t.prototype,"currentAppView",{get:function(){return this.currentPerspective},set:function(e){this.currentPerspective=e,this.appController.currentAppView=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mode",{get:function(){return this.glassMode},set:function(e){this.glassMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bookmarkMode",{get:function(){return this.glassBookmarkMode},set:function(e){this.glassBookmarkMode=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cachedPerspectives",{get:function(){return this.perspectiveLifeCycle.cachedPerspectives},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"noCloseOnLastPerspective",{get:function(){return"true"===_.default.getObjectProperty(["context","content","closeWindowOnLastView"],this.currentAppView)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"previousAppView",{get:function(){return this.previousPerspective},set:function(e){this.previousPerspective=e,this.appController.previousAppView=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"perspectiveSwitcherRegistry",{get:function(){return this.perspectiveLifeCycle.perspectiveSwitcherRegistry},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"slideoutRegistry",{get:function(){return this.slideoutController.slideoutRegistry},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"windowPoppingState",{get:function(){return this.perspectiveLifeCycle.windowPoppingState},set:function(e){this.perspectiveLifeCycle.windowPoppingState=e},enumerable:!1,configurable:!0}),t.prototype.getCurrentContentView=function(){return this.currentPerspective?this.currentPerspective.getCurrentContentView():null},t.prototype.getCurrentPerspective=function(){return this.currentPerspective?this.currentPerspective.getCurrentPerspective():null},t}(d.default);t.default=S},function(e,t){e.exports=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isApplicationStyledForHighContrast=t.styleApplicationForHighContrast=t.isApplicationInHighContrast=void 0,t.isApplicationInHighContrast=function(){var e=!1,t=document.createElement("div");return t.classList.add("hcDetect"),document.body.appendChild(t),getComputedStyle(t).getPropertyValue("border-top-color")===getComputedStyle(t).getPropertyValue("border-left-color")&&""!==getComputedStyle(t).getPropertyValue("border-left-color")&&(e=!0),document.body.removeChild(t),e},t.styleApplicationForHighContrast=function(){document.body.classList.add("highcontrast")},t.isApplicationStyledForHighContrast=function(){return document.body.classList.contains("highcontrast")}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=this.perspectiveSwitcherRegistry.size()&&(e=this.perspectiveSwitcherRegistry.size()-1),!n){var r=void 0,o=this.Glass.previousAppView;return this.perspectiveSwitcherRegistry.containsPerspective(o)||(this.Glass.previousAppView=void 0,o=void 0),(r=o&&o.perspective&&o!==t&&"login"!==o.perspective?o:this.perspectiveSwitcherRegistry.getPerspectiveByIndex(e))?this.Glass.openAppView(r.perspective,r.context):this.Glass.openAppView()}return null},t.prototype.closeOpenWidgets=function(e){return i(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.Glass.hideSlideOut(e)];case 1:return t.sent(),u.default.remove(),[2]}}))}))},t.prototype.setHomeFlag=function(e,t){!0===t&&this.perspectiveSwitcherRegistry.clearAllPerspectiveHomeFlags(),e.setHomeFlag(t)},t.prototype.prefetchResources=function(){var e=this.Glass.getRequireJs(),t=e&&e.s&&e.s.contexts&&e.s.contexts._&&e.s.contexts._.config&&e.s.contexts._.config.bundles;t&&this.Glass.getCoreSvc(".Prefetch").prefetchResources(Object.keys(t))},t}(c.default);t.default=l},function(e,t){e.exports=y},function(e,t){e.exports=v},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(5),i=r(n(13)),s=o.types.model({id:o.types.identifier,perspectiveName:o.types.string}).volatile((function(){return{context:{},spec:{}}})).actions((function(e){return{setContext:function(t){e.context=t},setSpec:function(t){e.spec=t}}})).views((function(e){return{get requirejs(){return e.spec.config?e.spec.config.requirejs:void 0},get configStyles(){return e.spec.config?e.spec.config.styles:void 0},get configScripts(){return e.spec.config?e.spec.config.scripts:void 0},get cssStyles(){return e.spec.cssStyles},get svgImages(){return e.spec.svgImages},get contextMenuSettings(){return e.spec.contextMenus},get actions(){return e.spec.actions},get services(){return e.spec.services},get toolBars(){return e.spec.toolBars},get layout(){return i.default.convertToolBarsToLayoutObject(this.toolBars)},get modelId(){return e.context.content&&e.context.content.id?e.context.content.id:e.context.id?e.context.id:e.spec.id?e.spec.id:""},get cacheKey(){return this.modelId?e.perspectiveName+"|"+this.modelId:e.perspectiveName},get contentModule(){return e.spec.content?e.spec.content.module:void 0}}}));t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.arePerspectivesEqual=t.isPerspectiveValid=t.loadPerspectiveModels=void 0,t.loadPerspectiveModels=function(e,t,n){try{Array.isArray(e)&&e.forEach((function(e){var n=e.name,r=e.model,o=e.context;t.addModel(n,r,o)}))}catch(e){n.error("Error while loading perspective models",e)}},t.isPerspectiveValid=function(e){return e&&!e.includes("/")&&!e.includes(".")&&!e.includes("%2F")&&!e.includes("%2f")},t.arePerspectivesEqual=function(e,t){return!(!e||!t||e!==t)}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&t.push(e),t.push([]),e=[]):e.push(n),e}),[]);return n.length>0&&t.push(n),t}}})).actions((function(e){return{updateItems:function(t){e.shownItems=t},updatePosition:function(t){e.position=t},showMenu:function(){e.isVisible||(e.isVisible=!0)},closeMenu:function(){e.isVisible&&(e.isVisible=!1)},onSelect:function(t){e.selectedItem=t}}}));t.default=i},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e),c.default.render(a.default.createElement(p.default,{callback:this.setFocusToMainContent}),e)},n.prototype.setFocusToAppbar=function(){if(this.Glass.currentAppView){var e=document.querySelector(".appview.paneColumn:not(.hidden)");if(e){var t=e.querySelector(".appbar");this.focusOnForemostNode(t)}}},n.prototype.focusOnForemostNode=function(e){if(e){var t=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');t.length>0&&t[0].id&&this.Glass.findElement(t[0].id.replace(/\./g,"\\.")).focus()}},n.prototype.shortcutListener=function(e,t){"up"===e?(f.default.isModifierKey(t)||this.removeKeyFromSet(t.which),f.default.isMetaKey(t)&&this.clearKeyInSet()):"down"===e&&(f.default.isModifierKey(t)||this.addKeyIntoSet(t.which),this.processShortcutAction(t))},n.prototype.addKeyIntoSet=function(e){this.keyPressedSet.add(e)},n.prototype.removeKeyFromSet=function(e){this.keyPressedSet.delete(e)},n.prototype.clearKeyInSet=function(){this.keyPressedSet.clear()},n.prototype.processShortcutAction=function(e){var t=this,n={shortcutFocusToAppbar:{enabled:f.default.isShortcutTriggered("focusToAppbar",this.keyPressedSet,e),callback:function(){return t.setFocusToAppbar()}},shortcutFocusToMainContent:{enabled:f.default.isShortcutTriggered("focusToMainContent",this.keyPressedSet,e),callback:function(){return t.setFocusToMainContent()}}};Object.keys(n).forEach((function(r){var o=n[r];o.enabled&&"function"==typeof o.callback&&(f.default.metaKeyEnabled(e)&&t.clearKeyInSet(),o.callback())}))},n.prototype.detectAccessibilityChange=function(e){var t=this;if(e){document.body.classList.add("accessibilityMode");var n=function(e){t.shortcutListener("down",e)},r=function(e){t.shortcutListener("up",e)};document.body.onmousedown=function(){document.body.onmousedown=null,t.detectAccessibilityChange(!1)}.bind(this),document.body.onkeydown=n.bind(this),document.body.onkeyup=r.bind(this)}else{n=function(e){e.which===u.default.TAB&&(document.body.onkeydown=null,t.detectAccessibilityChange(!0)),t.shortcutListener("down",e)},r=function(e){t.shortcutListener("up",e)};document.body.classList.remove("accessibilityMode"),document.body.onkeydown=n.bind(this),document.body.onkeyup=r.bind(this)}},n}(s.default);t.default=d},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(1)),a=n(8),c=i(n(11)),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onclickCallback=function(e){var n=t.props.callback;e.stopPropagation(),e.nativeEvent.stopImmediatePropagation(),n()},t}return o(t,e),t.prototype.render=function(){return s.default.createElement(a.Button,{label:c.default.get("bypassBlockButtonTitle"),variant:"solid",intent:"primary",onClick:this.onclickCallback,style:{position:"absolute",top:"2px",left:"2px"},autofocus:!0})},t}(s.default.Component);t.default=u},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(33)),i=r(n(56)),s=function(){function e(){}return e.isShortcutTriggered=function(t,n,r){var o=e.shortcutMap[t];return null!=o&&e.verifyKeyset(o,n,r)},e.verifyKeyset=function(e,t,n){return Object.keys(e).every((function(r){if("others"===r){if(e.others.filter((function(e){return t.has(e)})).length!==e.others.length)return!1}else if("ctrlKey"===r&&n){if(!i.default.isDeviceMac()&&!n.ctrlKey||i.default.isDeviceMac()&&!n.metaKey)return!1}else if(n&&!n[r])return!1;return!0}))},e.isModifierKey=function(e){return e&&e.key&&["control","shift","alt","meta"].includes(e.key.toLowerCase())},e.isMetaKey=function(e){return e&&e.key&&"meta"===e.key.toLowerCase()},e.metaKeyEnabled=function(e){return e&&e.metaKey},e.shortcutMap={focusToAppbar:{ctrlKey:!0,shiftKey:!0,others:[o.default.NUM1]},focusToMainContent:{ctrlKey:!0,shiftKey:!0,others:[o.default.NUM2]}},e}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.list={mac:["MacIntel","Macintosh"],windows:["Windows","Win32"]},e.isDeviceMac=function(){return navigator&&e.list.mac&&e.list.mac.includes(navigator.platform)},e.isDeviceWindows=function(){return navigator&&e.list.windows&&e.list.windows.includes(navigator.platform)},e}();t.default=r},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(1)),c=n(8),u=n(9),l=n(10),p=s(n(11)),f=function(e){function t(t){var n=e.call(this,t)||this;return n.state={embedWidth:500,embedHeight:400},n.isIOSdevice=/iPad/i.test(navigator.userAgent),n.buttonLabelMap={copy:"copyText",ok:"ok",cancel:"cancel",close:"close"},n}return o(t,e),t.prototype.bindOnClose=function(e){for(var t=this.props.Glass,n=0;n'}return e.payload&&e.payload.url?e.payload.url:""},t.prototype.urlDisplay=function(e){var t=this;return a.default.createElement("textarea",{className:"displayedURLOrCode","aria-label":p.default.get("share"===e.type?"shareDialogCodeLabel":"embedDialogCodeLabel"),tabIndex:0,readOnly:!this.isIOSdevice,style:{width:"100%",height:"96px"},ref:function(e){t.targetTextarea=e},value:this.urlGenerator(e)})},t.prototype.nodeEmbedDialog=function(e){var t=this,n=this.state,r=n.embedWidth,o=n.embedHeight;return a.default.createElement(a.default.Fragment,null,a.default.createElement(c.Dialog.Body,null,a.default.createElement("div",{className:"embedDialogText",style:{marginBottom:"24px"},"aria-label":p.default.get("embedDialogText")},p.default.get("embedDialogText")),a.default.createElement("div",{className:"embedDialogSizeAdjustor",style:{marginBottom:"16px"}},a.default.createElement("div",{style:{width:"50%",display:"inline-block"}},a.default.createElement("div",null,p.default.get("embedURLWidthLabel")),a.default.createElement(c.NumberInput,{id:"GlassMessageDialog_embedWidth",value:r,scale:1,max:1e5,onValueAccept:function(e,n){return Number(e)===Number(n)&&t.setState({embedWidth:e})}})),a.default.createElement("div",{style:{width:"50%",display:"inline-block"}},a.default.createElement("div",null,p.default.get("embedURLHeightLabel")),a.default.createElement(c.NumberInput,{id:"GlassMessageDialog_embedHeight",value:o,scale:1,max:1e5,onValueAccept:function(e,n){return Number(e)===Number(n)&&t.setState({embedHeight:e})}}))),this.urlDisplay(e)),this.buttonsEmbedShareDialog(e))},t.prototype.nodeShareDialog=function(e){return a.default.createElement(a.default.Fragment,null,a.default.createElement(c.Dialog.Body,null,a.default.createElement("div",{className:"shareDialogText",style:{marginBottom:"16px"},"aria-label":p.default.get("shareDialogText")},p.default.get("shareDialogText")),this.urlDisplay(e)),this.buttonsEmbedShareDialog(e))},t.prototype.nodeGeneralDialog=function(e){var t=this,n=this.props.Glass;return a.default.createElement(a.default.Fragment,null,e.isHTMLContent?a.default.createElement(c.Dialog.Body,{dangerouslySetInnerHTML:{__html:e.message}}):a.default.createElement(c.Dialog.Body,null,a.default.createElement("div",{className:"messageBox "+e.type},e.message)),a.default.createElement(c.Dialog.Footer,null,e.buttons.map((function(r){var o="object"==typeof r&&r.text?r.text:p.default.get(t.buttonLabelMap["string"==typeof r?r:"ok"]),i="object"==typeof r&&r.defaultId?r.defaultId:r,s="ok"===r||"object"==typeof r&&"ok"===r.defaultId;return a.default.createElement(c.Dialog.Button,{key:""+e.key+o,id:i,className:"button dialogButton "+(s?"primary":"secondary"),label:o,primary:s,onClick:function(){return n.getCoreSvc(".Dialog").removeDialog(i)},style:{margin:"0px 0px 0px 16px"}})}))))},t.prototype.renderBodyFooter=function(e){var t;switch(e.type){case"info":case"error":case"warning":t=this.nodeGeneralDialog(e);break;case"share":t=this.nodeShareDialog(e);break;case"embed":t=this.nodeEmbedDialog(e);break;default:t=this.nodeGeneralDialog(e)}return t},t.prototype.render=function(){var e=this,t=this.props.store,n=this.bindOnClose((0,l.toJS)(t?t.dialogs:[]));return n&&n.map((function(t){return a.default.createElement(c.Dialog,{size:t.size,width:t.width,className:t.className,startingFocusIndex:-1,onClose:t.onClose,style:{zIndex:9999999}},a.default.createElement(c.Dialog.SubHeader,null,t.subTitle),a.default.createElement(c.Dialog.Header,null,t.title),e.renderBodyFooter(t))}))},t=i([u.observer],t)}(a.default.Component);t.default=f},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&Object.values(e.callback).filter((function(e){return e&&"function"==typeof e})).length>0,isHTMLContent:e.htmlContent,className:e.className,size:"error"===e.type?"small":"large",key:e.id,payload:e.payload};return a.create(t)}(t)))},removeDialog:function(){e.dialogStack=(0,r.observable)(e.dialogStack.slice(0,e.dialogStack.length-1))},removeAllDialogs:function(){e.dialogStack=(0,r.observable)([])}}}));t.default=c},function(e,t){e.exports=w},function(e,t){e.exports=m},function(e,t){e.exports=C},function(e,t){e.exports=_},function(e,t){e.exports=P},function(e,t){e.exports=S},function(e,t){e.exports=O},function(e,t){e.exports=E},function(e,t){e.exports=x},function(e,t){e.exports=j},function(e,t){e.exports=R},function(e,t){e.exports=k},function(e,t){e.exports=V},function(e,t){e.exports=T},function(e,t){e.exports=M},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=i(n(6)),a=i(n(1)),c=i(n(17)),u=i(n(80)),l=i(n(81)),p=i(n(82)),f=i(n(88)),d=i(n(90)),h=i(n(104)),y=i(n(105)),v=i(n(106)),g=i(n(19)),b=function(e){function t(t){var n=e.call(this,t)||this;return n.closeOpenWidgets=function(){return n.openPerspectiveController.closeOpenWidgets()},n.updateCurrentPerspectiveCache=function(){return n.perspectiveViewsCache.updateCache(n.Glass.currentAppView)},n.isOpeningAPerspective=function(){return n.openPerspectiveController.isOpeningAPerspective()},n.openLoginPerspective=function(e){return n.openPerspectiveController.openLoginPerspective(e)},n.openPerspective=function(e,t){return n.openPerspectiveController.openPerspective(e,t)},n.openPreviousPerspective=function(){return n.openPerspectiveController.openPreviousPerspective()},n.closeAllPerspectives=function(e,t){return n.closePerspectiveController.closeAllPerspectives(e,t)},n.closePerspective=function(e,t,r){return n.closePerspectiveController.closePerspective(e,t,r)},n.perspectiveSwitcherRegistry=new v.default(n.Glass),n.perspectiveViewsCache=new y.default(n.Glass),n.urlHelper=new g.default,n.initializeGlassUIRender(),n.openPerspectiveController=new p.default(n.Glass,n.perspectiveSwitcherRegistry,n.perspectiveViewsCache,n.glassStore,n.perspectivesRegistry,n.perspectivesFactory,n.urlHelper),n.closePerspectiveController=new u.default(n.Glass,n.perspectiveSwitcherRegistry,n.perspectiveViewsCache,n.glassStore,n.perspectivesRegistry),n}return o(t,e),Object.defineProperty(t.prototype,"cachedPerspectives",{get:function(){return this.perspectiveViewsCache.getCachedPerspectives()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isLoginViewShown",{get:function(){return!!this.openPerspectiveController.loginView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"url",{get:function(){return this.urlHelper},enumerable:!1,configurable:!0}),t.prototype.getMountPointForGlassUI=function(){return this.Glass.rootPane.length>0&&this.Glass.rootPane[0]?this.Glass.rootPane[0]:document.getElementById("main")},t.prototype.initializeGlassUIRender=function(){this.glassStore=l.default.create(),this.perspectivesRegistry=new h.default(this.glassStore),this.perspectivesFactory=new d.default(this.perspectivesRegistry,this.Glass);try{c.default.render(a.default.createElement(f.default,{perspectiveRegistry:this.perspectivesRegistry,glassStore:this.glassStore}),this.getMountPointForGlassUI())}catch(e){this.logger.error("Mount point is not correctly set for Glass UI",e,this.Glass.rootPane)}},t}(s.default);t.default=b},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0)return t?function(e){var t=l.default.get("unsavedViewsMsg")+"\n\r";return e.forEach((function(e){t+=e.getTitle(!0)+"\r"})),t}(n):this.closeAllPerspectivesWithConfirmation();var r=this.closeAllPerspectiveViews(t,!0);return t?void 0:new Promise((function(e,t){r.then(e,t)}))}},t.prototype.closePerspective=function(e,t,n){return i(this,void 0,void 0,(function(){var r,o;return s(this,(function(i){return r={perspective:e},t&&(r.content={id:t}),o=this.perspectiveViewsCache.getCachedViewByPerspectiveNameAndContext(e,r),[2,this.closePerspectiveView(o,null,null,n)]}))}))},t.prototype.closeAllPerspectivesWithConfirmation=function(){return i(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,u.default.waitForCloseConfirmation(this.Glass)];case 1:return e.sent(),this.closeAllPerspectiveViews(!1,!0),[2]}}))}))},t.prototype.closeAllPerspectiveViews=function(e,t){return i(this,void 0,void 0,(function(){var n,r=this;return s(this,(function(o){return e&&this.Glass.currentAppView.updateRenderState(!0),this.Glass.previousAppView=void 0,n=[],this.perspectiveViewsCache.getCacheKeys().forEach((function(e){var o=r.perspectiveViewsCache.getCachedView(e);o.cleanupSlideoutController();var i=r.closePerspectiveView.bind(r,o,!0,t);n.push(i())})),this.perspectiveViewsCache.clearCache(),[2,Promise.all(n)]}))}))},t.prototype.closePerspectiveView=function(e,t,n,r){return i(this,void 0,void 0,(function(){return s(this,(function(o){switch(o.label){case 0:return e?!e.shouldShowCloseConfirmationDialog()||t?[3,2]:[4,u.default.waitForCloseConfirmation(this.Glass,r)]:[3,6];case 1:o.sent(),o.label=2;case 2:return e!==this.Glass.currentAppView?[3,4]:[4,this.closeOpenWidgets()];case 3:o.sent(),o.label=4;case 4:return[4,this.removePerspective(e,r)];case 5:o.sent(),this.removePerspectiveEvents(e),this.cleanSwitcherRegistry(e,n),this.Glass.previousAppView===e&&(this.Glass.previousAppView=void 0),this.perspectiveViewsCache.removeCachedView(e.cacheKey),null==n&&this.postPerspectiveClose(),o.label=6;case 6:return[2,!0]}}))}))},t.prototype.cleanSwitcherRegistry=function(e,t){var n=this.perspectiveSwitcherRegistry.getIndexOfPerspective(e);this.Glass.perspectiveSwitcherRegistry.removePerspective(e),e===this.Glass.currentAppView&&(-1===n&&(n=0),this.attemptToOpenPreviousPerspective(n,e,t))},t.prototype.postPerspectiveClose=function(){var e=this.Glass.noCloseOnLastPerspective;0===this.perspectiveSwitcherRegistry.size()&&e&&window.close(),this.pendingOpenPerspectivePromise=null},t.prototype.removePerspective=function(e,t){return i(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return this.perspectivesRegistry.remove(e.perspectiveModel.id),this.glassStore.removePerspectiveModel(e.perspectiveModel.id),[4,e.remove(!0,t)];case 1:return[2,n.sent()]}}))}))},t.prototype.removePerspectiveEvents=function(e){this.Glass.off("change:title",void 0,e.viewId)},t}(c.default);t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5),o=n(10),i=r.types.model({perspectiveModels:r.types.optional(r.types.array(r.types.string),[]),registeredPerspectives:r.types.optional(r.types.array(r.types.string),[]),currentPerspective:r.types.optional(r.types.string,"")}).actions((function(e){return{addPerspectiveModel:function(t){e.perspectiveModels.push(t.id)},removePerspectiveModel:function(t){var n=e.perspectiveModels.filter((function(e){return e!==t}));e.perspectiveModels=(0,o.observable)(n)},registerPerspective:function(t){e.registeredPerspectives.push(t)},deregisterPerspective:function(t){e.registeredPerspectives.remove(t)},setCurrentPerspective:function(t){e.currentPerspective=t}}}));t.default=i},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t},c=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},u=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&this.perspectiveViewsCache.updateCache(t)),"login"!==e.perspective&&this.loginView&&(this.removeLoginView(),this.Glass.reloadTheme()),e.show(),this.Glass.trigger("appView:loaded",{perspective:e.perspective,context:e.context,appView:e}),e.setFocus(),this.perspectiveSwitcherRegistry.addPerspective(e),this.Glass.unlockGlass(),this.Glass.isEmbedded()||this.Glass.isPrefetchDisabled()||this.prefetchResources(),e},t.prototype.deactivateCurrentPerspective=function(){return c(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return this.Glass.currentAppView?[4,this.Glass.currentAppView.deactivate()]:[3,2];case 1:e.sent(),"login"!==this.Glass.currentAppView.perspective&&(this.Glass.previousAppView=this.Glass.currentAppView),e.label=2;case 2:return[2]}}))}))},t.prototype.getPerspectiveModel=function(e,t){return c(this,void 0,void 0,(function(){var n,r,o;return u(this,(function(i){switch(i.label){case 0:return[4,this.Glass.getCoreSvc(".Perspective").getModel(e,t)];case 1:return n=i.sent(),r=C.default.extend(!0,{},n,t),(o=h.default.create({id:"login"===e?"login":(0,d.default)("id"),perspectiveName:e||r.perspective})).setSpec(r),o.setContext(t),[2,o]}}))}))},t.prototype.openHomePerspective=function(e){return c(this,void 0,void 0,(function(){var t,n,r;return u(this,(function(o){switch(o.label){case 0:return t="number"==typeof e?e:0,[4,this.Glass.getHomePageObject(t)];case 1:n=o.sent(),o.label=2;case 2:return o.trys.push([2,5,,6]),"login"===n.perspective?[2,this.openLoginPerspective(n)]:[4,this.closeOpenWidgets()];case 3:return o.sent(),[4,this.buildPerspectiveContext(n.perspective,n)];case 4:return r=o.sent(),[2,this.showPerspective(r.perspectiveName,r.context)];case 5:return o.sent(),this.logger.warn("Failed to open home page:",t,n.perspective),[2,this.openHomePerspective(t+1)];case 6:return[2]}}))}))},t.prototype.renderPerspective=function(e,t,n){return c(this,void 0,void 0,(function(){var r,o,i;return u(this,(function(s){switch(s.label){case 0:if((0,y.isPerspectiveValid)(e))return[3,1];throw new g.default(w.default.get("invalidPerspectiveErrorMessage"));case 1:return[4,this.getPerspectiveModel(e,t)];case 2:return r=s.sent(),"login"!==e&&this.updateUserProfileContext(r),[4,this.deactivateCurrentPerspective()];case 3:return s.sent(),[4,(0,v.preRenderSetup)(r,this.Glass)];case 4:return s.sent(),[4,this.renderPerspectiveView(r)];case 5:return o=s.sent(),this.perspectiveViewsCache.cacheView(e,r.spec,o),i=function(e,t,n,r){var o=JSON.parse(JSON.stringify(e));return o.content=r.content,o.perspective=n||t.perspectiveName,!o.id&&t.modelId&&(o.id=t.modelId),o}(t,r,e,o),o.context=i,[2,this.displayPerspective(o,n)]}}))}))},t.prototype.renderPerspectiveView=function(e){var t=this;this.glassStore.addPerspectiveModel(e),this.perspectivesFactory.create(e),this.glassStore.setCurrentPerspective(e.id);var n=this.perspectivesRegistry.getPerspectiveById(e.id),r=n.getPerspectiveController();this.Glass.currentAppView=r;var o=n.getPerspectiveStore();return new Promise((function(e,n){f.when((function(){return o.contentViewRendered}),(function(){return e(r)})),f.when((function(){return o.contentViewRenderFailed}),(function(){t.logger.error(new Error("AppView Error: Error creating the AppView")),n()}))}))},t.prototype.showCachedPerspective=function(e,t,n){return c(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return e&&n?e===this.Glass.currentAppView?[3,2]:[4,this.Glass.currentAppView.deactivate()]:[3,3];case 1:return r.sent(),[2,this.showContentView(e,t,n)];case 2:return[2,this.showContentView(e,t,n)];case 3:throw new Error("Cached appview and/or its context can not be null.")}}))}))},t.prototype.showNonCachedPerspective=function(e,t,n){return c(this,void 0,void 0,(function(){var r,o;return u(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),function(e){return e.isHomepage||e.content&&e.content.isHomepage}(t)?[3,2]:[4,this.Glass.getHomePageObject()];case 1:return r=i.sent(),!function(e,t,n){return t&&t.perspective===n&&e.content&&t.content&&e.content.pathRef===t.content.pathRef}(t,r,e)?t.isHomepage=!1:t.isHomepage=!0,[2,this.renderPerspective(e,t,n)];case 2:return t.isHomepage=!0,t.content&&delete t.content.isHomepage,[2,this.renderPerspective(e,t,n)];case 3:return o=i.sent(),this.handleShowNonCachedPerspectiveError(o,t),[3,4];case 4:return[2,null]}}))}))},t.prototype.showContentView=function(e,t,n){return c(this,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return this.Glass.previousAppView=this.Glass.currentAppView,this.Glass.currentAppView=e,this.glassStore.setCurrentPerspective(e.perspectiveModel.id),[4,e.showContentView(n)];case 1:return r.sent(),t&&(n.perspective=t),[2,e]}}))}))},t.prototype.showPerspective=function(e,t){return c(this,void 0,void 0,(function(){var n,r,o;return u(this,(function(i){switch(i.label){case 0:return n=this.perspectiveViewsCache.getCachedViewByPerspectiveNameAndContext(e,t),r=this.Glass.currentAppView,(0,y.arePerspectivesEqual)(n,r)?[2,n]:n?[4,this.showCachedPerspective(n,e,t)]:[3,2];case 1:return i.sent(),o=n.hasHomeFlag()||t&&t.isHomepage,this.setHomeFlag(n,o),[2,this.displayPerspective(n,r)];case 2:return[4,this.showNonCachedPerspective(e,t,r)];case 3:return[2,i.sent()]}}))}))},t.prototype.buildPerspectiveContext=function(e,t){return c(this,void 0,void 0,(function(){var n,r;return u(this,(function(o){switch(o.label){case 0:return n=this.buildNewPerspectiveContext(e,t),void 0!==e&&void 0===n.content.pathRef?[2,{context:n,perspectiveName:e}]:[4,this.getDefaultActionUrlMap(n.content)];case 1:return r=o.sent(),[2,{context:function(e,t,n){var r=t;return void 0===e&&(r.isDefaultAction=!0),r.isHomepage=t.isHomepage||n&&n.isHomepage,r.content=n,r}(e,n,r),perspectiveName:void 0===e?r.perspective:e}]}}))}))},t.prototype.buildNewPerspectiveContext=function(e,t){var n=t||{};return n.content=n.content||{},n.content.perspective=e,this.Glass.currentAppView&&this.Glass.currentAppView.context&&this.Glass.currentAppView.context.content&&(n=this.urlHelper.updateContextWithCurrentUIFilters(this.Glass.currentAppView.context.content,n)),n},t.prototype.getDefaultActionUrlMap=function(e){return c(this,void 0,void 0,(function(){var t,n,r,o,i;return u(this,(function(s){switch(s.label){case 0:return e&&(e.pathRef||e.objRef)?[4,this.urlHelper.getObjInfoFromContent(this.Glass,e)]:[3,3];case 1:return t=s.sent(),C.default.extend(!0,t,e),void 0===t.id&&(t.id=t.objRef),t.perspective?[2,t]:[4,b.default.getSharedResourceActionController(this.Glass,t.type)];case 2:return n=s.sent(),r={urlMap:t,mode:m.default.MODES.DEFAULT_ACTION,Glass:this.Glass,glassContext:this.Glass},[2,this.urlHelper.getUrlMap(n,this.Glass,r)];case 3:return e&&e.perspective?[3,5]:[4,this.Glass.getHomePageObject()];case 4:return o=s.sent(),i={perspective:o.perspective},C.default.extend(!0,i,e,o.content),i.pathRef?[2,this.getDefaultActionUrlMap(i)]:[2,i];case 5:return[2,null]}}))}))},t.prototype.handleOpenLoginViewError=function(){var e=w.default.get("customLoginPerspectiveNotFound"),t=w.default.get("defaultToIBMLoginPage");this.Glass.showErrorMessage(t,e,(function(){var e=window.location.href;e.includes("/",e.length-1)?window.location.href=e+"?factoryMode=true":window.location.href=e+"&factoryMode=true"}))},t.prototype.handleOpenPerspectiveError=function(e){return c(this,void 0,void 0,(function(){var t,n,r,o=this;return u(this,(function(i){switch(i.label){case 0:if(this.logger.error("openAppView",e),t=function(e){var t=!0===e?"errLoadingViewShowHome":"errLoadingView";o.Glass.showToast(w.default.get(t),{type:"error",preventDuplicates:!1})},n=function(){var e=w.default.get("errLoadingView"),t=w.default.get("errorLabel");return o.Glass.showErrorMessage(e,t),o.Glass.currentAppView},0!==this.perspectiveSwitcherRegistry.size())return[3,4];this.pendingOpenPerspectivePromise=null,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.openHomePerspective()];case 2:return r=i.sent(),t(!0),[2,r];case 3:return i.sent(),n(),[3,4];case 4:return t(),[2,null]}}))}))},t.prototype.handleShowNonCachedPerspectiveError=function(e,t){var n=e.message,r="Error";throw e.ajaxOptions&&e.ajaxOptions.url?(n="Glass Perspective Service : "+e.ajaxOptions.url,r=w.default.get("error404NotFound")):"BaseError"===e.name?r="Error: "+w.default.get("invalidPerspectiveErrorTitle"):404===e.code&&(r=w.default.get("perspective404ErrorTitle"),n=w.default.get("perspective404ErrorMessage"),t.isHomepage&&(n=w.default.get("perspective404HomeErrorMessage"))),this.logger.error("Perspective Error: Failed to load the requested perspective"),this.Glass.showErrorMessage(n,r),e},t.prototype.openPendingPerspective=function(){var e=this;try{return this.pendingOpenPerspectivePromise=Promise.resolve(this.pendingOpenPerspectivePromise).finally((function(){e.pendingOpenPerspectivePromise=null})),this.pendingOpenPerspectivePromise}catch(e){return this.logger.error("openAppView - previous attempt failed",e),Promise.resolve()}},t.prototype.removeLoginView=function(){this.perspectivesRegistry.remove("login"),this.loginView.getContentPane().remove(),this.loginView.remove(!0),this.loginView=void 0},t.prototype.updateUserProfileContext=function(e){return c(this,void 0,void 0,(function(){var t;return u(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.Glass.getCoreSvc(".UserProfile").updateContext(e.context)];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),this.logger.error("Perspective Error: Could not get the account info",t),this.Glass.showErrorMessage(w.default.get("unableGetAccountInfo"),w.default.get("accountInfoTitle")),[3,3];case 3:return[2]}}))}))},t}(p.default);t.default=_},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o.filter((function(e){for(var t=0;t0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(1)),c=n(9),u=s(n(89)),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.getPerspectiveView=function(e){var t=this.props,n=t.glassStore,r=t.perspectiveRegistry.getPerspectiveById(e);return a.default.createElement(u.default,{key:e,perspectiveStore:r.getPerspectiveStore(),glassStore:n},r.getPerspectiveView())},t.prototype.render=function(){var e=this,t=this.props.glassStore;return a.default.createElement(a.default.Fragment,null,t.registeredPerspectives.map((function(t){return e.getPerspectiveView(t)})))},t=i([c.observer],t)}(a.default.Component);t.default=l},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__decorate||function(e,t,n,r){var o,i=arguments.length,s=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(1)),c=n(9),u=s(n(2)),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.getClassNames=function(){var e=this.props,t=e.perspectiveStore,n=e.glassStore,r="appview";t.perspectiveModel.id!==n.currentPerspective&&(r+=" hidden");var o=t.perspectiveModel.layout;return o[u.default.LOOPS]&&o.class&&(r+=" "+o.class),r},t.prototype.render=function(){var e=this.props.children;return a.default.createElement("div",{className:this.getClassNames()},e)},t=i([c.observer],t)}(a.default.Component);t.default=l},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(91)),i=function(){function e(e,t){this.glassContext=t,this.perspectivesRegistry=e}return e.prototype.create=function(e){var t=this;e?(Array.isArray(e)||(e=[e]),e.forEach((function(e){t.perspectivesRegistry.add(e.id,new o.default(e,t.glassContext))}))):this.glassContext.getCoreSvc(".Logger").error("Error creating the perspective, perspectiveModels is undefined")},e}();t.default=i},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(1)),i=r(n(92)),s=r(n(101)),a=r(n(111)),c=r(n(48));var u=function(){function e(e,t){this.perspectiveStore=function(e){return s.default.create({perspectiveModel:e,contextMenuStore:c.default.create()})}(e),this.perspectiveController=function(e,t){return new i.default(e,t)}(this.perspectiveStore,t),this.perspectiveView=function(e,t,n){return o.default.createElement(a.default,{appView:e,glassContext:n,perspectiveStore:t,toolBars:t.perspectiveModel.toolBars,addPluginRenderToQueue:e.addPluginRenderToQueue,onPerspectiveViewMounted:e.renderAllPlugins,onContentContainerMounted:e.setContentContainerMounted,onNoContentViewFound:e.resolveViewRenderPromise,successContentViewRenderCallback:e.successContentViewRenderCallback,failureContentViewRenderCallback:e.failureContentViewRenderCallback,getContentView:e.getCurrentContentView})}(this.perspectiveController,this.perspectiveStore,t),this.registeredPlugins={}}return e.prototype.registerPlugin=function(e,t){this.registeredPlugins[e]=t},e.prototype.getRegisteredPlugin=function(e){return this.registeredPlugins[e]?this.registeredPlugins[e]:null},e.prototype.getPerspectiveController=function(){return this.perspectiveController},e.prototype.getPerspectiveStore=function(){return this.perspectiveStore},e.prototype.getPerspectiveView=function(){return this.perspectiveView},e}();t.default=u},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]1){var t=this.glassContext.perspectiveSwitcherRegistry.getPerspectiveByIndex(0),n=t.getContentPane();n&&t._slideoutController.updateRegistryContainer(n)}return Promise.resolve().then((function(){return e.currentContentView&&p.default.isFunction(e.currentContentView.remove)?(e.contentViewRemoved=!0,e.currentContentView.remove()):Promise.resolve()})).catch((function(t){e.glassContext.getCoreSvc(".Logger").error("An error occurred while removing the content view",t)})).then(this._postRemove.bind(this))},e.prototype._postRemove=function(){this.setContentPane(void 0)},e.prototype.isDirty=function(){return this.currentContentView&&p.default.isFunction(this.currentContentView.isDirty)&&this.currentContentView.isDirty()},e.prototype.shouldShowCloseConfirmationDialog=function(){return!!this.isDirty()&&(!this.currentContentView||!p.default.isFunction(this.currentContentView.shouldShowCloseConfirmationDialog)||this.currentContentView.shouldShowCloseConfirmationDialog())},e.prototype.getTitle=function(e){var t=this.currentContentView&&p.default.isFunction(this.currentContentView.getTitle)?this.currentContentView.getTitle():this.perspectiveModel.perspectiveName;return void 0===t&&(t=w.default.get("unavailable")),!e&&this.isDirty()&&(t+=" *"),t},e.prototype.getIcon=function(){return this.currentContentView&&p.default.isFunction(this.currentContentView.getIcon)&&this.currentContentView.getIcon()},e.prototype.getIconTooltip=function(){return this.currentContentView&&p.default.isFunction(this.currentContentView.getIconTooltip)&&this.currentContentView.getIconTooltip()},e.prototype.getIconColor=function(){var e="";try{e=this.currentContentView&&p.default.isFunction(this.currentContentView.getIconColor)&&this.currentContentView.getIconColor()}catch(e){this.glassContext.getCoreSvc(".Logger").warn("issue getting icon color from current content view",e)}return e||(e="#1d3458"),e},e.prototype.getContentPane=function(){return this.$contentPane},e.prototype.setContentPane=function(e){this.$contentPane=e},e.prototype._updateSlideoutContainer=function(){var e=this;return new Promise((function(t){var n=e.getContentPane();if(n)try{e._slideoutController.updateRegistryContainer(n),t()}catch(r){e.glassContext.getCoreSvc(".Logger").warn("Failed to update slideout container. Slideouts stuck open in previous view. Closing and trying again...",r),e.glassContext.closeOpenWidgets().then((function(){e._slideoutController.updateRegistryContainer(n),t()})).catch((function(){e._slideoutController.updateRegistryContainer(n),t()}))}else t()}))},e.prototype.showContentView=function(e){var t=this;return this._updateSlideoutContainer().then((function(){(e=e||{}).content||(e.content=t.defaultContent);var n=e.content;return n&&!n.module&&(n.module=t.defaultContent.module),t.currentContentView?t._setContentView(e):Promise.resolve()}))},e.prototype._setContentView=function(e){var t=this;return this.currentContentView.activate&&this.currentContentView.deactivated?this.currentContentView.activate(e.content).then((function(){return t._setContentViewHelper(e)})):Promise.resolve(this._setContentViewHelper(e))},e.prototype._setContentViewHelper=function(e){return this._setCurrentContentView(this.currentContentView,e),this.currentContentView},e.prototype.onViewRendered=function(){var e=this;return new Promise((function(t,n){f.when((function(){return e.perspectiveStore.contentViewRendered}),(function(){return t(e)})),f.when((function(){return e.perspectiveStore.contentViewRenderFailed}),(function(){return n()}))}))},e.prototype.registerPlugin=function(e,t){p.default.isString(e)&&(this.registeredPlugins[e]=t)},e.prototype.performAction=function(e,t){var n=this.perspectiveModel.actions;return n?Promise.resolve(S.default.performAction(e,t,n)):Promise.reject(new d.default("Internal error: unable to find action for "+e))},e.prototype.canExecuteAction=function(e,t){var n=this.perspectiveModel.actions;return n?S.default.canExecuteAction(e,t,n):Promise.reject(new d.default("Internal error: unable to find action for "+e))},e.prototype.openSlideout=function(e){return this.glassContext.addToOptions(e),this._openSlideout("appView",e)},e.prototype.closeAllOpenedSlideouts=function(e){return this._slideoutController.closeAllOpenedSlideouts(e)},e.prototype._openSlideout=function(e,t){return t.parent&&!Object.prototype.isPrototypeOf.call(v.default,t)?t.parent.addChild(t):this._slideoutController.openSlideout(e,t)},e.prototype._setCurrentContentView=function(e,t){this.context=t,this.content=t.content,this.currentContentView=e,this.updateRenderState(!1),this.currentContentView.deactivated=!1,e.show()},e.prototype.setAsHome=function(e){var t=this;return Promise.resolve().then((function(){var n=t.getType();return p.default.isUndefined(n)?t._setAsHome({perspective:t.perspectiveModel.perspectiveName,id:t.context&&t.context.id}):C.default.getSharedResourceActionController(t.glassContext,n).then((function(r){var o={urlMap:{objRef:t.content?t.content.objRef:void 0,type:n},mode:m.default.MODES.CURRENT};return t.content.mode&&(o.urlMap.mode=t.content.mode),p.default.extend(o,e),t._url.getUrlMap(r,t.glassContext,o).then(t._setAsHome.bind(t))}))}))},e.prototype.setHomeFlag=function(e){this.context.isHomepage=!0===e},e.prototype.hasHomeFlag=function(){return!0===this.context.isHomepage},e.prototype._setAsHome=function(e){var t=this._url.getContextFromUrlMap(e),n={homePage:JSON.stringify(t)};return this.glassContext.getCoreSvc(".UserProfile").savePreferences(n).then(this.setHomeFlag.bind(this,!0))},e.prototype.getType=function(){var e=this.currentContentView;return!p.default.isUndefined(e)&&p.default.isFunction(e.getType)?e.getType():E.default[this.perspective]},e.prototype.getContent=function(e){var t,n=this.currentContentView;return!p.default.isUndefined(n)&&p.default.isFunction(n.getContent)&&(t=n.getContent(e)),t},e.prototype._updateHistory=function(e,t,n,r){if(!this.context.content.options||!this.context.content.options.ignoreInWindowHistory){e.name=e.perspective;try{!0===r||this===this.glassContext.previousAppView?window.history.replaceState(e,t,n):window.history.pushState(e,t,n)}catch(e){}}},e.prototype.updateRenderState=function(e){var t=this._getContext(),n=this.getTitle();if(this.glassContext.trackHistory&&!this.glassContext.windowPoppingState&&"login"!==this.perspective&&t.content){var r=this._getContext({mode:"bookmark"}),o=p.default.omit(r,"content");Object.assign(o,this.content);var i=Object.assign(this._url.getPublicMap({urlMap:o}),r.content);delete i.module;var s=this._url.getUrl({urlMap:i},this.glassContext);this.glassContext.previousAppView&&"login"!==this.glassContext.previousAppView.perspective?this._updateHistory(t,n,s,e):this._updateHistory(t,n,s,!0)}this._triggerTitleChange({value:n})},e.prototype._getContext=function(e){var t={perspective:this.perspective},n=this.perspectiveModel.modelId;if(n&&(t.id=n),this.currentContentView){var r=this.getContent(e)||this.content;r&&(t.content=r)}return t},e.prototype.cleanupSlideoutController=function(){this._slideoutController.cleanupSlideoutRegistry()},e.prototype.getCurrentPerspective=function(){return this.perspective},e.prototype.setFocus=function(){!p.default.isUndefined(this.currentContentView)&&p.default.isFunction(this.currentContentView.setFocus)&&this.currentContentView.setFocus()},e.prototype.$=function(e){return(0,l.default)(".appview:not(.hidden)").find(e)},e}();t.default=j},function(e,t){e.exports=A},function(e,t){e.exports=I},function(e,t){e.exports=D},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=e.length?"canExecute"!==o||!0!==r&&!1!==r?Promise.reject(r):Promise.resolve(r):d(e,t,i,o)}function f(e,t,n,r,i){return"defaultAction"===i?function(e,t,n,r){if(o.a.isFunction(e.doAction))return Promise.resolve(e.doAction(n)).catch((function(e){return p(t,n,r,e,"defaultAction")}));var i=new s.a("doAction is not defined on the controller");return p(t,n,r,i,"defaultAction")}(e,t,n,r):"canExecute"===i?Promise.resolve(!0):Promise.resolve()}function d(e,t,n,r){return l(e,n).then((function(i){var a;return o.a.isFunction(i.canExecute)?!0===i.canExecute(t)?f(i,e,t,n,r):("defaultAction"===r?a=new s.a("Action controller can not execute this object."):"canExecute"===r&&(a=!1),p(e,t,n,a,r)):f(i,e,t,n,r)})).catch((function(o){return p(e,t,n,o,r)}))}function h(e,t,n,r){var o=r.find((function(t){return t.id===e}));return o?function(e,t,n,r){return e&&e.length>0?d(e,t,0,r):Promise.reject(new s.a("Internal error: no controller defined for ".concat(n)))}(o.items,t,e,n):Promise.reject(new s.a("Internal error: unable to find action for ".concat(e)))}function y(e,t,n,r){return r?h(e,t,n,r):Promise.reject(new s.a("No action controllers defined."))}var v={performAction:function(e,t,n){return y(e,t,"defaultAction",n)},canExecuteAction:function(e,t,n){return y(e,t,"canExecute",n)}};t.default=v},function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.dashboard="exploration",e.authoring="report",e.classicviewer="interactiveReport",e.datasets="dataSet2",e.modeller="module",e.savedoutput="output"}(r||(r={})),t.default=r},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=n(5),i=r(n(3)),s=r(n(47)),a=r(n(40)),c=r(n(48)),u=s.default.PLUGINS_RENDER_IN_PROGRESS,l=s.default.PLUGINS_RENDER_SUCCESS,p=s.default.CONTENT_VIEW_LOAD_SUCCESS,f=s.default.CONTENT_VIEW_LOAD_FAILURE,d=s.default.CONTENT_VIEW_RENDER_SUCCESS,h=s.default.CONTENT_VIEW_RENDER_FAILURE,y=o.types.model({containerMounted:o.types.optional(o.types.boolean,!1),perspectiveModel:a.default,renderState:o.types.optional(o.types.enumeration("RenderState",i.default.values(s.default)),u),visible:o.types.optional(o.types.boolean,!1),contextMenuStore:c.default}).views((function(e){return{get viewReadyToLoadContentView(){return e.renderState===l&&e.containerMounted},get contentViewLoadedSuccessfully(){return e.renderState===p||e.renderState===d},get contentViewLoadFailed(){return e.renderState===f},get contentViewRendered(){return e.renderState===d},get contentViewRenderFailed(){return e.renderState===h},get loaded(){return e.renderState===d||e.renderState===f||e.renderState===h}}})).actions((function(e){return{setVisibility:function(t){e.visible=t},updateRenderState:function(t){e.renderState=t},setContainerMounted:function(t){e.containerMounted=t}}}));t.default=y},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return d}));var r=n(1),o=n(0),i=n.n(o);function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,n,s):o(t,n))||s);return i>3&&s&&Object.defineProperty(t,n,s),s},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var a=s(n(1)),c=n(8),u=n(9),l=s(n(3)),p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.render=function(){var e=this.props,t=e.store,n=e.className,r=t.disabled,o=t.iconId,i=t.label,s=n+(r?" disabled":" enabled");return t.visible&&a.default.createElement("div",{className:s},o&&a.default.createElement(c.SVGIcon,{className:"svgIcon",iconId:o,size:"normal",verticalAlign:"middle"}),l.default.unescape(i))},t=i([u.observer],t)}(a.default.Component);t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.perspectives={},this.glassStore=e}return e.prototype.add=function(e,t){this.perspectives[e]=t,this.glassStore.registerPerspective(e)},e.prototype.remove=function(e){this.glassStore.deregisterPerspective(e),delete this.perspectives[e]},e.prototype.getPerspectiveById=function(e){return this.perspectives[e]},e}();t.default=r},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};function s(e,t){var n=e;return t&&t.content&&t.content.id?n+="|"+t.content.id:t&&t.id&&(n+="|"+t.id),n}Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t){var n=e.call(this,t)||this;return n.cache={},n}return o(t,e),Object.defineProperty(t.prototype,"perspectiveViewsCache",{get:function(){return this.cache},enumerable:!1,configurable:!0}),t.prototype.cacheView=function(e,t,n){if(this.Glass.cacheAppViews&&"login"!==e){var r=s(e,t);n.cacheKey=r,this.cache[r]=n}},t.prototype.clearCache=function(){this.cache={}},t.prototype.getCacheKeys=function(){return Object.keys(this.cache)},t.prototype.getCachedPerspectives=function(){return Object.values(this.cache)},t.prototype.getCachedView=function(e){return this.cache[e]},t.prototype.getCachedViewByPerspectiveNameAndContext=function(e,t){return this.cache[s(e,t)]},t.prototype.getDirtyCachedViews=function(){var e=this,t=[];return this.getCacheKeys().forEach((function(n){var r=e.getCachedView(n);r.shouldShowCloseConfirmationDialog()&&t.push(r)})),t},t.prototype.removeCachedView=function(e){this.getCachedView(e)&&delete this.cache[e]},t.prototype.updateCache=function(e){var t=s(e.perspective,e.context);if(e.context){var n=e.context.id,r=e.context?e.context.id:void 0,o=r||n,i=void 0,a=void 0,c={};e.contentViewRemoved||(i=e.getContent(e.context.content))&&(a=i.id?i.id:r,e.context.content=i,e.content=i,a!==o&&(e.id=a),delete this.cache[t],c={id:a},this.cacheView(e.perspective,c,e))}},t}(i(n(6)).default);t.default=a},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t){var n=e.call(this,t)||this;return n.registry=[],n}return o(t,e),t.prototype.addPerspective=function(e){e&&"login"!==e.perspective&&!this.registry.includes(e)&&this.registry.push(e)},t.prototype.clearAllPerspectiveHomeFlags=function(){this.registry.forEach((function(e){e.setHomeFlag(!1)}))},t.prototype.containsPerspective=function(e){return this.registry.includes(e)},t.prototype.getIndexOfPerspective=function(e){return this.registry.indexOf(e)},t.prototype.getPerspectiveByIndex=function(e){return this.registry[e]},t.prototype.removePerspectiveAtIndex=function(e){this.registry.splice(e,1)},t.prototype.removePerspective=function(e){var t=this.getIndexOfPerspective(e);-1===t?t=0:this.registry.splice(t,1)},t.prototype.size=function(){return this.registry.length},t}(i(n(6)).default);t.default=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]');
* $element.ariaButton({label: 'some label'}).addClass('some class');
*/
$.fn.ariaButton = function (options) {
return this.each(function (index, element) {
var $el = $(element);
$el.attr('type', 'button');
$el.attr('role', 'button');
if (options) {
if (options.haspopup === true) {
$el.attr('aria-haspopup', 'true');
}
$el.text(options.label);
$el.attr('title', options.title ? options.title : options.label);
$el.attr('id', options.id);
}
});
};
});
//# sourceMappingURL=JQueryAria.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI
* (C) Copyright IBM Corp. 2015, 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/utils/JQueryExt',['jquery', '../ui/KeyCodes', './EventHelper', './JQueryAria'], function ($, KeyCodes) {
// Add a custom event that will handle both click and tap. This custom event will cancel the simulated clicks on mobile
$.event.special.clicktap = {
add: function add(obj) {
var isHandled = false;
$(this).on('click.clicktap_' + obj.guid, obj.selector, function (e) {
if (isHandled) {
if (obj.data && obj.data.allowPropagationDefaultAction) {
return true;
}
// We already handled this click, so we don't call the handler.
// We also stop the propagation so other handlers don't end up being triggered.
e.stopPropagation();
isHandled = false;
return false;
} else {
return obj.handler.apply(this, arguments);
}
}).on('tap.clicktap_' + obj.guid, obj.selector, function (e) {
e.pageX = e.gesture.center.pageX; // set pageX for 'tap' event
e.pageY = e.gesture.center.pageY;
isHandled = true;
return obj.handler.apply(this, arguments);
});
},
remove: function remove(obj) {
$(this).off('.clicktap_' + obj.guid);
}
};
/**
* Add a custom event that handles click, tap and keypress of enter & space keys
* Note on the implementation:
* - cancels the simulated clicks on mobile
* - key press is ignored when the element is a button because the browser automically triggers a click for those;
* The event sequence is the following:
* Without JAWS:
* - for enter: keydown->click->keyup; in this case, the keyup event is attached to the current active element which can be
* different from the initial one.
* for example: Pressing a button in dialog which closes it and sets the focus on a div which has a button role.
* - for space: keydown->keyup->click
* With JAWS: the click event is triggered only for elements with a button role.
* Corollary: only non-button elements have their handler attached to the keydown and keyup events
* - on keydown, we flag the fact that the handler is to be invoked at keyup time; this is to handle the case where
* click and keyup events are attached to different elements.
* - limitation:
* - handler defined for non-button parent & child elements: when the propagation is stopped in the child handler,
* parent handler can be invoked on keyup only.
*/
$.event.special.primaryaction = {
add: function add(obj) {
var isTapHandled = false;
var ENTERKEY = KeyCodes.ENTER;
var SPACEKEY = KeyCodes.SPACE;
var isKeytoProcess = false;
$(this).on('click.primaryaction_' + obj.guid, obj.selector, function (e) {
isKeytoProcess = false;
if (isTapHandled) {
if (obj.data && obj.data.allowPropagationDefaultAction) {
return true;
}
// We already handled this click, so we don't call the handler.
// We also stop the propagation so other handlers don't end up being triggered.
e.stopPropagation();
isTapHandled = false;
return false;
} else {
return obj.handler.apply(this, arguments);
}
}).on('tap.primaryaction_' + obj.guid, obj.selector, function (e) {
isTapHandled = true;
e.pageX = e.gesture.center.pageX;
e.pageY = e.gesture.center.pageY;
return obj.handler.apply(this, arguments);
}).on('keydown.primaryaction_' + obj.guid, obj.selector, function (e) {
var key = e.which || e.keyCode;
isKeytoProcess = (key === ENTERKEY || key === SPACEKEY) && !$(e.target).is('button');
}).on('keyup.primaryaction_' + obj.guid, obj.selector, function (e) {
var key = e.which || e.keyCode;
if ((key === ENTERKEY || key === SPACEKEY) && !$(e.target).is('button') && isKeytoProcess === true) {
isKeytoProcess = false;
return obj.handler.apply(this, arguments);
} else {
isKeytoProcess = false;
}
});
},
remove: function remove(obj) {
$(this).off('.primaryaction_' + obj.guid);
}
};
/**
* Add a custom event that will handle both escape and ctrl+[
* Note on the implementation:
* - Handler is invoked on keyup event only.
* - For escape, keyup invokes the handler regardless of any keys pressed after keydown
* - For ctrl+[, keyup invokes the handler only if the ctrl+[ keydown event had occurred just before.
* - iPad + AppleKeyboard + VoiceOver combination does not provide the expected keycodes on keyup.
* - As a result, on keyup, we only check that ctrl is held, and that the ctrl+[ keydown had occurred just before.
* - Corollary: If a key is pressed down before [, letting go of that key will invoke the handler.
* - On keydown, we flag the fact that the handler is to be invoked at keyup time; this is ensure the event can only
* happen once, and it allows us to check the keycodes in keydown, where they are available.
*/
$.event.special.escapeaction = {
add: function add(obj) {
var ESCAPEKEY = KeyCodes.ESCAPE;
var SQUARE_OPEN_BRACKET = KeyCodes.OPEN_BRACKET;
var isCtrlBracketToProcess = false;
$(this).on('keydown.escapeaction_' + obj.guid, obj.selector, function (e) {
var key = e.which || e.keyCode;
isCtrlBracketToProcess = key === SQUARE_OPEN_BRACKET && e.ctrlKey;
}).on('keyup.escapeaction_' + obj.guid, obj.selector, function (e) {
var key = e.which || e.keyCode;
if (key === ESCAPEKEY) {
isCtrlBracketToProcess = false;
return obj.handler.apply(this, arguments);
}
if (e.ctrlKey && isCtrlBracketToProcess) {
isCtrlBracketToProcess = false;
return obj.handler.apply(this, arguments);
}
isCtrlBracketToProcess = false;
});
},
remove: function remove(obj) {
$(this).off('.escapeaction_' + obj.guid);
}
};
/**
* Add a custom event that handles "DELETE" and "CTRL+SECOND" key down & up events
* Note on the implementation:
* - Handler is invoked on keyup event only.
* - For DELETE, keyup invokes the handler regardless of any keys pressed after keydown
* - For CTRL+SECOND, keyup invokes the handler only if CTRL+SECOND keydown event had occurred just before.
* This key combination workarounds the issue that on IPAD+Apple Wireless keyboard+VoiceOver, the DELETE key
* event can not be captured
*/
$.event.special.deleteaction = {
add: function add(obj) {
var isCtrlSecondEventKeyDowned = false;
$(this).on('keydown.deleteaction_' + obj.guid, obj.selector, function (e) {
var key = e.which || e.keyCode;
isCtrlSecondEventKeyDowned = key === KeyCodes.SECOND && e.ctrlKey;
}).on('keyup.deleteaction_' + obj.guid, obj.selector, function (e) {
var key = e.which || e.keyCode;
//invokes the handler as long as DELETE keycode is received in keyup event
if (key === KeyCodes.DELETE) {
isCtrlSecondEventKeyDowned = false;
return obj.handler.apply(this, arguments);
}
//Otherwise, invokes the handler handler if CTRL+SECOND were flagged keydown-ed
if (e.ctrlKey && isCtrlSecondEventKeyDowned) {
isCtrlSecondEventKeyDowned = false;
return obj.handler.apply(this, arguments);
}
isCtrlSecondEventKeyDowned = false;
});
},
remove: function remove(obj) {
$(this).off('.deleteaction_' + obj.guid);
}
};
return $;
});
//# sourceMappingURL=JQueryExt.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Glass
* (C) Copyright IBM Corp. 2015, 2021
* US Government Users Restricted Rights - Use, duplication or disclosure
* restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/AppController',['../core-client/js/core-client/ui/core/Class', 'baglass/glass.webpack.bundle', '../core-client/js/core-client/utils/ClassFactory', '../core-client/js/core-client/utils/JQueryExt', 'jquery-ui'], function (Class, GlassWebpackBundle, ClassFactory) {
var Glass = GlassWebpackBundle.Glass,
ExtendObject = GlassWebpackBundle.ExtendObject;
/**
* @public
*/
var AppController = Class.extend(
/**
* @lends AppController.prototype
*/
{
_ClassFactory: ClassFactory,
/**
* @classdesc Main class giving access to method managing the perspectives
* @constructs
* @public
* @param {Object}
* options - set of initial properties
*/
init: function init(options) {
AppController.inherited('init', this, arguments);
ExtendObject(this, options);
var config = {
appController: this,
trackHistory: options.trackHistory !== false && options.trackHistory !== 'false',
cacheAppViews: options.cacheAppViews !== false && options.cacheAppViews !== 'false',
installInfo: options.installInfo,
versionInfo: options.versionInfo,
authInfo: options.authInfo,
requirejs: requirejs
};
this.Glass = new Glass(config, options);
this.glassContext = this.Glass;
this.Glass.initialize();
this.Glass.getCoreSvc('.Logger').setLevelWarn();
},
/** MOVED TO GLASS */
getCurrentContentView: function getCurrentContentView() {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.getCurrentContentView is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.getCurrentContentView();
},
// Actions API
canExecuteAction: function canExecuteAction(id, object) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.canExecuteAction is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.canExecuteAction(id, object);
},
performAction: function performAction(id, object) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.performAction is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.performAction(id, object);
},
// Accessibility API
isHighContrastOn: function isHighContrastOn() {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.isHighContrastOn is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.isApplicationStyledForHighContrast();
},
detectAccessibilityChange: function detectAccessibilityChange(accessibilityMode) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.detectAccessibilityChange is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.detectAccessibilityChange(accessibilityMode);
},
// Context Menu API
showContextMenu: function showContextMenu(args) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.showContextMenu is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.showContextMenu(args);
},
// Dialog Toast API
showErrorMessage: function showErrorMessage(error, title, callback, htmlContent) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.showErrorMessage is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.showErrorMessage(error, title, callback, htmlContent);
},
showMessage: function showMessage(msg, title, type, buttons, width, callback, htmlContent, className) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.showMessage is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.showMessage(msg, title, type, buttons, width, callback, htmlContent, className);
},
showEmbedDialog: function showEmbedDialog(model) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController. is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.showEmbedDialog(model);
},
showResetHomeDialog: function showResetHomeDialog(errMessage) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.showEmbedDialog is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.showResetHomeDialog(errMessage);
},
showShareDialog: function showShareDialog(model) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.showShareDialog is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.showShareDialog(model);
},
// Events API
emit: function emit(eventName, event) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.emit is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.trigger(eventName, event);
},
on: function on(eventName, handler, context) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.on is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.on(eventName, handler, context);
},
off: function off(eventName, handler, context) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.off is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.off(eventName, handler, context);
},
trigger: function trigger(eventName, event) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.trigger is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.trigger(eventName, event);
},
// Home Page API
setDefaultHomePerspective: function setDefaultHomePerspective(perspective) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.setDefaultHomePerspective is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.setDefaultHomePerspective(perspective);
},
resetHome: function resetHome(isCurrentViewBroken) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.resetHome is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.resetHome(isCurrentViewBroken);
},
// Perspective LifeCycle API
closeAppView: function closeAppView(perspective, id, options) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.closeAppView is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.closeAppView(perspective, id, options);
},
close: function close(force, isBrowser) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.close is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.close(force, isBrowser);
},
getCurrentPerspective: function getCurrentPerspective() {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.getCurrentPerspective is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.getCurrentPerspective();
},
isOpeningAView: function isOpeningAView() {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.isOpeningAView is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.isOpeningAView();
},
isLoginViewShown: function isLoginViewShown() {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.isLoginViewShown is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.isLoginViewShown();
},
openAppView: function openAppView(perspective, context) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.openAppView is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.openAppView(perspective, context);
},
openLoginView: function openLoginView(context) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.openLoginView is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.openLoginView(context);
},
openPreviousAppView: function openPreviousAppView() {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.openPreviousAppView is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.openPreviousAppView();
},
// Search Perspective DOM API
findCollection: function findCollection(id) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.findCollection is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.findCollection(id);
},
findElement: function findElement(id) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.findElement is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.findElement(id);
},
findPlugin: function findPlugin(id) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.findPlugin is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.findPlugin(id);
},
// Slideout API
hideSlideOut: function hideSlideOut(excludeAppViewSlideouts) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.hideSlideOut is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.hideSlideOut(excludeAppViewSlideouts);
},
showSlideOut: function showSlideOut(options) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.showSlideOut is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.showSlideOut(options);
},
// Toast API
showToast: function showToast(message, options) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.showToast is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.showToast(message, options);
},
// Theme API
reloadTheme: function reloadTheme() {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.reloadTheme is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.reloadTheme();
},
// URL API
getUrl: function getUrl(context) {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.getUrl is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.getUrl(context);
},
// Other
updateCurrentCachedAppView: function updateCurrentCachedAppView() {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.updateCurrentCachedAppView is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.updateCurrentCachedAppView();
},
/** TO BE DEPRECATED */
lockGlass: function lockGlass() {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.lockGlass is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.lockGlass();
},
unlockGlass: function unlockGlass() {
// this.Glass.getCoreSvc('.Logger').warn('Usage of glassContext.appController.unlockGlass is deprecated. Please update your usage according to the documentation here : https://pages.github.ibm.com/BusinessAnalytics/glass-documentation/docs/documentation/api/api_glass/');
return this.Glass.unlockGlass();
}
});
return AppController;
});
//# sourceMappingURL=AppController.js.map
;
/**
* Licensed Materials - Property of IBM
*
* IBM Cognos Products: BI Titan
*
* Copyright IBM Corp. 2015, 2018
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/ui/Button',['./core/View', 'jquery', 'underscore', '../utils/Utils', '../utils/JQueryExt'], function (View, $, _, utils) {
/**
* This Class is the Glass provided button widget
*/
var Button = View.extend({
tagName: 'button',
events: {
'primaryaction': '_onSelect'
},
/**
*@constructs
*@buttonSpec specification of the button
*/
init: function init(args) {
Button.inherited('init', this, args.buttonSpec);
_.extend(this, args.buttonSpec);
},
/**
* Render the plugin.
* @override
*/
render: function render() {
this.$el.ariaButton(this);
utils.addClass(this.$el, 'button');
utils.addClass(this.$el, this['class']);
utils.setIcon(this.$el, this.icon, this.title);
this._initializePressState();
return Promise.resolve(this.el);
},
/**
* Sets a push button in the pressed state; Does nothing if this is regular button; i.e. not a push one
* @public
*/
setPressed: function setPressed() {
this.$el.addClass('pushed');
this.$el.attr('aria-pressed', 'true');
this.$el.attr('aria-checked', 'true');
},
/**
* Sets a push button in the unpressed state; Does nothing if this is regular button; i.e. not a push one
* @public
*/
setUnpressed: function setUnpressed() {
this.$el.removeClass('pushed');
this.$el.blur();
this.$el.attr('aria-pressed', 'false');
this.$el.attr('aria-checked', 'false');
},
/**
* toggles the pressed state; Does nothing if this is regular button; i.e. not a push one
* @public
* @return {Boolean} the pressed state it is toggled into: true if pressed false otherwise
*/
togglePressed: function togglePressed() {
if (this.isPressed() === true) {
this.setUnpressed();
} else {
this.setPressed();
}
return this.isPressed();
},
/**
* sets the button as selected; selection is different from push, as it is exclusive, for now: you can have only one
* selected button; set the selection state only if it is not a push button
*
*/
setSelected: function setSelected() {
var $activeButton = $('.currentlySelected');
if ($activeButton[0]) {
$activeButton.removeClass('currentlySelected');
}
if (!this.push) {
this.$el.addClass('currentlySelected');
}
},
/**
* Gets the states of a pushed button
* @public
* @return {Boolean} true if pressed; false otherwise
*/
isPressed: function isPressed() {
return this.$el.hasClass('pushed');
},
/**
* Sets a button to the disabled state
* @public
*/
disable: function disable() {
this.$el.addClass('disabled');
this.$el.attr('aria-disabled', 'true');
this.$el.attr('tabindex', '-1');
},
/**
* Sets a button to the enabled state
* @public
*/
enable: function enable() {
this.$el.removeClass('disabled');
this.$el.attr('aria-disabled', 'false');
this.$el.attr('tabindex', '0');
},
/**
* Gets the enabled state of a button
* @public
* @return {Boolean} true if disabled; false otherwise
*/
isEnabled: function isEnabled() {
return !this.$el.hasClass('disabled');
},
/**
* @private
* callback attached to all the items
* @param the corresponding event
*/
_onSelect: function _onSelect(event) {
if (this.isEnabled() === true) {
if (this.push) {
this.togglePressed();
}
if (_.isFunction(this.onSelect)) {
this.onSelect(event);
}
}
},
_initializePressState: function _initializePressState() {
if (this.push) {
this.setUnpressed();
}
},
remove: function remove() {
Button.inherited('remove', this, arguments);
}
});
return Button;
});
//# sourceMappingURL=Button.js.map
;
/**
* Licensed Materials - Property of IBM
*
* IBM Cognos Products: BI Glass
*
* Copyright IBM Corp. 2015, 2018
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/plugins/Button',['./GlassPlugin', 'jquery', 'underscore', '../../core-client/js/core-client/ui/Button', '../../api/Context', '../AppEvents'], function (GlassPlugin, $, _, CommonButton, Context, AppEvents) {
/**
* This Class is the Glass provided button widget
*/
var Button = GlassPlugin.extend(
/**
* @lends GlassButton.prototype
*/
{
/**
* @classdesc Represent a button in the Nav/App bars
* @constructs
* @public
* @param {Object} - itemSpec specification of the button
*/
init: function init() {
Button.inherited('init', this, arguments);
},
/**
* Render the plugin.
* @override
*/
render: function render() {
var buttonSpecArgs = this._updateButtonSpec();
this._createCommonButton(buttonSpecArgs);
this.registerOneTimeCallback(AppEvents.APPVIEW_LOADED);
return this.button.render();
},
/**
* create the callback the controller.onPress/execute method with the onSelect
* @override
*/
attachActionControllerCallbacks: function attachActionControllerCallbacks() {
var context = this.glassContext.addToOptions({
target: {
plugin: this
}
});
var logger = this.glassContext.getCoreSvc('.Logger');
var thisPlugin = this;
var baseButton = this.getBaseButton();
baseButton.onSelect = function () {
var _this = this;
return thisPlugin.getController().then(function (controller) {
_this.setSelected();
if (_this.push) {
context.pushState = _this.isPressed();
}
if (_.isFunction(controller.onPress)) {
controller.onPress(context);
} else if (_.isFunction(controller.execute)) {
var apiContext = new Context(context.glassContext);
var apiOptions = {
options: context.target.plugin.itemSpec.options
};
controller.execute(apiContext, apiOptions);
}
}).catch(function (error) {
logger.error('failed to retrieved the actionController or invoke its method', error);
});
};
},
/**
* @override
*/
changeLabel: function changeLabel(label) {
if (_.isString(label)) {
this.$el.contents().last()[0].nodeValue = label;
}
},
/**
* Set the state of the button as pressed
* Do nothing if the base button is not defined
* @public
*/
setPressed: function setPressed() {
if (this.getBaseButton()) {
this.getBaseButton().setPressed();
}
},
/**
* Set the state of the button as unpressed
* Do nothing if the base button is not defined
* @public
*/
setUnpressed: function setUnpressed() {
if (this.getBaseButton()) {
this.getBaseButton().setUnpressed();
}
},
/**
* getter
* @return {Button} The ui_common button which is contained in this plugin
*/
getBaseButton: function getBaseButton() {
return this.button;
},
_updateButtonSpec: function _updateButtonSpec() {
var buttonSpecArgs = {
buttonSpec: {
'id': this.itemSpec.id,
'class': this.itemSpec['class'],
'label': this.itemSpec.label,
'title': this.itemSpec.title,
'icon': this.itemSpec.icon,
'push': this.itemSpec.push
}
};
if (this.itemSpec.label) {
if (buttonSpecArgs.buttonSpec['class']) {
buttonSpecArgs.buttonSpec['class'] = buttonSpecArgs.buttonSpec['class'] + ' labelled';
} else {
buttonSpecArgs.buttonSpec['class'] = 'labelled';
}
}
return buttonSpecArgs;
},
_createCommonButton: function _createCommonButton(buttonSpecArgs) {
this.button = new CommonButton(buttonSpecArgs);
this.$el = this.button.$el;
}
});
return Button;
});
//# sourceMappingURL=Button.js.map
;
/**
* Licensed Materials - Property of IBM
*
* "Restricted Materials of IBM"
*
* 5746-SM2
*
* (C) Copyright IBM Corp. 2015, 2017
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/plugins/ButtonActionInterface',['../../core-client/js/core-client/ui/core/Class'], function (Class) {
/**
* This class lists all the methods corresponding to the actions supported by a button
* It plays the role of an interface, consumer can extend it.
*
* @interface
*/
var ButtonActionInterface = Class.extend({
/**
* method to be invoked on the press action
* @param {Object} context - The context for this item
* @param {Object} context.glassContext - The glass context.
* @param {Object} context.target - containing info on the target; one is the plugin
* @param {string} context.target.itemId - The id of the pressed item
*/
onPress: function onPress(context) {
console.info('I am pressed', context.target.itemId);
},
/**
* method to be invoked when the button is rendered
* @param {Object} context - The context for this item
* @param {Object} context.glassContext - The glass context.
* @param {Object} context.target - containing info on the target; one is the plugin
* @param {string} context.target.itemId - The id of the rendered item
*/
onRender: function
/* context */
onRender() {},
/**
* Method to be invoked when loading a coachmark.
* Can be used to dynamically set the coachmark's title
* or contents
* @param {Object} context - The context for this coach mark
* @param {Object} context.glassContext - The glass context.
* @param {Object} context.target - The coachMark target for which we want the spec
* @param {string} context.target.itemId - The id of the item for which we want the
* coach mark spec
* @param {Object} context.target.coachMark - The current spec of the coachMark, if any
* @returns {Object} A coach mark specification, including title and contents.
*/
getCoachMarkSpec: function
/* context */
getCoachMarkSpec() {}
});
return ButtonActionInterface;
});
//# sourceMappingURL=ButtonActionInterface.js.map
;
/*
*+------------------------------------------------------------------------+
*| Licensed Materials - Property of IBM
*| IBM Cognos Products: Content Explorer
*| (C) Copyright IBM Corp. 2015, 2016
*|
*| US Government Users Restricted Rights - Use, duplication or disclosure
*| restricted by GSA ADP Schedule Contract with IBM Corp.
*+------------------------------------------------------------------------+
*/
define('baglass/core-client/js/core-client/utils/StringMeasurementUtils',['jquery', 'underscore'], function ($, _) {
'use strict';
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
var charWidthCache = {};
var StringMeasurementUtils = function StringMeasurementUtils() {};
StringMeasurementUtils.prototype.getNodeFont = function ($node) {
var font = $node.css(['font-variant', 'font-weight', 'font-size', 'font-family']);
return _.values(font).join(' ');
};
StringMeasurementUtils.prototype.charWidth = function (char, font) {
if (charWidthCache[font] === undefined) {
charWidthCache[font] = {};
}
var res = charWidthCache[font][char];
if (res === undefined) {
context.font = font;
// Repeat the character n times to increase the precision of measureText on IE which returns an integer
var n = 10;
var metrics = context.measureText(Array(n + 1).join(char));
res = metrics.width / n;
charWidthCache[font][char] = res;
}
return res;
};
StringMeasurementUtils.prototype.getTextWidth = function (text, font, force) {
if (force) {
context.font = font;
return context.measureText(text).width;
}
var i = text.length;
var strLen = 0;
while (i--) {
strLen += this.charWidth(text[i], font);
}
return strLen;
};
StringMeasurementUtils.prototype.charsInWidth = function (text, font, size, maxStrLength, forward) {
var strLen = 0;
for (var i = 0; i < maxStrLength; i++) {
var char = text[forward ? i : text.length - 1 - i];
var len;
if (charWidthCache[font] !== undefined && (len = charWidthCache[font][char]) === undefined) {
len = this.charWidth(char, font);
}
strLen += len;
// In IE, the measured width precision is not 100% accurate, when we are 1px from the desired length, compute the real easurement
if (strLen >= size - 1 && strLen < size) {
var realText = forward ? text.substring(0, i + 1) : text.substring(text.length - i - 1);
var realLen = this.getTextWidth(realText, font, true);
if (realLen >= size) {
return i;
}
}
if (strLen >= size) {
return i;
}
}
return maxStrLength;
};
StringMeasurementUtils.prototype.isZoomTextOnly = function () {
var pt = 14;
var $div = $('
').css('font-size', pt);
var zoomTextOnly = parseInt($div.css('font-size')) !== pt;
$div.remove();
return zoomTextOnly;
};
StringMeasurementUtils.prototype.getIntCSSProp = function ($node, prop) {
return parseInt($node.css(prop));
};
StringMeasurementUtils.prototype.getLineCount = function ($node, isZoomTextOnly) {
if (isZoomTextOnly === undefined) {
isZoomTextOnly = this.isZoomTextOnly();
}
var lineCount = 1;
var lineHeight = this.getIntCSSProp($node, 'line-height');
var maxHeight = this.getIntCSSProp($node, 'max-height');
if (lineHeight > 0 && maxHeight > 0 && $node.css('white-space') !== 'nowrap' && !isZoomTextOnly) {
// If we set css line-height and white-space wrap and firefox zoom text only is zoom 100%
lineCount = Math.max(1, parseInt(maxHeight / lineHeight));
}
return lineCount;
};
StringMeasurementUtils.prototype.getAvailableWidth = function ($node, lineCount) {
if (lineCount === undefined) {
lineCount = this.getLineCount($node);
}
var nodeRect = $node[0].getBoundingClientRect();
var $nodePadding = $node.outerWidth() - $node.width();
var availableWidth = (Math.floor(nodeRect.width) - $nodePadding) * lineCount;
// Removes the width of the children nodes such as the icon in the switcher
availableWidth -= $node.children().length ? $node.children().width() : 0;
return availableWidth;
};
StringMeasurementUtils.prototype.getStringWidth = function ($node, lineCount, availableWidth) {
var isZoomTextOnly = this.isZoomTextOnly();
if (availableWidth === undefined) {
availableWidth = this.getAvailableWidth($node);
}
if (lineCount === undefined) {
lineCount = this.getLineCount($node, isZoomTextOnly);
}
var stringWidth;
var maxHeight = this.getIntCSSProp($node, 'max-height');
if (lineCount > 1 || $node.is('INPUT') || isZoomTextOnly && maxHeight > 0) {
var value = $node.val() || $node.text();
var font = this.getNodeFont($node);
stringWidth = this.getTextWidth(value, font, true);
} else {
stringWidth = availableWidth + $node[0].scrollWidth - $node[0].offsetWidth;
}
return stringWidth;
};
return new StringMeasurementUtils();
});
//# sourceMappingURL=StringMeasurementUtils.js.map
;
/*
*+------------------------------------------------------------------------+
*| Licensed Materials - Property of IBM
*| IBM Cognos Products: Content Explorer
*| (C) Copyright IBM Corp. 2015, 2017
*|
*| US Government Users Restricted Rights - Use, duplication or disclosure
*| restricted by GSA ADP Schedule Contract with IBM Corp.
*+------------------------------------------------------------------------+
*/
define('baglass/core-client/js/core-client/utils/ContentFormatter',['jquery', 'underscore', './StringMeasurementUtils'], function ($, _, StringMeasurement) {
'use strict';
var ELLIPSIS_STR = '…';
var NBSP = '\xA0';
var ZWSP = '\u200B';
function getFirstTextNode(nodeWithText) {
return _.find(nodeWithText.childNodes, function (node) {
return node.nodeType === Node.TEXT_NODE && node.nodeValue.length > 0;
});
}
var ContentFormatter = function ContentFormatter() {};
function stringFittingInWidth(stringValue, font, size, maxStrLength, forward) {
if (stringValue.length === 0) {
return '';
}
var len = StringMeasurement.charsInWidth(stringValue, font, Math.floor(size), maxStrLength, forward);
if (forward) {
return stringValue.substring(0, len).trim();
} else {
// Remove truncated words after the ellipsis
var cutFrom = stringValue.length - len;
var previousChars = stringValue.substring(cutFrom - 1, cutFrom + 1);
if (previousChars.indexOf(' ') === -1) {
// There are no spaces at the beginning, we must be truncating a word.
var nextWord = stringValue.indexOf(' ', cutFrom);
if (nextWord !== -1) {
cutFrom = nextWord;
}
}
return stringValue.substring(cutFrom).trim();
}
}
ContentFormatter.prototype.updateEllipsesBasedOnWidth = function (nodeWithText, lengthAvailable, stringWidth, lineCount) {
var overflowHeight = lineCount > 1 && nodeWithText.scrollHeight - 2 - nodeWithText.offsetHeight > 0;
var $nodeWithText = $(nodeWithText);
var newValue = null;
var textNode;
var isInput = $nodeWithText.is('INPUT');
var initialStringValue;
if (isInput) {
textNode = null;
initialStringValue = $nodeWithText.val();
} else {
textNode = getFirstTextNode(nodeWithText);
initialStringValue = textNode ? textNode.nodeValue : '';
}
// Checking for ELLIPSIS_STR prevent multiple string shortening to introduce ... in the title
if (initialStringValue.indexOf(ELLIPSIS_STR) === -1) {
// If we're dealing with an input, then the full text should be displayed when it gets focus. No need to
// add an aria-label since it will cause issues with reading the controls label
if (!isInput) {
$nodeWithText.attr('aria-label', initialStringValue);
}
$nodeWithText.attr('title', initialStringValue);
}
// Add a zero width space between words as in MultiPage will have an invisible space between the i and the P.
var stringValue = initialStringValue.replace(/([a-z])([a-z])([A-Z])([a-z])/g, '$1' + '$2' + ZWSP + '$3' + '$4').trim();
if (lengthAvailable > 0 && (lengthAvailable < stringWidth - 1 || overflowHeight)) {
var font = StringMeasurement.getNodeFont($nodeWithText);
var spaceWidth = StringMeasurement.getTextWidth(NBSP, font);
var ellipsisWidth = StringMeasurement.getTextWidth(ELLIPSIS_STR, font);
if (lengthAvailable > ellipsisWidth) {
var textSpaceAvailable = lengthAvailable / 2;
var leftText, rightText;
if (lineCount > 1) {
// When multiple lines, the first line contains half of the text and the ellipsis
// The second line contains the truncated second half starting on a word boundary
leftText = stringFittingInWidth(stringValue, font, textSpaceAvailable - ellipsisWidth - spaceWidth, stringValue.length, true);
rightText = stringFittingInWidth(stringValue, font, textSpaceAvailable - spaceWidth, stringValue.length - leftText.length, false);
} else {
// When single line, compute the space of the second half in order to start on a word boundary
// The first half might have a longer content to fit the space left
rightText = stringFittingInWidth(stringValue, font, textSpaceAvailable - spaceWidth, stringValue.length, false);
var rightTextWidth = StringMeasurement.getTextWidth(rightText, font);
leftText = stringFittingInWidth(stringValue, font, lengthAvailable - rightTextWidth - ellipsisWidth - spaceWidth * 2, stringValue.length - rightText.length, true);
}
if (leftText.length + rightText.length < stringValue.length) {
// Use a non-breakable space to keep the ... next to the previous letter
if (leftText.length > 0) {
leftText += NBSP;
}
if (rightText.length > 0) {
rightText = (lineCount > 1 ? ZWSP : NBSP) + rightText;
}
newValue = leftText + ELLIPSIS_STR + rightText;
} else if (leftText.length > 0 && rightText.length > 0) {
// Add a zero width space in the center of a word to fit it on the first line
newValue = leftText + ZWSP + rightText;
} else {
newValue = leftText + rightText;
}
} else {
newValue = '';
}
} else {
// Sets the newValue to stringValue in order to keep the ZWSP
if (stringValue !== initialStringValue) {
newValue = stringValue;
}
}
if (newValue !== null) {
if (isInput) {
$nodeWithText.val(newValue);
} else if (textNode) {
textNode.nodeValue = newValue;
}
}
};
ContentFormatter.prototype.middleShortenString = function (node) {
var $node = $(node);
var lineCount = StringMeasurement.getLineCount($node);
var availableWidth = StringMeasurement.getAvailableWidth($node, lineCount);
var stringWidth = StringMeasurement.getStringWidth($node, lineCount, availableWidth);
this.updateEllipsesBasedOnWidth($node[0], availableWidth, stringWidth, lineCount);
};
ContentFormatter.prototype.resizeInput = function (node) {
var $node = $(node);
if ($node.is('INPUT')) {
var availableWidth = StringMeasurement.getAvailableWidth($node) + 1;
var stringWidth = StringMeasurement.getStringWidth($node);
// Set the width of the input to the smallest needed. Needed so that the
// edit pencil shows up beside the input field.
if (stringWidth < availableWidth) {
$node.css('width', stringWidth + 10 + 'px');
} else {
$node.css('width', availableWidth + 10 + 'px');
}
}
};
return new ContentFormatter();
});
//# sourceMappingURL=ContentFormatter.js.map
;
/* Licensed Materials - Property of IBM
*
* IBM Cognos Products: BI
*
* Copyright IBM Corp. 2015, 2017
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/ui/DropDownMenu',['./core/View', 'jquery', 'underscore', './Button', './Menu', '../utils/ContentFormatter', '../utils/BidiUtil', 'bootstrap'], function (View, $, _, Button, Menu, ContentFormatter, BidiUtil) {
/**
* This Class is the Glass provided DropDownMenu widget
*/
var DropDownMenu = View.extend({
/**
*@constructs
*@DropDownMenuSpec specification of the DropDownMenu
*/
init: function init(args) {
DropDownMenu.inherited('init', this, args.dropDownMenuSpec);
_.extend(this, args.dropDownMenuSpec);
},
/**
* Render the plugin.
* @override
*/
render: function render() {
var className = 'menu ';
if (this['class']) {
className += this['class'];
}
var spec = {
'id': this.id,
'title': BidiUtil.enforceTextDirection(this.title),
'label': BidiUtil.enforceTextDirection(this.label),
'class': className,
'icon': this.icon,
'haspopup': true
};
var button = this._createMenuButton(spec);
button.onSelect = this._onMenuSelect.bind(this);
return button.render().then(function (el) {
this.$el = button.$el;
this._setTitle();
this.menuButton = button;
this.menuButtonDom = el;
return el;
}.bind(this));
},
/**
* getter
* @return {Button} the button which shows the menu when is primaryactioned; undefined if the dropdown menu is not rendered
*/
getButton: function getButton() {
return this.menuButton;
},
setMenuItems: function setMenuItems(shownItems, showPopover, event) {
this.items = shownItems;
if (showPopover) {
return this._onMenuSelect(event);
} else {
return Promise.resolve();
}
},
_setTitle: function _setTitle() {
if (this.$el && this.$el.length) {
if (this.title) {
$(this.$el).attr('title', this.title);
} else if (this.label) {
$(this.$el).attr('title', this.label);
}
}
},
_onMenuSelect: function _onMenuSelect() {
Menu.hideOpenMenus();
if (!this.$ddPopover) {
var $activeButton = $('.currentlySelected');
if ($activeButton[0]) {
$activeButton.removeClass('currentlySelected');
}
this.$el.addClass('currentlySelected');
this.contentMenu = this._createMenu(this.items);
return this.contentMenu.render().then(function (menuDomEl) {
this.contentMenu.whenReadyToClose = this._closePopover.bind(this);
var menuClass = 'popover glass-menu ';
if (this['class']) {
menuClass += this['class'];
}
var popoverOptions = {
placement: this.ddMenuPlacement,
trigger: 'manual',
container: 'body',
content: function content() {
return $(menuDomEl);
},
template: '
',
html: true
};
this._showPopover(popoverOptions);
}.bind(this));
} else {
return Promise.resolve();
}
},
_createMenuButton: function _createMenuButton(spec) {
return new Button({
buttonSpec: spec
});
},
_createMenu: function _createMenu(itemsList) {
return new Menu({
spec: {
items: itemsList
}
});
},
_showPopover: function _showPopover(options) {
// Bootstrap empties the title when opening the pop-up, setting data-selector to true prevent bootstrap from updating the title.
// See: http://stackoverflow.com/questions/27235776/can-i-still-use-the-title-attribute-on-bootstrap-popovers
this.$el.attr('data-selector', 'true');
this.$ddPopover = this.$el.popover(options);
this.$ddPopover.popover('show');
this.popupId = this.$ddPopover.attr('aria-describedby');
this._updatePopupover();
},
_updatePopupover: function _updatePopupover() {
var $popupEl = $('#' + this.popupId);
var popupItems = $popupEl.find('.commonMenuItem');
_.each(popupItems, function (item) {
var $anchorEl = $(item).find('a');
var $iconEl = $anchorEl.find('svg');
var $spanEl = $(item).find('span');
var aWidth = $anchorEl.width();
var spanPadding = $spanEl.innerWidth() - $spanEl.width();
var maxSpanWidth = aWidth - $iconEl.outerWidth(true) - spanPadding;
if ($spanEl.length) {
ContentFormatter.updateEllipsesBasedOnWidth($spanEl[0], maxSpanWidth, $spanEl.width());
}
}, this);
},
/**
* @private
* closes the popover
*/
_closePopover: function _closePopover() {
return new Promise(function (resolve, reject) {
if (this.$ddPopover) {
this.$ddPopover.on('hidden.bs.popover', function () {
this._removePopover();
resolve();
}.bind(this));
// Hack-fix for bootstrap popover not dispatching 'hidden.bs.popover' event
setTimeout(function () {
this._removePopover();
resolve();
}.bind(this), 250);
this.$el.removeClass('currentlySelected');
this.$el.blur();
this.$ddPopover.popover('hide');
} else {
reject(new Error('Failed to close popover'));
}
}.bind(this));
},
_removePopover: function _removePopover() {
if (this.$ddPopover) {
this.$ddPopover.off('hidden.bs.popover');
this.$ddPopover.popover('destroy');
this.$ddPopover = null;
$('#' + this.popupId).remove();
}
},
remove: function remove() {
this._removePopover();
DropDownMenu.inherited('remove', this, arguments);
},
closeDropDownMenu: function closeDropDownMenu(event) {
if (this.contentMenu) {
var contentMenu = this.contentMenu;
this.contentMenu = null;
return contentMenu.closeMenu(event, false);
} else {
return this._closePopover(event);
}
}
});
return DropDownMenu;
});
//# sourceMappingURL=DropDownMenu.js.map
;
/**
* Licensed Materials - Property of IBM
*
* IBM Cognos Products: BI Titan
*
* Copyright IBM Corp. 2015, 2018
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/plugins/GlassMenu',['./GlassPlugin', 'jquery', 'underscore', '../../core-client/js/core-client/utils/ClassFactory', './MenuActionControllerDispatcher', '../../core-client/js/core-client/ui/DropDownMenu', '../../core-client/js/core-client/ui/Button', '../AppEvents'], function (GlassPlugin, $, _, ClassFactory, ControllerDispatcher, DropDownMenu, Button, AppEvents) {
/**
* This Class is the Glass provided Menu widget
*/
var GlassMenu = GlassPlugin.extend(
/**
* @lends GlassMenu.prototype
*/
{
_ClassFactory: ClassFactory,
/**
* @classdesc class representing a menu
* @augments GlassPlugin
* @constructs
* @public
* @param {Object} options - set of initial properties
*
* */
init: function init(options) {
$.extend(true, this, options);
var spec = this.itemSpec;
if (spec.labelOnly === undefined) {
if (!spec.icon) {
spec.labelOnly = 'true';
} else if (spec.label) {
spec.labelOnly = 'false';
}
}
GlassMenu.inherited('init', this, [spec]);
},
/**
* @override
*/
changeLabel: function changeLabel(label) {
if (_.isString(label)) {
this.$el.contents().last()[0].nodeValue = label;
}
},
/**
* Gets the button element of the menu.
* @public
* @example
* //Used in the item controller to pass the launch point when opening a slideout
* var options = itemSpec.options;
* options.launchPoint = context.target.plugin.getButtonElement();
* context.glassContext.showSlideOut(options);
*
* @return {JqueryObject} the button element when it is defined
*/
getButtonElement: function getButtonElement() {
return this.activeObject;
},
/**
* getter
* @public
* @return {DropDownMenu} the dropdown menu object; undefined if not rendered.
*/
getDropdownMenu: function getDropdownMenu() {
return this.ddMenu;
},
/**
* getter
* @public
* @return {Button} the default action button; undefined if not rendered or there is no default action
*/
getDefaultActionButton: function getDefaultActionButton() {
return this.defaultButton;
},
/**
* Setting the action controller is necessary at this stage, as the action attribute needs to be set for each item
* @override
*/
render: function render() {
this.registerOneTimeCallback(AppEvents.APPVIEW_LOADED);
this._createMenu();
return this.ddMenu.render().then(function (menu) {
this.$el = $(menu);
this.activeObject = this.ddMenu.$el;
if (this.defaultButton) {
this.$el = $('
');
return this.defaultButton.render().then(function
/* el */
() {
this.$el.append(this.defaultButton.$el);
this.$el.append(this.ddMenu.menuButton.$el);
this.$el.addClass('inlineFlex');
return this.$el[0];
}.bind(this));
} else {
return this.$el[0];
}
}.bind(this));
},
/**
* create the callback the controller.onPress/execute method with the onSelect
* @override
*/
attachActionControllerCallbacks: function attachActionControllerCallbacks() {
this.ddMenu.menuButton.onSelect = this._handleMenuClick.bind(this);
if (this.defaultButton) {
this.defaultButton.onSelect = this._handleDefaultAction.bind(this);
}
},
/**
* get the controller dispatcher
*/
getController: function getController() {
var aModulePromises = [];
var aFeatures = [];
var oControllerMap = {};
if (!this._loadingController) {
this._loadingController = new Promise(function (resolve) {
_.each(this.itemSpec.actionControllers, function (module, key) {
aModulePromises.push(this._loadController(module, key));
aFeatures.push(key);
}.bind(this));
resolve(Promise.all(aModulePromises).then(function (controllers) {
_.each(controllers, function (item, index) {
oControllerMap[aFeatures[index]] = item;
});
this._controller = this._createControllerDispatcher(oControllerMap);
return this._controller;
}.bind(this)));
}.bind(this));
}
return this._loadingController;
},
_loadController: function _loadController(module, key) {
return this._ClassFactory.instantiate(module).then(function (controller) {
if (_.isFunction(controller.initialize)) {
var oEventContext = {
glassContext: this.glassContext,
target: {
plugin: this,
itemId: this.itemSpec.id
},
controllerConfig: this.itemSpec.controllerConfig && this.itemSpec.controllerConfig[key]
};
return Promise.resolve(controller.initialize.apply(controller, [oEventContext])).then(function () {
return controller;
});
} else {
return controller;
}
}.bind(this));
},
/**
* Creates the menu and the default action menu if required
*/
_createMenu: function _createMenu() {
var menuButtonSpec;
var defaultActionItem = this._findDefaultActionItem();
if (defaultActionItem) {
var defaultButtonSpec;
menuButtonSpec = {
dropDownMenuSpec: {
'id': this.id + '.menu',
'title': this.title,
'icon': 'common-dropdown',
'class': 'button menu comboBox',
'ddMenuPlacement': this.ddMenuPlacement,
'items': []
}
};
var title = _.isUndefined(defaultActionItem.title) ? defaultActionItem.label : defaultActionItem.title;
defaultButtonSpec = {
'id': this.id + '.default',
'title': title,
'icon': this.icon,
'class': this['class'] + ' menu defaultButton',
'item': defaultActionItem
};
this.defaultButton = new Button({
buttonSpec: defaultButtonSpec
});
} else {
if (this.label) {
if (_.isUndefined(this['class'])) {
this['class'] = 'dropDownImage';
} else {
this['class'] += ' dropDownImage';
}
}
menuButtonSpec = {
dropDownMenuSpec: {
'id': this.id,
'label': this.label,
'title': this.title,
'icon': this.icon,
'class': this['class'],
'ddMenuPlacement': this.ddMenuPlacement,
'items': []
}
};
}
this.ddMenu = this._createDropDownMenu(menuButtonSpec);
},
_handleMenuClick: function _handleMenuClick(event) {
var logger = this.glassContext.getCoreSvc('.Logger');
return this._updateMenuItemsList().then(function (shownItems) {
this.ddMenu.setMenuItems(shownItems, true, event);
}.bind(this)).catch(function (error) {
logger.error('failure in the onSelect callback', error);
});
},
/**
* Creates the controller dispatcher providing the controller Map
* @private
* @param controllerMap
* @return Instance of the controller Dispatcher
*/
_createControllerDispatcher: function _createControllerDispatcher(controllerMap) {
return new ControllerDispatcher(controllerMap);
},
_createDropDownMenu: function _createDropDownMenu(menuSpec) {
return new DropDownMenu(menuSpec);
},
_handleDefaultAction: function
/* event */
_handleDefaultAction() {
var _this = this;
var logger = this.glassContext.getCoreSvc('.Logger');
return this.getController().then(function (controller) {
var featureController = controller.getControllerMap()[_this.defaultButton.item.featureId];
var context = {
glassContext: _this.glassContext,
target: {
plugin: _this,
itemId: _this.defaultButton.item.id,
specItemIndex: _this.defaultButton.item.index,
index: 0
}
};
if (featureController && _.isFunction(featureController.onSelectItem)) {
featureController.onSelectItem.call(featureController, context);
}
}).catch(function (error) {
logger.error('failed to call the default action', error);
});
},
_findDefaultActionItem: function _findDefaultActionItem() {
var defaultActionItem;
var itemIndex;
if (_.isString(this.defaultAction)) {
defaultActionItem = _.find(this.itemSpec.items, function (item, index) {
itemIndex = index;
return item.id === this.defaultAction;
}.bind(this));
}
if (defaultActionItem) {
defaultActionItem.index = itemIndex;
}
return defaultActionItem;
},
_updateMenuItemsList: function _updateMenuItemsList() {
var _this2 = this;
var oEventContext = {
glassContext: this.glassContext,
target: {
plugin: this,
itemId: this.itemSpec.id
}
};
return this.getController().then(function (controller) {
return controller.onOpen(oEventContext).then(function () {
var shownItems = [];
controller.buildItemMap(this.itemSpec.items);
var idx = 0;
_.each(this.itemSpec.items, function (item, index) {
var oEventContext = {
glassContext: this.glassContext,
target: {
plugin: this,
itemId: item.id,
specItemIndex: index
}
};
var isVisible = controller.isItemVisible(oEventContext);
if (isVisible) {
oEventContext.target.index = idx++;
var uiItem = {};
$.extend(true, uiItem, item);
uiItem.name = item.id;
uiItem.onSelect = function ($menuItem) {
oEventContext.target.activeObject = $menuItem;
controller.onSelectItem.call(controller, oEventContext);
}.bind(this);
uiItem.onRemove = function ($menuItem) {
oEventContext.target.activeObject = $menuItem;
return controller.onRemoveItem.call(controller, oEventContext);
}.bind(this);
uiItem.onRender = function ($menuItem) {
oEventContext.target.activeObject = $menuItem;
controller.onRenderItem.call(controller, oEventContext);
}.bind(this);
var customLabel = controller.getLabel(oEventContext);
if (!_.isUndefined(customLabel)) {
uiItem.label = customLabel;
}
var isSelected = controller.isItemSelected(oEventContext);
if (isSelected) {
uiItem.selected = true;
}
shownItems.push(uiItem);
}
}, this);
return shownItems;
}.bind(_this2));
});
},
closeGlassMenu: function closeGlassMenu() {
return new Promise(function (resolve, reject) {
this.ddMenu.closeDropDownMenu({}).then(resolve, reject);
}.bind(this));
}
});
GlassMenu.errors = {
FAILURE_CREATING_CONTROLLER: 'Failure creating one of the menu controllers'
};
return GlassMenu;
});
//# sourceMappingURL=GlassMenu.js.map
;
/**
* Licensed Materials - Property of IBM
*
* IBM Cognos Products: BI Glass
*
* Copyright IBM Corp. 2018
*
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/plugins/SynchronousButton',['underscore', './Button', '../../api/Context'], function (_, Button, Context) {
/**
* A special type of button that calls its controller synchronously on click.
* This is required for native/browser functions that are not permitted to be
* executed from an asynchronous callback.
*
* Example: Requesting HTML5/FullScreen
*
*/
var SynchronousButton = Button.extend({
initialize: function initialize() {
return this.getController();
},
getControllerSync: function getControllerSync() {
if (!this._controller) {
throw new Error('Controller has not been registered');
} else {
return this._controller;
}
},
/**
* create the callback the controller.onPress/execute method with the onSelect
* @override
*/
attachActionControllerCallbacks: function attachActionControllerCallbacks() {
var context = this.glassContext.addToOptions({
target: {
plugin: this
}
});
var logger = this.glassContext.getCoreSvc('.Logger');
var thisPlugin = this;
var baseButton = this.getBaseButton();
baseButton.onSelect = function () {
try {
var result;
var controller = thisPlugin.getControllerSync();
this.setSelected();
if (this.push) {
context.pushState = this.isPressed();
}
if (_.isFunction(controller.onPress)) {
result = controller.onPress(context);
} else if (_.isFunction(controller.execute)) {
var apiContext = new Context(context.glassContext);
var apiOptions = {
options: context.target.plugin.itemSpec.options
};
result = controller.execute(apiContext, apiOptions);
}
return Promise.resolve(result).catch(function (err) {
logger.error(err);
});
} catch (err) {
logger.error(err);
return Promise.resolve();
}
};
}
});
return SynchronousButton;
});
//# sourceMappingURL=SynchronousButton.js.map
;
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Glass
* (C) Copyright IBM Corp. 2015, 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/app/plugins/all',['./Button', './ButtonActionInterface', './GlassMenu', './SynchronousButton'], function () {});
//# sourceMappingURL=all.js.map
;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2015, 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define('baglass/core-client/js/core-client/ui/dialogs/BaseDialog',['../AccessibleView', 'jquery', 'underscore', '../../nls/StringResources', '../Button', '../../utils/Utils'], function (AccessibleView, $, _, stringResources, Button, Utils) {
'use strict';
var BaseDialog = AccessibleView.extend({
_buttons: ['ok', 'cancel'],
_showCloseX: true,
_width: null,
init: function init(options) {
this._dialogId = _.uniqueId('modalDialog_');
this._queryId = '#' + this._dialogId;
this._footerButtons = [];
/**
* Flag to indicate whether to render the header in the dialog.
* The header will be rendered by default if options.showHeader is undefined.
*/
this._showHeader = true;
// set dialog options
this.setDialogOptions(options);
this.enableTabLooping = true;
//force a default id if none was set
if (!this.id) {
this.id = 'com-ibm-ca-dialogDefaultId';
}
BaseDialog.inherited('init', this, arguments);
},
setDialogOptions: function setDialogOptions(options) {
// process options
if (options) {
// set width as necessary
if (options.width) {
this._width = options.width;
}
// set closeX button option
if (options.showCloseX === false) {
this._showCloseX = options.showCloseX;
}
// Check for buttons passed in and override defaults.
if (options.buttons) {
this._buttons = options.buttons;
}
this.titleAriaLabel = options.titleAriaLabel;
this._showHeader = options.showHeader === undefined ? true : options.showHeader;
}
},
destroy: function destroy() {
$(this._queryId).remove();
$('body').removeClass('openedDialog');
},
remove: function remove() {
this.destroy();
},
hide: function hide() {
this._setFocusToLaunchPoint();
$(this._queryId).removeClass('show');
this.destroy();
},
open: function open() {
this.showBlocker();
this.show();
},
showBlocker: function showBlocker() {
var nBlocker = $(this._queryId);
if (!nBlocker.length) {
nBlocker = $('
', {
'id': this._dialogId,
'class': 'dialogBlocker show'
});
if (this.blockerClass) {
nBlocker.addClass(this.blockerClass);
}
if (this.className) {
nBlocker.addClass(this.className);
}
// set the blocker height (works with scrollbars)
nBlocker.height($(document).height());
var nBlockerCell = $('
', {
'id': this._dialogId + 'Container',
'class': 'dialogBlockerCell'
});
$('body').append(nBlocker.append(nBlockerCell.text(stringResources.get('loading'))));
nBlocker.on('keydown', this.onKey.bind(this));
}
this._container().parent().on('primaryaction', null, { allowPropagationDefaultAction: true }, function (event) {
Utils.setEventProperty(event, Utils.EVENT_DIALOG, true);
});
},
show: function show() {
var nContainer = this._container();
// set width as necessary
if (this._width) {
nContainer.css('max-width', this._width);
}
// build dialog as necessary
if (nContainer.length) {
nContainer.empty();
// assemble dialog
var $contentDiv = $('
', { 'class': 'dialogHeader' });
var title = this.renderTitle($('', {
'class': 'dialogTitle',
'aria-label': this.titleAriaLabel || this.title,
'role': 'banner',
'id': this.getId()
}));
var closeX = this.renderCloseX();
// pop the title and closeX into the header
header.append(title, closeX);
$contentDiv.append(header);
}
var content = this.renderContent($('