mirror of
https://github.com/Hopiu/vue-material.git
synced 2026-03-16 22:10:27 +00:00
469 lines
No EOL
12 KiB
JavaScript
469 lines
No EOL
12 KiB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
|
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
module.exports = factory();
|
|
else if(typeof define === 'function' && define.amd)
|
|
define([], factory);
|
|
else if(typeof exports === 'object')
|
|
exports["VueMaterial"] = factory();
|
|
else
|
|
root["VueMaterial"] = factory();
|
|
})(this, (function() {
|
|
return /******/ (function(modules) { // webpackBootstrap
|
|
/******/ // The module cache
|
|
/******/ var installedModules = {};
|
|
|
|
/******/ // The require function
|
|
/******/ function __webpack_require__(moduleId) {
|
|
|
|
/******/ // Check if module is in cache
|
|
/******/ if(installedModules[moduleId])
|
|
/******/ return installedModules[moduleId].exports;
|
|
|
|
/******/ // Create a new module (and put it into the cache)
|
|
/******/ var module = installedModules[moduleId] = {
|
|
/******/ i: moduleId,
|
|
/******/ l: false,
|
|
/******/ exports: {}
|
|
/******/ };
|
|
|
|
/******/ // Execute the module function
|
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
|
|
/******/ // Flag the module as loaded
|
|
/******/ module.l = true;
|
|
|
|
/******/ // Return the exports of the module
|
|
/******/ return module.exports;
|
|
/******/ }
|
|
|
|
|
|
/******/ // expose the modules object (__webpack_modules__)
|
|
/******/ __webpack_require__.m = modules;
|
|
|
|
/******/ // expose the module cache
|
|
/******/ __webpack_require__.c = installedModules;
|
|
|
|
/******/ // identity function for calling harmony imports with the correct context
|
|
/******/ __webpack_require__.i = function(value) { return value; };
|
|
|
|
/******/ // define getter function for harmony exports
|
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
/******/ Object.defineProperty(exports, name, {
|
|
/******/ configurable: false,
|
|
/******/ enumerable: true,
|
|
/******/ get: getter
|
|
/******/ });
|
|
/******/ }
|
|
/******/ };
|
|
|
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
/******/ __webpack_require__.n = function(module) {
|
|
/******/ var getter = module && module.__esModule ?
|
|
/******/ function getDefault() { return module['default']; } :
|
|
/******/ function getModuleExports() { return module; };
|
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
/******/ return getter;
|
|
/******/ };
|
|
|
|
/******/ // Object.prototype.hasOwnProperty.call
|
|
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
|
|
/******/ // __webpack_public_path__
|
|
/******/ __webpack_require__.p = "/";
|
|
|
|
/******/ // Load entry module and return exports
|
|
/******/ return __webpack_require__(__webpack_require__.s = 417);
|
|
/******/ })
|
|
/************************************************************************/
|
|
/******/ ({
|
|
|
|
/***/ 0:
|
|
/***/ (function(module, exports) {
|
|
|
|
module.exports = function normalizeComponent (
|
|
rawScriptExports,
|
|
compiledTemplate,
|
|
scopeId,
|
|
cssModules
|
|
) {
|
|
var esModule
|
|
var scriptExports = rawScriptExports = rawScriptExports || {}
|
|
|
|
// ES6 modules interop
|
|
var type = typeof rawScriptExports.default
|
|
if (type === 'object' || type === 'function') {
|
|
esModule = rawScriptExports
|
|
scriptExports = rawScriptExports.default
|
|
}
|
|
|
|
// Vue.extend constructor export interop
|
|
var options = typeof scriptExports === 'function'
|
|
? scriptExports.options
|
|
: scriptExports
|
|
|
|
// render functions
|
|
if (compiledTemplate) {
|
|
options.render = compiledTemplate.render
|
|
options.staticRenderFns = compiledTemplate.staticRenderFns
|
|
}
|
|
|
|
// scopedId
|
|
if (scopeId) {
|
|
options._scopeId = scopeId
|
|
}
|
|
|
|
// inject cssModules
|
|
if (cssModules) {
|
|
var computed = options.computed || (options.computed = {})
|
|
Object.keys(cssModules).forEach((function (key) {
|
|
var module = cssModules[key]
|
|
computed[key] = function () { return module }
|
|
}))
|
|
}
|
|
|
|
return {
|
|
esModule: esModule,
|
|
exports: scriptExports,
|
|
options: options
|
|
}
|
|
}
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 1:
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = {
|
|
props: {
|
|
mdTheme: String
|
|
},
|
|
data: function data() {
|
|
return {
|
|
closestThemedParent: false
|
|
};
|
|
},
|
|
methods: {
|
|
getClosestThemedParent: function getClosestThemedParent($parent) {
|
|
if (!$parent || !$parent.$el || $parent._uid === 0) {
|
|
return false;
|
|
}
|
|
|
|
if ($parent.mdTheme || $parent.mdName) {
|
|
return $parent;
|
|
}
|
|
|
|
return this.getClosestThemedParent($parent.$parent);
|
|
}
|
|
},
|
|
computed: {
|
|
themeClass: function themeClass() {
|
|
if (this.mdTheme) {
|
|
return 'md-theme-' + this.mdTheme;
|
|
}
|
|
|
|
var theme = this.closestThemedParent.mdTheme;
|
|
|
|
if (!theme) {
|
|
if (this.closestThemedParent) {
|
|
theme = this.closestThemedParent.mdName;
|
|
} else {
|
|
theme = this.$material.currentTheme;
|
|
}
|
|
}
|
|
|
|
return 'md-theme-' + theme;
|
|
}
|
|
},
|
|
mounted: function mounted() {
|
|
this.closestThemedParent = this.getClosestThemedParent(this.$parent);
|
|
|
|
if (!this.$material.currentTheme) {
|
|
this.$material.setCurrentTheme('default');
|
|
}
|
|
}
|
|
};
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
|
|
/***/ 110:
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = install;
|
|
|
|
var _mdSidenav = __webpack_require__(308);
|
|
|
|
var _mdSidenav2 = _interopRequireDefault(_mdSidenav);
|
|
|
|
var _mdSidenav3 = __webpack_require__(250);
|
|
|
|
var _mdSidenav4 = _interopRequireDefault(_mdSidenav3);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function install(Vue) {
|
|
Vue.component('md-sidenav', _mdSidenav2.default);
|
|
|
|
Vue.material.styles.push(_mdSidenav4.default);
|
|
}
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
|
|
/***/ 170:
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
"use strict";
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
|
|
var _mixin = __webpack_require__(1);
|
|
|
|
var _mixin2 = _interopRequireDefault(_mixin);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
exports.default = {
|
|
data: function data() {
|
|
return {
|
|
mdVisible: false
|
|
};
|
|
},
|
|
|
|
mixins: [_mixin2.default],
|
|
props: {
|
|
mdSwipeable: Boolean,
|
|
mdSwipeThreshold: {
|
|
type: Number,
|
|
default: 15
|
|
},
|
|
mdSwipeDistance: {
|
|
type: Number,
|
|
default: 100
|
|
}
|
|
},
|
|
computed: {
|
|
classes: function classes() {
|
|
return this.mdVisible && 'md-active';
|
|
}
|
|
},
|
|
methods: {
|
|
show: function show() {
|
|
this.open();
|
|
},
|
|
open: function open() {
|
|
this.mdVisible = true;
|
|
this.$el.focus();
|
|
this.$emit('open');
|
|
},
|
|
close: function close() {
|
|
this.mdVisible = false;
|
|
this.$el.blur();
|
|
this.$emit('close');
|
|
},
|
|
toggle: function toggle() {
|
|
if (this.mdVisible) {
|
|
this.close();
|
|
} else {
|
|
this.open();
|
|
}
|
|
},
|
|
isHorizontallyInside: function isHorizontallyInside(positionX) {
|
|
return positionX > 0 && positionX < this.mountedRect.left + this.mountedRect.width;
|
|
},
|
|
isVerticallyInside: function isVerticallyInside(positionY) {
|
|
return positionY > 0 && positionY < this.mountedRect.top + this.mountedRect.height;
|
|
},
|
|
isFromStartWhenClosed: function isFromStartWhenClosed(positionX) {
|
|
if (this.mdVisible) {
|
|
return true;
|
|
}
|
|
|
|
return positionX < this.mdSwipeThreshold;
|
|
},
|
|
handleTouchStart: function handleTouchStart(event) {
|
|
var positionX = event.touches[0].clientX - this.mountedRect.left;
|
|
var positionY = event.touches[0].clientY - this.mountedRect.top;
|
|
|
|
if (!this.isHorizontallyInside(positionX) || !this.isVerticallyInside(positionY) || !this.isFromStartWhenClosed(positionX)) {
|
|
return;
|
|
}
|
|
|
|
this.initialTouchPosition = positionX;
|
|
this.canMove = true;
|
|
},
|
|
handleTouchEnd: function handleTouchEnd() {
|
|
this.canMove = false;
|
|
this.initialTouchPosition = null;
|
|
},
|
|
handleTouchMove: function handleTouchMove(event) {
|
|
if (!this.canMove) {
|
|
return;
|
|
}
|
|
|
|
var positionX = event.touches[0].clientX;
|
|
|
|
var difference = this.mdVisible ? this.initialTouchPosition - positionX : positionX - this.initialTouchPosition;
|
|
|
|
var action = this.mdVisible ? 'close' : 'open';
|
|
|
|
if (difference > this.mdSwipeDistance) {
|
|
this[action]();
|
|
}
|
|
}
|
|
},
|
|
mounted: function mounted() {
|
|
if (!this.mdSwipeable) {
|
|
return;
|
|
}
|
|
|
|
this.mountedRect = this.$refs.backdrop.$el.getBoundingClientRect();
|
|
this.initialTouchPosition = null;
|
|
this.canMove = false;
|
|
|
|
document.addEventListener('touchstart', this.handleTouchStart);
|
|
document.addEventListener('touchend', this.handleTouchEnd);
|
|
document.addEventListener('touchmove', this.handleTouchMove);
|
|
},
|
|
beforeDestroy: function beforeDestroy() {
|
|
if (!this.mdSwipeable) {
|
|
return;
|
|
}
|
|
|
|
document.removeEventListener('touchstart', this.handleTouchStart);
|
|
document.removeEventListener('touchend', this.handleTouchEnd);
|
|
document.removeEventListener('touchmove', this.handleTouchMove);
|
|
}
|
|
}; //
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
|
|
module.exports = exports['default'];
|
|
|
|
/***/ }),
|
|
|
|
/***/ 218:
|
|
/***/ (function(module, exports) {
|
|
|
|
// removed by extract-text-webpack-plugin
|
|
|
|
/***/ }),
|
|
|
|
/***/ 250:
|
|
/***/ (function(module, exports) {
|
|
|
|
module.exports = ".THEME_NAME.md-sidenav .md-sidenav-content {\n background-color: BACKGROUND-COLOR;\n color: BACKGROUND-CONTRAST; }\n"
|
|
|
|
/***/ }),
|
|
|
|
/***/ 308:
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
|
/* styles */
|
|
__webpack_require__(218)
|
|
|
|
var Component = __webpack_require__(0)(
|
|
/* script */
|
|
__webpack_require__(170),
|
|
/* template */
|
|
__webpack_require__(367),
|
|
/* scopeId */
|
|
null,
|
|
/* cssModules */
|
|
null
|
|
)
|
|
Component.options.__file = "/Users/mrufino/Projects/personal/github/vue-material/src/components/mdSidenav/mdSidenav.vue"
|
|
if (Component.esModule && Object.keys(Component.esModule).some((function (key) {return key !== "default" && key !== "__esModule"}))) {console.error("named exports are not supported in *.vue files.")}
|
|
if (Component.options.functional) {console.error("[vue-loader] mdSidenav.vue: functional components are not supported with templates, they should use render functions.")}
|
|
|
|
/* hot reload */
|
|
if (false) {(function () {
|
|
var hotAPI = require("vue-hot-reload-api")
|
|
hotAPI.install(require("vue"), false)
|
|
if (!hotAPI.compatible) return
|
|
module.hot.accept()
|
|
if (!module.hot.data) {
|
|
hotAPI.createRecord("data-v-52912130", Component.options)
|
|
} else {
|
|
hotAPI.reload("data-v-52912130", Component.options)
|
|
}
|
|
})()}
|
|
|
|
module.exports = Component.exports
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ 367:
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
|
|
return _c('div', {
|
|
staticClass: "md-sidenav",
|
|
class: [_vm.themeClass, _vm.classes],
|
|
attrs: {
|
|
"tabindex": "0"
|
|
},
|
|
on: {
|
|
"keyup": function($event) {
|
|
if (_vm._k($event.keyCode, "esc", 27)) { return; }
|
|
_vm.close($event)
|
|
}
|
|
}
|
|
}, [_c('div', {
|
|
staticClass: "md-sidenav-content"
|
|
}, [_vm._t("default")], 2), _vm._v(" "), _c('md-backdrop', {
|
|
ref: "backdrop",
|
|
staticClass: "md-sidenav-backdrop",
|
|
on: {
|
|
"close": _vm.close
|
|
}
|
|
})], 1)
|
|
},staticRenderFns: []}
|
|
module.exports.render._withStripped = true
|
|
if (false) {
|
|
module.hot.accept()
|
|
if (module.hot.data) {
|
|
require("vue-hot-reload-api").rerender("data-v-52912130", module.exports)
|
|
}
|
|
}
|
|
|
|
/***/ }),
|
|
|
|
/***/ 417:
|
|
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
module.exports = __webpack_require__(110);
|
|
|
|
|
|
/***/ })
|
|
|
|
/******/ });
|
|
})); |