UNPKG

cube-ui

Version:

A fantastic mobile ui lib implement by Vue

1,302 lines (1,089 loc) 35.7 kB
(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["popup"] = factory(); else root["cube"] = root["cube"] || {}, root["cube"]["popup"] = factory(); })(typeof self !== 'undefined' ? self : 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; /******/ /******/ // 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 = 347); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ (function(module, exports) { var core = module.exports = { version: '2.5.7' }; if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef /***/ }), /***/ 1: /***/ (function(module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self // eslint-disable-next-line no-new-func : Function('return this')(); if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef /***/ }), /***/ 10: /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(1); var core = __webpack_require__(0); var ctx = __webpack_require__(31); var hide = __webpack_require__(6); var has = __webpack_require__(5); var PROTOTYPE = 'prototype'; var $export = function (type, name, source) { var IS_FORCED = type & $export.F; var IS_GLOBAL = type & $export.G; var IS_STATIC = type & $export.S; var IS_PROTO = type & $export.P; var IS_BIND = type & $export.B; var IS_WRAP = type & $export.W; var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); var expProto = exports[PROTOTYPE]; var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]; var key, own, out; if (IS_GLOBAL) source = name; for (key in source) { // contains in native own = !IS_FORCED && target && target[key] !== undefined; if (own && has(exports, key)) continue; // export native or passed out = own ? target[key] : source[key]; // prevent global pollution for namespaces exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key] // bind timers to global for call from export context : IS_BIND && own ? ctx(out, global) // wrap global constructors for prevent change them in library : IS_WRAP && target[key] == out ? (function (C) { var F = function (a, b, c) { if (this instanceof C) { switch (arguments.length) { case 0: return new C(); case 1: return new C(a); case 2: return new C(a, b); } return new C(a, b, c); } return C.apply(this, arguments); }; F[PROTOTYPE] = C[PROTOTYPE]; return F; // make static versions for prototype methods })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; // export proto methods to core.%CONSTRUCTOR%.methods.%NAME% if (IS_PROTO) { (exports.virtual || (exports.virtual = {}))[key] = out; // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME% if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out); } } }; // type bitmap $export.F = 1; // forced $export.G = 2; // global $export.S = 4; // static $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap $export.U = 64; // safe $export.R = 128; // real proto method for `library` module.exports = $export; /***/ }), /***/ 101: /***/ (function(module, exports, __webpack_require__) { function injectStyle (ssrContext) { __webpack_require__(102) } var Component = __webpack_require__(9)( /* script */ __webpack_require__(103), /* template */ __webpack_require__(104), /* styles */ injectStyle, /* scopeId */ null, /* moduleIdentifier (server only) */ null ) module.exports = Component.exports /***/ }), /***/ 102: /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /***/ 103: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(37), __webpack_require__(58), __webpack_require__(69)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (typeof exports !== "undefined") { factory(module, exports, require('babel-runtime/helpers/defineProperty'), require('../../common/mixins/visibility'), require('../../common/mixins/popup')); } else { var mod = { exports: {} }; factory(mod, mod.exports, global.defineProperty, global.visibility, global.popup); global.popup = mod.exports; } })(this, function (module, exports, _defineProperty2, _visibility, _popup) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _defineProperty3 = _interopRequireDefault(_defineProperty2); var _visibility2 = _interopRequireDefault(_visibility); var _popup2 = _interopRequireDefault(_popup); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var COMPONENT_NAME = 'cube-popup'; var EVENT_MASK_CLICK = 'mask-click'; exports.default = { name: COMPONENT_NAME, mixins: [_visibility2.default, _popup2.default], props: { type: { type: String, default: '' }, mask: { type: Boolean, default: true }, content: { type: String, default: '' }, center: { type: Boolean, default: true }, position: { type: String, default: '' } }, computed: { rootClass: function rootClass() { var cls = { 'cube-popup_mask': this.mask }; if (this.type) { cls['cube-' + this.type] = true; } return cls; }, containerClass: function containerClass() { var center = this.center; var position = this.position; if (position) { return (0, _defineProperty3.default)({}, 'cube-popup-' + position, true); } if (center) { return { 'cube-popup-center': true }; } } }, methods: { maskClick: function maskClick(e) { this.$emit(EVENT_MASK_CLICK, e); if (this.maskClosable) { this.hide(); } } } }; module.exports = exports['default']; }); /***/ }), /***/ 104: /***/ (function(module, exports) { module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h; return _c('div', { directives: [{ name: "show", rawName: "v-show", value: (_vm.isVisible), expression: "isVisible" }], staticClass: "cube-popup", class: _vm.rootClass, style: ({ 'z-index': _vm.zIndex }) }, [_c('div', { staticClass: "cube-popup-mask", on: { "touchmove": function($event) { $event.preventDefault(); }, "click": _vm.maskClick } }, [_vm._t("mask")], 2), _vm._v(" "), _c('div', { staticClass: "cube-popup-container", class: _vm.containerClass, on: { "touchmove": function($event) { $event.preventDefault(); } } }, [(_vm.$slots.default) ? _c('div', { staticClass: "cube-popup-content" }, [_vm._t("default")], 2) : _c('div', { staticClass: "cube-popup-content", domProps: { "innerHTML": _vm._s(_vm.content) } })])]) },staticRenderFns: []} /***/ }), /***/ 11: /***/ (function(module, exports) { module.exports = function (exec) { try { return !!exec(); } catch (e) { return true; } }; /***/ }), /***/ 12: /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(8); module.exports = function (it) { if (!isObject(it)) throw TypeError(it + ' is not an object!'); return it; }; /***/ }), /***/ 14: /***/ (function(module, exports) { module.exports = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; /***/ }), /***/ 22: /***/ (function(module, exports, __webpack_require__) { // 7.1.1 ToPrimitive(input [, PreferredType]) var isObject = __webpack_require__(8); // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function (it, S) { if (!isObject(it)) return it; var fn, val; if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; throw TypeError("Can't convert object to primitive value"); }; /***/ }), /***/ 28: /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(8); var document = __webpack_require__(1).document; // typeof document.createElement is 'object' in old IE var is = isObject(document) && isObject(document.createElement); module.exports = function (it) { return is ? document.createElement(it) : {}; }; /***/ }), /***/ 3: /***/ (function(module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty module.exports = !__webpack_require__(11)(function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), /***/ 31: /***/ (function(module, exports, __webpack_require__) { // optional / simple context binding var aFunction = __webpack_require__(34); module.exports = function (fn, that, length) { aFunction(fn); if (that === undefined) return fn; switch (length) { case 1: return function (a) { return fn.call(that, a); }; case 2: return function (a, b) { return fn.call(that, a, b); }; case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } return function (/* ...args */) { return fn.apply(that, arguments); }; }; /***/ }), /***/ 33: /***/ (function(module, exports, __webpack_require__) { module.exports = !__webpack_require__(3) && !__webpack_require__(11)(function () { return Object.defineProperty(__webpack_require__(28)('div'), 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), /***/ 34: /***/ (function(module, exports) { module.exports = function (it) { if (typeof it != 'function') throw TypeError(it + ' is not a function!'); return it; }; /***/ }), /***/ 347: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(101), __webpack_require__(348)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (typeof exports !== "undefined") { factory(module, exports, require('../../components/popup/popup.vue'), require('./api')); } else { var mod = { exports: {} }; factory(mod, mod.exports, global.popup, global.api); global.index = mod.exports; } })(this, function (module, exports, _popup, _api) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _popup2 = _interopRequireDefault(_popup); var _api2 = _interopRequireDefault(_api); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } _popup2.default.install = function (Vue) { Vue.component(_popup2.default.name, _popup2.default); (0, _api2.default)(Vue, _popup2.default); }; exports.default = _popup2.default; module.exports = exports['default']; }); /***/ }), /***/ 348: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(89)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (typeof exports !== "undefined") { factory(module, exports, require('../../common/helpers/create-api')); } else { var mod = { exports: {} }; factory(mod, mod.exports, global.createApi); global.api = mod.exports; } })(this, function (module, exports, _createApi) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = addPopup; var _createApi2 = _interopRequireDefault(_createApi); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function addPopup(Vue, Popup) { (0, _createApi2.default)(Vue, Popup, ['mask-click'], true); } module.exports = exports['default']; }); /***/ }), /***/ 37: /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _defineProperty = __webpack_require__(55); var _defineProperty2 = _interopRequireDefault(_defineProperty); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = function (obj, key, value) { if (key in obj) { (0, _defineProperty2.default)(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }; /***/ }), /***/ 4: /***/ (function(module, exports, __webpack_require__) { var anObject = __webpack_require__(12); var IE8_DOM_DEFINE = __webpack_require__(33); var toPrimitive = __webpack_require__(22); var dP = Object.defineProperty; exports.f = __webpack_require__(3) ? Object.defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (IE8_DOM_DEFINE) try { return dP(O, P, Attributes); } catch (e) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; /***/ }), /***/ 5: /***/ (function(module, exports) { var hasOwnProperty = {}.hasOwnProperty; module.exports = function (it, key) { return hasOwnProperty.call(it, key); }; /***/ }), /***/ 55: /***/ (function(module, exports, __webpack_require__) { module.exports = { "default": __webpack_require__(56), __esModule: true }; /***/ }), /***/ 56: /***/ (function(module, exports, __webpack_require__) { __webpack_require__(57); var $Object = __webpack_require__(0).Object; module.exports = function defineProperty(it, key, desc) { return $Object.defineProperty(it, key, desc); }; /***/ }), /***/ 57: /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(10); // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) $export($export.S + $export.F * !__webpack_require__(3), 'Object', { defineProperty: __webpack_require__(4).f }); /***/ }), /***/ 58: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (typeof exports !== "undefined") { factory(module, exports); } else { var mod = { exports: {} }; factory(mod, mod.exports); global.visibility = mod.exports; } })(this, function (module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var EVENT_TOGGLE = 'toggle'; exports.default = { model: { prop: 'visible', event: EVENT_TOGGLE }, props: { visible: { type: Boolean, default: false } }, data: function data() { return { isVisible: false }; }, watch: { isVisible: function isVisible(newVal) { this.$emit(EVENT_TOGGLE, newVal); } }, mounted: function mounted() { var _this = this; this.$watch('visible', function (newVal, oldVal) { if (newVal) { _this.show(); } else if (oldVal && !_this._createAPI_reuse) { _this.hide(); } }, { immediate: true }); }, methods: { show: function show() { this.isVisible = true; }, hide: function hide() { this.isVisible = false; } } }; module.exports = exports['default']; }); /***/ }), /***/ 6: /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__(4); var createDesc = __webpack_require__(14); module.exports = __webpack_require__(3) ? function (object, key, value) { return dP.f(object, key, createDesc(1, value)); } : function (object, key, value) { object[key] = value; return object; }; /***/ }), /***/ 69: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (typeof exports !== "undefined") { factory(module, exports); } else { var mod = { exports: {} }; factory(mod, mod.exports); global.popup = mod.exports; } })(this, function (module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = { props: { zIndex: { type: Number, default: 100 }, maskClosable: { type: Boolean, default: false } } }; module.exports = exports["default"]; }); /***/ }), /***/ 8: /***/ (function(module, exports) { module.exports = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; /***/ }), /***/ 89: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) { if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(99)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (typeof exports !== "undefined") { factory(module, exports, require('vue-create-api')); } else { var mod = { exports: {} }; factory(mod, mod.exports, global.vueCreateApi); global.createApi = mod.exports; } })(this, function (module, exports, _vueCreateApi) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = createAPI; var _vueCreateApi2 = _interopRequireDefault(_vueCreateApi); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function createAPI(Vue, Component, events, single) { Vue.use(_vueCreateApi2.default, { componentPrefix: 'cube-' }); var api = Vue.createAPI(Component, events, single); return api; } module.exports = exports['default']; }); /***/ }), /***/ 9: /***/ (function(module, exports) { /* globals __VUE_SSR_CONTEXT__ */ // this module is a runtime utility for cleaner component module output and will // be included in the final webpack user bundle module.exports = function normalizeComponent ( rawScriptExports, compiledTemplate, injectStyles, scopeId, moduleIdentifier /* server only */ ) { 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 } var hook if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__ } // inject component styles if (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier) } } // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook } else if (injectStyles) { hook = injectStyles } if (hook) { var functional = options.functional var existing = functional ? options.render : options.beforeCreate if (!functional) { // inject component registration as beforeCreate hook options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } else { // register for functioal component in vue file options.render = function renderWithStyleInjection (h, context) { hook.call(context) return existing(h, context) } } } return { esModule: esModule, exports: scriptExports, options: options } } /***/ }), /***/ 99: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /** * vue-create-api v0.2.3 * (c) 2019 ustbhuangyi * @license MIT */ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var camelizeRE = /-(\w)/g; function camelize(str) { return (str + '').replace(camelizeRE, function (m, c) { return c ? c.toUpperCase() : ''; }); } function escapeReg(str, delimiter) { return (str + '').replace(new RegExp('[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\' + (delimiter || '') + '-]', 'g'), '\\$&'); } function isBoolean(value) { return typeof value === 'boolean'; } function isUndef(value) { return value === undefined; } function isStr(value) { return typeof value === 'string'; } function isFunction(fn) { return typeof fn === 'function'; } function assert(condition, msg) { if (!condition) { throw new Error("[vue-create-api error]: " + msg); } } function instantiateComponent(Vue, Component, data, renderFn, options) { var renderData = void 0; var childrenRenderFn = void 0; var instance = new Vue(_extends({}, options, { render: function render(createElement) { var children = childrenRenderFn && childrenRenderFn(createElement); if (children && !Array.isArray(children)) { children = [children]; } return createElement(Component, _extends({}, renderData), children || []); }, methods: { init: function init() { document.body.appendChild(this.$el); }, destroy: function destroy() { this.$destroy(); if (this.$el && this.$el.parentNode === document.body) { document.body.removeChild(this.$el); } } } })); instance.updateRenderData = function (data, render) { renderData = data; childrenRenderFn = render; }; instance.updateRenderData(data, renderFn); instance.$mount(); instance.init(); var component = instance.$children[0]; component.$updateProps = function (props) { _extends(renderData.props, props); instance.$forceUpdate(); }; return component; } function parseRenderData() { var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; events = parseEvents(events); var props = _extends({}, data); var on = {}; for (var name in events) { if (events.hasOwnProperty(name)) { var handlerName = events[name]; if (props[handlerName]) { on[name] = props[handlerName]; delete props[handlerName]; } } } return { props: props, on: on }; } function parseEvents(events) { var parsedEvents = {}; events.forEach(function (name) { parsedEvents[name] = camelize('on-' + name); }); return parsedEvents; } var eventBeforeDestroy = 'hook:beforeDestroy'; function apiCreator(Component) { var events = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; var single = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var Vue = this; var singleMap = {}; var beforeHooks = []; function createComponent(renderData, renderFn, options, single) { beforeHooks.forEach(function (before) { before(renderData, renderFn, single); }); var ownerInsUid = options.parent ? options.parent._uid : -1; var _ref = singleMap[ownerInsUid] ? singleMap[ownerInsUid] : {}, comp = _ref.comp, ins = _ref.ins; if (single && comp && ins) { ins.updateRenderData(renderData, renderFn); ins.$forceUpdate(); return comp; } var component = instantiateComponent(Vue, Component, renderData, renderFn, options); var instance = component.$parent; var originRemove = component.remove; component.remove = function () { if (single) { if (!singleMap[ownerInsUid]) { return; } singleMap[ownerInsUid] = null; } originRemove && originRemove.apply(this, arguments); instance.destroy(); }; var originShow = component.show; component.show = function () { originShow && originShow.apply(this, arguments); return this; }; var originHide = component.hide; component.hide = function () { originHide && originHide.apply(this, arguments); return this; }; if (single) { singleMap[ownerInsUid] = { comp: component, ins: instance }; } return component; } function processProps(ownerInstance, renderData, isInVueInstance, onChange) { var $props = renderData.props.$props; if ($props) { delete renderData.props.$props; var watchKeys = []; var watchPropKeys = []; Object.keys($props).forEach(function (key) { var propKey = $props[key]; if (isStr(propKey) && propKey in ownerInstance) { // get instance value renderData.props[key] = ownerInstance[propKey]; watchKeys.push(key); watchPropKeys.push(propKey); } else { renderData.props[key] = propKey; } }); if (isInVueInstance) { var unwatchFn = ownerInstance.$watch(function () { var props = {}; watchKeys.forEach(function (key, i) { props[key] = ownerInstance[watchPropKeys[i]]; }); return props; }, onChange); ownerInstance.__unwatchFns__.push(unwatchFn); } } } function processEvents(renderData, ownerInstance) { var $events = renderData.props.$events; if ($events) { delete renderData.props.$events; Object.keys($events).forEach(function (event) { var eventHandler = $events[event]; if (typeof eventHandler === 'string') { eventHandler = ownerInstance[eventHandler]; } renderData.on[event] = eventHandler; }); } } function process$(renderData) { var props = renderData.props; Object.keys(props).forEach(function (prop) { if (prop.charAt(0) === '$') { renderData[prop.slice(1)] = props[prop]; delete props[prop]; } }); } function cancelWatchProps(ownerInstance) { if (ownerInstance.__unwatchFns__) { ownerInstance.__unwatchFns__.forEach(function (unwatchFn) { unwatchFn(); }); ownerInstance.__unwatchFns__ = null; } } var api = { before: function before(hook) { beforeHooks.push(hook); }, create: function create(config, renderFn, _single) { if (!isFunction(renderFn) && isUndef(_single)) { _single = renderFn; renderFn = null; } if (isUndef(_single)) { _single = single; } var ownerInstance = this; var isInVueInstance = !!ownerInstance.$on; var options = {}; if (isInVueInstance) { // Set parent to store router i18n ... options.parent = ownerInstance; if (!ownerInstance.__unwatchFns__) { ownerInstance.__unwatchFns__ = []; } } var renderData = parseRenderData(config, events); var component = null; processProps(ownerInstance, renderData, isInVueInstance, function (newProps) { component && component.$updateProps(newProps); }); processEvents(renderData, ownerInstance); process$(renderData); component = createComponent(renderData, renderFn, options, _single); if (isInVueInstance) { ownerInstance.$on(eventBeforeDestroy, beforeDestroy); } function beforeDestroy() { cancelWatchProps(ownerInstance); component.remove(); component = null; } return component; } }; return api; } function install(Vue) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var _options$componentPre = options.componentPrefix, componentPrefix = _options$componentPre === undefined ? '' : _options$componentPre, _options$apiPrefix = options.apiPrefix, apiPrefix = _options$apiPrefix === undefined ? '$create-' : _options$apiPrefix; Vue.createAPI = function (Component, events, single) { if (isBoolean(events)) { single = events; events = []; } var api = apiCreator.call(this, Component, events, single); var createName = processComponentName(Component, { componentPrefix: componentPrefix, apiPrefix: apiPrefix }); Vue.prototype[createName] = Component.$create = api.create; return api; }; } function processComponentName(Component, options) { var componentPrefix = options.componentPrefix, apiPrefix = options.apiPrefix; var name = Component.name; assert(name, 'Component must have name while using create-api!'); var prefixReg = new RegExp('^' + escapeReg(componentPrefix), 'i'); var pureName = name.replace(prefixReg, ''); var camelizeName = '' + camelize('' + apiPrefix + pureName); return camelizeName; } var index = { install: install, instantiateComponent: instantiateComponent, version: '0.2.3' }; /* harmony default export */ __webpack_exports__["default"] = (index); /***/ }) /******/ }); });