vc-popup
Version:
vue popup components with power position and animation support and back key support as well
1,551 lines (1,321 loc) • 51.6 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("vc-popup-base"));
else if(typeof define === 'function' && define.amd)
define(["vc-popup-base"], factory);
else {
var a = typeof exports === 'object' ? factory(require("vc-popup-base")) : factory(root["vc-popup-base"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_3__) {
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 = 152);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
module.exports = function(useSourceMap) {
var list = [];
// return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = cssWithMappingToString(item, useSourceMap);
if(item[2]) {
return "@media " + item[2] + "{" + content + "}";
} else {
return content;
}
}).join("");
};
// import a list of modules into the list
list.i = function(modules, mediaQuery) {
if(typeof modules === "string")
modules = [[null, modules, ""]];
var alreadyImportedModules = {};
for(var i = 0; i < this.length; i++) {
var id = this[i][0];
if(typeof id === "number")
alreadyImportedModules[id] = true;
}
for(i = 0; i < modules.length; i++) {
var item = modules[i];
// skip already imported module
// this implementation is not 100% perfect for weird media query combinations
// when a module is imported multiple times with different media queries.
// I hope this will never occur (Hey this way we have smaller bundles)
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
if(mediaQuery && !item[2]) {
item[2] = mediaQuery;
} else if(mediaQuery) {
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
}
list.push(item);
}
}
};
return list;
};
function cssWithMappingToString(item, useSourceMap) {
var content = item[1] || '';
var cssMapping = item[3];
if (!cssMapping) {
return content;
}
if (useSourceMap && typeof btoa === 'function') {
var sourceMapping = toComment(cssMapping);
var sourceURLs = cssMapping.sources.map(function (source) {
return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
});
return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
}
return [content].join('\n');
}
// Adapted from convert-source-map (MIT)
function toComment(sourceMap) {
// eslint-disable-next-line no-undef
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
return '/*# ' + data + ' */';
}
/***/ }),
/***/ 1:
/***/ (function(module, exports, __webpack_require__) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
Modified by Evan You @yyx990803
*/
var hasDocument = typeof document !== 'undefined'
if (typeof DEBUG !== 'undefined' && DEBUG) {
if (!hasDocument) {
throw new Error(
'vue-style-loader cannot be used in a non-browser environment. ' +
"Use { target: 'node' } in your Webpack config to indicate a server-rendering environment."
) }
}
var listToStyles = __webpack_require__(4)
/*
type StyleObject = {
id: number;
parts: Array<StyleObjectPart>
}
type StyleObjectPart = {
css: string;
media: string;
sourceMap: ?string
}
*/
var stylesInDom = {/*
[id: number]: {
id: number,
refs: number,
parts: Array<(obj?: StyleObjectPart) => void>
}
*/}
var head = hasDocument && (document.head || document.getElementsByTagName('head')[0])
var singletonElement = null
var singletonCounter = 0
var isProduction = false
var noop = function () {}
var options = null
var ssrIdKey = 'data-vue-ssr-id'
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\b/.test(navigator.userAgent.toLowerCase())
module.exports = function (parentId, list, _isProduction, _options) {
isProduction = _isProduction
options = _options || {}
var styles = listToStyles(parentId, list)
addStylesToDom(styles)
return function update (newList) {
var mayRemove = []
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
domStyle.refs--
mayRemove.push(domStyle)
}
if (newList) {
styles = listToStyles(parentId, newList)
addStylesToDom(styles)
} else {
styles = []
}
for (var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i]
if (domStyle.refs === 0) {
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j]()
}
delete stylesInDom[domStyle.id]
}
}
}
}
function addStylesToDom (styles /* Array<StyleObject> */) {
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
if (domStyle) {
domStyle.refs++
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j])
}
for (; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j]))
}
if (domStyle.parts.length > item.parts.length) {
domStyle.parts.length = item.parts.length
}
} else {
var parts = []
for (var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j]))
}
stylesInDom[item.id] = { id: item.id, refs: 1, parts: parts }
}
}
}
function createStyleElement () {
var styleElement = document.createElement('style')
styleElement.type = 'text/css'
head.appendChild(styleElement)
return styleElement
}
function addStyle (obj /* StyleObjectPart */) {
var update, remove
var styleElement = document.querySelector('style[' + ssrIdKey + '~="' + obj.id + '"]')
if (styleElement) {
if (isProduction) {
// has SSR styles and in production mode.
// simply do nothing.
return noop
} else {
// has SSR styles but in dev mode.
// for some reason Chrome can't handle source map in server-rendered
// style tags - source maps in <style> only works if the style tag is
// created and inserted dynamically. So we remove the server rendered
// styles and inject new ones.
styleElement.parentNode.removeChild(styleElement)
}
}
if (isOldIE) {
// use singleton mode for IE9.
var styleIndex = singletonCounter++
styleElement = singletonElement || (singletonElement = createStyleElement())
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false)
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true)
} else {
// use multi-style-tag mode in all other cases
styleElement = createStyleElement()
update = applyToTag.bind(null, styleElement)
remove = function () {
styleElement.parentNode.removeChild(styleElement)
}
}
update(obj)
return function updateStyle (newObj /* StyleObjectPart */) {
if (newObj) {
if (newObj.css === obj.css &&
newObj.media === obj.media &&
newObj.sourceMap === obj.sourceMap) {
return
}
update(obj = newObj)
} else {
remove()
}
}
}
var replaceText = (function () {
var textStore = []
return function (index, replacement) {
textStore[index] = replacement
return textStore.filter(Boolean).join('\n')
}
})()
function applyToSingletonTag (styleElement, index, remove, obj) {
var css = remove ? '' : obj.css
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(index, css)
} else {
var cssNode = document.createTextNode(css)
var childNodes = styleElement.childNodes
if (childNodes[index]) styleElement.removeChild(childNodes[index])
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index])
} else {
styleElement.appendChild(cssNode)
}
}
}
function applyToTag (styleElement, obj) {
var css = obj.css
var media = obj.media
var sourceMap = obj.sourceMap
if (media) {
styleElement.setAttribute('media', media)
}
if (options.ssrId) {
styleElement.setAttribute(ssrIdKey, obj.id)
}
if (sourceMap) {
// https://developer.chrome.com/devtools/docs/javascript-debugging
// this makes source maps inside style tags work properly in Chrome
css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */'
// http://stackoverflow.com/a/26603875
css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */'
}
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = css
} else {
while (styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild)
}
styleElement.appendChild(document.createTextNode(css))
}
}
/***/ }),
/***/ 10:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue__);
/* harmony namespace reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_42554e8c_hasScoped_false_transformToRequire_video_src_source_src_img_src_image_xlink_href_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_index_vue__ = __webpack_require__(17);
var disposed = false
function injectStyle (ssrContext) {
if (disposed) return
__webpack_require__(11)
}
var normalizeComponent = __webpack_require__(2)
/* script */
/* template */
/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = null
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue___default.a,
__WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_42554e8c_hasScoped_false_transformToRequire_video_src_source_src_img_src_image_xlink_href_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_index_vue__["a" /* default */],
__vue_template_functional__,
__vue_styles__,
__vue_scopeId__,
__vue_module_identifier__
)
Component.options.__file = "src\\components\\picker-view\\index.vue"
/* 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-42554e8c", Component.options)
} else {
hotAPI.reload("data-v-42554e8c", Component.options)
}
module.hot.dispose(function (data) {
disposed = true
})
})()}
/* harmony default export */ __webpack_exports__["default"] = (Component.exports);
/***/ }),
/***/ 11:
/***/ (function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(12);
if(typeof content === 'string') content = [[module.i, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var update = __webpack_require__(1)("79611e1c", content, false, {});
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../../node_modules/css-loader/index.js?{\"minimize\":false,\"sourceMap\":false}!../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-42554e8c\",\"scoped\":false,\"hasInlineConfig\":false}!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./index.vue", function() {
var newContent = require("!!../../../node_modules/css-loader/index.js?{\"minimize\":false,\"sourceMap\":false}!../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-42554e8c\",\"scoped\":false,\"hasInlineConfig\":false}!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./index.vue");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ }),
/***/ 12:
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(0)(false);
// imports
// module
exports.push([module.i, "\n.vc-picker-body {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n position: relative;\n background-color: #fff;\n height: 238px;\n overflow: hidden;\n}\n", ""]);
// exports
/***/ }),
/***/ 13:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_slot_vue__ = __webpack_require__(8);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_slot_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_slot_vue__);
/* harmony namespace reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_slot_vue__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_slot_vue__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_7f7de245_hasScoped_false_transformToRequire_video_src_source_src_img_src_image_xlink_href_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_picker_slot_vue__ = __webpack_require__(16);
var disposed = false
function injectStyle (ssrContext) {
if (disposed) return
__webpack_require__(14)
}
var normalizeComponent = __webpack_require__(2)
/* script */
/* template */
/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = null
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_slot_vue___default.a,
__WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_7f7de245_hasScoped_false_transformToRequire_video_src_source_src_img_src_image_xlink_href_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_picker_slot_vue__["a" /* default */],
__vue_template_functional__,
__vue_styles__,
__vue_scopeId__,
__vue_module_identifier__
)
Component.options.__file = "src\\components\\picker-view\\picker-slot.vue"
/* 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-7f7de245", Component.options)
} else {
hotAPI.reload("data-v-7f7de245", Component.options)
}
module.hot.dispose(function (data) {
disposed = true
})
})()}
/* harmony default export */ __webpack_exports__["default"] = (Component.exports);
/***/ }),
/***/ 14:
/***/ (function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(15);
if(typeof content === 'string') content = [[module.i, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var update = __webpack_require__(1)("33a8d441", content, false, {});
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../../node_modules/css-loader/index.js?{\"minimize\":false,\"sourceMap\":false}!../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-7f7de245\",\"scoped\":false,\"hasInlineConfig\":false}!../../../node_modules/sass-loader/lib/loader.js?{\"sourceMap\":false}!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./picker-slot.vue", function() {
var newContent = require("!!../../../node_modules/css-loader/index.js?{\"minimize\":false,\"sourceMap\":false}!../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-7f7de245\",\"scoped\":false,\"hasInlineConfig\":false}!../../../node_modules/sass-loader/lib/loader.js?{\"sourceMap\":false}!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./picker-slot.vue");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ }),
/***/ 15:
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(0)(false);
// imports
// module
exports.push([module.i, "\n.vc-picker-group {\n z-index: 0;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n position: relative;\n height: 100%;\n}\n.vc-picker-mask {\n z-index: 2;\n width: 100%;\n height: 100%;\n top: 0;\n background: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.95)), to(rgba(255, 255, 255, 0.6))), -webkit-gradient(linear, left bottom, left top, from(rgba(255, 255, 255, 0.95)), to(rgba(255, 255, 255, 0.6)));\n background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.6)), linear-gradient(0deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.6));\n background-position: top,bottom;\n background-size: 100% 102px;\n background-repeat: no-repeat;\n}\n.vc-picker-indicator {\n z-index: 3;\n height: 34px;\n}\n.vc-picker-indicator:after, .vc-picker-indicator:before {\n content: \" \";\n position: absolute;\n left: 0;\n right: 0;\n height: 1px;\n color: #e5e5e5;\n}\n.vc-picker-indicator:before {\n top: 0;\n border-top: 1px solid #e5e5e5;\n -webkit-transform-origin: 0 0;\n transform-origin: 0 0;\n -webkit-transform: scaleY(0.5);\n transform: scaleY(0.5);\n}\n.vc-picker-indicator:after {\n bottom: 0;\n border-bottom: 1px solid #e5e5e5;\n -webkit-transform-origin: 0 100%;\n transform-origin: 0 100%;\n -webkit-transform: scaleY(0.5);\n transform: scaleY(0.5);\n}\n.vc-picker-content {\n z-index: 1;\n top: 0;\n}\n.vc-picker-item {\n padding: 0;\n height: 34px;\n line-height: 34px;\n text-align: center;\n color: #000;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n}\n.vc-picker-indicator,\n.vc-picker-mask,\n.vc-picker-content {\n position: absolute;\n left: 0;\n width: 100%;\n}\n.vc-picker-slot-divider {\n -webkit-transform: translateY(106px);\n transform: translateY(106px);\n}\n", ""]);
// exports
/***/ }),
/***/ 152:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var version = '0.1.25';
var install = function install(Vue) {
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
if (install.installed) return;
Vue.use(__webpack_require__(3));
__webpack_require__(153);
};
// auto install
if (typeof window !== 'undefined' && window.Vue) {
install(window.Vue);
}
exports.default = {
install: install,
version: version
};
/***/ }),
/***/ 153:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _vcPopupBase = __webpack_require__(3);
var _index = __webpack_require__(154);
var _index2 = _interopRequireDefault(_index);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var popupConfig = {};
var defaultConfig = {
animation: {
init: 'vc-slide-up-init',
in: 'vc-slide-up-in',
out: 'vc-slide-up-out'
},
position: {
bottom: 0
}
};
exports.default = (0, _vcPopupBase.popupRegister)('picker', _index2.default, popupConfig, defaultConfig);
/***/ }),
/***/ 154:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue__ = __webpack_require__(40);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue__);
/* harmony namespace reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue__[key]; }) }(__WEBPACK_IMPORT_KEY__));
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_3e3388f5_hasScoped_false_transformToRequire_video_src_source_src_img_src_image_xlink_href_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_index_vue__ = __webpack_require__(157);
var disposed = false
function injectStyle (ssrContext) {
if (disposed) return
__webpack_require__(155)
}
var normalizeComponent = __webpack_require__(2)
/* script */
/* template */
/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = injectStyle
/* scopeId */
var __vue_scopeId__ = null
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue___default.a,
__WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_3e3388f5_hasScoped_false_transformToRequire_video_src_source_src_img_src_image_xlink_href_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_index_vue__["a" /* default */],
__vue_template_functional__,
__vue_styles__,
__vue_scopeId__,
__vue_module_identifier__
)
Component.options.__file = "src\\components\\popup-picker\\index.vue"
/* 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-3e3388f5", Component.options)
} else {
hotAPI.reload("data-v-3e3388f5", Component.options)
}
module.hot.dispose(function (data) {
disposed = true
})
})()}
/* harmony default export */ __webpack_exports__["default"] = (Component.exports);
/***/ }),
/***/ 155:
/***/ (function(module, exports, __webpack_require__) {
// style-loader: Adds some css to the DOM by adding a <style> tag
// load the styles
var content = __webpack_require__(156);
if(typeof content === 'string') content = [[module.i, content, '']];
if(content.locals) module.exports = content.locals;
// add the styles to the DOM
var update = __webpack_require__(1)("a205aad2", content, false, {});
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../../../node_modules/css-loader/index.js?{\"minimize\":false,\"sourceMap\":false}!../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-3e3388f5\",\"scoped\":false,\"hasInlineConfig\":false}!../../../node_modules/sass-loader/lib/loader.js?{\"sourceMap\":false}!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./index.vue", function() {
var newContent = require("!!../../../node_modules/css-loader/index.js?{\"minimize\":false,\"sourceMap\":false}!../../../node_modules/vue-loader/lib/style-compiler/index.js?{\"vue\":true,\"id\":\"data-v-3e3388f5\",\"scoped\":false,\"hasInlineConfig\":false}!../../../node_modules/sass-loader/lib/loader.js?{\"sourceMap\":false}!../../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./index.vue");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
/***/ }),
/***/ 156:
/***/ (function(module, exports, __webpack_require__) {
exports = module.exports = __webpack_require__(0)(false);
// imports
// module
exports.push([module.i, "\n.vc-picker {\n width: 100vw;\n height: auto;\n -webkit-transition: all 250ms ease 0s;\n transition: all 250ms ease 0s;\n border-top: 1px solid #e3e3e3;\n}\n.vc-picker-head {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n padding: 9px 15px;\n background-color: #fff;\n position: relative;\n text-align: center;\n font-size: 17px;\n}\n.vc-picker-head:after {\n content: \" \";\n position: absolute;\n left: 0;\n bottom: 0;\n right: 0;\n height: 1px;\n border-bottom: 1px solid #e5e5e5;\n color: #e5e5e5;\n -webkit-transform-origin: 0 100%;\n transform-origin: 0 100%;\n -webkit-transform: scaleY(0.5);\n transform: scaleY(0.5);\n}\n.vc-picker-action {\n display: block;\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n color: #1aad19;\n}\n.vc-picker-action:first-child {\n text-align: left;\n color: #888;\n}\n.vc-picker-action.noExpand {\n -webkit-box-flex: 0;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n padding: 0 5px;\n -webkit-transition: all 40ms linear 0ms;\n transition: all 40ms linear 0ms;\n}\n.vc-picker-action.noExpand:active {\n background: #ececec;\n}\n", ""]);
// exports
/***/ }),
/***/ 157:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"div",
{ staticClass: "vc-picker" },
[
_c("div", { staticClass: "vc-picker-head" }, [
_c("a", {
staticClass: "vc-picker-action noExpand",
domProps: { textContent: _vm._s(_vm.cancelText) },
on: { click: _vm._cancel }
}),
_vm._v(" "),
_c("a", { staticClass: "vc-picker-action" }),
_vm._v(" "),
_c("a", {
staticClass: "vc-picker-action noExpand",
domProps: { textContent: _vm._s(_vm.confirmText) },
on: { click: _vm._confirm }
})
]),
_vm._v(" "),
_c("vc-picker-view", {
ref: "picker",
attrs: {
slots: _vm.slots,
onChange: _vm.onChange,
defaultValues: _vm.defaultValues,
showItemNum: _vm.showItemNum,
showItemHeight: _vm.showItemHeight
}
})
],
1
)
}
var staticRenderFns = []
render._withStripped = true
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ __webpack_exports__["a"] = (esExports);
if (false) {
module.hot.accept()
if (module.hot.data) {
require("vue-hot-reload-api") .rerender("data-v-3e3388f5", esExports)
}
}
/***/ }),
/***/ 16:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return !_vm.divider
? _c("div", { ref: "group", staticClass: "vc-picker-group" }, [
_c("div", { ref: "mask", staticClass: "vc-picker-mask" }),
_vm._v(" "),
_c("div", { ref: "indicator", staticClass: "vc-picker-indicator" }),
_vm._v(" "),
_c(
"div",
{ ref: "content", staticClass: "vc-picker-content" },
_vm._l(_vm.mutatingValues, function(item, key) {
return _c(
"div",
{
key: key,
staticClass: "vc-picker-item",
class: {
"vc-picker-item_disabled":
typeof item === "object" && item.disabled
}
},
[
_vm._v(
"\n " +
_vm._s(
typeof item === "object" && item[_vm.labelKey]
? item[_vm.labelKey]
: item
) +
"\n "
)
]
)
})
)
])
: _c("div", {
staticClass: "vc-picker-slot-divider",
domProps: { innerHTML: _vm._s(_vm.content) }
})
}
var staticRenderFns = []
render._withStripped = true
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ __webpack_exports__["a"] = (esExports);
if (false) {
module.hot.accept()
if (module.hot.data) {
require("vue-hot-reload-api") .rerender("data-v-7f7de245", esExports)
}
}
/***/ }),
/***/ 17:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"div",
{ ref: "body", staticClass: "vc-picker-body" },
_vm._l(_vm.slots, function(slot, key) {
return _c("vc-picker-slot", {
key: key,
attrs: {
values: slot.values || [],
content: slot.content,
divider: slot.divider,
labelKey: slot.labelKey,
showItemNum: _vm.showItemNum,
showItemHeight: _vm.showItemHeight
},
model: {
value: _vm.values[slot.valueIndex],
callback: function($$v) {
_vm.$set(_vm.values, slot.valueIndex, $$v)
},
expression: "values[slot.valueIndex]"
}
})
})
)
}
var staticRenderFns = []
render._withStripped = true
var esExports = { render: render, staticRenderFns: staticRenderFns }
/* harmony default export */ __webpack_exports__["a"] = (esExports);
if (false) {
module.hot.accept()
if (module.hot.data) {
require("vue-hot-reload-api") .rerender("data-v-42554e8c", esExports)
}
}
/***/ }),
/***/ 2:
/***/ (function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file.
// 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,
functionalTemplate,
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
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// 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 {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// 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
}
}
/***/ }),
/***/ 3:
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_3__;
/***/ }),
/***/ 4:
/***/ (function(module, exports) {
/**
* Translates the list format produced by css-loader into something
* easier to manipulate.
*/
module.exports = function listToStyles (parentId, list) {
var styles = []
var newStyles = {}
for (var i = 0; i < list.length; i++) {
var item = list[i]
var id = item[0]
var css = item[1]
var media = item[2]
var sourceMap = item[3]
var part = {
id: parentId + ':' + i,
css: css,
media: media,
sourceMap: sourceMap
}
if (!newStyles[id]) {
styles.push(newStyles[id] = { id: id, parts: [part] })
} else {
newStyles[id].parts.push(part)
}
}
return styles
}
/***/ }),
/***/ 40:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _pickerView = __webpack_require__(9);
var _pickerView2 = _interopRequireDefault(_pickerView);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'vc-popup-picker',
props: {
slots: Array,
showItemNum: Number,
showItemHeight: Number,
defaultValues: Array,
confirmText: {
type: String,
default: '确定'
},
cancelText: {
type: String,
default: '取消'
},
onConfirm: {
type: Function,
default: function _default() {}
},
onCancel: {
type: Function,
default: function _default() {}
},
onChange: {
type: Function,
default: function _default() {}
}
},
components: {
VcPickerView: _pickerView2.default
},
methods: {
_cancel: function _cancel(e) {
var _this = this;
this.$popupCtrl.close();
setTimeout(function () {
_this.onCancel instanceof Function && _this.onCancel(_this.$refs.picker);
}, 0);
},
_confirm: function _confirm(e) {
var _this2 = this;
this.$popupCtrl.close();
setTimeout(function () {
_this2.onConfirm instanceof Function && _this2.onConfirm(_this2.$refs.picker);
}, 0);
}
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ }),
/***/ 7:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _pickerSlot = __webpack_require__(13);
var _pickerSlot2 = _interopRequireDefault(_pickerSlot);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: 'vc-picker-view',
components: {
VcPickerSlot: _pickerSlot2.default
},
props: {
slots: {
type: Array,
required: true
},
defaultValues: Array,
showItemNum: {
type: Number,
default: 7,
validator: function validator(val) {
return val % 2 !== 0 && val > 1;
}
},
showItemHeight: {
type: Number,
default: 34
},
onChange: Function
},
computed: {
values: function values() {
var slots = this.slots || [];
var values = [];
slots.forEach(function (slot) {
if (!slot.divider) values.push(slot.value);
});
return values;
},
slotCount: function slotCount() {
var slots = this.slots || [];
var count = 0;
slots.forEach(function (slot) {
if (!slot.divider) count++;
});
return count;
}
},
created: function created() {
var _this = this;
this.$on('slotValueChange', this.slotValueChange);
var slots = this.slots || [];
var values = this.values;
var valueIndexCount = 0;
slots.forEach(function (slot) {
if (!slot.divider) {
slot.valueIndex = valueIndexCount++;
values[slot.valueIndex] = (slot.values || [])[slot.defaultIndex || 0];
_this.slotValueChange();
}
});
this.defaultValues instanceof Array && this.setValues(this.defaultValues);
},
mounted: function mounted() {
this.$refs.body.style.height = this.showItemHeight * this.showItemNum + 'px';
},
methods: {
slotValueChange: function slotValueChange() {
this.onChange instanceof Function && this.onChange(this, this.values);
},
getSlot: function getSlot(slotIndex) {
var slots = this.slots || [];
var count = 0;
var target = void 0;
var children = this.$children;
children = children.filter(function (child) {
return child.$options.name === 'vc-picker-slot';
});
slots.forEach(function (slot, index) {
if (!slot.divider) {
if (slotIndex === count) {
target = children[index];
}
count++;
}
});
return target;
},
getSlotValue: function getSlotValue(index) {
var slot = this.getSlot(index);
if (slot) {
return slot.value;
}
return null;
},
setSlotValue: function setSlotValue(index, value, taskQueue) {
var _this2 = this;
this.$nextTick(function () {
var slot = _this2.getSlot(index);
if (slot) {
slot.currentValue = value;
if (taskQueue.length > 0) slot.$nextTick(taskQueue.shift());
}
});
},
getSlotValues: function getSlotValues(index) {
var slot = this.getSlot(index);
if (slot) {
return slot.mutatingValues;
}
return null;
},
setSlotValues: function setSlotValues(index, values) {
var _this3 = this;
this.$nextTick(function () {
var slot = _this3.getSlot(index);
var oldVal;
if (slot) {
oldVal = slot.currentValue;
slot.mutatingValues = values;
slot.$nextTick(function () {
if (oldVal !== undefined && oldVal !== null) slot.doOnValueChange(oldVal);
oldVal = null;
});
}
});
},
getValues: function getValues() {
return this.values;
},
setValues: function setValues(values) {
var _this4 = this;
values = values || [];
if (this.slotCount !== values.length) {
throw new Error('values length is not equal slot count.');
}
var taskQueue = [];
values.forEach(function (value, index) {
if (index !== 0) taskQueue.push(function () {
_this4.setSlotValue(index, value, taskQueue);
});
});
this.setSlotValue(0, values[0], taskQueue);
}
}
}; //
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/***/ }),
/***/ 8:
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'vc-picker-slot',
props: {
values: {
type: Array,
default: function _default() {
return [];
}
},
value: {},
content: String,
labelKey: String,
defaultIndex: {
type: Number,
default: 0
},
divider: {
type: Boolean,
default: false
},
showItemNum: Number,
showItemHeight: Number
},
data: function data() {
return {
currentValue: this.value,
mutatingValues: this.values
};
},
computed: {
minTranslateY: function minTranslateY() {
return this.showItemHeight * (Math.ceil(this.showItemNum / 2) - this.mutatingValues.length);
},
maxTranslateY: function maxTranslateY() {
return this.showItemHeight * Math.floor(this.showItemNum / 2);
},
valueIndex: function valueIndex() {
var labelKey = this.labelKey;
if (this.currentValue instanceof Object) {
for (var i = 0, len = this.mutatingValues.length; i < len; i++) {
if (this.currentValue[labelKey] === this.mutatingValues[i][labelKey]) return i;
}
return -1;
} else return this.mutatingValues.indexOf(this.currentValue);
}
},
mounted: function mounted() {
this.ready = true;
this.currentValue = this.value;
this.$emit('input', this.currentValue);
if (this.divider) return;
this.$refs.indicator.style.top = (this.showItemHeight * this.showItemNum - 34) / 2 + 'px';
this.$refs.mask.style.backgroundSize = '100% ' + this.showItemHeight * (this.showItemNum - 1) / 2 + 'px';
this.doOnValueChange();
this.initListener();
},
methods: {
initListener: function initListener() {
var self = this;
var $group = this.$refs.group;
var $content = this.$refs.content;
var $indicator = this.$refs.indicator;
var itemHeight = self.showItemHeight;
var lastEvt = null;
var startTime = null;
var startPositionY = null;
var prevTranslateY = null;
var startTranslateY = null;
var velocityTranslate = null;
$group.addEventListener('touchstart', function (evt) {
lastEvt = evt;
startTime = new Date();
startPositionY = evt.touches[0].clientY;
prevTranslateY = startTranslateY = self.currentTranslateY;
$content.style.webkitTransition = null;
});
$group.addEventListener('touchmove', function (evt) {
var deltaY = evt.touches[0].clientY - startPositionY;
var translateY = startTranslateY + deltaY;
var minTranslateY = self.minTranslateY;
var maxTranslateY = self.maxTranslateY;
if (translateY > maxTranslateY) translateY = (translateY - maxTranslateY) / 2 + maxTranslateY;
if (translateY < minTranslateY) translateY = (translateY - minTranslateY) / 2 + minTranslateY;
self.setTranslateY(translateY);
velocityTranslate = translateY - prevTranslateY;
prevTranslateY = translateY;
lastEvt = evt;
});
$group.addEventListener('touchend', function () {
var momentumRatio = 7;
var translateY = self.currentTranslateY;
var duration = new Date() - startTime;
var distance = Math.abs(startTranslateY - translateY);
var minTranslateY = self.minTranslateY;
var maxTranslateY = self.maxTranslateY;
var rect, offset, momentumTranslate;
if (distance < 6) {
rect = $indicator.getBoundingClientRect();
offset = Math.floor((lastEvt.touches[0].clientY - rect.top) / itemHeight) * itemHeight;
if (offset > maxTranslateY) offset = maxTranslateY;
velocityTranslate = 0;
translateY -= offset;
}
if (duration < 300) {
momentumTranslate = translateY + velocityTranslate * momentumRatio;
}
$content.style.webkitTransition = 'transform 200ms ease';
self.$nextTick(function () {
var translate = momentumTranslate ? Math.round(momentumTranslate / itemHeight) * itemHeight : Math.round(translateY / itemHeight) * itemHeight;
translate = Math.max(Math.min(translate, maxTranslateY), minTranslateY);
self.setTranslateY(translate);
self.currentValue = self.translate2value(translate);
});
});
},
setTranslateY: function setTranslateY(val) {
this.currentTranslateY = val;
this.$refs.content.style.webkitTransform = 'translate3d(0, ' + val + 'px, 0)';
},
value2translate: function value2translate() {
var valueIndex = this.valueIndex;
var offset = Math.floor(this.showItemNum / 2);
if (valueIndex !== -1) {
return (valueIndex - offset) * -this.showItemHeight;
}
},
translate2value: function translate2value(translate) {
translate = Math.floor(translate / this.showItemHeight) * this.showItemHeight;
var index = -(translate - Math.floor(this.showItemNum / 2) * this.showItemHeight) / this.showItemHeight;
return this.mutatingValues[index];
},
doOnValueChange: function doOnValueChange(val) {
if (this.divider) return;
this.setTranslateY(this.value2translate(val || this.currentValue));
},
nearby: function nearby(val, values) {
var minOffset, minIndex, offset;
if (Array.isArray(values) === false) return undefined;
minIndex = 0;
if (typeof val === 'number') {
minOffset = Math.abs(values[0] - val);
values.forEach(function (value, i) {
offset = Math.abs(value - val);