index.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/ // Check if module is in cache
  8. /******/ if(installedModules[moduleId])
  9. /******/ return installedModules[moduleId].exports;
  10. /******/ // Create a new module (and put it into the cache)
  11. /******/ var module = installedModules[moduleId] = {
  12. /******/ i: moduleId,
  13. /******/ l: false,
  14. /******/ exports: {}
  15. /******/ };
  16. /******/ // Execute the module function
  17. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  18. /******/ // Flag the module as loaded
  19. /******/ module.l = true;
  20. /******/ // Return the exports of the module
  21. /******/ return module.exports;
  22. /******/ }
  23. /******/ // expose the modules object (__webpack_modules__)
  24. /******/ __webpack_require__.m = modules;
  25. /******/ // expose the module cache
  26. /******/ __webpack_require__.c = installedModules;
  27. /******/ // identity function for calling harmony imports with the correct context
  28. /******/ __webpack_require__.i = function(value) { return value; };
  29. /******/ // define getter function for harmony exports
  30. /******/ __webpack_require__.d = function(exports, name, getter) {
  31. /******/ if(!__webpack_require__.o(exports, name)) {
  32. /******/ Object.defineProperty(exports, name, {
  33. /******/ configurable: false,
  34. /******/ enumerable: true,
  35. /******/ get: getter
  36. /******/ });
  37. /******/ }
  38. /******/ };
  39. /******/ // getDefaultExport function for compatibility with non-harmony modules
  40. /******/ __webpack_require__.n = function(module) {
  41. /******/ var getter = module && module.__esModule ?
  42. /******/ function getDefault() { return module['default']; } :
  43. /******/ function getModuleExports() { return module; };
  44. /******/ __webpack_require__.d(getter, 'a', getter);
  45. /******/ return getter;
  46. /******/ };
  47. /******/ // Object.prototype.hasOwnProperty.call
  48. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  49. /******/ // __webpack_public_path__
  50. /******/ __webpack_require__.p = "";
  51. /******/ // Load entry module and return exports
  52. /******/ return __webpack_require__(__webpack_require__.s = 213);
  53. /******/ })
  54. /************************************************************************/
  55. /******/ ({
  56. /***/ 0:
  57. /***/ function(module, exports) {
  58. /* globals __VUE_SSR_CONTEXT__ */
  59. // this module is a runtime utility for cleaner component module output and will
  60. // be included in the final webpack user bundle
  61. module.exports = function normalizeComponent (
  62. rawScriptExports,
  63. compiledTemplate,
  64. injectStyles,
  65. scopeId,
  66. moduleIdentifier /* server only */
  67. ) {
  68. var esModule
  69. var scriptExports = rawScriptExports = rawScriptExports || {}
  70. // ES6 modules interop
  71. var type = typeof rawScriptExports.default
  72. if (type === 'object' || type === 'function') {
  73. esModule = rawScriptExports
  74. scriptExports = rawScriptExports.default
  75. }
  76. // Vue.extend constructor export interop
  77. var options = typeof scriptExports === 'function'
  78. ? scriptExports.options
  79. : scriptExports
  80. // render functions
  81. if (compiledTemplate) {
  82. options.render = compiledTemplate.render
  83. options.staticRenderFns = compiledTemplate.staticRenderFns
  84. }
  85. // scopedId
  86. if (scopeId) {
  87. options._scopeId = scopeId
  88. }
  89. var hook
  90. if (moduleIdentifier) { // server build
  91. hook = function (context) {
  92. // 2.3 injection
  93. context =
  94. context || // cached call
  95. (this.$vnode && this.$vnode.ssrContext) || // stateful
  96. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  97. // 2.2 with runInNewContext: true
  98. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  99. context = __VUE_SSR_CONTEXT__
  100. }
  101. // inject component styles
  102. if (injectStyles) {
  103. injectStyles.call(this, context)
  104. }
  105. // register component module identifier for async chunk inferrence
  106. if (context && context._registeredComponents) {
  107. context._registeredComponents.add(moduleIdentifier)
  108. }
  109. }
  110. // used by ssr in case component is cached and beforeCreate
  111. // never gets called
  112. options._ssrRegister = hook
  113. } else if (injectStyles) {
  114. hook = injectStyles
  115. }
  116. if (hook) {
  117. var functional = options.functional
  118. var existing = functional
  119. ? options.render
  120. : options.beforeCreate
  121. if (!functional) {
  122. // inject component registration as beforeCreate hook
  123. options.beforeCreate = existing
  124. ? [].concat(existing, hook)
  125. : [hook]
  126. } else {
  127. // register for functioal component in vue file
  128. options.render = function renderWithStyleInjection (h, context) {
  129. hook.call(context)
  130. return existing(h, context)
  131. }
  132. }
  133. }
  134. return {
  135. esModule: esModule,
  136. exports: scriptExports,
  137. options: options
  138. }
  139. }
  140. /***/ },
  141. /***/ 1:
  142. /***/ function(module, exports) {
  143. module.exports = require("vue");
  144. /***/ },
  145. /***/ 102:
  146. /***/ function(module, exports) {
  147. // removed by extract-text-webpack-plugin
  148. /***/ },
  149. /***/ 12:
  150. /***/ function(module, exports, __webpack_require__) {
  151. "use strict";
  152. /**
  153. * v-clickoutside
  154. * @desc 点击元素外面才会触发的事件
  155. * @example
  156. * ```vue
  157. * <div v-element-clickoutside="handleClose">
  158. * ```
  159. */
  160. var clickoutsideContext = '@@clickoutsideContext';
  161. /* harmony default export */ exports["a"] = {
  162. bind: function bind(el, binding, vnode) {
  163. var documentHandler = function(e) {
  164. if (vnode.context && !el.contains(e.target)) {
  165. vnode.context[el[clickoutsideContext].methodName]();
  166. }
  167. };
  168. el[clickoutsideContext] = {
  169. documentHandler: documentHandler,
  170. methodName: binding.expression,
  171. arg: binding.arg || 'click'
  172. };
  173. document.addEventListener(el[clickoutsideContext].arg, documentHandler);
  174. },
  175. update: function update(el, binding) {
  176. el[clickoutsideContext].methodName = binding.expression;
  177. },
  178. unbind: function unbind(el) {
  179. document.removeEventListener(
  180. el[clickoutsideContext].arg,
  181. el[clickoutsideContext].documentHandler);
  182. },
  183. install: function install(Vue) {
  184. Vue.directive('clickoutside', {
  185. bind: this.bind,
  186. unbind: this.unbind
  187. });
  188. }
  189. };
  190. /***/ },
  191. /***/ 133:
  192. /***/ function(module, exports, __webpack_require__) {
  193. function injectStyle (ssrContext) {
  194. __webpack_require__(102)
  195. }
  196. var Component = __webpack_require__(0)(
  197. /* script */
  198. __webpack_require__(55),
  199. /* template */
  200. __webpack_require__(171),
  201. /* styles */
  202. injectStyle,
  203. /* scopeId */
  204. null,
  205. /* moduleIdentifier (server only) */
  206. null
  207. )
  208. module.exports = Component.exports
  209. /***/ },
  210. /***/ 171:
  211. /***/ function(module, exports) {
  212. module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;
  213. return _c('x-cell', {
  214. directives: [{
  215. name: "clickoutside",
  216. rawName: "v-clickoutside:touchstart",
  217. value: (_vm.swipeMove),
  218. expression: "swipeMove",
  219. arg: "touchstart"
  220. }],
  221. ref: "cell",
  222. staticClass: "mint-cell-swipe",
  223. attrs: {
  224. "title": _vm.title,
  225. "icon": _vm.icon,
  226. "label": _vm.label,
  227. "to": _vm.to,
  228. "is-link": _vm.isLink,
  229. "value": _vm.value
  230. },
  231. nativeOn: {
  232. "click": function($event) {
  233. _vm.swipeMove()
  234. },
  235. "touchstart": function($event) {
  236. _vm.startDrag($event)
  237. },
  238. "touchmove": function($event) {
  239. _vm.onDrag($event)
  240. },
  241. "touchend": function($event) {
  242. _vm.endDrag($event)
  243. }
  244. }
  245. }, [_c('div', {
  246. ref: "right",
  247. staticClass: "mint-cell-swipe-buttongroup",
  248. slot: "right"
  249. }, _vm._l((_vm.right), function(btn) {
  250. return _c('a', {
  251. staticClass: "mint-cell-swipe-button",
  252. style: (btn.style),
  253. domProps: {
  254. "innerHTML": _vm._s(btn.content)
  255. },
  256. on: {
  257. "click": function($event) {
  258. $event.preventDefault();
  259. $event.stopPropagation();
  260. btn.handler && btn.handler(), _vm.swipeMove()
  261. }
  262. }
  263. })
  264. })), _vm._v(" "), _c('div', {
  265. ref: "left",
  266. staticClass: "mint-cell-swipe-buttongroup",
  267. slot: "left"
  268. }, _vm._l((_vm.left), function(btn) {
  269. return _c('a', {
  270. staticClass: "mint-cell-swipe-button",
  271. style: (btn.style),
  272. domProps: {
  273. "innerHTML": _vm._s(btn.content)
  274. },
  275. on: {
  276. "click": function($event) {
  277. $event.preventDefault();
  278. $event.stopPropagation();
  279. btn.handler && btn.handler(), _vm.swipeMove()
  280. }
  281. }
  282. })
  283. })), _vm._v(" "), _vm._t("default"), _vm._v(" "), (_vm.$slots.title) ? _c('span', {
  284. slot: "title"
  285. }, [_vm._t("title")], 2) : _vm._e(), _vm._v(" "), (_vm.$slots.icon) ? _c('span', {
  286. slot: "icon"
  287. }, [_vm._t("icon")], 2) : _vm._e()], 2)
  288. },staticRenderFns: []}
  289. /***/ },
  290. /***/ 2:
  291. /***/ function(module, exports, __webpack_require__) {
  292. "use strict";
  293. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(1);
  294. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__);
  295. /* unused harmony export on */
  296. /* unused harmony export off */
  297. /* harmony export (binding) */ __webpack_require__.d(exports, "c", function() { return once; });
  298. /* unused harmony export hasClass */
  299. /* harmony export (immutable) */ exports["a"] = addClass;
  300. /* harmony export (immutable) */ exports["b"] = removeClass;
  301. /* unused harmony export getStyle */
  302. /* unused harmony export setStyle */
  303. /* istanbul ignore next */
  304. var isServer = __WEBPACK_IMPORTED_MODULE_0_vue___default.a.prototype.$isServer;
  305. var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
  306. var MOZ_HACK_REGEXP = /^moz([A-Z])/;
  307. var ieVersion = isServer ? 0 : Number(document.documentMode);
  308. /* istanbul ignore next */
  309. var trim = function(string) {
  310. return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
  311. };
  312. /* istanbul ignore next */
  313. var camelCase = function(name) {
  314. return name.replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
  315. return offset ? letter.toUpperCase() : letter;
  316. }).replace(MOZ_HACK_REGEXP, 'Moz$1');
  317. };
  318. /* istanbul ignore next */
  319. var on = (function() {
  320. if (!isServer && document.addEventListener) {
  321. return function(element, event, handler) {
  322. if (element && event && handler) {
  323. element.addEventListener(event, handler, false);
  324. }
  325. };
  326. } else {
  327. return function(element, event, handler) {
  328. if (element && event && handler) {
  329. element.attachEvent('on' + event, handler);
  330. }
  331. };
  332. }
  333. })();
  334. /* istanbul ignore next */
  335. var off = (function() {
  336. if (!isServer && document.removeEventListener) {
  337. return function(element, event, handler) {
  338. if (element && event) {
  339. element.removeEventListener(event, handler, false);
  340. }
  341. };
  342. } else {
  343. return function(element, event, handler) {
  344. if (element && event) {
  345. element.detachEvent('on' + event, handler);
  346. }
  347. };
  348. }
  349. })();
  350. /* istanbul ignore next */
  351. var once = function(el, event, fn) {
  352. var listener = function() {
  353. if (fn) {
  354. fn.apply(this, arguments);
  355. }
  356. off(el, event, listener);
  357. };
  358. on(el, event, listener);
  359. };
  360. /* istanbul ignore next */
  361. function hasClass(el, cls) {
  362. if (!el || !cls) return false;
  363. if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
  364. if (el.classList) {
  365. return el.classList.contains(cls);
  366. } else {
  367. return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
  368. }
  369. };
  370. /* istanbul ignore next */
  371. function addClass(el, cls) {
  372. if (!el) return;
  373. var curClass = el.className;
  374. var classes = (cls || '').split(' ');
  375. for (var i = 0, j = classes.length; i < j; i++) {
  376. var clsName = classes[i];
  377. if (!clsName) continue;
  378. if (el.classList) {
  379. el.classList.add(clsName);
  380. } else {
  381. if (!hasClass(el, clsName)) {
  382. curClass += ' ' + clsName;
  383. }
  384. }
  385. }
  386. if (!el.classList) {
  387. el.className = curClass;
  388. }
  389. };
  390. /* istanbul ignore next */
  391. function removeClass(el, cls) {
  392. if (!el || !cls) return;
  393. var classes = cls.split(' ');
  394. var curClass = ' ' + el.className + ' ';
  395. for (var i = 0, j = classes.length; i < j; i++) {
  396. var clsName = classes[i];
  397. if (!clsName) continue;
  398. if (el.classList) {
  399. el.classList.remove(clsName);
  400. } else {
  401. if (hasClass(el, clsName)) {
  402. curClass = curClass.replace(' ' + clsName + ' ', ' ');
  403. }
  404. }
  405. }
  406. if (!el.classList) {
  407. el.className = trim(curClass);
  408. }
  409. };
  410. /* istanbul ignore next */
  411. var getStyle = ieVersion < 9 ? function(element, styleName) {
  412. if (isServer) return;
  413. if (!element || !styleName) return null;
  414. styleName = camelCase(styleName);
  415. if (styleName === 'float') {
  416. styleName = 'styleFloat';
  417. }
  418. try {
  419. switch (styleName) {
  420. case 'opacity':
  421. try {
  422. return element.filters.item('alpha').opacity / 100;
  423. } catch (e) {
  424. return 1.0;
  425. }
  426. default:
  427. return (element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null);
  428. }
  429. } catch (e) {
  430. return element.style[styleName];
  431. }
  432. } : function(element, styleName) {
  433. if (isServer) return;
  434. if (!element || !styleName) return null;
  435. styleName = camelCase(styleName);
  436. if (styleName === 'float') {
  437. styleName = 'cssFloat';
  438. }
  439. try {
  440. var computed = document.defaultView.getComputedStyle(element, '');
  441. return element.style[styleName] || computed ? computed[styleName] : null;
  442. } catch (e) {
  443. return element.style[styleName];
  444. }
  445. };
  446. /* istanbul ignore next */
  447. function setStyle(element, styleName, value) {
  448. if (!element || !styleName) return;
  449. if (typeof styleName === 'object') {
  450. for (var prop in styleName) {
  451. if (styleName.hasOwnProperty(prop)) {
  452. setStyle(element, prop, styleName[prop]);
  453. }
  454. }
  455. } else {
  456. styleName = camelCase(styleName);
  457. if (styleName === 'opacity' && ieVersion < 9) {
  458. element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
  459. } else {
  460. element.style[styleName] = value;
  461. }
  462. }
  463. };
  464. /***/ },
  465. /***/ 21:
  466. /***/ function(module, exports, __webpack_require__) {
  467. "use strict";
  468. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_cell_swipe_vue__ = __webpack_require__(133);
  469. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_cell_swipe_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__src_cell_swipe_vue__);
  470. Object.defineProperty(exports, "__esModule", { value: true });
  471. /* harmony reexport (default from non-hamory) */ __webpack_require__.d(exports, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__src_cell_swipe_vue___default.a; });
  472. /***/ },
  473. /***/ 213:
  474. /***/ function(module, exports, __webpack_require__) {
  475. module.exports = __webpack_require__(21);
  476. /***/ },
  477. /***/ 3:
  478. /***/ function(module, exports) {
  479. module.exports = require("mint-ui/lib/cell");
  480. /***/ },
  481. /***/ 4:
  482. /***/ function(module, exports) {
  483. module.exports = require("mint-ui/lib/cell/style.css");
  484. /***/ },
  485. /***/ 55:
  486. /***/ function(module, exports, __webpack_require__) {
  487. "use strict";
  488. Object.defineProperty(exports, "__esModule", { value: true });
  489. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_mint_ui_src_utils_dom__ = __webpack_require__(2);
  490. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_mint_ui_packages_cell_index_js__ = __webpack_require__(3);
  491. /* 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__);
  492. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_clickoutside__ = __webpack_require__(12);
  493. //
  494. //
  495. //
  496. //
  497. //
  498. //
  499. //
  500. //
  501. //
  502. //
  503. //
  504. //
  505. //
  506. //
  507. //
  508. //
  509. //
  510. //
  511. //
  512. //
  513. //
  514. //
  515. //
  516. //
  517. //
  518. //
  519. //
  520. //
  521. //
  522. //
  523. //
  524. //
  525. //
  526. //
  527. //
  528. //
  529. //
  530. //
  531. //
  532. //
  533. //
  534. //
  535. //
  536. //
  537. //
  538. //
  539. //
  540. //
  541. //
  542. //
  543. //
  544. if (true) {
  545. __webpack_require__(4);
  546. }
  547. /**
  548. * mt-cell-swipe
  549. * @desc 类似 iOS 滑动 Cell 的效果
  550. * @module components/cell-swipe
  551. *
  552. * @example
  553. * <mt-cell-swipe
  554. * :left=[
  555. * {
  556. * content: 'text',
  557. * style: {color: 'white', backgroundColor: 'red'},
  558. * handler(e) => console.log(123)
  559. * }
  560. * ]
  561. * :right=[{ content: 'allowed HTML' }]>
  562. * swipe me
  563. * </mt-cell-swipe>
  564. */
  565. /* harmony default export */ exports["default"] = {
  566. name: 'mt-cell-swipe',
  567. components: { XCell: __WEBPACK_IMPORTED_MODULE_1_mint_ui_packages_cell_index_js___default.a },
  568. directives: { Clickoutside: __WEBPACK_IMPORTED_MODULE_2_mint_ui_src_utils_clickoutside__["a" /* default */] },
  569. props: {
  570. to: String,
  571. left: Array,
  572. right: Array,
  573. icon: String,
  574. title: String,
  575. label: String,
  576. isLink: Boolean,
  577. value: {}
  578. },
  579. data: function data() {
  580. return {
  581. start: { x: 0, y: 0 }
  582. };
  583. },
  584. mounted: function mounted() {
  585. this.wrap = this.$refs.cell.$el.querySelector('.mint-cell-wrapper');
  586. this.leftElm = this.$refs.left;
  587. this.rightElm = this.$refs.right;
  588. this.leftWrapElm = this.leftElm.parentNode;
  589. this.rightWrapElm = this.rightElm.parentNode;
  590. this.leftWidth = this.leftElm.getBoundingClientRect().width;
  591. this.rightWidth = this.rightElm.getBoundingClientRect().width;
  592. this.leftDefaultTransform = this.translate3d(-this.leftWidth - 1);
  593. this.rightDefaultTransform = this.translate3d(this.rightWidth);
  594. this.rightWrapElm.style.webkitTransform = this.rightDefaultTransform;
  595. this.leftWrapElm.style.webkitTransform = this.leftDefaultTransform;
  596. },
  597. methods: {
  598. resetSwipeStatus: function resetSwipeStatus() {
  599. this.swiping = false;
  600. this.opened = true;
  601. this.offsetLeft = 0;
  602. },
  603. translate3d: function translate3d(offset) {
  604. return ("translate3d(" + offset + "px, 0, 0)");
  605. },
  606. setAnimations: function setAnimations(val) {
  607. this.wrap.style.transitionDuration = val;
  608. this.rightWrapElm.style.transitionDuration = val;
  609. this.leftWrapElm.style.transitionDuration = val;
  610. },
  611. swipeMove: function swipeMove(offset) {
  612. if ( offset === void 0 ) offset = 0;
  613. this.wrap.style.webkitTransform = this.translate3d(offset);
  614. this.rightWrapElm.style.webkitTransform = this.translate3d(this.rightWidth + offset);
  615. this.leftWrapElm.style.webkitTransform = this.translate3d(-this.leftWidth + offset);
  616. offset && (this.swiping = true);
  617. },
  618. swipeLeaveTransition: function swipeLeaveTransition(direction) {
  619. var this$1 = this;
  620. setTimeout(function () {
  621. this$1.swipeLeave = true;
  622. // left
  623. if (direction > 0 && -this$1.offsetLeft > this$1.rightWidth * 0.4) {
  624. this$1.swipeMove(-this$1.rightWidth);
  625. this$1.resetSwipeStatus();
  626. return;
  627. // right
  628. } else if (direction < 0 && this$1.offsetLeft > this$1.leftWidth * 0.4) {
  629. this$1.swipeMove(this$1.leftWidth);
  630. this$1.resetSwipeStatus();
  631. return;
  632. }
  633. this$1.swipeMove(0);
  634. __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_mint_ui_src_utils_dom__["c" /* once */])(this$1.wrap, 'webkitTransitionEnd', function (_) {
  635. this$1.wrap.style.webkitTransform = '';
  636. this$1.rightWrapElm.style.webkitTransform = this$1.rightDefaultTransform;
  637. this$1.leftWrapElm.style.webkitTransform = this$1.leftDefaultTransform;
  638. this$1.swipeLeave = false;
  639. this$1.swiping = false;
  640. });
  641. }, 0);
  642. },
  643. startDrag: function startDrag(evt) {
  644. evt = evt.changedTouches ? evt.changedTouches[0] : evt;
  645. this.dragging = true;
  646. this.start.x = evt.pageX;
  647. this.start.y = evt.pageY;
  648. this.direction = '';
  649. },
  650. onDrag: function onDrag(evt) {
  651. if (this.opened) {
  652. if (!this.swiping) {
  653. this.swipeMove(0);
  654. this.setAnimations('');
  655. }
  656. this.opened = false;
  657. return;
  658. }
  659. if (!this.dragging) return;
  660. var swiping;
  661. var e = evt.changedTouches ? evt.changedTouches[0] : evt;
  662. var offsetTop = e.pageY - this.start.y;
  663. var offsetLeft = this.offsetLeft = e.pageX - this.start.x;
  664. var y = Math.abs(offsetTop);
  665. var x = Math.abs(offsetLeft);
  666. this.setAnimations('0ms');
  667. if (this.direction === '') {
  668. this.direction = x > y ? 'horizonal' : 'vertical';
  669. }
  670. if (this.direction === 'horizonal') {
  671. evt.preventDefault();
  672. evt.stopPropagation();
  673. swiping = !(x < 5 || (x >= 5 && y >= x * 1.73));
  674. if (!swiping) return;
  675. if ((offsetLeft < 0 && -offsetLeft > this.rightWidth) ||
  676. (offsetLeft > 0 && offsetLeft > this.leftWidth) ||
  677. (offsetLeft > 0 && !this.leftWidth) ||
  678. (offsetLeft < 0 && !this.rightWidth)) {
  679. } else {
  680. this.swipeMove(offsetLeft);
  681. }
  682. }
  683. },
  684. endDrag: function endDrag() {
  685. this.direction = '';
  686. this.setAnimations('');
  687. if (!this.swiping) return;
  688. this.swipeLeaveTransition(this.offsetLeft > 0 ? -1 : 1);
  689. }
  690. }
  691. };
  692. /***/ }
  693. /******/ });