UNPKG

@insaic/neon

Version:

A Mobile UI Components built on Vue

526 lines (463 loc) 18.9 kB
module.exports = /******/ (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 = 173); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ (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 } } /***/ }), /***/ 113: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /* harmony default export */ __webpack_exports__["a"] = ({ name: 'sq-carlicense', props: { provinceName: { type: String, required: true }, carNumber: { type: String, default: '' }, placeholder: { type: String, default: '' }, closeButtonText: { type: String, default: '关闭' } }, mounted: function mounted() { var _this = this; this.$nextTick(function () { document.addEventListener('click', _this.closeAllKeyboard, false); }); }, data: function data() { return { closeBtnText: this.closeButtonText, isShowTip: false, tipText: '', tipPosX: '0', tipPosY: '-100px', provinceList: [['京', '津', '冀', '晋', '蒙', '辽', '吉', '黑'], ['沪', '苏', '浙', '皖', '闽', '赣', '鲁', '豫'], ['鄂', '湘', '粤', '桂', '琼', '渝', '川', '贵'], ['云', '藏', '陕', '甘', '青', '宁', '新', '']], keyboardList: [[1, 2, 3, 4, 5, 6, 7, 8, 9, 0], ['Q', 'W', 'E', 'R', 'T', 'Y', 'U'], ['A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L'], ['Z', 'X', 'C', 'V', 'B', 'N', 'M']], isNumKeyDisabled: true, // 设置数字键盘是否含disabled样式属性 isEnKeyDisabled: false, // 设置英文键盘是否含disabled样式属性 provinceDisplay: 'none', // 设置省份键盘是否显示 的 display 属性 keyBoardDisplay: 'none', // 设置数字英文键盘是否显示的 display 属性 isShowDelIcon: false, // 是否显示删除图标 hasEnergyText: false // 是否显示新能源文字提示 }; }, methods: { closeAllKeyboard: function closeAllKeyboard(event) { if (!this.$refs.hasOwnProperty('keyboardWrapper') || !this.$refs.keyboardWrapper) { return; } var isContains = this.$refs.keyboardWrapper.contains(event.target); if (!isContains) { this.keyBoardDisplay !== 'none' && (this.keyBoardDisplay = 'none'); this.provinceDisplay !== 'none' && (this.provinceDisplay = 'none'); } }, closeEnNumKeyboard: function closeEnNumKeyboard(event) { this.keyBoardDisplay = 'none'; event.stopPropagation(); }, cliackDeleteHandle: function cliackDeleteHandle() { this.$emit('update:carNumber', this.carNumber.slice(0, 1)); }, clickProvinceNameHandle: function clickProvinceNameHandle() { this.showProvinceKeyBoard(); }, showProvinceKeyBoard: function showProvinceKeyBoard() { this.provinceDisplay !== 'block' && (this.provinceDisplay = 'block'); this.keyBoardDisplay !== 'none' && (this.keyBoardDisplay = 'none'); }, showEnNumberBoard: function showEnNumberBoard() { this.keyBoardDisplay !== 'block' && (this.keyBoardDisplay = 'block'); this.provinceDisplay !== 'none' && (this.provinceDisplay = 'none'); }, getProvince: function getProvince(event) { event.stopPropagation(); var nodeName = event.target.nodeName.toLocaleLowerCase(); var isDisabled = event.target.className.indexOf('sq-carlicense-disabled') !== -1; if (isDisabled) return; if (nodeName === 'li') { var text = event.target.innerText; this.$emit('update:provinceName', text); this.$emit('update:carNumber', ''); this.$emit('set-province', text); this.showEnNumberBoard(); } }, getContent: function getContent(event) { var _this2 = this; event.stopPropagation(); var nodeName = event.target.nodeName.toLocaleLowerCase(); var isDisabled = event.target.className.indexOf('sq-carlicense-disabled') !== -1; var isDel = event.target.className.indexOf('sq-carlicense-del') !== -1; if (isDel) { this.$emit('update:carNumber', this.carNumber.slice(0, -1)); return; } if (nodeName === 'li') { if (isDisabled) { return; } var textContent = event.target.textContent; var position = event.target.getBoundingClientRect(); this.tipText = textContent; this.tipPosX = (position.left < 10 ? 12 : textContent === '0' || textContent === 'P' || textContent === 'L' ? position.left - 8 : position.left) - 10 + 'px'; this.tipPosY = position.top - 56 + 'px'; this.isShowTip = true; window.setTimeout(function () { _this2.isShowTip = false; _this2.tipText = ''; }, 250); if (this.carNumber.length < 7) { this.$emit('update:carNumber', this.carNumber + event.target.innerText); } } if (this.keyBoardDisplay === 'none') { this.showEnNumberBoard(); } } }, watch: { carNumber: { handler: function handler() { if (this.carNumber.length === 0) { !this.isNumKeyDisabled && (this.isNumKeyDisabled = true); this.isEnKeyDisabled && (this.isEnKeyDisabled = false); this.isShowDelIcon && (this.isShowDelIcon = false); } if (this.carNumber.length > 0) { this.isNumKeyDisabled && (this.isNumKeyDisabled = false); !this.isEnKeyDisabled && (this.isEnKeyDisabled = true); this.carNumber.length > 1 && !this.isShowDelIcon && (this.isShowDelIcon = true); this.carNumber.length === 1 && this.isShowDelIcon && (this.isShowDelIcon = false); } // this.carNumber 为 第2 到 第8位 // 严格校验新能源车牌号码的约束规则: // 沪【第1位】 A【第2位】 D【第3位】 K【第4位】 1【第5位】 2【第6位】 3【第7位】 4【第8位】 // 当第3位为D/F时,第4位可字母和数字,第5-8位必须纯数字; // 当第8位为D/F时,第3-7位必须纯数字; if (this.carNumber.length === 7 && (/[A-Z][DF][0-9A-Z]\d{4}/.test(this.carNumber) || /[A-Z]\d{5}[DF]/.test(this.carNumber))) { this.hasEnergyText = true; } else { this.hasEnergyText && (this.hasEnergyText = false); } if (this.carNumber.length === 6 || this.carNumber.length === 7) { this.closeBtnText !== '完成' && (this.closeBtnText = '完成'); } else { this.closeBtnText === '完成' && (this.closeBtnText = this.closeButtonText); } }, immediate: true } }, beforeDestroy: function beforeDestroy() { document.removeEventListener('click', this.closeAllKeyboard); } }); /***/ }), /***/ 173: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_index_vue__ = __webpack_require__(174); __WEBPACK_IMPORTED_MODULE_0__src_index_vue__["a" /* default */].install = function (Vue) { Vue.component(__WEBPACK_IMPORTED_MODULE_0__src_index_vue__["a" /* default */].name, __WEBPACK_IMPORTED_MODULE_0__src_index_vue__["a" /* default */]); }; /* harmony default export */ __webpack_exports__["default"] = (__WEBPACK_IMPORTED_MODULE_0__src_index_vue__["a" /* default */]); /***/ }), /***/ 174: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_index_vue__ = __webpack_require__(113); /* unused harmony namespace reexport */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_1f43335b_hasScoped_false_transformToRequire_video_src_poster_source_src_img_src_image_xlink_href_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_index_vue__ = __webpack_require__(176); function injectStyle (ssrContext) { __webpack_require__(175) } var normalizeComponent = __webpack_require__(0) /* 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__["a" /* default */], __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_1f43335b_hasScoped_false_transformToRequire_video_src_poster_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__ ) /* harmony default export */ __webpack_exports__["a"] = (Component.exports); /***/ }), /***/ 175: /***/ (function(module, exports) { // removed by extract-text-webpack-plugin /***/ }), /***/ 176: /***/ (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:"keyboardWrapper",staticClass:"sq-carlicense"},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(!_vm.$slots.input),expression:"!$slots.input"}],staticClass:"sq-carlicense-wrapper"},[_c('span',{staticClass:"sq-carlicense-province",on:{"click":_vm.clickProvinceNameHandle}},[_vm._v("\n "+_vm._s(_vm.provinceName)+"\n ")]),_vm._v(" "),_c('div',{staticClass:"sq-carlicense-energy",class:{'sq-carlicense-has-energy-text': _vm.hasEnergyText}},[_c('span',{staticClass:"sq-carlicense-number",class:{ 'sq-carlicense-blink-blur':_vm.keyBoardDisplay === 'none', 'sq-carlicense-hidden-placeholder':_vm.carNumber },attrs:{"data-content":_vm.placeholder},on:{"click":_vm.showEnNumberBoard}},[_vm._v(_vm._s(_vm.carNumber))])]),_vm._v(" "),_c('i',{directives:[{name:"show",rawName:"v-show",value:(_vm.isShowDelIcon),expression:"isShowDelIcon"}],staticClass:"sq-icon sq-icon-error-full sq-carlicense-keyboard-icon-delete",on:{"click":_vm.cliackDeleteHandle}})]),_vm._v(" "),_c('transition',{attrs:{"name":"ry-slide-bottom"}},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.provinceDisplay === 'block'),expression:"provinceDisplay === 'block'"}],staticClass:"sq-carlicense-province-wrapper",on:{"click":function($event){_vm.getProvince($event)}}},[_c('p',{staticClass:"sq-carlicense-close-btn"},[_c('a',{staticClass:"sq-carlicense-close-btn-text",on:{"click":function($event){_vm.provinceDisplay = 'none'}}},[_vm._v("关闭")])]),_vm._v(" "),_vm._l((_vm.provinceList),function(rowProvince,index){return _c('ul',{key:index,staticClass:"sq-carlicense-row-wrapper"},_vm._l((rowProvince),function(province){return _c('li',{key:province,staticClass:"sq-carlicense-row-wrapper-item",class:{'sq-carlicense-disabled': !province}},[_vm._v(_vm._s(province))])}))})],2)]),_vm._v(" "),_c('transition',{attrs:{"name":"ry-slide-bottom"}},[_c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.keyBoardDisplay === 'block'),expression:"keyBoardDisplay === 'block'"}],staticClass:"sq-carlicense-en-num-wrapper",on:{"click":function($event){_vm.getContent($event)}}},[_c('p',{staticClass:"sq-carlicense-close-btn"},[_c('a',{staticClass:"sq-carlicense-close-btn-text",on:{"click":function($event){_vm.closeEnNumKeyboard($event)}}},[_vm._v("\n "+_vm._s(_vm.closeBtnText)+"\n ")])]),_vm._v(" "),_vm._l((_vm.keyboardList),function(item,index){return _c('ul',{key:index,staticClass:"sq-carlicense-row-key"},[(index === 0)?_vm._l((item),function(item,index){return _c('li',{key:'num-' + index,staticClass:"sq-carlicense-row-key-item",class:{ 'sq-carlicense-disabled': _vm.isNumKeyDisabled }},[_vm._v(_vm._s(item))])}):(index === 1)?[_vm._l((item),function(item,index){return _c('li',{key:'firstRow-' + index,staticClass:"sq-carlicense-row-key-item"},[_vm._v(_vm._s(item))])}),_vm._v(" "),_c('li',{staticClass:"sq-carlicense-row-key-item",class:{ 'sq-carlicense-disabled': _vm.isEnKeyDisabled }},[_vm._v("I")]),_vm._v(" "),_c('li',{staticClass:"sq-carlicense-row-key-item",class:{ 'sq-carlicense-disabled': _vm.isEnKeyDisabled }},[_vm._v("O")]),_vm._v(" "),_c('li',{staticClass:"sq-carlicense-row-key-item"},[_vm._v("P")])]:(index === 2)?_vm._l((item),function(item,index){return _c('li',{key:'secondRow-' + index,staticClass:"sq-carlicense-row-key-item"},[_vm._v(_vm._s(item))])}):(index === 3)?[_c('li',{staticClass:"sq-carlicense-row-key-item sq-carlicense-uppercase sq-carlicense-disabled sq-icon sq-icon-keyboard-xiangshang"}),_vm._v(" "),_vm._l((item),function(item,index){return _c('li',{key:'threeRow-' + index,staticClass:"sq-carlicense-row-key-item"},[_vm._v(_vm._s(item))])}),_vm._v(" "),_c('li',{staticClass:"sq-carlicense-row-key-item sq-carlicense-del sq-icon sq-icon-keyboard-delete"})]:_vm._e()],2)})],2)]),_vm._v(" "),(_vm.isShowTip)?_c('div',{staticClass:"sq-carlicense-keyboard-tip",style:({'left': _vm.tipPosX, 'top': _vm.tipPosY})},[_vm._v(_vm._s(_vm.tipText))]):_vm._e()],1)} var staticRenderFns = [] var esExports = { render: render, staticRenderFns: staticRenderFns } /* harmony default export */ __webpack_exports__["a"] = (esExports); /***/ }) /******/ });