| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815 |
- 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;
- /******/ // identity function for calling harmony imports with the correct context
- /******/ __webpack_require__.i = function(value) { return value; };
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, {
- /******/ configurable: false,
- /******/ enumerable: true,
- /******/ get: getter
- /******/ });
- /******/ }
- /******/ };
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 213);
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ 0:
- /***/ 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
- }
- }
- /***/ },
- /***/ 1:
- /***/ function(module, exports) {
- module.exports = require("vue");
- /***/ },
- /***/ 102:
- /***/ function(module, exports) {
- // removed by extract-text-webpack-plugin
- /***/ },
- /***/ 12:
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * v-clickoutside
- * @desc 点击元素外面才会触发的事件
- * @example
- * ```vue
- * <div v-element-clickoutside="handleClose">
- * ```
- */
- var clickoutsideContext = '@@clickoutsideContext';
- /* harmony default export */ exports["a"] = {
- bind: function bind(el, binding, vnode) {
- var documentHandler = function(e) {
- if (vnode.context && !el.contains(e.target)) {
- vnode.context[el[clickoutsideContext].methodName]();
- }
- };
- el[clickoutsideContext] = {
- documentHandler: documentHandler,
- methodName: binding.expression,
- arg: binding.arg || 'click'
- };
- document.addEventListener(el[clickoutsideContext].arg, documentHandler);
- },
- update: function update(el, binding) {
- el[clickoutsideContext].methodName = binding.expression;
- },
- unbind: function unbind(el) {
- document.removeEventListener(
- el[clickoutsideContext].arg,
- el[clickoutsideContext].documentHandler);
- },
- install: function install(Vue) {
- Vue.directive('clickoutside', {
- bind: this.bind,
- unbind: this.unbind
- });
- }
- };
- /***/ },
- /***/ 133:
- /***/ function(module, exports, __webpack_require__) {
- function injectStyle (ssrContext) {
- __webpack_require__(102)
- }
- var Component = __webpack_require__(0)(
- /* script */
- __webpack_require__(55),
- /* template */
- __webpack_require__(171),
- /* styles */
- injectStyle,
- /* scopeId */
- null,
- /* moduleIdentifier (server only) */
- null
- )
- module.exports = Component.exports
- /***/ },
- /***/ 171:
- /***/ function(module, exports) {
- module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
- return _c('x-cell', {
- directives: [{
- name: "clickoutside",
- rawName: "v-clickoutside:touchstart",
- value: (_vm.swipeMove),
- expression: "swipeMove",
- arg: "touchstart"
- }],
- ref: "cell",
- staticClass: "mint-cell-swipe",
- attrs: {
- "title": _vm.title,
- "icon": _vm.icon,
- "label": _vm.label,
- "to": _vm.to,
- "is-link": _vm.isLink,
- "value": _vm.value
- },
- nativeOn: {
- "click": function($event) {
- _vm.swipeMove()
- },
- "touchstart": function($event) {
- _vm.startDrag($event)
- },
- "touchmove": function($event) {
- _vm.onDrag($event)
- },
- "touchend": function($event) {
- _vm.endDrag($event)
- }
- }
- }, [_c('div', {
- ref: "right",
- staticClass: "mint-cell-swipe-buttongroup",
- slot: "right"
- }, _vm._l((_vm.right), function(btn) {
- return _c('a', {
- staticClass: "mint-cell-swipe-button",
- style: (btn.style),
- domProps: {
- "innerHTML": _vm._s(btn.content)
- },
- on: {
- "click": function($event) {
- $event.preventDefault();
- $event.stopPropagation();
- btn.handler && btn.handler(), _vm.swipeMove()
- }
- }
- })
- })), _vm._v(" "), _c('div', {
- ref: "left",
- staticClass: "mint-cell-swipe-buttongroup",
- slot: "left"
- }, _vm._l((_vm.left), function(btn) {
- return _c('a', {
- staticClass: "mint-cell-swipe-button",
- style: (btn.style),
- domProps: {
- "innerHTML": _vm._s(btn.content)
- },
- on: {
- "click": function($event) {
- $event.preventDefault();
- $event.stopPropagation();
- btn.handler && btn.handler(), _vm.swipeMove()
- }
- }
- })
- })), _vm._v(" "), _vm._t("default"), _vm._v(" "), (_vm.$slots.title) ? _c('span', {
- slot: "title"
- }, [_vm._t("title")], 2) : _vm._e(), _vm._v(" "), (_vm.$slots.icon) ? _c('span', {
- slot: "icon"
- }, [_vm._t("icon")], 2) : _vm._e()], 2)
- },staticRenderFns: []}
- /***/ },
- /***/ 2:
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(1);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);
- /* unused harmony export on */
- /* unused harmony export off */
- /* harmony export (binding) */ __webpack_require__.d(exports, "c", function() { return once; });
- /* unused harmony export hasClass */
- /* harmony export (immutable) */ exports["a"] = addClass;
- /* harmony export (immutable) */ exports["b"] = removeClass;
- /* unused harmony export getStyle */
- /* unused harmony export setStyle */
- /* istanbul ignore next */
- var isServer = __WEBPACK_IMPORTED_MODULE_0_vue___default.a.prototype.$isServer;
- var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
- var MOZ_HACK_REGEXP = /^moz([A-Z])/;
- var ieVersion = isServer ? 0 : Number(document.documentMode);
- /* istanbul ignore next */
- var trim = function(string) {
- return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
- };
- /* istanbul ignore next */
- var camelCase = function(name) {
- return name.replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
- return offset ? letter.toUpperCase() : letter;
- }).replace(MOZ_HACK_REGEXP, 'Moz$1');
- };
- /* istanbul ignore next */
- var on = (function() {
- if (!isServer && document.addEventListener) {
- return function(element, event, handler) {
- if (element && event && handler) {
- element.addEventListener(event, handler, false);
- }
- };
- } else {
- return function(element, event, handler) {
- if (element && event && handler) {
- element.attachEvent('on' + event, handler);
- }
- };
- }
- })();
- /* istanbul ignore next */
- var off = (function() {
- if (!isServer && document.removeEventListener) {
- return function(element, event, handler) {
- if (element && event) {
- element.removeEventListener(event, handler, false);
- }
- };
- } else {
- return function(element, event, handler) {
- if (element && event) {
- element.detachEvent('on' + event, handler);
- }
- };
- }
- })();
- /* istanbul ignore next */
- var once = function(el, event, fn) {
- var listener = function() {
- if (fn) {
- fn.apply(this, arguments);
- }
- off(el, event, listener);
- };
- on(el, event, listener);
- };
- /* istanbul ignore next */
- function hasClass(el, cls) {
- if (!el || !cls) return false;
- if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
- if (el.classList) {
- return el.classList.contains(cls);
- } else {
- return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
- }
- };
- /* istanbul ignore next */
- function addClass(el, cls) {
- if (!el) return;
- var curClass = el.className;
- var classes = (cls || '').split(' ');
- for (var i = 0, j = classes.length; i < j; i++) {
- var clsName = classes[i];
- if (!clsName) continue;
- if (el.classList) {
- el.classList.add(clsName);
- } else {
- if (!hasClass(el, clsName)) {
- curClass += ' ' + clsName;
- }
- }
- }
- if (!el.classList) {
- el.className = curClass;
- }
- };
- /* istanbul ignore next */
- function removeClass(el, cls) {
- if (!el || !cls) return;
- var classes = cls.split(' ');
- var curClass = ' ' + el.className + ' ';
- for (var i = 0, j = classes.length; i < j; i++) {
- var clsName = classes[i];
- if (!clsName) continue;
- if (el.classList) {
- el.classList.remove(clsName);
- } else {
- if (hasClass(el, clsName)) {
- curClass = curClass.replace(' ' + clsName + ' ', ' ');
- }
- }
- }
- if (!el.classList) {
- el.className = trim(curClass);
- }
- };
- /* istanbul ignore next */
- var getStyle = ieVersion < 9 ? function(element, styleName) {
- if (isServer) return;
- if (!element || !styleName) return null;
- styleName = camelCase(styleName);
- if (styleName === 'float') {
- styleName = 'styleFloat';
- }
- try {
- switch (styleName) {
- case 'opacity':
- try {
- return element.filters.item('alpha').opacity / 100;
- } catch (e) {
- return 1.0;
- }
- default:
- return (element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null);
- }
- } catch (e) {
- return element.style[styleName];
- }
- } : function(element, styleName) {
- if (isServer) return;
- if (!element || !styleName) return null;
- styleName = camelCase(styleName);
- if (styleName === 'float') {
- styleName = 'cssFloat';
- }
- try {
- var computed = document.defaultView.getComputedStyle(element, '');
- return element.style[styleName] || computed ? computed[styleName] : null;
- } catch (e) {
- return element.style[styleName];
- }
- };
- /* istanbul ignore next */
- function setStyle(element, styleName, value) {
- if (!element || !styleName) return;
- if (typeof styleName === 'object') {
- for (var prop in styleName) {
- if (styleName.hasOwnProperty(prop)) {
- setStyle(element, prop, styleName[prop]);
- }
- }
- } else {
- styleName = camelCase(styleName);
- if (styleName === 'opacity' && ieVersion < 9) {
- element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
- } else {
- element.style[styleName] = value;
- }
- }
- };
- /***/ },
- /***/ 21:
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_cell_swipe_vue__ = __webpack_require__(133);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_cell_swipe_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__src_cell_swipe_vue__);
- Object.defineProperty(exports, "__esModule", { value: true });
- /* harmony reexport (default from non-hamory) */ __webpack_require__.d(exports, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__src_cell_swipe_vue___default.a; });
- /***/ },
- /***/ 213:
- /***/ function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(21);
- /***/ },
- /***/ 3:
- /***/ function(module, exports) {
- module.exports = require("mint-ui/lib/cell");
- /***/ },
- /***/ 4:
- /***/ function(module, exports) {
- module.exports = require("mint-ui/lib/cell/style.css");
- /***/ },
- /***/ 55:
- /***/ function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_mint_ui_src_utils_dom__ = __webpack_require__(2);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_mint_ui_packages_cell_index_js__ = __webpack_require__(3);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_mint_ui_packages_cell_index_js___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_mint_ui_packages_cell_index_js__);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_clickoutside__ = __webpack_require__(12);
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- if (true) {
- __webpack_require__(4);
- }
- /**
- * mt-cell-swipe
- * @desc 类似 iOS 滑动 Cell 的效果
- * @module components/cell-swipe
- *
- * @example
- * <mt-cell-swipe
- * :left=[
- * {
- * content: 'text',
- * style: {color: 'white', backgroundColor: 'red'},
- * handler(e) => console.log(123)
- * }
- * ]
- * :right=[{ content: 'allowed HTML' }]>
- * swipe me
- * </mt-cell-swipe>
- */
- /* harmony default export */ exports["default"] = {
- name: 'mt-cell-swipe',
- components: { XCell: __WEBPACK_IMPORTED_MODULE_1_mint_ui_packages_cell_index_js___default.a },
- directives: { Clickoutside: __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_clickoutside__["a" /* default */] },
- props: {
- to: String,
- left: Array,
- right: Array,
- icon: String,
- title: String,
- label: String,
- isLink: Boolean,
- value: {}
- },
- data: function data() {
- return {
- start: { x: 0, y: 0 }
- };
- },
- mounted: function mounted() {
- this.wrap = this.$refs.cell.$el.querySelector('.mint-cell-wrapper');
- this.leftElm = this.$refs.left;
- this.rightElm = this.$refs.right;
- this.leftWrapElm = this.leftElm.parentNode;
- this.rightWrapElm = this.rightElm.parentNode;
- this.leftWidth = this.leftElm.getBoundingClientRect().width;
- this.rightWidth = this.rightElm.getBoundingClientRect().width;
- this.leftDefaultTransform = this.translate3d(-this.leftWidth - 1);
- this.rightDefaultTransform = this.translate3d(this.rightWidth);
- this.rightWrapElm.style.webkitTransform = this.rightDefaultTransform;
- this.leftWrapElm.style.webkitTransform = this.leftDefaultTransform;
- },
- methods: {
- resetSwipeStatus: function resetSwipeStatus() {
- this.swiping = false;
- this.opened = true;
- this.offsetLeft = 0;
- },
- translate3d: function translate3d(offset) {
- return ("translate3d(" + offset + "px, 0, 0)");
- },
- setAnimations: function setAnimations(val) {
- this.wrap.style.transitionDuration = val;
- this.rightWrapElm.style.transitionDuration = val;
- this.leftWrapElm.style.transitionDuration = val;
- },
- swipeMove: function swipeMove(offset) {
- if ( offset === void 0 ) offset = 0;
- this.wrap.style.webkitTransform = this.translate3d(offset);
- this.rightWrapElm.style.webkitTransform = this.translate3d(this.rightWidth + offset);
- this.leftWrapElm.style.webkitTransform = this.translate3d(-this.leftWidth + offset);
- offset && (this.swiping = true);
- },
- swipeLeaveTransition: function swipeLeaveTransition(direction) {
- var this$1 = this;
- setTimeout(function () {
- this$1.swipeLeave = true;
- // left
- if (direction > 0 && -this$1.offsetLeft > this$1.rightWidth * 0.4) {
- this$1.swipeMove(-this$1.rightWidth);
- this$1.resetSwipeStatus();
- return;
- // right
- } else if (direction < 0 && this$1.offsetLeft > this$1.leftWidth * 0.4) {
- this$1.swipeMove(this$1.leftWidth);
- this$1.resetSwipeStatus();
- return;
- }
- this$1.swipeMove(0);
- __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_mint_ui_src_utils_dom__["c" /* once */])(this$1.wrap, 'webkitTransitionEnd', function (_) {
- this$1.wrap.style.webkitTransform = '';
- this$1.rightWrapElm.style.webkitTransform = this$1.rightDefaultTransform;
- this$1.leftWrapElm.style.webkitTransform = this$1.leftDefaultTransform;
- this$1.swipeLeave = false;
- this$1.swiping = false;
- });
- }, 0);
- },
- startDrag: function startDrag(evt) {
- evt = evt.changedTouches ? evt.changedTouches[0] : evt;
- this.dragging = true;
- this.start.x = evt.pageX;
- this.start.y = evt.pageY;
- this.direction = '';
- },
- onDrag: function onDrag(evt) {
- if (this.opened) {
- if (!this.swiping) {
- this.swipeMove(0);
- this.setAnimations('');
- }
- this.opened = false;
- return;
- }
- if (!this.dragging) return;
- var swiping;
- var e = evt.changedTouches ? evt.changedTouches[0] : evt;
- var offsetTop = e.pageY - this.start.y;
- var offsetLeft = this.offsetLeft = e.pageX - this.start.x;
- var y = Math.abs(offsetTop);
- var x = Math.abs(offsetLeft);
- this.setAnimations('0ms');
- if (this.direction === '') {
- this.direction = x > y ? 'horizonal' : 'vertical';
- }
- if (this.direction === 'horizonal') {
- evt.preventDefault();
- evt.stopPropagation();
- swiping = !(x < 5 || (x >= 5 && y >= x * 1.73));
- if (!swiping) return;
- if ((offsetLeft < 0 && -offsetLeft > this.rightWidth) ||
- (offsetLeft > 0 && offsetLeft > this.leftWidth) ||
- (offsetLeft > 0 && !this.leftWidth) ||
- (offsetLeft < 0 && !this.rightWidth)) {
- } else {
- this.swipeMove(offsetLeft);
- }
- }
- },
- endDrag: function endDrag() {
- this.direction = '';
- this.setAnimations('');
- if (!this.swiping) return;
- this.swipeLeaveTransition(this.offsetLeft > 0 ? -1 : 1);
- }
- }
- };
- /***/ }
- /******/ });
|