1 | module.exports =
|
2 | (function(modules) {
|
3 |
|
4 | var installedModules = {};
|
5 |
|
6 |
|
7 | function __webpack_require__(moduleId) {
|
8 |
|
9 |
|
10 | if(installedModules[moduleId]) {
|
11 | return installedModules[moduleId].exports;
|
12 | }
|
13 |
|
14 | var module = installedModules[moduleId] = {
|
15 | i: moduleId,
|
16 | l: false,
|
17 | exports: {}
|
18 | };
|
19 |
|
20 |
|
21 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
22 |
|
23 |
|
24 | module.l = true;
|
25 |
|
26 |
|
27 | return module.exports;
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 | __webpack_require__.m = modules;
|
33 |
|
34 |
|
35 | __webpack_require__.c = installedModules;
|
36 |
|
37 |
|
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 |
|
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 |
|
53 |
|
54 |
|
55 |
|
56 |
|
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 |
|
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 |
|
78 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
79 |
|
80 |
|
81 | __webpack_require__.p = "/dist/";
|
82 |
|
83 |
|
84 |
|
85 | return __webpack_require__(__webpack_require__.s = 86);
|
86 | })
|
87 |
|
88 | ({
|
89 |
|
90 | 0:
|
91 | (function(module, __webpack_exports__, __webpack_require__) {
|
92 |
|
93 | "use strict";
|
94 | __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | function normalizeComponent (
|
102 | scriptExports,
|
103 | render,
|
104 | staticRenderFns,
|
105 | functionalTemplate,
|
106 | injectStyles,
|
107 | scopeId,
|
108 | moduleIdentifier, /* server only */
|
109 | shadowMode /* vue-cli only */
|
110 | ) {
|
111 |
|
112 | var options = typeof scriptExports === 'function'
|
113 | ? scriptExports.options
|
114 | : scriptExports
|
115 |
|
116 |
|
117 | if (render) {
|
118 | options.render = render
|
119 | options.staticRenderFns = staticRenderFns
|
120 | options._compiled = true
|
121 | }
|
122 |
|
123 |
|
124 | if (functionalTemplate) {
|
125 | options.functional = true
|
126 | }
|
127 |
|
128 |
|
129 | if (scopeId) {
|
130 | options._scopeId = 'data-v-' + scopeId
|
131 | }
|
132 |
|
133 | var hook
|
134 | if (moduleIdentifier) {
|
135 | hook = function (context) {
|
136 |
|
137 | context =
|
138 | context ||
|
139 | (this.$vnode && this.$vnode.ssrContext) ||
|
140 | (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext)
|
141 |
|
142 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
143 | context = __VUE_SSR_CONTEXT__
|
144 | }
|
145 |
|
146 | if (injectStyles) {
|
147 | injectStyles.call(this, context)
|
148 | }
|
149 |
|
150 | if (context && context._registeredComponents) {
|
151 | context._registeredComponents.add(moduleIdentifier)
|
152 | }
|
153 | }
|
154 |
|
155 |
|
156 | options._ssrRegister = hook
|
157 | } else if (injectStyles) {
|
158 | hook = shadowMode
|
159 | ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
|
160 | : injectStyles
|
161 | }
|
162 |
|
163 | if (hook) {
|
164 | if (options.functional) {
|
165 |
|
166 |
|
167 | options._injectStyles = hook
|
168 |
|
169 | var originalRender = options.render
|
170 | options.render = function renderWithStyleInjection (h, context) {
|
171 | hook.call(context)
|
172 | return originalRender(h, context)
|
173 | }
|
174 | } else {
|
175 |
|
176 | var existing = options.beforeCreate
|
177 | options.beforeCreate = existing
|
178 | ? [].concat(existing, hook)
|
179 | : [hook]
|
180 | }
|
181 | }
|
182 |
|
183 | return {
|
184 | exports: scriptExports,
|
185 | options: options
|
186 | }
|
187 | }
|
188 |
|
189 |
|
190 | }),
|
191 |
|
192 | 10:
|
193 | (function(module, exports) {
|
194 |
|
195 | module.exports = require("element-ui/lib/input");
|
196 |
|
197 | }),
|
198 |
|
199 | 2:
|
200 | (function(module, exports) {
|
201 |
|
202 | module.exports = require("element-ui/lib/utils/dom");
|
203 |
|
204 | }),
|
205 |
|
206 | 22:
|
207 | (function(module, exports) {
|
208 |
|
209 | module.exports = require("element-ui/lib/mixins/focus");
|
210 |
|
211 | }),
|
212 |
|
213 | 30:
|
214 | (function(module, __webpack_exports__, __webpack_require__) {
|
215 |
|
216 | "use strict";
|
217 | var element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
218 | var element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__);
|
219 |
|
220 |
|
221 | __webpack_exports__["a"] = ({
|
222 | bind: function bind(el, binding, vnode) {
|
223 | var interval = null;
|
224 | var startTime = void 0;
|
225 | var handler = function handler() {
|
226 | return vnode.context[binding.expression].apply();
|
227 | };
|
228 | var clear = function clear() {
|
229 | if (Date.now() - startTime < 100) {
|
230 | handler();
|
231 | }
|
232 | clearInterval(interval);
|
233 | interval = null;
|
234 | };
|
235 |
|
236 | Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["on"])(el, 'mousedown', function (e) {
|
237 | if (e.button !== 0) return;
|
238 | startTime = Date.now();
|
239 | Object(element_ui_src_utils_dom__WEBPACK_IMPORTED_MODULE_0__["once"])(document, 'mouseup', clear);
|
240 | clearInterval(interval);
|
241 | interval = setInterval(handler, 100);
|
242 | });
|
243 | }
|
244 | });
|
245 |
|
246 | }),
|
247 |
|
248 | 86:
|
249 | (function(module, __webpack_exports__, __webpack_require__) {
|
250 |
|
251 | "use strict";
|
252 | __webpack_require__.r(__webpack_exports__);
|
253 |
|
254 |
|
255 | var render = function() {
|
256 | var _vm = this
|
257 | var _h = _vm.$createElement
|
258 | var _c = _vm._self._c || _h
|
259 | return _c(
|
260 | "div",
|
261 | {
|
262 | class: [
|
263 | "el-input-number",
|
264 | _vm.inputNumberSize ? "el-input-number--" + _vm.inputNumberSize : "",
|
265 | { "is-disabled": _vm.inputNumberDisabled },
|
266 | { "is-without-controls": !_vm.controls },
|
267 | { "is-controls-right": _vm.controlsAtRight }
|
268 | ],
|
269 | on: {
|
270 | dragstart: function($event) {
|
271 | $event.preventDefault()
|
272 | }
|
273 | }
|
274 | },
|
275 | [
|
276 | _vm.controls
|
277 | ? _c(
|
278 | "span",
|
279 | {
|
280 | directives: [
|
281 | {
|
282 | name: "repeat-click",
|
283 | rawName: "v-repeat-click",
|
284 | value: _vm.decrease,
|
285 | expression: "decrease"
|
286 | }
|
287 | ],
|
288 | staticClass: "el-input-number__decrease",
|
289 | class: { "is-disabled": _vm.minDisabled },
|
290 | attrs: { role: "button" },
|
291 | on: {
|
292 | keydown: function($event) {
|
293 | if (
|
294 | !("button" in $event) &&
|
295 | _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
|
296 | ) {
|
297 | return null
|
298 | }
|
299 | return _vm.decrease($event)
|
300 | }
|
301 | }
|
302 | },
|
303 | [
|
304 | _c("i", {
|
305 | class:
|
306 | "el-icon-" + (_vm.controlsAtRight ? "arrow-down" : "minus")
|
307 | })
|
308 | ]
|
309 | )
|
310 | : _vm._e(),
|
311 | _vm.controls
|
312 | ? _c(
|
313 | "span",
|
314 | {
|
315 | directives: [
|
316 | {
|
317 | name: "repeat-click",
|
318 | rawName: "v-repeat-click",
|
319 | value: _vm.increase,
|
320 | expression: "increase"
|
321 | }
|
322 | ],
|
323 | staticClass: "el-input-number__increase",
|
324 | class: { "is-disabled": _vm.maxDisabled },
|
325 | attrs: { role: "button" },
|
326 | on: {
|
327 | keydown: function($event) {
|
328 | if (
|
329 | !("button" in $event) &&
|
330 | _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
|
331 | ) {
|
332 | return null
|
333 | }
|
334 | return _vm.increase($event)
|
335 | }
|
336 | }
|
337 | },
|
338 | [
|
339 | _c("i", {
|
340 | class: "el-icon-" + (_vm.controlsAtRight ? "arrow-up" : "plus")
|
341 | })
|
342 | ]
|
343 | )
|
344 | : _vm._e(),
|
345 | _c("el-input", {
|
346 | ref: "input",
|
347 | attrs: {
|
348 | value: _vm.displayValue,
|
349 | placeholder: _vm.placeholder,
|
350 | disabled: _vm.inputNumberDisabled,
|
351 | size: _vm.inputNumberSize,
|
352 | max: _vm.max,
|
353 | min: _vm.min,
|
354 | name: _vm.name,
|
355 | label: _vm.label
|
356 | },
|
357 | on: {
|
358 | blur: _vm.handleBlur,
|
359 | focus: _vm.handleFocus,
|
360 | input: _vm.handleInput,
|
361 | change: _vm.handleInputChange
|
362 | },
|
363 | nativeOn: {
|
364 | keydown: [
|
365 | function($event) {
|
366 | if (
|
367 | !("button" in $event) &&
|
368 | _vm._k($event.keyCode, "up", 38, $event.key, ["Up", "ArrowUp"])
|
369 | ) {
|
370 | return null
|
371 | }
|
372 | $event.preventDefault()
|
373 | return _vm.increase($event)
|
374 | },
|
375 | function($event) {
|
376 | if (
|
377 | !("button" in $event) &&
|
378 | _vm._k($event.keyCode, "down", 40, $event.key, [
|
379 | "Down",
|
380 | "ArrowDown"
|
381 | ])
|
382 | ) {
|
383 | return null
|
384 | }
|
385 | $event.preventDefault()
|
386 | return _vm.decrease($event)
|
387 | }
|
388 | ]
|
389 | }
|
390 | })
|
391 | ],
|
392 | 1
|
393 | )
|
394 | }
|
395 | var staticRenderFns = []
|
396 | render._withStripped = true
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 | var input_ = __webpack_require__(10);
|
403 | var input_default = __webpack_require__.n(input_);
|
404 |
|
405 |
|
406 | var focus_ = __webpack_require__(22);
|
407 | var focus_default = __webpack_require__.n(focus_);
|
408 |
|
409 |
|
410 | var repeat_click = __webpack_require__(30);
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 |
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 | var input_numbervue_type_script_lang_js_ = ({
|
466 | name: 'ElInputNumber',
|
467 | mixins: [focus_default()('input')],
|
468 | inject: {
|
469 | elForm: {
|
470 | default: ''
|
471 | },
|
472 | elFormItem: {
|
473 | default: ''
|
474 | }
|
475 | },
|
476 | directives: {
|
477 | repeatClick: repeat_click["a" ]
|
478 | },
|
479 | components: {
|
480 | ElInput: input_default.a
|
481 | },
|
482 | props: {
|
483 | step: {
|
484 | type: Number,
|
485 | default: 1
|
486 | },
|
487 | stepStrictly: {
|
488 | type: Boolean,
|
489 | default: false
|
490 | },
|
491 | max: {
|
492 | type: Number,
|
493 | default: Infinity
|
494 | },
|
495 | min: {
|
496 | type: Number,
|
497 | default: -Infinity
|
498 | },
|
499 | value: {},
|
500 | disabled: Boolean,
|
501 | size: String,
|
502 | controls: {
|
503 | type: Boolean,
|
504 | default: true
|
505 | },
|
506 | controlsPosition: {
|
507 | type: String,
|
508 | default: ''
|
509 | },
|
510 | name: String,
|
511 | label: String,
|
512 | placeholder: String,
|
513 | precision: {
|
514 | type: Number,
|
515 | validator: function validator(val) {
|
516 | return val >= 0 && val === parseInt(val, 10);
|
517 | }
|
518 | }
|
519 | },
|
520 | data: function data() {
|
521 | return {
|
522 | currentValue: 0,
|
523 | userInput: null
|
524 | };
|
525 | },
|
526 |
|
527 | watch: {
|
528 | value: {
|
529 | immediate: true,
|
530 | handler: function handler(value) {
|
531 | var newVal = value === undefined ? value : Number(value);
|
532 | if (newVal !== undefined) {
|
533 | if (isNaN(newVal)) {
|
534 | return;
|
535 | }
|
536 |
|
537 | if (this.stepStrictly) {
|
538 | var stepPrecision = this.getPrecision(this.step);
|
539 | var precisionFactor = Math.pow(10, stepPrecision);
|
540 | newVal = Math.round(newVal / this.step) * precisionFactor * this.step / precisionFactor;
|
541 | }
|
542 |
|
543 | if (this.precision !== undefined) {
|
544 | newVal = this.toPrecision(newVal, this.precision);
|
545 | }
|
546 | }
|
547 | if (newVal >= this.max) newVal = this.max;
|
548 | if (newVal <= this.min) newVal = this.min;
|
549 | this.currentValue = newVal;
|
550 | this.userInput = null;
|
551 | this.$emit('input', newVal);
|
552 | }
|
553 | }
|
554 | },
|
555 | computed: {
|
556 | minDisabled: function minDisabled() {
|
557 | return this._decrease(this.value, this.step) < this.min;
|
558 | },
|
559 | maxDisabled: function maxDisabled() {
|
560 | return this._increase(this.value, this.step) > this.max;
|
561 | },
|
562 | numPrecision: function numPrecision() {
|
563 | var value = this.value,
|
564 | step = this.step,
|
565 | getPrecision = this.getPrecision,
|
566 | precision = this.precision;
|
567 |
|
568 | var stepPrecision = getPrecision(step);
|
569 | if (precision !== undefined) {
|
570 | if (stepPrecision > precision) {
|
571 | console.warn('[Element Warn][InputNumber]precision should not be less than the decimal places of step');
|
572 | }
|
573 | return precision;
|
574 | } else {
|
575 | return Math.max(getPrecision(value), stepPrecision);
|
576 | }
|
577 | },
|
578 | controlsAtRight: function controlsAtRight() {
|
579 | return this.controls && this.controlsPosition === 'right';
|
580 | },
|
581 | _elFormItemSize: function _elFormItemSize() {
|
582 | return (this.elFormItem || {}).elFormItemSize;
|
583 | },
|
584 | inputNumberSize: function inputNumberSize() {
|
585 | return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
586 | },
|
587 | inputNumberDisabled: function inputNumberDisabled() {
|
588 | return this.disabled || !!(this.elForm || {}).disabled;
|
589 | },
|
590 | displayValue: function displayValue() {
|
591 | if (this.userInput !== null) {
|
592 | return this.userInput;
|
593 | }
|
594 |
|
595 | var currentValue = this.currentValue;
|
596 |
|
597 | if (typeof currentValue === 'number') {
|
598 | if (this.stepStrictly) {
|
599 | var stepPrecision = this.getPrecision(this.step);
|
600 | var precisionFactor = Math.pow(10, stepPrecision);
|
601 | currentValue = Math.round(currentValue / this.step) * precisionFactor * this.step / precisionFactor;
|
602 | }
|
603 |
|
604 | if (this.precision !== undefined) {
|
605 | currentValue = currentValue.toFixed(this.precision);
|
606 | }
|
607 | }
|
608 |
|
609 | return currentValue;
|
610 | }
|
611 | },
|
612 | methods: {
|
613 | toPrecision: function toPrecision(num, precision) {
|
614 | if (precision === undefined) precision = this.numPrecision;
|
615 | return parseFloat(Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision));
|
616 | },
|
617 | getPrecision: function getPrecision(value) {
|
618 | if (value === undefined) return 0;
|
619 | var valueString = value.toString();
|
620 | var dotPosition = valueString.indexOf('.');
|
621 | var precision = 0;
|
622 | if (dotPosition !== -1) {
|
623 | precision = valueString.length - dotPosition - 1;
|
624 | }
|
625 | return precision;
|
626 | },
|
627 | _increase: function _increase(val, step) {
|
628 | if (typeof val !== 'number' && val !== undefined) return this.currentValue;
|
629 |
|
630 | var precisionFactor = Math.pow(10, this.numPrecision);
|
631 |
|
632 | return this.toPrecision((precisionFactor * val + precisionFactor * step) / precisionFactor);
|
633 | },
|
634 | _decrease: function _decrease(val, step) {
|
635 | if (typeof val !== 'number' && val !== undefined) return this.currentValue;
|
636 |
|
637 | var precisionFactor = Math.pow(10, this.numPrecision);
|
638 |
|
639 | return this.toPrecision((precisionFactor * val - precisionFactor * step) / precisionFactor);
|
640 | },
|
641 | increase: function increase() {
|
642 | if (this.inputNumberDisabled || this.maxDisabled) return;
|
643 | var value = this.value || 0;
|
644 | var newVal = this._increase(value, this.step);
|
645 | this.setCurrentValue(newVal);
|
646 | },
|
647 | decrease: function decrease() {
|
648 | if (this.inputNumberDisabled || this.minDisabled) return;
|
649 | var value = this.value || 0;
|
650 | var newVal = this._decrease(value, this.step);
|
651 | this.setCurrentValue(newVal);
|
652 | },
|
653 | handleBlur: function handleBlur(event) {
|
654 | this.$emit('blur', event);
|
655 | },
|
656 | handleFocus: function handleFocus(event) {
|
657 | this.$emit('focus', event);
|
658 | },
|
659 | setCurrentValue: function setCurrentValue(newVal) {
|
660 | var oldVal = this.currentValue;
|
661 | if (typeof newVal === 'number' && this.precision !== undefined) {
|
662 | newVal = this.toPrecision(newVal, this.precision);
|
663 | }
|
664 | if (newVal >= this.max) newVal = this.max;
|
665 | if (newVal <= this.min) newVal = this.min;
|
666 | if (oldVal === newVal) return;
|
667 | this.userInput = null;
|
668 | this.$emit('input', newVal);
|
669 | this.$emit('change', newVal, oldVal);
|
670 | this.currentValue = newVal;
|
671 | },
|
672 | handleInput: function handleInput(value) {
|
673 | this.userInput = value;
|
674 | },
|
675 | handleInputChange: function handleInputChange(value) {
|
676 | var newVal = value === '' ? undefined : Number(value);
|
677 | if (!isNaN(newVal) || value === '') {
|
678 | this.setCurrentValue(newVal);
|
679 | }
|
680 | this.userInput = null;
|
681 | },
|
682 | select: function select() {
|
683 | this.$refs.input.select();
|
684 | }
|
685 | },
|
686 | mounted: function mounted() {
|
687 | var innerInput = this.$refs.input.$refs.input;
|
688 | innerInput.setAttribute('role', 'spinbutton');
|
689 | innerInput.setAttribute('aria-valuemax', this.max);
|
690 | innerInput.setAttribute('aria-valuemin', this.min);
|
691 | innerInput.setAttribute('aria-valuenow', this.currentValue);
|
692 | innerInput.setAttribute('aria-disabled', this.inputNumberDisabled);
|
693 | },
|
694 | updated: function updated() {
|
695 | if (!this.$refs || !this.$refs.input) return;
|
696 | var innerInput = this.$refs.input.$refs.input;
|
697 | innerInput.setAttribute('aria-valuenow', this.currentValue);
|
698 | }
|
699 | });
|
700 |
|
701 | var src_input_numbervue_type_script_lang_js_ = (input_numbervue_type_script_lang_js_);
|
702 |
|
703 | var componentNormalizer = __webpack_require__(0);
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 | var component = Object(componentNormalizer["a" ])(
|
714 | src_input_numbervue_type_script_lang_js_,
|
715 | render,
|
716 | staticRenderFns,
|
717 | false,
|
718 | null,
|
719 | null,
|
720 | null
|
721 |
|
722 | )
|
723 |
|
724 |
|
725 | if (false) { var api; }
|
726 | component.options.__file = "packages/input-number/src/input-number.vue"
|
727 | var input_number = (component.exports);
|
728 |
|
729 |
|
730 |
|
731 |
|
732 | input_number.install = function (Vue) {
|
733 | Vue.component(input_number.name, input_number);
|
734 | };
|
735 |
|
736 | var packages_input_number = __webpack_exports__["default"] = (input_number);
|
737 |
|
738 | })
|
739 |
|
740 | }); |
\ | No newline at end of file |