UNPKG

quasar-framework

Version:

Simultaneously build desktop/mobile SPA websites & phone/tablet apps with VueJS

1,805 lines (1,516 loc) 239 kB
/*! * Quasar Framework v0.8.3 * (c) 2016 Razvan Stoenescu * Released under the MIT License. */ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var Velocity$1 = _interopDefault(require('velocity-animate')); var moment = _interopDefault(require('moment')); var FastClick = _interopDefault(require('fastclick')); function getUserAgent() { return (navigator.userAgent || navigator.vendor || window.opera).toLowerCase(); } 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() { var userAgent = getUserAgent(), 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; } 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; } if (browser.ipod || browser.ipad || browser.iphone) { browser.ios = true; } if (browser['windows phone']) { browser.winphone = true; delete browser['windows phone']; } if (browser.cros || browser.mac || browser.linux || browser.win) { browser.desktop = true; } if (browser.chrome || browser.opr || browser.safari || browser.vivaldi) { browser.webkit = true; } if (browser.rv || browser.iemobile) { matched.browser = 'ie'; browser.ie = true; } if (browser.edge) { matched.browser = 'edge'; browser.edge = true; } if (browser.safari && browser.blackberry || browser.bb) { matched.browser = 'blackberry'; browser.blackberry = true; } if (browser.safari && browser.playbook) { matched.browser = 'playbook'; browser.playbook = true; } if (browser.opr) { matched.browser = 'opera'; browser.opera = true; } if (browser.safari && browser.android) { matched.browser = 'android'; browser.android = true; } if (browser.safari && browser.kindle) { matched.browser = 'kindle'; browser.kindle = true; } if (browser.safari && browser.silk) { matched.browser = 'silk'; browser.silk = true; } if (browser.vivaldi) { matched.browser = 'vivaldi'; browser.vivaldi = true; } browser.name = matched.browser; browser.platform = matched.platform; if (window._cordovaNative) { browser.cordova = true; } return browser; } var Platform = { is: getPlatform(), has: { touch: function () { return !!('ontouchstart' in document.documentElement) || window.navigator.msMaxTouchPoints > 0; }() }, within: { iframe: window.self !== window.top } }; var bus = void 0; function install$1(_Vue) { bus = new _Vue(); } var Events = { $on: function $on() { var _bus; bus && (_bus = bus).$on.apply(_bus, arguments); }, $once: function $once() { var _bus2; bus && (_bus2 = bus).$once.apply(_bus2, arguments); }, $emit: function $emit() { var _bus3; bus && (_bus3 = bus).$emit.apply(_bus3, arguments); }, $off: function $off() { var _bus4; bus && (_bus4 = bus).$off.apply(_bus4, arguments); } }; function rgbToHex(red, green, blue) { if (typeof red === 'string') { var res = red.match(/\b\d{1,3}\b/g).map(Number); red = res[0]; green = res[1]; blue = res[2]; } if (typeof red !== 'number' || typeof green !== 'number' || typeof blue !== 'number' || red > 255 || green > 255 || blue > 255) { throw new TypeError('Expected three numbers below 256'); } return (blue | green << 8 | red << 16 | 1 << 24).toString(16).slice(1); } 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]; } var num = parseInt(hex, 16); return [num >> 16, num >> 8 & 255, num & 255]; } var colors = Object.freeze({ rgbToHex: rgbToHex, hexToRgb: hexToRgb }); var now = Date.now; var debounce$1 = function (fn) { var wait = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250; var immediate = arguments[2]; var timeout = void 0, params = void 0, context = void 0, timestamp = void 0, result = void 0, later = function later() { var last = now() - timestamp; if (last < wait && last >= 0) { timeout = setTimeout(later, wait - last); } else { timeout = null; if (!immediate) { result = fn.apply(context, params); if (!timeout) { context = params = null; } } } }; return function () { var callNow = immediate && !timeout; context = this; timestamp = now(); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } params = args; if (!timeout) { timeout = setTimeout(later, wait); } if (callNow) { result = fn.apply(context, args); context = params = null; } return result; }; }; function offset(el) { if (el === window) { return { top: 0, left: 0 }; } var _el$getBoundingClient = el.getBoundingClientRect(), top = _el$getBoundingClient.top, left = _el$getBoundingClient.left; return { top: top, left: left }; } function style(el, property) { return window.getComputedStyle(el).getPropertyValue(property); } function height$1(el) { if (el === window) { return viewport().height; } return parseFloat(window.getComputedStyle(el).getPropertyValue('height'), 10); } function width$1(el) { if (el === window) { return viewport().width; } return parseFloat(window.getComputedStyle(el).getPropertyValue('width'), 10); } function css$1(element, css) { var style = element.style; Object.keys(css).forEach(function (prop) { style[prop] = css[prop]; }); } function viewport() { var e = window, a = 'inner'; if (!('innerWidth' in window)) { a = 'client'; e = document.documentElement || document.body; } return { width: e[a + 'Width'], height: e[a + 'Height'] }; } function ready$1(fn) { if (typeof fn !== 'function') { return; } if (document.readyState === 'complete') { return fn(); } document.addEventListener('DOMContentLoaded', fn, false); } function getScrollTarget(el) { return el.closest('.layout-view') || window; } function getScrollPosition(scrollTarget) { if (scrollTarget === window) { return window.pageYOffset || window.scrollY || document.body.scrollTop || 0; } return scrollTarget.scrollTop; } var dom = Object.freeze({ offset: offset, style: style, height: height$1, width: width$1, css: css$1, viewport: viewport, ready: ready$1, getScrollTarget: getScrollTarget, getScrollPosition: getScrollPosition }); function rightClick(e) { if (!e) { e = window.event; } if (e.which) { return e.which == 3; } if (e.button) { return e.button == 2; } return false; } function position$1(e) { var posx = void 0, posy = void 0; if (!e) { e = window.event; } 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; } return { top: posy, left: posx }; } function targetElement$1(e) { var target = void 0; if (!e) { e = window.event; } if (e.target) { target = e.target; } else if (e.srcElement) { target = e.srcElement; } if (target.nodeType === 3) { target = target.parentNode; } return target; } var event = Object.freeze({ rightClick: rightClick, position: position$1, targetElement: targetElement$1 }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var asyncGenerator = function () { function AwaitValue(value) { this.value = value; } function AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; if (value instanceof AwaitValue) { Promise.resolve(value.value).then(function (arg) { resume("next", arg); }, function (arg) { resume("throw", arg); }); } else { settle(result.done ? "return" : "normal", result.value); } } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen.return !== "function") { this.return = undefined; } } if (typeof Symbol === "function" && Symbol.asyncIterator) { AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; } AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); }; AsyncGenerator.prototype.throw = function (arg) { return this._invoke("throw", arg); }; AsyncGenerator.prototype.return = function (arg) { return this._invoke("return", arg); }; return { wrap: function (fn) { return function () { return new AsyncGenerator(fn.apply(this, arguments)); }; }, await: function (value) { return new AwaitValue(value); } }; }(); var get$1 = function get$1(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get$1(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; var set$1 = function set$1(object, property, value, receiver) { var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent !== null) { set$1(parent, property, value, receiver); } } else if ("value" in desc && desc.writable) { desc.value = value; } else { var setter = desc.set; if (setter !== undefined) { setter.call(receiver, value); } } return value; }; var toString = Object.prototype.toString; var hasOwn = Object.prototype.hasOwnProperty; var class2type = {}; 'Boolean Number String Function Array Date RegExp Object'.split(' ').forEach(function (name) { class2type['[object ' + name + ']'] = name.toLowerCase(); }); function type$1(obj) { return obj == null ? String(obj) : class2type[toString.call(obj)] || 'object'; } function isPlainObject(obj) { if (!obj || type$1(obj) !== 'object') { return false; } if (obj.constructor && !hasOwn.call(obj, 'constructor') && !hasOwn.call(obj.constructor.prototype, 'isPrototypeOf')) { return false; } var key = void 0; for (key in obj) {} return key === undefined || hasOwn.call(obj, key); } function extend() { var options = void 0, name = void 0, src = void 0, copy = void 0, copyIsArray = void 0, clone = void 0, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; if (typeof target === 'boolean') { deep = target; target = arguments[1] || {}; i = 2; } if ((typeof target === 'undefined' ? 'undefined' : _typeof(target)) !== 'object' && type$1(target) !== 'function') { target = {}; } if (length === i) { target = this; i--; } for (; i < length; i++) { if ((options = arguments[i]) != null) { for (name in options) { src = target[name]; copy = options[name]; if (target === copy) { continue; } if (deep && copy && (isPlainObject(copy) || (copyIsArray = type$1(copy) === 'array'))) { if (copyIsArray) { copyIsArray = false; clone = src && type$1(src) === 'array' ? src : []; } else { clone = src && isPlainObject(src) ? src : {}; } target[name] = extend(deep, clone, copy); } else if (copy !== undefined) { target[name] = copy; } } } } return target; } var getVueRef = function (vm, refName) { var parent = vm.$parent; while (parent && (!parent.$refs || !parent.$refs[refName])) { parent = parent.$parent; } if (parent) { return parent.$refs[refName]; } }; var ModalGenerator = function (VueComponent) { return { create: function create(props) { var node = document.createElement('div'); document.body.appendChild(node); var vm = new Vue({ el: node, data: function data() { return { props: props }; }, render: function render(h) { return h(VueComponent, { props: props }); } }); return { close: function close(fn) { vm.quasarClose(fn); } }; } }; }; var Dialog$1 = { render: function render() { with(this) { return _h('quasar-modal', { ref: "dialog", staticClass: "minimized" }, [_h('div', { staticClass: "modal-header", domProps: { "innerHTML": _s(title || '') } }), message ? _h('div', { staticClass: "modal-body modal-scroll", domProps: { "innerHTML": _s(message) } }) : _e(), form ? _h('div', { staticClass: "modal-body modal-scroll" }, [_l(form, function (el) { return [el.type === 'heading' ? _h('h6', { domProps: { "innerHTML": _s(el.label) } }) : _e(), el.type === 'textbox' ? _h('div', { staticClass: "floating-label", attrs: { "style": "margin-bottom: 10px" } }, [_h('input', { directives: [{ name: "model", rawName: "v-model", value: el.model, expression: "el.model" }], staticClass: "full-width", attrs: { "type": "text", "placeholder": el.placeholder, "required": "" }, domProps: { "value": _s(el.model) }, on: { "input": function input($event) { if ($event.target.composing) return;el.model = $event.target.value; } } }), _h('label', { domProps: { "innerHTML": _s(el.label) } })]) : _e(), el.type === 'textarea' ? _h('div', { staticClass: "floating-label", attrs: { "style": "margin-bottom: 10px" } }, [_h('textarea', { directives: [{ name: "model", rawName: "v-model", value: el.model, expression: "el.model" }], staticClass: "full-width", attrs: { "type": "text", "placeholder": el.placeholder, "required": "" }, domProps: { "value": _s(el.model) }, on: { "input": function input($event) { if ($event.target.composing) return;el.model = $event.target.value; } } }), _h('label', { domProps: { "innerHTML": _s(el.label) } })]) : _e(), el.type === 'numeric' ? _h('div', { attrs: { "style": "margin-bottom: 10px" } }, [_h('label', { domProps: { "innerHTML": _s(el.label) } }), _h('quasar-numeric', { directives: [{ name: "model", rawName: "v-model", value: el.model, expression: "el.model" }], attrs: { "min": el.min, "max": el.max, "step": el.step }, domProps: { "value": el.model }, on: { "input": function input($event) { el.model = $event; } } })]) : _e(), el.type === 'chips' ? _h('div', { attrs: { "style": "margin-bottom: 10px" } }, [_h('label', { domProps: { "innerHTML": _s(el.label) } }), _h('quasar-chips', { directives: [{ name: "model", rawName: "v-model", value: el.model, expression: "el.model" }], domProps: { "value": el.model }, on: { "input": function input($event) { el.model = $event; } } })]) : _e(), _l(el.items, function (radio) { return el.type === 'radio' ? _h('label', { staticClass: "item" }, [_h('div', { staticClass: "item-primary" }, [_h('quasar-radio', { directives: [{ name: "model", rawName: "v-model", value: el.model, expression: "el.model" }], attrs: { "val": radio.value }, domProps: { "value": el.model }, on: { "input": function input($event) { el.model = $event; } } })]), _h('div', { staticClass: "item-content", domProps: { "innerHTML": _s(radio.label) } })]) : _e(); }), _l(el.items, function (checkbox) { return el.type === 'checkbox' ? _h('label', { staticClass: "item" }, [_h('div', { staticClass: "item-primary" }, [_h('quasar-checkbox', { directives: [{ name: "model", rawName: "v-model", value: checkbox.model, expression: "checkbox.model" }], domProps: { "value": checkbox.model }, on: { "input": function input($event) { checkbox.model = $event; } } })]), _h('div', { staticClass: "item-content", domProps: { "innerHTML": _s(checkbox.label) } })]) : _e(); }), _l(el.items, function (toggle) { return el.type === 'toggle' ? _h('label', { staticClass: "item" }, [_h('div', { staticClass: "item-content has-secondary", domProps: { "innerHTML": _s(toggle.label) } }), _h('div', { staticClass: "item-secondary" }, [_h('quasar-toggle', { directives: [{ name: "model", rawName: "v-model", value: toggle.model, expression: "toggle.model" }], domProps: { "value": toggle.model }, on: { "input": function input($event) { toggle.model = $event; } } })])]) : _e(); }), el.type === 'rating' ? _h('div', { attrs: { "style": "margin-bottom: 10px" } }, [_h('label', { domProps: { "innerHTML": _s(el.label) } }), _h('quasar-rating', { directives: [{ name: "model", rawName: "v-model", value: el.model, expression: "el.model" }], style: { fontSize: el.size || '2rem' }, attrs: { "max": el.max, "icon": el.icon }, domProps: { "value": el.model }, on: { "input": function input($event) { el.model = $event; } } })]) : _e()]; })]) : _e(), progress ? _h('div', { staticClass: "modal-body" }, [_h('quasar-progress', { staticClass: "primary stripe animate", class: { indeterminate: progress.indeterminate }, attrs: { "percentage": progress.model } }), !progress.indeterminate ? _h('span', [_s(progress.model) + " %"]) : _e()]) : _e(), buttons ? _h('div', { staticClass: "modal-buttons", class: { row: !stackButtons, column: stackButtons } }, [_l(buttons, function (button) { return _h('button', { staticClass: "primary clear", domProps: { "innerHTML": _s(typeof button === 'string' ? button : button.label) }, on: { "click": function click($event) { trigger(button.handler); } } }); })]) : _e(), !buttons && !nobuttons ? _h('div', { staticClass: "modal-buttons row" }, [_h('button', { staticClass: "primary clear", on: { "click": function click($event) { close(); } } }, ["OK"])]) : _e()]); } }, staticRenderFns: [], props: { title: String, message: String, form: Object, stackButtons: Boolean, buttons: Array, nobuttons: Boolean, progress: Object }, computed: { opened: function opened() { return this.$refs.dialog.active; } }, methods: { trigger: function trigger(handler) { var _this = this; this.close(function () { if (typeof handler === 'function') { handler(_this.getFormData()); } }); }, getFormData: function getFormData() { var _this2 = this; if (!this.form) { return; } var data = {}; Object.keys(this.form).forEach(function (name) { var el = _this2.form[name]; if (['checkbox', 'toggle'].includes(el.type)) { data[name] = el.items.filter(function (item) { return item.model; }).map(function (item) { return item.value; }); } else if (el.type !== 'heading') { data[name] = el.model; } }); return data; }, close: function close(fn) { var _this3 = this; if (!this.opened) { return; } this.$refs.dialog.close(function () { if (typeof fn === 'function') { fn(); } _this3.$root.$destroy(); }); } }, mounted: function mounted() { this.$refs.dialog.open(); this.$root.quasarClose = this.close; }, destroyed: function destroyed() { if (document.body.contains(this.$el)) { document.body.removeChild(this.$el); } } }; var Dialog = ModalGenerator(Dialog$1); var openURL = (function (url) { if (Platform.is.cordova) { navigator.app.loadUrl(url, { openExternal: true }); return; } var win = window.open(url, '_blank'); if (win) { win.focus(); } else { Dialog.create({ title: 'Cannot Open Window', message: 'Please allow popups first, then please try again.' }).show(); } }); function s4() { return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); } var uid$1 = function () { return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); }; var data$1 = {}; function add$1(name, el, ctx) { var id = uid$1(); el.dataset['__' + name] = id; if (!data$1[name]) { data$1[name] = {}; } else if (data$1[name][id]) { console.warn('Element store [add]: overwriting data'); } data$1[name][id] = ctx; } function get$2(name, el) { var id = el.dataset['__' + name]; if (!id) { console.warn('Element store [get]: id not registered', name, el); return; } if (!data$1[name]) { console.warn('Element store [get]: name not registered', name, el); return; } var ctx = data$1[name][id]; if (!ctx) { console.warn('Element store [get]: data not found for', name, ':', id, '->', el); return; } return ctx; } function remove$1(name, el) { var id = el.dataset['__' + name]; if (!id) { console.warn('Element store [remove]: id not registered', name, el); return; } if (data$1[name] && data$1[name][id]) { delete data$1[name][id]; } } var store = Object.freeze({ add: add$1, get: get$2, remove: remove$1 }); var throttle = function (fn) { var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250; var wait = false; return function () { if (wait) { return; } wait = true; for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } fn.apply(this, args); setTimeout(function () { wait = false; }, limit); }; }; var Utils = { colors: colors, debounce: debounce$1, dom: dom, event: event, extend: extend, getVueRef: getVueRef, openURL: openURL, store: store, throttle: throttle, uid: uid$1 }; var transitionDuration = 300; var displayDuration = 2500; function parseOptions(opts, defaults) { if (!opts) { throw new Error('Missing toast options.'); } var options = Utils.extend(true, {}, defaults, typeof opts === 'string' ? { html: opts } : opts); if (!options.html) { throw new Error('Missing toast content/HTML.'); } return options; } var Toast$1 = { render: function render() { with(this) { return _h('div', { staticClass: "quasar-toast-container", class: { active: active } }, [stack[0] ? _h('div', { staticClass: "quasar-toast row no-wrap items-center non-selectable", class: classes, style: { color: stack[0].color, background: stack[0].bgColor } }, [stack[0].icon ? _h('i', [_s(stack[0].icon)]) : _e(), " ", stack[0].image ? _h('img', { attrs: { "src": stack[0].image } }) : _e(), _h('div', { staticClass: "quasar-toast-message auto", domProps: { "innerHTML": _s(stack[0].html) } }), stack[0].button && stack[0].button.label ? _h('a', { style: { color: stack[0].button.color }, on: { "click": function click($event) { dismiss(stack[0].button.handler); } } }, [_s(stack[0].button.label) + " "]) : _e(), _h('a', { style: { color: stack[0].button.color }, on: { "click": function click($event) { dismiss(); } } }, [_m(0)])]) : _e()]); } }, staticRenderFns: [function () { with(this) { return _h('i', ["close"]); } }], data: function data() { return { active: false, inTransition: false, stack: [], timer: null, defaults: { color: 'white', bgColor: '#323232', button: { color: 'yellow' } } }; }, computed: { classes: function classes() { if (!this.stack.length || !this.stack[0].classes) { return {}; } return this.stack[0].classes.split(' '); } }, methods: { create: function create(options) { this.stack.push(parseOptions(options, this.defaults)); if (this.active || this.inTransition) { return; } this.active = true; this.inTransition = true; this.__show(); }, __show: function __show() { var _this = this; Events.$emit('app:toast', this.stack[0].html); this.timer = setTimeout(function () { if (_this.stack.length > 0) { _this.dismiss(); } else { _this.inTransition = false; } }, transitionDuration + (this.stack[0].timeout || displayDuration)); }, dismiss: function dismiss(done) { var _this2 = this; this.active = false; if (this.timer) { clearTimeout(this.timer); this.timer = null; } setTimeout(function () { if (typeof _this2.stack[0].onDismiss === 'function') { _this2.stack[0].onDismiss(); } _this2.stack.shift(); done && done(); if (_this2.stack.length > 0) { _this2.active = true; _this2.__show(); return; } _this2.inTransition = false; }, transitionDuration + 50); }, setDefaults: function setDefaults(opts) { Utils.extend(true, this.defaults, opts); } } }; var toast = void 0; var types = [{ name: 'positive', defaults: { icon: 'check', classes: 'bg-positive' } }, { name: 'negative', defaults: { icon: 'whatshot', classes: 'bg-negative' } }, { name: 'info', defaults: { icon: 'info', classes: 'bg-info' } }, { name: 'warning', defaults: { icon: 'warning', classes: 'bg-warning' } }]; function create$1(opts, defaults) { if (!opts) { throw new Error('Missing toast options.'); } if (defaults) { opts = Utils.extend(true, typeof opts === 'string' ? { html: opts } : opts, defaults); } toast.create(opts); } types.forEach(function (type) { create$1[type.name] = function (opts) { return create$1(opts, type.defaults); }; }); function install$2(_Vue) { var node = document.createElement('div'); document.body.appendChild(node); toast = new _Vue(Toast$1).$mount(node); } var Toast = { create: create$1, setDefaults: function setDefaults(opts) { toast.setDefaults(opts); }, install: install$2 }; function set$2(theme) { if (current) { document.body.classList.remove(current); } current = theme; document.body.classList.add(theme); if (Platform.is.mobile && !Platform.is.cordova) { var tempDiv = document.createElement('div'); tempDiv.style.height = '10px'; tempDiv.style.position = 'absolute'; tempDiv.style.top = '-100000px'; tempDiv.className = 'bg-primary'; document.body.appendChild(tempDiv); var primaryColor = window.getComputedStyle(tempDiv).getPropertyValue('background-color'); document.body.removeChild(tempDiv); var rgb = primaryColor.match(/\d+/g); var hex = '#' + Utils.colors.rgbToHex(parseInt(rgb[0]), parseInt(rgb[1]), parseInt(rgb[2])); var metaTag = document.createElement('meta'); if (Platform.is.winphone) { metaTag.setAttribute('name', 'msapplication-navbutton-color'); } if (Platform.is.webkit || Platform.is.vivaldi) { metaTag.setAttribute('name', 'theme-color'); } if (Platform.is.safari) { metaTag.setAttribute('name', 'apple-mobile-web-app-status-bar-style'); } metaTag.setAttribute('content', hex); document.getElementsByTagName('head')[0].appendChild(metaTag); } } var current; var theme$1 = Object.freeze({ set: set$2, get current () { return current; } }); var slide$1 = { enter: function enter(el, done) { Velocity(el, 'stop'); Velocity(el, 'slideDown', done); }, enterCancelled: function enterCancelled(el) { Velocity(el, 'stop'); el.removeAttribute('style'); }, leave: function leave(el, done) { Velocity(el, 'stop'); Velocity(el, 'slideUp', done); }, leaveCancelled: function leaveCancelled(el) { Velocity(el, 'stop'); el.removeAttribute('style'); } }; var transitions = { slide: slide$1 }; var Transition = { functional: true, props: { name: { type: String, default: 'slide', validator: function validator(value) { if (!transitions[value]) { console.error('Quasar Transition unknown: ' + value); return false; } return true; } } }, render: function render(h, context) { if (!transitions[context.props.name]) { throw new Error('Quasar Transition ' + context.props.name + ' is unnowkn.'); } var data = { props: { name: 'quasar-transition', mode: 'out-in' }, on: transitions[context.props.name] }; return h('transition', data, context.children); } }; var dGoBack = { bind: function bind(el, _ref, vnode) { var value = _ref.value, modifiers = _ref.modifiers; var ctx = { value: value, position: window.history.length - 1, single: modifiers.single }; if (Platform.is.cordova) { ctx.goBack = function () { vnode.context.$router.go(ctx.single ? -1 : ctx.position - window.history.length); }; } else { ctx.goBack = function () { vnode.context.$router.replace(ctx.value); }; } Utils.store.add('goback', el, ctx); el.addEventListener('click', ctx.goBack); }, update: function update(el, binding) { if (binding.oldValue !== binding.value) { var ctx = Utils.store.get('goback', el); ctx.value = binding.value; } }, unbind: function unbind(el) { el.removeEventListener('click', Utils.store.get('goback', el).goBack); Utils.store.remove('goback', el); } }; var dLink = { bind: function bind(el, binding, vnode) { var ctx = { replace: binding.replace, route: binding.value, go: function go() { vnode.context.$router[ctx.replace ? 'replace' : 'push'](ctx.route); } }; Utils.store.add('link', el, ctx); el.addEventListener('click', ctx.go); }, update: function update(el, binding) { var ctx = Utils.store.get('link', el); if (binding.oldValue !== binding.value) { ctx.route = binding.value; } if (binding.replace !== ctx.replace) { ctx.replace = binding.replace; } }, unbind: function unbind(el) { el.removeEventListener('click', Utils.store.get('link', el).go); Utils.store.remove('link', el); } }; function updateBinding(el, binding, ctx) { if (typeof binding.value !== 'function') { ctx.scrollTarget.removeEventListener('scroll', ctx.scroll); console.error('v-scroll-fire requires a function as parameter', el); return; } ctx.handler = binding.value; if (typeof binding.oldValue !== 'function') { ctx.scrollTarget.addEventListener('scroll', ctx.scroll); ctx.scroll(); } } var dScrollFire = { bind: function bind(el, binding) { var ctx = { scroll: Utils.debounce(function () { var containerBottom = void 0, elementBottom = void 0, fire = void 0; if (ctx.scrollTarget === window) { elementBottom = el.getBoundingClientRect().bottom; fire = elementBottom < Utils.dom.viewport().height; } else { containerBottom = Utils.dom.offset(ctx.scrollTarget).top + Utils.dom.height(ctx.scrollTarget); elementBottom = Utils.dom.offset(el).top + Utils.dom.height(el); fire = elementBottom < containerBottom; } if (fire) { ctx.scrollTarget.removeEventListener('scroll', ctx.scroll); ctx.handler(el); } }, 25) }; Utils.store.add('scrollfire', el, ctx); }, inserted: function inserted(el, binding) { var ctx = Utils.store.get('scrollfire', el); ctx.scrollTarget = Utils.dom.getScrollTarget(el); updateBinding(el, binding, ctx); }, update: function update(el, binding) { if (binding.value !== binding.oldValue) { updateBinding(el, binding, Utils.store.get('scrollfire', el)); } }, unbind: function unbind(el) { var ctx = Utils.store.get('scrollfire', el); ctx.scrollTarget.removeEventListener('scroll', ctx.scroll); Utils.store.remove('scrollfire', el); } }; function updateBinding$1(el, binding, ctx) { if (typeof binding.value !== 'function') { ctx.scrollTarget.removeEventListener('scroll', ctx.scroll); console.error('v-scroll requires a function as parameter', el); return; } ctx.handler = binding.value; if (typeof binding.oldValue !== 'function') { ctx.scrollTarget.addEventListener('scroll', ctx.scroll); } } var dScroll = { bind: function bind(el, binding) { var ctx = { scroll: function scroll() { ctx.handler(Utils.dom.getScrollPosition(ctx.scrollTarget)); } }; Utils.store.add('scroll', el, ctx); }, inserted: function inserted(el, binding) { var ctx = Utils.store.get('scroll', el); ctx.scrollTarget = Utils.dom.getScrollTarget(el); updateBinding$1(el, binding, ctx); }, update: function update(el, binding) { if (binding.oldValue !== binding.value) { updateBinding$1(el, binding, Utils.store.get('scrollfire', el)); } }, unbind: function unbind(el) { var ctx = Utils.store.get('scroll', el); ctx.scrollTarget.removeEventListener('scroll', ctx.scroll); Utils.store.remove('scroll', el); } }; var dTooltip = { bind: function bind(el, binding) { el.setAttribute('quasar-tooltip', binding.value); el.classList.add('quasar-tooltip'); if (binding.modifiers.inline) { el.classList.add('flex', 'inline'); } }, update: function update(el, binding) { if (binding.value !== binding.oldValue) { el.setAttribute('quasar-tooltip', binding.value); } }, unbind: function unbind(el) { el.removeAttribute('quasar-tooltip'); } }; var defaultDuration = 800; function updateBinding$2(el, binding, ctx) { ctx.duration = parseInt(binding.arg, 10) || defaultDuration; if (binding.oldValue !== binding.value) { ctx.handler = binding.value; } } var dTouchHold = { bind: function bind(el, binding) { var ctx = { start: function start(evt) { ctx.timer = setTimeout(function () { document.removeEventListener('mousemove', ctx.mouseAbort); document.removeEventListener('mouseup', ctx.mouseAbort); ctx.handler(); }, ctx.duration); }, mouseStart: function mouseStart(evt) { document.addEventListener('mousemove', ctx.mouseAbort); document.addEventListener('mouseup', ctx.mouseAbort); ctx.start(evt); }, abort: function abort(evt) { if (ctx.timer) { clearTimeout(ctx.timer); ctx.timer = null; } }, mouseAbort: function mouseAbort(evt) { document.removeEventListener('mousemove', ctx.mouseAbort); document.removeEventListener('mouseup', ctx.mouseAbort); ctx.abort(evt); } }; Utils.store.add('touchhold', el, ctx); updateBinding$2(el, binding, ctx); el.addEventListener('touchstart', ctx.start); el.addEventListener('touchmove', ctx.abort); el.addEventListener('touchend', ctx.abort); el.addEventListener('mousedown', ctx.mouseStart); }, update: function update(el, binding) { updateBinding$2(el, binding, Utils.store.get('touchhold', el)); }, unbind: function unbind(el, binding) { var ctx = Utils.store.get('touchhold', el); el.removeEventListener('touchstart', ctx.start); el.removeEventListener('touchmove', ctx.abort); el.removeEventListener('touchend', ctx.abort); el.removeEventListener('mousedown', ctx.mouseStart); document.removeEventListener('mousemove', ctx.mouseAbort); document.removeEventListener('mouseup', ctx.mouseAbort); Utils.store.remove('touchhold'); } }; function getDirection(mod) { if (Object.keys(mod).length === 0) { return { horizontal: true, vertical: true }; } var dir = {};['horizontal', 'vertical'].forEach(function (direction) { if (mod[direction]) { dir[direction] = true; } }); return dir; } function updateClasses(el, dir) { el.classList.add('quasar-touch'); if (dir.horizontal && !dir.vertical) { el.classList.add('quasar-touch-y'); el.classList.remove('quasar-touch-x'); } else if (!dir.horizontal && dir.vertical) { el.classList.add('quasar-touch-x'); el.classList.remove('quasar-touch-y'); } } function processChanges(evt, ctx, isFinal) { var direction = void 0, position = Utils.event.position(evt), distX = position.left - ctx.event.x, distY = position.top - ctx.event.y, absDistX = Math.abs(distX), absDistY = Math.abs(distY); if (ctx.direction.horizontal && !ctx.direction.vertical) { direction = distX < 0 ? 'left' : 'right'; } else if (!ctx.direction.horizontal && ctx.direction.vertical) { direction = distY < 0 ? 'up' : 'down'; } else if (absDistX >= absDistY) { direction = distX < 0 ? 'left' : 'right'; } else { direction = distY < 0 ? 'up' : 'down'; } return { evt: evt, position: position, direction: direction, isFirst: ctx.event.isFirst, isFinal: Boolean(isFinal), duration: new Date().getTime() - ctx.event.time, distance: { x: absDistX, y: absDistY }, delta: { x: position.left - ctx.event.lastX, y: position.top - ctx.event.lastY } }; } function shouldTrigger(ctx, changes) { if (ctx.direction.horizontal && ctx.direction.vertical) { return true; } if (ctx.direction.horizontal && !ctx.direction.vertical) { return Math.abs(changes.delta.x) > 0; } if (!ctx.direction.horizontal && ctx.direction.vertical) { return Math.abs(changes.delta.y) > 0; } } var dTouchPan = { bind: function bind(el, binding) { var ctx = { handler: binding.value, direction: getDirection(binding.modifiers), mouseStart: function mouseStart(evt) { document.addEventListener('mousemove', ctx.mouseMove); document.addEventListener('mouseup', ctx.mouseEnd); ctx.start(evt); }, start: function start(evt) { var position = Utils.event.position(evt); ctx.event = { x: position.left, y: position.top, time: new Date().getTime(), detected: false, prevent: ctx.direction.horizontal && ctx.direction.vertical, isFirst: true, lastX: position.left, lastY: position.top }; }, mouseMove: function mouseMove(evt) { ctx.event.prevent = true; ctx.move(evt); }, move: function move(evt) { if (ctx.event.prevent) { evt.preventDefault(); var changes = processChanges(evt, ctx, false); if (shouldTrigger(ctx, changes)) { ctx.handler(changes); ctx.event.lastX = changes.position.left; ctx.event.lastY = changes.position.top; ctx.event.isFirst = false; } return; } if (ctx.event.detected) { return; } ctx.event.detected = true; var position = Utils.event.position(evt), distX = position.left - ctx.event.x, distY = position.top - ctx.event.y; if (ctx.direction.horizontal && !ctx.direction.vertical) { if (Math.abs(distX) > Math.abs(distY)) { evt.preventDefault(); ctx.event.prevent = true; } } else { if (Math.abs(distX) < Math.abs(distY)) { evt.preventDefault(); ctx.event.prevent = true; } } }, mouseEnd: function mouseEnd(evt) { document.removeEventListener('mousemove', ctx.mouseMove); document.removeEventListener('mouseup', ctx.mouseEnd); ctx.end(evt); }, end: function end(evt) { if (!ctx.event.prevent || ctx.event.isFirst) { return; } ctx.handler(processChanges(evt, ctx, true)); } }; Utils.store.add('touchpan', el, ctx); updateClasses(el, ctx.direction); el.addEventListener('touchstart', ctx.start); el.addEventListener('mousedown', ctx.mouseStart); el.addEventListener('touchmove', ctx.move); el.addEventListener('touchend', ctx.end); }, update: function update(el, binding) { if (binding.oldValue !== binding.value) { var ctx = Utils.store.get('touchpan', el); ctx.handler = binding.value; } }, unbind: function unbind(el, binding) { var ctx = Utils.store.get('touchpan', el); el.removeEventListener('touchstart', ctx.start); el.removeEventListener('mousedown', ctx.mouseStart); el.removeEventListener('touchmove', ctx.move); el.removeEventListener('touchend', ctx.end); Utils.store.remove('touchpan', el); } }; function getDirection$1(mod) { if (Object.keys(mod).length === 0) { return { left: true, right: true, up: true, down: true, horizontal: true, vertical: true }; } var dir = {};['left', 'right', 'up', 'down', 'horizontal', 'vertical'].forEach(function (direction) { if (mod[direction]) { dir[direction] = true; } }); if (dir.horizontal) { dir.left = dir.right = true; } if (dir.vertical) { dir.up = dir.down = true; } if (dir.left || dir.right) { dir.horizontal = true; } if (dir.up || dir.down) { dir.vertical = true; } return dir; } function updateClasses$1(el, dir) { el.classList.add('quasar-touch'); if (dir.horizontal && !dir.vertical) { el.classList.add('quasar-touch-y'); el.classList.remove('quasar-touch-x'); } else if (!dir.horizontal && dir.vertical) { el.classList.add('quasar-touch-x'); el.classList.remove('quasar-touch-y'); } } var dTouchSwipe = { bind: function bind(el, binding) { var ctx = { handler: binding.value, direction: getDirection$1(binding.modifiers), start: function start(evt) { var position = Utils.event.position(evt); ctx.event = { x: position.left, y: position.top, time: new Date().getTime(), detected: false, prevent: ctx.direction.horizontal && ctx.direction.vertical }; document.addEventListener('mousemove', ctx.move); document.addEventListener('mouseup', ctx.end); }, move: function move(evt) { var position = Utils.event.position(evt), distX = position.left - ctx.event.x, distY = position.top - ctx.event.y; if (ctx.event.prevent) { evt.preventDefault(); return; } if (ctx.event.detected) { return; } ctx.event.detected = true; if (ctx.direction.horizontal && !ctx.direction.vertical) { if (Math.abs(distX) > Math.abs(distY)) { evt.preventDefault(); ctx.event.prevent = true; } } else { if (Math.abs(distX) < Math.abs(distY)) { evt.preventDefault(); ctx.event.prevent = true; } } }, end: function end(evt) { document.removeEventListener('mousemove', ctx.move); document.removeEventListener('mouseup', ctx.end); var direction = void 0, position = Utils.event.position(evt), distX = position.left - ctx.event.x, distY = position.top - ctx.event.y; if (distX !== 0 || distY !== 0) { if (Math.abs(distX) >= Math.abs(distY)) { direction = distX < 0 ? 'left' : 'right'; } else { direction = distY < 0 ? 'up' : 'down'; } if (ctx.direction[direction]) { ctx.handler({ evt: evt, direction: direction, duration: new Date().getTime() - ctx.event.time, distance: { x: Math.abs(distX), y: Math.abs(distY) } }); } } } }; Utils.store.add('touchswipe', el, ctx); updateClasses$1(el, ctx.direction); el.addEventListener('touchstart', ctx.start); el.addEventListener('mousedown', ctx.start); el.addEventListener('touchmove', ctx.move); el.addEventListener('touchend', ctx.end); }, update: function update(el, binding) { if (binding.oldValue !== binding.value) { var ctx = Utils.store.get('touchswipe', el); ctx.handler = binding.value; } }, unbind: function unbind(el, binding) { var ctx = Utils.store.get('touchswipe', el); el.removeEventListener('touchstart', ctx.start); el.removeEventListener('mousedown', ctx.start); el.removeEventListener('touchmove', ctx.move); el.removeEventListener('touchend', ctx.end); Utils.store.remove('touchswipe', el); } }; var Checkbox = { render: function render() { with(this) { return _h('label', { staticClass: "quasar-checkbox", class: { disabled: disable } }, [_h('input', { directives: [{ name: "model", rawName: "v-model", value: model, expression: "model" }], attrs: { "type": "checkbox", "disabled": disable }, domProps: { "checked": Array.isArray(model) ? _i(model, null) > -1 : _q(model, true) }, on: { "change": function change($event) { var $$a = model, $$el = $event.target, $$c = $$el.checked ? true : false;if (Array.isArray($$a)) { var $$v = null, $$i = _i($$a, $$v);if ($$c) { $$i < 0 && (model = $$a.concat($$v)); } else { $$i > -1 && (model = $$a.slice(0, $$i).concat($$a.slice($$i + 1))); } } else { model = $$c; } } } }), _m(0)]); } }, staticRenderFns: [function () { with(this) { return _h('div'); } }], props: { value: { type: Boolean, required: true }, disable: Boolean }, computed: { model: { get: function get() { return this.value; }, set: function set(value) { this.$emit('input', value); } } } }; var Chips = { render: function render() { with(this) { return _h('div', { staticClass: "quasar-chips group", class: { active: active, disabled: disable }, on: { "click": focus } }, [_l(value, function (label, index) {