input-number.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "/dist/";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 104);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 0:
  90. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  91. "use strict";
  92. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
  93. /* globals __VUE_SSR_CONTEXT__ */
  94. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  95. // This module is a runtime utility for cleaner component module output and will
  96. // be included in the final webpack user bundle.
  97. function normalizeComponent (
  98. scriptExports,
  99. render,
  100. staticRenderFns,
  101. functionalTemplate,
  102. injectStyles,
  103. scopeId,
  104. moduleIdentifier, /* server only */
  105. shadowMode /* vue-cli only */
  106. ) {
  107. // Vue.extend constructor export interop
  108. var options = typeof scriptExports === 'function'
  109. ? scriptExports.options
  110. : scriptExports
  111. // render functions
  112. if (render) {
  113. options.render = render
  114. options.staticRenderFns = staticRenderFns
  115. options._compiled = true
  116. }
  117. // functional template
  118. if (functionalTemplate) {
  119. options.functional = true
  120. }
  121. // scopedId
  122. if (scopeId) {
  123. options._scopeId = 'data-v-' + scopeId
  124. }
  125. var hook
  126. if (moduleIdentifier) { // server build
  127. hook = function (context) {
  128. // 2.3 injection
  129. context =
  130. context || // cached call
  131. (this.$vnode && this.$vnode.ssrContext) || // stateful
  132. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  133. // 2.2 with runInNewContext: true
  134. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  135. context = __VUE_SSR_CONTEXT__
  136. }
  137. // inject component styles
  138. if (injectStyles) {
  139. injectStyles.call(this, context)
  140. }
  141. // register component module identifier for async chunk inferrence
  142. if (context && context._registeredComponents) {
  143. context._registeredComponents.add(moduleIdentifier)
  144. }
  145. }
  146. // used by ssr in case component is cached and beforeCreate
  147. // never gets called
  148. options._ssrRegister = hook
  149. } else if (injectStyles) {
  150. hook = shadowMode
  151. ? function () {
  152. injectStyles.call(
  153. this,
  154. (options.functional ? this.parent : this).$root.$options.shadowRoot
  155. )
  156. }
  157. : injectStyles
  158. }
  159. if (hook) {
  160. if (options.functional) {
  161. // for template-only hot-reload because in that case the render fn doesn't
  162. // go through the normalizer
  163. options._injectStyles = hook
  164. // register for functional component in vue file
  165. var originalRender = options.render
  166. options.render = function renderWithStyleInjection (h, context) {
  167. hook.call(context)
  168. return originalRender(h, context)
  169. }
  170. } else {
  171. // inject component registration as beforeCreate hook
  172. var existing = options.beforeCreate
  173. options.beforeCreate = existing
  174. ? [].concat(existing, hook)
  175. : [hook]
  176. }
  177. }
  178. return {
  179. exports: scriptExports,
  180. options: options
  181. }
  182. }
  183. /***/ }),
  184. /***/ 10:
  185. /***/ (function(module, exports) {
  186. module.exports = require("element-ui/lib/input");
  187. /***/ }),
  188. /***/ 104:
  189. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  190. "use strict";
  191. // ESM COMPAT FLAG
  192. __webpack_require__.r(__webpack_exports__);
  193. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/input-number/src/input-number.vue?vue&type=template&id=42f8cf66&
  194. var render = function() {
  195. var _vm = this
  196. var _h = _vm.$createElement
  197. var _c = _vm._self._c || _h
  198. return _c(
  199. "div",
  200. {
  201. class: [
  202. "el-input-number",
  203. _vm.inputNumberSize ? "el-input-number--" + _vm.inputNumberSize : "",
  204. { "is-disabled": _vm.inputNumberDisabled },
  205. { "is-without-controls": !_vm.controls },
  206. { "is-controls-right": _vm.controlsAtRight }
  207. ],
  208. on: {
  209. dragstart: function($event) {
  210. $event.preventDefault()
  211. }
  212. }
  213. },
  214. [
  215. _vm.controls
  216. ? _c(
  217. "span",
  218. {
  219. directives: [
  220. {
  221. name: "repeat-click",
  222. rawName: "v-repeat-click",
  223. value: _vm.decrease,
  224. expression: "decrease"
  225. }
  226. ],
  227. staticClass: "el-input-number__decrease",
  228. class: { "is-disabled": _vm.minDisabled },
  229. attrs: { role: "button" },
  230. on: {
  231. keydown: function($event) {
  232. if (
  233. !("button" in $event) &&
  234. _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
  235. ) {
  236. return null
  237. }
  238. return _vm.decrease($event)
  239. }
  240. }
  241. },
  242. [
  243. _c("i", {
  244. class:
  245. "el-icon-" + (_vm.controlsAtRight ? "arrow-down" : "minus")
  246. })
  247. ]
  248. )
  249. : _vm._e(),
  250. _vm.controls
  251. ? _c(
  252. "span",
  253. {
  254. directives: [
  255. {
  256. name: "repeat-click",
  257. rawName: "v-repeat-click",
  258. value: _vm.increase,
  259. expression: "increase"
  260. }
  261. ],
  262. staticClass: "el-input-number__increase",
  263. class: { "is-disabled": _vm.maxDisabled },
  264. attrs: { role: "button" },
  265. on: {
  266. keydown: function($event) {
  267. if (
  268. !("button" in $event) &&
  269. _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
  270. ) {
  271. return null
  272. }
  273. return _vm.increase($event)
  274. }
  275. }
  276. },
  277. [
  278. _c("i", {
  279. class: "el-icon-" + (_vm.controlsAtRight ? "arrow-up" : "plus")
  280. })
  281. ]
  282. )
  283. : _vm._e(),
  284. _c("el-input", {
  285. ref: "input",
  286. attrs: {
  287. value: _vm.displayValue,
  288. placeholder: _vm.placeholder,
  289. disabled: _vm.inputNumberDisabled,
  290. size: _vm.inputNumberSize,
  291. max: _vm.max,
  292. min: _vm.min,
  293. name: _vm.name,
  294. label: _vm.label
  295. },
  296. on: {
  297. blur: _vm.handleBlur,
  298. focus: _vm.handleFocus,
  299. input: _vm.handleInput,
  300. change: _vm.handleInputChange
  301. },
  302. nativeOn: {
  303. keydown: [
  304. function($event) {
  305. if (
  306. !("button" in $event) &&
  307. _vm._k($event.keyCode, "up", 38, $event.key, ["Up", "ArrowUp"])
  308. ) {
  309. return null
  310. }
  311. $event.preventDefault()
  312. return _vm.increase($event)
  313. },
  314. function($event) {
  315. if (
  316. !("button" in $event) &&
  317. _vm._k($event.keyCode, "down", 40, $event.key, [
  318. "Down",
  319. "ArrowDown"
  320. ])
  321. ) {
  322. return null
  323. }
  324. $event.preventDefault()
  325. return _vm.decrease($event)
  326. }
  327. ]
  328. }
  329. })
  330. ],
  331. 1
  332. )
  333. }
  334. var staticRenderFns = []
  335. render._withStripped = true
  336. // CONCATENATED MODULE: ./packages/input-number/src/input-number.vue?vue&type=template&id=42f8cf66&
  337. // EXTERNAL MODULE: external "element-ui/lib/input"
  338. var input_ = __webpack_require__(10);
  339. var input_default = /*#__PURE__*/__webpack_require__.n(input_);
  340. // EXTERNAL MODULE: external "element-ui/lib/mixins/focus"
  341. var focus_ = __webpack_require__(22);
  342. var focus_default = /*#__PURE__*/__webpack_require__.n(focus_);
  343. // EXTERNAL MODULE: ./src/directives/repeat-click.js
  344. var repeat_click = __webpack_require__(30);
  345. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/input-number/src/input-number.vue?vue&type=script&lang=js&
  346. //
  347. //
  348. //
  349. //
  350. //
  351. //
  352. //
  353. //
  354. //
  355. //
  356. //
  357. //
  358. //
  359. //
  360. //
  361. //
  362. //
  363. //
  364. //
  365. //
  366. //
  367. //
  368. //
  369. //
  370. //
  371. //
  372. //
  373. //
  374. //
  375. //
  376. //
  377. //
  378. //
  379. //
  380. //
  381. //
  382. //
  383. //
  384. //
  385. //
  386. //
  387. //
  388. //
  389. //
  390. //
  391. //
  392. //
  393. /* harmony default export */ var input_numbervue_type_script_lang_js_ = ({
  394. name: 'ElInputNumber',
  395. mixins: [focus_default()('input')],
  396. inject: {
  397. elForm: {
  398. default: ''
  399. },
  400. elFormItem: {
  401. default: ''
  402. }
  403. },
  404. directives: {
  405. repeatClick: repeat_click["a" /* default */]
  406. },
  407. components: {
  408. ElInput: input_default.a
  409. },
  410. props: {
  411. step: {
  412. type: Number,
  413. default: 1
  414. },
  415. stepStrictly: {
  416. type: Boolean,
  417. default: false
  418. },
  419. max: {
  420. type: Number,
  421. default: Infinity
  422. },
  423. min: {
  424. type: Number,
  425. default: -Infinity
  426. },
  427. value: {},
  428. disabled: Boolean,
  429. size: String,
  430. controls: {
  431. type: Boolean,
  432. default: true
  433. },
  434. controlsPosition: {
  435. type: String,
  436. default: ''
  437. },
  438. name: String,
  439. label: String,
  440. placeholder: String,
  441. precision: {
  442. type: Number,
  443. validator: function validator(val) {
  444. return val >= 0 && val === parseInt(val, 10);
  445. }
  446. }
  447. },
  448. data: function data() {
  449. return {
  450. currentValue: 0,
  451. userInput: null
  452. };
  453. },
  454. watch: {
  455. value: {
  456. immediate: true,
  457. handler: function handler(value) {
  458. var newVal = value === undefined ? value : Number(value);
  459. if (newVal !== undefined) {
  460. if (isNaN(newVal)) {
  461. return;
  462. }
  463. if (this.stepStrictly) {
  464. var stepPrecision = this.getPrecision(this.step);
  465. var precisionFactor = Math.pow(10, stepPrecision);
  466. newVal = Math.round(newVal / this.step) * precisionFactor * this.step / precisionFactor;
  467. }
  468. if (this.precision !== undefined) {
  469. newVal = this.toPrecision(newVal, this.precision);
  470. }
  471. }
  472. if (newVal >= this.max) newVal = this.max;
  473. if (newVal <= this.min) newVal = this.min;
  474. this.currentValue = newVal;
  475. this.userInput = null;
  476. this.$emit('input', newVal);
  477. }
  478. }
  479. },
  480. computed: {
  481. minDisabled: function minDisabled() {
  482. return this._decrease(this.value, this.step) < this.min;
  483. },
  484. maxDisabled: function maxDisabled() {
  485. return this._increase(this.value, this.step) > this.max;
  486. },
  487. numPrecision: function numPrecision() {
  488. var value = this.value,
  489. step = this.step,
  490. getPrecision = this.getPrecision,
  491. precision = this.precision;
  492. var stepPrecision = getPrecision(step);
  493. if (precision !== undefined) {
  494. if (stepPrecision > precision) {
  495. console.warn('[Element Warn][InputNumber]precision should not be less than the decimal places of step');
  496. }
  497. return precision;
  498. } else {
  499. return Math.max(getPrecision(value), stepPrecision);
  500. }
  501. },
  502. controlsAtRight: function controlsAtRight() {
  503. return this.controls && this.controlsPosition === 'right';
  504. },
  505. _elFormItemSize: function _elFormItemSize() {
  506. return (this.elFormItem || {}).elFormItemSize;
  507. },
  508. inputNumberSize: function inputNumberSize() {
  509. return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
  510. },
  511. inputNumberDisabled: function inputNumberDisabled() {
  512. return this.disabled || !!(this.elForm || {}).disabled;
  513. },
  514. displayValue: function displayValue() {
  515. if (this.userInput !== null) {
  516. return this.userInput;
  517. }
  518. var currentValue = this.currentValue;
  519. if (typeof currentValue === 'number') {
  520. if (this.stepStrictly) {
  521. var stepPrecision = this.getPrecision(this.step);
  522. var precisionFactor = Math.pow(10, stepPrecision);
  523. currentValue = Math.round(currentValue / this.step) * precisionFactor * this.step / precisionFactor;
  524. }
  525. if (this.precision !== undefined) {
  526. currentValue = currentValue.toFixed(this.precision);
  527. }
  528. }
  529. return currentValue;
  530. }
  531. },
  532. methods: {
  533. toPrecision: function toPrecision(num, precision) {
  534. if (precision === undefined) precision = this.numPrecision;
  535. return parseFloat(Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision));
  536. },
  537. getPrecision: function getPrecision(value) {
  538. if (value === undefined) return 0;
  539. var valueString = value.toString();
  540. var dotPosition = valueString.indexOf('.');
  541. var precision = 0;
  542. if (dotPosition !== -1) {
  543. precision = valueString.length - dotPosition - 1;
  544. }
  545. return precision;
  546. },
  547. _increase: function _increase(val, step) {
  548. if (typeof val !== 'number' && val !== undefined) return this.currentValue;
  549. var precisionFactor = Math.pow(10, this.numPrecision);
  550. // Solve the accuracy problem of JS decimal calculation by converting the value to integer.
  551. return this.toPrecision((precisionFactor * val + precisionFactor * step) / precisionFactor);
  552. },
  553. _decrease: function _decrease(val, step) {
  554. if (typeof val !== 'number' && val !== undefined) return this.currentValue;
  555. var precisionFactor = Math.pow(10, this.numPrecision);
  556. return this.toPrecision((precisionFactor * val - precisionFactor * step) / precisionFactor);
  557. },
  558. increase: function increase() {
  559. if (this.inputNumberDisabled || this.maxDisabled) return;
  560. var value = this.value || 0;
  561. var newVal = this._increase(value, this.step);
  562. this.setCurrentValue(newVal);
  563. },
  564. decrease: function decrease() {
  565. if (this.inputNumberDisabled || this.minDisabled) return;
  566. var value = this.value || 0;
  567. var newVal = this._decrease(value, this.step);
  568. this.setCurrentValue(newVal);
  569. },
  570. handleBlur: function handleBlur(event) {
  571. this.$emit('blur', event);
  572. },
  573. handleFocus: function handleFocus(event) {
  574. this.$emit('focus', event);
  575. },
  576. setCurrentValue: function setCurrentValue(newVal) {
  577. var oldVal = this.currentValue;
  578. if (typeof newVal === 'number' && this.precision !== undefined) {
  579. newVal = this.toPrecision(newVal, this.precision);
  580. }
  581. if (newVal >= this.max) newVal = this.max;
  582. if (newVal <= this.min) newVal = this.min;
  583. if (oldVal === newVal) return;
  584. this.userInput = null;
  585. this.$emit('input', newVal);
  586. this.$emit('change', newVal, oldVal);
  587. this.currentValue = newVal;
  588. },
  589. handleInput: function handleInput(value) {
  590. this.userInput = value;
  591. },
  592. handleInputChange: function handleInputChange(value) {
  593. var newVal = value === '' ? undefined : Number(value);
  594. if (!isNaN(newVal) || value === '') {
  595. this.setCurrentValue(newVal);
  596. }
  597. this.userInput = null;
  598. },
  599. select: function select() {
  600. this.$refs.input.select();
  601. }
  602. },
  603. mounted: function mounted() {
  604. var innerInput = this.$refs.input.$refs.input;
  605. innerInput.setAttribute('role', 'spinbutton');
  606. innerInput.setAttribute('aria-valuemax', this.max);
  607. innerInput.setAttribute('aria-valuemin', this.min);
  608. innerInput.setAttribute('aria-valuenow', this.currentValue);
  609. innerInput.setAttribute('aria-disabled', this.inputNumberDisabled);
  610. },
  611. updated: function updated() {
  612. if (!this.$refs || !this.$refs.input) return;
  613. var innerInput = this.$refs.input.$refs.input;
  614. innerInput.setAttribute('aria-valuenow', this.currentValue);
  615. }
  616. });
  617. // CONCATENATED MODULE: ./packages/input-number/src/input-number.vue?vue&type=script&lang=js&
  618. /* harmony default export */ var src_input_numbervue_type_script_lang_js_ = (input_numbervue_type_script_lang_js_);
  619. // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
  620. var componentNormalizer = __webpack_require__(0);
  621. // CONCATENATED MODULE: ./packages/input-number/src/input-number.vue
  622. /* normalize component */
  623. var component = Object(componentNormalizer["a" /* default */])(
  624. src_input_numbervue_type_script_lang_js_,
  625. render,
  626. staticRenderFns,
  627. false,
  628. null,
  629. null,
  630. null
  631. )
  632. /* hot reload */
  633. if (false) { var api; }
  634. component.options.__file = "packages/input-number/src/input-number.vue"
  635. /* harmony default export */ var input_number = (component.exports);
  636. // CONCATENATED MODULE: ./packages/input-number/index.js
  637. /* istanbul ignore next */
  638. input_number.install = function (Vue) {
  639. Vue.component(input_number.name, input_number);
  640. };
  641. /* harmony default export */ var packages_input_number = __webpack_exports__["default"] = (input_number);
  642. /***/ }),
  643. /***/ 2:
  644. /***/ (function(module, exports) {
  645. module.exports = require("element-ui/lib/utils/dom");
  646. /***/ }),
  647. /***/ 22:
  648. /***/ (function(module, exports) {
  649. module.exports = require("element-ui/lib/mixins/focus");
  650. /***/ }),
  651. /***/ 30:
  652. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  653. "use strict";
  654. /* harmony import */ var element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
  655. /* harmony import */ var element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__);
  656. /* harmony default export */ __webpack_exports__["a"] = ({
  657. bind: function bind(el, binding, vnode) {
  658. var interval = null;
  659. var startTime = void 0;
  660. var handler = function handler() {
  661. return vnode.context[binding.expression].apply();
  662. };
  663. var clear = function clear() {
  664. if (Date.now() - startTime < 100) {
  665. handler();
  666. }
  667. clearInterval(interval);
  668. interval = null;
  669. };
  670. Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["on"])(el, 'mousedown', function (e) {
  671. if (e.button !== 0) return;
  672. startTime = Date.now();
  673. Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["once"])(document, 'mouseup', clear);
  674. clearInterval(interval);
  675. interval = setInterval(handler, 100);
  676. });
  677. }
  678. });
  679. /***/ })
  680. /******/ });