@fiori-for-react/utils
Advanced tools
Comparing version 0.1.0-a5148f9 to 0.1.0-f3d70f4
@@ -7,2 +7,38 @@ 'use strict'; | ||
var Event = (function () { | ||
function Event(source, originalEvent, parameters) { | ||
if (parameters === void 0) { parameters = {}; } | ||
this.source = source; | ||
this.originalEvent = originalEvent; | ||
this.parameters = parameters; | ||
this.htmlSource = originalEvent.target; | ||
} | ||
Event.of = function (source, originalEvent, parameters) { | ||
if (parameters === void 0) { parameters = {}; } | ||
return new Event(source, originalEvent, parameters); | ||
}; | ||
Event.prototype.getSource = function () { | ||
return this.source; | ||
}; | ||
Event.prototype.getOriginalEvent = function () { | ||
return this.originalEvent; | ||
}; | ||
Event.prototype.getParameters = function () { | ||
return this.parameters; | ||
}; | ||
Event.prototype.getParameter = function (parameter) { | ||
return this.parameters[parameter]; | ||
}; | ||
Event.prototype.getHtmlSourceElement = function () { | ||
return this.htmlSource; | ||
}; | ||
Event.prototype.cancel = function () { | ||
this.originalEvent.stopPropagation(); | ||
}; | ||
Event.prototype.preventDefault = function () { | ||
this.originalEvent.preventDefault(); | ||
}; | ||
return Event; | ||
}()); | ||
var KeyCodes; | ||
@@ -184,38 +220,1132 @@ (function (KeyCodes) { | ||
var Event = (function () { | ||
function Event(source, originalEvent, parameters) { | ||
if (parameters === void 0) { parameters = {}; } | ||
this.source = source; | ||
this.originalEvent = originalEvent; | ||
this.parameters = parameters; | ||
this.htmlSource = originalEvent.target; | ||
var isNumeric = function (n) { | ||
return !isNaN(parseFloat(n)) && isFinite(n); | ||
}; | ||
!function (e, t, n) { | ||
function r(e, t) { | ||
return typeof e === t; | ||
} | ||
function o() { | ||
var e, t, n, o, i, s, a; | ||
for (var u in y) if (y.hasOwnProperty(u)) { | ||
if (e = [], t = y[u], t.name && (e.push(t.name.toLowerCase()), t.options && t.options.aliases && t.options.aliases.length)) for (n = 0; n < t.options.aliases.length; n++) e.push(t.options.aliases[n].toLowerCase()); | ||
for (o = r(t.fn, 'function') ? t.fn() : t.fn, i = 0; i < e.length; i++) s = e[i], a = s.split('.'), 1 === a.length ? Modernizr[a[0]] = o : (!Modernizr[a[0]] || Modernizr[a[0]] instanceof Boolean || (Modernizr[a[0]] = new Boolean(Modernizr[a[0]])), Modernizr[a[0]][a[1]] = o), C.push((o ? '' : 'no-') + a.join('-')); | ||
} | ||
Event.of = function (source, originalEvent, parameters) { | ||
if (parameters === void 0) { parameters = {}; } | ||
return new Event(source, originalEvent, parameters); | ||
} | ||
function i() { | ||
return 'function' != typeof t.createElement ? t.createElement(arguments[0]) : _ ? t.createElementNS.call(t, 'http://www.w3.org/2000/svg', arguments[0]) : t.createElement.apply(t, arguments); | ||
} | ||
function s() { | ||
var e = t.body; | ||
return e || (e = i(_ ? 'svg' : 'body'), e.fake = !0), e; | ||
} | ||
function a(e, n, r, o) { | ||
var a, | ||
u, | ||
l, | ||
f, | ||
d = 'modernizr', | ||
c = i('div'), | ||
p = s(); | ||
if (parseInt(r, 10)) for (; r--;) l = i('div'), l.id = o ? o[r] : d + (r + 1), c.appendChild(l); | ||
return a = i('style'), a.type = 'text/css', a.id = 's' + d, (p.fake ? p : c).appendChild(a), p.appendChild(c), a.styleSheet ? a.styleSheet.cssText = e : a.appendChild(t.createTextNode(e)), c.id = d, p.fake && (p.style.background = '', p.style.overflow = 'hidden', f = x.style.overflow, x.style.overflow = 'hidden', x.appendChild(p)), u = n(c, e), p.fake ? (p.parentNode.removeChild(p), x.style.overflow = f, x.offsetHeight) : c.parentNode.removeChild(c), !!u; | ||
} | ||
function u(e, t) { | ||
return !!~('' + e).indexOf(t); | ||
} | ||
function l(e) { | ||
return e.replace(/([A-Z])/g, function (e, t) { | ||
return '-' + t.toLowerCase(); | ||
}).replace(/^ms-/, '-ms-'); | ||
} | ||
function f(t, n, r) { | ||
var o; | ||
if ('getComputedStyle' in e) { | ||
o = getComputedStyle.call(e, t, n); | ||
var i = e.console; | ||
if (null !== o) r && (o = o.getPropertyValue(r));else if (i) { | ||
var s = i.error ? 'error' : 'log'; | ||
i[s].call(i, 'getComputedStyle returning null, its possible modernizr test results are inaccurate'); | ||
} | ||
} else o = !n && t.currentStyle && t.currentStyle[r]; | ||
return o; | ||
} | ||
function d(t, r) { | ||
var o = t.length; | ||
if ('CSS' in e && 'supports' in e.CSS) { | ||
for (; o--;) if (e.CSS.supports(l(t[o]), r)) return !0; | ||
return !1; | ||
} | ||
if ('CSSSupportsRule' in e) { | ||
for (var i = []; o--;) i.push('(' + l(t[o]) + ':' + r + ')'); | ||
return i = i.join(' or '), a('@supports (' + i + ') { #modernizr { position: absolute; } }', function (e) { | ||
return 'absolute' == f(e, null, 'position'); | ||
}); | ||
} | ||
return n; | ||
} | ||
function c(e) { | ||
return e.replace(/([a-z])-([a-z])/g, function (e, t, n) { | ||
return t + n.toUpperCase(); | ||
}).replace(/^-/, ''); | ||
} | ||
function p(e, t, o, s) { | ||
function a() { | ||
f && (delete L.style, delete L.modElem); | ||
} | ||
if (s = r(s, 'undefined') ? !1 : s, !r(o, 'undefined')) { | ||
var l = d(e, o); | ||
if (!r(l, 'undefined')) return l; | ||
} | ||
for (var f, p, v, m, h, y = ['modernizr', 'tspan', 'samp']; !L.style && y.length;) f = !0, L.modElem = i(y.shift()), L.style = L.modElem.style; | ||
for (v = e.length, p = 0; v > p; p++) if (m = e[p], h = L.style[m], u(m, '-') && (m = c(m)), L.style[m] !== n) { | ||
if (s || r(o, 'undefined')) return a(), 'pfx' == t ? m : !0; | ||
try { | ||
L.style[m] = o; | ||
} catch (g) {} | ||
if (L.style[m] != h) return a(), 'pfx' == t ? m : !0; | ||
} | ||
return a(), !1; | ||
} | ||
function v(e, t) { | ||
return function () { | ||
return e.apply(t, arguments); | ||
}; | ||
Event.prototype.getSource = function () { | ||
return this.source; | ||
} | ||
function m(e, t, n) { | ||
var o; | ||
for (var i in e) if (e[i] in t) return n === !1 ? e[i] : (o = t[e[i]], r(o, 'function') ? v(o, n || t) : o); | ||
return !1; | ||
} | ||
function h(e, t, n, o, i) { | ||
var s = e.charAt(0).toUpperCase() + e.slice(1), | ||
a = (e + ' ' + P.join(s + ' ') + s).split(' '); | ||
return r(t, 'string') || r(t, 'undefined') ? p(a, t, o, i) : (a = (e + ' ' + w.join(s + ' ') + s).split(' '), m(a, t, n)); | ||
} | ||
var y = [], | ||
g = { | ||
_version: '3.6.0', | ||
_config: { | ||
classPrefix: '', | ||
enableClasses: !0, | ||
enableJSClass: !0, | ||
usePrefixes: !0 | ||
}, | ||
_q: [], | ||
on: function (e, t) { | ||
var n = this; | ||
setTimeout(function () { | ||
t(n[e]); | ||
}, 0); | ||
}, | ||
addTest: function (e, t, n) { | ||
y.push({ | ||
name: e, | ||
fn: t, | ||
options: n | ||
}); | ||
}, | ||
addAsyncTest: function (e) { | ||
y.push({ | ||
name: null, | ||
fn: e | ||
}); | ||
} | ||
}, | ||
Modernizr = function () {}; | ||
Modernizr.prototype = g, Modernizr = new Modernizr(); | ||
var C = [], | ||
S = 'Moz O ms Webkit', | ||
w = g._config.usePrefixes ? S.toLowerCase().split(' ') : []; | ||
g._domPrefixes = w; | ||
var x = t.documentElement, | ||
_ = 'svg' === x.nodeName.toLowerCase(), | ||
b = function () { | ||
function e(e, t) { | ||
var o; | ||
return e ? (t && 'string' != typeof t || (t = i(t || 'div')), e = 'on' + e, o = e in t, !o && r && (t.setAttribute || (t = i('div')), t.setAttribute(e, ''), o = 'function' == typeof t[e], t[e] !== n && (t[e] = n), t.removeAttribute(e)), o) : !1; | ||
} | ||
var r = !('onblur' in t.documentElement); | ||
return e; | ||
}(); | ||
g.hasEvent = b, Modernizr.addTest('pointerevents', function () { | ||
var e = !1, | ||
t = w.length; | ||
for (e = Modernizr.hasEvent('pointerdown'); t-- && !e;) b(w[t] + 'pointerdown') && (e = !0); | ||
return e; | ||
}); | ||
var T = g._config.usePrefixes ? ' -webkit- -moz- -o- -ms- '.split(' ') : ['', '']; | ||
g._prefixes = T; | ||
var E = g.testStyles = a; | ||
Modernizr.addTest('touchevents', function () { | ||
var n; | ||
if ('ontouchstart' in e || e.DocumentTouch && t instanceof DocumentTouch) n = !0;else { | ||
var r = ['@media (', T.join('touch-enabled),('), 'heartz', ')', '{#modernizr{top:9px;position:absolute}}'].join(''); | ||
E(r, function (e) { | ||
n = 9 === e.offsetTop; | ||
}); | ||
} | ||
return n; | ||
}); | ||
var z = !1; | ||
try { | ||
z = 'WebSocket' in e && 2 === e.WebSocket.CLOSING; | ||
} catch (k) {} | ||
Modernizr.addTest('websockets', z), Modernizr.addTest('devicemotion', 'DeviceMotionEvent' in e), Modernizr.addTest('deviceorientation', 'DeviceOrientationEvent' in e), Modernizr.addTest('placeholder', 'placeholder' in i('input') && 'placeholder' in i('textarea')); | ||
var P = g._config.usePrefixes ? S.split(' ') : []; | ||
g._cssomPrefixes = P; | ||
var A = { | ||
elem: i('modernizr') | ||
}; | ||
Modernizr._q.push(function () { | ||
delete A.elem; | ||
}); | ||
var L = { | ||
style: A.elem.style | ||
}; | ||
Modernizr._q.unshift(function () { | ||
delete L.style; | ||
}), g.testAllProps = h; | ||
var O = function (t) { | ||
var r, | ||
o = T.length, | ||
i = e.CSSRule; | ||
if ('undefined' == typeof i) return n; | ||
if (!t) return !1; | ||
if (t = t.replace(/^@/, ''), r = t.replace(/-/g, '_').toUpperCase() + '_RULE', r in i) return '@' + t; | ||
for (var s = 0; o > s; s++) { | ||
var a = T[s], | ||
u = a.toUpperCase() + '_' + r; | ||
if (u in i) return '@-' + a.toLowerCase() + '-' + t; | ||
} | ||
return !1; | ||
}; | ||
g.atRule = O; | ||
var N = g.prefixed = function (e, t, n) { | ||
return 0 === e.indexOf('@') ? O(e) : (-1 != e.indexOf('-') && (e = c(e)), t ? h(e, t, n) : h(e, 'pfx')); | ||
}; | ||
Modernizr.addTest('matchmedia', !!N('matchMedia', e)), o(), delete g.addTest, delete g.addAsyncTest; | ||
for (var j = 0; j < Modernizr._q.length; j++) Modernizr._q[j](); | ||
e.Modernizr = Modernizr; | ||
}(window, document); | ||
var Support = (function () { | ||
function Support(browser) { | ||
this.input = { | ||
placeholder: false | ||
}; | ||
this.touch = Modernizr.touchevents; | ||
this.pointer = Modernizr.pointerevents; | ||
this.matchmedia = Modernizr.matchmedia; | ||
var matchmedialistener = !!(this.matchmedia && window.matchMedia('all and (max-width:0px)')); | ||
if (browser.safari && browser.version < 6 && !browser.fullscreen && !browser.webview) { | ||
matchmedialistener = false; | ||
} | ||
this.matchmedialistener = matchmedialistener; | ||
this.orientation = Modernizr.deviceorientation; | ||
this.retina = window.retina || window.devicePixelRatio >= 2; | ||
this.websocket = Modernizr.websockets; | ||
this.input.placeholder = Modernizr.placeholder; | ||
return this; | ||
} | ||
return Support; | ||
}()); | ||
var OSTypes; | ||
(function (OSTypes) { | ||
OSTypes["WINDOWS"] = "win"; | ||
OSTypes["MACINTOSH"] = "mac"; | ||
OSTypes["LINUX"] = "linux"; | ||
OSTypes["IOS"] = "iOS"; | ||
OSTypes["ANDROID"] = "Android"; | ||
OSTypes["BLACKBERRY"] = "bb"; | ||
OSTypes["WINDOWS_PHONE"] = "winphone"; | ||
})(OSTypes || (OSTypes = {})); | ||
var OS = (function () { | ||
function OS(customUA) { | ||
var _this = this; | ||
this.OS = OSTypes; | ||
this.getDesktopOS = function (customUA) { | ||
var userAgent = customUA || navigator.userAgent; | ||
var pf = navigator.platform; | ||
if (pf.indexOf('Win') != -1) { | ||
var rVersion = /Windows NT (\d+).(\d)/i; | ||
var uaResult = userAgent.match(rVersion); | ||
var sVersionStr = ''; | ||
if (uaResult[1] == '6') { | ||
if (uaResult[2] == 1) { | ||
sVersionStr = '7'; | ||
} | ||
else if (uaResult[2] > 1) { | ||
sVersionStr = '8'; | ||
} | ||
} | ||
else { | ||
sVersionStr = uaResult[1]; | ||
} | ||
_this.name = OSTypes.WINDOWS; | ||
_this.versionStr = sVersionStr; | ||
return _this; | ||
} | ||
if (pf.indexOf('Mac') != -1) { | ||
_this.name = OSTypes.MACINTOSH; | ||
_this.versionStr = ''; | ||
return _this; | ||
} | ||
if (pf.indexOf('Linux') != -1) { | ||
_this.name = OSTypes.LINUX; | ||
_this.versionStr = ''; | ||
return _this; | ||
} | ||
Logger.info('OS detection returned no result'); | ||
return null; | ||
}; | ||
this.setOS(customUA); | ||
} | ||
OS.prototype.setOS = function (customUA) { | ||
this.getOS(customUA); | ||
this.version = this.versionStr ? parseFloat(this.versionStr) : -1; | ||
if (this.name) { | ||
for (var os in OSTypes) { | ||
if (OSTypes[os] === this.name) { | ||
this[os.toLowerCase()] = true; | ||
} | ||
} | ||
} | ||
}; | ||
Event.prototype.getOriginalEvent = function () { | ||
return this.originalEvent; | ||
OS.prototype.getOS = function (customUA) { | ||
var platform; | ||
var result; | ||
var userAgent = customUA || navigator.userAgent; | ||
platform = /Windows Phone (?:OS )?([\d.]*)/; | ||
result = userAgent.match(platform); | ||
if (result) { | ||
this.name = OSTypes.WINDOWS_PHONE; | ||
this.versionStr = result[1]; | ||
return this; | ||
} | ||
if (userAgent.indexOf('(BB10;') > 0) { | ||
platform = /\sVersion\/([\d.]+)\s/; | ||
result = userAgent.match(platform); | ||
if (result) { | ||
this.name = OSTypes.BLACKBERRY; | ||
this.versionStr = result[1]; | ||
return this; | ||
} | ||
this.name = OSTypes.BLACKBERRY; | ||
this.versionStr = '10'; | ||
return this; | ||
} | ||
platform = /\(([a-zA-Z ]+);\s(?:[U]?[;]?)([\D]+)((?:[\d._]*))(?:.*[\)][^\d]*)([\d.]*)\s/; | ||
result = userAgent.match(platform); | ||
if (result) { | ||
var appleDevices = /iPhone|iPad|iPod/; | ||
var bbDevices = /PlayBook|BlackBerry/; | ||
if (result[0].match(appleDevices)) { | ||
result[3] = result[3].replace(/_/g, '.'); | ||
this.name = OSTypes.IOS; | ||
this.versionStr = result[3]; | ||
return this; | ||
} | ||
if (result[2].match(/Android/)) { | ||
result[2] = result[2].replace(/\s/g, ''); | ||
this.name = OSTypes.ANDROID; | ||
this.versionStr = result[3]; | ||
return this; | ||
} | ||
if (result[0].match(bbDevices)) { | ||
this.name = OSTypes.BLACKBERRY; | ||
this.versionStr = result[4]; | ||
return this; | ||
} | ||
} | ||
platform = /\((Android)[\s]?([\d][.\d]*)?;.*Firefox\/[\d][.\d]*/; | ||
result = userAgent.match(platform); | ||
if (result) { | ||
this.name = OSTypes.ANDROID; | ||
this.versionStr = result.length == 3 ? result[2] : ''; | ||
return this; | ||
} | ||
return this.getDesktopOS(customUA); | ||
}; | ||
Event.prototype.getParameters = function () { | ||
return this.parameters; | ||
return OS; | ||
}()); | ||
var BROWSER; | ||
(function (BROWSER) { | ||
BROWSER["INTERNET_EXPLORER"] = "ie"; | ||
BROWSER["EDGE"] = "ed"; | ||
BROWSER["FIREFOX"] = "ff"; | ||
BROWSER["CHROME"] = "cr"; | ||
BROWSER["SAFARI"] = "sf"; | ||
BROWSER["ANDROID"] = "an"; | ||
})(BROWSER || (BROWSER = {})); | ||
var Browser = (function () { | ||
function Browser() { | ||
this.BROWSER = BROWSER; | ||
this.setBrowser(); | ||
} | ||
Browser.calcBrowser = function (customUa) { | ||
var ua = navigator.userAgent; | ||
var _ua = (customUa || ua).toLowerCase(); | ||
var rwebkit = /(webkit)[ \/]([\w.]+)/; | ||
var ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/; | ||
var rmsie = /(msie) ([\w.]+)/; | ||
var rmsie11 = /(trident)\/[\w.]+;.*rv:([\w.]+)/; | ||
var redge = /(edge)[ \/]([\w.]+)/; | ||
var rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/; | ||
var browserMatch = redge.exec(_ua) || | ||
rmsie11.exec(_ua) || | ||
rwebkit.exec(_ua) || | ||
ropera.exec(_ua) || | ||
rmsie.exec(_ua) || | ||
(_ua.indexOf('compatible') < 0 && rmozilla.exec(_ua)) || | ||
[]; | ||
var res = { | ||
browser: browserMatch[1] || '', | ||
version: browserMatch[2] || '0' | ||
}; | ||
res[res.browser] = true; | ||
return res; | ||
}; | ||
Event.prototype.getParameter = function (parameter) { | ||
return this.parameters[parameter]; | ||
Browser.prototype.getBrowser = function (customUa, customNav) { | ||
var ua = navigator.userAgent; | ||
var b = Browser.calcBrowser(customUa); | ||
var _ua = customUa || ua; | ||
var _navigator = customNav || window.navigator; | ||
var oExpMobile; | ||
if (b.mozilla) { | ||
oExpMobile = /Mobile/; | ||
if (_ua.match(/Firefox\/(\d+\.\d+)/)) { | ||
var version = parseFloat(RegExp.$1); | ||
this.name = BROWSER.FIREFOX; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.mozilla = true; | ||
this.mobile = oExpMobile.test(_ua); | ||
return this; | ||
} | ||
this.mobile = oExpMobile.test(_ua); | ||
this.mozilla = true; | ||
this.version = -1; | ||
} | ||
if (b.webkit) { | ||
var regExpWebkitVersion = _ua.toLowerCase().match(/webkit[\/]([\d.]+)/); | ||
var webkitVersion = void 0; | ||
if (regExpWebkitVersion) { | ||
webkitVersion = regExpWebkitVersion[1]; | ||
} | ||
oExpMobile = /Mobile/; | ||
if (_ua.match(/(Chrome|CriOS)\/(\d+\.\d+).\d+/)) { | ||
var version = parseFloat(RegExp.$2); | ||
this.name = BROWSER.CHROME; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.mobile = oExpMobile.test(_ua); | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
return this; | ||
} | ||
if (_ua.match(/FxiOS\/(\d+\.\d+)/)) { | ||
var version = parseFloat(RegExp.$1); | ||
this.name = BROWSER.FIREFOX; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.mobile = true; | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
return this; | ||
} | ||
if (_ua.match(/Android .+ Version\/(\d+\.\d+)/)) { | ||
var version = parseFloat(RegExp.$1); | ||
this.name = BROWSER.ANDROID; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.mobile = oExpMobile.test(_ua); | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
return this; | ||
} | ||
var oExp = /(Version|PhantomJS)\/(\d+\.\d+).*Safari/; | ||
var bStandalone = _navigator.standalone; | ||
if (oExp.test(_ua)) { | ||
var aParts = oExp.exec(_ua); | ||
var version = parseFloat(aParts[2]); | ||
this.name = BROWSER.SAFARI; | ||
this.versionStr = "" + version; | ||
this.fullscreen = false; | ||
this.webview = false; | ||
this.version = version; | ||
this.mobile = oExpMobile.test(_ua); | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
this.phantomJS = aParts[1] === 'PhantomJS'; | ||
return this; | ||
} | ||
if (/iPhone|iPad|iPod/.test(_ua) && | ||
!/CriOS/.test(_ua) && | ||
!/FxiOS/.test(_ua) && | ||
(bStandalone === true || bStandalone === false)) { | ||
this.name = BROWSER.SAFARI; | ||
this.version = -1; | ||
this.fullscreen = bStandalone; | ||
this.webview = bStandalone; | ||
this.mobile = oExpMobile.test(_ua); | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
return this; | ||
} | ||
this.mobile = oExpMobile.test(_ua); | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
this.version = -1; | ||
return this; | ||
} | ||
if (b.msie || b.trident) { | ||
var version = void 0; | ||
if (document.documentMode && !customUa) { | ||
if (document.documentMode === 7) { | ||
version = 8.0; | ||
} | ||
else { | ||
version = parseFloat(document.documentMode); | ||
} | ||
} | ||
else { | ||
version = parseFloat(b.version); | ||
} | ||
this.name = BROWSER.INTERNET_EXPLORER; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.msie = true; | ||
this.mobile = false; | ||
return this; | ||
} | ||
if (b.edge) { | ||
var version = parseFloat(b.version); | ||
this.name = BROWSER.EDGE; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.edge = true; | ||
return this; | ||
} | ||
this.name = ''; | ||
this.versionStr = ''; | ||
this.version = -1; | ||
this.mobile = false; | ||
return this; | ||
}; | ||
Event.prototype.getHtmlSourceElement = function () { | ||
return this.htmlSource; | ||
Browser.prototype.setBrowser = function () { | ||
this.getBrowser(); | ||
if (this.name) { | ||
for (var b in BROWSER) { | ||
if (BROWSER[b] === this.name) { | ||
this[b.toLowerCase()] = true; | ||
} | ||
} | ||
} | ||
}; | ||
Event.prototype.cancel = function () { | ||
this.originalEvent.stopPropagation(); | ||
return Browser; | ||
}()); | ||
var windowSize = function () { | ||
return [window.innerWidth, window.innerHeight]; | ||
}; | ||
var changeRootCSSClass = function (sClassName, bRemove, sPrefix) { | ||
var oRoot = document.documentElement; | ||
if (oRoot.className.length === 0) { | ||
if (!bRemove) { | ||
oRoot.className = sClassName; | ||
} | ||
} | ||
else { | ||
var aCurrentClasses = oRoot.className.split(' '); | ||
var sNewClasses_1 = ''; | ||
aCurrentClasses.forEach(function (currentClass) { | ||
if ((sPrefix && currentClass.indexOf(sPrefix) !== 0) || (!sPrefix && currentClass !== sClassName)) { | ||
sNewClasses_1 = sNewClasses_1 + currentClass + " "; | ||
} | ||
}); | ||
if (!bRemove) { | ||
sNewClasses_1 += sClassName; | ||
} | ||
oRoot.className = sNewClasses_1; | ||
} | ||
}; | ||
var getQuery = function (from, to, unit) { | ||
unit = unit || 'px'; | ||
var q = 'all'; | ||
if (from > 0) { | ||
q = q + " and (min-width:" + from + unit + ")"; | ||
} | ||
if (to > 0) { | ||
q = q + " and (max-width:" + to + unit + ")"; | ||
} | ||
return q; | ||
}; | ||
var convertToPx = function (val, unit) { | ||
if (unit === 'em' || unit === 'rem') { | ||
var s = window.getComputedStyle || | ||
function (e) { | ||
return e.currentStyle; | ||
}; | ||
var x = s(document.documentElement).fontSize; | ||
var f = x && x.indexOf('px') >= 0 ? parseFloat(x, 10) : 16; | ||
return val * f; | ||
} | ||
return val; | ||
}; | ||
var matchLegacyBySize = function (from, to, unit, size) { | ||
from = convertToPx(from, unit); | ||
to = convertToPx(to, unit); | ||
var width = size[0]; | ||
var a = from < 0 || from <= width; | ||
var b = to < 0 || width <= to; | ||
return a && b; | ||
}; | ||
var SYSTEMTYPE; | ||
(function (SYSTEMTYPE) { | ||
SYSTEMTYPE["TABLET"] = "tablet"; | ||
SYSTEMTYPE["PHONE"] = "phone"; | ||
SYSTEMTYPE["DESKTOP"] = "desktop"; | ||
SYSTEMTYPE["COMBI"] = "combi"; | ||
})(SYSTEMTYPE || (SYSTEMTYPE = {})); | ||
var os; | ||
var browser; | ||
var support; | ||
var System = (function () { | ||
function System(osInstance, browserInstance, supportInstance) { | ||
this.SYSTEMTYPE = SYSTEMTYPE; | ||
os = osInstance; | ||
browser = browserInstance; | ||
support = supportInstance; | ||
this.setSystem(); | ||
return this; | ||
} | ||
System.prototype.getSystem = function (customUA) { | ||
var _this = this; | ||
var t = this.isTablet(customUA); | ||
var isWin8Upwards = os.windows && os.version >= 8; | ||
var isWin7 = os.windows && os.version === 7; | ||
this.tablet = !!(((support.touch && !isWin7) || isWin8Upwards) && t); | ||
this.phone = !!(os.windows_phone || (support.touch && !isWin7 && !t)); | ||
this.desktop = !!((!this.tablet && !this.phone) || isWin8Upwards || isWin7); | ||
this.combi = !!(this.desktop && this.tablet); | ||
Object.values(SYSTEMTYPE).forEach(function (type) { | ||
changeRootCSSClass("sap-" + type, !_this[type]); | ||
}); | ||
}; | ||
Event.prototype.preventDefault = function () { | ||
this.originalEvent.preventDefault(); | ||
System.prototype.isTablet = function (customUA) { | ||
var ua = customUA || navigator.userAgent; | ||
var isWin8Upwards = os.windows && os.version >= 8; | ||
if (os.name === os.OS.IOS) { | ||
return /ipad/i.test(ua); | ||
} | ||
if (support.touch) { | ||
if (isWin8Upwards) { | ||
return true; | ||
} | ||
if (browser.chrome && os.android && os.version >= 4.4) { | ||
return !/Mobile Safari\/[.0-9]+/.test(ua); | ||
} | ||
var densityFactor = window.devicePixelRatio ? window.devicePixelRatio : 1; | ||
if (os.android && browser.webkit && parseFloat(browser.webkitVersion) > 537.1) { | ||
densityFactor = 1; | ||
} | ||
var bTablet = Math.min(window.screen.width / densityFactor, window.screen.height / densityFactor) >= 600; | ||
if ((window.screen.height === 552 || window.screen.height === 553) && | ||
/Nexus 7/i.test(ua)) { | ||
bTablet = true; | ||
} | ||
return bTablet; | ||
} | ||
var androidPhone = /(?=android)(?=.*mobile)/i.test(ua); | ||
return (browser.msie && ua.indexOf('Touch') !== -1) || (os.android && !androidPhone); | ||
}; | ||
return Event; | ||
System.prototype.setSystem = function (customUA) { | ||
this.getSystem(customUA); | ||
if (this.tablet || this.phone) { | ||
browser.mobile = true; | ||
} | ||
}; | ||
return System; | ||
}()); | ||
var EventRegistry = (function () { | ||
function EventRegistry() { | ||
} | ||
EventRegistry.attachEvent = function (sEventId, fnFunction, oListener) { | ||
if (!EventRegistry.mEventRegistry[sEventId]) { | ||
EventRegistry.mEventRegistry[sEventId] = []; | ||
} | ||
EventRegistry.mEventRegistry[sEventId].push({ | ||
oListener: oListener, | ||
fFunction: fnFunction | ||
}); | ||
}; | ||
EventRegistry.detachEvent = function (sEventId, fnFunction, oListener) { | ||
var aEventListeners = EventRegistry.mEventRegistry[sEventId]; | ||
if (!aEventListeners) { | ||
return; | ||
} | ||
for (var i = 0, iL = aEventListeners.length; i < iL; i++) { | ||
if (aEventListeners[i].fFunction === fnFunction && aEventListeners[i].oListener === oListener) { | ||
aEventListeners.splice(i, 1); | ||
break; | ||
} | ||
} | ||
if (aEventListeners.length === 0) { | ||
delete EventRegistry.mEventRegistry[sEventId]; | ||
} | ||
}; | ||
EventRegistry.fireEvent = function (sEventId, mParameters) { | ||
var aEventListeners = EventRegistry.mEventRegistry[sEventId]; | ||
var oInfo; | ||
if (aEventListeners) { | ||
aEventListeners = aEventListeners.slice(); | ||
for (var i = 0, iL = aEventListeners.length; i < iL; i++) { | ||
oInfo = aEventListeners[i]; | ||
oInfo.fFunction.call(oInfo.oListener || window, mParameters); | ||
} | ||
} | ||
}; | ||
EventRegistry.mEventRegistry = {}; | ||
return EventRegistry; | ||
}()); | ||
var _a; | ||
var RANGESETS; | ||
(function (RANGESETS) { | ||
RANGESETS["SAP_3STEPS"] = "3Step"; | ||
RANGESETS["SAP_4STEPS"] = "4Step"; | ||
RANGESETS["SAP_6STEPS"] = "6Step"; | ||
RANGESETS["SAP_STANDARD"] = "Std"; | ||
RANGESETS["SAP_STANDARD_EXTENDED"] = "StdExt"; | ||
})(RANGESETS || (RANGESETS = {})); | ||
var support$1; | ||
var defaultRangeSet = RANGESETS.SAP_STANDARD; | ||
var querysets = {}; | ||
var mediaCurrentwidth = null; | ||
var matchLegacy = function (from, to, unit) { return matchLegacyBySize(from, to, unit, windowSize()); }; | ||
var match = function (from, to, unit) { | ||
var q = getQuery(from, to, unit); | ||
var mm = window.matchMedia(q); | ||
return mm && mm.matches; | ||
}; | ||
var refreshCSSClasses = function (sSetName, sRangeName, bRemove) { | ||
var sClassPrefix = "sapUiMedia-" + sSetName + "-"; | ||
changeRootCSSClass(sClassPrefix + sRangeName, bRemove, sClassPrefix); | ||
}; | ||
var Media = (function () { | ||
function Media(supportInstance) { | ||
this.RANGESETS = RANGESETS; | ||
support$1 = supportInstance; | ||
this.media_timeout = support$1.matchmedialistener ? 0 : 100; | ||
this.matches = support$1.matchmedia ? match : matchLegacy; | ||
this.initRangeSet(); | ||
this.initRangeSet(RANGESETS.SAP_STANDARD_EXTENDED); | ||
} | ||
Media.getRangeInfo = function (sSetName, iRangeIdx) { | ||
var q = querysets[sSetName].queries[iRangeIdx]; | ||
var info = { from: q.from, unit: querysets[sSetName].unit }; | ||
if (q.to >= 0) { | ||
info.to = q.to; | ||
} | ||
if (querysets[sSetName].names) { | ||
info.name = querysets[sSetName].names[iRangeIdx]; | ||
} | ||
return info; | ||
}; | ||
Media.prototype.checkQueries = function (name, infoOnly, fnMatches) { | ||
fnMatches = fnMatches || this.matches; | ||
if (querysets[name]) { | ||
var aQueries = querysets[name].queries; | ||
var info = null; | ||
for (var i = 0, len = aQueries.length; i < len; i++) { | ||
var q = aQueries[i]; | ||
if ((q !== querysets[name].currentquery || infoOnly) && fnMatches(q.from, q.to, querysets[name].unit)) { | ||
if (!infoOnly) { | ||
querysets[name].currentquery = q; | ||
} | ||
if (!querysets[name].noClasses && querysets[name].names && !infoOnly) { | ||
refreshCSSClasses(name, querysets[name].names[i]); | ||
} | ||
info = Media.getRangeInfo(name, i); | ||
} | ||
} | ||
return info; | ||
} | ||
Logger.warning("No queryset with name " + name + " found", 'DEVICE.MEDIA'); | ||
return null; | ||
}; | ||
Media.prototype.handleChange = function (name) { | ||
var _this = this; | ||
if (!support$1.matchmedialistener && mediaCurrentwidth === windowSize()[0]) { | ||
return; | ||
} | ||
if (querysets[name].timer) { | ||
clearTimeout(querysets[name].timer); | ||
querysets[name].timer = null; | ||
} | ||
querysets[name].timer = setTimeout(function () { | ||
var mParams = _this.checkQueries(name, false); | ||
if (mParams) { | ||
EventRegistry.fireEvent("media_" + name, mParams); | ||
} | ||
}, this.media_timeout); | ||
}; | ||
Media.prototype.attachHandler = function (fnFunction, oListener, sName) { | ||
var name = sName || defaultRangeSet; | ||
EventRegistry.attachEvent("media_" + name, fnFunction, oListener); | ||
}; | ||
Media.prototype.detachHandler = function (fnFunction, oListener, sName) { | ||
var name = sName || defaultRangeSet; | ||
EventRegistry.detachEvent("media_" + name, fnFunction, oListener); | ||
}; | ||
Media.prototype.initRangeSet = function (sName, aRangeBorders, sUnit, aRangeNames, bSuppressClasses) { | ||
var _this = this; | ||
var oConfig; | ||
if (!sName) { | ||
oConfig = Media.predefinedRangeSets[defaultRangeSet]; | ||
} | ||
else if (sName && Media.predefinedRangeSets[sName]) { | ||
oConfig = Media.predefinedRangeSets[sName]; | ||
} | ||
else { | ||
oConfig = { | ||
name: sName, | ||
unit: (sUnit || 'px').toLowerCase(), | ||
points: aRangeBorders || [], | ||
names: aRangeNames, | ||
noClasses: !!bSuppressClasses | ||
}; | ||
} | ||
if (this.hasRangeSet(oConfig.name)) { | ||
Logger.info("Range set " + oConfig.name + " has already been initialized", 'DEVICE.MEDIA'); | ||
return; | ||
} | ||
sName = oConfig.name; | ||
oConfig.queries = []; | ||
oConfig.timer = null; | ||
oConfig.currentquery = null; | ||
oConfig.listener = function () { return _this.handleChange(sName); }; | ||
var from, to, query; | ||
var aPoints = oConfig.points; | ||
for (var i = 0, len = aPoints.length; i <= len; i++) { | ||
from = i === 0 ? 0 : aPoints[i - 1]; | ||
to = i === aPoints.length ? -1 : aPoints[i]; | ||
query = getQuery(from, to, oConfig.unit); | ||
oConfig.queries.push({ | ||
query: query, | ||
from: from, | ||
to: to | ||
}); | ||
} | ||
if (oConfig.names && oConfig.names.length !== oConfig.queries.length) { | ||
oConfig.names = null; | ||
} | ||
querysets[oConfig.name] = oConfig; | ||
if (support$1.matchmedialistener) { | ||
var queries = oConfig.queries; | ||
for (var i = 0; i < queries.length; i++) { | ||
var q = queries[i]; | ||
q.media = window.matchMedia(q.query); | ||
q.media.addListener(oConfig.listener); | ||
} | ||
} | ||
else { | ||
window.addEventListener('resize', oConfig.listener, false); | ||
window.addEventListener('orientationchange', oConfig.listener, false); | ||
} | ||
oConfig.listener(); | ||
}; | ||
Media.prototype.getCurrentRange = function (sName, iWidth) { | ||
if (!this.hasRangeSet(sName)) { | ||
return null; | ||
} | ||
return this.checkQueries(sName, true, isNaN(iWidth) ? null : function (from, to, unit) { return matchLegacyBySize(from, to, unit, [iWidth, 0]); }); | ||
}; | ||
Media.prototype.hasRangeSet = function (sName) { | ||
return sName && !!querysets[sName]; | ||
}; | ||
Media.prototype.removeRangeSet = function (sName) { | ||
if (!this.hasRangeSet(sName)) { | ||
Logger.info("RangeSet " + sName + " not found, thus could not be removed.", 'DEVICE.MEDIA'); | ||
return; | ||
} | ||
for (var x in RANGESETS) { | ||
if (sName === RANGESETS[x]) { | ||
Logger.warning('Cannot remove default rangeset - no action taken.', 'DEVICE.MEDIA'); | ||
return; | ||
} | ||
} | ||
var oConfig = querysets[sName]; | ||
if (support$1.matchmedialistener) { | ||
var queries = oConfig.queries; | ||
for (var i = 0; i < queries.length; i++) { | ||
queries[i].media.removeListener(oConfig.listener); | ||
} | ||
} | ||
else { | ||
window.removeEventListener('resize', oConfig.listener, false); | ||
window.removeEventListener('orientationchange', oConfig.listener, false); | ||
} | ||
refreshCSSClasses(sName, '', true); | ||
delete EventRegistry.mEventRegistry["media_" + sName]; | ||
delete querysets[sName]; | ||
}; | ||
Media.predefinedRangeSets = (_a = {}, | ||
_a[RANGESETS.SAP_3STEPS] = { | ||
points: [520, 960], | ||
unit: 'px', | ||
name: RANGESETS.SAP_3STEPS, | ||
names: ['S', 'M', 'L'] | ||
}, | ||
_a[RANGESETS.SAP_4STEPS] = { | ||
points: [520, 760, 960], | ||
unit: 'px', | ||
name: RANGESETS.SAP_4STEPS, | ||
names: ['S', 'M', 'L', 'XL'] | ||
}, | ||
_a[RANGESETS.SAP_6STEPS] = { | ||
points: [241, 400, 541, 768, 960], | ||
unit: 'px', | ||
name: RANGESETS.SAP_6STEPS, | ||
names: ['XS', 'S', 'M', 'L', 'XL', 'XXL'] | ||
}, | ||
_a[RANGESETS.SAP_STANDARD] = { | ||
points: [600, 1024], | ||
unit: 'px', | ||
name: RANGESETS.SAP_STANDARD, | ||
names: ['Phone', 'Tablet', 'Desktop'] | ||
}, | ||
_a[RANGESETS.SAP_STANDARD_EXTENDED] = { | ||
points: [600, 1024, 1440], | ||
unit: 'px', | ||
name: RANGESETS.SAP_STANDARD_EXTENDED, | ||
names: ['Phone', 'Tablet', 'Desktop', 'LargeDesktop'] | ||
}, | ||
_a); | ||
return Media; | ||
}()); | ||
var Orientation = (function () { | ||
function Orientation() { | ||
} | ||
Orientation.prototype.attachHandler = function (fnFunction, oListener) { | ||
EventRegistry.attachEvent('orientation', fnFunction, oListener); | ||
}; | ||
Orientation.prototype.detachHandler = function (fnFunction, oListener) { | ||
EventRegistry.detachEvent('orientation', fnFunction, oListener); | ||
}; | ||
return Orientation; | ||
}()); | ||
var Resize = (function () { | ||
function Resize() { | ||
this.setResizeInfo(); | ||
} | ||
Resize.prototype.attachHandler = function (fnFunction, oListener) { | ||
EventRegistry.attachEvent('resize', fnFunction, oListener); | ||
}; | ||
Resize.prototype.detachHandler = function (fnFunction, oListener) { | ||
EventRegistry.detachEvent('resize', fnFunction, oListener); | ||
}; | ||
Resize.prototype.setResizeInfo = function () { | ||
this.width = windowSize()[0]; | ||
this.height = windowSize()[1]; | ||
}; | ||
return Resize; | ||
}()); | ||
var iResizeTimeout; | ||
var bOrientationChange = false; | ||
var bResize = false; | ||
var iOrientationTimeout; | ||
var iClearFlagTimeout; | ||
var iWindowHeightOld = windowSize()[1]; | ||
var iWindowWidthOld = windowSize()[0]; | ||
var bKeyboardOpen = false; | ||
var iLastResizeTime; | ||
var rInputTagRegex = /INPUT|TEXTAREA|SELECT/; | ||
var bSkipFirstResize; | ||
var DeviceBuilder = (function () { | ||
function DeviceBuilder() { | ||
var _this = this; | ||
this.os = new OS(); | ||
this.browser = new Browser(); | ||
this.support = new Support(this.browser); | ||
this.system = new System(this.os, this.browser, this.support); | ||
this.media = new Media(this.support); | ||
this.orientation = new Orientation(); | ||
this.resize = new Resize(); | ||
this.handleResizeEvent = function () { | ||
var wasL = _this.orientation.landscape; | ||
var isL = _this.isLandscape(false); | ||
if (wasL !== isL) { | ||
_this.handleOrientationChange(); | ||
} | ||
if (!iResizeTimeout) { | ||
iResizeTimeout = window.setTimeout(_this.handleResizeTimeout, 150); | ||
} | ||
}; | ||
this.handleResizeTimeout = function () { | ||
_this.handleResizeChange(); | ||
iResizeTimeout = null; | ||
}; | ||
this.handleResizeChange = function () { | ||
_this.resize.setResizeInfo(); | ||
EventRegistry.fireEvent('resize', { | ||
height: _this.resize.height, | ||
width: _this.resize.width | ||
}); | ||
}; | ||
this.setOrientationInfo = function () { | ||
_this.orientation.landscape = _this.isLandscape(true); | ||
_this.orientation.portrait = !_this.orientation.landscape; | ||
}; | ||
this.handleOrientationChange = function () { | ||
_this.setOrientationInfo(); | ||
EventRegistry.fireEvent('orientation', { landscape: _this.orientation.landscape }); | ||
}; | ||
this.isLandscape = function (bFromOrientationChange) { | ||
if (_this.support.touch && _this.support.orientation && _this.os.android) { | ||
if (bKeyboardOpen && bFromOrientationChange) { | ||
return !_this.orientation.landscape; | ||
} | ||
if (bKeyboardOpen) { | ||
return _this.orientation.landscape; | ||
} | ||
} | ||
else if (_this.support.matchmedia && _this.support.orientation) { | ||
return !!window.matchMedia('(orientation: landscape)').matches; | ||
} | ||
var size = windowSize(); | ||
return size[0] > size[1]; | ||
}; | ||
this.handleMobileOrientationResizeChange = function (evt) { | ||
if (evt.type === 'resize') { | ||
if (bSkipFirstResize && rInputTagRegex.test(document.activeElement.tagName) && !bOrientationChange) { | ||
return; | ||
} | ||
var iWindowHeightNew = windowSize()[1]; | ||
var iWindowWidthNew = windowSize()[0]; | ||
var iTime = new Date().getTime(); | ||
if (iWindowHeightNew === iWindowHeightOld && iWindowWidthNew === iWindowWidthOld) { | ||
return; | ||
} | ||
bResize = true; | ||
if (iWindowHeightOld !== iWindowHeightNew && iWindowWidthOld === iWindowWidthNew) { | ||
if (!iLastResizeTime || iTime - iLastResizeTime > 300) { | ||
bKeyboardOpen = iWindowHeightNew < iWindowHeightOld; | ||
} | ||
_this.handleResizeChange(); | ||
} | ||
else { | ||
iWindowWidthOld = iWindowWidthNew; | ||
} | ||
iLastResizeTime = iTime; | ||
iWindowHeightOld = iWindowHeightNew; | ||
if (iClearFlagTimeout) { | ||
window.clearTimeout(iClearFlagTimeout); | ||
iClearFlagTimeout = null; | ||
} | ||
iClearFlagTimeout = window.setTimeout(DeviceBuilder.clearFlags, 1200); | ||
} | ||
else if (evt.type === 'orientationchange') { | ||
bOrientationChange = true; | ||
} | ||
if (iOrientationTimeout) { | ||
clearTimeout(iOrientationTimeout); | ||
iOrientationTimeout = null; | ||
} | ||
iOrientationTimeout = window.setTimeout(_this.handleMobileTimeout, 50); | ||
}; | ||
this.handleMobileTimeout = function () { | ||
if (bResize && (bOrientationChange || (_this.system.tablet && _this.os.ios && _this.os.version >= 9))) { | ||
_this.handleOrientationChange(); | ||
_this.handleResizeChange(); | ||
bOrientationChange = false; | ||
bResize = false; | ||
if (iClearFlagTimeout) { | ||
window.clearTimeout(iClearFlagTimeout); | ||
iClearFlagTimeout = null; | ||
} | ||
} | ||
iOrientationTimeout = null; | ||
}; | ||
bSkipFirstResize = | ||
this.os.ios && | ||
this.browser.name === 'sf' && | ||
((this.system.phone && this.os.version >= 7 && this.os.version < 7.1) || | ||
(this.system.tablet && this.os.version >= 7)); | ||
if (this.support.touch && this.support.orientation) { | ||
window.addEventListener('resize', this.handleMobileOrientationResizeChange, false); | ||
window.addEventListener('orientationchange', this.handleMobileOrientationResizeChange, false); | ||
} | ||
else { | ||
window.addEventListener('resize', this.handleResizeEvent, false); | ||
} | ||
this.setOrientationInfo(); | ||
} | ||
DeviceBuilder.clearFlags = function () { | ||
bOrientationChange = false; | ||
bResize = false; | ||
iClearFlagTimeout = null; | ||
}; | ||
return DeviceBuilder; | ||
}()); | ||
var Device = new DeviceBuilder(); | ||
var getThemeClassFor = function (theme, themes) { | ||
@@ -275,2 +1405,3 @@ if ({}.hasOwnProperty.call(themes, theme)) { | ||
exports.Device = Device; | ||
exports.Event = Event; | ||
@@ -286,2 +1417,3 @@ exports.KeyCodes = KeyCodes$1; | ||
exports.getThemeOverwrite = getThemeOverwrite; | ||
exports.isNumeric = isNumeric; | ||
exports.pushElementBackInScreen = pushElementBackInScreen; |
@@ -1,11 +0,53 @@ | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:!0});var f=require("tslib"),g,k=g||(g={});k[k.ENTER=13]="ENTER";k[k.SPACE=32]="SPACE";k[k.PAGE_UP=33]="PAGE_UP";k[k.PAGE_DOWN=34]="PAGE_DOWN";k[k.ARROW_UP=38]="ARROW_UP";k[k.ARROW_DOWN=40]="ARROW_DOWN";var l=g;function m(a,b){return("000"+String(a)).slice(-b)}var n=exports.LOG_LEVEL||(exports.LOG_LEVEL={});n[n.FATAL=0]="FATAL";n[n.ERROR=1]="ERROR";n[n.WARNING=2]="WARNING";n[n.INFO=3]="INFO";n[n.DEBUG=4]="DEBUG";n[n.TRACE=5]="TRACE"; | ||
var p=new (function(){function a(b){void 0===b&&(b="DEVICE");this.sWindowName=window.top===window?"":"["+window.location.pathname.split("/").slice(-1)[0]+"] ";this.log(exports.LOG_LEVEL.INFO,"Device API logging initialized");this.defaultComponent=b;return this}a.prototype.for=function(b){return new a(b)};a.prototype.log=function(b,a,c){c=c||this.defaultComponent||"";var d=new Date;a={time:m(d.getHours(),2)+":"+m(d.getMinutes(),2)+":"+m(d.getSeconds(),2),date:m(d.getFullYear(),4)+"-"+m(d.getMonth()+ | ||
1,2)+"-"+m(d.getDate(),2),timestamp:d.getTime(),level:b,message:a||"",component:c||""};if(window.console)switch(c=a.date+" "+a.time+" "+this.sWindowName+a.message+" - "+a.component,b){case exports.LOG_LEVEL.FATAL:case exports.LOG_LEVEL.ERROR:console.error(c);break;case exports.LOG_LEVEL.WARNING:console.warn(c);break;case exports.LOG_LEVEL.INFO:console.info?console.info(c):console.log(c);break;case exports.LOG_LEVEL.DEBUG:console.debug?console.debug(c):console.log(c);break;case exports.LOG_LEVEL.TRACE:console.trace? | ||
console.trace(c):console.log(c)}return a};a.prototype.fatal=function(b,a){return this.log(exports.LOG_LEVEL.FATAL,b,a)};a.prototype.error=function(b,a){return this.log(exports.LOG_LEVEL.ERROR,b,a)};a.prototype.warning=function(b,a){return this.log(exports.LOG_LEVEL.WARNING,b,a)};a.prototype.info=function(b,a){return this.log(exports.LOG_LEVEL.INFO,b,a)};a.prototype.debug=function(a,d){return this.log(exports.LOG_LEVEL.DEBUG,a,d)};a.prototype.trace=function(a,d){return this.log(exports.LOG_LEVEL.TRACE, | ||
a,d)};return a}()),q=function(){function a(a,d){this.object=a;this.path=d}a.of=function(b,d){return new a(b,d)};a.prototype.get=function(){return this.path.split(".").reduce(function(a,d){return a[d]},this.object)};a.prototype.isPresent=function(){var a=this.object;return this.path.split(".").every(function(b){if("object"!==typeof a||null===a||void 0===a||!(b in a))return!1;a=a[b];return!0})};a.prototype.ifPresent=function(a){return this.isPresent()?a(this.get()):null};a.prototype.orElse=function(a){return this.isPresent()? | ||
this.get():a};a.prototype.orElseThrow=function(a){if(!this.isPresent())throw a;return this.get()};a.prototype.valueOf=function(){return this.get()};return a}(),r=function(a){function b(){for(var b=[],c=0;c<arguments.length;c++)b[c]=arguments[c];c=a.call(this)||this;c.classes=[];c.classes=b.slice();return c}f.__extends(b,a);b.prototype.put=function(){for(var a,b=[],e=0;e<arguments.length;e++)b[e]=arguments[e];(a=this.classes).push.apply(a,b);return this};b.prototype.valueOf=function(){return this.classes.join(" ")}; | ||
b.prototype.toString=function(){return this.valueOf()};b.of=function(){for(var a,c=[],e=0;e<arguments.length;e++)c[e]=arguments[e];return(a=new b).put.apply(a,c)};return b}(String),t,u=t||(t={});u.sap_belize="sap_belize";u.sap_belize_plus="sap_belize_plus";u.sap_belize_hcb="sap_belize_hcb"; | ||
var v=t,w=function(){function a(a,d,c){void 0===c&&(c={});this.source=a;this.originalEvent=d;this.parameters=c;this.htmlSource=d.target}a.of=function(b,d,c){void 0===c&&(c={});return new a(b,d,c)};a.prototype.getSource=function(){return this.source};a.prototype.getOriginalEvent=function(){return this.originalEvent};a.prototype.getParameters=function(){return this.parameters};a.prototype.getParameter=function(a){return this.parameters[a]};a.prototype.getHtmlSourceElement=function(){return this.htmlSource}; | ||
a.prototype.cancel=function(){this.originalEvent.stopPropagation()};a.prototype.preventDefault=function(){this.originalEvent.preventDefault()};return a}();exports.Event=w;exports.KeyCodes=l;exports.Logger=p;exports.Optional=q;exports.StyleClassHelper=r;exports.Themes=v;exports.createThemeMap=function(a,b,d){var c;void 0===d&&(d={});return c={},c[v.sap_belize]=a,c[v.sap_belize_plus]=b,c[v.sap_belize_hcb]=d,c}; | ||
exports.deprecationNotice=function(a,b){a="* fiori-for-react Deprecation Notice - "+a;var d="*".padStart(a.length,"*");console.warn(""+d+a+d+b)};exports.getThemeClassFor=function(a,b){if({}.hasOwnProperty.call(b,a))return b[a];throw Error("Could not match theme to Theme Class!");};exports.getThemeOverwrite=function(a,b){return Object.values(v).includes(b)?b:a}; | ||
exports.pushElementBackInScreen=function(a,b){void 0===b&&(b=5);if(a){var d=document.documentElement.clientHeight,c=document.documentElement.clientWidth,e=a.getBoundingClientRect();if(0>e.left){var h=-1*e.left+b;h=parseInt(a.style.left,10)+h;a.style.left=h+"px"}e.right>c&&(h=e.right-c,h=parseInt(a.style.left,10)-h-b,a.style.left=h+"px");0>e.top&&(h=-1*e.top+b,b=parseInt(a.style.top,10)+h,a.style.top=b+"px");e.bottom>d&&(h=e.bottom-d,b=parseInt(a.style.top,10)-h,a.style.top=b+"px")}}; | ||
'use strict';Object.defineProperty(exports,"__esModule",{value:!0}); | ||
var aa=require("tslib"),ba=function(){function b(a,c,d){void 0===d&&(d={});this.source=a;this.originalEvent=c;this.parameters=d;this.htmlSource=c.target}b.of=function(a,c,d){void 0===d&&(d={});return new b(a,c,d)};b.prototype.getSource=function(){return this.source};b.prototype.getOriginalEvent=function(){return this.originalEvent};b.prototype.getParameters=function(){return this.parameters};b.prototype.getParameter=function(a){return this.parameters[a]};b.prototype.getHtmlSourceElement=function(){return this.htmlSource}; | ||
b.prototype.cancel=function(){this.originalEvent.stopPropagation()};b.prototype.preventDefault=function(){this.originalEvent.preventDefault()};return b}(),l,p=l||(l={});p[p.ENTER=13]="ENTER";p[p.SPACE=32]="SPACE";p[p.PAGE_UP=33]="PAGE_UP";p[p.PAGE_DOWN=34]="PAGE_DOWN";p[p.ARROW_UP=38]="ARROW_UP";p[p.ARROW_DOWN=40]="ARROW_DOWN";var da=l;function q(b,a){return("000"+String(b)).slice(-a)}var r=exports.LOG_LEVEL||(exports.LOG_LEVEL={});r[r.FATAL=0]="FATAL";r[r.ERROR=1]="ERROR";r[r.WARNING=2]="WARNING"; | ||
r[r.INFO=3]="INFO";r[r.DEBUG=4]="DEBUG";r[r.TRACE=5]="TRACE"; | ||
var t=new (function(){function b(a){void 0===a&&(a="DEVICE");this.sWindowName=window.top===window?"":"["+window.location.pathname.split("/").slice(-1)[0]+"] ";this.log(exports.LOG_LEVEL.INFO,"Device API logging initialized");this.defaultComponent=a;return this}b.prototype.for=function(a){return new b(a)};b.prototype.log=function(a,c,d){d=d||this.defaultComponent||"";var b=new Date;c={time:q(b.getHours(),2)+":"+q(b.getMinutes(),2)+":"+q(b.getSeconds(),2),date:q(b.getFullYear(),4)+"-"+q(b.getMonth()+ | ||
1,2)+"-"+q(b.getDate(),2),timestamp:b.getTime(),level:a,message:c||"",component:d||""};if(window.console)switch(d=c.date+" "+c.time+" "+this.sWindowName+c.message+" - "+c.component,a){case exports.LOG_LEVEL.FATAL:case exports.LOG_LEVEL.ERROR:console.error(d);break;case exports.LOG_LEVEL.WARNING:console.warn(d);break;case exports.LOG_LEVEL.INFO:console.info?console.info(d):console.log(d);break;case exports.LOG_LEVEL.DEBUG:console.debug?console.debug(d):console.log(d);break;case exports.LOG_LEVEL.TRACE:console.trace? | ||
console.trace(d):console.log(d)}return c};b.prototype.fatal=function(a,c){return this.log(exports.LOG_LEVEL.FATAL,a,c)};b.prototype.error=function(a,c){return this.log(exports.LOG_LEVEL.ERROR,a,c)};b.prototype.warning=function(a,c){return this.log(exports.LOG_LEVEL.WARNING,a,c)};b.prototype.info=function(a,c){return this.log(exports.LOG_LEVEL.INFO,a,c)};b.prototype.debug=function(a,c){return this.log(exports.LOG_LEVEL.DEBUG,a,c)};b.prototype.trace=function(a,c){return this.log(exports.LOG_LEVEL.TRACE, | ||
a,c)};return b}()),ea=function(){function b(a,c){this.object=a;this.path=c}b.of=function(a,c){return new b(a,c)};b.prototype.get=function(){return this.path.split(".").reduce(function(a,c){return a[c]},this.object)};b.prototype.isPresent=function(){var a=this.object;return this.path.split(".").every(function(c){if("object"!==typeof a||null===a||void 0===a||!(c in a))return!1;a=a[c];return!0})};b.prototype.ifPresent=function(a){return this.isPresent()?a(this.get()):null};b.prototype.orElse=function(a){return this.isPresent()? | ||
this.get():a};b.prototype.orElseThrow=function(a){if(!this.isPresent())throw a;return this.get()};b.prototype.valueOf=function(){return this.get()};return b}(),fa=function(b){function a(){for(var a=[],d=0;d<arguments.length;d++)a[d]=arguments[d];d=b.call(this)||this;d.classes=[];d.classes=a.slice();return d}aa.__extends(a,b);a.prototype.put=function(){for(var a,b=[],e=0;e<arguments.length;e++)b[e]=arguments[e];(a=this.classes).push.apply(a,b);return this};a.prototype.valueOf=function(){return this.classes.join(" ")}; | ||
a.prototype.toString=function(){return this.valueOf()};a.of=function(){for(var c,b=[],e=0;e<arguments.length;e++)b[e]=arguments[e];return(c=new a).put.apply(c,b)};return a}(String),ha,ia=ha||(ha={});ia.sap_belize="sap_belize";ia.sap_belize_plus="sap_belize_plus";ia.sap_belize_hcb="sap_belize_hcb";var u=ha; | ||
!function(b,a,c){function d(a){var d,e=Q.length,f=b.CSSRule;if("undefined"==typeof f)return c;if(!a)return!1;if(a=a.replace(/^@/,""),d=a.replace(/-/g,"_").toUpperCase()+"_RULE",d in f)return"@"+a;for(var k=0;e>k;k++){var ka=Q[k];if(ka.toUpperCase()+"_"+d in f)return"@-"+ka.toLowerCase()+"-"+a}return!1}function e(){}function f(){return"function"!=typeof a.createElement?a.createElement(arguments[0]):la?a.createElementNS.call(a,"http://www.w3.org/2000/svg",arguments[0]):a.createElement.apply(a,arguments)} | ||
function h(c,b,d,e){var k,m,n,y=f("div");var g=a.body;var h=(g||(g=f(la?"svg":"body"),g.fake=!0),g);if(parseInt(d,10))for(;d--;)g=f("div"),g.id=e?e[d]:"modernizr"+(d+1),y.appendChild(g);return k=f("style"),k.type="text/css",k.id="smodernizr",(h.fake?h:y).appendChild(k),h.appendChild(y),k.styleSheet?k.styleSheet.cssText=c:k.appendChild(a.createTextNode(c)),y.id="modernizr",h.fake&&(h.style.background="",h.style.overflow="hidden",n=H.style.overflow,H.style.overflow="hidden",H.appendChild(h)),m=b(y, | ||
c),h.fake?(h.parentNode.removeChild(h),H.style.overflow=n,H.offsetHeight):y.parentNode.removeChild(y),!!m}function z(a){return a.replace(/([A-Z])/g,function(a,c){return"-"+c.toLowerCase()}).replace(/^ms-/,"-ms-")}function B(a,d){var e=a.length;if("CSS"in b&&"supports"in b.CSS){for(;e--;)if(b.CSS.supports(z(a[e]),d))return!0;return!1}if("CSSSupportsRule"in b){for(var f=[];e--;)f.push("("+z(a[e])+":"+d+")");return f=f.join(" or "),h("@supports ("+f+") { #modernizr { position: absolute; } }",function(a){if("getComputedStyle"in | ||
b){a=getComputedStyle.call(b,a,null);var c=b.console;null!==a?a=a.getPropertyValue("position"):c&&c[c.error?"error":"log"].call(c,"getComputedStyle returning null, its possible modernizr test results are inaccurate")}else a=a.currentStyle&&a.currentStyle.position;return"absolute"==a})}return c}function R(a){return a.replace(/([a-z])-([a-z])/g,function(a,c,b){return c+b.toUpperCase()}).replace(/^-/,"")}function ya(a,b,d,e){function k(){h&&(delete w.style,delete w.modElem)}if(e="undefined"===typeof e? | ||
!1:e,"undefined"!==typeof d){var m=B(a,d);if("undefined"!==typeof m)return m}var n,g;for(m=["modernizr","tspan","samp"];!w.style&&m.length;){var h=!0;w.modElem=f(m.shift());w.style=w.modElem.style}var y=a.length;for(m=0;y>m;m++)if(n=a[m],g=w.style[n],!!~(""+n).indexOf("-")&&(n=R(n)),w.style[n]!==c){if(e||"undefined"===typeof d)return k(),"pfx"==b?n:!0;try{w.style[n]=d}catch(Na){}if(w.style[n]!=g)return k(),"pfx"==b?n:!0}return k(),!1}function za(a,c){return function(){return a.apply(c,arguments)}} | ||
function ca(a,c,b,d,e){var f=a.charAt(0).toUpperCase()+a.slice(1),k=(a+" "+ma.join(f+" ")+f).split(" ");if("string"===typeof c||"undefined"===typeof c)var m=ya(k,c,d,e);else{k=(a+" "+S.join(f+" ")+f).split(" ");a:{a=k;for(var n in a)if(a[n]in c){c=!1===b?a[n]:(m=c[a[n]],"function"===typeof m?za(m,b||c):m);break a}c=!1}m=c}return m}var M=[],g={_version:"3.6.0",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(a,c){var b=this;setTimeout(function(){c(b[a])}, | ||
0)},addTest:function(a,c,b){M.push({name:a,fn:c,options:b})},addAsyncTest:function(a){M.push({name:null,fn:a})}};e.prototype=g;e=new e;var Aa=[],S=g._config.usePrefixes?["moz","o","ms","webkit"]:[];g._domPrefixes=S;var H=a.documentElement,la="svg"===H.nodeName.toLowerCase(),na=function(){var b=!("onblur"in a.documentElement);return function(a,d){var e;return a?(d&&"string"!=typeof d||(d=f(d||"div")),a="on"+a,e=a in d,!e&&b&&(d.setAttribute||(d=f("div")),d.setAttribute(a,""),e="function"==typeof d[a], | ||
d[a]!==c&&(d[a]=c),d.removeAttribute(a)),e):!1}}();g.hasEvent=na;e.addTest("pointerevents",function(){var a,c=S.length;for(a=e.hasEvent("pointerdown");c--&&!a;)na(S[c]+"pointerdown")&&(a=!0);return a});var Q=g._config.usePrefixes?" -webkit- -moz- -o- -ms- ".split(" "):["",""];g._prefixes=Q;var Ba=g.testStyles=h;e.addTest("touchevents",function(){if("ontouchstart"in b||b.DocumentTouch&&a instanceof DocumentTouch)var c=!0;else{var d=["@media (",Q.join("touch-enabled),("),"heartz){#modernizr{top:9px;position:absolute}}"].join(""); | ||
Ba(d,function(a){c=9===a.offsetTop})}return c});var T=!1;try{T="WebSocket"in b&&2===b.WebSocket.CLOSING}catch(k){}e.addTest("websockets",T);e.addTest("devicemotion","DeviceMotionEvent"in b);e.addTest("deviceorientation","DeviceOrientationEvent"in b);e.addTest("placeholder","placeholder"in f("input")&&"placeholder"in f("textarea"));var ma=g._config.usePrefixes?["Moz","O","ms","Webkit"]:[];g._cssomPrefixes=ma;var oa={elem:f("modernizr")};e._q.push(function(){delete oa.elem});var w={style:oa.elem.style}; | ||
e._q.unshift(function(){delete w.style});g.testAllProps=ca;g.atRule=d;T=g.prefixed=function(a,c,b){return 0===a.indexOf("@")?d(a):(-1!=a.indexOf("-")&&(a=R(a)),c?ca(a,c,b):ca(a,"pfx"))};e.addTest("matchmedia",!!T("matchMedia",b));(function(){var a,c,d,b,f;for(f in M)if(M.hasOwnProperty(f)){if(a=[],c=M[f],c.name&&(a.push(c.name.toLowerCase()),c.options&&c.options.aliases&&c.options.aliases.length))for(d=0;d<c.options.aliases.length;d++)a.push(c.options.aliases[d].toLowerCase());d="function"===typeof c.fn? | ||
c.fn():c.fn;for(b=0;b<a.length;b++){var g=a[b];g=g.split(".");1===g.length?e[g[0]]=d:(!e[g[0]]||e[g[0]]instanceof Boolean||(e[g[0]]=new Boolean(e[g[0]])),e[g[0]][g[1]]=d);Aa.push((d?"":"no-")+g.join("-"))}}})();delete g.addTest;delete g.addAsyncTest;for(g=0;g<e._q.length;g++)e._q[g]();b.Modernizr=e}(window,document); | ||
function ja(b){this.input={placeholder:!1};this.touch=Modernizr.touchevents;this.pointer=Modernizr.pointerevents;this.matchmedia=Modernizr.matchmedia;var a=!(!this.matchmedia||!window.matchMedia("all and (max-width:0px)"));b.safari&&6>b.version&&!b.fullscreen&&!b.webview&&(a=!1);this.matchmedialistener=a;this.orientation=Modernizr.deviceorientation;this.retina=window.retina||2<=window.devicePixelRatio;this.websocket=Modernizr.websockets;this.input.placeholder=Modernizr.placeholder;return this} | ||
var v,x=v||(v={});x.WINDOWS="win";x.MACINTOSH="mac";x.LINUX="linux";x.IOS="iOS";x.ANDROID="Android";x.BLACKBERRY="bb";x.WINDOWS_PHONE="winphone"; | ||
var pa=function(){function b(a){var c=this;this.OS=v;this.getDesktopOS=function(a){a=a||navigator.userAgent;var b=navigator.platform;if(-1!=b.indexOf("Win"))return a=a.match(/Windows NT (\d+).(\d)/i),b="","6"==a[1]?1==a[2]?b="7":1<a[2]&&(b="8"):b=a[1],c.name=v.WINDOWS,c.versionStr=b,c;if(-1!=b.indexOf("Mac"))return c.name=v.MACINTOSH,c.versionStr="",c;if(-1!=b.indexOf("Linux"))return c.name=v.LINUX,c.versionStr="",c;t.info("OS detection returned no result");return null};this.setOS(a)}b.prototype.setOS= | ||
function(a){this.getOS(a);this.version=this.versionStr?parseFloat(this.versionStr):-1;if(this.name)for(var c in v)v[c]===this.name&&(this[c.toLowerCase()]=!0)};b.prototype.getOS=function(a){var c=a||navigator.userAgent;var b=/Windows Phone (?:OS )?([\d.]*)/;if(b=c.match(b))return this.name=v.WINDOWS_PHONE,this.versionStr=b[1],this;if(0<c.indexOf("(BB10;")){b=/\sVersion\/([\d.]+)\s/;if(b=c.match(b))return this.name=v.BLACKBERRY,this.versionStr=b[1],this;this.name=v.BLACKBERRY;this.versionStr="10"; | ||
return this}b=/\(([a-zA-Z ]+);\s(?:[U]?[;]?)([\D]+)((?:[\d._]*))(?:.*[\)][^\d]*)([\d.]*)\s/;if(b=c.match(b)){if(b[0].match(/iPhone|iPad|iPod/))return b[3]=b[3].replace(/_/g,"."),this.name=v.IOS,this.versionStr=b[3],this;if(b[2].match(/Android/))return b[2]=b[2].replace(/\s/g,""),this.name=v.ANDROID,this.versionStr=b[3],this;if(b[0].match(/PlayBook|BlackBerry/))return this.name=v.BLACKBERRY,this.versionStr=b[4],this}b=/\((Android)[\s]?([\d][.\d]*)?;.*Firefox\/[\d][.\d]*/;return(b=c.match(b))?(this.name= | ||
v.ANDROID,this.versionStr=3==b.length?b[2]:"",this):this.getDesktopOS(a)};return b}(),A,C=A||(A={});C.INTERNET_EXPLORER="ie";C.EDGE="ed";C.FIREFOX="ff";C.CHROME="cr";C.SAFARI="sf";C.ANDROID="an"; | ||
var qa=function(){function b(){this.BROWSER=A;this.setBrowser()}b.calcBrowser=function(a){var c=navigator.userAgent;a=(a||c).toLowerCase();c=/(webkit)[ \/]([\w.]+)/;var b=/(opera)(?:.*version)?[ \/]([\w.]+)/,e=/(msie) ([\w.]+)/,f=/(trident)\/[\w.]+;.*rv:([\w.]+)/,h=/(mozilla)(?:.*? rv:([\w.]+))?/;a=/(edge)[ \/]([\w.]+)/.exec(a)||f.exec(a)||c.exec(a)||b.exec(a)||e.exec(a)||0>a.indexOf("compatible")&&h.exec(a)||[];a={browser:a[1]||"",version:a[2]||"0"};a[a.browser]=!0;return a};b.prototype.getBrowser= | ||
function(a,c){var d=navigator.userAgent,e=b.calcBrowser(a);d=a||d;var f=c||window.navigator;if(e.mozilla){c=/Mobile/;if(d.match(/Firefox\/(\d+\.\d+)/))return f=parseFloat(RegExp.$1),this.name=A.FIREFOX,this.versionStr=""+f,this.version=f,this.mozilla=!0,this.mobile=c.test(d),this;this.mobile=c.test(d);this.mozilla=!0;this.version=-1}if(e.webkit){c=d.toLowerCase().match(/webkit[\/]([\d.]+)/);a=void 0;c&&(a=c[1]);c=/Mobile/;if(d.match(/(Chrome|CriOS)\/(\d+\.\d+).\d+/))return f=parseFloat(RegExp.$2), | ||
this.name=A.CHROME,this.versionStr=""+f,this.version=f,this.mobile=c.test(d),this.webkit=!0,this.webkitVersion=a,this;if(d.match(/FxiOS\/(\d+\.\d+)/))return f=parseFloat(RegExp.$1),this.name=A.FIREFOX,this.versionStr=""+f,this.version=f,this.webkit=this.mobile=!0,this.webkitVersion=a,this;if(d.match(/Android .+ Version\/(\d+\.\d+)/))return f=parseFloat(RegExp.$1),this.name=A.ANDROID,this.versionStr=""+f,this.version=f,this.mobile=c.test(d),this.webkit=!0,this.webkitVersion=a,this;e=/(Version|PhantomJS)\/(\d+\.\d+).*Safari/; | ||
f=f.standalone;if(e.test(d))return e=e.exec(d),f=parseFloat(e[2]),this.name=A.SAFARI,this.versionStr=""+f,this.webview=this.fullscreen=!1,this.version=f,this.mobile=c.test(d),this.webkit=!0,this.webkitVersion=a,this.phantomJS="PhantomJS"===e[1],this;if(/iPhone|iPad|iPod/.test(d)&&!/CriOS/.test(d)&&!/FxiOS/.test(d)&&(!0===f||!1===f))return this.name=A.SAFARI,this.version=-1,this.webview=this.fullscreen=f,this.mobile=c.test(d),this.webkit=!0,this.webkitVersion=a,this;this.mobile=c.test(d);this.webkit= | ||
!0;this.webkitVersion=a;this.version=-1;return this}if(e.msie||e.trident)return f=document.documentMode&&!a?7===document.documentMode?8:parseFloat(document.documentMode):parseFloat(e.version),this.name=A.INTERNET_EXPLORER,this.versionStr=""+f,this.version=f,this.msie=!0,this.mobile=!1,this;if(e.edge)return f=parseFloat(e.version),this.name=A.EDGE,this.versionStr=""+f,this.version=f,this.edge=!0,this;this.versionStr=this.name="";this.version=-1;this.mobile=!1;return this};b.prototype.setBrowser=function(){this.getBrowser(); | ||
if(this.name)for(var a in A)A[a]===this.name&&(this[a.toLowerCase()]=!0)};return b}();function D(){return[window.innerWidth,window.innerHeight]}function ra(b,a,c){var d=document.documentElement;if(0===d.className.length)a||(d.className=b);else{var e="";d.className.split(" ").forEach(function(a){if(c&&0!==a.indexOf(c)||!c&&a!==b)e=e+a+" "});a||(e+=b);d.className=e}}function sa(b,a,c){c=c||"px";var d="all";0<b&&(d=d+" and (min-width:"+b+c+")");0<a&&(d=d+" and (max-width:"+a+c+")");return d} | ||
function ta(b,a){return"em"===a||"rem"===a?(a=(a=(window.getComputedStyle||function(a){return a.currentStyle})(document.documentElement).fontSize)&&0<=a.indexOf("px")?parseFloat(a,10):16,b*a):b}function ua(b,a,c,d){b=ta(b,c);a=ta(a,c);c=d[0];return(0>b||b<=c)&&(0>a||c<=a)}var E,F=E||(E={});F.TABLET="tablet";F.PHONE="phone";F.DESKTOP="desktop";F.COMBI="combi"; | ||
var G,I,J,va=function(){function b(a,c,b){this.SYSTEMTYPE=E;G=a;I=c;J=b;this.setSystem();return this}b.prototype.getSystem=function(a){var c=this;a=this.isTablet(a);var b=G.windows&&8<=G.version,e=G.windows&&7===G.version;this.tablet=!(!(J.touch&&!e||b)||!a);this.phone=!(!G.windows_phone&&(!J.touch||e||a));this.desktop=!((this.tablet||this.phone)&&!b&&!e);this.combi=!(!this.desktop||!this.tablet);Object.values(E).forEach(function(a){ra("sap-"+a,!c[a])})};b.prototype.isTablet=function(a){a=a||navigator.userAgent; | ||
var c=G.windows&&8<=G.version;if(G.name===G.OS.IOS)return/ipad/i.test(a);if(J.touch){if(c)return!0;if(I.chrome&&G.android&&4.4<=G.version)return!/Mobile Safari\/[.0-9]+/.test(a);c=window.devicePixelRatio?window.devicePixelRatio:1;G.android&&I.webkit&&537.1<parseFloat(I.webkitVersion)&&(c=1);c=600<=Math.min(window.screen.width/c,window.screen.height/c);552!==window.screen.height&&553!==window.screen.height||!/Nexus 7/i.test(a)||(c=!0);return c}c=/(?=android)(?=.*mobile)/i.test(a);return I.msie&&-1!== | ||
a.indexOf("Touch")||G.android&&!c};b.prototype.setSystem=function(a){this.getSystem(a);if(this.tablet||this.phone)I.mobile=!0};return b}(),K=function(){function b(){}b.attachEvent=function(a,c,d){b.mEventRegistry[a]||(b.mEventRegistry[a]=[]);b.mEventRegistry[a].push({oListener:d,fFunction:c})};b.detachEvent=function(a,c,d){var e=b.mEventRegistry[a];if(e){for(var f=0,h=e.length;f<h;f++)if(e[f].fFunction===c&&e[f].oListener===d){e.splice(f,1);break}0===e.length&&delete b.mEventRegistry[a]}};b.fireEvent= | ||
function(a,c){a=b.mEventRegistry[a];if(a){a=a.slice();for(var d=0,e=a.length;d<e;d++){var f=a[d];f.fFunction.call(f.oListener||window,c)}}};b.mEventRegistry={};return b}(),L,N,O=N||(N={});O.SAP_3STEPS="3Step";O.SAP_4STEPS="4Step";O.SAP_6STEPS="6Step";O.SAP_STANDARD="Std";O.SAP_STANDARD_EXTENDED="StdExt";var P,wa=N.SAP_STANDARD,U={};function xa(b,a,c){return ua(b,a,c,D())}function Ca(b,a,c){b=sa(b,a,c);return(b=window.matchMedia(b))&&b.matches} | ||
var Da=function(){function b(a){this.RANGESETS=N;P=a;this.media_timeout=P.matchmedialistener?0:100;this.matches=P.matchmedia?Ca:xa;this.initRangeSet();this.initRangeSet(N.SAP_STANDARD_EXTENDED)}b.getRangeInfo=function(a,c){var b=U[a].queries[c],e={from:b.from,unit:U[a].unit};0<=b.to&&(e.to=b.to);U[a].names&&(e.name=U[a].names[c]);return e};b.prototype.checkQueries=function(a,c,d){d=d||this.matches;if(U[a]){for(var e=U[a].queries,f=null,h=0,z=e.length;h<z;h++){var B=e[h];(B!==U[a].currentquery||c)&& | ||
d(B.from,B.to,U[a].unit)&&(c||(U[a].currentquery=B),U[a].noClasses||!U[a].names||c||(f="sapUiMedia-"+a+"-",ra(f+U[a].names[h],void 0,f)),f=b.getRangeInfo(a,h))}return f}t.warning("No queryset with name "+a+" found","DEVICE.MEDIA");return null};b.prototype.handleChange=function(a){var c=this;if(P.matchmedialistener||null!==D()[0])U[a].timer&&(clearTimeout(U[a].timer),U[a].timer=null),U[a].timer=setTimeout(function(){var b=c.checkQueries(a,!1);b&&K.fireEvent("media_"+a,b)},this.media_timeout)};b.prototype.attachHandler= | ||
function(a,c,b){K.attachEvent("media_"+(b||wa),a,c)};b.prototype.detachHandler=function(a,c,b){K.detachEvent("media_"+(b||wa),a,c)};b.prototype.initRangeSet=function(a,c,d,e,f){var h=this;c=a?a&&b.predefinedRangeSets[a]?b.predefinedRangeSets[a]:{name:a,unit:(d||"px").toLowerCase(),points:c||[],names:e,noClasses:!!f}:b.predefinedRangeSets[wa];if(this.hasRangeSet(c.name))t.info("Range set "+c.name+" has already been initialized","DEVICE.MEDIA");else{a=c.name;c.queries=[];c.timer=null;c.currentquery= | ||
null;c.listener=function(){return h.handleChange(a)};var z=c.points;d=0;for(var B=z.length;d<=B;d++){e=0===d?0:z[d-1];f=d===z.length?-1:z[d];var R=sa(e,f,c.unit);c.queries.push({query:R,from:e,to:f})}c.names&&c.names.length!==c.queries.length&&(c.names=null);U[c.name]=c;if(P.matchmedialistener)for(e=c.queries,d=0;d<e.length;d++)f=e[d],f.media=window.matchMedia(f.query),f.media.addListener(c.listener);else window.addEventListener("resize",c.listener,!1),window.addEventListener("orientationchange", | ||
c.listener,!1);c.listener()}};b.prototype.getCurrentRange=function(a,b){return this.hasRangeSet(a)?this.checkQueries(a,!0,isNaN(b)?null:function(a,c,f){return ua(a,c,f,[b,0])}):null};b.prototype.hasRangeSet=function(a){return a&&!!U[a]};b.prototype.removeRangeSet=function(a){if(this.hasRangeSet(a)){for(var b in N)if(a===N[b]){t.warning("Cannot remove default rangeset - no action taken.","DEVICE.MEDIA");return}b=U[a];if(P.matchmedialistener)for(var d=b.queries,e=0;e<d.length;e++)d[e].media.removeListener(b.listener); | ||
else window.removeEventListener("resize",b.listener,!1),window.removeEventListener("orientationchange",b.listener,!1);b="sapUiMedia-"+a+"-";ra(b+"",!0,b);delete K.mEventRegistry["media_"+a];delete U[a]}else t.info("RangeSet "+a+" not found, thus could not be removed.","DEVICE.MEDIA")};b.predefinedRangeSets=(L={},L[N.SAP_3STEPS]={points:[520,960],unit:"px",name:N.SAP_3STEPS,names:["S","M","L"]},L[N.SAP_4STEPS]={points:[520,760,960],unit:"px",name:N.SAP_4STEPS,names:["S","M","L","XL"]},L[N.SAP_6STEPS]= | ||
{points:[241,400,541,768,960],unit:"px",name:N.SAP_6STEPS,names:"XS S M L XL XXL".split(" ")},L[N.SAP_STANDARD]={points:[600,1024],unit:"px",name:N.SAP_STANDARD,names:["Phone","Tablet","Desktop"]},L[N.SAP_STANDARD_EXTENDED]={points:[600,1024,1440],unit:"px",name:N.SAP_STANDARD_EXTENDED,names:["Phone","Tablet","Desktop","LargeDesktop"]},L);return b}(),Ea=function(){function b(){}b.prototype.attachHandler=function(a,b){K.attachEvent("orientation",a,b)};b.prototype.detachHandler=function(a,b){K.detachEvent("orientation", | ||
a,b)};return b}(),Fa=function(){function b(){this.setResizeInfo()}b.prototype.attachHandler=function(a,b){K.attachEvent("resize",a,b)};b.prototype.detachHandler=function(a,b){K.detachEvent("resize",a,b)};b.prototype.setResizeInfo=function(){this.width=D()[0];this.height=D()[1]};return b}(),Ga,V=!1,W=!1,X,Y,Z=D()[1],Ha=D()[0],Ia=!1,Ja,Ka=/INPUT|TEXTAREA|SELECT/,La,Ma=new (function(){function b(){var a=this;this.os=new pa;this.browser=new qa;this.support=new ja(this.browser);this.system=new va(this.os, | ||
this.browser,this.support);this.media=new Da(this.support);this.orientation=new Ea;this.resize=new Fa;this.handleResizeEvent=function(){var b=a.orientation.landscape,d=a.isLandscape(!1);b!==d&&a.handleOrientationChange();Ga||(Ga=window.setTimeout(a.handleResizeTimeout,150))};this.handleResizeTimeout=function(){a.handleResizeChange();Ga=null};this.handleResizeChange=function(){a.resize.setResizeInfo();K.fireEvent("resize",{height:a.resize.height,width:a.resize.width})};this.setOrientationInfo=function(){a.orientation.landscape= | ||
a.isLandscape(!0);a.orientation.portrait=!a.orientation.landscape};this.handleOrientationChange=function(){a.setOrientationInfo();K.fireEvent("orientation",{landscape:a.orientation.landscape})};this.isLandscape=function(b){if(a.support.touch&&a.support.orientation&&a.os.android){if(Ia&&b)return!a.orientation.landscape;if(Ia)return a.orientation.landscape}else if(a.support.matchmedia&&a.support.orientation)return!!window.matchMedia("(orientation: landscape)").matches;b=D();return b[0]>b[1]};this.handleMobileOrientationResizeChange= | ||
function(c){if("resize"===c.type){if(La&&Ka.test(document.activeElement.tagName)&&!V)return;c=D()[1];var d=D()[0],e=(new Date).getTime();if(c===Z&&d===Ha)return;W=!0;if(Z!==c&&Ha===d){if(!Ja||300<e-Ja)Ia=c<Z;a.handleResizeChange()}else Ha=d;Ja=e;Z=c;Y&&(window.clearTimeout(Y),Y=null);Y=window.setTimeout(b.clearFlags,1200)}else"orientationchange"===c.type&&(V=!0);X&&(clearTimeout(X),X=null);X=window.setTimeout(a.handleMobileTimeout,50)};this.handleMobileTimeout=function(){W&&(V||a.system.tablet&&a.os.ios&& | ||
9<=a.os.version)&&(a.handleOrientationChange(),a.handleResizeChange(),W=V=!1,Y&&(window.clearTimeout(Y),Y=null));X=null};La=this.os.ios&&"sf"===this.browser.name&&(this.system.phone&&7<=this.os.version&&7.1>this.os.version||this.system.tablet&&7<=this.os.version);this.support.touch&&this.support.orientation?(window.addEventListener("resize",this.handleMobileOrientationResizeChange,!1),window.addEventListener("orientationchange",this.handleMobileOrientationResizeChange,!1)):window.addEventListener("resize", | ||
this.handleResizeEvent,!1);this.setOrientationInfo()}b.clearFlags=function(){W=V=!1;Y=null};return b}());exports.Device=Ma;exports.Event=ba;exports.KeyCodes=da;exports.Logger=t;exports.Optional=ea;exports.StyleClassHelper=fa;exports.Themes=u;exports.createThemeMap=function(b,a,c){var d;void 0===c&&(c={});return d={},d[u.sap_belize]=b,d[u.sap_belize_plus]=a,d[u.sap_belize_hcb]=c,d}; | ||
exports.deprecationNotice=function(b,a){b="* fiori-for-react Deprecation Notice - "+b;var c="*".padStart(b.length,"*");console.warn(""+c+b+c+a)};exports.getThemeClassFor=function(b,a){if({}.hasOwnProperty.call(a,b))return a[b];throw Error("Could not match theme to Theme Class!");};exports.getThemeOverwrite=function(b,a){return Object.values(u).includes(a)?a:b};exports.isNumeric=function(b){return!isNaN(parseFloat(b))&&isFinite(b)}; | ||
exports.pushElementBackInScreen=function(b,a){void 0===a&&(a=5);if(b){var c=document.documentElement.clientHeight,d=document.documentElement.clientWidth,e=b.getBoundingClientRect();if(0>e.left){var f=-1*e.left+a;f=parseInt(b.style.left,10)+f;b.style.left=f+"px"}e.right>d&&(f=e.right-d,f=parseInt(b.style.left,10)-f-a,b.style.left=f+"px");0>e.top&&(f=-1*e.top+a,a=parseInt(b.style.top,10)+f,b.style.top=a+"px");e.bottom>c&&(f=e.bottom-c,a=parseInt(b.style.top,10)-f,b.style.top=a+"px")}}; |
import { __extends } from 'tslib'; | ||
var Event = (function () { | ||
function Event(source, originalEvent, parameters) { | ||
if (parameters === void 0) { parameters = {}; } | ||
this.source = source; | ||
this.originalEvent = originalEvent; | ||
this.parameters = parameters; | ||
this.htmlSource = originalEvent.target; | ||
} | ||
Event.of = function (source, originalEvent, parameters) { | ||
if (parameters === void 0) { parameters = {}; } | ||
return new Event(source, originalEvent, parameters); | ||
}; | ||
Event.prototype.getSource = function () { | ||
return this.source; | ||
}; | ||
Event.prototype.getOriginalEvent = function () { | ||
return this.originalEvent; | ||
}; | ||
Event.prototype.getParameters = function () { | ||
return this.parameters; | ||
}; | ||
Event.prototype.getParameter = function (parameter) { | ||
return this.parameters[parameter]; | ||
}; | ||
Event.prototype.getHtmlSourceElement = function () { | ||
return this.htmlSource; | ||
}; | ||
Event.prototype.cancel = function () { | ||
this.originalEvent.stopPropagation(); | ||
}; | ||
Event.prototype.preventDefault = function () { | ||
this.originalEvent.preventDefault(); | ||
}; | ||
return Event; | ||
}()); | ||
var KeyCodes; | ||
@@ -180,38 +216,1132 @@ (function (KeyCodes) { | ||
var Event = (function () { | ||
function Event(source, originalEvent, parameters) { | ||
if (parameters === void 0) { parameters = {}; } | ||
this.source = source; | ||
this.originalEvent = originalEvent; | ||
this.parameters = parameters; | ||
this.htmlSource = originalEvent.target; | ||
var isNumeric = function (n) { | ||
return !isNaN(parseFloat(n)) && isFinite(n); | ||
}; | ||
!function (e, t, n) { | ||
function r(e, t) { | ||
return typeof e === t; | ||
} | ||
function o() { | ||
var e, t, n, o, i, s, a; | ||
for (var u in y) if (y.hasOwnProperty(u)) { | ||
if (e = [], t = y[u], t.name && (e.push(t.name.toLowerCase()), t.options && t.options.aliases && t.options.aliases.length)) for (n = 0; n < t.options.aliases.length; n++) e.push(t.options.aliases[n].toLowerCase()); | ||
for (o = r(t.fn, 'function') ? t.fn() : t.fn, i = 0; i < e.length; i++) s = e[i], a = s.split('.'), 1 === a.length ? Modernizr[a[0]] = o : (!Modernizr[a[0]] || Modernizr[a[0]] instanceof Boolean || (Modernizr[a[0]] = new Boolean(Modernizr[a[0]])), Modernizr[a[0]][a[1]] = o), C.push((o ? '' : 'no-') + a.join('-')); | ||
} | ||
Event.of = function (source, originalEvent, parameters) { | ||
if (parameters === void 0) { parameters = {}; } | ||
return new Event(source, originalEvent, parameters); | ||
} | ||
function i() { | ||
return 'function' != typeof t.createElement ? t.createElement(arguments[0]) : _ ? t.createElementNS.call(t, 'http://www.w3.org/2000/svg', arguments[0]) : t.createElement.apply(t, arguments); | ||
} | ||
function s() { | ||
var e = t.body; | ||
return e || (e = i(_ ? 'svg' : 'body'), e.fake = !0), e; | ||
} | ||
function a(e, n, r, o) { | ||
var a, | ||
u, | ||
l, | ||
f, | ||
d = 'modernizr', | ||
c = i('div'), | ||
p = s(); | ||
if (parseInt(r, 10)) for (; r--;) l = i('div'), l.id = o ? o[r] : d + (r + 1), c.appendChild(l); | ||
return a = i('style'), a.type = 'text/css', a.id = 's' + d, (p.fake ? p : c).appendChild(a), p.appendChild(c), a.styleSheet ? a.styleSheet.cssText = e : a.appendChild(t.createTextNode(e)), c.id = d, p.fake && (p.style.background = '', p.style.overflow = 'hidden', f = x.style.overflow, x.style.overflow = 'hidden', x.appendChild(p)), u = n(c, e), p.fake ? (p.parentNode.removeChild(p), x.style.overflow = f, x.offsetHeight) : c.parentNode.removeChild(c), !!u; | ||
} | ||
function u(e, t) { | ||
return !!~('' + e).indexOf(t); | ||
} | ||
function l(e) { | ||
return e.replace(/([A-Z])/g, function (e, t) { | ||
return '-' + t.toLowerCase(); | ||
}).replace(/^ms-/, '-ms-'); | ||
} | ||
function f(t, n, r) { | ||
var o; | ||
if ('getComputedStyle' in e) { | ||
o = getComputedStyle.call(e, t, n); | ||
var i = e.console; | ||
if (null !== o) r && (o = o.getPropertyValue(r));else if (i) { | ||
var s = i.error ? 'error' : 'log'; | ||
i[s].call(i, 'getComputedStyle returning null, its possible modernizr test results are inaccurate'); | ||
} | ||
} else o = !n && t.currentStyle && t.currentStyle[r]; | ||
return o; | ||
} | ||
function d(t, r) { | ||
var o = t.length; | ||
if ('CSS' in e && 'supports' in e.CSS) { | ||
for (; o--;) if (e.CSS.supports(l(t[o]), r)) return !0; | ||
return !1; | ||
} | ||
if ('CSSSupportsRule' in e) { | ||
for (var i = []; o--;) i.push('(' + l(t[o]) + ':' + r + ')'); | ||
return i = i.join(' or '), a('@supports (' + i + ') { #modernizr { position: absolute; } }', function (e) { | ||
return 'absolute' == f(e, null, 'position'); | ||
}); | ||
} | ||
return n; | ||
} | ||
function c(e) { | ||
return e.replace(/([a-z])-([a-z])/g, function (e, t, n) { | ||
return t + n.toUpperCase(); | ||
}).replace(/^-/, ''); | ||
} | ||
function p(e, t, o, s) { | ||
function a() { | ||
f && (delete L.style, delete L.modElem); | ||
} | ||
if (s = r(s, 'undefined') ? !1 : s, !r(o, 'undefined')) { | ||
var l = d(e, o); | ||
if (!r(l, 'undefined')) return l; | ||
} | ||
for (var f, p, v, m, h, y = ['modernizr', 'tspan', 'samp']; !L.style && y.length;) f = !0, L.modElem = i(y.shift()), L.style = L.modElem.style; | ||
for (v = e.length, p = 0; v > p; p++) if (m = e[p], h = L.style[m], u(m, '-') && (m = c(m)), L.style[m] !== n) { | ||
if (s || r(o, 'undefined')) return a(), 'pfx' == t ? m : !0; | ||
try { | ||
L.style[m] = o; | ||
} catch (g) {} | ||
if (L.style[m] != h) return a(), 'pfx' == t ? m : !0; | ||
} | ||
return a(), !1; | ||
} | ||
function v(e, t) { | ||
return function () { | ||
return e.apply(t, arguments); | ||
}; | ||
Event.prototype.getSource = function () { | ||
return this.source; | ||
} | ||
function m(e, t, n) { | ||
var o; | ||
for (var i in e) if (e[i] in t) return n === !1 ? e[i] : (o = t[e[i]], r(o, 'function') ? v(o, n || t) : o); | ||
return !1; | ||
} | ||
function h(e, t, n, o, i) { | ||
var s = e.charAt(0).toUpperCase() + e.slice(1), | ||
a = (e + ' ' + P.join(s + ' ') + s).split(' '); | ||
return r(t, 'string') || r(t, 'undefined') ? p(a, t, o, i) : (a = (e + ' ' + w.join(s + ' ') + s).split(' '), m(a, t, n)); | ||
} | ||
var y = [], | ||
g = { | ||
_version: '3.6.0', | ||
_config: { | ||
classPrefix: '', | ||
enableClasses: !0, | ||
enableJSClass: !0, | ||
usePrefixes: !0 | ||
}, | ||
_q: [], | ||
on: function (e, t) { | ||
var n = this; | ||
setTimeout(function () { | ||
t(n[e]); | ||
}, 0); | ||
}, | ||
addTest: function (e, t, n) { | ||
y.push({ | ||
name: e, | ||
fn: t, | ||
options: n | ||
}); | ||
}, | ||
addAsyncTest: function (e) { | ||
y.push({ | ||
name: null, | ||
fn: e | ||
}); | ||
} | ||
}, | ||
Modernizr = function () {}; | ||
Modernizr.prototype = g, Modernizr = new Modernizr(); | ||
var C = [], | ||
S = 'Moz O ms Webkit', | ||
w = g._config.usePrefixes ? S.toLowerCase().split(' ') : []; | ||
g._domPrefixes = w; | ||
var x = t.documentElement, | ||
_ = 'svg' === x.nodeName.toLowerCase(), | ||
b = function () { | ||
function e(e, t) { | ||
var o; | ||
return e ? (t && 'string' != typeof t || (t = i(t || 'div')), e = 'on' + e, o = e in t, !o && r && (t.setAttribute || (t = i('div')), t.setAttribute(e, ''), o = 'function' == typeof t[e], t[e] !== n && (t[e] = n), t.removeAttribute(e)), o) : !1; | ||
} | ||
var r = !('onblur' in t.documentElement); | ||
return e; | ||
}(); | ||
g.hasEvent = b, Modernizr.addTest('pointerevents', function () { | ||
var e = !1, | ||
t = w.length; | ||
for (e = Modernizr.hasEvent('pointerdown'); t-- && !e;) b(w[t] + 'pointerdown') && (e = !0); | ||
return e; | ||
}); | ||
var T = g._config.usePrefixes ? ' -webkit- -moz- -o- -ms- '.split(' ') : ['', '']; | ||
g._prefixes = T; | ||
var E = g.testStyles = a; | ||
Modernizr.addTest('touchevents', function () { | ||
var n; | ||
if ('ontouchstart' in e || e.DocumentTouch && t instanceof DocumentTouch) n = !0;else { | ||
var r = ['@media (', T.join('touch-enabled),('), 'heartz', ')', '{#modernizr{top:9px;position:absolute}}'].join(''); | ||
E(r, function (e) { | ||
n = 9 === e.offsetTop; | ||
}); | ||
} | ||
return n; | ||
}); | ||
var z = !1; | ||
try { | ||
z = 'WebSocket' in e && 2 === e.WebSocket.CLOSING; | ||
} catch (k) {} | ||
Modernizr.addTest('websockets', z), Modernizr.addTest('devicemotion', 'DeviceMotionEvent' in e), Modernizr.addTest('deviceorientation', 'DeviceOrientationEvent' in e), Modernizr.addTest('placeholder', 'placeholder' in i('input') && 'placeholder' in i('textarea')); | ||
var P = g._config.usePrefixes ? S.split(' ') : []; | ||
g._cssomPrefixes = P; | ||
var A = { | ||
elem: i('modernizr') | ||
}; | ||
Modernizr._q.push(function () { | ||
delete A.elem; | ||
}); | ||
var L = { | ||
style: A.elem.style | ||
}; | ||
Modernizr._q.unshift(function () { | ||
delete L.style; | ||
}), g.testAllProps = h; | ||
var O = function (t) { | ||
var r, | ||
o = T.length, | ||
i = e.CSSRule; | ||
if ('undefined' == typeof i) return n; | ||
if (!t) return !1; | ||
if (t = t.replace(/^@/, ''), r = t.replace(/-/g, '_').toUpperCase() + '_RULE', r in i) return '@' + t; | ||
for (var s = 0; o > s; s++) { | ||
var a = T[s], | ||
u = a.toUpperCase() + '_' + r; | ||
if (u in i) return '@-' + a.toLowerCase() + '-' + t; | ||
} | ||
return !1; | ||
}; | ||
g.atRule = O; | ||
var N = g.prefixed = function (e, t, n) { | ||
return 0 === e.indexOf('@') ? O(e) : (-1 != e.indexOf('-') && (e = c(e)), t ? h(e, t, n) : h(e, 'pfx')); | ||
}; | ||
Modernizr.addTest('matchmedia', !!N('matchMedia', e)), o(), delete g.addTest, delete g.addAsyncTest; | ||
for (var j = 0; j < Modernizr._q.length; j++) Modernizr._q[j](); | ||
e.Modernizr = Modernizr; | ||
}(window, document); | ||
var Support = (function () { | ||
function Support(browser) { | ||
this.input = { | ||
placeholder: false | ||
}; | ||
this.touch = Modernizr.touchevents; | ||
this.pointer = Modernizr.pointerevents; | ||
this.matchmedia = Modernizr.matchmedia; | ||
var matchmedialistener = !!(this.matchmedia && window.matchMedia('all and (max-width:0px)')); | ||
if (browser.safari && browser.version < 6 && !browser.fullscreen && !browser.webview) { | ||
matchmedialistener = false; | ||
} | ||
this.matchmedialistener = matchmedialistener; | ||
this.orientation = Modernizr.deviceorientation; | ||
this.retina = window.retina || window.devicePixelRatio >= 2; | ||
this.websocket = Modernizr.websockets; | ||
this.input.placeholder = Modernizr.placeholder; | ||
return this; | ||
} | ||
return Support; | ||
}()); | ||
var OSTypes; | ||
(function (OSTypes) { | ||
OSTypes["WINDOWS"] = "win"; | ||
OSTypes["MACINTOSH"] = "mac"; | ||
OSTypes["LINUX"] = "linux"; | ||
OSTypes["IOS"] = "iOS"; | ||
OSTypes["ANDROID"] = "Android"; | ||
OSTypes["BLACKBERRY"] = "bb"; | ||
OSTypes["WINDOWS_PHONE"] = "winphone"; | ||
})(OSTypes || (OSTypes = {})); | ||
var OS = (function () { | ||
function OS(customUA) { | ||
var _this = this; | ||
this.OS = OSTypes; | ||
this.getDesktopOS = function (customUA) { | ||
var userAgent = customUA || navigator.userAgent; | ||
var pf = navigator.platform; | ||
if (pf.indexOf('Win') != -1) { | ||
var rVersion = /Windows NT (\d+).(\d)/i; | ||
var uaResult = userAgent.match(rVersion); | ||
var sVersionStr = ''; | ||
if (uaResult[1] == '6') { | ||
if (uaResult[2] == 1) { | ||
sVersionStr = '7'; | ||
} | ||
else if (uaResult[2] > 1) { | ||
sVersionStr = '8'; | ||
} | ||
} | ||
else { | ||
sVersionStr = uaResult[1]; | ||
} | ||
_this.name = OSTypes.WINDOWS; | ||
_this.versionStr = sVersionStr; | ||
return _this; | ||
} | ||
if (pf.indexOf('Mac') != -1) { | ||
_this.name = OSTypes.MACINTOSH; | ||
_this.versionStr = ''; | ||
return _this; | ||
} | ||
if (pf.indexOf('Linux') != -1) { | ||
_this.name = OSTypes.LINUX; | ||
_this.versionStr = ''; | ||
return _this; | ||
} | ||
Logger.info('OS detection returned no result'); | ||
return null; | ||
}; | ||
this.setOS(customUA); | ||
} | ||
OS.prototype.setOS = function (customUA) { | ||
this.getOS(customUA); | ||
this.version = this.versionStr ? parseFloat(this.versionStr) : -1; | ||
if (this.name) { | ||
for (var os in OSTypes) { | ||
if (OSTypes[os] === this.name) { | ||
this[os.toLowerCase()] = true; | ||
} | ||
} | ||
} | ||
}; | ||
Event.prototype.getOriginalEvent = function () { | ||
return this.originalEvent; | ||
OS.prototype.getOS = function (customUA) { | ||
var platform; | ||
var result; | ||
var userAgent = customUA || navigator.userAgent; | ||
platform = /Windows Phone (?:OS )?([\d.]*)/; | ||
result = userAgent.match(platform); | ||
if (result) { | ||
this.name = OSTypes.WINDOWS_PHONE; | ||
this.versionStr = result[1]; | ||
return this; | ||
} | ||
if (userAgent.indexOf('(BB10;') > 0) { | ||
platform = /\sVersion\/([\d.]+)\s/; | ||
result = userAgent.match(platform); | ||
if (result) { | ||
this.name = OSTypes.BLACKBERRY; | ||
this.versionStr = result[1]; | ||
return this; | ||
} | ||
this.name = OSTypes.BLACKBERRY; | ||
this.versionStr = '10'; | ||
return this; | ||
} | ||
platform = /\(([a-zA-Z ]+);\s(?:[U]?[;]?)([\D]+)((?:[\d._]*))(?:.*[\)][^\d]*)([\d.]*)\s/; | ||
result = userAgent.match(platform); | ||
if (result) { | ||
var appleDevices = /iPhone|iPad|iPod/; | ||
var bbDevices = /PlayBook|BlackBerry/; | ||
if (result[0].match(appleDevices)) { | ||
result[3] = result[3].replace(/_/g, '.'); | ||
this.name = OSTypes.IOS; | ||
this.versionStr = result[3]; | ||
return this; | ||
} | ||
if (result[2].match(/Android/)) { | ||
result[2] = result[2].replace(/\s/g, ''); | ||
this.name = OSTypes.ANDROID; | ||
this.versionStr = result[3]; | ||
return this; | ||
} | ||
if (result[0].match(bbDevices)) { | ||
this.name = OSTypes.BLACKBERRY; | ||
this.versionStr = result[4]; | ||
return this; | ||
} | ||
} | ||
platform = /\((Android)[\s]?([\d][.\d]*)?;.*Firefox\/[\d][.\d]*/; | ||
result = userAgent.match(platform); | ||
if (result) { | ||
this.name = OSTypes.ANDROID; | ||
this.versionStr = result.length == 3 ? result[2] : ''; | ||
return this; | ||
} | ||
return this.getDesktopOS(customUA); | ||
}; | ||
Event.prototype.getParameters = function () { | ||
return this.parameters; | ||
return OS; | ||
}()); | ||
var BROWSER; | ||
(function (BROWSER) { | ||
BROWSER["INTERNET_EXPLORER"] = "ie"; | ||
BROWSER["EDGE"] = "ed"; | ||
BROWSER["FIREFOX"] = "ff"; | ||
BROWSER["CHROME"] = "cr"; | ||
BROWSER["SAFARI"] = "sf"; | ||
BROWSER["ANDROID"] = "an"; | ||
})(BROWSER || (BROWSER = {})); | ||
var Browser = (function () { | ||
function Browser() { | ||
this.BROWSER = BROWSER; | ||
this.setBrowser(); | ||
} | ||
Browser.calcBrowser = function (customUa) { | ||
var ua = navigator.userAgent; | ||
var _ua = (customUa || ua).toLowerCase(); | ||
var rwebkit = /(webkit)[ \/]([\w.]+)/; | ||
var ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/; | ||
var rmsie = /(msie) ([\w.]+)/; | ||
var rmsie11 = /(trident)\/[\w.]+;.*rv:([\w.]+)/; | ||
var redge = /(edge)[ \/]([\w.]+)/; | ||
var rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/; | ||
var browserMatch = redge.exec(_ua) || | ||
rmsie11.exec(_ua) || | ||
rwebkit.exec(_ua) || | ||
ropera.exec(_ua) || | ||
rmsie.exec(_ua) || | ||
(_ua.indexOf('compatible') < 0 && rmozilla.exec(_ua)) || | ||
[]; | ||
var res = { | ||
browser: browserMatch[1] || '', | ||
version: browserMatch[2] || '0' | ||
}; | ||
res[res.browser] = true; | ||
return res; | ||
}; | ||
Event.prototype.getParameter = function (parameter) { | ||
return this.parameters[parameter]; | ||
Browser.prototype.getBrowser = function (customUa, customNav) { | ||
var ua = navigator.userAgent; | ||
var b = Browser.calcBrowser(customUa); | ||
var _ua = customUa || ua; | ||
var _navigator = customNav || window.navigator; | ||
var oExpMobile; | ||
if (b.mozilla) { | ||
oExpMobile = /Mobile/; | ||
if (_ua.match(/Firefox\/(\d+\.\d+)/)) { | ||
var version = parseFloat(RegExp.$1); | ||
this.name = BROWSER.FIREFOX; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.mozilla = true; | ||
this.mobile = oExpMobile.test(_ua); | ||
return this; | ||
} | ||
this.mobile = oExpMobile.test(_ua); | ||
this.mozilla = true; | ||
this.version = -1; | ||
} | ||
if (b.webkit) { | ||
var regExpWebkitVersion = _ua.toLowerCase().match(/webkit[\/]([\d.]+)/); | ||
var webkitVersion = void 0; | ||
if (regExpWebkitVersion) { | ||
webkitVersion = regExpWebkitVersion[1]; | ||
} | ||
oExpMobile = /Mobile/; | ||
if (_ua.match(/(Chrome|CriOS)\/(\d+\.\d+).\d+/)) { | ||
var version = parseFloat(RegExp.$2); | ||
this.name = BROWSER.CHROME; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.mobile = oExpMobile.test(_ua); | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
return this; | ||
} | ||
if (_ua.match(/FxiOS\/(\d+\.\d+)/)) { | ||
var version = parseFloat(RegExp.$1); | ||
this.name = BROWSER.FIREFOX; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.mobile = true; | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
return this; | ||
} | ||
if (_ua.match(/Android .+ Version\/(\d+\.\d+)/)) { | ||
var version = parseFloat(RegExp.$1); | ||
this.name = BROWSER.ANDROID; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.mobile = oExpMobile.test(_ua); | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
return this; | ||
} | ||
var oExp = /(Version|PhantomJS)\/(\d+\.\d+).*Safari/; | ||
var bStandalone = _navigator.standalone; | ||
if (oExp.test(_ua)) { | ||
var aParts = oExp.exec(_ua); | ||
var version = parseFloat(aParts[2]); | ||
this.name = BROWSER.SAFARI; | ||
this.versionStr = "" + version; | ||
this.fullscreen = false; | ||
this.webview = false; | ||
this.version = version; | ||
this.mobile = oExpMobile.test(_ua); | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
this.phantomJS = aParts[1] === 'PhantomJS'; | ||
return this; | ||
} | ||
if (/iPhone|iPad|iPod/.test(_ua) && | ||
!/CriOS/.test(_ua) && | ||
!/FxiOS/.test(_ua) && | ||
(bStandalone === true || bStandalone === false)) { | ||
this.name = BROWSER.SAFARI; | ||
this.version = -1; | ||
this.fullscreen = bStandalone; | ||
this.webview = bStandalone; | ||
this.mobile = oExpMobile.test(_ua); | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
return this; | ||
} | ||
this.mobile = oExpMobile.test(_ua); | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
this.version = -1; | ||
return this; | ||
} | ||
if (b.msie || b.trident) { | ||
var version = void 0; | ||
if (document.documentMode && !customUa) { | ||
if (document.documentMode === 7) { | ||
version = 8.0; | ||
} | ||
else { | ||
version = parseFloat(document.documentMode); | ||
} | ||
} | ||
else { | ||
version = parseFloat(b.version); | ||
} | ||
this.name = BROWSER.INTERNET_EXPLORER; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.msie = true; | ||
this.mobile = false; | ||
return this; | ||
} | ||
if (b.edge) { | ||
var version = parseFloat(b.version); | ||
this.name = BROWSER.EDGE; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.edge = true; | ||
return this; | ||
} | ||
this.name = ''; | ||
this.versionStr = ''; | ||
this.version = -1; | ||
this.mobile = false; | ||
return this; | ||
}; | ||
Event.prototype.getHtmlSourceElement = function () { | ||
return this.htmlSource; | ||
Browser.prototype.setBrowser = function () { | ||
this.getBrowser(); | ||
if (this.name) { | ||
for (var b in BROWSER) { | ||
if (BROWSER[b] === this.name) { | ||
this[b.toLowerCase()] = true; | ||
} | ||
} | ||
} | ||
}; | ||
Event.prototype.cancel = function () { | ||
this.originalEvent.stopPropagation(); | ||
return Browser; | ||
}()); | ||
var windowSize = function () { | ||
return [window.innerWidth, window.innerHeight]; | ||
}; | ||
var changeRootCSSClass = function (sClassName, bRemove, sPrefix) { | ||
var oRoot = document.documentElement; | ||
if (oRoot.className.length === 0) { | ||
if (!bRemove) { | ||
oRoot.className = sClassName; | ||
} | ||
} | ||
else { | ||
var aCurrentClasses = oRoot.className.split(' '); | ||
var sNewClasses_1 = ''; | ||
aCurrentClasses.forEach(function (currentClass) { | ||
if ((sPrefix && currentClass.indexOf(sPrefix) !== 0) || (!sPrefix && currentClass !== sClassName)) { | ||
sNewClasses_1 = sNewClasses_1 + currentClass + " "; | ||
} | ||
}); | ||
if (!bRemove) { | ||
sNewClasses_1 += sClassName; | ||
} | ||
oRoot.className = sNewClasses_1; | ||
} | ||
}; | ||
var getQuery = function (from, to, unit) { | ||
unit = unit || 'px'; | ||
var q = 'all'; | ||
if (from > 0) { | ||
q = q + " and (min-width:" + from + unit + ")"; | ||
} | ||
if (to > 0) { | ||
q = q + " and (max-width:" + to + unit + ")"; | ||
} | ||
return q; | ||
}; | ||
var convertToPx = function (val, unit) { | ||
if (unit === 'em' || unit === 'rem') { | ||
var s = window.getComputedStyle || | ||
function (e) { | ||
return e.currentStyle; | ||
}; | ||
var x = s(document.documentElement).fontSize; | ||
var f = x && x.indexOf('px') >= 0 ? parseFloat(x, 10) : 16; | ||
return val * f; | ||
} | ||
return val; | ||
}; | ||
var matchLegacyBySize = function (from, to, unit, size) { | ||
from = convertToPx(from, unit); | ||
to = convertToPx(to, unit); | ||
var width = size[0]; | ||
var a = from < 0 || from <= width; | ||
var b = to < 0 || width <= to; | ||
return a && b; | ||
}; | ||
var SYSTEMTYPE; | ||
(function (SYSTEMTYPE) { | ||
SYSTEMTYPE["TABLET"] = "tablet"; | ||
SYSTEMTYPE["PHONE"] = "phone"; | ||
SYSTEMTYPE["DESKTOP"] = "desktop"; | ||
SYSTEMTYPE["COMBI"] = "combi"; | ||
})(SYSTEMTYPE || (SYSTEMTYPE = {})); | ||
var os; | ||
var browser; | ||
var support; | ||
var System = (function () { | ||
function System(osInstance, browserInstance, supportInstance) { | ||
this.SYSTEMTYPE = SYSTEMTYPE; | ||
os = osInstance; | ||
browser = browserInstance; | ||
support = supportInstance; | ||
this.setSystem(); | ||
return this; | ||
} | ||
System.prototype.getSystem = function (customUA) { | ||
var _this = this; | ||
var t = this.isTablet(customUA); | ||
var isWin8Upwards = os.windows && os.version >= 8; | ||
var isWin7 = os.windows && os.version === 7; | ||
this.tablet = !!(((support.touch && !isWin7) || isWin8Upwards) && t); | ||
this.phone = !!(os.windows_phone || (support.touch && !isWin7 && !t)); | ||
this.desktop = !!((!this.tablet && !this.phone) || isWin8Upwards || isWin7); | ||
this.combi = !!(this.desktop && this.tablet); | ||
Object.values(SYSTEMTYPE).forEach(function (type) { | ||
changeRootCSSClass("sap-" + type, !_this[type]); | ||
}); | ||
}; | ||
Event.prototype.preventDefault = function () { | ||
this.originalEvent.preventDefault(); | ||
System.prototype.isTablet = function (customUA) { | ||
var ua = customUA || navigator.userAgent; | ||
var isWin8Upwards = os.windows && os.version >= 8; | ||
if (os.name === os.OS.IOS) { | ||
return /ipad/i.test(ua); | ||
} | ||
if (support.touch) { | ||
if (isWin8Upwards) { | ||
return true; | ||
} | ||
if (browser.chrome && os.android && os.version >= 4.4) { | ||
return !/Mobile Safari\/[.0-9]+/.test(ua); | ||
} | ||
var densityFactor = window.devicePixelRatio ? window.devicePixelRatio : 1; | ||
if (os.android && browser.webkit && parseFloat(browser.webkitVersion) > 537.1) { | ||
densityFactor = 1; | ||
} | ||
var bTablet = Math.min(window.screen.width / densityFactor, window.screen.height / densityFactor) >= 600; | ||
if ((window.screen.height === 552 || window.screen.height === 553) && | ||
/Nexus 7/i.test(ua)) { | ||
bTablet = true; | ||
} | ||
return bTablet; | ||
} | ||
var androidPhone = /(?=android)(?=.*mobile)/i.test(ua); | ||
return (browser.msie && ua.indexOf('Touch') !== -1) || (os.android && !androidPhone); | ||
}; | ||
return Event; | ||
System.prototype.setSystem = function (customUA) { | ||
this.getSystem(customUA); | ||
if (this.tablet || this.phone) { | ||
browser.mobile = true; | ||
} | ||
}; | ||
return System; | ||
}()); | ||
var EventRegistry = (function () { | ||
function EventRegistry() { | ||
} | ||
EventRegistry.attachEvent = function (sEventId, fnFunction, oListener) { | ||
if (!EventRegistry.mEventRegistry[sEventId]) { | ||
EventRegistry.mEventRegistry[sEventId] = []; | ||
} | ||
EventRegistry.mEventRegistry[sEventId].push({ | ||
oListener: oListener, | ||
fFunction: fnFunction | ||
}); | ||
}; | ||
EventRegistry.detachEvent = function (sEventId, fnFunction, oListener) { | ||
var aEventListeners = EventRegistry.mEventRegistry[sEventId]; | ||
if (!aEventListeners) { | ||
return; | ||
} | ||
for (var i = 0, iL = aEventListeners.length; i < iL; i++) { | ||
if (aEventListeners[i].fFunction === fnFunction && aEventListeners[i].oListener === oListener) { | ||
aEventListeners.splice(i, 1); | ||
break; | ||
} | ||
} | ||
if (aEventListeners.length === 0) { | ||
delete EventRegistry.mEventRegistry[sEventId]; | ||
} | ||
}; | ||
EventRegistry.fireEvent = function (sEventId, mParameters) { | ||
var aEventListeners = EventRegistry.mEventRegistry[sEventId]; | ||
var oInfo; | ||
if (aEventListeners) { | ||
aEventListeners = aEventListeners.slice(); | ||
for (var i = 0, iL = aEventListeners.length; i < iL; i++) { | ||
oInfo = aEventListeners[i]; | ||
oInfo.fFunction.call(oInfo.oListener || window, mParameters); | ||
} | ||
} | ||
}; | ||
EventRegistry.mEventRegistry = {}; | ||
return EventRegistry; | ||
}()); | ||
var _a; | ||
var RANGESETS; | ||
(function (RANGESETS) { | ||
RANGESETS["SAP_3STEPS"] = "3Step"; | ||
RANGESETS["SAP_4STEPS"] = "4Step"; | ||
RANGESETS["SAP_6STEPS"] = "6Step"; | ||
RANGESETS["SAP_STANDARD"] = "Std"; | ||
RANGESETS["SAP_STANDARD_EXTENDED"] = "StdExt"; | ||
})(RANGESETS || (RANGESETS = {})); | ||
var support$1; | ||
var defaultRangeSet = RANGESETS.SAP_STANDARD; | ||
var querysets = {}; | ||
var mediaCurrentwidth = null; | ||
var matchLegacy = function (from, to, unit) { return matchLegacyBySize(from, to, unit, windowSize()); }; | ||
var match = function (from, to, unit) { | ||
var q = getQuery(from, to, unit); | ||
var mm = window.matchMedia(q); | ||
return mm && mm.matches; | ||
}; | ||
var refreshCSSClasses = function (sSetName, sRangeName, bRemove) { | ||
var sClassPrefix = "sapUiMedia-" + sSetName + "-"; | ||
changeRootCSSClass(sClassPrefix + sRangeName, bRemove, sClassPrefix); | ||
}; | ||
var Media = (function () { | ||
function Media(supportInstance) { | ||
this.RANGESETS = RANGESETS; | ||
support$1 = supportInstance; | ||
this.media_timeout = support$1.matchmedialistener ? 0 : 100; | ||
this.matches = support$1.matchmedia ? match : matchLegacy; | ||
this.initRangeSet(); | ||
this.initRangeSet(RANGESETS.SAP_STANDARD_EXTENDED); | ||
} | ||
Media.getRangeInfo = function (sSetName, iRangeIdx) { | ||
var q = querysets[sSetName].queries[iRangeIdx]; | ||
var info = { from: q.from, unit: querysets[sSetName].unit }; | ||
if (q.to >= 0) { | ||
info.to = q.to; | ||
} | ||
if (querysets[sSetName].names) { | ||
info.name = querysets[sSetName].names[iRangeIdx]; | ||
} | ||
return info; | ||
}; | ||
Media.prototype.checkQueries = function (name, infoOnly, fnMatches) { | ||
fnMatches = fnMatches || this.matches; | ||
if (querysets[name]) { | ||
var aQueries = querysets[name].queries; | ||
var info = null; | ||
for (var i = 0, len = aQueries.length; i < len; i++) { | ||
var q = aQueries[i]; | ||
if ((q !== querysets[name].currentquery || infoOnly) && fnMatches(q.from, q.to, querysets[name].unit)) { | ||
if (!infoOnly) { | ||
querysets[name].currentquery = q; | ||
} | ||
if (!querysets[name].noClasses && querysets[name].names && !infoOnly) { | ||
refreshCSSClasses(name, querysets[name].names[i]); | ||
} | ||
info = Media.getRangeInfo(name, i); | ||
} | ||
} | ||
return info; | ||
} | ||
Logger.warning("No queryset with name " + name + " found", 'DEVICE.MEDIA'); | ||
return null; | ||
}; | ||
Media.prototype.handleChange = function (name) { | ||
var _this = this; | ||
if (!support$1.matchmedialistener && mediaCurrentwidth === windowSize()[0]) { | ||
return; | ||
} | ||
if (querysets[name].timer) { | ||
clearTimeout(querysets[name].timer); | ||
querysets[name].timer = null; | ||
} | ||
querysets[name].timer = setTimeout(function () { | ||
var mParams = _this.checkQueries(name, false); | ||
if (mParams) { | ||
EventRegistry.fireEvent("media_" + name, mParams); | ||
} | ||
}, this.media_timeout); | ||
}; | ||
Media.prototype.attachHandler = function (fnFunction, oListener, sName) { | ||
var name = sName || defaultRangeSet; | ||
EventRegistry.attachEvent("media_" + name, fnFunction, oListener); | ||
}; | ||
Media.prototype.detachHandler = function (fnFunction, oListener, sName) { | ||
var name = sName || defaultRangeSet; | ||
EventRegistry.detachEvent("media_" + name, fnFunction, oListener); | ||
}; | ||
Media.prototype.initRangeSet = function (sName, aRangeBorders, sUnit, aRangeNames, bSuppressClasses) { | ||
var _this = this; | ||
var oConfig; | ||
if (!sName) { | ||
oConfig = Media.predefinedRangeSets[defaultRangeSet]; | ||
} | ||
else if (sName && Media.predefinedRangeSets[sName]) { | ||
oConfig = Media.predefinedRangeSets[sName]; | ||
} | ||
else { | ||
oConfig = { | ||
name: sName, | ||
unit: (sUnit || 'px').toLowerCase(), | ||
points: aRangeBorders || [], | ||
names: aRangeNames, | ||
noClasses: !!bSuppressClasses | ||
}; | ||
} | ||
if (this.hasRangeSet(oConfig.name)) { | ||
Logger.info("Range set " + oConfig.name + " has already been initialized", 'DEVICE.MEDIA'); | ||
return; | ||
} | ||
sName = oConfig.name; | ||
oConfig.queries = []; | ||
oConfig.timer = null; | ||
oConfig.currentquery = null; | ||
oConfig.listener = function () { return _this.handleChange(sName); }; | ||
var from, to, query; | ||
var aPoints = oConfig.points; | ||
for (var i = 0, len = aPoints.length; i <= len; i++) { | ||
from = i === 0 ? 0 : aPoints[i - 1]; | ||
to = i === aPoints.length ? -1 : aPoints[i]; | ||
query = getQuery(from, to, oConfig.unit); | ||
oConfig.queries.push({ | ||
query: query, | ||
from: from, | ||
to: to | ||
}); | ||
} | ||
if (oConfig.names && oConfig.names.length !== oConfig.queries.length) { | ||
oConfig.names = null; | ||
} | ||
querysets[oConfig.name] = oConfig; | ||
if (support$1.matchmedialistener) { | ||
var queries = oConfig.queries; | ||
for (var i = 0; i < queries.length; i++) { | ||
var q = queries[i]; | ||
q.media = window.matchMedia(q.query); | ||
q.media.addListener(oConfig.listener); | ||
} | ||
} | ||
else { | ||
window.addEventListener('resize', oConfig.listener, false); | ||
window.addEventListener('orientationchange', oConfig.listener, false); | ||
} | ||
oConfig.listener(); | ||
}; | ||
Media.prototype.getCurrentRange = function (sName, iWidth) { | ||
if (!this.hasRangeSet(sName)) { | ||
return null; | ||
} | ||
return this.checkQueries(sName, true, isNaN(iWidth) ? null : function (from, to, unit) { return matchLegacyBySize(from, to, unit, [iWidth, 0]); }); | ||
}; | ||
Media.prototype.hasRangeSet = function (sName) { | ||
return sName && !!querysets[sName]; | ||
}; | ||
Media.prototype.removeRangeSet = function (sName) { | ||
if (!this.hasRangeSet(sName)) { | ||
Logger.info("RangeSet " + sName + " not found, thus could not be removed.", 'DEVICE.MEDIA'); | ||
return; | ||
} | ||
for (var x in RANGESETS) { | ||
if (sName === RANGESETS[x]) { | ||
Logger.warning('Cannot remove default rangeset - no action taken.', 'DEVICE.MEDIA'); | ||
return; | ||
} | ||
} | ||
var oConfig = querysets[sName]; | ||
if (support$1.matchmedialistener) { | ||
var queries = oConfig.queries; | ||
for (var i = 0; i < queries.length; i++) { | ||
queries[i].media.removeListener(oConfig.listener); | ||
} | ||
} | ||
else { | ||
window.removeEventListener('resize', oConfig.listener, false); | ||
window.removeEventListener('orientationchange', oConfig.listener, false); | ||
} | ||
refreshCSSClasses(sName, '', true); | ||
delete EventRegistry.mEventRegistry["media_" + sName]; | ||
delete querysets[sName]; | ||
}; | ||
Media.predefinedRangeSets = (_a = {}, | ||
_a[RANGESETS.SAP_3STEPS] = { | ||
points: [520, 960], | ||
unit: 'px', | ||
name: RANGESETS.SAP_3STEPS, | ||
names: ['S', 'M', 'L'] | ||
}, | ||
_a[RANGESETS.SAP_4STEPS] = { | ||
points: [520, 760, 960], | ||
unit: 'px', | ||
name: RANGESETS.SAP_4STEPS, | ||
names: ['S', 'M', 'L', 'XL'] | ||
}, | ||
_a[RANGESETS.SAP_6STEPS] = { | ||
points: [241, 400, 541, 768, 960], | ||
unit: 'px', | ||
name: RANGESETS.SAP_6STEPS, | ||
names: ['XS', 'S', 'M', 'L', 'XL', 'XXL'] | ||
}, | ||
_a[RANGESETS.SAP_STANDARD] = { | ||
points: [600, 1024], | ||
unit: 'px', | ||
name: RANGESETS.SAP_STANDARD, | ||
names: ['Phone', 'Tablet', 'Desktop'] | ||
}, | ||
_a[RANGESETS.SAP_STANDARD_EXTENDED] = { | ||
points: [600, 1024, 1440], | ||
unit: 'px', | ||
name: RANGESETS.SAP_STANDARD_EXTENDED, | ||
names: ['Phone', 'Tablet', 'Desktop', 'LargeDesktop'] | ||
}, | ||
_a); | ||
return Media; | ||
}()); | ||
var Orientation = (function () { | ||
function Orientation() { | ||
} | ||
Orientation.prototype.attachHandler = function (fnFunction, oListener) { | ||
EventRegistry.attachEvent('orientation', fnFunction, oListener); | ||
}; | ||
Orientation.prototype.detachHandler = function (fnFunction, oListener) { | ||
EventRegistry.detachEvent('orientation', fnFunction, oListener); | ||
}; | ||
return Orientation; | ||
}()); | ||
var Resize = (function () { | ||
function Resize() { | ||
this.setResizeInfo(); | ||
} | ||
Resize.prototype.attachHandler = function (fnFunction, oListener) { | ||
EventRegistry.attachEvent('resize', fnFunction, oListener); | ||
}; | ||
Resize.prototype.detachHandler = function (fnFunction, oListener) { | ||
EventRegistry.detachEvent('resize', fnFunction, oListener); | ||
}; | ||
Resize.prototype.setResizeInfo = function () { | ||
this.width = windowSize()[0]; | ||
this.height = windowSize()[1]; | ||
}; | ||
return Resize; | ||
}()); | ||
var iResizeTimeout; | ||
var bOrientationChange = false; | ||
var bResize = false; | ||
var iOrientationTimeout; | ||
var iClearFlagTimeout; | ||
var iWindowHeightOld = windowSize()[1]; | ||
var iWindowWidthOld = windowSize()[0]; | ||
var bKeyboardOpen = false; | ||
var iLastResizeTime; | ||
var rInputTagRegex = /INPUT|TEXTAREA|SELECT/; | ||
var bSkipFirstResize; | ||
var DeviceBuilder = (function () { | ||
function DeviceBuilder() { | ||
var _this = this; | ||
this.os = new OS(); | ||
this.browser = new Browser(); | ||
this.support = new Support(this.browser); | ||
this.system = new System(this.os, this.browser, this.support); | ||
this.media = new Media(this.support); | ||
this.orientation = new Orientation(); | ||
this.resize = new Resize(); | ||
this.handleResizeEvent = function () { | ||
var wasL = _this.orientation.landscape; | ||
var isL = _this.isLandscape(false); | ||
if (wasL !== isL) { | ||
_this.handleOrientationChange(); | ||
} | ||
if (!iResizeTimeout) { | ||
iResizeTimeout = window.setTimeout(_this.handleResizeTimeout, 150); | ||
} | ||
}; | ||
this.handleResizeTimeout = function () { | ||
_this.handleResizeChange(); | ||
iResizeTimeout = null; | ||
}; | ||
this.handleResizeChange = function () { | ||
_this.resize.setResizeInfo(); | ||
EventRegistry.fireEvent('resize', { | ||
height: _this.resize.height, | ||
width: _this.resize.width | ||
}); | ||
}; | ||
this.setOrientationInfo = function () { | ||
_this.orientation.landscape = _this.isLandscape(true); | ||
_this.orientation.portrait = !_this.orientation.landscape; | ||
}; | ||
this.handleOrientationChange = function () { | ||
_this.setOrientationInfo(); | ||
EventRegistry.fireEvent('orientation', { landscape: _this.orientation.landscape }); | ||
}; | ||
this.isLandscape = function (bFromOrientationChange) { | ||
if (_this.support.touch && _this.support.orientation && _this.os.android) { | ||
if (bKeyboardOpen && bFromOrientationChange) { | ||
return !_this.orientation.landscape; | ||
} | ||
if (bKeyboardOpen) { | ||
return _this.orientation.landscape; | ||
} | ||
} | ||
else if (_this.support.matchmedia && _this.support.orientation) { | ||
return !!window.matchMedia('(orientation: landscape)').matches; | ||
} | ||
var size = windowSize(); | ||
return size[0] > size[1]; | ||
}; | ||
this.handleMobileOrientationResizeChange = function (evt) { | ||
if (evt.type === 'resize') { | ||
if (bSkipFirstResize && rInputTagRegex.test(document.activeElement.tagName) && !bOrientationChange) { | ||
return; | ||
} | ||
var iWindowHeightNew = windowSize()[1]; | ||
var iWindowWidthNew = windowSize()[0]; | ||
var iTime = new Date().getTime(); | ||
if (iWindowHeightNew === iWindowHeightOld && iWindowWidthNew === iWindowWidthOld) { | ||
return; | ||
} | ||
bResize = true; | ||
if (iWindowHeightOld !== iWindowHeightNew && iWindowWidthOld === iWindowWidthNew) { | ||
if (!iLastResizeTime || iTime - iLastResizeTime > 300) { | ||
bKeyboardOpen = iWindowHeightNew < iWindowHeightOld; | ||
} | ||
_this.handleResizeChange(); | ||
} | ||
else { | ||
iWindowWidthOld = iWindowWidthNew; | ||
} | ||
iLastResizeTime = iTime; | ||
iWindowHeightOld = iWindowHeightNew; | ||
if (iClearFlagTimeout) { | ||
window.clearTimeout(iClearFlagTimeout); | ||
iClearFlagTimeout = null; | ||
} | ||
iClearFlagTimeout = window.setTimeout(DeviceBuilder.clearFlags, 1200); | ||
} | ||
else if (evt.type === 'orientationchange') { | ||
bOrientationChange = true; | ||
} | ||
if (iOrientationTimeout) { | ||
clearTimeout(iOrientationTimeout); | ||
iOrientationTimeout = null; | ||
} | ||
iOrientationTimeout = window.setTimeout(_this.handleMobileTimeout, 50); | ||
}; | ||
this.handleMobileTimeout = function () { | ||
if (bResize && (bOrientationChange || (_this.system.tablet && _this.os.ios && _this.os.version >= 9))) { | ||
_this.handleOrientationChange(); | ||
_this.handleResizeChange(); | ||
bOrientationChange = false; | ||
bResize = false; | ||
if (iClearFlagTimeout) { | ||
window.clearTimeout(iClearFlagTimeout); | ||
iClearFlagTimeout = null; | ||
} | ||
} | ||
iOrientationTimeout = null; | ||
}; | ||
bSkipFirstResize = | ||
this.os.ios && | ||
this.browser.name === 'sf' && | ||
((this.system.phone && this.os.version >= 7 && this.os.version < 7.1) || | ||
(this.system.tablet && this.os.version >= 7)); | ||
if (this.support.touch && this.support.orientation) { | ||
window.addEventListener('resize', this.handleMobileOrientationResizeChange, false); | ||
window.addEventListener('orientationchange', this.handleMobileOrientationResizeChange, false); | ||
} | ||
else { | ||
window.addEventListener('resize', this.handleResizeEvent, false); | ||
} | ||
this.setOrientationInfo(); | ||
} | ||
DeviceBuilder.clearFlags = function () { | ||
bOrientationChange = false; | ||
bResize = false; | ||
iClearFlagTimeout = null; | ||
}; | ||
return DeviceBuilder; | ||
}()); | ||
var Device = new DeviceBuilder(); | ||
var getThemeClassFor = function (theme, themes) { | ||
@@ -271,2 +1401,2 @@ if ({}.hasOwnProperty.call(themes, theme)) { | ||
export { Event, KeyCodes$1 as KeyCodes, LOG_LEVEL, Logger, Optional, StyleClassHelper, Themes$1 as Themes, createThemeMap, deprecationNotice, getThemeClassFor, getThemeOverwrite, pushElementBackInScreen }; | ||
export { Device, Event, KeyCodes$1 as KeyCodes, LOG_LEVEL, Logger, Optional, StyleClassHelper, Themes$1 as Themes, createThemeMap, deprecationNotice, getThemeClassFor, getThemeOverwrite, isNumeric, pushElementBackInScreen }; |
import { __extends } from 'tslib'; | ||
var Event = (function () { | ||
function Event(source, originalEvent, parameters) { | ||
if (parameters === void 0) { parameters = {}; } | ||
this.source = source; | ||
this.originalEvent = originalEvent; | ||
this.parameters = parameters; | ||
this.htmlSource = originalEvent.target; | ||
} | ||
Event.of = function (source, originalEvent, parameters) { | ||
if (parameters === void 0) { parameters = {}; } | ||
return new Event(source, originalEvent, parameters); | ||
}; | ||
Event.prototype.getSource = function () { | ||
return this.source; | ||
}; | ||
Event.prototype.getOriginalEvent = function () { | ||
return this.originalEvent; | ||
}; | ||
Event.prototype.getParameters = function () { | ||
return this.parameters; | ||
}; | ||
Event.prototype.getParameter = function (parameter) { | ||
return this.parameters[parameter]; | ||
}; | ||
Event.prototype.getHtmlSourceElement = function () { | ||
return this.htmlSource; | ||
}; | ||
Event.prototype.cancel = function () { | ||
this.originalEvent.stopPropagation(); | ||
}; | ||
Event.prototype.preventDefault = function () { | ||
this.originalEvent.preventDefault(); | ||
}; | ||
return Event; | ||
}()); | ||
var KeyCodes; | ||
@@ -180,38 +216,1132 @@ (function (KeyCodes) { | ||
var Event = (function () { | ||
function Event(source, originalEvent, parameters) { | ||
if (parameters === void 0) { parameters = {}; } | ||
this.source = source; | ||
this.originalEvent = originalEvent; | ||
this.parameters = parameters; | ||
this.htmlSource = originalEvent.target; | ||
var isNumeric = function (n) { | ||
return !isNaN(parseFloat(n)) && isFinite(n); | ||
}; | ||
!function (e, t, n) { | ||
function r(e, t) { | ||
return typeof e === t; | ||
} | ||
function o() { | ||
var e, t, n, o, i, s, a; | ||
for (var u in y) if (y.hasOwnProperty(u)) { | ||
if (e = [], t = y[u], t.name && (e.push(t.name.toLowerCase()), t.options && t.options.aliases && t.options.aliases.length)) for (n = 0; n < t.options.aliases.length; n++) e.push(t.options.aliases[n].toLowerCase()); | ||
for (o = r(t.fn, 'function') ? t.fn() : t.fn, i = 0; i < e.length; i++) s = e[i], a = s.split('.'), 1 === a.length ? Modernizr[a[0]] = o : (!Modernizr[a[0]] || Modernizr[a[0]] instanceof Boolean || (Modernizr[a[0]] = new Boolean(Modernizr[a[0]])), Modernizr[a[0]][a[1]] = o), C.push((o ? '' : 'no-') + a.join('-')); | ||
} | ||
Event.of = function (source, originalEvent, parameters) { | ||
if (parameters === void 0) { parameters = {}; } | ||
return new Event(source, originalEvent, parameters); | ||
} | ||
function i() { | ||
return 'function' != typeof t.createElement ? t.createElement(arguments[0]) : _ ? t.createElementNS.call(t, 'http://www.w3.org/2000/svg', arguments[0]) : t.createElement.apply(t, arguments); | ||
} | ||
function s() { | ||
var e = t.body; | ||
return e || (e = i(_ ? 'svg' : 'body'), e.fake = !0), e; | ||
} | ||
function a(e, n, r, o) { | ||
var a, | ||
u, | ||
l, | ||
f, | ||
d = 'modernizr', | ||
c = i('div'), | ||
p = s(); | ||
if (parseInt(r, 10)) for (; r--;) l = i('div'), l.id = o ? o[r] : d + (r + 1), c.appendChild(l); | ||
return a = i('style'), a.type = 'text/css', a.id = 's' + d, (p.fake ? p : c).appendChild(a), p.appendChild(c), a.styleSheet ? a.styleSheet.cssText = e : a.appendChild(t.createTextNode(e)), c.id = d, p.fake && (p.style.background = '', p.style.overflow = 'hidden', f = x.style.overflow, x.style.overflow = 'hidden', x.appendChild(p)), u = n(c, e), p.fake ? (p.parentNode.removeChild(p), x.style.overflow = f, x.offsetHeight) : c.parentNode.removeChild(c), !!u; | ||
} | ||
function u(e, t) { | ||
return !!~('' + e).indexOf(t); | ||
} | ||
function l(e) { | ||
return e.replace(/([A-Z])/g, function (e, t) { | ||
return '-' + t.toLowerCase(); | ||
}).replace(/^ms-/, '-ms-'); | ||
} | ||
function f(t, n, r) { | ||
var o; | ||
if ('getComputedStyle' in e) { | ||
o = getComputedStyle.call(e, t, n); | ||
var i = e.console; | ||
if (null !== o) r && (o = o.getPropertyValue(r));else if (i) { | ||
var s = i.error ? 'error' : 'log'; | ||
i[s].call(i, 'getComputedStyle returning null, its possible modernizr test results are inaccurate'); | ||
} | ||
} else o = !n && t.currentStyle && t.currentStyle[r]; | ||
return o; | ||
} | ||
function d(t, r) { | ||
var o = t.length; | ||
if ('CSS' in e && 'supports' in e.CSS) { | ||
for (; o--;) if (e.CSS.supports(l(t[o]), r)) return !0; | ||
return !1; | ||
} | ||
if ('CSSSupportsRule' in e) { | ||
for (var i = []; o--;) i.push('(' + l(t[o]) + ':' + r + ')'); | ||
return i = i.join(' or '), a('@supports (' + i + ') { #modernizr { position: absolute; } }', function (e) { | ||
return 'absolute' == f(e, null, 'position'); | ||
}); | ||
} | ||
return n; | ||
} | ||
function c(e) { | ||
return e.replace(/([a-z])-([a-z])/g, function (e, t, n) { | ||
return t + n.toUpperCase(); | ||
}).replace(/^-/, ''); | ||
} | ||
function p(e, t, o, s) { | ||
function a() { | ||
f && (delete L.style, delete L.modElem); | ||
} | ||
if (s = r(s, 'undefined') ? !1 : s, !r(o, 'undefined')) { | ||
var l = d(e, o); | ||
if (!r(l, 'undefined')) return l; | ||
} | ||
for (var f, p, v, m, h, y = ['modernizr', 'tspan', 'samp']; !L.style && y.length;) f = !0, L.modElem = i(y.shift()), L.style = L.modElem.style; | ||
for (v = e.length, p = 0; v > p; p++) if (m = e[p], h = L.style[m], u(m, '-') && (m = c(m)), L.style[m] !== n) { | ||
if (s || r(o, 'undefined')) return a(), 'pfx' == t ? m : !0; | ||
try { | ||
L.style[m] = o; | ||
} catch (g) {} | ||
if (L.style[m] != h) return a(), 'pfx' == t ? m : !0; | ||
} | ||
return a(), !1; | ||
} | ||
function v(e, t) { | ||
return function () { | ||
return e.apply(t, arguments); | ||
}; | ||
Event.prototype.getSource = function () { | ||
return this.source; | ||
} | ||
function m(e, t, n) { | ||
var o; | ||
for (var i in e) if (e[i] in t) return n === !1 ? e[i] : (o = t[e[i]], r(o, 'function') ? v(o, n || t) : o); | ||
return !1; | ||
} | ||
function h(e, t, n, o, i) { | ||
var s = e.charAt(0).toUpperCase() + e.slice(1), | ||
a = (e + ' ' + P.join(s + ' ') + s).split(' '); | ||
return r(t, 'string') || r(t, 'undefined') ? p(a, t, o, i) : (a = (e + ' ' + w.join(s + ' ') + s).split(' '), m(a, t, n)); | ||
} | ||
var y = [], | ||
g = { | ||
_version: '3.6.0', | ||
_config: { | ||
classPrefix: '', | ||
enableClasses: !0, | ||
enableJSClass: !0, | ||
usePrefixes: !0 | ||
}, | ||
_q: [], | ||
on: function (e, t) { | ||
var n = this; | ||
setTimeout(function () { | ||
t(n[e]); | ||
}, 0); | ||
}, | ||
addTest: function (e, t, n) { | ||
y.push({ | ||
name: e, | ||
fn: t, | ||
options: n | ||
}); | ||
}, | ||
addAsyncTest: function (e) { | ||
y.push({ | ||
name: null, | ||
fn: e | ||
}); | ||
} | ||
}, | ||
Modernizr = function () {}; | ||
Modernizr.prototype = g, Modernizr = new Modernizr(); | ||
var C = [], | ||
S = 'Moz O ms Webkit', | ||
w = g._config.usePrefixes ? S.toLowerCase().split(' ') : []; | ||
g._domPrefixes = w; | ||
var x = t.documentElement, | ||
_ = 'svg' === x.nodeName.toLowerCase(), | ||
b = function () { | ||
function e(e, t) { | ||
var o; | ||
return e ? (t && 'string' != typeof t || (t = i(t || 'div')), e = 'on' + e, o = e in t, !o && r && (t.setAttribute || (t = i('div')), t.setAttribute(e, ''), o = 'function' == typeof t[e], t[e] !== n && (t[e] = n), t.removeAttribute(e)), o) : !1; | ||
} | ||
var r = !('onblur' in t.documentElement); | ||
return e; | ||
}(); | ||
g.hasEvent = b, Modernizr.addTest('pointerevents', function () { | ||
var e = !1, | ||
t = w.length; | ||
for (e = Modernizr.hasEvent('pointerdown'); t-- && !e;) b(w[t] + 'pointerdown') && (e = !0); | ||
return e; | ||
}); | ||
var T = g._config.usePrefixes ? ' -webkit- -moz- -o- -ms- '.split(' ') : ['', '']; | ||
g._prefixes = T; | ||
var E = g.testStyles = a; | ||
Modernizr.addTest('touchevents', function () { | ||
var n; | ||
if ('ontouchstart' in e || e.DocumentTouch && t instanceof DocumentTouch) n = !0;else { | ||
var r = ['@media (', T.join('touch-enabled),('), 'heartz', ')', '{#modernizr{top:9px;position:absolute}}'].join(''); | ||
E(r, function (e) { | ||
n = 9 === e.offsetTop; | ||
}); | ||
} | ||
return n; | ||
}); | ||
var z = !1; | ||
try { | ||
z = 'WebSocket' in e && 2 === e.WebSocket.CLOSING; | ||
} catch (k) {} | ||
Modernizr.addTest('websockets', z), Modernizr.addTest('devicemotion', 'DeviceMotionEvent' in e), Modernizr.addTest('deviceorientation', 'DeviceOrientationEvent' in e), Modernizr.addTest('placeholder', 'placeholder' in i('input') && 'placeholder' in i('textarea')); | ||
var P = g._config.usePrefixes ? S.split(' ') : []; | ||
g._cssomPrefixes = P; | ||
var A = { | ||
elem: i('modernizr') | ||
}; | ||
Modernizr._q.push(function () { | ||
delete A.elem; | ||
}); | ||
var L = { | ||
style: A.elem.style | ||
}; | ||
Modernizr._q.unshift(function () { | ||
delete L.style; | ||
}), g.testAllProps = h; | ||
var O = function (t) { | ||
var r, | ||
o = T.length, | ||
i = e.CSSRule; | ||
if ('undefined' == typeof i) return n; | ||
if (!t) return !1; | ||
if (t = t.replace(/^@/, ''), r = t.replace(/-/g, '_').toUpperCase() + '_RULE', r in i) return '@' + t; | ||
for (var s = 0; o > s; s++) { | ||
var a = T[s], | ||
u = a.toUpperCase() + '_' + r; | ||
if (u in i) return '@-' + a.toLowerCase() + '-' + t; | ||
} | ||
return !1; | ||
}; | ||
g.atRule = O; | ||
var N = g.prefixed = function (e, t, n) { | ||
return 0 === e.indexOf('@') ? O(e) : (-1 != e.indexOf('-') && (e = c(e)), t ? h(e, t, n) : h(e, 'pfx')); | ||
}; | ||
Modernizr.addTest('matchmedia', !!N('matchMedia', e)), o(), delete g.addTest, delete g.addAsyncTest; | ||
for (var j = 0; j < Modernizr._q.length; j++) Modernizr._q[j](); | ||
e.Modernizr = Modernizr; | ||
}(window, document); | ||
var Support = (function () { | ||
function Support(browser) { | ||
this.input = { | ||
placeholder: false | ||
}; | ||
this.touch = Modernizr.touchevents; | ||
this.pointer = Modernizr.pointerevents; | ||
this.matchmedia = Modernizr.matchmedia; | ||
var matchmedialistener = !!(this.matchmedia && window.matchMedia('all and (max-width:0px)')); | ||
if (browser.safari && browser.version < 6 && !browser.fullscreen && !browser.webview) { | ||
matchmedialistener = false; | ||
} | ||
this.matchmedialistener = matchmedialistener; | ||
this.orientation = Modernizr.deviceorientation; | ||
this.retina = window.retina || window.devicePixelRatio >= 2; | ||
this.websocket = Modernizr.websockets; | ||
this.input.placeholder = Modernizr.placeholder; | ||
return this; | ||
} | ||
return Support; | ||
}()); | ||
var OSTypes; | ||
(function (OSTypes) { | ||
OSTypes["WINDOWS"] = "win"; | ||
OSTypes["MACINTOSH"] = "mac"; | ||
OSTypes["LINUX"] = "linux"; | ||
OSTypes["IOS"] = "iOS"; | ||
OSTypes["ANDROID"] = "Android"; | ||
OSTypes["BLACKBERRY"] = "bb"; | ||
OSTypes["WINDOWS_PHONE"] = "winphone"; | ||
})(OSTypes || (OSTypes = {})); | ||
var OS = (function () { | ||
function OS(customUA) { | ||
var _this = this; | ||
this.OS = OSTypes; | ||
this.getDesktopOS = function (customUA) { | ||
var userAgent = customUA || navigator.userAgent; | ||
var pf = navigator.platform; | ||
if (pf.indexOf('Win') != -1) { | ||
var rVersion = /Windows NT (\d+).(\d)/i; | ||
var uaResult = userAgent.match(rVersion); | ||
var sVersionStr = ''; | ||
if (uaResult[1] == '6') { | ||
if (uaResult[2] == 1) { | ||
sVersionStr = '7'; | ||
} | ||
else if (uaResult[2] > 1) { | ||
sVersionStr = '8'; | ||
} | ||
} | ||
else { | ||
sVersionStr = uaResult[1]; | ||
} | ||
_this.name = OSTypes.WINDOWS; | ||
_this.versionStr = sVersionStr; | ||
return _this; | ||
} | ||
if (pf.indexOf('Mac') != -1) { | ||
_this.name = OSTypes.MACINTOSH; | ||
_this.versionStr = ''; | ||
return _this; | ||
} | ||
if (pf.indexOf('Linux') != -1) { | ||
_this.name = OSTypes.LINUX; | ||
_this.versionStr = ''; | ||
return _this; | ||
} | ||
Logger.info('OS detection returned no result'); | ||
return null; | ||
}; | ||
this.setOS(customUA); | ||
} | ||
OS.prototype.setOS = function (customUA) { | ||
this.getOS(customUA); | ||
this.version = this.versionStr ? parseFloat(this.versionStr) : -1; | ||
if (this.name) { | ||
for (var os in OSTypes) { | ||
if (OSTypes[os] === this.name) { | ||
this[os.toLowerCase()] = true; | ||
} | ||
} | ||
} | ||
}; | ||
Event.prototype.getOriginalEvent = function () { | ||
return this.originalEvent; | ||
OS.prototype.getOS = function (customUA) { | ||
var platform; | ||
var result; | ||
var userAgent = customUA || navigator.userAgent; | ||
platform = /Windows Phone (?:OS )?([\d.]*)/; | ||
result = userAgent.match(platform); | ||
if (result) { | ||
this.name = OSTypes.WINDOWS_PHONE; | ||
this.versionStr = result[1]; | ||
return this; | ||
} | ||
if (userAgent.indexOf('(BB10;') > 0) { | ||
platform = /\sVersion\/([\d.]+)\s/; | ||
result = userAgent.match(platform); | ||
if (result) { | ||
this.name = OSTypes.BLACKBERRY; | ||
this.versionStr = result[1]; | ||
return this; | ||
} | ||
this.name = OSTypes.BLACKBERRY; | ||
this.versionStr = '10'; | ||
return this; | ||
} | ||
platform = /\(([a-zA-Z ]+);\s(?:[U]?[;]?)([\D]+)((?:[\d._]*))(?:.*[\)][^\d]*)([\d.]*)\s/; | ||
result = userAgent.match(platform); | ||
if (result) { | ||
var appleDevices = /iPhone|iPad|iPod/; | ||
var bbDevices = /PlayBook|BlackBerry/; | ||
if (result[0].match(appleDevices)) { | ||
result[3] = result[3].replace(/_/g, '.'); | ||
this.name = OSTypes.IOS; | ||
this.versionStr = result[3]; | ||
return this; | ||
} | ||
if (result[2].match(/Android/)) { | ||
result[2] = result[2].replace(/\s/g, ''); | ||
this.name = OSTypes.ANDROID; | ||
this.versionStr = result[3]; | ||
return this; | ||
} | ||
if (result[0].match(bbDevices)) { | ||
this.name = OSTypes.BLACKBERRY; | ||
this.versionStr = result[4]; | ||
return this; | ||
} | ||
} | ||
platform = /\((Android)[\s]?([\d][.\d]*)?;.*Firefox\/[\d][.\d]*/; | ||
result = userAgent.match(platform); | ||
if (result) { | ||
this.name = OSTypes.ANDROID; | ||
this.versionStr = result.length == 3 ? result[2] : ''; | ||
return this; | ||
} | ||
return this.getDesktopOS(customUA); | ||
}; | ||
Event.prototype.getParameters = function () { | ||
return this.parameters; | ||
return OS; | ||
}()); | ||
var BROWSER; | ||
(function (BROWSER) { | ||
BROWSER["INTERNET_EXPLORER"] = "ie"; | ||
BROWSER["EDGE"] = "ed"; | ||
BROWSER["FIREFOX"] = "ff"; | ||
BROWSER["CHROME"] = "cr"; | ||
BROWSER["SAFARI"] = "sf"; | ||
BROWSER["ANDROID"] = "an"; | ||
})(BROWSER || (BROWSER = {})); | ||
var Browser = (function () { | ||
function Browser() { | ||
this.BROWSER = BROWSER; | ||
this.setBrowser(); | ||
} | ||
Browser.calcBrowser = function (customUa) { | ||
var ua = navigator.userAgent; | ||
var _ua = (customUa || ua).toLowerCase(); | ||
var rwebkit = /(webkit)[ \/]([\w.]+)/; | ||
var ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/; | ||
var rmsie = /(msie) ([\w.]+)/; | ||
var rmsie11 = /(trident)\/[\w.]+;.*rv:([\w.]+)/; | ||
var redge = /(edge)[ \/]([\w.]+)/; | ||
var rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/; | ||
var browserMatch = redge.exec(_ua) || | ||
rmsie11.exec(_ua) || | ||
rwebkit.exec(_ua) || | ||
ropera.exec(_ua) || | ||
rmsie.exec(_ua) || | ||
(_ua.indexOf('compatible') < 0 && rmozilla.exec(_ua)) || | ||
[]; | ||
var res = { | ||
browser: browserMatch[1] || '', | ||
version: browserMatch[2] || '0' | ||
}; | ||
res[res.browser] = true; | ||
return res; | ||
}; | ||
Event.prototype.getParameter = function (parameter) { | ||
return this.parameters[parameter]; | ||
Browser.prototype.getBrowser = function (customUa, customNav) { | ||
var ua = navigator.userAgent; | ||
var b = Browser.calcBrowser(customUa); | ||
var _ua = customUa || ua; | ||
var _navigator = customNav || window.navigator; | ||
var oExpMobile; | ||
if (b.mozilla) { | ||
oExpMobile = /Mobile/; | ||
if (_ua.match(/Firefox\/(\d+\.\d+)/)) { | ||
var version = parseFloat(RegExp.$1); | ||
this.name = BROWSER.FIREFOX; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.mozilla = true; | ||
this.mobile = oExpMobile.test(_ua); | ||
return this; | ||
} | ||
this.mobile = oExpMobile.test(_ua); | ||
this.mozilla = true; | ||
this.version = -1; | ||
} | ||
if (b.webkit) { | ||
var regExpWebkitVersion = _ua.toLowerCase().match(/webkit[\/]([\d.]+)/); | ||
var webkitVersion = void 0; | ||
if (regExpWebkitVersion) { | ||
webkitVersion = regExpWebkitVersion[1]; | ||
} | ||
oExpMobile = /Mobile/; | ||
if (_ua.match(/(Chrome|CriOS)\/(\d+\.\d+).\d+/)) { | ||
var version = parseFloat(RegExp.$2); | ||
this.name = BROWSER.CHROME; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.mobile = oExpMobile.test(_ua); | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
return this; | ||
} | ||
if (_ua.match(/FxiOS\/(\d+\.\d+)/)) { | ||
var version = parseFloat(RegExp.$1); | ||
this.name = BROWSER.FIREFOX; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.mobile = true; | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
return this; | ||
} | ||
if (_ua.match(/Android .+ Version\/(\d+\.\d+)/)) { | ||
var version = parseFloat(RegExp.$1); | ||
this.name = BROWSER.ANDROID; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.mobile = oExpMobile.test(_ua); | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
return this; | ||
} | ||
var oExp = /(Version|PhantomJS)\/(\d+\.\d+).*Safari/; | ||
var bStandalone = _navigator.standalone; | ||
if (oExp.test(_ua)) { | ||
var aParts = oExp.exec(_ua); | ||
var version = parseFloat(aParts[2]); | ||
this.name = BROWSER.SAFARI; | ||
this.versionStr = "" + version; | ||
this.fullscreen = false; | ||
this.webview = false; | ||
this.version = version; | ||
this.mobile = oExpMobile.test(_ua); | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
this.phantomJS = aParts[1] === 'PhantomJS'; | ||
return this; | ||
} | ||
if (/iPhone|iPad|iPod/.test(_ua) && | ||
!/CriOS/.test(_ua) && | ||
!/FxiOS/.test(_ua) && | ||
(bStandalone === true || bStandalone === false)) { | ||
this.name = BROWSER.SAFARI; | ||
this.version = -1; | ||
this.fullscreen = bStandalone; | ||
this.webview = bStandalone; | ||
this.mobile = oExpMobile.test(_ua); | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
return this; | ||
} | ||
this.mobile = oExpMobile.test(_ua); | ||
this.webkit = true; | ||
this.webkitVersion = webkitVersion; | ||
this.version = -1; | ||
return this; | ||
} | ||
if (b.msie || b.trident) { | ||
var version = void 0; | ||
if (document.documentMode && !customUa) { | ||
if (document.documentMode === 7) { | ||
version = 8.0; | ||
} | ||
else { | ||
version = parseFloat(document.documentMode); | ||
} | ||
} | ||
else { | ||
version = parseFloat(b.version); | ||
} | ||
this.name = BROWSER.INTERNET_EXPLORER; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.msie = true; | ||
this.mobile = false; | ||
return this; | ||
} | ||
if (b.edge) { | ||
var version = parseFloat(b.version); | ||
this.name = BROWSER.EDGE; | ||
this.versionStr = "" + version; | ||
this.version = version; | ||
this.edge = true; | ||
return this; | ||
} | ||
this.name = ''; | ||
this.versionStr = ''; | ||
this.version = -1; | ||
this.mobile = false; | ||
return this; | ||
}; | ||
Event.prototype.getHtmlSourceElement = function () { | ||
return this.htmlSource; | ||
Browser.prototype.setBrowser = function () { | ||
this.getBrowser(); | ||
if (this.name) { | ||
for (var b in BROWSER) { | ||
if (BROWSER[b] === this.name) { | ||
this[b.toLowerCase()] = true; | ||
} | ||
} | ||
} | ||
}; | ||
Event.prototype.cancel = function () { | ||
this.originalEvent.stopPropagation(); | ||
return Browser; | ||
}()); | ||
var windowSize = function () { | ||
return [window.innerWidth, window.innerHeight]; | ||
}; | ||
var changeRootCSSClass = function (sClassName, bRemove, sPrefix) { | ||
var oRoot = document.documentElement; | ||
if (oRoot.className.length === 0) { | ||
if (!bRemove) { | ||
oRoot.className = sClassName; | ||
} | ||
} | ||
else { | ||
var aCurrentClasses = oRoot.className.split(' '); | ||
var sNewClasses_1 = ''; | ||
aCurrentClasses.forEach(function (currentClass) { | ||
if ((sPrefix && currentClass.indexOf(sPrefix) !== 0) || (!sPrefix && currentClass !== sClassName)) { | ||
sNewClasses_1 = sNewClasses_1 + currentClass + " "; | ||
} | ||
}); | ||
if (!bRemove) { | ||
sNewClasses_1 += sClassName; | ||
} | ||
oRoot.className = sNewClasses_1; | ||
} | ||
}; | ||
var getQuery = function (from, to, unit) { | ||
unit = unit || 'px'; | ||
var q = 'all'; | ||
if (from > 0) { | ||
q = q + " and (min-width:" + from + unit + ")"; | ||
} | ||
if (to > 0) { | ||
q = q + " and (max-width:" + to + unit + ")"; | ||
} | ||
return q; | ||
}; | ||
var convertToPx = function (val, unit) { | ||
if (unit === 'em' || unit === 'rem') { | ||
var s = window.getComputedStyle || | ||
function (e) { | ||
return e.currentStyle; | ||
}; | ||
var x = s(document.documentElement).fontSize; | ||
var f = x && x.indexOf('px') >= 0 ? parseFloat(x, 10) : 16; | ||
return val * f; | ||
} | ||
return val; | ||
}; | ||
var matchLegacyBySize = function (from, to, unit, size) { | ||
from = convertToPx(from, unit); | ||
to = convertToPx(to, unit); | ||
var width = size[0]; | ||
var a = from < 0 || from <= width; | ||
var b = to < 0 || width <= to; | ||
return a && b; | ||
}; | ||
var SYSTEMTYPE; | ||
(function (SYSTEMTYPE) { | ||
SYSTEMTYPE["TABLET"] = "tablet"; | ||
SYSTEMTYPE["PHONE"] = "phone"; | ||
SYSTEMTYPE["DESKTOP"] = "desktop"; | ||
SYSTEMTYPE["COMBI"] = "combi"; | ||
})(SYSTEMTYPE || (SYSTEMTYPE = {})); | ||
var os; | ||
var browser; | ||
var support; | ||
var System = (function () { | ||
function System(osInstance, browserInstance, supportInstance) { | ||
this.SYSTEMTYPE = SYSTEMTYPE; | ||
os = osInstance; | ||
browser = browserInstance; | ||
support = supportInstance; | ||
this.setSystem(); | ||
return this; | ||
} | ||
System.prototype.getSystem = function (customUA) { | ||
var _this = this; | ||
var t = this.isTablet(customUA); | ||
var isWin8Upwards = os.windows && os.version >= 8; | ||
var isWin7 = os.windows && os.version === 7; | ||
this.tablet = !!(((support.touch && !isWin7) || isWin8Upwards) && t); | ||
this.phone = !!(os.windows_phone || (support.touch && !isWin7 && !t)); | ||
this.desktop = !!((!this.tablet && !this.phone) || isWin8Upwards || isWin7); | ||
this.combi = !!(this.desktop && this.tablet); | ||
Object.values(SYSTEMTYPE).forEach(function (type) { | ||
changeRootCSSClass("sap-" + type, !_this[type]); | ||
}); | ||
}; | ||
Event.prototype.preventDefault = function () { | ||
this.originalEvent.preventDefault(); | ||
System.prototype.isTablet = function (customUA) { | ||
var ua = customUA || navigator.userAgent; | ||
var isWin8Upwards = os.windows && os.version >= 8; | ||
if (os.name === os.OS.IOS) { | ||
return /ipad/i.test(ua); | ||
} | ||
if (support.touch) { | ||
if (isWin8Upwards) { | ||
return true; | ||
} | ||
if (browser.chrome && os.android && os.version >= 4.4) { | ||
return !/Mobile Safari\/[.0-9]+/.test(ua); | ||
} | ||
var densityFactor = window.devicePixelRatio ? window.devicePixelRatio : 1; | ||
if (os.android && browser.webkit && parseFloat(browser.webkitVersion) > 537.1) { | ||
densityFactor = 1; | ||
} | ||
var bTablet = Math.min(window.screen.width / densityFactor, window.screen.height / densityFactor) >= 600; | ||
if ((window.screen.height === 552 || window.screen.height === 553) && | ||
/Nexus 7/i.test(ua)) { | ||
bTablet = true; | ||
} | ||
return bTablet; | ||
} | ||
var androidPhone = /(?=android)(?=.*mobile)/i.test(ua); | ||
return (browser.msie && ua.indexOf('Touch') !== -1) || (os.android && !androidPhone); | ||
}; | ||
return Event; | ||
System.prototype.setSystem = function (customUA) { | ||
this.getSystem(customUA); | ||
if (this.tablet || this.phone) { | ||
browser.mobile = true; | ||
} | ||
}; | ||
return System; | ||
}()); | ||
var EventRegistry = (function () { | ||
function EventRegistry() { | ||
} | ||
EventRegistry.attachEvent = function (sEventId, fnFunction, oListener) { | ||
if (!EventRegistry.mEventRegistry[sEventId]) { | ||
EventRegistry.mEventRegistry[sEventId] = []; | ||
} | ||
EventRegistry.mEventRegistry[sEventId].push({ | ||
oListener: oListener, | ||
fFunction: fnFunction | ||
}); | ||
}; | ||
EventRegistry.detachEvent = function (sEventId, fnFunction, oListener) { | ||
var aEventListeners = EventRegistry.mEventRegistry[sEventId]; | ||
if (!aEventListeners) { | ||
return; | ||
} | ||
for (var i = 0, iL = aEventListeners.length; i < iL; i++) { | ||
if (aEventListeners[i].fFunction === fnFunction && aEventListeners[i].oListener === oListener) { | ||
aEventListeners.splice(i, 1); | ||
break; | ||
} | ||
} | ||
if (aEventListeners.length === 0) { | ||
delete EventRegistry.mEventRegistry[sEventId]; | ||
} | ||
}; | ||
EventRegistry.fireEvent = function (sEventId, mParameters) { | ||
var aEventListeners = EventRegistry.mEventRegistry[sEventId]; | ||
var oInfo; | ||
if (aEventListeners) { | ||
aEventListeners = aEventListeners.slice(); | ||
for (var i = 0, iL = aEventListeners.length; i < iL; i++) { | ||
oInfo = aEventListeners[i]; | ||
oInfo.fFunction.call(oInfo.oListener || window, mParameters); | ||
} | ||
} | ||
}; | ||
EventRegistry.mEventRegistry = {}; | ||
return EventRegistry; | ||
}()); | ||
var _a; | ||
var RANGESETS; | ||
(function (RANGESETS) { | ||
RANGESETS["SAP_3STEPS"] = "3Step"; | ||
RANGESETS["SAP_4STEPS"] = "4Step"; | ||
RANGESETS["SAP_6STEPS"] = "6Step"; | ||
RANGESETS["SAP_STANDARD"] = "Std"; | ||
RANGESETS["SAP_STANDARD_EXTENDED"] = "StdExt"; | ||
})(RANGESETS || (RANGESETS = {})); | ||
var support$1; | ||
var defaultRangeSet = RANGESETS.SAP_STANDARD; | ||
var querysets = {}; | ||
var mediaCurrentwidth = null; | ||
var matchLegacy = function (from, to, unit) { return matchLegacyBySize(from, to, unit, windowSize()); }; | ||
var match = function (from, to, unit) { | ||
var q = getQuery(from, to, unit); | ||
var mm = window.matchMedia(q); | ||
return mm && mm.matches; | ||
}; | ||
var refreshCSSClasses = function (sSetName, sRangeName, bRemove) { | ||
var sClassPrefix = "sapUiMedia-" + sSetName + "-"; | ||
changeRootCSSClass(sClassPrefix + sRangeName, bRemove, sClassPrefix); | ||
}; | ||
var Media = (function () { | ||
function Media(supportInstance) { | ||
this.RANGESETS = RANGESETS; | ||
support$1 = supportInstance; | ||
this.media_timeout = support$1.matchmedialistener ? 0 : 100; | ||
this.matches = support$1.matchmedia ? match : matchLegacy; | ||
this.initRangeSet(); | ||
this.initRangeSet(RANGESETS.SAP_STANDARD_EXTENDED); | ||
} | ||
Media.getRangeInfo = function (sSetName, iRangeIdx) { | ||
var q = querysets[sSetName].queries[iRangeIdx]; | ||
var info = { from: q.from, unit: querysets[sSetName].unit }; | ||
if (q.to >= 0) { | ||
info.to = q.to; | ||
} | ||
if (querysets[sSetName].names) { | ||
info.name = querysets[sSetName].names[iRangeIdx]; | ||
} | ||
return info; | ||
}; | ||
Media.prototype.checkQueries = function (name, infoOnly, fnMatches) { | ||
fnMatches = fnMatches || this.matches; | ||
if (querysets[name]) { | ||
var aQueries = querysets[name].queries; | ||
var info = null; | ||
for (var i = 0, len = aQueries.length; i < len; i++) { | ||
var q = aQueries[i]; | ||
if ((q !== querysets[name].currentquery || infoOnly) && fnMatches(q.from, q.to, querysets[name].unit)) { | ||
if (!infoOnly) { | ||
querysets[name].currentquery = q; | ||
} | ||
if (!querysets[name].noClasses && querysets[name].names && !infoOnly) { | ||
refreshCSSClasses(name, querysets[name].names[i]); | ||
} | ||
info = Media.getRangeInfo(name, i); | ||
} | ||
} | ||
return info; | ||
} | ||
Logger.warning("No queryset with name " + name + " found", 'DEVICE.MEDIA'); | ||
return null; | ||
}; | ||
Media.prototype.handleChange = function (name) { | ||
var _this = this; | ||
if (!support$1.matchmedialistener && mediaCurrentwidth === windowSize()[0]) { | ||
return; | ||
} | ||
if (querysets[name].timer) { | ||
clearTimeout(querysets[name].timer); | ||
querysets[name].timer = null; | ||
} | ||
querysets[name].timer = setTimeout(function () { | ||
var mParams = _this.checkQueries(name, false); | ||
if (mParams) { | ||
EventRegistry.fireEvent("media_" + name, mParams); | ||
} | ||
}, this.media_timeout); | ||
}; | ||
Media.prototype.attachHandler = function (fnFunction, oListener, sName) { | ||
var name = sName || defaultRangeSet; | ||
EventRegistry.attachEvent("media_" + name, fnFunction, oListener); | ||
}; | ||
Media.prototype.detachHandler = function (fnFunction, oListener, sName) { | ||
var name = sName || defaultRangeSet; | ||
EventRegistry.detachEvent("media_" + name, fnFunction, oListener); | ||
}; | ||
Media.prototype.initRangeSet = function (sName, aRangeBorders, sUnit, aRangeNames, bSuppressClasses) { | ||
var _this = this; | ||
var oConfig; | ||
if (!sName) { | ||
oConfig = Media.predefinedRangeSets[defaultRangeSet]; | ||
} | ||
else if (sName && Media.predefinedRangeSets[sName]) { | ||
oConfig = Media.predefinedRangeSets[sName]; | ||
} | ||
else { | ||
oConfig = { | ||
name: sName, | ||
unit: (sUnit || 'px').toLowerCase(), | ||
points: aRangeBorders || [], | ||
names: aRangeNames, | ||
noClasses: !!bSuppressClasses | ||
}; | ||
} | ||
if (this.hasRangeSet(oConfig.name)) { | ||
Logger.info("Range set " + oConfig.name + " has already been initialized", 'DEVICE.MEDIA'); | ||
return; | ||
} | ||
sName = oConfig.name; | ||
oConfig.queries = []; | ||
oConfig.timer = null; | ||
oConfig.currentquery = null; | ||
oConfig.listener = function () { return _this.handleChange(sName); }; | ||
var from, to, query; | ||
var aPoints = oConfig.points; | ||
for (var i = 0, len = aPoints.length; i <= len; i++) { | ||
from = i === 0 ? 0 : aPoints[i - 1]; | ||
to = i === aPoints.length ? -1 : aPoints[i]; | ||
query = getQuery(from, to, oConfig.unit); | ||
oConfig.queries.push({ | ||
query: query, | ||
from: from, | ||
to: to | ||
}); | ||
} | ||
if (oConfig.names && oConfig.names.length !== oConfig.queries.length) { | ||
oConfig.names = null; | ||
} | ||
querysets[oConfig.name] = oConfig; | ||
if (support$1.matchmedialistener) { | ||
var queries = oConfig.queries; | ||
for (var i = 0; i < queries.length; i++) { | ||
var q = queries[i]; | ||
q.media = window.matchMedia(q.query); | ||
q.media.addListener(oConfig.listener); | ||
} | ||
} | ||
else { | ||
window.addEventListener('resize', oConfig.listener, false); | ||
window.addEventListener('orientationchange', oConfig.listener, false); | ||
} | ||
oConfig.listener(); | ||
}; | ||
Media.prototype.getCurrentRange = function (sName, iWidth) { | ||
if (!this.hasRangeSet(sName)) { | ||
return null; | ||
} | ||
return this.checkQueries(sName, true, isNaN(iWidth) ? null : function (from, to, unit) { return matchLegacyBySize(from, to, unit, [iWidth, 0]); }); | ||
}; | ||
Media.prototype.hasRangeSet = function (sName) { | ||
return sName && !!querysets[sName]; | ||
}; | ||
Media.prototype.removeRangeSet = function (sName) { | ||
if (!this.hasRangeSet(sName)) { | ||
Logger.info("RangeSet " + sName + " not found, thus could not be removed.", 'DEVICE.MEDIA'); | ||
return; | ||
} | ||
for (var x in RANGESETS) { | ||
if (sName === RANGESETS[x]) { | ||
Logger.warning('Cannot remove default rangeset - no action taken.', 'DEVICE.MEDIA'); | ||
return; | ||
} | ||
} | ||
var oConfig = querysets[sName]; | ||
if (support$1.matchmedialistener) { | ||
var queries = oConfig.queries; | ||
for (var i = 0; i < queries.length; i++) { | ||
queries[i].media.removeListener(oConfig.listener); | ||
} | ||
} | ||
else { | ||
window.removeEventListener('resize', oConfig.listener, false); | ||
window.removeEventListener('orientationchange', oConfig.listener, false); | ||
} | ||
refreshCSSClasses(sName, '', true); | ||
delete EventRegistry.mEventRegistry["media_" + sName]; | ||
delete querysets[sName]; | ||
}; | ||
Media.predefinedRangeSets = (_a = {}, | ||
_a[RANGESETS.SAP_3STEPS] = { | ||
points: [520, 960], | ||
unit: 'px', | ||
name: RANGESETS.SAP_3STEPS, | ||
names: ['S', 'M', 'L'] | ||
}, | ||
_a[RANGESETS.SAP_4STEPS] = { | ||
points: [520, 760, 960], | ||
unit: 'px', | ||
name: RANGESETS.SAP_4STEPS, | ||
names: ['S', 'M', 'L', 'XL'] | ||
}, | ||
_a[RANGESETS.SAP_6STEPS] = { | ||
points: [241, 400, 541, 768, 960], | ||
unit: 'px', | ||
name: RANGESETS.SAP_6STEPS, | ||
names: ['XS', 'S', 'M', 'L', 'XL', 'XXL'] | ||
}, | ||
_a[RANGESETS.SAP_STANDARD] = { | ||
points: [600, 1024], | ||
unit: 'px', | ||
name: RANGESETS.SAP_STANDARD, | ||
names: ['Phone', 'Tablet', 'Desktop'] | ||
}, | ||
_a[RANGESETS.SAP_STANDARD_EXTENDED] = { | ||
points: [600, 1024, 1440], | ||
unit: 'px', | ||
name: RANGESETS.SAP_STANDARD_EXTENDED, | ||
names: ['Phone', 'Tablet', 'Desktop', 'LargeDesktop'] | ||
}, | ||
_a); | ||
return Media; | ||
}()); | ||
var Orientation = (function () { | ||
function Orientation() { | ||
} | ||
Orientation.prototype.attachHandler = function (fnFunction, oListener) { | ||
EventRegistry.attachEvent('orientation', fnFunction, oListener); | ||
}; | ||
Orientation.prototype.detachHandler = function (fnFunction, oListener) { | ||
EventRegistry.detachEvent('orientation', fnFunction, oListener); | ||
}; | ||
return Orientation; | ||
}()); | ||
var Resize = (function () { | ||
function Resize() { | ||
this.setResizeInfo(); | ||
} | ||
Resize.prototype.attachHandler = function (fnFunction, oListener) { | ||
EventRegistry.attachEvent('resize', fnFunction, oListener); | ||
}; | ||
Resize.prototype.detachHandler = function (fnFunction, oListener) { | ||
EventRegistry.detachEvent('resize', fnFunction, oListener); | ||
}; | ||
Resize.prototype.setResizeInfo = function () { | ||
this.width = windowSize()[0]; | ||
this.height = windowSize()[1]; | ||
}; | ||
return Resize; | ||
}()); | ||
var iResizeTimeout; | ||
var bOrientationChange = false; | ||
var bResize = false; | ||
var iOrientationTimeout; | ||
var iClearFlagTimeout; | ||
var iWindowHeightOld = windowSize()[1]; | ||
var iWindowWidthOld = windowSize()[0]; | ||
var bKeyboardOpen = false; | ||
var iLastResizeTime; | ||
var rInputTagRegex = /INPUT|TEXTAREA|SELECT/; | ||
var bSkipFirstResize; | ||
var DeviceBuilder = (function () { | ||
function DeviceBuilder() { | ||
var _this = this; | ||
this.os = new OS(); | ||
this.browser = new Browser(); | ||
this.support = new Support(this.browser); | ||
this.system = new System(this.os, this.browser, this.support); | ||
this.media = new Media(this.support); | ||
this.orientation = new Orientation(); | ||
this.resize = new Resize(); | ||
this.handleResizeEvent = function () { | ||
var wasL = _this.orientation.landscape; | ||
var isL = _this.isLandscape(false); | ||
if (wasL !== isL) { | ||
_this.handleOrientationChange(); | ||
} | ||
if (!iResizeTimeout) { | ||
iResizeTimeout = window.setTimeout(_this.handleResizeTimeout, 150); | ||
} | ||
}; | ||
this.handleResizeTimeout = function () { | ||
_this.handleResizeChange(); | ||
iResizeTimeout = null; | ||
}; | ||
this.handleResizeChange = function () { | ||
_this.resize.setResizeInfo(); | ||
EventRegistry.fireEvent('resize', { | ||
height: _this.resize.height, | ||
width: _this.resize.width | ||
}); | ||
}; | ||
this.setOrientationInfo = function () { | ||
_this.orientation.landscape = _this.isLandscape(true); | ||
_this.orientation.portrait = !_this.orientation.landscape; | ||
}; | ||
this.handleOrientationChange = function () { | ||
_this.setOrientationInfo(); | ||
EventRegistry.fireEvent('orientation', { landscape: _this.orientation.landscape }); | ||
}; | ||
this.isLandscape = function (bFromOrientationChange) { | ||
if (_this.support.touch && _this.support.orientation && _this.os.android) { | ||
if (bKeyboardOpen && bFromOrientationChange) { | ||
return !_this.orientation.landscape; | ||
} | ||
if (bKeyboardOpen) { | ||
return _this.orientation.landscape; | ||
} | ||
} | ||
else if (_this.support.matchmedia && _this.support.orientation) { | ||
return !!window.matchMedia('(orientation: landscape)').matches; | ||
} | ||
var size = windowSize(); | ||
return size[0] > size[1]; | ||
}; | ||
this.handleMobileOrientationResizeChange = function (evt) { | ||
if (evt.type === 'resize') { | ||
if (bSkipFirstResize && rInputTagRegex.test(document.activeElement.tagName) && !bOrientationChange) { | ||
return; | ||
} | ||
var iWindowHeightNew = windowSize()[1]; | ||
var iWindowWidthNew = windowSize()[0]; | ||
var iTime = new Date().getTime(); | ||
if (iWindowHeightNew === iWindowHeightOld && iWindowWidthNew === iWindowWidthOld) { | ||
return; | ||
} | ||
bResize = true; | ||
if (iWindowHeightOld !== iWindowHeightNew && iWindowWidthOld === iWindowWidthNew) { | ||
if (!iLastResizeTime || iTime - iLastResizeTime > 300) { | ||
bKeyboardOpen = iWindowHeightNew < iWindowHeightOld; | ||
} | ||
_this.handleResizeChange(); | ||
} | ||
else { | ||
iWindowWidthOld = iWindowWidthNew; | ||
} | ||
iLastResizeTime = iTime; | ||
iWindowHeightOld = iWindowHeightNew; | ||
if (iClearFlagTimeout) { | ||
window.clearTimeout(iClearFlagTimeout); | ||
iClearFlagTimeout = null; | ||
} | ||
iClearFlagTimeout = window.setTimeout(DeviceBuilder.clearFlags, 1200); | ||
} | ||
else if (evt.type === 'orientationchange') { | ||
bOrientationChange = true; | ||
} | ||
if (iOrientationTimeout) { | ||
clearTimeout(iOrientationTimeout); | ||
iOrientationTimeout = null; | ||
} | ||
iOrientationTimeout = window.setTimeout(_this.handleMobileTimeout, 50); | ||
}; | ||
this.handleMobileTimeout = function () { | ||
if (bResize && (bOrientationChange || (_this.system.tablet && _this.os.ios && _this.os.version >= 9))) { | ||
_this.handleOrientationChange(); | ||
_this.handleResizeChange(); | ||
bOrientationChange = false; | ||
bResize = false; | ||
if (iClearFlagTimeout) { | ||
window.clearTimeout(iClearFlagTimeout); | ||
iClearFlagTimeout = null; | ||
} | ||
} | ||
iOrientationTimeout = null; | ||
}; | ||
bSkipFirstResize = | ||
this.os.ios && | ||
this.browser.name === 'sf' && | ||
((this.system.phone && this.os.version >= 7 && this.os.version < 7.1) || | ||
(this.system.tablet && this.os.version >= 7)); | ||
if (this.support.touch && this.support.orientation) { | ||
window.addEventListener('resize', this.handleMobileOrientationResizeChange, false); | ||
window.addEventListener('orientationchange', this.handleMobileOrientationResizeChange, false); | ||
} | ||
else { | ||
window.addEventListener('resize', this.handleResizeEvent, false); | ||
} | ||
this.setOrientationInfo(); | ||
} | ||
DeviceBuilder.clearFlags = function () { | ||
bOrientationChange = false; | ||
bResize = false; | ||
iClearFlagTimeout = null; | ||
}; | ||
return DeviceBuilder; | ||
}()); | ||
var Device = new DeviceBuilder(); | ||
var getThemeClassFor = function (theme, themes) { | ||
@@ -271,2 +1401,2 @@ if ({}.hasOwnProperty.call(themes, theme)) { | ||
export { Event, KeyCodes$1 as KeyCodes, LOG_LEVEL, Logger, Optional, StyleClassHelper, Themes$1 as Themes, createThemeMap, deprecationNotice, getThemeClassFor, getThemeOverwrite, pushElementBackInScreen }; | ||
export { Device, Event, KeyCodes$1 as KeyCodes, LOG_LEVEL, Logger, Optional, StyleClassHelper, Themes$1 as Themes, createThemeMap, deprecationNotice, getThemeClassFor, getThemeOverwrite, isNumeric, pushElementBackInScreen }; |
@@ -0,1 +1,2 @@ | ||
import { Event } from './Event'; | ||
import KeyCodes from './KeyCodes'; | ||
@@ -6,4 +7,5 @@ import { LOG_LEVEL, Logger } from './Logger'; | ||
import Themes from './Themes'; | ||
import { Event } from './Event'; | ||
import { isNumeric } from './isNumeric'; | ||
import { Device } from './Device'; | ||
import { createThemeMap, deprecationNotice, getThemeClassFor, getThemeOverwrite, pushElementBackInScreen } from './Util'; | ||
export { StyleClassHelper, KeyCodes, Optional, getThemeClassFor, createThemeMap, getThemeOverwrite, deprecationNotice, pushElementBackInScreen, Themes, Event, Logger, LOG_LEVEL }; | ||
export { StyleClassHelper, KeyCodes, Optional, getThemeClassFor, createThemeMap, getThemeOverwrite, deprecationNotice, pushElementBackInScreen, Themes, Event, Logger, LOG_LEVEL, isNumeric, Device }; |
{ | ||
"name": "@fiori-for-react/utils", | ||
"version": "0.1.0-a5148f9", | ||
"version": "0.1.0-f3d70f4", | ||
"description": "Utils for fiori-for-react", | ||
@@ -5,0 +5,0 @@ "main": "index.cjs.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
198814
30
4454
1