quasar-framework
Version:
Build responsive SPA, SSR, PWA, Hybrid Mobile Apps and Electron apps, all simultaneously using the same codebase
1,999 lines (1,736 loc) • 718 kB
JavaScript
/*!
* Quasar Framework v0.17.20
* (c) 2016-present Razvan Stoenescu
* Released under the MIT License.
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('vue')) :
typeof define === 'function' && define.amd ? define(['vue'], factory) :
(global.Quasar = factory(global.Vue));
}(this, (function (Vue) { 'use strict';
Vue = Vue && Vue.hasOwnProperty('default') ? Vue['default'] : Vue;
/* eslint-disable no-useless-escape */
/* eslint-disable no-unused-expressions */
/* eslint-disable no-mixed-operators */
var isSSR = typeof window === 'undefined';
var fromSSR = false;
var onSSR = isSSR;
function getMatch (userAgent, platformMatch) {
var match = /(edge)\/([\w.]+)/.exec(userAgent) ||
/(opr)[\/]([\w.]+)/.exec(userAgent) ||
/(vivaldi)[\/]([\w.]+)/.exec(userAgent) ||
/(chrome)[\/]([\w.]+)/.exec(userAgent) ||
/(iemobile)[\/]([\w.]+)/.exec(userAgent) ||
/(version)(applewebkit)[\/]([\w.]+).*(safari)[\/]([\w.]+)/.exec(userAgent) ||
/(webkit)[\/]([\w.]+).*(version)[\/]([\w.]+).*(safari)[\/]([\w.]+)/.exec(userAgent) ||
/(webkit)[\/]([\w.]+)/.exec(userAgent) ||
/(opera)(?:.*version|)[\/]([\w.]+)/.exec(userAgent) ||
/(msie) ([\w.]+)/.exec(userAgent) ||
userAgent.indexOf('trident') >= 0 && /(rv)(?::| )([\w.]+)/.exec(userAgent) ||
userAgent.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(userAgent) ||
[];
return {
browser: match[5] || match[3] || match[1] || '',
version: match[2] || match[4] || '0',
versionNumber: match[4] || match[2] || '0',
platform: platformMatch[0] || ''
}
}
function getPlatformMatch (userAgent) {
return /(ipad)/.exec(userAgent) ||
/(ipod)/.exec(userAgent) ||
/(windows phone)/.exec(userAgent) ||
/(iphone)/.exec(userAgent) ||
/(kindle)/.exec(userAgent) ||
/(silk)/.exec(userAgent) ||
/(android)/.exec(userAgent) ||
/(win)/.exec(userAgent) ||
/(mac)/.exec(userAgent) ||
/(linux)/.exec(userAgent) ||
/(cros)/.exec(userAgent) ||
/(playbook)/.exec(userAgent) ||
/(bb)/.exec(userAgent) ||
/(blackberry)/.exec(userAgent) ||
[]
}
function getPlatform (userAgent) {
userAgent = (userAgent || navigator.userAgent || navigator.vendor || window.opera).toLowerCase();
var
platformMatch = getPlatformMatch(userAgent),
matched = getMatch(userAgent, platformMatch),
browser = {};
if (matched.browser) {
browser[matched.browser] = true;
browser.version = matched.version;
browser.versionNumber = parseInt(matched.versionNumber, 10);
}
if (matched.platform) {
browser[matched.platform] = true;
}
// These are all considered mobile platforms, meaning they run a mobile browser
if (browser.android || browser.bb || browser.blackberry || browser.ipad || browser.iphone ||
browser.ipod || browser.kindle || browser.playbook || browser.silk || browser['windows phone']) {
browser.mobile = true;
}
// Set iOS if on iPod, iPad or iPhone
if (browser.ipod || browser.ipad || browser.iphone) {
browser.ios = true;
}
if (browser['windows phone']) {
browser.winphone = true;
delete browser['windows phone'];
}
// These are all considered desktop platforms, meaning they run a desktop browser
if (browser.cros || browser.mac || browser.linux || browser.win) {
browser.desktop = true;
}
// Chrome, Opera 15+, Vivaldi and Safari are webkit based browsers
if (browser.chrome || browser.opr || browser.safari || browser.vivaldi) {
browser.webkit = true;
}
// IE11 has a new token so we will assign it msie to avoid breaking changes
if (browser.rv || browser.iemobile) {
matched.browser = 'ie';
browser.ie = true;
}
// Edge is officially known as Microsoft Edge, so rewrite the key to match
if (browser.edge) {
matched.browser = 'edge';
browser.edge = true;
}
// Blackberry browsers are marked as Safari on BlackBerry
if (browser.safari && browser.blackberry || browser.bb) {
matched.browser = 'blackberry';
browser.blackberry = true;
}
// Playbook browsers are marked as Safari on Playbook
if (browser.safari && browser.playbook) {
matched.browser = 'playbook';
browser.playbook = true;
}
// Opera 15+ are identified as opr
if (browser.opr) {
matched.browser = 'opera';
browser.opera = true;
}
// Stock Android browsers are marked as Safari on Android.
if (browser.safari && browser.android) {
matched.browser = 'android';
browser.android = true;
}
// Kindle browsers are marked as Safari on Kindle
if (browser.safari && browser.kindle) {
matched.browser = 'kindle';
browser.kindle = true;
}
// Kindle Silk browsers are marked as Safari on Kindle
if (browser.safari && browser.silk) {
matched.browser = 'silk';
browser.silk = true;
}
if (browser.vivaldi) {
matched.browser = 'vivaldi';
browser.vivaldi = true;
}
// Assign the name and platform variable
browser.name = matched.browser;
browser.platform = matched.platform;
if (!isSSR) {
if (window.process && window.process.versions && window.process.versions.electron) {
browser.electron = true;
}
else if (document.location.href.indexOf('chrome-extension://') === 0) {
browser.chromeExt = true;
}
else if (window._cordovaNative || window.cordova) {
browser.cordova = true;
}
fromSSR = browser.cordova === void 0 &&
browser.electron === void 0 &&
!!document.querySelector('[data-server-rendered]');
fromSSR && (onSSR = true);
}
return browser
}
var webStorage;
function hasWebStorage () {
if (webStorage !== void 0) {
return webStorage
}
try {
if (window.localStorage) {
webStorage = true;
return true
}
}
catch (e) {}
webStorage = false;
return false
}
function getClientProperties () {
return {
has: {
touch: (function () { return !!('ontouchstart' in document.documentElement) || window.navigator.msMaxTouchPoints > 0; })(),
webStorage: hasWebStorage()
},
within: {
iframe: window.self !== window.top
}
}
}
var Platform = {
has: {
touch: false,
webStorage: false
},
within: { iframe: false },
parseSSR: function parseSSR (/* ssrContext */ ssr) {
return ssr ? {
is: getPlatform(ssr.req.headers['user-agent']),
has: this.has,
within: this.within
} : Object.assign({}, {is: getPlatform()},
getClientProperties())
},
install: function install ($q, queues, Vue$$1) {
var this$1 = this;
if (isSSR) {
queues.server.push(function (q, ctx) {
q.platform = this$1.parseSSR(ctx.ssr);
});
return
}
this.is = getPlatform();
if (fromSSR) {
queues.takeover.push(function (q) {
onSSR = fromSSR = false;
Object.assign(q.platform, getClientProperties());
});
Vue$$1.util.defineReactive($q, 'platform', this);
}
else {
Object.assign(this, getClientProperties());
$q.platform = this;
}
}
};
/* eslint-disable no-extend-native, one-var, no-self-compare */
function assign (target, firstSource) {
var arguments$1 = arguments;
if (target === undefined || target === null) {
throw new TypeError('Cannot convert first argument to object')
}
var to = Object(target);
for (var i = 1; i < arguments.length; i++) {
var nextSource = arguments$1[i];
if (nextSource === undefined || nextSource === null) {
continue
}
var keysArray = Object.keys(Object(nextSource));
for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex++) {
var nextKey = keysArray[nextIndex];
var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey);
if (desc !== undefined && desc.enumerable) {
to[nextKey] = nextSource[nextKey];
}
}
}
return to
}
if (!Object.assign) {
Object.defineProperty(Object, 'assign', {
enumerable: false,
configurable: true,
writable: true,
value: assign
});
}
if (!Number.isInteger) {
Number.isInteger = function (value) {
return typeof value === 'number' &&
isFinite(value) &&
Math.floor(value) === value
};
}
if (!Array.prototype.includes) {
Array.prototype.includes = function (searchEl, startFrom) {
var O = Object(this);
var len = parseInt(O.length, 10) || 0;
if (len === 0) {
return false
}
var n = parseInt(startFrom, 10) || 0;
var k;
if (n >= 0) {
k = n;
}
else {
k = len + n;
if (k < 0) { k = 0; }
}
var curEl;
while (k < len) {
curEl = O[k];
if (searchEl === curEl ||
(searchEl !== searchEl && curEl !== curEl)) { // NaN !== NaN
return true
}
k++;
}
return false
};
}
if (!String.prototype.startsWith) {
String.prototype.startsWith = function (str, position) {
position = position || 0;
return this.substr(position, str.length) === str
};
}
if (!String.prototype.endsWith) {
String.prototype.endsWith = function (str, position) {
var subjectString = this.toString();
if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
position = subjectString.length;
}
position -= str.length;
var lastIndex = subjectString.indexOf(str, position);
return lastIndex !== -1 && lastIndex === position
};
}
if (!isSSR) {
if (typeof Element.prototype.matches !== 'function') {
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.mozMatchesSelector || Element.prototype.webkitMatchesSelector || function matches (selector) {
var
element = this,
elements = (element.document || element.ownerDocument).querySelectorAll(selector),
index = 0;
while (elements[index] && elements[index] !== element) {
++index;
}
return Boolean(elements[index])
};
}
if (typeof Element.prototype.closest !== 'function') {
Element.prototype.closest = function closest (selector) {
var el = this;
while (el && el.nodeType === 1) {
if (el.matches(selector)) {
return el
}
el = el.parentNode;
}
return null
};
}
// from:https://github.com/jserz/js_piece/blob/master/DOM/ChildNode/remove()/remove().md
(function (arr) {
arr.forEach(function (item) {
if (item.hasOwnProperty('remove')) { return }
Object.defineProperty(item, 'remove', {
configurable: true,
enumerable: true,
writable: true,
value: function value () {
if (this.parentNode !== null) {
this.parentNode.removeChild(this);
}
}
});
});
})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);
}
if (!Array.prototype.find) {
Object.defineProperty(Array.prototype, 'find', {
value: function value (predicate) {
if (this == null) {
throw new TypeError('Array.prototype.find called on null or undefined')
}
if (typeof predicate !== 'function') {
throw new TypeError('predicate must be a function')
}
var value;
var
list = Object(this),
length = list.length >>> 0,
thisArg = arguments[1];
for (var i = 0; i < length; i++) {
value = list[i];
if (predicate.call(thisArg, value, i, list)) {
return value
}
}
return undefined
}
});
}
var version = "0.17.20";
var History = {
__history: [],
add: function () {},
remove: function () {},
install: function install ($q, cfg) {
var this$1 = this;
if (isSSR || !$q.platform.is.cordova) {
return
}
this.add = function (definition) {
this$1.__history.push(definition);
};
this.remove = function (definition) {
var index = this$1.__history.indexOf(definition);
if (index >= 0) {
this$1.__history.splice(index, 1);
}
};
var exit = cfg.cordova === void 0 || cfg.cordova.backButtonExit !== false;
document.addEventListener('deviceready', function () {
document.addEventListener('backbutton', function () {
if (this$1.__history.length) {
this$1.__history.pop().handler();
}
else if (exit && window.location.hash === '#/') {
navigator.app.exitApp();
}
else {
window.history.back();
}
}, false);
});
}
};
var langEn = {
lang: 'en-us',
label: {
clear: 'Clear',
ok: 'OK',
cancel: 'Cancel',
close: 'Close',
set: 'Set',
select: 'Select',
reset: 'Reset',
remove: 'Remove',
update: 'Update',
create: 'Create',
search: 'Search',
filter: 'Filter',
refresh: 'Refresh'
},
date: {
days: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
daysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
firstDayOfWeek: 0, // 0-6, 0 - Sunday, 1 Monday, ...
format24h: false
},
pullToRefresh: {
pull: 'Pull down to refresh',
release: 'Release to refresh',
refresh: 'Refreshing...'
},
table: {
noData: 'No data available',
noResults: 'No matching records found',
loading: 'Loading...',
selectedRecords: function (rows) {
return rows === 1
? '1 record selected.'
: (rows === 0 ? 'No' : rows) + ' records selected.'
},
recordsPerPage: 'Records per page:',
allRows: 'All',
pagination: function (start, end, total) {
return start + '-' + end + ' of ' + total
},
columns: 'Columns'
},
editor: {
url: 'URL',
bold: 'Bold',
italic: 'Italic',
strikethrough: 'Strikethrough',
underline: 'Underline',
unorderedList: 'Unordered List',
orderedList: 'Ordered List',
subscript: 'Subscript',
superscript: 'Superscript',
hyperlink: 'Hyperlink',
toggleFullscreen: 'Toggle Fullscreen',
quote: 'Quote',
left: 'Left align',
center: 'Center align',
right: 'Right align',
justify: 'Justify align',
print: 'Print',
outdent: 'Decrease indentation',
indent: 'Increase indentation',
removeFormat: 'Remove formatting',
formatting: 'Formatting',
fontSize: 'Font Size',
align: 'Align',
hr: 'Insert Horizontal Rule',
undo: 'Undo',
redo: 'Redo',
header1: 'Header 1',
header2: 'Header 2',
header3: 'Header 3',
header4: 'Header 4',
header5: 'Header 5',
header6: 'Header 6',
paragraph: 'Paragraph',
code: 'Code',
size1: 'Very small',
size2: 'A bit small',
size3: 'Normal',
size4: 'Medium-large',
size5: 'Big',
size6: 'Very big',
size7: 'Maximum',
defaultFont: 'Default Font'
},
tree: {
noNodes: 'No nodes available',
noResults: 'No matching nodes found'
}
};
var i18n = {
install: function install ($q, queues, Vue$$1, lang) {
var this$1 = this;
if (isSSR) {
queues.server.push(function (q, ctx) {
var
opt = {
lang: q.i18n.lang,
dir: q.i18n.rtl ? 'rtl' : 'ltr'
},
fn = ctx.ssr.setHtmlAttrs;
if (typeof fn === 'function') {
fn(opt);
}
else {
ctx.ssr.Q_HTML_ATTRS = Object.keys(opt)
.map(function (key) { return (key + "=" + (opt[key])); })
.join(' ');
}
});
}
this.set = function (lang) {
if ( lang === void 0 ) lang = langEn;
lang.set = this$1.set;
lang.getLocale = this$1.getLocale;
lang.rtl = lang.rtl || false;
if (!isSSR) {
var el = document.documentElement;
el.setAttribute('dir', lang.rtl ? 'rtl' : 'ltr');
el.setAttribute('lang', lang.lang);
}
if (isSSR || $q.i18n) {
$q.i18n = lang;
}
else {
Vue$$1.util.defineReactive($q, 'i18n', lang);
}
this$1.name = lang.lang;
this$1.lang = lang;
};
this.set(lang);
},
getLocale: function getLocale () {
if (isSSR) { return }
var val =
navigator.language ||
navigator.languages[0] ||
navigator.browserLanguage ||
navigator.userLanguage ||
navigator.systemLanguage;
if (val) {
return val.toLowerCase()
}
}
};
function rgbToHex (ref) {
var r = ref.r;
var g = ref.g;
var b = ref.b;
var a = ref.a;
var alpha = a !== void 0;
r = Math.round(r);
g = Math.round(g);
b = Math.round(b);
if (
r > 255 ||
g > 255 ||
b > 255 ||
(alpha && a > 100)
) {
throw new TypeError('Expected 3 numbers below 256 (and optionally one below 100)')
}
a = alpha
? (Math.round(255 * a / 100) | 1 << 8).toString(16).slice(1)
: '';
return '#' + ((b | g << 8 | r << 16) | 1 << 24).toString(16).slice(1) + a
}
function hexToRgb (hex) {
if (typeof hex !== 'string') {
throw new TypeError('Expected a string')
}
hex = hex.replace(/^#/, '');
if (hex.length === 3) {
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
}
else if (hex.length === 4) {
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];
}
var num = parseInt(hex, 16);
return hex.length > 6
? {r: num >> 24 & 255, g: num >> 16 & 255, b: num >> 8 & 255, a: Math.round((num & 255) / 2.55)}
: {r: num >> 16, g: num >> 8 & 255, b: num & 255}
}
function hsvToRgb (ref) {
var h = ref.h;
var s = ref.s;
var v = ref.v;
var a = ref.a;
var r, g, b, i, f, p, q, t;
s = s / 100;
v = v / 100;
h = h / 360;
i = Math.floor(h * 6);
f = h * 6 - i;
p = v * (1 - s);
q = v * (1 - f * s);
t = v * (1 - (1 - f) * s);
switch (i % 6) {
case 0:
r = v;
g = t;
b = p;
break
case 1:
r = q;
g = v;
b = p;
break
case 2:
r = p;
g = v;
b = t;
break
case 3:
r = p;
g = q;
b = v;
break
case 4:
r = t;
g = p;
b = v;
break
case 5:
r = v;
g = p;
b = q;
break
}
return {
r: Math.round(r * 255),
g: Math.round(g * 255),
b: Math.round(b * 255),
a: a
}
}
function rgbToHsv (ref) {
var r = ref.r;
var g = ref.g;
var b = ref.b;
var a = ref.a;
var
max = Math.max(r, g, b), min = Math.min(r, g, b),
d = max - min,
h,
s = (max === 0 ? 0 : d / max),
v = max / 255;
switch (max) {
case min:
h = 0;
break
case r:
h = (g - b) + d * (g < b ? 6 : 0);
h /= 6 * d;
break
case g:
h = (b - r) + d * 2;
h /= 6 * d;
break
case b:
h = (r - g) + d * 4;
h /= 6 * d;
break
}
return {
h: Math.round(h * 360),
s: Math.round(s * 100),
v: Math.round(v * 100),
a: a
}
}
var reRGBA = /^\s*rgb(a)?\s*\((\s*(\d+)\s*,\s*?){2}(\d+)\s*,?\s*([01]?\.?\d*?)?\s*\)\s*$/;
function textToRgb (color) {
if (typeof color !== 'string') {
throw new TypeError('Expected a string')
}
var m = reRGBA.exec(color);
if (m) {
var rgb = {
r: Math.max(255, parseInt(m[2], 10)),
g: Math.max(255, parseInt(m[3], 10)),
b: Math.max(255, parseInt(m[4], 10))
};
if (m[1]) {
rgb.a = Math.max(1, parseFloat(m[5]));
}
return rgb
}
return hexToRgb(color)
}
/* works as darken if percent < 0 */
function lighten (color, percent) {
if (typeof color !== 'string') {
throw new TypeError('Expected a string as color')
}
if (typeof percent !== 'number') {
throw new TypeError('Expected a numeric percent')
}
var rgb = textToRgb(color),
t = percent < 0 ? 0 : 255,
p = Math.abs(percent) / 100,
R = rgb.r,
G = rgb.g,
B = rgb.b;
return '#' + (
0x1000000 + (Math.round((t - R) * p) + R) * 0x10000 +
(Math.round((t - G) * p) + G) * 0x100 +
(Math.round((t - B) * p) + B)
).toString(16).slice(1)
}
function luminosity (color) {
if (typeof color !== 'string' && (!color || color.r === void 0)) {
throw new TypeError('Expected a string or a {r, g, b} object as color')
}
var
rgb = typeof color === 'string' ? textToRgb(color) : color,
r = rgb.r / 255,
g = rgb.g / 255,
b = rgb.b / 255,
R = r <= 0.03928 ? r / 12.92 : Math.pow((r + 0.055) / 1.055, 2.4),
G = g <= 0.03928 ? g / 12.92 : Math.pow((g + 0.055) / 1.055, 2.4),
B = b <= 0.03928 ? b / 12.92 : Math.pow((b + 0.055) / 1.055, 2.4);
return 0.2126 * R + 0.7152 * G + 0.0722 * B
}
function setBrand (color, value, element) {
if ( element === void 0 ) element = document.body;
if (typeof color !== 'string') {
throw new TypeError('Expected a string as color')
}
if (typeof value !== 'string') {
throw new TypeError('Expected a string as value')
}
if (!(element instanceof Element)) {
throw new TypeError('Expected a DOM element')
}
element.style.setProperty(("--q-color-" + color), value);
switch (color) {
case 'negative':
case 'warning':
element.style.setProperty(("--q-color-" + color + "-l"), lighten(value, 46));
break
case 'light':
element.style.setProperty(("--q-color-" + color + "-d"), lighten(value, -10));
}
}
function getBrand (color, element) {
if ( element === void 0 ) element = document.body;
if (typeof color !== 'string') {
throw new TypeError('Expected a string as color')
}
if (!(element instanceof Element)) {
throw new TypeError('Expected a DOM element')
}
return getComputedStyle(element).getPropertyValue(("--q-color-" + color)).trim() || null
}
var colors = {
rgbToHex: rgbToHex,
hexToRgb: hexToRgb,
hsvToRgb: hsvToRgb,
rgbToHsv: rgbToHsv,
textToRgb: textToRgb,
lighten: lighten,
luminosity: luminosity,
setBrand: setBrand,
getBrand: getBrand
};
function getBodyClasses (ref, cfg) {
var is = ref.is;
var has = ref.has;
var within = ref.within;
var cls = [
'mat',
is.desktop ? 'desktop' : 'mobile',
has.touch ? 'touch' : 'no-touch',
("platform-" + (is.ios ? 'ios' : 'mat'))
];
if (is.cordova) {
cls.push('cordova');
if (is.ios && (cfg.cordova === void 0 || cfg.cordova.iosStatusBarPadding !== false)) {
var
ratio = window.devicePixelRatio || 1,
width = window.screen.width * ratio,
height = window.screen.height * ratio;
if (width === 1125 && height === 2436) { // iPhoneX fullscreen
cls.push('q-ios-statusbar-x');
}
if (width !== 1125 || height !== 2001) { // not iPhoneX on non-fullscreen
cls.push('q-ios-statusbar-padding');
}
}
}
within.iframe && cls.push('within-iframe');
is.electron && cls.push('electron');
return cls
}
function bodyInit (Platform$$1, cfg) {
var cls = getBodyClasses(Platform$$1, cfg);
if (Platform$$1.is.ie && Platform$$1.is.versionNumber === 11) {
cls.forEach(function (c) { return document.body.classList.add(c); });
}
else {
document.body.classList.add.apply(document.body.classList, cls);
}
if (Platform$$1.is.ios) {
// needed for iOS button active state
document.body.addEventListener('touchstart', function () {});
}
}
function setColors (brand) {
for (var color in brand) {
setBrand(color, brand[color]);
}
}
var Body = {
install: function install ($q, queues, cfg) {
if (isSSR) {
queues.server.push(function (q, ctx) {
var
cls = getBodyClasses(q.platform, cfg),
fn = ctx.ssr.setBodyClasses;
if (typeof fn === 'function') {
fn(cls);
}
else {
ctx.ssr.Q_BODY_CLASSES = cls.join(' ');
}
});
return
}
cfg.brand && setColors(cfg.brand);
bodyInit($q.platform, cfg);
}
};
var materialIcons = {
name: 'material-icons',
type: {
positive: 'check_circle',
negative: 'warning',
info: 'info',
warning: 'priority_high'
},
arrow: {
up: 'arrow_upward',
right: 'arrow_forward',
down: 'arrow_downward',
left: 'arrow_back'
},
chevron: {
left: 'chevron_left',
right: 'chevron_right'
},
pullToRefresh: {
arrow: 'arrow_downward',
refresh: 'refresh'
},
search: {
icon: 'search',
clear: 'cancel',
clearInverted: 'clear'
},
carousel: {
left: 'chevron_left',
right: 'chevron_right',
quickNav: 'lens',
thumbnails: 'view_carousel'
},
checkbox: {
checked: {
ios: 'check_circle',
mat: 'check_box'
},
unchecked: {
ios: 'radio_button_unchecked',
mat: 'check_box_outline_blank'
},
indeterminate: {
ios: 'remove_circle_outline',
mat: 'indeterminate_check_box'
}
},
chip: {
close: 'cancel'
},
chipsInput: {
add: 'send'
},
collapsible: {
icon: 'arrow_drop_down'
},
datetime: {
arrowLeft: 'chevron_left',
arrowRight: 'chevron_right'
},
editor: {
bold: 'format_bold',
italic: 'format_italic',
strikethrough: 'strikethrough_s',
underline: 'format_underlined',
unorderedList: 'format_list_bulleted',
orderedList: 'format_list_numbered',
subscript: 'vertical_align_bottom',
superscript: 'vertical_align_top',
hyperlink: 'link',
toggleFullscreen: 'fullscreen',
quote: 'format_quote',
left: 'format_align_left',
center: 'format_align_center',
right: 'format_align_right',
justify: 'format_align_justify',
print: 'print',
outdent: 'format_indent_decrease',
indent: 'format_indent_increase',
removeFormat: 'format_clear',
formatting: 'text_format',
fontSize: 'format_size',
align: 'format_align_left',
hr: 'remove',
undo: 'undo',
redo: 'redo',
header: 'format_size',
code: 'code',
size: 'format_size',
font: 'font_download'
},
fab: {
icon: 'add',
activeIcon: 'close'
},
input: {
showPass: 'visibility',
hidePass: 'visibility_off',
showNumber: 'keyboard',
hideNumber: 'keyboard_hide',
clear: 'cancel',
clearInverted: 'clear',
dropdown: 'arrow_drop_down'
},
pagination: {
first: 'first_page',
prev: 'keyboard_arrow_left',
next: 'keyboard_arrow_right',
last: 'last_page'
},
radio: {
checked: {
ios: 'check',
mat: 'radio_button_checked'
},
unchecked: {
ios: '',
mat: 'radio_button_unchecked'
}
},
rating: {
icon: 'grade'
},
stepper: {
done: 'check',
active: 'edit',
error: 'warning'
},
tabs: {
left: 'chevron_left',
right: 'chevron_right'
},
table: {
arrowUp: 'arrow_upward',
warning: 'warning',
prevPage: 'chevron_left',
nextPage: 'chevron_right'
},
tree: {
icon: 'play_arrow'
},
uploader: {
done: 'done',
clear: 'cancel',
clearInverted: 'clear',
add: 'add',
upload: 'cloud_upload',
expand: 'keyboard_arrow_down',
file: 'insert_drive_file'
}
};
var Icons = {
__installed: false,
install: function install ($q, Vue$$1, iconSet) {
var this$1 = this;
this.set = function (iconDef) {
if ( iconDef === void 0 ) iconDef = materialIcons;
iconDef.set = this$1.set;
if (isSSR || $q.icon) {
$q.icon = iconDef;
}
else {
Vue$$1.util.defineReactive($q, 'icon', iconDef);
}
this$1.name = iconDef.name;
this$1.def = iconDef;
};
this.set(iconSet);
}
};
var queues = {
server: [], // on SSR update
takeover: [] // on client takeover
};
var $q = {
version: version,
theme: 'mat'
};
function install (Vue$$1, opts) {
if ( opts === void 0 ) opts = {};
if (this.__installed) { return }
this.__installed = true;
var cfg = opts.config || {};
// required plugins
Platform.install($q, queues, Vue$$1);
Body.install($q, queues, cfg);
History.install($q, cfg);
i18n.install($q, queues, Vue$$1, opts.i18n);
Icons.install($q, Vue$$1, opts.iconSet);
if (isSSR) {
Vue$$1.mixin({
beforeCreate: function beforeCreate () {
this.$q = this.$root.$options.$q;
}
});
}
else {
Vue$$1.prototype.$q = $q;
}
opts.components && Object.keys(opts.components).forEach(function (key) {
var c = opts.components[key];
if (c.name !== undefined && (c.render !== void 0 || c.mixins !== void 0)) {
Vue$$1.component(c.name, c);
}
});
opts.directives && Object.keys(opts.directives).forEach(function (key) {
var d = opts.directives[key];
if (d.name !== undefined && d.unbind !== void 0) {
Vue$$1.directive(d.name, d);
}
});
if (opts.plugins) {
var param = { $q: $q, queues: queues, Vue: Vue$$1, cfg: cfg };
Object.keys(opts.plugins).forEach(function (key) {
var p = opts.plugins[key];
if (typeof p.install === 'function' && p !== Platform) {
p.install(param);
}
});
}
}
var handlers = [];
var EscapeKey = {
__installed: false,
__install: function __install () {
this.__installed = true;
window.addEventListener('keyup', function (evt) {
if (handlers.length === 0) {
return
}
if (evt.which === 27 || evt.keyCode === 27) {
handlers[handlers.length - 1]();
}
});
},
register: function register (handler) {
if (Platform.is.desktop) {
if (!this.__installed) {
this.__install();
}
handlers.push(handler);
}
},
pop: function pop () {
if (Platform.is.desktop) {
handlers.pop();
}
}
};
/* eslint prefer-promise-reject-errors: 0 */
var ModelToggleMixin = {
props: {
value: Boolean
},
data: function data () {
return {
showing: false
}
},
watch: {
value: function value (val) {
var this$1 = this;
if (this.disable && val) {
this.$emit('input', false);
return
}
this.$nextTick(function () {
if (this$1.value !== this$1.showing) {
this$1[val ? 'show' : 'hide']();
}
});
}
},
methods: {
toggle: function toggle (evt) {
return this[this.showing ? 'hide' : 'show'](evt)
},
show: function show (evt) {
var this$1 = this;
if (this.disable || this.showing) {
return this.showPromise || Promise.resolve(evt)
}
this.hidePromise && this.hidePromiseReject();
this.showing = true;
if (this.value === false) {
this.$emit('input', true);
}
if (this.$options.modelToggle === void 0 || this.$options.modelToggle.history) {
this.__historyEntry = {
handler: this.hide
};
History.add(this.__historyEntry);
}
if (!this.__show) {
this.$emit('show', evt);
return Promise.resolve(evt)
}
this.showPromise = new Promise(function (resolve, reject) {
this$1.showPromiseResolve = function () {
this$1.showPromise = null;
this$1.$emit('show', evt);
resolve(evt);
};
this$1.showPromiseReject = function () {
this$1.showPromise.catch(function () {});
this$1.showPromise = null;
reject(null); // eslint prefer-promise-reject-errors: 0
};
});
this.__show(evt);
return this.showPromise || Promise.resolve(evt)
},
hide: function hide (evt) {
var this$1 = this;
if (this.disable || !this.showing) {
return this.hidePromise || Promise.resolve(evt)
}
this.showPromise && this.showPromiseReject();
this.showing = false;
if (this.value === true) {
this.$emit('input', false);
}
this.__removeHistory();
if (!this.__hide) {
this.$emit('hide', evt);
return Promise.resolve()
}
this.hidePromise = new Promise(function (resolve, reject) {
this$1.hidePromiseResolve = function () {
this$1.hidePromise = null;
this$1.$emit('hide', evt);
resolve();
};
this$1.hidePromiseReject = function () {
this$1.hidePromise.catch(function () {});
this$1.hidePromise = null;
reject(null);
};
});
this.__hide(evt);
return this.hidePromise || Promise.resolve(evt)
},
__removeHistory: function __removeHistory () {
if (this.__historyEntry) {
History.remove(this.__historyEntry);
this.__historyEntry = null;
}
}
},
beforeDestroy: function beforeDestroy () {
if (this.showing) {
this.showPromise && this.showPromiseReject();
this.hidePromise && this.hidePromiseReject();
this.__removeHistory();
}
}
};
var listenOpts = {};
Object.defineProperty(listenOpts, 'passive', {
configurable: true,
get: function get () {
var passive;
try {
var opts = Object.defineProperty({}, 'passive', {
get: function get () {
passive = { passive: true };
}
});
window.addEventListener('qtest', null, opts);
window.removeEventListener('qtest', null, opts);
}
catch (e) {}
listenOpts.passive = passive;
return passive
},
set: function set (val) {
Object.defineProperty(this, 'passive', {
value: val
});
}
});
function leftClick (e) {
return e.button === 0
}
function middleClick (e) {
return e.button === 1
}
function rightClick (e) {
return e.button === 2
}
function getEventKey (e) {
return e.which || e.keyCode
}
function position (e) {
var posx, posy;
if (e.touches && e.touches[0]) {
e = e.touches[0];
}
else if (e.changedTouches && e.changedTouches[0]) {
e = e.changedTouches[0];
}
if (e.clientX || e.clientY) {
posx = e.clientX;
posy = e.clientY;
}
else if (e.pageX || e.pageY) {
posx = e.pageX - document.body.scrollLeft - document.documentElement.scrollLeft;
posy = e.pageY - document.body.scrollTop - document.documentElement.scrollTop;
}
else {
var offset = targetElement(e).getBoundingClientRect();
posx = ((offset.right - offset.left) / 2) + offset.left;
posy = ((offset.bottom - offset.top) / 2) + offset.top;
}
return {
top: posy,
left: posx
}
}
function targetElement (e) {
var target;
if (e.target) {
target = e.target;
}
else if (e.srcElement) {
target = e.srcElement;
}
// defeat Safari bug
if (target.nodeType === 3) {
target = target.parentNode;
}
return target
}
function getEventPath (e) {
if (e.path) {
return e.path
}
if (e.composedPath) {
return e.composedPath()
}
var path = [];
var el = e.target;
while (el) {
path.push(el);
if (el.tagName === 'HTML') {
path.push(document);
path.push(window);
return path
}
el = el.parentElement;
}
}
// Reasonable defaults
var
LINE_HEIGHT = 40,
PAGE_HEIGHT = 800;
function getMouseWheelDistance (e) {
var assign;
var x = e.deltaX, y = e.deltaY;
if ((x || y) && e.deltaMode) {
var multiplier = e.deltaMode === 1 ? LINE_HEIGHT : PAGE_HEIGHT;
x *= multiplier;
y *= multiplier;
}
if (e.shiftKey && !x) {
(assign = [x, y], y = assign[0], x = assign[1]);
}
return { x: x, y: y }
}
function stopAndPrevent (e) {
e.preventDefault();
e.stopPropagation();
}
var event = {
listenOpts: listenOpts,
leftClick: leftClick,
middleClick: middleClick,
rightClick: rightClick,
getEventKey: getEventKey,
position: position,
targetElement: targetElement,
getEventPath: getEventPath,
getMouseWheelDistance: getMouseWheelDistance,
stopAndPrevent: stopAndPrevent
};
function offset (el) {
if (!el || el === window) {
return {top: 0, left: 0}
}
var ref = el.getBoundingClientRect();
var top = ref.top;
var left = ref.left;
return {top: top, left: left}
}
function style (el, property) {
return window.getComputedStyle(el).getPropertyValue(property)
}
function height (el) {
if (el === window) {
return window.innerHeight
}
return parseFloat(style(el, 'height'))
}
function width (el) {
if (el === window) {
return window.innerWidth
}
return parseFloat(style(el, 'width'))
}
function css (element, css) {
var style = element.style;
Object.keys(css).forEach(function (prop) {
style[prop] = css[prop];
});
}
function ready (fn) {
if (typeof fn !== 'function') {
return
}
if (document.readyState !== 'loading') {
return fn()
}
document.addEventListener('DOMContentLoaded', fn, false);
}
var prefix = ['-webkit-', '-moz-', '-ms-', '-o-'];
function cssTransform (val) {
var o = {transform: val};
prefix.forEach(function (p) {
o[p + 'transform'] = val;
});
return o
}
var dom = {
offset: offset,
style: style,
height: height,
width: width,
css: css,
ready: ready,
cssTransform: cssTransform
};
function getScrollTarget (el) {
return el.closest('.scroll,.scroll-y,.overflow-auto') || window
}
function getScrollHeight (el) {
return (el === window ? document.body : el).scrollHeight
}
function getScrollPosition (scrollTarget) {
if (scrollTarget === window) {
return window.pageYOffset || window.scrollY || document.body.scrollTop || 0
}
return scrollTarget.scrollTop
}
function getHorizontalScrollPosition (scrollTarget) {
if (scrollTarget === window) {
return window.pageXOffset || window.scrollX || document.body.scrollLeft || 0
}
return scrollTarget.scrollLeft
}
function animScrollTo (el, to, duration) {
var pos = getScrollPosition(el);
if (duration <= 0) {
if (pos !== to) {
setScroll(el, to);
}
return
}
requestAnimationFrame(function () {
var newPos = pos + (to - pos) / Math.max(16, duration) * 16;
setScroll(el, newPos);
if (newPos !== to) {
animScrollTo(el, to, duration - 16);
}
});
}
function setScroll (scrollTarget, offset$$1) {
if (scrollTarget === window) {
document.documentElement.scrollTop = offset$$1;
document.body.scrollTop = offset$$1;
return
}
scrollTarget.scrollTop = offset$$1;
}
function setScrollPosition (scrollTarget, offset$$1, duration) {
if (duration) {
animScrollTo(scrollTarget, offset$$1, duration);
return
}
setScroll(scrollTarget, offset$$1);
}
var size;
function getScrollbarWidth () {
if (size !== undefined) {
return size
}
var
inner = document.createElement('p'),
outer = document.createElement('div');
css(inner, {
width: '100%',
height: '200px'
});
css(outer, {
position: 'absolute',
top: '0px',
left: '0px',
visibility: 'hidden',
width: '200px',
height: '150px',
overflow: 'hidden'
});
outer.appendChild(inner);
document.body.appendChild(outer);
var w1 = inner.offsetWidth;
outer.style.overflow = 'scroll';
var w2 = inner.offsetWidth;
if (w1 === w2) {
w2 = outer.clientWidth;
}
outer.remove();
size = w1 - w2;
return size
}
function hasScrollbar (el, onY) {
if ( onY === void 0 ) onY = true;
if (!el || el.nodeType !== Node.ELEMENT_NODE) {
return false
}
return onY
? (
el.scrollHeight > el.clientHeight && (
el.classList.contains('scroll') ||
el.classList.contains('overflow-auto') ||
['auto', 'scroll'].includes(window.getComputedStyle(el)['overflow-y'])
)
)
: (
el.scrollWidth > el.clientWidth && (
el.classList.contains('scroll') ||
el.classList.contains('overflow-auto') ||
['auto', 'scroll'].includes(window.getComputedStyle(el)['overflow-x'])
)
)
}
var scroll = {
getScrollTarget: getScrollTarget,
getScrollHeight: getScrollHeight,
getScrollPosition: getScrollPosition,
animScrollTo: animScrollTo,
setScrollPosition: setScrollPosition,
getScrollbarWidth: getScrollbarWidth,
hasScrollbar: hasScrollbar
};
var registered = 0;
function onWheel (e) {
if (shouldPreventScroll(e)) {
stopAndPrevent(e);
}
}
function shouldPreventScroll (e) {
if (e.target === document.body || e.target.classList.contains('q-layout-backdrop')) {
return true
}
var
path = getEventPath(e),
shift = e.shiftKey && !e.deltaX,
scrollY = !shift && Math.abs(e.deltaX) <= Math.abs(e.deltaY),
delta = shift || scrollY ? e.deltaY : e.deltaX;
for (var index = 0; index < path.length; index++) {
var el = path[index];
if (hasScrollbar(el, scrollY)) {
return scrollY
? (
delta < 0 && el.scrollTop === 0
? true
: delta > 0 && el.scrollTop + el.clientHeight === el.scrollHeight
)
: (
delta < 0 && el.scrollLeft === 0
? true
: delta > 0 && el.scrollLeft + el.clientWidth === el.scrollWidth
)
}
}
return true
}
function preventScroll (register) {
registered += register ? 1 : -1;
if (registered > 1) { return }
var action = register ? 'add' : 'remove';
if (Platform.is.mobile) {
document.body.classList[action]('q-body-prevent-scroll');
}
else if (Platform.is.desktop) {
window[(action + "EventListener")]('wheel', onWheel);
}
}
var positions = {
top: 'items-start justify-center with-backdrop',
bottom: 'items-end justify-center with-backdrop',
right: 'items-center justify-end with-backdrop',
left: 'items-center justify-start with-backdrop'
};
var positionCSS = {
maxHeight: '80vh',
height: 'auto'
};
function additionalCSS (position) {
var css = {};
if (['left', 'right'].includes(position)) {
css.maxWidth = '90vw';
}
if (['left', 'top'].includes(position)) {
css.borderTopLeftRadius = 0;
}
if (['right', 'top'].includes(position)) {
css.borderTopRightRadius = 0;
}
if (['left', 'bottom'].includes(position)) {
css.borderBottomLeftRadius = 0;
}
if (['right', 'bottom'].includes(position)) {
css.borderBottomRightRadius = 0;
}
return css
}
var modals = {
responsive: 0,
maximized: 0
};
var QModal = {
name: 'QModal',
mixins: [ModelToggleMixin],
provide: function provide () {
var this$1 = this;
return {
__qmodal: {
register: function (layout) {
if (this$1.layout !== layout) {
this$1.layout = layout;
}
},
unregister: function (layout) {
if (this$1.layout === layout) {
this$1.layout = null;
}
}
}
}
},
props: {
position: {
type: String,
default: '',
validator: function validator (val) {
return val === '' || ['top', 'bottom', 'left', 'right'].includes(val)
}
},
transition: String,
enterClass: String,
leaveClass: String,
positionClasses: {
type: String,
default: 'flex-center'
},
contentClasses: [Object, Array, String],
contentCss: [Object, Array, String],
noBackdropDismiss: {
type: Boolean,
default: false
},
noEscDismiss: {
type: Boolean,
default: false
},
noRouteDismiss: Boolean,
noRefocus: Boolean,
minimized: Boolean,
maximized: Boolean
},
data: function data () {
return {
layout: null
}
},
watch: {
$route: function $route () {
if (!this.noRouteDismiss) {
this.hide();
}
},
maximized: function maximized (newV, oldV) {
this.__register(false, oldV);
this.__register(true, newV);
},
minimized: function minimized (newV, oldV) {
this.__register(false, this.maximized, oldV);
this.__register(true, this.maximized, newV);
}
},
computed: {
modalClasses: function modalClasses () {
var cls = this.position
? positions[this.position]
: this.positionClasses;
if (this.maximized) {
return ['maximized', cls]
}
else if (this.minimized) {
return ['minimized', cls]
}
return cls
},
contentClassesCalc: function contentClassesCalc () {
if (this.layout) {
return [this.contentClasses, 'column no-wrap']
}
return this.contentClasses
},
transitionProps: function transitionProps () {
if (this.position) {
return { name: ("q-modal-" + (this.position)) }
}
if (this.enterClass || this.leaveClass) {
return {
enterActiveClass: this.enterClass,
leaveActiveClass: this.leaveClass
}
}
return { name: this.transition || 'q-modal' }
},
modalCss: function modalCss () {
if (this.position) {
var css = Array.isArray(this.contentCss)
? this.contentCss
: [this.contentCss];
css.unshift(Object.assign(
{},
positionCSS,
additionalCSS(this.position)
));
return css
}
return this.contentCss
}
},
methods: {
__dismiss: function __dismiss () {
var this$1 = this;
if (this.noBackdropDismiss) {
this.__shake();
return
}
this.hide().then(function () {
this$1.$emit('dismiss');
});
},
__show: function __show () {
var this$1 = this;
if (!this.noRefocus) {
this.__refocusTarget = document.activeElement;
}
document.body.appendChild(this.$el);
this.__register(true);
preventScroll(true);
EscapeKey.register(function () {
if (this$1.noEscDismiss) {
this$1.__shake();
}
else {
this$1.$emit('escape-key');
this$1.hide().then(function () {
this$1.$emit('dismiss');
});
}
});
var content = this.$refs.content;
if (this.$q.platform.is.ios) {
// workaround the iOS hover/touch issue
content.click();
}
content.scrollTop = 0
;['modal-scroll', 'layout-view'].forEach(function (c) {
[].slice.call(content.getElementsByClassName(c)).forEach(function (el) {
el.scrollTop = 0;
});
});
this.$nextTick(function () { return content && content.focus(); });
},
__hide: function __hide () {
this.__cleanup();
if (!this.noRefocus && this.__refocusTarget) {
this.__refocusTarget.focus();
!this.__refocusTarget.classList.contains('q-if') && this.__refocusTarget.blur();
}
},
__cleanup: function __cleanup () {
EscapeKey.pop();