UNPKG

18.1 kBJavaScriptView Raw
1module.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, {
41/******/ configurable: false,
42/******/ enumerable: true,
43/******/ get: getter
44/******/ });
45/******/ }
46/******/ };
47/******/
48/******/ // getDefaultExport function for compatibility with non-harmony modules
49/******/ __webpack_require__.n = function(module) {
50/******/ var getter = module && module.__esModule ?
51/******/ function getDefault() { return module['default']; } :
52/******/ function getModuleExports() { return module; };
53/******/ __webpack_require__.d(getter, 'a', getter);
54/******/ return getter;
55/******/ };
56/******/
57/******/ // Object.prototype.hasOwnProperty.call
58/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
59/******/
60/******/ // __webpack_public_path__
61/******/ __webpack_require__.p = "/dist/";
62/******/
63/******/ // Load entry module and return exports
64/******/ return __webpack_require__(__webpack_require__.s = 106);
65/******/ })
66/************************************************************************/
67/******/ ({
68
69/***/ 0:
70/***/ (function(module, exports) {
71
72/* globals __VUE_SSR_CONTEXT__ */
73
74// IMPORTANT: Do NOT use ES2015 features in this file.
75// This module is a runtime utility for cleaner component module output and will
76// be included in the final webpack user bundle.
77
78module.exports = function normalizeComponent (
79 rawScriptExports,
80 compiledTemplate,
81 functionalTemplate,
82 injectStyles,
83 scopeId,
84 moduleIdentifier /* server only */
85) {
86 var esModule
87 var scriptExports = rawScriptExports = rawScriptExports || {}
88
89 // ES6 modules interop
90 var type = typeof rawScriptExports.default
91 if (type === 'object' || type === 'function') {
92 esModule = rawScriptExports
93 scriptExports = rawScriptExports.default
94 }
95
96 // Vue.extend constructor export interop
97 var options = typeof scriptExports === 'function'
98 ? scriptExports.options
99 : scriptExports
100
101 // render functions
102 if (compiledTemplate) {
103 options.render = compiledTemplate.render
104 options.staticRenderFns = compiledTemplate.staticRenderFns
105 options._compiled = true
106 }
107
108 // functional template
109 if (functionalTemplate) {
110 options.functional = true
111 }
112
113 // scopedId
114 if (scopeId) {
115 options._scopeId = scopeId
116 }
117
118 var hook
119 if (moduleIdentifier) { // server build
120 hook = function (context) {
121 // 2.3 injection
122 context =
123 context || // cached call
124 (this.$vnode && this.$vnode.ssrContext) || // stateful
125 (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
126 // 2.2 with runInNewContext: true
127 if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
128 context = __VUE_SSR_CONTEXT__
129 }
130 // inject component styles
131 if (injectStyles) {
132 injectStyles.call(this, context)
133 }
134 // register component module identifier for async chunk inferrence
135 if (context && context._registeredComponents) {
136 context._registeredComponents.add(moduleIdentifier)
137 }
138 }
139 // used by ssr in case component is cached and beforeCreate
140 // never gets called
141 options._ssrRegister = hook
142 } else if (injectStyles) {
143 hook = injectStyles
144 }
145
146 if (hook) {
147 var functional = options.functional
148 var existing = functional
149 ? options.render
150 : options.beforeCreate
151
152 if (!functional) {
153 // inject component registration as beforeCreate hook
154 options.beforeCreate = existing
155 ? [].concat(existing, hook)
156 : [hook]
157 } else {
158 // for template-only hot-reload because in that case the render fn doesn't
159 // go through the normalizer
160 options._injectStyles = hook
161 // register for functioal component in vue file
162 options.render = function renderWithStyleInjection (h, context) {
163 hook.call(context)
164 return existing(h, context)
165 }
166 }
167 }
168
169 return {
170 esModule: esModule,
171 exports: scriptExports,
172 options: options
173 }
174}
175
176
177/***/ }),
178
179/***/ 106:
180/***/ (function(module, exports, __webpack_require__) {
181
182"use strict";
183
184
185exports.__esModule = true;
186
187var _inputNumber = __webpack_require__(107);
188
189var _inputNumber2 = _interopRequireDefault(_inputNumber);
190
191function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
192
193/* istanbul ignore next */
194_inputNumber2.default.install = function (Vue) {
195 Vue.component(_inputNumber2.default.name, _inputNumber2.default);
196};
197
198exports.default = _inputNumber2.default;
199
200/***/ }),
201
202/***/ 107:
203/***/ (function(module, __webpack_exports__, __webpack_require__) {
204
205"use strict";
206Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
207/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_input_number_vue__ = __webpack_require__(108);
208/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_input_number_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_input_number_vue__);
209/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_223987a9_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_input_number_vue__ = __webpack_require__(109);
210var normalizeComponent = __webpack_require__(0)
211/* script */
212
213/* template */
214
215/* template functional */
216 var __vue_template_functional__ = false
217/* styles */
218var __vue_styles__ = null
219/* scopeId */
220var __vue_scopeId__ = null
221/* moduleIdentifier (server only) */
222var __vue_module_identifier__ = null
223var Component = normalizeComponent(
224 __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_input_number_vue___default.a,
225 __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_223987a9_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_input_number_vue__["a" /* default */],
226 __vue_template_functional__,
227 __vue_styles__,
228 __vue_scopeId__,
229 __vue_module_identifier__
230)
231
232/* harmony default export */ __webpack_exports__["default"] = (Component.exports);
233
234
235/***/ }),
236
237/***/ 108:
238/***/ (function(module, exports, __webpack_require__) {
239
240"use strict";
241
242
243exports.__esModule = true;
244
245var _input = __webpack_require__(6);
246
247var _input2 = _interopRequireDefault(_input);
248
249var _focus = __webpack_require__(19);
250
251var _focus2 = _interopRequireDefault(_focus);
252
253var _repeatClick = __webpack_require__(24);
254
255var _repeatClick2 = _interopRequireDefault(_repeatClick);
256
257function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
258
259exports.default = {
260 name: 'ElInputNumber',
261 mixins: [(0, _focus2.default)('input')],
262 inject: {
263 elForm: {
264 default: ''
265 },
266 elFormItem: {
267 default: ''
268 }
269 },
270 directives: {
271 repeatClick: _repeatClick2.default
272 },
273 components: {
274 ElInput: _input2.default
275 },
276 props: {
277 step: {
278 type: Number,
279 default: 1
280 },
281 max: {
282 type: Number,
283 default: Infinity
284 },
285 min: {
286 type: Number,
287 default: -Infinity
288 },
289 value: {},
290 disabled: Boolean,
291 size: String,
292 controls: {
293 type: Boolean,
294 default: true
295 },
296 controlsPosition: {
297 type: String,
298 default: ''
299 },
300 name: String,
301 label: String,
302 precision: {
303 type: Number,
304 validator: function validator(val) {
305 return val >= 0 && val === parseInt(val, 10);
306 }
307 }
308 },
309 data: function data() {
310 return {
311 currentValue: 0
312 };
313 },
314
315 watch: {
316 value: {
317 immediate: true,
318 handler: function handler(value) {
319 var newVal = value === undefined ? value : Number(value);
320 if (newVal !== undefined) {
321 if (isNaN(newVal)) {
322 return;
323 }
324 if (this.precision !== undefined) {
325 newVal = this.toPrecision(newVal, this.precision);
326 }
327 }
328 if (newVal >= this.max) newVal = this.max;
329 if (newVal <= this.min) newVal = this.min;
330 this.currentValue = newVal;
331 this.$emit('input', newVal);
332 }
333 }
334 },
335 computed: {
336 minDisabled: function minDisabled() {
337 return this._decrease(this.value, this.step) < this.min;
338 },
339 maxDisabled: function maxDisabled() {
340 return this._increase(this.value, this.step) > this.max;
341 },
342 numPrecision: function numPrecision() {
343 var value = this.value,
344 step = this.step,
345 getPrecision = this.getPrecision,
346 precision = this.precision;
347
348 var stepPrecision = getPrecision(step);
349 if (precision !== undefined) {
350 if (stepPrecision > precision) {
351 console.warn('[Element Warn][InputNumber]precision should not be less than the decimal places of step');
352 }
353 return precision;
354 } else {
355 return Math.max(getPrecision(value), stepPrecision);
356 }
357 },
358 controlsAtRight: function controlsAtRight() {
359 return this.controlsPosition === 'right';
360 },
361 _elFormItemSize: function _elFormItemSize() {
362 return (this.elFormItem || {}).elFormItemSize;
363 },
364 inputNumberSize: function inputNumberSize() {
365 return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
366 },
367 inputNumberDisabled: function inputNumberDisabled() {
368 return this.disabled || (this.elForm || {}).disabled;
369 },
370 currentInputValue: function currentInputValue() {
371 var currentValue = this.currentValue;
372 if (typeof currentValue === 'number' && this.precision !== undefined) {
373 return currentValue.toFixed(this.precision);
374 } else {
375 return currentValue;
376 }
377 }
378 },
379 methods: {
380 toPrecision: function toPrecision(num, precision) {
381 if (precision === undefined) precision = this.numPrecision;
382 return parseFloat(parseFloat(Number(num).toFixed(precision)));
383 },
384 getPrecision: function getPrecision(value) {
385 if (value === undefined) return 0;
386 var valueString = value.toString();
387 var dotPosition = valueString.indexOf('.');
388 var precision = 0;
389 if (dotPosition !== -1) {
390 precision = valueString.length - dotPosition - 1;
391 }
392 return precision;
393 },
394 _increase: function _increase(val, step) {
395 if (typeof val !== 'number' && val !== undefined) return this.currentValue;
396
397 var precisionFactor = Math.pow(10, this.numPrecision);
398 // Solve the accuracy problem of JS decimal calculation by converting the value to integer.
399 return this.toPrecision((precisionFactor * val + precisionFactor * step) / precisionFactor);
400 },
401 _decrease: function _decrease(val, step) {
402 if (typeof val !== 'number' && val !== undefined) return this.currentValue;
403
404 var precisionFactor = Math.pow(10, this.numPrecision);
405
406 return this.toPrecision((precisionFactor * val - precisionFactor * step) / precisionFactor);
407 },
408 increase: function increase() {
409 if (this.inputNumberDisabled || this.maxDisabled) return;
410 var value = this.value || 0;
411 var newVal = this._increase(value, this.step);
412 this.setCurrentValue(newVal);
413 },
414 decrease: function decrease() {
415 if (this.inputNumberDisabled || this.minDisabled) return;
416 var value = this.value || 0;
417 var newVal = this._decrease(value, this.step);
418 this.setCurrentValue(newVal);
419 },
420 handleBlur: function handleBlur(event) {
421 this.$emit('blur', event);
422 this.$refs.input.setCurrentValue(this.currentInputValue);
423 },
424 handleFocus: function handleFocus(event) {
425 this.$emit('focus', event);
426 },
427 setCurrentValue: function setCurrentValue(newVal) {
428 var oldVal = this.currentValue;
429 if (typeof newVal === 'number' && this.precision !== undefined) {
430 newVal = this.toPrecision(newVal, this.precision);
431 }
432 if (newVal >= this.max) newVal = this.max;
433 if (newVal <= this.min) newVal = this.min;
434 if (oldVal === newVal) {
435 this.$refs.input.setCurrentValue(this.currentInputValue);
436 return;
437 }
438 this.$emit('input', newVal);
439 this.$emit('change', newVal, oldVal);
440 this.currentValue = newVal;
441 },
442 handleInputChange: function handleInputChange(value) {
443 var newVal = value === '' ? undefined : Number(value);
444 if (!isNaN(newVal) || value === '') {
445 this.setCurrentValue(newVal);
446 }
447 }
448 },
449 mounted: function mounted() {
450 var innerInput = this.$refs.input.$refs.input;
451 innerInput.setAttribute('role', 'spinbutton');
452 innerInput.setAttribute('aria-valuemax', this.max);
453 innerInput.setAttribute('aria-valuemin', this.min);
454 innerInput.setAttribute('aria-valuenow', this.currentValue);
455 innerInput.setAttribute('aria-disabled', this.inputNumberDisabled);
456 },
457 updated: function updated() {
458 if (!this.$refs || !this.$refs.input) return;
459 var innerInput = this.$refs.input.$refs.input;
460 innerInput.setAttribute('aria-valuenow', this.currentValue);
461 }
462}; //
463//
464//
465//
466//
467//
468//
469//
470//
471//
472//
473//
474//
475//
476//
477//
478//
479//
480//
481//
482//
483//
484//
485//
486//
487//
488//
489//
490//
491//
492//
493//
494//
495//
496//
497//
498//
499//
500//
501//
502//
503//
504//
505//
506//
507
508/***/ }),
509
510/***/ 109:
511/***/ (function(module, __webpack_exports__, __webpack_require__) {
512
513"use strict";
514var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{class:[
515 'el-input-number',
516 _vm.inputNumberSize ? 'el-input-number--' + _vm.inputNumberSize : '',
517 { 'is-disabled': _vm.inputNumberDisabled },
518 { 'is-without-controls': !_vm.controls },
519 { 'is-controls-right': _vm.controlsAtRight }
520 ],on:{"dragstart":function($event){$event.preventDefault();}}},[(_vm.controls)?_c('span',{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:(_vm.decrease),expression:"decrease"}],staticClass:"el-input-number__decrease",class:{'is-disabled': _vm.minDisabled},attrs:{"role":"button"},on:{"keydown":function($event){if(!('button' in $event)&&_vm._k($event.keyCode,"enter",13,$event.key)){ return null; }_vm.decrease($event)}}},[_c('i',{class:("el-icon-" + (_vm.controlsAtRight ? 'arrow-down' : 'minus'))})]):_vm._e(),(_vm.controls)?_c('span',{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:(_vm.increase),expression:"increase"}],staticClass:"el-input-number__increase",class:{'is-disabled': _vm.maxDisabled},attrs:{"role":"button"},on:{"keydown":function($event){if(!('button' in $event)&&_vm._k($event.keyCode,"enter",13,$event.key)){ return null; }_vm.increase($event)}}},[_c('i',{class:("el-icon-" + (_vm.controlsAtRight ? 'arrow-up' : 'plus'))})]):_vm._e(),_c('el-input',{ref:"input",attrs:{"value":_vm.currentInputValue,"disabled":_vm.inputNumberDisabled,"size":_vm.inputNumberSize,"max":_vm.max,"min":_vm.min,"name":_vm.name,"label":_vm.label},on:{"blur":_vm.handleBlur,"focus":_vm.handleFocus,"change":_vm.handleInputChange},nativeOn:{"keydown":[function($event){if(!('button' in $event)&&_vm._k($event.keyCode,"up",38,$event.key)){ return null; }$event.preventDefault();_vm.increase($event)},function($event){if(!('button' in $event)&&_vm._k($event.keyCode,"down",40,$event.key)){ return null; }$event.preventDefault();_vm.decrease($event)}]}})],1)}
521var staticRenderFns = []
522var esExports = { render: render, staticRenderFns: staticRenderFns }
523/* harmony default export */ __webpack_exports__["a"] = (esExports);
524
525/***/ }),
526
527/***/ 19:
528/***/ (function(module, exports) {
529
530module.exports = require("element-ui/lib/mixins/focus");
531
532/***/ }),
533
534/***/ 24:
535/***/ (function(module, exports, __webpack_require__) {
536
537"use strict";
538
539
540exports.__esModule = true;
541
542var _dom = __webpack_require__(3);
543
544exports.default = {
545 bind: function bind(el, binding, vnode) {
546 var interval = null;
547 var startTime = void 0;
548 var handler = function handler() {
549 return vnode.context[binding.expression].apply();
550 };
551 var clear = function clear() {
552 if (new Date() - startTime < 100) {
553 handler();
554 }
555 clearInterval(interval);
556 interval = null;
557 };
558
559 (0, _dom.on)(el, 'mousedown', function (e) {
560 if (e.button !== 0) return;
561 startTime = new Date();
562 (0, _dom.once)(document, 'mouseup', clear);
563 clearInterval(interval);
564 interval = setInterval(handler, 100);
565 });
566 }
567};
568
569/***/ }),
570
571/***/ 3:
572/***/ (function(module, exports) {
573
574module.exports = require("element-ui/lib/utils/dom");
575
576/***/ }),
577
578/***/ 6:
579/***/ (function(module, exports) {
580
581module.exports = require("element-ui/lib/input");
582
583/***/ })
584
585/******/ });
\No newline at end of file