@atlassian/aui
Version:
Atlassian User Interface Framework
1,352 lines (1,149 loc) • 645 kB
JavaScript
/*!!
* @atlassian/aui - Atlassian User Interface Framework
* @version v7.8.1
* @link https://docs.atlassian.com/aui/latest/
* @license SEE LICENSE IN LICENSE.md
* @author Atlassian Pty Ltd.
*/
// src/js/aui/jquery.js
(typeof window === 'undefined' ? global : window).__078f1f0dae379d17d70c51baf1a7fc2e = (function () {
var module = {
exports: {}
};
var exports = module.exports;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = window.jQuery || window.Zepto;
module.exports = exports["default"];
return module.exports;
}).call(this);
// src/js/aui/create-element.js
(typeof window === 'undefined' ? global : window).__f198562ae18f53434639fc434ee4740c = (function () {
var module = {
exports: {}
};
var exports = module.exports;
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery = __078f1f0dae379d17d70c51baf1a7fc2e;
var _jquery2 = _interopRequireDefault(_jquery);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function createElement() {
var res = null;
if (arguments.length && typeof arguments[0] === 'string') {
res = (0, _jquery2.default)(document.createElement(arguments[0]));
if (arguments.length === 2) {
res.html(arguments[1]);
}
}
//We can't use the deprecate module or we will introduce a circular dependency
if (typeof console !== 'undefined' && console.warn) {
console.warn('AJS\'s create element functionality has been deprecated since 5.9.0.\nNo alternative will be provided.\nUse document.createElement() or jQuery.parseHTML(), or preferably use a templating library.');
}
return res;
}
exports.default = createElement;
module.exports = exports['default'];
return module.exports;
}).call(this);
// node_modules/object-assign/index.js
(typeof window === 'undefined' ? global : window).__e13c04a87556a5776162e551803c8943 = (function () {
var module = {
exports: {}
};
var exports = module.exports;
/* eslint-disable no-unused-vars */
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
module.exports = Object.assign || function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (Object.getOwnPropertySymbols) {
symbols = Object.getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
return module.exports;
}).call(this);
// src/js/aui/internal/globalize.js
(typeof window === 'undefined' ? global : window).__72a5ad586a97d712f1f222cf9b461386 = (function () {
var module = {
exports: {}
};
var exports = module.exports;
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = globalize;
var _createElement = __f198562ae18f53434639fc434ee4740c;
var _createElement2 = _interopRequireDefault(_createElement);
var _objectAssign = __e13c04a87556a5776162e551803c8943;
var _objectAssign2 = _interopRequireDefault(_objectAssign);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function auiNamespace() {
return _createElement2.default.apply(undefined, arguments);
};
var NAMESPACE = 'AJS';
function globalize(name, value) {
if (window[NAMESPACE] !== auiNamespace) {
window[NAMESPACE] = (0, _objectAssign2.default)(auiNamespace, window[NAMESPACE]);
}
return window[NAMESPACE][name] = value;
}
module.exports = exports['default'];
return module.exports;
}).call(this);
// src/js/aui/internal/deprecation.js
(typeof window === 'undefined' ? global : window).__790480709a11d9caf89bfe72fb497800 = (function () {
var module = {
exports: {}
};
var exports = module.exports;
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getMessageLogger = exports.propertyDeprecationSupported = exports.obj = exports.prop = exports.css = exports.construct = exports.fn = undefined;
var _jquery = __078f1f0dae379d17d70c51baf1a7fc2e;
var _jquery2 = _interopRequireDefault(_jquery);
var _globalize = __72a5ad586a97d712f1f222cf9b461386;
var _globalize2 = _interopRequireDefault(_globalize);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var has = Object.prototype.hasOwnProperty;
var deprecationCalls = [];
var deprecatedSelectorMap = [];
function toSentenceCase(str) {
str += '';
if (!str) {
return '';
}
return str.charAt(0).toUpperCase() + str.substring(1);
}
function getDeprecatedLocation(printFrameOffset) {
var err = new Error();
var stack = err.stack || err.stacktrace;
var stackMessage = stack && stack.replace(/^Error\n/, '') || '';
if (stackMessage) {
stackMessage = stackMessage.split('\n');
return stackMessage[printFrameOffset + 2];
}
return stackMessage;
}
function logger() {
if (typeof console !== 'undefined' && console.warn) {
Function.prototype.apply.call(console.warn, console, arguments);
}
}
/**
* Return a function that logs a deprecation warning to the console the first time it is called from a certain location.
* It will also print the stack frame of the calling function.
*
* @param {string} displayName the name of the thing being deprecated
* @param {object} options
* @param {string} options.removeInVersion the version this will be removed in
* @param {string} options.alternativeName the name of an alternative to use
* @param {string} options.sinceVersion the version this has been deprecated since
* @param {string} options.extraInfo extra information to be printed at the end of the deprecation log
* @param {string} options.extraObject an extra object that will be printed at the end
* @param {string} options.deprecationType type of the deprecation to append to the start of the deprecation message. e.g. JS or CSS
* @return {Function} that logs the warning and stack frame of the calling function. Takes in an optional parameter for the offset of
* the stack frame to print, the default is 0. For example, 0 will log it for the line of the calling function,
* -1 will print the location the logger was called from
*/
function getShowDeprecationMessage(displayName, options) {
// This can be used internally to pas in a showmessage fn
if (typeof displayName === 'function') {
return displayName;
}
var called = false;
options = options || {};
return function (printFrameOffset) {
var deprecatedLocation = getDeprecatedLocation(printFrameOffset ? printFrameOffset : 1) || '';
// Only log once if the stack frame doesn't exist to avoid spamming the console/test output
if (!called || deprecationCalls.indexOf(deprecatedLocation) === -1) {
deprecationCalls.push(deprecatedLocation);
called = true;
var deprecationType = options.deprecationType + ' ' || '';
var message = 'DEPRECATED ' + deprecationType + '- ' + toSentenceCase(displayName) + ' has been deprecated' + (options.sinceVersion ? ' since ' + options.sinceVersion : '') + ' and will be removed in ' + (options.removeInVersion || 'a future release') + '.';
if (options.alternativeName) {
message += ' Use ' + options.alternativeName + ' instead. ';
}
if (options.extraInfo) {
message += ' ' + options.extraInfo;
}
if (deprecatedLocation === '') {
deprecatedLocation = ' \n ' + 'No stack trace of the deprecated usage is available in your current browser.';
} else {
deprecatedLocation = ' \n ' + deprecatedLocation;
}
if (options.extraObject) {
message += '\n';
logger(message, options.extraObject, deprecatedLocation);
} else {
logger(message, deprecatedLocation);
}
}
};
}
function logCssDeprecation(selectorMap, newNode) {
var displayName = selectorMap.options.displayName;
displayName = displayName ? ' (' + displayName + ')' : '';
var options = _jquery2.default.extend({
deprecationType: 'CSS',
extraObject: newNode
}, selectorMap.options);
getShowDeprecationMessage('\'' + selectorMap.selector + '\' pattern' + displayName, options)();
}
/**
* Returns a wrapped version of the function that logs a deprecation warning when the function is used.
* @param {Function} fn the fn to wrap
* @param {string} displayName the name of the fn to be displayed in the message
* @param {string} options.removeInVersion the version this will be removed in
* @param {string} options.alternativeName the name of an alternative to use
* @param {string} options.sinceVersion the version this has been deprecated since
* @param {string} options.extraInfo extra information to be printed at the end of the deprecation log
* @return {Function} wrapping the original function
*/
function deprecateFunctionExpression(fn, displayName, options) {
options = options || {};
options.deprecationType = options.deprecationType || 'JS';
var showDeprecationMessage = getShowDeprecationMessage(displayName || fn.name || 'this function', options);
return function () {
showDeprecationMessage();
return fn.apply(this, arguments);
};
}
/**
* Returns a wrapped version of the constructor that logs a deprecation warning when the constructor is instantiated.
* @param {Function} constructorFn the constructor function to wrap
* @param {string} displayName the name of the fn to be displayed in the message
* @param {string} options.removeInVersion the version this will be removed in
* @param {string} options.alternativeName the name of an alternative to use
* @param {string} options.sinceVersion the version this has been deprecated since
* @param {string} options.extraInfo extra information to be printed at the end of the deprecation log
* @return {Function} wrapping the original function
*/
function deprecateConstructor(constructorFn, displayName, options) {
options = options || {};
options.deprecationType = options.deprecationType || 'JS';
var deprecatedConstructor = deprecateFunctionExpression(constructorFn, displayName, options);
deprecatedConstructor.prototype = constructorFn.prototype;
_jquery2.default.extend(deprecatedConstructor, constructorFn); //copy static methods across;
return deprecatedConstructor;
}
var supportsProperties = false;
try {
if (Object.defineProperty) {
Object.defineProperty({}, 'blam', { get: function get() {}, set: function set() {} });
exports.propertyDeprecationSupported = supportsProperties = true;
}
} catch (e) {}
/* IE8 doesn't support on non-DOM elements */
/**
* Wraps a "value" object property in a deprecation warning in browsers supporting Object.defineProperty
* @param {Object} obj the object containing the property
* @param {string} prop the name of the property to deprecate
* @param {string} options.removeInVersion the version this will be removed in
* @param {string} options.displayName the display name of the property to deprecate (optional, will fall back to the property name)
* @param {string} options.alternativeName the name of an alternative to use
* @param {string} options.sinceVersion the version this has been deprecated since
* @param {string} options.extraInfo extra information to be printed at the end of the deprecation log
*/
function deprecateValueProperty(obj, prop, options) {
if (supportsProperties) {
var oldVal = obj[prop];
options = options || {};
options.deprecationType = options.deprecationType || 'JS';
var displayNameOrShowMessageFn = options.displayName || prop;
var showDeprecationMessage = getShowDeprecationMessage(displayNameOrShowMessageFn, options);
Object.defineProperty(obj, prop, {
get: function get() {
showDeprecationMessage();
return oldVal;
},
set: function set(val) {
oldVal = val;
showDeprecationMessage();
return val;
}
});
}
}
/**
* Wraps an object property in a deprecation warning, if possible. functions will always log warnings, but other
* types of properties will only log in browsers supporting Object.defineProperty
* @param {Object} obj the object containing the property
* @param {string} prop the name of the property to deprecate
* @param {string} options.removeInVersion the version this will be removed in
* @param {string} options.displayName the display name of the property to deprecate (optional, will fall back to the property name)
* @param {string} options.alternativeName the name of an alternative to use
* @param {string} options.sinceVersion the version this has been deprecated since
* @param {string} options.extraInfo extra information to be printed at the end of the deprecation log
*/
function deprecateObjectProperty(obj, prop, options) {
if (typeof obj[prop] === 'function') {
options = options || {};
options.deprecationType = options.deprecationType || 'JS';
var displayNameOrShowMessageFn = options.displayName || prop;
obj[prop] = deprecateFunctionExpression(obj[prop], displayNameOrShowMessageFn, options);
} else {
deprecateValueProperty(obj, prop, options);
}
}
/**
* Wraps all an objects properties in a deprecation warning, if possible. functions will always log warnings, but other
* types of properties will only log in browsers supporting Object.defineProperty
* @param {Object} obj the object to be wrapped
* @param {string} objDisplayPrefix the object's prefix to be used in logs
* @param {string} options.removeInVersion the version this will be removed in
* @param {string} options.alternativeNamePrefix the name of another object to prefix the deprecated objects properties with
* @param {string} options.sinceVersion the version this has been deprecated since
* @param {string} options.extraInfo extra information to be printed at the end of the deprecation log
*/
function deprecateAllProperties(obj, objDisplayPrefix, options) {
options = options || {};
for (var attr in obj) {
if (has.call(obj, attr)) {
options.deprecationType = options.deprecationType || 'JS';
options.displayName = objDisplayPrefix + attr;
options.alternativeName = options.alternativeNamePrefix && options.alternativeNamePrefix + attr;
deprecateObjectProperty(obj, attr, _jquery2.default.extend({}, options));
}
}
}
function matchesSelector(el, selector) {
return (el.matches || el.msMatchesSelector || el.webkitMatchesSelector || el.mozMatchesSelector || el.oMatchesSelector).call(el, selector);
}
function handleAddingSelector(options) {
return function (selector) {
var selectorMap = {
selector: selector,
options: options || {}
};
deprecatedSelectorMap.push(selectorMap);
// Search if matches have already been added
var matches = document.querySelectorAll(selector);
for (var i = 0; i < matches.length; i++) {
logCssDeprecation(selectorMap, matches[i]);
}
};
}
/**
* Return a function that logs a deprecation warning to the console the first time it is called from a certain location.
* It will also print the stack frame of the calling function.
*
* @param {string|Array} selectors a selector or list of selectors that match deprecated markup
* @param {object} options
* @param {string} options.displayName a name describing these selectors
* @param {string} options.alternativeName the name of an alternative to use
* @param {string} options.removeInVersion the version these will be removed in
* @param {string} options.sinceVersion the version these have been deprecated since
* @param {string} options.extraInfo extra information to be printed at the end of the deprecation log
*/
function deprecateCSS(selectors, options) {
if (!window.MutationObserver) {
logger('CSS could not be deprecated as Mutation Observer was not found.');
return;
}
if (typeof selectors === 'string') {
selectors = [selectors];
}
selectors.forEach(handleAddingSelector(options));
}
function testAndHandleDeprecation(newNode) {
return function (selectorMap) {
if (matchesSelector(newNode, selectorMap.selector)) {
logCssDeprecation(selectorMap, newNode);
}
};
}
if (window.MutationObserver) {
var observer = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
// TODO - should this also look at class changes, if possible?
var addedNodes = mutation.addedNodes;
for (var i = 0; i < addedNodes.length; i++) {
var newNode = addedNodes[i];
if (newNode.nodeType === 1) {
deprecatedSelectorMap.forEach(testAndHandleDeprecation(newNode));
}
}
});
});
var config = {
childList: true,
subtree: true
};
observer.observe(document, config);
}
var deprecate = {
fn: deprecateFunctionExpression,
construct: deprecateConstructor,
css: deprecateCSS,
prop: deprecateObjectProperty,
obj: deprecateAllProperties,
propertyDeprecationSupported: supportsProperties,
getMessageLogger: getShowDeprecationMessage
};
(0, _globalize2.default)('deprecate', deprecate);
exports.fn = deprecateFunctionExpression;
exports.construct = deprecateConstructor;
exports.css = deprecateCSS;
exports.prop = deprecateObjectProperty;
exports.obj = deprecateAllProperties;
exports.propertyDeprecationSupported = supportsProperties;
exports.getMessageLogger = getShowDeprecationMessage;
return module.exports;
}).call(this);
// src/js/aui/internal/amdify.js
(typeof window === 'undefined' ? global : window).__c22195cc5d37225b372c9a8af628fc78 = (function () {
var module = {
exports: {}
};
var exports = module.exports;
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (name, fn) {
if (window.define) {
var alias = window.define;
alias(name, [], function () {
return fn;
});
}
return fn;
};
module.exports = exports['default'];
return module.exports;
}).call(this);
// src/js/aui/internal/log.js
(typeof window === 'undefined' ? global : window).__bdf9202e1b2493b75532363403577f4b = (function () {
var module = {
exports: {}
};
var exports = module.exports;
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.error = exports.warn = exports.log = undefined;
var _globalize = __72a5ad586a97d712f1f222cf9b461386;
var _globalize2 = _interopRequireDefault(_globalize);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function polyfillConsole(prop) {
return function () {
if (typeof console !== 'undefined' && console[prop]) {
Function.prototype.apply.call(console[prop], console, arguments);
}
};
}
var log = polyfillConsole('log');
var warn = polyfillConsole('warn');
var error = polyfillConsole('error');
(0, _globalize2.default)('error', error);
(0, _globalize2.default)('log', log);
(0, _globalize2.default)('warn', warn);
exports.log = log;
exports.warn = warn;
exports.error = error;
return module.exports;
}).call(this);
// src/js/aui/internal/browser.js
(typeof window === 'undefined' ? global : window).__bb5fba313ec1eb836dad64fbff4776b2 = (function () {
var module = {
exports: {}
};
var exports = module.exports;
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.needsLayeringShim = needsLayeringShim;
exports.supportsCalc = supportsCalc;
exports.supportsRequestAnimationFrame = supportsRequestAnimationFrame;
exports.supportsCssTransition = supportsCssTransition;
exports.supportsVoiceOver = supportsVoiceOver;
exports.supportsDateField = supportsDateField;
exports.supportsNewMouseEvent = supportsNewMouseEvent;
var ua = navigator.userAgent.toLowerCase();
var isIE = /msie/.test(ua);
var isWinXP = /windows nt 5.1/.test(ua);
var isWinVista = /windows nt 6.0/.test(ua);
var isWin7 = /windows nt 6.1/.test(ua);
var isMacOSX = /mac os x/.test(ua);
var doesSupportCalc;
var doesSupportCssTransition;
var doesSupportHtml5DateInput;
/**
* Layered elements can get obscured by <object>, <embed>, <select> or sometimes even <iframe>
* on older versions of Windows + Internet Explorer.
* From manual testing, all IE versions on Windows 7 appear to have the bug,
* but no IE versions on Windows 8 have it.
*/
function needsLayeringShim() {
return isIE && (isWinXP || isWinVista || isWin7);
}
function supportsCalc() {
if (typeof doesSupportCalc === 'undefined') {
var d = document.createElement('div');
d.style.cssText = 'height: -webkit-calc(20px + 0); height: calc(20px);';
// browsers will cull the rules they don't understand, so we can check whether
// any were added at all to confirm presence of the calc() behaviour.
doesSupportCalc = d.style.cssText.length > 0;
}
return doesSupportCalc;
}
function supportsRequestAnimationFrame() {
return !!window.requestAnimationFrame;
}
function supportsCssTransition() {
if (typeof doesSupportCssTransition === 'undefined') {
var documentBody = document.body || document.documentElement;
var style = documentBody.style;
doesSupportCssTransition = typeof style.transition === 'string' || typeof style.WebkitTransition === 'string';
}
return doesSupportCssTransition;
}
function supportsVoiceOver() {
return isMacOSX;
}
function supportsDateField() {
if (typeof doesSupportHtml5DateInput === 'undefined') {
var el = document.createElement('input');
el.setAttribute('type', 'date');
doesSupportHtml5DateInput = el.type === 'date';
}
return doesSupportHtml5DateInput;
}
// This is supported everywhere except Chrome 22, but we needed to support this use case due to
// https://bitbucket.org/atlassian/aui/pull-requests/1920/aui-4380-fix-shortcut-not-work-in-old/diff .
function supportsNewMouseEvent() {
try {
new MouseEvent('click');
} catch (e) {
return false;
}
return true;
}
return module.exports;
}).call(this);
// src/js/aui/key-code.js
(typeof window === 'undefined' ? global : window).__4bfccaeabc98ece1d9093bf6f637e351 = (function () {
var module = {
exports: {}
};
var exports = module.exports;
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _globalize = __72a5ad586a97d712f1f222cf9b461386;
var _globalize2 = _interopRequireDefault(_globalize);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var keyCode = {
ALT: 18,
BACKSPACE: 8,
CAPS_LOCK: 20,
COMMA: 188,
COMMAND: 91,
// cmd
COMMAND_LEFT: 91,
COMMAND_RIGHT: 93,
LEFT_SQUARE_BRACKET: 91, //This is 91 for keypress and 219 for keydown/keyup
CONTROL: 17,
DELETE: 46,
DOWN: 40,
END: 35,
ENTER: 13,
ESCAPE: 27,
HOME: 36,
INSERT: 45,
LEFT: 37,
// right cmd
MENU: 93,
NUMPAD_ADD: 107,
NUMPAD_DECIMAL: 110,
NUMPAD_DIVIDE: 111,
NUMPAD_ENTER: 108,
NUMPAD_MULTIPLY: 106,
NUMPAD_SUBTRACT: 109,
PAGE_DOWN: 34,
PAGE_UP: 33,
PERIOD: 190,
RIGHT: 39,
SHIFT: 16,
SPACE: 32,
TAB: 9,
UP: 38,
// cmd
WINDOWS: 91
};
(0, _globalize2.default)('keyCode', keyCode);
exports.default = keyCode;
module.exports = exports['default'];
return module.exports;
}).call(this);
// node_modules/css.escape/css.escape.js
(typeof window === 'undefined' ? global : window).__31c413f55c162c23d36ee04551225a8a = (function () {
var module = {
exports: {}
};
var exports = module.exports;
var defineDependencies = {
"module": module,
"exports": exports
};
var define = function defineReplacementWrapper(generatedModuleName) {
return function defineReplacement(name, deps, func) {
var root = (typeof window === 'undefined' ? global : window);
var defineGlobal = root.define;
var rval;
var type;
func = [func, deps, name].filter(function (cur) {
return typeof cur === 'function';
})[0];
deps = [deps, name, []].filter(Array.isArray)[0];
rval = func.apply(null, deps.map(function (value) {
return defineDependencies[value];
}));
type = typeof rval;
// Support existing AMD libs.
if (typeof defineGlobal === 'function') {
// Almond always expects a name so resolve one (#29).
defineGlobal(typeof name === 'string' ? name : generatedModuleName, deps, func);
}
// Some processors like Babel don't check to make sure that the module value
// is not a primitive before calling Object.defineProperty() on it. We ensure
// it is an instance so that it can.
if (type === 'string') {
rval = String(rval);
} else if (type === 'number') {
rval = Number(rval);
} else if (type === 'boolean') {
rval = Boolean(rval);
}
// Reset the exports to the defined module. This is how we convert AMD to
// CommonJS and ensures both can either co-exist, or be used separately. We
// only set it if it is not defined because there is no object representation
// of undefined, thus calling Object.defineProperty() on it would fail.
if (rval !== undefined) {
exports = module.exports = rval;
}
};
}("__31c413f55c162c23d36ee04551225a8a");
define.amd = true;
/*! https://mths.be/cssescape v1.5.0 by @mathias | MIT license */
;(function(root, factory) {
// https://github.com/umdjs/umd/blob/master/returnExports.js
if (typeof exports == 'object') {
// For Node.js.
module.exports = factory(root);
} else if (typeof define == 'function' && define.amd) {
// For AMD. Register as an anonymous module.
define([], factory.bind(root, root));
} else {
// For browser globals (not exposing the function separately).
factory(root);
}
}(typeof global != 'undefined' ? global : this, function(root) {
if (root.CSS && root.CSS.escape) {
return root.CSS.escape;
}
// https://drafts.csswg.org/cssom/#serialize-an-identifier
var cssEscape = function(value) {
var string = String(value);
var length = string.length;
var index = -1;
var codeUnit;
var result = '';
var firstCodeUnit = string.charCodeAt(0);
while (++index < length) {
codeUnit = string.charCodeAt(index);
// Note: there’s no need to special-case astral symbols, surrogate
// pairs, or lone surrogates.
// If the character is NULL (U+0000), then the REPLACEMENT CHARACTER
// (U+FFFD).
if (codeUnit == 0x0000) {
result += '\uFFFD';
continue;
}
if (
// If the character is in the range [\1-\1F] (U+0001 to U+001F) or is
// U+007F, […]
(codeUnit >= 0x0001 && codeUnit <= 0x001F) || codeUnit == 0x007F ||
// If the character is the first character and is in the range [0-9]
// (U+0030 to U+0039), […]
(index == 0 && codeUnit >= 0x0030 && codeUnit <= 0x0039) ||
// If the character is the second character and is in the range [0-9]
// (U+0030 to U+0039) and the first character is a `-` (U+002D), […]
(
index == 1 &&
codeUnit >= 0x0030 && codeUnit <= 0x0039 &&
firstCodeUnit == 0x002D
)
) {
// https://drafts.csswg.org/cssom/#escape-a-character-as-code-point
result += '\\' + codeUnit.toString(16) + ' ';
continue;
}
if (
// If the character is the first character and is a `-` (U+002D), and
// there is no second character, […]
index == 0 &&
length == 1 &&
codeUnit == 0x002D
) {
result += '\\' + string.charAt(index);
continue;
}
// If the character is not handled by one of the above rules and is
// greater than or equal to U+0080, is `-` (U+002D) or `_` (U+005F), or
// is in one of the ranges [0-9] (U+0030 to U+0039), [A-Z] (U+0041 to
// U+005A), or [a-z] (U+0061 to U+007A), […]
if (
codeUnit >= 0x0080 ||
codeUnit == 0x002D ||
codeUnit == 0x005F ||
codeUnit >= 0x0030 && codeUnit <= 0x0039 ||
codeUnit >= 0x0041 && codeUnit <= 0x005A ||
codeUnit >= 0x0061 && codeUnit <= 0x007A
) {
// the character itself
result += string.charAt(index);
continue;
}
// Otherwise, the escaped character.
// https://drafts.csswg.org/cssom/#escape-a-character
result += '\\' + string.charAt(index);
}
return result;
};
if (!root.CSS) {
root.CSS = {};
}
root.CSS.escape = cssEscape;
return cssEscape;
}));
return module.exports;
}).call(this);
// src/js/aui/inline-dialog.js
(typeof window === 'undefined' ? global : window).__f41aa0120717d7505a0deee194734975 = (function () {
var module = {
exports: {}
};
var exports = module.exports;
/* eslint quotmark:off, eqeqeq:off, strict:off, complexity:off */
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jquery = __078f1f0dae379d17d70c51baf1a7fc2e;
var _jquery2 = _interopRequireDefault(_jquery);
var _browser = __bb5fba313ec1eb836dad64fbff4776b2;
var _deprecation = __790480709a11d9caf89bfe72fb497800;
var deprecate = _interopRequireWildcard(_deprecation);
var _log = __bdf9202e1b2493b75532363403577f4b;
var logger = _interopRequireWildcard(_log);
var _globalize = __72a5ad586a97d712f1f222cf9b461386;
var _globalize2 = _interopRequireDefault(_globalize);
var _keyCode = __4bfccaeabc98ece1d9093bf6f637e351;
var _keyCode2 = _interopRequireDefault(_keyCode);
var _css = __31c413f55c162c23d36ee04551225a8a;
var _css2 = _interopRequireDefault(_css);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Creates a new inline dialog.
*
* @param items jQuery object - the items that trigger the display of this popup when the user mouses over.
* @param identifier A unique identifier for this popup. This should be unique across all popups on the page and a valid CSS class.
* @param url The URL to retrieve popup contents.
* @param options Custom options to change default behaviour. See InlineDialog.opts for default values and valid options.
*/
function InlineDialog(items, identifier, url, options) {
options = options || [];
if (options.hasOwnProperty('onTop')) {
onTopDeprecationLogger();
if (options.onTop && options.gravity === undefined) {
options.gravity = 's';
}
}
// attempt to generate a random identifier if it doesn't exist
if (typeof identifier === 'undefined') {
identifier = String(Math.random()).replace('.', '');
// if the generated supplied identifier already exists when combined with the prefixes we'll be using, then bail
if ((0, _jquery2.default)('#inline-dialog-' + identifier + ', #arrow-' + identifier + ', #inline-dialog-shim-' + identifier).length) {
throw 'GENERATED_IDENTIFIER_NOT_UNIQUE';
}
}
var escapedIdentifier = (0, _css2.default)(identifier);
var opts = _jquery2.default.extend(false, InlineDialog.opts, options);
if (opts.gravity === 'w') {
// TODO Once support for gravity: 'e' is added, it should also
// transpose the defaults for offsetX and offsetY.
opts.offsetX = options.offsetX === undefined ? 10 : options.offsetX;
opts.offsetY = options.offsetY === undefined ? 0 : options.offsetY;
}
var hash;
var hideDelayTimer;
var showTimer;
var beingShown = false;
var shouldShow = false;
var contentLoaded = false;
var mousePosition;
var targetPosition;
var popup = (0, _jquery2.default)('<div id="inline-dialog-' + identifier + '" class="aui-inline-dialog"><div class="aui-inline-dialog-contents contents"></div><div id="arrow-' + identifier + '" class="aui-inline-dialog-arrow arrow aui-css-arrow"></div></div>');
var arrow = (0, _jquery2.default)('#arrow-' + escapedIdentifier, popup);
var contents = popup.find('.contents');
if (!opts.displayShadow) {
contents.addClass('aui-inline-dialog-no-shadow');
}
if (opts.autoWidth) {
contents.addClass('aui-inline-dialog-auto-width');
} else {
contents.width(opts.width);
}
contents.on({
mouseenter: function mouseenter() {
clearTimeout(hideDelayTimer);
popup.unbind('mouseenter');
},
mouseleave: function mouseleave() {
hidePopup();
}
});
var getHash = function getHash() {
if (!hash) {
hash = {
popup: popup,
hide: function hide() {
hidePopup(0);
},
id: identifier,
show: function show() {
showPopup();
},
persistent: opts.persistent ? true : false,
reset: function reset() {
function drawPopup(popup, positions) {
//Position the popup using the left and right parameters
popup.css(positions.popupCss);
arrow.removeClass('aui-bottom-arrow aui-left-arrow aui-right-arrow');
if (positions.gravity === 's' && !arrow.hasClass('aui-bottom-arrow')) {
arrow.addClass('aui-bottom-arrow');
} else if (positions.gravity === 'w') {
arrow.addClass('aui-left-arrow');
} else if (positions.gravity === 'e') {
arrow.addClass('aui-right-arrow');
}
// Default styles are for 'n' gravity.
arrow.css(positions.arrowCss);
}
//DRAW POPUP
var viewportHeight = (0, _jquery2.default)(window).height();
var popupMaxHeight = Math.round(viewportHeight * 0.75);
popup.children('.aui-inline-dialog-contents').css('max-height', popupMaxHeight);
var positions = opts.calculatePositions(popup, targetPosition, mousePosition, opts);
if (positions.hasOwnProperty('displayAbove')) {
displayAboveDeprecationLogger();
positions.gravity = positions.displayAbove ? 's' : 'n';
}
drawPopup(popup, positions);
// reset position of popup box
popup.fadeIn(opts.fadeTime, function () {
// once the animation is complete, set the tracker variables
// beingShown = false; // is this necessary? Maybe only the shouldShow will have to be reset?
});
if ((0, _browser.needsLayeringShim)()) {
// iframeShim, prepend if it doesnt exist
var jQueryCache = (0, _jquery2.default)('#inline-dialog-shim-' + escapedIdentifier);
if (!jQueryCache.length) {
(0, _jquery2.default)(popup).prepend((0, _jquery2.default)('<iframe class = "inline-dialog-shim" id="inline-dialog-shim-' + identifier + '" frameBorder="0" src="javascript:false;"></iframe>'));
}
// adjust height and width of shim according to the popup
jQueryCache.css({
width: contents.outerWidth(),
height: contents.outerHeight()
});
}
}
};
}
return hash;
};
var showPopup = function showPopup() {
if (popup.is(':visible')) {
return;
}
showTimer = setTimeout(function () {
if (!contentLoaded || !shouldShow) {
return;
}
opts.addActiveClass && (0, _jquery2.default)(items).addClass('active');
beingShown = true;
if (!opts.persistent) {
bindHideEvents();
}
InlineDialog.current = getHash();
(0, _jquery2.default)(document).trigger('showLayer', ['inlineDialog', getHash()]);
// retrieve the position of the click target. The offsets might be different for different types of targets and therefore
// either have to be customisable or we will have to be smarter about calculating the padding and elements around it
getHash().reset();
}, opts.showDelay);
};
var hidePopup = function hidePopup(delay) {
// do not auto hide the popup if persistent is set as true
if (typeof delay === 'undefined' && opts.persistent) {
return;
}
if (typeof popup.get(0)._datePickerPopup !== 'undefined') {
// AUI-2696 - This inline dialog is host to a date picker... so we shouldn't close it.
return;
}
shouldShow = false;
// only exectute the below if the popup is currently being shown
// and the arbitrator callback gives us the green light
if (beingShown && opts.preHideCallback.call(popup[0].popup)) {
delay = delay == null ? opts.hideDelay : delay;
clearTimeout(hideDelayTimer);
clearTimeout(showTimer);
// store the timer so that it can be cleared in the mouseenter if required
//disable auto-hide if user passes null for hideDelay
if (delay != null) {
hideDelayTimer = setTimeout(function () {
unbindHideEvents();
opts.addActiveClass && (0, _jquery2.default)(items).removeClass('active');
popup.fadeOut(opts.fadeTime, function () {
opts.hideCallback.call(popup[0].popup);
});
beingShown = false;
shouldShow = false;
(0, _jquery2.default)(document).trigger('hideLayer', ['inlineDialog', getHash()]);
InlineDialog.current = null;
if (!opts.cacheContent) {
//if not caching the content, then reset the
//flags to false so as to reload the content
//on next mouse hover.
contentLoaded = false;
contentLoading = false;
}
}, delay);
}
}
};
// the trigger is the jquery element that is triggering the popup (i.e., the element that the mousemove event is bound to)
var initPopup = function initPopup(e, trigger) {
var $trigger = (0, _jquery2.default)(trigger);
opts.upfrontCallback.call({
popup: popup,
hide: function hide() {
hidePopup(0);
},
id: identifier,
show: function show() {
showPopup();
}
});
popup.each(function () {
if (typeof this.popup !== 'undefined') {
this.popup.hide();
}
});
//Close all other popups if neccessary
if (opts.closeOthers) {
(0, _jquery2.default)('.aui-inline-dialog').each(function () {
!this.popup.persistent && this.popup.hide();
});
}
//handle programmatic showing where there is no event
targetPosition = { target: $trigger };
if (!e) {
mousePosition = { x: $trigger.offset().left, y: $trigger.offset().top };
} else {
mousePosition = { x: e.pageX, y: e.pageY };
}
if (!beingShown) {
clearTimeout(showTimer);
}
shouldShow = true;
var doShowPopup = function doShowPopup() {
contentLoading = false;
contentLoaded = true;
opts.initCallback.call({
popup: popup,
hide: function hide() {
hidePopup(0);
},
id: identifier,
show: function show() {
showPopup();
}
});
showPopup();
};
// lazy load popup contents
if (!contentLoading) {
contentLoading = true;
if (_jquery2.default.isFunction(url)) {
// If the passed in URL is a function, execute it. Otherwise simply load the content.
url(contents, trigger, doShowPopup);
} else {
//Retrive response from server
_jquery2.default.get(url, function (data, status, xhr) {
//Load HTML contents into the popup
contents.html(opts.responseHandler(data, status, xhr));
//Show the popup
contentLoaded = true;
opts.initCallback.call({
popup: popup,
hide: function hide() {
hidePopup(0);
},
id: identifier,
show: function show() {
showPopup();
}
});
showPopup();
});
}
}
// stops the hide event if we move from the trigger to the popup element
clearTimeout(hideDelayTimer);
// don't trigger the animation again if we're being shown
if (!beingShown) {
showPopup();
}
return false;
};
popup[0].popup = getHash();
var contentLoading = false;
var added = false;
var appendPopup = function appendPopup() {
if (!added) {
(0, _jquery2.default)(opts.container).append(popup);
added = true;
}
};
var $items = (0, _jquery2.default)(items);
if (opts.onHover) {
if (opts.useLiveEvents) {
// We're using .on() to emulate the behaviour of .live() here. on() requires the jQuery object to have
// a selector - this is actually how .live() is implemented in jQuery 1.7+.
// Note that .selector is deleted in jQuery 1.9+.
// This means that jQuery objects created by selection eg $(".my-class-selector") will work, but
// object created by DOM parsing eg $("<div class='.my-class'></div>") will not work.
// Ideally we should throw an error if the $items has no selector but that is backwards incompatible,
// so we warn and do a no-op - this emulates the behaviour of live() but has the added warning.
if ($items.selector) {
(0, _jquery2.default)(document).on('mouseenter', $items.selector, function (e) {
appendPopup();
initPopup(e, this);
}).on('mouseleave', $items.selector, function () {
hidePopup();
});
} else {
logger.log('Warning: inline dialog trigger elements must have a jQuery selector when the useLiveEvents option is enabled.');
}
} else {
$items.on({
mouseenter: function mouseenter(e) {
appendPopup();
initPopup(e, this);
},
mouseleave: function mouseleave() {
hidePopup();
}
});
}
} else {
if (!opts.noBind) {
//Check if the noBind option is turned on
if (opts.useLiveEvents) {
// See above for why we filter by .selector
if ($items.selector) {
(0, _jquery2.default)(document).on('click', $items.selector, function (e) {
appendPopup();
if (shouldCloseOnTriggerClick()) {
popup.hide();
} else {
initPopup(e, this);
}
return false;
}).on('mouseleave', $items.selector, function () {
hidePopup();
});
} else {
logger.log('Warning: inline dialog trigger elements must have a jQuery selector when the useLiveEvents option is enabled.');
}
} else {
$items.on('click', function (e) {
appendPopup();
if (shouldCloseOnTriggerClick()) {
popup.hide();
} else {
initPopup(e, this);
}
return false;
}).on('mouseleave', function () {
hidePopup();
});
}
}
}
var shouldCloseOnTriggerClick = function shouldCloseOnTriggerClick() {
return beingShown && opts.closeOnTriggerClick;
};
var bindHideEvents = function bindHideEvents() {
bindHideOnExternalClick();
bindHideOnEscPressed();
};
var unbindHideEvents = function unbindHideEvents() {
unbindHideOnExternalClick();
unbindHideOnEscPressed();
};
// Be defensive and make sure that we haven't already bound the event
var hasBoundOnExternalClick = false;
var externalClickNamespace = identifier + '.inline-dialog-check';
/**
* Catch click events on the body to see if the click target occurs outside of this popup
* If it does, the popup will be hidden
*/
var bindHideOnExternalClick = function bindHideOnExternalClick() {
if (!hasBoundOnExternalClick) {
(0, _jquery2.default)('body').bind('click.' + externalClickNamespace, function (e) {
var $target = (0, _jquery2.default)(e.target);
// hide the popup if the target of the event is not in the dialog
if ($target.closest('#inline-dialog-' + escapedIdentifier + ' .contents').length === 0) {
hidePopup(0);
}
});
hasBoundOnExternalClick = true;
}
};
var unbindHideOnExternalClick = fu