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 = 45);
|
86 | })
|
87 |
|
88 | ([
|
89 |
|
90 | (function(module, exports) {
|
91 |
|
92 | module.exports = require("element-ui/lib/utils/date-util");
|
93 |
|
94 | }),
|
95 |
|
96 | (function(module, exports) {
|
97 |
|
98 | module.exports = require("element-ui/lib/utils/dom");
|
99 |
|
100 | }),
|
101 |
|
102 | (function(module, exports) {
|
103 |
|
104 | module.exports = require("element-ui/lib/utils/util");
|
105 |
|
106 | }),
|
107 |
|
108 | (function(module, exports) {
|
109 |
|
110 | module.exports = require("element-ui/lib/mixins/emitter");
|
111 |
|
112 | }),
|
113 |
|
114 | (function(module, exports) {
|
115 |
|
116 | module.exports = require("element-ui/lib/mixins/locale");
|
117 |
|
118 | }),
|
119 |
|
120 | (function(module, exports) {
|
121 |
|
122 | module.exports = require("element-ui/lib/utils/vue-popper");
|
123 |
|
124 | }),
|
125 |
|
126 | (function(module, exports) {
|
127 |
|
128 | module.exports = require("vue");
|
129 |
|
130 | }),
|
131 |
|
132 | (function(module, exports) {
|
133 |
|
134 | module.exports = require("element-ui/lib/utils/merge");
|
135 |
|
136 | }),
|
137 |
|
138 | (function(module, exports) {
|
139 |
|
140 | module.exports = require("element-ui/lib/input");
|
141 |
|
142 | }),
|
143 |
|
144 | (function(module, exports) {
|
145 |
|
146 | module.exports = require("element-ui/lib/mixins/migrating");
|
147 |
|
148 | }),
|
149 |
|
150 | (function(module, exports) {
|
151 |
|
152 | module.exports = require("element-ui/lib/utils/clickoutside");
|
153 |
|
154 | }),
|
155 |
|
156 | (function(module, exports) {
|
157 |
|
158 | module.exports = require("element-ui/lib/locale");
|
159 |
|
160 | }),
|
161 |
|
162 | (function(module, exports) {
|
163 |
|
164 | module.exports = require("element-ui/lib/button");
|
165 |
|
166 | }),
|
167 |
|
168 | (function(module, exports) {
|
169 |
|
170 | module.exports = require("element-ui/lib/utils/resize-event");
|
171 |
|
172 | }),
|
173 |
|
174 | (function(module, exports) {
|
175 |
|
176 | module.exports = require("element-ui/lib/utils/popup");
|
177 |
|
178 | }),
|
179 |
|
180 | (function(module, exports) {
|
181 |
|
182 | module.exports = require("throttle-debounce/debounce");
|
183 |
|
184 | }),
|
185 |
|
186 | (function(module, exports) {
|
187 |
|
188 | module.exports = require("element-ui/lib/checkbox");
|
189 |
|
190 | }),
|
191 |
|
192 | (function(module, exports) {
|
193 |
|
194 | module.exports = require("element-ui/lib/scrollbar");
|
195 |
|
196 | }),
|
197 |
|
198 | (function(module, exports) {
|
199 |
|
200 | module.exports = require("element-ui/lib/utils/types");
|
201 |
|
202 | }),
|
203 |
|
204 | (function(module, exports) {
|
205 |
|
206 | module.exports = require("element-ui/lib/utils/shared");
|
207 |
|
208 | }),
|
209 |
|
210 | (function(module, exports) {
|
211 |
|
212 | module.exports = require("element-ui/lib/utils/date");
|
213 |
|
214 | }),
|
215 |
|
216 | (function(module, exports) {
|
217 |
|
218 | module.exports = require("element-ui/lib/transitions/collapse-transition");
|
219 |
|
220 | }),
|
221 |
|
222 | (function(module, exports) {
|
223 |
|
224 | module.exports = require("element-ui/lib/mixins/focus");
|
225 |
|
226 | }),
|
227 |
|
228 | (function(module, exports) {
|
229 |
|
230 | module.exports = require("element-ui/lib/utils/vdom");
|
231 |
|
232 | }),
|
233 |
|
234 | (function(module, exports) {
|
235 |
|
236 | module.exports = require("babel-helper-vue-jsx-merge-props");
|
237 |
|
238 | }),
|
239 |
|
240 | (function(module, exports) {
|
241 |
|
242 | module.exports = require("throttle-debounce/throttle");
|
243 |
|
244 | }),
|
245 |
|
246 | (function(module, exports) {
|
247 |
|
248 | module.exports = require("element-ui/lib/tooltip");
|
249 |
|
250 | }),
|
251 |
|
252 | (function(module, exports) {
|
253 |
|
254 | module.exports = require("element-ui/lib/utils/scroll-into-view");
|
255 |
|
256 | }),
|
257 |
|
258 | (function(module, exports) {
|
259 |
|
260 | module.exports = require("element-ui/lib/utils/aria-utils");
|
261 |
|
262 | }),
|
263 |
|
264 | (function(module, exports) {
|
265 |
|
266 | module.exports = require("element-ui/lib/button-group");
|
267 |
|
268 | }),
|
269 |
|
270 | (function(module, exports) {
|
271 |
|
272 | module.exports = require("element-ui/lib/tag");
|
273 |
|
274 | }),
|
275 |
|
276 | (function(module, exports) {
|
277 |
|
278 | module.exports = require("element-ui/lib/utils/scrollbar-width");
|
279 |
|
280 | }),
|
281 |
|
282 | (function(module, exports) {
|
283 |
|
284 | module.exports = require("element-ui/lib/checkbox-group");
|
285 |
|
286 | }),
|
287 |
|
288 | (function(module, exports) {
|
289 |
|
290 | module.exports = require("element-ui/lib/utils/after-leave");
|
291 |
|
292 | }),
|
293 |
|
294 | (function(module, exports) {
|
295 |
|
296 | module.exports = require("element-ui/lib/progress");
|
297 |
|
298 | }),
|
299 |
|
300 | (function(module, exports) {
|
301 |
|
302 | module.exports = require("throttle-debounce");
|
303 |
|
304 | }),
|
305 |
|
306 | (function(module, exports) {
|
307 |
|
308 | module.exports = require("element-ui/lib/select");
|
309 |
|
310 | }),
|
311 |
|
312 | (function(module, exports) {
|
313 |
|
314 | module.exports = require("element-ui/lib/option");
|
315 |
|
316 | }),
|
317 |
|
318 | (function(module, exports) {
|
319 |
|
320 | module.exports = require("normalize-wheel");
|
321 |
|
322 | }),
|
323 |
|
324 | (function(module, exports) {
|
325 |
|
326 | module.exports = require("element-ui/lib/utils/aria-dialog");
|
327 |
|
328 | }),
|
329 |
|
330 | (function(module, exports) {
|
331 |
|
332 | module.exports = require("async-validator");
|
333 |
|
334 | }),
|
335 |
|
336 | (function(module, exports) {
|
337 |
|
338 | module.exports = require("element-ui/lib/input-number");
|
339 |
|
340 | }),
|
341 |
|
342 | (function(module, exports) {
|
343 |
|
344 | module.exports = require("element-ui/lib/cascader-panel");
|
345 |
|
346 | }),
|
347 |
|
348 | (function(module, exports) {
|
349 |
|
350 | module.exports = require("element-ui/lib/radio");
|
351 |
|
352 | }),
|
353 |
|
354 | (function(module, exports) {
|
355 |
|
356 | module.exports = require("element-ui/lib/popover");
|
357 |
|
358 | }),
|
359 |
|
360 | (function(module, exports, __webpack_require__) {
|
361 |
|
362 | module.exports = __webpack_require__(46);
|
363 |
|
364 |
|
365 | }),
|
366 |
|
367 | (function(module, __webpack_exports__, __webpack_require__) {
|
368 |
|
369 | "use strict";
|
370 | __webpack_require__.r(__webpack_exports__);
|
371 |
|
372 |
|
373 | var pagervue_type_template_id_7274f267_render = function() {
|
374 | var _vm = this
|
375 | var _h = _vm.$createElement
|
376 | var _c = _vm._self._c || _h
|
377 | return _c(
|
378 | "ul",
|
379 | { staticClass: "el-pager", on: { click: _vm.onPagerClick } },
|
380 | [
|
381 | _vm.pageCount > 0
|
382 | ? _c(
|
383 | "li",
|
384 | {
|
385 | staticClass: "number",
|
386 | class: { active: _vm.currentPage === 1, disabled: _vm.disabled }
|
387 | },
|
388 | [_vm._v("1")]
|
389 | )
|
390 | : _vm._e(),
|
391 | _vm.showPrevMore
|
392 | ? _c("li", {
|
393 | staticClass: "el-icon more btn-quickprev",
|
394 | class: [_vm.quickprevIconClass, { disabled: _vm.disabled }],
|
395 | on: {
|
396 | mouseenter: function($event) {
|
397 | _vm.onMouseenter("left")
|
398 | },
|
399 | mouseleave: function($event) {
|
400 | _vm.quickprevIconClass = "el-icon-more"
|
401 | }
|
402 | }
|
403 | })
|
404 | : _vm._e(),
|
405 | _vm._l(_vm.pagers, function(pager) {
|
406 | return _c(
|
407 | "li",
|
408 | {
|
409 | key: pager,
|
410 | staticClass: "number",
|
411 | class: { active: _vm.currentPage === pager, disabled: _vm.disabled }
|
412 | },
|
413 | [_vm._v(_vm._s(pager))]
|
414 | )
|
415 | }),
|
416 | _vm.showNextMore
|
417 | ? _c("li", {
|
418 | staticClass: "el-icon more btn-quicknext",
|
419 | class: [_vm.quicknextIconClass, { disabled: _vm.disabled }],
|
420 | on: {
|
421 | mouseenter: function($event) {
|
422 | _vm.onMouseenter("right")
|
423 | },
|
424 | mouseleave: function($event) {
|
425 | _vm.quicknextIconClass = "el-icon-more"
|
426 | }
|
427 | }
|
428 | })
|
429 | : _vm._e(),
|
430 | _vm.pageCount > 1
|
431 | ? _c(
|
432 | "li",
|
433 | {
|
434 | staticClass: "number",
|
435 | class: {
|
436 | active: _vm.currentPage === _vm.pageCount,
|
437 | disabled: _vm.disabled
|
438 | }
|
439 | },
|
440 | [_vm._v(_vm._s(_vm.pageCount))]
|
441 | )
|
442 | : _vm._e()
|
443 | ],
|
444 | 2
|
445 | )
|
446 | }
|
447 | var staticRenderFns = []
|
448 | pagervue_type_template_id_7274f267_render._withStripped = true
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
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 | var pagervue_type_script_lang_js_ = ({
|
488 | name: 'ElPager',
|
489 |
|
490 | props: {
|
491 | currentPage: Number,
|
492 |
|
493 | pageCount: Number,
|
494 |
|
495 | pagerCount: Number,
|
496 |
|
497 | disabled: Boolean
|
498 | },
|
499 |
|
500 | watch: {
|
501 | showPrevMore: function showPrevMore(val) {
|
502 | if (!val) this.quickprevIconClass = 'el-icon-more';
|
503 | },
|
504 | showNextMore: function showNextMore(val) {
|
505 | if (!val) this.quicknextIconClass = 'el-icon-more';
|
506 | }
|
507 | },
|
508 |
|
509 | methods: {
|
510 | onPagerClick: function onPagerClick(event) {
|
511 | var target = event.target;
|
512 | if (target.tagName === 'UL' || this.disabled) {
|
513 | return;
|
514 | }
|
515 |
|
516 | var newPage = Number(event.target.textContent);
|
517 | var pageCount = this.pageCount;
|
518 | var currentPage = this.currentPage;
|
519 | var pagerCountOffset = this.pagerCount - 2;
|
520 |
|
521 | if (target.className.indexOf('more') !== -1) {
|
522 | if (target.className.indexOf('quickprev') !== -1) {
|
523 | newPage = currentPage - pagerCountOffset;
|
524 | } else if (target.className.indexOf('quicknext') !== -1) {
|
525 | newPage = currentPage + pagerCountOffset;
|
526 | }
|
527 | }
|
528 |
|
529 |
|
530 | if (!isNaN(newPage)) {
|
531 | if (newPage < 1) {
|
532 | newPage = 1;
|
533 | }
|
534 |
|
535 | if (newPage > pageCount) {
|
536 | newPage = pageCount;
|
537 | }
|
538 | }
|
539 |
|
540 | if (newPage !== currentPage) {
|
541 | this.$emit('change', newPage);
|
542 | }
|
543 | },
|
544 | onMouseenter: function onMouseenter(direction) {
|
545 | if (this.disabled) return;
|
546 | if (direction === 'left') {
|
547 | this.quickprevIconClass = 'el-icon-d-arrow-left';
|
548 | } else {
|
549 | this.quicknextIconClass = 'el-icon-d-arrow-right';
|
550 | }
|
551 | }
|
552 | },
|
553 |
|
554 | computed: {
|
555 | pagers: function pagers() {
|
556 | var pagerCount = this.pagerCount;
|
557 | var halfPagerCount = (pagerCount - 1) / 2;
|
558 |
|
559 | var currentPage = Number(this.currentPage);
|
560 | var pageCount = Number(this.pageCount);
|
561 |
|
562 | var showPrevMore = false;
|
563 | var showNextMore = false;
|
564 |
|
565 | if (pageCount > pagerCount) {
|
566 | if (currentPage > pagerCount - halfPagerCount) {
|
567 | showPrevMore = true;
|
568 | }
|
569 |
|
570 | if (currentPage < pageCount - halfPagerCount) {
|
571 | showNextMore = true;
|
572 | }
|
573 | }
|
574 |
|
575 | var array = [];
|
576 |
|
577 | if (showPrevMore && !showNextMore) {
|
578 | var startPage = pageCount - (pagerCount - 2);
|
579 | for (var i = startPage; i < pageCount; i++) {
|
580 | array.push(i);
|
581 | }
|
582 | } else if (!showPrevMore && showNextMore) {
|
583 | for (var _i = 2; _i < pagerCount; _i++) {
|
584 | array.push(_i);
|
585 | }
|
586 | } else if (showPrevMore && showNextMore) {
|
587 | var offset = Math.floor(pagerCount / 2) - 1;
|
588 | for (var _i2 = currentPage - offset; _i2 <= currentPage + offset; _i2++) {
|
589 | array.push(_i2);
|
590 | }
|
591 | } else {
|
592 | for (var _i3 = 2; _i3 < pageCount; _i3++) {
|
593 | array.push(_i3);
|
594 | }
|
595 | }
|
596 |
|
597 | this.showPrevMore = showPrevMore;
|
598 | this.showNextMore = showNextMore;
|
599 |
|
600 | return array;
|
601 | }
|
602 | },
|
603 |
|
604 | data: function data() {
|
605 | return {
|
606 | current: null,
|
607 | showPrevMore: false,
|
608 | showNextMore: false,
|
609 | quicknextIconClass: 'el-icon-more',
|
610 | quickprevIconClass: 'el-icon-more'
|
611 | };
|
612 | }
|
613 | });
|
614 |
|
615 | var src_pagervue_type_script_lang_js_ = (pagervue_type_script_lang_js_);
|
616 |
|
617 |
|
618 |
|
619 |
|
620 |
|
621 |
|
622 |
|
623 | function normalizeComponent (
|
624 | scriptExports,
|
625 | render,
|
626 | staticRenderFns,
|
627 | functionalTemplate,
|
628 | injectStyles,
|
629 | scopeId,
|
630 | moduleIdentifier, /* server only */
|
631 | shadowMode /* vue-cli only */
|
632 | ) {
|
633 |
|
634 | var options = typeof scriptExports === 'function'
|
635 | ? scriptExports.options
|
636 | : scriptExports
|
637 |
|
638 |
|
639 | if (render) {
|
640 | options.render = render
|
641 | options.staticRenderFns = staticRenderFns
|
642 | options._compiled = true
|
643 | }
|
644 |
|
645 |
|
646 | if (functionalTemplate) {
|
647 | options.functional = true
|
648 | }
|
649 |
|
650 |
|
651 | if (scopeId) {
|
652 | options._scopeId = 'data-v-' + scopeId
|
653 | }
|
654 |
|
655 | var hook
|
656 | if (moduleIdentifier) {
|
657 | hook = function (context) {
|
658 |
|
659 | context =
|
660 | context ||
|
661 | (this.$vnode && this.$vnode.ssrContext) ||
|
662 | (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext)
|
663 |
|
664 | if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
|
665 | context = __VUE_SSR_CONTEXT__
|
666 | }
|
667 |
|
668 | if (injectStyles) {
|
669 | injectStyles.call(this, context)
|
670 | }
|
671 |
|
672 | if (context && context._registeredComponents) {
|
673 | context._registeredComponents.add(moduleIdentifier)
|
674 | }
|
675 | }
|
676 |
|
677 |
|
678 | options._ssrRegister = hook
|
679 | } else if (injectStyles) {
|
680 | hook = shadowMode
|
681 | ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
|
682 | : injectStyles
|
683 | }
|
684 |
|
685 | if (hook) {
|
686 | if (options.functional) {
|
687 |
|
688 |
|
689 | options._injectStyles = hook
|
690 |
|
691 | var originalRender = options.render
|
692 | options.render = function renderWithStyleInjection (h, context) {
|
693 | hook.call(context)
|
694 | return originalRender(h, context)
|
695 | }
|
696 | } else {
|
697 |
|
698 | var existing = options.beforeCreate
|
699 | options.beforeCreate = existing
|
700 | ? [].concat(existing, hook)
|
701 | : [hook]
|
702 | }
|
703 | }
|
704 |
|
705 | return {
|
706 | exports: scriptExports,
|
707 | options: options
|
708 | }
|
709 | }
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 | var component = normalizeComponent(
|
720 | src_pagervue_type_script_lang_js_,
|
721 | pagervue_type_template_id_7274f267_render,
|
722 | staticRenderFns,
|
723 | false,
|
724 | null,
|
725 | null,
|
726 | null
|
727 |
|
728 | )
|
729 |
|
730 |
|
731 | if (false) { var api; }
|
732 | component.options.__file = "packages/pagination/src/pager.vue"
|
733 | var pager = (component.exports);
|
734 |
|
735 | var select_ = __webpack_require__(36);
|
736 | var select_default = __webpack_require__.n(select_);
|
737 |
|
738 |
|
739 | var option_ = __webpack_require__(37);
|
740 | var option_default = __webpack_require__.n(option_);
|
741 |
|
742 |
|
743 | var input_ = __webpack_require__(8);
|
744 | var input_default = __webpack_require__.n(input_);
|
745 |
|
746 |
|
747 | var locale_ = __webpack_require__(4);
|
748 | var locale_default = __webpack_require__.n(locale_);
|
749 |
|
750 |
|
751 | var util_ = __webpack_require__(2);
|
752 |
|
753 |
|
754 |
|
755 |
|
756 |
|
757 |
|
758 |
|
759 |
|
760 |
|
761 | var pagination = ({
|
762 | name: 'ElPagination',
|
763 |
|
764 | props: {
|
765 | pageSize: {
|
766 | type: Number,
|
767 | default: 10
|
768 | },
|
769 |
|
770 | small: Boolean,
|
771 |
|
772 | total: Number,
|
773 |
|
774 | pageCount: Number,
|
775 |
|
776 | pagerCount: {
|
777 | type: Number,
|
778 | validator: function validator(value) {
|
779 | return (value | 0) === value && value > 4 && value < 22 && value % 2 === 1;
|
780 | },
|
781 |
|
782 | default: 7
|
783 | },
|
784 |
|
785 | currentPage: {
|
786 | type: Number,
|
787 | default: 1
|
788 | },
|
789 |
|
790 | layout: {
|
791 | default: 'prev, pager, next, jumper, ->, total'
|
792 | },
|
793 |
|
794 | pageSizes: {
|
795 | type: Array,
|
796 | default: function _default() {
|
797 | return [10, 20, 30, 40, 50, 100];
|
798 | }
|
799 | },
|
800 |
|
801 | popperClass: String,
|
802 |
|
803 | prevText: String,
|
804 |
|
805 | nextText: String,
|
806 |
|
807 | background: Boolean,
|
808 |
|
809 | disabled: Boolean,
|
810 |
|
811 | hideOnSinglePage: Boolean
|
812 | },
|
813 |
|
814 | data: function data() {
|
815 | return {
|
816 | internalCurrentPage: 1,
|
817 | internalPageSize: 0,
|
818 | lastEmittedPage: -1,
|
819 | userChangePageSize: false
|
820 | };
|
821 | },
|
822 | render: function render(h) {
|
823 | var layout = this.layout;
|
824 | if (!layout) return null;
|
825 | if (this.hideOnSinglePage && (!this.internalPageCount || this.internalPageCount === 1)) return null;
|
826 |
|
827 | var template = h('div', { 'class': ['el-pagination', {
|
828 | 'is-background': this.background,
|
829 | 'el-pagination--small': this.small
|
830 | }] });
|
831 | var TEMPLATE_MAP = {
|
832 | prev: h('prev'),
|
833 | jumper: h('jumper'),
|
834 | pager: h('pager', {
|
835 | attrs: { currentPage: this.internalCurrentPage, pageCount: this.internalPageCount, pagerCount: this.pagerCount, disabled: this.disabled },
|
836 | on: {
|
837 | 'change': this.handleCurrentChange
|
838 | }
|
839 | }),
|
840 | next: h('next'),
|
841 | sizes: h('sizes', {
|
842 | attrs: { pageSizes: this.pageSizes }
|
843 | }),
|
844 | slot: h('slot', [this.$slots.default ? this.$slots.default : '']),
|
845 | total: h('total')
|
846 | };
|
847 | var components = layout.split(',').map(function (item) {
|
848 | return item.trim();
|
849 | });
|
850 | var rightWrapper = h('div', { 'class': 'el-pagination__rightwrapper' });
|
851 | var haveRightWrapper = false;
|
852 |
|
853 | template.children = template.children || [];
|
854 | rightWrapper.children = rightWrapper.children || [];
|
855 | components.forEach(function (compo) {
|
856 | if (compo === '->') {
|
857 | haveRightWrapper = true;
|
858 | return;
|
859 | }
|
860 |
|
861 | if (!haveRightWrapper) {
|
862 | template.children.push(TEMPLATE_MAP[compo]);
|
863 | } else {
|
864 | rightWrapper.children.push(TEMPLATE_MAP[compo]);
|
865 | }
|
866 | });
|
867 |
|
868 | if (haveRightWrapper) {
|
869 | template.children.unshift(rightWrapper);
|
870 | }
|
871 |
|
872 | return template;
|
873 | },
|
874 |
|
875 |
|
876 | components: {
|
877 | Prev: {
|
878 | render: function render(h) {
|
879 | return h(
|
880 | 'button',
|
881 | {
|
882 | attrs: {
|
883 | type: 'button',
|
884 |
|
885 | disabled: this.$parent.disabled || this.$parent.internalCurrentPage <= 1
|
886 | },
|
887 | 'class': 'btn-prev', on: {
|
888 | 'click': this.$parent.prev
|
889 | }
|
890 | },
|
891 | [this.$parent.prevText ? h('span', [this.$parent.prevText]) : h('i', { 'class': 'el-icon el-icon-arrow-left' })]
|
892 | );
|
893 | }
|
894 | },
|
895 |
|
896 | Next: {
|
897 | render: function render(h) {
|
898 | return h(
|
899 | 'button',
|
900 | {
|
901 | attrs: {
|
902 | type: 'button',
|
903 |
|
904 | disabled: this.$parent.disabled || this.$parent.internalCurrentPage === this.$parent.internalPageCount || this.$parent.internalPageCount === 0
|
905 | },
|
906 | 'class': 'btn-next', on: {
|
907 | 'click': this.$parent.next
|
908 | }
|
909 | },
|
910 | [this.$parent.nextText ? h('span', [this.$parent.nextText]) : h('i', { 'class': 'el-icon el-icon-arrow-right' })]
|
911 | );
|
912 | }
|
913 | },
|
914 |
|
915 | Sizes: {
|
916 | mixins: [locale_default.a],
|
917 |
|
918 | props: {
|
919 | pageSizes: Array
|
920 | },
|
921 |
|
922 | watch: {
|
923 | pageSizes: {
|
924 | immediate: true,
|
925 | handler: function handler(newVal, oldVal) {
|
926 | if (Object(util_["valueEquals"])(newVal, oldVal)) return;
|
927 | if (Array.isArray(newVal)) {
|
928 | this.$parent.internalPageSize = newVal.indexOf(this.$parent.pageSize) > -1 ? this.$parent.pageSize : this.pageSizes[0];
|
929 | }
|
930 | }
|
931 | }
|
932 | },
|
933 |
|
934 | render: function render(h) {
|
935 | var _this = this;
|
936 |
|
937 | return h(
|
938 | 'span',
|
939 | { 'class': 'el-pagination__sizes' },
|
940 | [h(
|
941 | 'el-select',
|
942 | {
|
943 | attrs: {
|
944 | value: this.$parent.internalPageSize,
|
945 | popperClass: this.$parent.popperClass || '',
|
946 | size: 'mini',
|
947 |
|
948 | disabled: this.$parent.disabled },
|
949 | on: {
|
950 | 'input': this.handleChange
|
951 | }
|
952 | },
|
953 | [this.pageSizes.map(function (item) {
|
954 | return h('el-option', {
|
955 | attrs: {
|
956 | value: item,
|
957 | label: item + _this.t('el.pagination.pagesize') }
|
958 | });
|
959 | })]
|
960 | )]
|
961 | );
|
962 | },
|
963 |
|
964 |
|
965 | components: {
|
966 | ElSelect: select_default.a,
|
967 | ElOption: option_default.a
|
968 | },
|
969 |
|
970 | methods: {
|
971 | handleChange: function handleChange(val) {
|
972 | if (val !== this.$parent.internalPageSize) {
|
973 | this.$parent.internalPageSize = val = parseInt(val, 10);
|
974 | this.$parent.userChangePageSize = true;
|
975 | this.$parent.$emit('update:pageSize', val);
|
976 | this.$parent.$emit('size-change', val);
|
977 | }
|
978 | }
|
979 | }
|
980 | },
|
981 |
|
982 | Jumper: {
|
983 | mixins: [locale_default.a],
|
984 |
|
985 | components: { ElInput: input_default.a },
|
986 |
|
987 | data: function data() {
|
988 | return {
|
989 | userInput: null
|
990 | };
|
991 | },
|
992 |
|
993 |
|
994 | watch: {
|
995 | '$parent.internalCurrentPage': function $parentInternalCurrentPage() {
|
996 | this.userInput = null;
|
997 | }
|
998 | },
|
999 |
|
1000 | methods: {
|
1001 | handleKeyup: function handleKeyup(_ref) {
|
1002 | var keyCode = _ref.keyCode,
|
1003 | target = _ref.target;
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 | if (keyCode === 13) {
|
1009 | this.handleChange(target.value);
|
1010 | }
|
1011 | },
|
1012 | handleInput: function handleInput(value) {
|
1013 | this.userInput = value;
|
1014 | },
|
1015 | handleChange: function handleChange(value) {
|
1016 | this.$parent.internalCurrentPage = this.$parent.getValidCurrentPage(value);
|
1017 | this.$parent.emitChange();
|
1018 | this.userInput = null;
|
1019 | }
|
1020 | },
|
1021 |
|
1022 | render: function render(h) {
|
1023 | return h(
|
1024 | 'span',
|
1025 | { 'class': 'el-pagination__jump' },
|
1026 | [this.t('el.pagination.goto'), h('el-input', {
|
1027 | 'class': 'el-pagination__editor is-in-pagination',
|
1028 | attrs: { min: 1,
|
1029 | max: this.$parent.internalPageCount,
|
1030 | value: this.userInput !== null ? this.userInput : this.$parent.internalCurrentPage,
|
1031 | type: 'number',
|
1032 | disabled: this.$parent.disabled
|
1033 | },
|
1034 | nativeOn: {
|
1035 | 'keyup': this.handleKeyup
|
1036 | },
|
1037 | on: {
|
1038 | 'input': this.handleInput,
|
1039 | 'change': this.handleChange
|
1040 | }
|
1041 | }), this.t('el.pagination.pageClassifier')]
|
1042 | );
|
1043 | }
|
1044 | },
|
1045 |
|
1046 | Total: {
|
1047 | mixins: [locale_default.a],
|
1048 |
|
1049 | render: function render(h) {
|
1050 | return typeof this.$parent.total === 'number' ? h(
|
1051 | 'span',
|
1052 | { 'class': 'el-pagination__total' },
|
1053 | [this.t('el.pagination.total', { total: this.$parent.total })]
|
1054 | ) : '';
|
1055 | }
|
1056 | },
|
1057 |
|
1058 | Pager: pager
|
1059 | },
|
1060 |
|
1061 | methods: {
|
1062 | handleCurrentChange: function handleCurrentChange(val) {
|
1063 | this.internalCurrentPage = this.getValidCurrentPage(val);
|
1064 | this.userChangePageSize = true;
|
1065 | this.emitChange();
|
1066 | },
|
1067 | prev: function prev() {
|
1068 | if (this.disabled) return;
|
1069 | var newVal = this.internalCurrentPage - 1;
|
1070 | this.internalCurrentPage = this.getValidCurrentPage(newVal);
|
1071 | this.$emit('prev-click', this.internalCurrentPage);
|
1072 | this.emitChange();
|
1073 | },
|
1074 | next: function next() {
|
1075 | if (this.disabled) return;
|
1076 | var newVal = this.internalCurrentPage + 1;
|
1077 | this.internalCurrentPage = this.getValidCurrentPage(newVal);
|
1078 | this.$emit('next-click', this.internalCurrentPage);
|
1079 | this.emitChange();
|
1080 | },
|
1081 | getValidCurrentPage: function getValidCurrentPage(value) {
|
1082 | value = parseInt(value, 10);
|
1083 |
|
1084 | var havePageCount = typeof this.internalPageCount === 'number';
|
1085 |
|
1086 | var resetValue = void 0;
|
1087 | if (!havePageCount) {
|
1088 | if (isNaN(value) || value < 1) resetValue = 1;
|
1089 | } else {
|
1090 | if (value < 1) {
|
1091 | resetValue = 1;
|
1092 | } else if (value > this.internalPageCount) {
|
1093 | resetValue = this.internalPageCount;
|
1094 | }
|
1095 | }
|
1096 |
|
1097 | if (resetValue === undefined && isNaN(value)) {
|
1098 | resetValue = 1;
|
1099 | } else if (resetValue === 0) {
|
1100 | resetValue = 1;
|
1101 | }
|
1102 |
|
1103 | return resetValue === undefined ? value : resetValue;
|
1104 | },
|
1105 | emitChange: function emitChange() {
|
1106 | var _this2 = this;
|
1107 |
|
1108 | this.$nextTick(function () {
|
1109 | if (_this2.internalCurrentPage !== _this2.lastEmittedPage || _this2.userChangePageSize) {
|
1110 | _this2.$emit('current-change', _this2.internalCurrentPage);
|
1111 | _this2.lastEmittedPage = _this2.internalCurrentPage;
|
1112 | _this2.userChangePageSize = false;
|
1113 | }
|
1114 | });
|
1115 | }
|
1116 | },
|
1117 |
|
1118 | computed: {
|
1119 | internalPageCount: function internalPageCount() {
|
1120 | if (typeof this.total === 'number') {
|
1121 | return Math.max(1, Math.ceil(this.total / this.internalPageSize));
|
1122 | } else if (typeof this.pageCount === 'number') {
|
1123 | return Math.max(1, this.pageCount);
|
1124 | }
|
1125 | return null;
|
1126 | }
|
1127 | },
|
1128 |
|
1129 | watch: {
|
1130 | currentPage: {
|
1131 | immediate: true,
|
1132 | handler: function handler(val) {
|
1133 | this.internalCurrentPage = this.getValidCurrentPage(val);
|
1134 | }
|
1135 | },
|
1136 |
|
1137 | pageSize: {
|
1138 | immediate: true,
|
1139 | handler: function handler(val) {
|
1140 | this.internalPageSize = isNaN(val) ? 10 : val;
|
1141 | }
|
1142 | },
|
1143 |
|
1144 | internalCurrentPage: {
|
1145 | immediate: true,
|
1146 | handler: function handler(newVal) {
|
1147 | this.$emit('update:currentPage', newVal);
|
1148 | this.lastEmittedPage = -1;
|
1149 | }
|
1150 | },
|
1151 |
|
1152 | internalPageCount: function internalPageCount(newVal) {
|
1153 |
|
1154 | var oldPage = this.internalCurrentPage;
|
1155 | if (newVal > 0 && oldPage === 0) {
|
1156 | this.internalCurrentPage = 1;
|
1157 | } else if (oldPage > newVal) {
|
1158 | this.internalCurrentPage = newVal === 0 ? 1 : newVal;
|
1159 | this.userChangePageSize && this.emitChange();
|
1160 | }
|
1161 | this.userChangePageSize = false;
|
1162 | }
|
1163 | }
|
1164 | });
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 | pagination.install = function (Vue) {
|
1170 | Vue.component(pagination.name, pagination);
|
1171 | };
|
1172 |
|
1173 | var packages_pagination = (pagination);
|
1174 |
|
1175 | var componentvue_type_template_id_60140e62_render = function() {
|
1176 | var _vm = this
|
1177 | var _h = _vm.$createElement
|
1178 | var _c = _vm._self._c || _h
|
1179 | return _c(
|
1180 | "transition",
|
1181 | {
|
1182 | attrs: { name: "dialog-fade" },
|
1183 | on: { "after-enter": _vm.afterEnter, "after-leave": _vm.afterLeave }
|
1184 | },
|
1185 | [
|
1186 | _c(
|
1187 | "div",
|
1188 | {
|
1189 | directives: [
|
1190 | {
|
1191 | name: "show",
|
1192 | rawName: "v-show",
|
1193 | value: _vm.visible,
|
1194 | expression: "visible"
|
1195 | }
|
1196 | ],
|
1197 | staticClass: "el-dialog__wrapper",
|
1198 | on: {
|
1199 | click: function($event) {
|
1200 | if ($event.target !== $event.currentTarget) {
|
1201 | return null
|
1202 | }
|
1203 | return _vm.handleWrapperClick($event)
|
1204 | }
|
1205 | }
|
1206 | },
|
1207 | [
|
1208 | _c(
|
1209 | "div",
|
1210 | {
|
1211 | key: _vm.key,
|
1212 | ref: "dialog",
|
1213 | class: [
|
1214 | "el-dialog",
|
1215 | {
|
1216 | "is-fullscreen": _vm.fullscreen,
|
1217 | "el-dialog--center": _vm.center
|
1218 | },
|
1219 | _vm.customClass
|
1220 | ],
|
1221 | style: _vm.style,
|
1222 | attrs: {
|
1223 | role: "dialog",
|
1224 | "aria-modal": "true",
|
1225 | "aria-label": _vm.title || "dialog"
|
1226 | }
|
1227 | },
|
1228 | [
|
1229 | _c(
|
1230 | "div",
|
1231 | { staticClass: "el-dialog__header" },
|
1232 | [
|
1233 | _vm._t("title", [
|
1234 | _c("span", { staticClass: "el-dialog__title" }, [
|
1235 | _vm._v(_vm._s(_vm.title))
|
1236 | ])
|
1237 | ]),
|
1238 | _vm.showClose
|
1239 | ? _c(
|
1240 | "button",
|
1241 | {
|
1242 | staticClass: "el-dialog__headerbtn",
|
1243 | attrs: { type: "button", "aria-label": "Close" },
|
1244 | on: { click: _vm.handleClose }
|
1245 | },
|
1246 | [
|
1247 | _c("i", {
|
1248 | staticClass:
|
1249 | "el-dialog__close el-icon el-icon-close"
|
1250 | })
|
1251 | ]
|
1252 | )
|
1253 | : _vm._e()
|
1254 | ],
|
1255 | 2
|
1256 | ),
|
1257 | _vm.rendered
|
1258 | ? _c(
|
1259 | "div",
|
1260 | { staticClass: "el-dialog__body" },
|
1261 | [_vm._t("default")],
|
1262 | 2
|
1263 | )
|
1264 | : _vm._e(),
|
1265 | _vm.$slots.footer
|
1266 | ? _c(
|
1267 | "div",
|
1268 | { staticClass: "el-dialog__footer" },
|
1269 | [_vm._t("footer")],
|
1270 | 2
|
1271 | )
|
1272 | : _vm._e()
|
1273 | ]
|
1274 | )
|
1275 | ]
|
1276 | )
|
1277 | ]
|
1278 | )
|
1279 | }
|
1280 | var componentvue_type_template_id_60140e62_staticRenderFns = []
|
1281 | componentvue_type_template_id_60140e62_render._withStripped = true
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 | var popup_ = __webpack_require__(14);
|
1288 | var popup_default = __webpack_require__.n(popup_);
|
1289 |
|
1290 |
|
1291 | var migrating_ = __webpack_require__(9);
|
1292 | var migrating_default = __webpack_require__.n(migrating_);
|
1293 |
|
1294 |
|
1295 | var emitter_ = __webpack_require__(3);
|
1296 | var emitter_default = __webpack_require__.n(emitter_);
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 |
|
1329 |
|
1330 |
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 | var componentvue_type_script_lang_js_ = ({
|
1344 | name: 'ElDialog',
|
1345 |
|
1346 | mixins: [popup_default.a, emitter_default.a, migrating_default.a],
|
1347 |
|
1348 | props: {
|
1349 | title: {
|
1350 | type: String,
|
1351 | default: ''
|
1352 | },
|
1353 |
|
1354 | modal: {
|
1355 | type: Boolean,
|
1356 | default: true
|
1357 | },
|
1358 |
|
1359 | modalAppendToBody: {
|
1360 | type: Boolean,
|
1361 | default: true
|
1362 | },
|
1363 |
|
1364 | appendToBody: {
|
1365 | type: Boolean,
|
1366 | default: false
|
1367 | },
|
1368 |
|
1369 | lockScroll: {
|
1370 | type: Boolean,
|
1371 | default: true
|
1372 | },
|
1373 |
|
1374 | closeOnClickModal: {
|
1375 | type: Boolean,
|
1376 | default: true
|
1377 | },
|
1378 |
|
1379 | closeOnPressEscape: {
|
1380 | type: Boolean,
|
1381 | default: true
|
1382 | },
|
1383 |
|
1384 | showClose: {
|
1385 | type: Boolean,
|
1386 | default: true
|
1387 | },
|
1388 |
|
1389 | width: String,
|
1390 |
|
1391 | fullscreen: Boolean,
|
1392 |
|
1393 | customClass: {
|
1394 | type: String,
|
1395 | default: ''
|
1396 | },
|
1397 |
|
1398 | top: {
|
1399 | type: String,
|
1400 | default: '15vh'
|
1401 | },
|
1402 | beforeClose: Function,
|
1403 | center: {
|
1404 | type: Boolean,
|
1405 | default: false
|
1406 | },
|
1407 |
|
1408 | destroyOnClose: Boolean
|
1409 | },
|
1410 |
|
1411 | data: function data() {
|
1412 | return {
|
1413 | closed: false,
|
1414 | key: 0
|
1415 | };
|
1416 | },
|
1417 |
|
1418 |
|
1419 | watch: {
|
1420 | visible: function visible(val) {
|
1421 | var _this = this;
|
1422 |
|
1423 | if (val) {
|
1424 | this.closed = false;
|
1425 | this.$emit('open');
|
1426 | this.$el.addEventListener('scroll', this.updatePopper);
|
1427 | this.$nextTick(function () {
|
1428 | _this.$refs.dialog.scrollTop = 0;
|
1429 | });
|
1430 | if (this.appendToBody) {
|
1431 | document.body.appendChild(this.$el);
|
1432 | }
|
1433 | } else {
|
1434 | this.$el.removeEventListener('scroll', this.updatePopper);
|
1435 | if (!this.closed) this.$emit('close');
|
1436 | if (this.destroyOnClose) {
|
1437 | this.$nextTick(function () {
|
1438 | _this.key++;
|
1439 | });
|
1440 | }
|
1441 | }
|
1442 | }
|
1443 | },
|
1444 |
|
1445 | computed: {
|
1446 | style: function style() {
|
1447 | var style = {};
|
1448 | if (!this.fullscreen) {
|
1449 | style.marginTop = this.top;
|
1450 | if (this.width) {
|
1451 | style.width = this.width;
|
1452 | }
|
1453 | }
|
1454 | return style;
|
1455 | }
|
1456 | },
|
1457 |
|
1458 | methods: {
|
1459 | getMigratingConfig: function getMigratingConfig() {
|
1460 | return {
|
1461 | props: {
|
1462 | 'size': 'size is removed.'
|
1463 | }
|
1464 | };
|
1465 | },
|
1466 | handleWrapperClick: function handleWrapperClick() {
|
1467 | if (!this.closeOnClickModal) return;
|
1468 | this.handleClose();
|
1469 | },
|
1470 | handleClose: function handleClose() {
|
1471 | if (typeof this.beforeClose === 'function') {
|
1472 | this.beforeClose(this.hide);
|
1473 | } else {
|
1474 | this.hide();
|
1475 | }
|
1476 | },
|
1477 | hide: function hide(cancel) {
|
1478 | if (cancel !== false) {
|
1479 | this.$emit('update:visible', false);
|
1480 | this.$emit('close');
|
1481 | this.closed = true;
|
1482 | }
|
1483 | },
|
1484 | updatePopper: function updatePopper() {
|
1485 | this.broadcast('ElSelectDropdown', 'updatePopper');
|
1486 | this.broadcast('ElDropdownMenu', 'updatePopper');
|
1487 | },
|
1488 | afterEnter: function afterEnter() {
|
1489 | this.$emit('opened');
|
1490 | },
|
1491 | afterLeave: function afterLeave() {
|
1492 | this.$emit('closed');
|
1493 | }
|
1494 | },
|
1495 |
|
1496 | mounted: function mounted() {
|
1497 | if (this.visible) {
|
1498 | this.rendered = true;
|
1499 | this.open();
|
1500 | if (this.appendToBody) {
|
1501 | document.body.appendChild(this.$el);
|
1502 | }
|
1503 | }
|
1504 | },
|
1505 | destroyed: function destroyed() {
|
1506 |
|
1507 | if (this.appendToBody && this.$el && this.$el.parentNode) {
|
1508 | this.$el.parentNode.removeChild(this.$el);
|
1509 | }
|
1510 | }
|
1511 | });
|
1512 |
|
1513 | var src_componentvue_type_script_lang_js_ = (componentvue_type_script_lang_js_);
|
1514 |
|
1515 |
|
1516 |
|
1517 |
|
1518 |
|
1519 |
|
1520 |
|
1521 |
|
1522 | var component_component = normalizeComponent(
|
1523 | src_componentvue_type_script_lang_js_,
|
1524 | componentvue_type_template_id_60140e62_render,
|
1525 | componentvue_type_template_id_60140e62_staticRenderFns,
|
1526 | false,
|
1527 | null,
|
1528 | null,
|
1529 | null
|
1530 |
|
1531 | )
|
1532 |
|
1533 |
|
1534 | if (false) { var component_api; }
|
1535 | component_component.options.__file = "packages/dialog/src/component.vue"
|
1536 | var src_component = (component_component.exports);
|
1537 |
|
1538 |
|
1539 |
|
1540 |
|
1541 | src_component.install = function (Vue) {
|
1542 | Vue.component(src_component.name, src_component);
|
1543 | };
|
1544 |
|
1545 | var dialog = (src_component);
|
1546 |
|
1547 | var autocompletevue_type_template_id_152f2ee6_render = function() {
|
1548 | var _vm = this
|
1549 | var _h = _vm.$createElement
|
1550 | var _c = _vm._self._c || _h
|
1551 | return _c(
|
1552 | "div",
|
1553 | {
|
1554 | directives: [
|
1555 | {
|
1556 | name: "clickoutside",
|
1557 | rawName: "v-clickoutside",
|
1558 | value: _vm.close,
|
1559 | expression: "close"
|
1560 | }
|
1561 | ],
|
1562 | staticClass: "el-autocomplete",
|
1563 | attrs: {
|
1564 | "aria-haspopup": "listbox",
|
1565 | role: "combobox",
|
1566 | "aria-expanded": _vm.suggestionVisible,
|
1567 | "aria-owns": _vm.id
|
1568 | }
|
1569 | },
|
1570 | [
|
1571 | _c(
|
1572 | "el-input",
|
1573 | _vm._b(
|
1574 | {
|
1575 | ref: "input",
|
1576 | on: {
|
1577 | input: _vm.handleInput,
|
1578 | change: _vm.handleChange,
|
1579 | focus: _vm.handleFocus,
|
1580 | blur: _vm.handleBlur,
|
1581 | clear: _vm.handleClear
|
1582 | },
|
1583 | nativeOn: {
|
1584 | keydown: [
|
1585 | function($event) {
|
1586 | if (
|
1587 | !("button" in $event) &&
|
1588 | _vm._k($event.keyCode, "up", 38, $event.key, [
|
1589 | "Up",
|
1590 | "ArrowUp"
|
1591 | ])
|
1592 | ) {
|
1593 | return null
|
1594 | }
|
1595 | $event.preventDefault()
|
1596 | _vm.highlight(_vm.highlightedIndex - 1)
|
1597 | },
|
1598 | function($event) {
|
1599 | if (
|
1600 | !("button" in $event) &&
|
1601 | _vm._k($event.keyCode, "down", 40, $event.key, [
|
1602 | "Down",
|
1603 | "ArrowDown"
|
1604 | ])
|
1605 | ) {
|
1606 | return null
|
1607 | }
|
1608 | $event.preventDefault()
|
1609 | _vm.highlight(_vm.highlightedIndex + 1)
|
1610 | },
|
1611 | function($event) {
|
1612 | if (
|
1613 | !("button" in $event) &&
|
1614 | _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
|
1615 | ) {
|
1616 | return null
|
1617 | }
|
1618 | return _vm.handleKeyEnter($event)
|
1619 | },
|
1620 | function($event) {
|
1621 | if (
|
1622 | !("button" in $event) &&
|
1623 | _vm._k($event.keyCode, "tab", 9, $event.key, "Tab")
|
1624 | ) {
|
1625 | return null
|
1626 | }
|
1627 | return _vm.close($event)
|
1628 | }
|
1629 | ]
|
1630 | }
|
1631 | },
|
1632 | "el-input",
|
1633 | [_vm.$props, _vm.$attrs],
|
1634 | false
|
1635 | ),
|
1636 | [
|
1637 | _vm.$slots.prepend
|
1638 | ? _c("template", { slot: "prepend" }, [_vm._t("prepend")], 2)
|
1639 | : _vm._e(),
|
1640 | _vm.$slots.append
|
1641 | ? _c("template", { slot: "append" }, [_vm._t("append")], 2)
|
1642 | : _vm._e(),
|
1643 | _vm.$slots.prefix
|
1644 | ? _c("template", { slot: "prefix" }, [_vm._t("prefix")], 2)
|
1645 | : _vm._e(),
|
1646 | _vm.$slots.suffix
|
1647 | ? _c("template", { slot: "suffix" }, [_vm._t("suffix")], 2)
|
1648 | : _vm._e()
|
1649 | ],
|
1650 | 2
|
1651 | ),
|
1652 | _c(
|
1653 | "el-autocomplete-suggestions",
|
1654 | {
|
1655 | ref: "suggestions",
|
1656 | class: [_vm.popperClass ? _vm.popperClass : ""],
|
1657 | attrs: {
|
1658 | "visible-arrow": "",
|
1659 | "popper-options": _vm.popperOptions,
|
1660 | "append-to-body": _vm.popperAppendToBody,
|
1661 | placement: _vm.placement,
|
1662 | id: _vm.id
|
1663 | }
|
1664 | },
|
1665 | _vm._l(_vm.suggestions, function(item, index) {
|
1666 | return _c(
|
1667 | "li",
|
1668 | {
|
1669 | key: index,
|
1670 | class: { highlighted: _vm.highlightedIndex === index },
|
1671 | attrs: {
|
1672 | id: _vm.id + "-item-" + index,
|
1673 | role: "option",
|
1674 | "aria-selected": _vm.highlightedIndex === index
|
1675 | },
|
1676 | on: {
|
1677 | click: function($event) {
|
1678 | _vm.select(item)
|
1679 | }
|
1680 | }
|
1681 | },
|
1682 | [
|
1683 | _vm._t(
|
1684 | "default",
|
1685 | [
|
1686 | _vm._v("\n " + _vm._s(item[_vm.valueKey]) + "\n ")
|
1687 | ],
|
1688 | { item: item }
|
1689 | )
|
1690 | ],
|
1691 | 2
|
1692 | )
|
1693 | }),
|
1694 | 0
|
1695 | )
|
1696 | ],
|
1697 | 1
|
1698 | )
|
1699 | }
|
1700 | var autocompletevue_type_template_id_152f2ee6_staticRenderFns = []
|
1701 | autocompletevue_type_template_id_152f2ee6_render._withStripped = true
|
1702 |
|
1703 |
|
1704 |
|
1705 |
|
1706 |
|
1707 | var debounce_ = __webpack_require__(15);
|
1708 | var debounce_default = __webpack_require__.n(debounce_);
|
1709 |
|
1710 |
|
1711 | var clickoutside_ = __webpack_require__(10);
|
1712 | var clickoutside_default = __webpack_require__.n(clickoutside_);
|
1713 |
|
1714 |
|
1715 | var autocomplete_suggestionsvue_type_template_id_cd10dcf0_render = function() {
|
1716 | var _vm = this
|
1717 | var _h = _vm.$createElement
|
1718 | var _c = _vm._self._c || _h
|
1719 | return _c(
|
1720 | "transition",
|
1721 | { attrs: { name: "el-zoom-in-top" }, on: { "after-leave": _vm.doDestroy } },
|
1722 | [
|
1723 | _c(
|
1724 | "div",
|
1725 | {
|
1726 | directives: [
|
1727 | {
|
1728 | name: "show",
|
1729 | rawName: "v-show",
|
1730 | value: _vm.showPopper,
|
1731 | expression: "showPopper"
|
1732 | }
|
1733 | ],
|
1734 | staticClass: "el-autocomplete-suggestion el-popper",
|
1735 | class: {
|
1736 | "is-loading": !_vm.parent.hideLoading && _vm.parent.loading
|
1737 | },
|
1738 | style: { width: _vm.dropdownWidth },
|
1739 | attrs: { role: "region" }
|
1740 | },
|
1741 | [
|
1742 | _c(
|
1743 | "el-scrollbar",
|
1744 | {
|
1745 | attrs: {
|
1746 | tag: "ul",
|
1747 | "wrap-class": "el-autocomplete-suggestion__wrap",
|
1748 | "view-class": "el-autocomplete-suggestion__list"
|
1749 | }
|
1750 | },
|
1751 | [
|
1752 | !_vm.parent.hideLoading && _vm.parent.loading
|
1753 | ? _c("li", [_c("i", { staticClass: "el-icon-loading" })])
|
1754 | : _vm._t("default")
|
1755 | ],
|
1756 | 2
|
1757 | )
|
1758 | ],
|
1759 | 1
|
1760 | )
|
1761 | ]
|
1762 | )
|
1763 | }
|
1764 | var autocomplete_suggestionsvue_type_template_id_cd10dcf0_staticRenderFns = []
|
1765 | autocomplete_suggestionsvue_type_template_id_cd10dcf0_render._withStripped = true
|
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 | var vue_popper_ = __webpack_require__(5);
|
1772 | var vue_popper_default = __webpack_require__.n(vue_popper_);
|
1773 |
|
1774 |
|
1775 | var scrollbar_ = __webpack_require__(17);
|
1776 | var scrollbar_default = __webpack_require__.n(scrollbar_);
|
1777 |
|
1778 |
|
1779 |
|
1780 |
|
1781 |
|
1782 |
|
1783 |
|
1784 |
|
1785 |
|
1786 |
|
1787 |
|
1788 |
|
1789 |
|
1790 |
|
1791 |
|
1792 |
|
1793 |
|
1794 |
|
1795 |
|
1796 |
|
1797 |
|
1798 |
|
1799 |
|
1800 |
|
1801 |
|
1802 |
|
1803 | var autocomplete_suggestionsvue_type_script_lang_js_ = ({
|
1804 | components: { ElScrollbar: scrollbar_default.a },
|
1805 | mixins: [vue_popper_default.a, emitter_default.a],
|
1806 |
|
1807 | componentName: 'ElAutocompleteSuggestions',
|
1808 |
|
1809 | data: function data() {
|
1810 | return {
|
1811 | parent: this.$parent,
|
1812 | dropdownWidth: ''
|
1813 | };
|
1814 | },
|
1815 |
|
1816 |
|
1817 | props: {
|
1818 | options: {
|
1819 | default: function _default() {
|
1820 | return {
|
1821 | gpuAcceleration: false
|
1822 | };
|
1823 | }
|
1824 | },
|
1825 | id: String
|
1826 | },
|
1827 |
|
1828 | methods: {
|
1829 | select: function select(item) {
|
1830 | this.dispatch('ElAutocomplete', 'item-click', item);
|
1831 | }
|
1832 | },
|
1833 |
|
1834 | updated: function updated() {
|
1835 | var _this = this;
|
1836 |
|
1837 | this.$nextTick(function (_) {
|
1838 | _this.popperJS && _this.updatePopper();
|
1839 | });
|
1840 | },
|
1841 | mounted: function mounted() {
|
1842 | this.$parent.popperElm = this.popperElm = this.$el;
|
1843 | this.referenceElm = this.$parent.$refs.input.$refs.input || this.$parent.$refs.input.$refs.textarea;
|
1844 | this.referenceList = this.$el.querySelector('.el-autocomplete-suggestion__list');
|
1845 | this.referenceList.setAttribute('role', 'listbox');
|
1846 | this.referenceList.setAttribute('id', this.id);
|
1847 | },
|
1848 | created: function created() {
|
1849 | var _this2 = this;
|
1850 |
|
1851 | this.$on('visible', function (val, inputWidth) {
|
1852 | _this2.dropdownWidth = inputWidth + 'px';
|
1853 | _this2.showPopper = val;
|
1854 | });
|
1855 | }
|
1856 | });
|
1857 |
|
1858 | var src_autocomplete_suggestionsvue_type_script_lang_js_ = (autocomplete_suggestionsvue_type_script_lang_js_);
|
1859 |
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 | var autocomplete_suggestions_component = normalizeComponent(
|
1868 | src_autocomplete_suggestionsvue_type_script_lang_js_,
|
1869 | autocomplete_suggestionsvue_type_template_id_cd10dcf0_render,
|
1870 | autocomplete_suggestionsvue_type_template_id_cd10dcf0_staticRenderFns,
|
1871 | false,
|
1872 | null,
|
1873 | null,
|
1874 | null
|
1875 |
|
1876 | )
|
1877 |
|
1878 |
|
1879 | if (false) { var autocomplete_suggestions_api; }
|
1880 | autocomplete_suggestions_component.options.__file = "packages/autocomplete/src/autocomplete-suggestions.vue"
|
1881 | var autocomplete_suggestions = (autocomplete_suggestions_component.exports);
|
1882 |
|
1883 | var focus_ = __webpack_require__(22);
|
1884 | var focus_default = __webpack_require__.n(focus_);
|
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 |
|
1890 |
|
1891 |
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 |
|
1945 |
|
1946 |
|
1947 |
|
1948 |
|
1949 |
|
1950 |
|
1951 |
|
1952 |
|
1953 |
|
1954 |
|
1955 |
|
1956 | var autocompletevue_type_script_lang_js_ = ({
|
1957 | name: 'ElAutocomplete',
|
1958 |
|
1959 | mixins: [emitter_default.a, focus_default()('input'), migrating_default.a],
|
1960 |
|
1961 | inheritAttrs: false,
|
1962 |
|
1963 | componentName: 'ElAutocomplete',
|
1964 |
|
1965 | components: {
|
1966 | ElInput: input_default.a,
|
1967 | ElAutocompleteSuggestions: autocomplete_suggestions
|
1968 | },
|
1969 |
|
1970 | directives: { Clickoutside: clickoutside_default.a },
|
1971 |
|
1972 | props: {
|
1973 | valueKey: {
|
1974 | type: String,
|
1975 | default: 'value'
|
1976 | },
|
1977 | popperClass: String,
|
1978 | popperOptions: Object,
|
1979 | placeholder: String,
|
1980 | clearable: {
|
1981 | type: Boolean,
|
1982 | default: false
|
1983 | },
|
1984 | disabled: Boolean,
|
1985 | name: String,
|
1986 | size: String,
|
1987 | value: String,
|
1988 | maxlength: Number,
|
1989 | minlength: Number,
|
1990 | autofocus: Boolean,
|
1991 | fetchSuggestions: Function,
|
1992 | triggerOnFocus: {
|
1993 | type: Boolean,
|
1994 | default: true
|
1995 | },
|
1996 | customItem: String,
|
1997 | selectWhenUnmatched: {
|
1998 | type: Boolean,
|
1999 | default: false
|
2000 | },
|
2001 | prefixIcon: String,
|
2002 | suffixIcon: String,
|
2003 | label: String,
|
2004 | debounce: {
|
2005 | type: Number,
|
2006 | default: 300
|
2007 | },
|
2008 | placement: {
|
2009 | type: String,
|
2010 | default: 'bottom-start'
|
2011 | },
|
2012 | hideLoading: Boolean,
|
2013 | popperAppendToBody: {
|
2014 | type: Boolean,
|
2015 | default: true
|
2016 | },
|
2017 | highlightFirstItem: {
|
2018 | type: Boolean,
|
2019 | default: false
|
2020 | }
|
2021 | },
|
2022 | data: function data() {
|
2023 | return {
|
2024 | activated: false,
|
2025 | suggestions: [],
|
2026 | loading: false,
|
2027 | highlightedIndex: -1,
|
2028 | suggestionDisabled: false
|
2029 | };
|
2030 | },
|
2031 |
|
2032 | computed: {
|
2033 | suggestionVisible: function suggestionVisible() {
|
2034 | var suggestions = this.suggestions;
|
2035 | var isValidData = Array.isArray(suggestions) && suggestions.length > 0;
|
2036 | return (isValidData || this.loading) && this.activated;
|
2037 | },
|
2038 | id: function id() {
|
2039 | return 'el-autocomplete-' + Object(util_["generateId"])();
|
2040 | }
|
2041 | },
|
2042 | watch: {
|
2043 | suggestionVisible: function suggestionVisible(val) {
|
2044 | var $input = this.getInput();
|
2045 | if ($input) {
|
2046 | this.broadcast('ElAutocompleteSuggestions', 'visible', [val, $input.offsetWidth]);
|
2047 | }
|
2048 | }
|
2049 | },
|
2050 | methods: {
|
2051 | getMigratingConfig: function getMigratingConfig() {
|
2052 | return {
|
2053 | props: {
|
2054 | 'custom-item': 'custom-item is removed, use scoped slot instead.',
|
2055 | 'props': 'props is removed, use value-key instead.'
|
2056 | }
|
2057 | };
|
2058 | },
|
2059 | getData: function getData(queryString) {
|
2060 | var _this = this;
|
2061 |
|
2062 | if (this.suggestionDisabled) {
|
2063 | return;
|
2064 | }
|
2065 | this.loading = true;
|
2066 | this.fetchSuggestions(queryString, function (suggestions) {
|
2067 | _this.loading = false;
|
2068 | if (_this.suggestionDisabled) {
|
2069 | return;
|
2070 | }
|
2071 | if (Array.isArray(suggestions)) {
|
2072 | _this.suggestions = suggestions;
|
2073 | _this.highlightedIndex = _this.highlightFirstItem ? 0 : -1;
|
2074 | } else {
|
2075 | console.error('[Element Error][Autocomplete]autocomplete suggestions must be an array');
|
2076 | }
|
2077 | });
|
2078 | },
|
2079 | handleInput: function handleInput(value) {
|
2080 | this.$emit('input', value);
|
2081 | this.suggestionDisabled = false;
|
2082 | if (!this.triggerOnFocus && !value) {
|
2083 | this.suggestionDisabled = true;
|
2084 | this.suggestions = [];
|
2085 | return;
|
2086 | }
|
2087 | this.debouncedGetData(value);
|
2088 | },
|
2089 | handleChange: function handleChange(value) {
|
2090 | this.$emit('change', value);
|
2091 | },
|
2092 | handleFocus: function handleFocus(event) {
|
2093 | this.activated = true;
|
2094 | this.$emit('focus', event);
|
2095 | if (this.triggerOnFocus) {
|
2096 | this.debouncedGetData(this.value);
|
2097 | }
|
2098 | },
|
2099 | handleBlur: function handleBlur(event) {
|
2100 | this.$emit('blur', event);
|
2101 | },
|
2102 | handleClear: function handleClear() {
|
2103 | this.activated = false;
|
2104 | this.$emit('clear');
|
2105 | },
|
2106 | close: function close(e) {
|
2107 | this.activated = false;
|
2108 | },
|
2109 | handleKeyEnter: function handleKeyEnter(e) {
|
2110 | var _this2 = this;
|
2111 |
|
2112 | if (this.suggestionVisible && this.highlightedIndex >= 0 && this.highlightedIndex < this.suggestions.length) {
|
2113 | e.preventDefault();
|
2114 | this.select(this.suggestions[this.highlightedIndex]);
|
2115 | } else if (this.selectWhenUnmatched) {
|
2116 | this.$emit('select', { value: this.value });
|
2117 | this.$nextTick(function (_) {
|
2118 | _this2.suggestions = [];
|
2119 | _this2.highlightedIndex = -1;
|
2120 | });
|
2121 | }
|
2122 | },
|
2123 | select: function select(item) {
|
2124 | var _this3 = this;
|
2125 |
|
2126 | this.$emit('input', item[this.valueKey]);
|
2127 | this.$emit('select', item);
|
2128 | this.$nextTick(function (_) {
|
2129 | _this3.suggestions = [];
|
2130 | _this3.highlightedIndex = -1;
|
2131 | });
|
2132 | },
|
2133 | highlight: function highlight(index) {
|
2134 | if (!this.suggestionVisible || this.loading) {
|
2135 | return;
|
2136 | }
|
2137 | if (index < 0) {
|
2138 | this.highlightedIndex = -1;
|
2139 | return;
|
2140 | }
|
2141 | if (index >= this.suggestions.length) {
|
2142 | index = this.suggestions.length - 1;
|
2143 | }
|
2144 | var suggestion = this.$refs.suggestions.$el.querySelector('.el-autocomplete-suggestion__wrap');
|
2145 | var suggestionList = suggestion.querySelectorAll('.el-autocomplete-suggestion__list li');
|
2146 |
|
2147 | var highlightItem = suggestionList[index];
|
2148 | var scrollTop = suggestion.scrollTop;
|
2149 | var offsetTop = highlightItem.offsetTop;
|
2150 |
|
2151 | if (offsetTop + highlightItem.scrollHeight > scrollTop + suggestion.clientHeight) {
|
2152 | suggestion.scrollTop += highlightItem.scrollHeight;
|
2153 | }
|
2154 | if (offsetTop < scrollTop) {
|
2155 | suggestion.scrollTop -= highlightItem.scrollHeight;
|
2156 | }
|
2157 | this.highlightedIndex = index;
|
2158 | var $input = this.getInput();
|
2159 | $input.setAttribute('aria-activedescendant', this.id + '-item-' + this.highlightedIndex);
|
2160 | },
|
2161 | getInput: function getInput() {
|
2162 | return this.$refs.input.getInput();
|
2163 | }
|
2164 | },
|
2165 | mounted: function mounted() {
|
2166 | var _this4 = this;
|
2167 |
|
2168 | this.debouncedGetData = debounce_default()(this.debounce, this.getData);
|
2169 | this.$on('item-click', function (item) {
|
2170 | _this4.select(item);
|
2171 | });
|
2172 | var $input = this.getInput();
|
2173 | $input.setAttribute('role', 'textbox');
|
2174 | $input.setAttribute('aria-autocomplete', 'list');
|
2175 | $input.setAttribute('aria-controls', 'id');
|
2176 | $input.setAttribute('aria-activedescendant', this.id + '-item-' + this.highlightedIndex);
|
2177 | },
|
2178 | beforeDestroy: function beforeDestroy() {
|
2179 | this.$refs.suggestions.$destroy();
|
2180 | }
|
2181 | });
|
2182 |
|
2183 | var src_autocompletevue_type_script_lang_js_ = (autocompletevue_type_script_lang_js_);
|
2184 |
|
2185 |
|
2186 |
|
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 | var autocomplete_component = normalizeComponent(
|
2193 | src_autocompletevue_type_script_lang_js_,
|
2194 | autocompletevue_type_template_id_152f2ee6_render,
|
2195 | autocompletevue_type_template_id_152f2ee6_staticRenderFns,
|
2196 | false,
|
2197 | null,
|
2198 | null,
|
2199 | null
|
2200 |
|
2201 | )
|
2202 |
|
2203 |
|
2204 | if (false) { var autocomplete_api; }
|
2205 | autocomplete_component.options.__file = "packages/autocomplete/src/autocomplete.vue"
|
2206 | var autocomplete = (autocomplete_component.exports);
|
2207 |
|
2208 |
|
2209 |
|
2210 |
|
2211 | autocomplete.install = function (Vue) {
|
2212 | Vue.component(autocomplete.name, autocomplete);
|
2213 | };
|
2214 |
|
2215 | var packages_autocomplete = (autocomplete);
|
2216 |
|
2217 | var button_ = __webpack_require__(12);
|
2218 | var button_default = __webpack_require__.n(button_);
|
2219 |
|
2220 |
|
2221 | var button_group_ = __webpack_require__(29);
|
2222 | var button_group_default = __webpack_require__.n(button_group_);
|
2223 |
|
2224 |
|
2225 |
|
2226 |
|
2227 |
|
2228 |
|
2229 |
|
2230 |
|
2231 |
|
2232 |
|
2233 | var dropdownvue_type_script_lang_js_ = ({
|
2234 | name: 'ElDropdown',
|
2235 |
|
2236 | componentName: 'ElDropdown',
|
2237 |
|
2238 | mixins: [emitter_default.a, migrating_default.a],
|
2239 |
|
2240 | directives: { Clickoutside: clickoutside_default.a },
|
2241 |
|
2242 | components: {
|
2243 | ElButton: button_default.a,
|
2244 | ElButtonGroup: button_group_default.a
|
2245 | },
|
2246 |
|
2247 | provide: function provide() {
|
2248 | return {
|
2249 | dropdown: this
|
2250 | };
|
2251 | },
|
2252 |
|
2253 |
|
2254 | props: {
|
2255 | trigger: {
|
2256 | type: String,
|
2257 | default: 'hover'
|
2258 | },
|
2259 | type: String,
|
2260 | size: {
|
2261 | type: String,
|
2262 | default: ''
|
2263 | },
|
2264 | splitButton: Boolean,
|
2265 | hideOnClick: {
|
2266 | type: Boolean,
|
2267 | default: true
|
2268 | },
|
2269 | placement: {
|
2270 | type: String,
|
2271 | default: 'bottom-end'
|
2272 | },
|
2273 | visibleArrow: {
|
2274 | default: true
|
2275 | },
|
2276 | showTimeout: {
|
2277 | type: Number,
|
2278 | default: 250
|
2279 | },
|
2280 | hideTimeout: {
|
2281 | type: Number,
|
2282 | default: 150
|
2283 | },
|
2284 | tabindex: {
|
2285 | type: Number,
|
2286 | default: 0
|
2287 | }
|
2288 | },
|
2289 |
|
2290 | data: function data() {
|
2291 | return {
|
2292 | timeout: null,
|
2293 | visible: false,
|
2294 | triggerElm: null,
|
2295 | menuItems: null,
|
2296 | menuItemsArray: null,
|
2297 | dropdownElm: null,
|
2298 | focusing: false,
|
2299 | listId: 'dropdown-menu-' + Object(util_["generateId"])()
|
2300 | };
|
2301 | },
|
2302 |
|
2303 |
|
2304 | computed: {
|
2305 | dropdownSize: function dropdownSize() {
|
2306 | return this.size || (this.$ELEMENT || {}).size;
|
2307 | }
|
2308 | },
|
2309 |
|
2310 | mounted: function mounted() {
|
2311 | this.$on('menu-item-click', this.handleMenuItemClick);
|
2312 | },
|
2313 |
|
2314 |
|
2315 | watch: {
|
2316 | visible: function visible(val) {
|
2317 | this.broadcast('ElDropdownMenu', 'visible', val);
|
2318 | this.$emit('visible-change', val);
|
2319 | },
|
2320 | focusing: function focusing(val) {
|
2321 | var selfDefine = this.$el.querySelector('.el-dropdown-selfdefine');
|
2322 | if (selfDefine) {
|
2323 |
|
2324 | if (val) {
|
2325 | selfDefine.className += ' focusing';
|
2326 | } else {
|
2327 | selfDefine.className = selfDefine.className.replace('focusing', '');
|
2328 | }
|
2329 | }
|
2330 | }
|
2331 | },
|
2332 |
|
2333 | methods: {
|
2334 | getMigratingConfig: function getMigratingConfig() {
|
2335 | return {
|
2336 | props: {
|
2337 | 'menu-align': 'menu-align is renamed to placement.'
|
2338 | }
|
2339 | };
|
2340 | },
|
2341 | show: function show() {
|
2342 | var _this = this;
|
2343 |
|
2344 | if (this.triggerElm.disabled) return;
|
2345 | clearTimeout(this.timeout);
|
2346 | this.timeout = setTimeout(function () {
|
2347 | _this.visible = true;
|
2348 | }, this.trigger === 'click' ? 0 : this.showTimeout);
|
2349 | },
|
2350 | hide: function hide() {
|
2351 | var _this2 = this;
|
2352 |
|
2353 | if (this.triggerElm.disabled) return;
|
2354 | this.removeTabindex();
|
2355 | if (this.tabindex >= 0) {
|
2356 | this.resetTabindex(this.triggerElm);
|
2357 | }
|
2358 | clearTimeout(this.timeout);
|
2359 | this.timeout = setTimeout(function () {
|
2360 | _this2.visible = false;
|
2361 | }, this.trigger === 'click' ? 0 : this.hideTimeout);
|
2362 | },
|
2363 | handleClick: function handleClick() {
|
2364 | if (this.triggerElm.disabled) return;
|
2365 | if (this.visible) {
|
2366 | this.hide();
|
2367 | } else {
|
2368 | this.show();
|
2369 | }
|
2370 | },
|
2371 | handleTriggerKeyDown: function handleTriggerKeyDown(ev) {
|
2372 | var keyCode = ev.keyCode;
|
2373 | if ([38, 40].indexOf(keyCode) > -1) {
|
2374 |
|
2375 | this.removeTabindex();
|
2376 | this.resetTabindex(this.menuItems[0]);
|
2377 | this.menuItems[0].focus();
|
2378 | ev.preventDefault();
|
2379 | ev.stopPropagation();
|
2380 | } else if (keyCode === 13) {
|
2381 |
|
2382 | this.handleClick();
|
2383 | } else if ([9, 27].indexOf(keyCode) > -1) {
|
2384 |
|
2385 | this.hide();
|
2386 | }
|
2387 | },
|
2388 | handleItemKeyDown: function handleItemKeyDown(ev) {
|
2389 | var keyCode = ev.keyCode;
|
2390 | var target = ev.target;
|
2391 | var currentIndex = this.menuItemsArray.indexOf(target);
|
2392 | var max = this.menuItemsArray.length - 1;
|
2393 | var nextIndex = void 0;
|
2394 | if ([38, 40].indexOf(keyCode) > -1) {
|
2395 |
|
2396 | if (keyCode === 38) {
|
2397 |
|
2398 | nextIndex = currentIndex !== 0 ? currentIndex - 1 : 0;
|
2399 | } else {
|
2400 |
|
2401 | nextIndex = currentIndex < max ? currentIndex + 1 : max;
|
2402 | }
|
2403 | this.removeTabindex();
|
2404 | this.resetTabindex(this.menuItems[nextIndex]);
|
2405 | this.menuItems[nextIndex].focus();
|
2406 | ev.preventDefault();
|
2407 | ev.stopPropagation();
|
2408 | } else if (keyCode === 13) {
|
2409 |
|
2410 | this.triggerElmFocus();
|
2411 | target.click();
|
2412 | if (this.hideOnClick) {
|
2413 |
|
2414 | this.visible = false;
|
2415 | }
|
2416 | } else if ([9, 27].indexOf(keyCode) > -1) {
|
2417 |
|
2418 | this.hide();
|
2419 | this.triggerElmFocus();
|
2420 | }
|
2421 | },
|
2422 | resetTabindex: function resetTabindex(ele) {
|
2423 |
|
2424 | this.removeTabindex();
|
2425 | ele.setAttribute('tabindex', '0');
|
2426 | },
|
2427 | removeTabindex: function removeTabindex() {
|
2428 | this.triggerElm.setAttribute('tabindex', '-1');
|
2429 | this.menuItemsArray.forEach(function (item) {
|
2430 | item.setAttribute('tabindex', '-1');
|
2431 | });
|
2432 | },
|
2433 | initAria: function initAria() {
|
2434 | this.dropdownElm.setAttribute('id', this.listId);
|
2435 | this.triggerElm.setAttribute('aria-haspopup', 'list');
|
2436 | this.triggerElm.setAttribute('aria-controls', this.listId);
|
2437 |
|
2438 | if (!this.splitButton) {
|
2439 |
|
2440 | this.triggerElm.setAttribute('role', 'button');
|
2441 | this.triggerElm.setAttribute('tabindex', this.tabindex);
|
2442 | this.triggerElm.setAttribute('class', (this.triggerElm.getAttribute('class') || '') + ' el-dropdown-selfdefine');
|
2443 | }
|
2444 | },
|
2445 | initEvent: function initEvent() {
|
2446 | var _this3 = this;
|
2447 |
|
2448 | var trigger = this.trigger,
|
2449 | show = this.show,
|
2450 | hide = this.hide,
|
2451 | handleClick = this.handleClick,
|
2452 | splitButton = this.splitButton,
|
2453 | handleTriggerKeyDown = this.handleTriggerKeyDown,
|
2454 | handleItemKeyDown = this.handleItemKeyDown;
|
2455 |
|
2456 | this.triggerElm = splitButton ? this.$refs.trigger.$el : this.$slots.default[0].elm;
|
2457 |
|
2458 | var dropdownElm = this.dropdownElm;
|
2459 |
|
2460 | this.triggerElm.addEventListener('keydown', handleTriggerKeyDown);
|
2461 | dropdownElm.addEventListener('keydown', handleItemKeyDown, true);
|
2462 |
|
2463 | if (!splitButton) {
|
2464 | this.triggerElm.addEventListener('focus', function () {
|
2465 | _this3.focusing = true;
|
2466 | });
|
2467 | this.triggerElm.addEventListener('blur', function () {
|
2468 | _this3.focusing = false;
|
2469 | });
|
2470 | this.triggerElm.addEventListener('click', function () {
|
2471 | _this3.focusing = false;
|
2472 | });
|
2473 | }
|
2474 | if (trigger === 'hover') {
|
2475 | this.triggerElm.addEventListener('mouseenter', show);
|
2476 | this.triggerElm.addEventListener('mouseleave', hide);
|
2477 | dropdownElm.addEventListener('mouseenter', show);
|
2478 | dropdownElm.addEventListener('mouseleave', hide);
|
2479 | } else if (trigger === 'click') {
|
2480 | this.triggerElm.addEventListener('click', handleClick);
|
2481 | }
|
2482 | },
|
2483 | handleMenuItemClick: function handleMenuItemClick(command, instance) {
|
2484 | if (this.hideOnClick) {
|
2485 | this.visible = false;
|
2486 | }
|
2487 | this.$emit('command', command, instance);
|
2488 | },
|
2489 | triggerElmFocus: function triggerElmFocus() {
|
2490 | this.triggerElm.focus && this.triggerElm.focus();
|
2491 | },
|
2492 | initDomOperation: function initDomOperation() {
|
2493 | this.dropdownElm = this.popperElm;
|
2494 | this.menuItems = this.dropdownElm.querySelectorAll("[tabindex='-1']");
|
2495 | this.menuItemsArray = [].slice.call(this.menuItems);
|
2496 |
|
2497 | this.initEvent();
|
2498 | this.initAria();
|
2499 | }
|
2500 | },
|
2501 |
|
2502 | render: function render(h) {
|
2503 | var _this4 = this;
|
2504 |
|
2505 | var hide = this.hide,
|
2506 | splitButton = this.splitButton,
|
2507 | type = this.type,
|
2508 | dropdownSize = this.dropdownSize;
|
2509 |
|
2510 |
|
2511 | var handleMainButtonClick = function handleMainButtonClick(event) {
|
2512 | _this4.$emit('click', event);
|
2513 | hide();
|
2514 | };
|
2515 |
|
2516 | var triggerElm = !splitButton ? this.$slots.default : h('el-button-group', [h(
|
2517 | 'el-button',
|
2518 | {
|
2519 | attrs: { type: type, size: dropdownSize },
|
2520 | nativeOn: {
|
2521 | 'click': handleMainButtonClick
|
2522 | }
|
2523 | },
|
2524 | [this.$slots.default]
|
2525 | ), h(
|
2526 | 'el-button',
|
2527 | { ref: 'trigger', attrs: { type: type, size: dropdownSize },
|
2528 | 'class': 'el-dropdown__caret-button' },
|
2529 | [h('i', { 'class': 'el-dropdown__icon el-icon-arrow-down' })]
|
2530 | )]);
|
2531 |
|
2532 | return h(
|
2533 | 'div',
|
2534 | { 'class': 'el-dropdown', directives: [{
|
2535 | name: 'clickoutside',
|
2536 | value: hide
|
2537 | }]
|
2538 | },
|
2539 | [triggerElm, this.$slots.dropdown]
|
2540 | );
|
2541 | }
|
2542 | });
|
2543 |
|
2544 | var src_dropdownvue_type_script_lang_js_ = (dropdownvue_type_script_lang_js_);
|
2545 |
|
2546 | var dropdown_render, dropdown_staticRenderFns
|
2547 |
|
2548 |
|
2549 |
|
2550 |
|
2551 |
|
2552 |
|
2553 | var dropdown_component = normalizeComponent(
|
2554 | src_dropdownvue_type_script_lang_js_,
|
2555 | dropdown_render,
|
2556 | dropdown_staticRenderFns,
|
2557 | false,
|
2558 | null,
|
2559 | null,
|
2560 | null
|
2561 |
|
2562 | )
|
2563 |
|
2564 |
|
2565 | if (false) { var dropdown_api; }
|
2566 | dropdown_component.options.__file = "packages/dropdown/src/dropdown.vue"
|
2567 | var dropdown = (dropdown_component.exports);
|
2568 |
|
2569 |
|
2570 |
|
2571 |
|
2572 | dropdown.install = function (Vue) {
|
2573 | Vue.component(dropdown.name, dropdown);
|
2574 | };
|
2575 |
|
2576 | var packages_dropdown = (dropdown);
|
2577 |
|
2578 | var dropdown_menuvue_type_template_id_0da6b714_render = function() {
|
2579 | var _vm = this
|
2580 | var _h = _vm.$createElement
|
2581 | var _c = _vm._self._c || _h
|
2582 | return _c(
|
2583 | "transition",
|
2584 | { attrs: { name: "el-zoom-in-top" }, on: { "after-leave": _vm.doDestroy } },
|
2585 | [
|
2586 | _c(
|
2587 | "ul",
|
2588 | {
|
2589 | directives: [
|
2590 | {
|
2591 | name: "show",
|
2592 | rawName: "v-show",
|
2593 | value: _vm.showPopper,
|
2594 | expression: "showPopper"
|
2595 | }
|
2596 | ],
|
2597 | staticClass: "el-dropdown-menu el-popper",
|
2598 | class: [_vm.size && "el-dropdown-menu--" + _vm.size]
|
2599 | },
|
2600 | [_vm._t("default")],
|
2601 | 2
|
2602 | )
|
2603 | ]
|
2604 | )
|
2605 | }
|
2606 | var dropdown_menuvue_type_template_id_0da6b714_staticRenderFns = []
|
2607 | dropdown_menuvue_type_template_id_0da6b714_render._withStripped = true
|
2608 |
|
2609 |
|
2610 |
|
2611 |
|
2612 |
|
2613 |
|
2614 |
|
2615 |
|
2616 |
|
2617 |
|
2618 |
|
2619 |
|
2620 |
|
2621 |
|
2622 |
|
2623 | var dropdown_menuvue_type_script_lang_js_ = ({
|
2624 | name: 'ElDropdownMenu',
|
2625 |
|
2626 | componentName: 'ElDropdownMenu',
|
2627 |
|
2628 | mixins: [vue_popper_default.a],
|
2629 |
|
2630 | props: {
|
2631 | visibleArrow: {
|
2632 | type: Boolean,
|
2633 | default: true
|
2634 | },
|
2635 | arrowOffset: {
|
2636 | type: Number,
|
2637 | default: 0
|
2638 | }
|
2639 | },
|
2640 |
|
2641 | data: function data() {
|
2642 | return {
|
2643 | size: this.dropdown.dropdownSize
|
2644 | };
|
2645 | },
|
2646 |
|
2647 |
|
2648 | inject: ['dropdown'],
|
2649 |
|
2650 | created: function created() {
|
2651 | var _this = this;
|
2652 |
|
2653 | this.$on('updatePopper', function () {
|
2654 | if (_this.showPopper) _this.updatePopper();
|
2655 | });
|
2656 | this.$on('visible', function (val) {
|
2657 | _this.showPopper = val;
|
2658 | });
|
2659 | },
|
2660 | mounted: function mounted() {
|
2661 | this.dropdown.popperElm = this.popperElm = this.$el;
|
2662 | this.referenceElm = this.dropdown.$el;
|
2663 |
|
2664 |
|
2665 | this.dropdown.initDomOperation();
|
2666 | },
|
2667 |
|
2668 |
|
2669 | watch: {
|
2670 | 'dropdown.placement': {
|
2671 | immediate: true,
|
2672 | handler: function handler(val) {
|
2673 | this.currentPlacement = val;
|
2674 | }
|
2675 | }
|
2676 | }
|
2677 | });
|
2678 |
|
2679 | var src_dropdown_menuvue_type_script_lang_js_ = (dropdown_menuvue_type_script_lang_js_);
|
2680 |
|
2681 |
|
2682 |
|
2683 |
|
2684 |
|
2685 |
|
2686 |
|
2687 |
|
2688 | var dropdown_menu_component = normalizeComponent(
|
2689 | src_dropdown_menuvue_type_script_lang_js_,
|
2690 | dropdown_menuvue_type_template_id_0da6b714_render,
|
2691 | dropdown_menuvue_type_template_id_0da6b714_staticRenderFns,
|
2692 | false,
|
2693 | null,
|
2694 | null,
|
2695 | null
|
2696 |
|
2697 | )
|
2698 |
|
2699 |
|
2700 | if (false) { var dropdown_menu_api; }
|
2701 | dropdown_menu_component.options.__file = "packages/dropdown/src/dropdown-menu.vue"
|
2702 | var dropdown_menu = (dropdown_menu_component.exports);
|
2703 |
|
2704 |
|
2705 |
|
2706 |
|
2707 | dropdown_menu.install = function (Vue) {
|
2708 | Vue.component(dropdown_menu.name, dropdown_menu);
|
2709 | };
|
2710 |
|
2711 | var packages_dropdown_menu = (dropdown_menu);
|
2712 |
|
2713 | var dropdown_itemvue_type_template_id_6359102a_render = function() {
|
2714 | var _vm = this
|
2715 | var _h = _vm.$createElement
|
2716 | var _c = _vm._self._c || _h
|
2717 | return _c(
|
2718 | "li",
|
2719 | {
|
2720 | staticClass: "el-dropdown-menu__item",
|
2721 | class: {
|
2722 | "is-disabled": _vm.disabled,
|
2723 | "el-dropdown-menu__item--divided": _vm.divided
|
2724 | },
|
2725 | attrs: {
|
2726 | "aria-disabled": _vm.disabled,
|
2727 | tabindex: _vm.disabled ? null : -1
|
2728 | },
|
2729 | on: { click: _vm.handleClick }
|
2730 | },
|
2731 | [_vm.icon ? _c("i", { class: _vm.icon }) : _vm._e(), _vm._t("default")],
|
2732 | 2
|
2733 | )
|
2734 | }
|
2735 | var dropdown_itemvue_type_template_id_6359102a_staticRenderFns = []
|
2736 | dropdown_itemvue_type_template_id_6359102a_render._withStripped = true
|
2737 |
|
2738 |
|
2739 |
|
2740 |
|
2741 |
|
2742 |
|
2743 |
|
2744 |
|
2745 |
|
2746 |
|
2747 |
|
2748 |
|
2749 |
|
2750 |
|
2751 |
|
2752 |
|
2753 |
|
2754 |
|
2755 |
|
2756 |
|
2757 |
|
2758 |
|
2759 |
|
2760 | var dropdown_itemvue_type_script_lang_js_ = ({
|
2761 | name: 'ElDropdownItem',
|
2762 |
|
2763 | mixins: [emitter_default.a],
|
2764 |
|
2765 | props: {
|
2766 | command: {},
|
2767 | disabled: Boolean,
|
2768 | divided: Boolean,
|
2769 | icon: String
|
2770 | },
|
2771 |
|
2772 | methods: {
|
2773 | handleClick: function handleClick(e) {
|
2774 | this.dispatch('ElDropdown', 'menu-item-click', [this.command, this]);
|
2775 | }
|
2776 | }
|
2777 | });
|
2778 |
|
2779 | var src_dropdown_itemvue_type_script_lang_js_ = (dropdown_itemvue_type_script_lang_js_);
|
2780 |
|
2781 |
|
2782 |
|
2783 |
|
2784 |
|
2785 |
|
2786 |
|
2787 |
|
2788 | var dropdown_item_component = normalizeComponent(
|
2789 | src_dropdown_itemvue_type_script_lang_js_,
|
2790 | dropdown_itemvue_type_template_id_6359102a_render,
|
2791 | dropdown_itemvue_type_template_id_6359102a_staticRenderFns,
|
2792 | false,
|
2793 | null,
|
2794 | null,
|
2795 | null
|
2796 |
|
2797 | )
|
2798 |
|
2799 |
|
2800 | if (false) { var dropdown_item_api; }
|
2801 | dropdown_item_component.options.__file = "packages/dropdown/src/dropdown-item.vue"
|
2802 | var dropdown_item = (dropdown_item_component.exports);
|
2803 |
|
2804 |
|
2805 |
|
2806 |
|
2807 | dropdown_item.install = function (Vue) {
|
2808 | Vue.component(dropdown_item.name, dropdown_item);
|
2809 | };
|
2810 |
|
2811 | var packages_dropdown_item = (dropdown_item);
|
2812 |
|
2813 | var aria = aria || {};
|
2814 |
|
2815 | aria.Utils = aria.Utils || {};
|
2816 |
|
2817 |
|
2818 |
|
2819 |
|
2820 |
|
2821 |
|
2822 |
|
2823 |
|
2824 |
|
2825 | aria.Utils.focusFirstDescendant = function (element) {
|
2826 | for (var i = 0; i < element.childNodes.length; i++) {
|
2827 | var child = element.childNodes[i];
|
2828 | if (aria.Utils.attemptFocus(child) || aria.Utils.focusFirstDescendant(child)) {
|
2829 | return true;
|
2830 | }
|
2831 | }
|
2832 | return false;
|
2833 | };
|
2834 |
|
2835 |
|
2836 |
|
2837 |
|
2838 |
|
2839 |
|
2840 |
|
2841 |
|
2842 |
|
2843 | aria.Utils.focusLastDescendant = function (element) {
|
2844 | for (var i = element.childNodes.length - 1; i >= 0; i--) {
|
2845 | var child = element.childNodes[i];
|
2846 | if (aria.Utils.attemptFocus(child) || aria.Utils.focusLastDescendant(child)) {
|
2847 | return true;
|
2848 | }
|
2849 | }
|
2850 | return false;
|
2851 | };
|
2852 |
|
2853 |
|
2854 |
|
2855 |
|
2856 |
|
2857 |
|
2858 |
|
2859 |
|
2860 | aria.Utils.attemptFocus = function (element) {
|
2861 | if (!aria.Utils.isFocusable(element)) {
|
2862 | return false;
|
2863 | }
|
2864 | aria.Utils.IgnoreUtilFocusChanges = true;
|
2865 | try {
|
2866 | element.focus();
|
2867 | } catch (e) {}
|
2868 | aria.Utils.IgnoreUtilFocusChanges = false;
|
2869 | return document.activeElement === element;
|
2870 | };
|
2871 |
|
2872 | aria.Utils.isFocusable = function (element) {
|
2873 | if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute('tabIndex') !== null) {
|
2874 | return true;
|
2875 | }
|
2876 |
|
2877 | if (element.disabled) {
|
2878 | return false;
|
2879 | }
|
2880 |
|
2881 | switch (element.nodeName) {
|
2882 | case 'A':
|
2883 | return !!element.href && element.rel !== 'ignore';
|
2884 | case 'INPUT':
|
2885 | return element.type !== 'hidden' && element.type !== 'file';
|
2886 | case 'BUTTON':
|
2887 | case 'SELECT':
|
2888 | case 'TEXTAREA':
|
2889 | return true;
|
2890 | default:
|
2891 | return false;
|
2892 | }
|
2893 | };
|
2894 |
|
2895 |
|
2896 |
|
2897 |
|
2898 |
|
2899 |
|
2900 |
|
2901 |
|
2902 | aria.Utils.triggerEvent = function (elm, name) {
|
2903 | var eventName = void 0;
|
2904 |
|
2905 | if (/^mouse|click/.test(name)) {
|
2906 | eventName = 'MouseEvents';
|
2907 | } else if (/^key/.test(name)) {
|
2908 | eventName = 'KeyboardEvent';
|
2909 | } else {
|
2910 | eventName = 'HTMLEvents';
|
2911 | }
|
2912 | var evt = document.createEvent(eventName);
|
2913 |
|
2914 | for (var _len = arguments.length, opts = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
2915 | opts[_key - 2] = arguments[_key];
|
2916 | }
|
2917 |
|
2918 | evt.initEvent.apply(evt, [name].concat(opts));
|
2919 | elm.dispatchEvent ? elm.dispatchEvent(evt) : elm.fireEvent('on' + name, evt);
|
2920 |
|
2921 | return elm;
|
2922 | };
|
2923 |
|
2924 | aria.Utils.keys = {
|
2925 | tab: 9,
|
2926 | enter: 13,
|
2927 | space: 32,
|
2928 | left: 37,
|
2929 | up: 38,
|
2930 | right: 39,
|
2931 | down: 40,
|
2932 | esc: 27
|
2933 | };
|
2934 |
|
2935 | var aria_utils = (aria.Utils);
|
2936 |
|
2937 |
|
2938 |
|
2939 | var SubMenu = function SubMenu(parent, domNode) {
|
2940 | this.domNode = domNode;
|
2941 | this.parent = parent;
|
2942 | this.subMenuItems = [];
|
2943 | this.subIndex = 0;
|
2944 | this.init();
|
2945 | };
|
2946 |
|
2947 | SubMenu.prototype.init = function () {
|
2948 | this.subMenuItems = this.domNode.querySelectorAll('li');
|
2949 | this.addListeners();
|
2950 | };
|
2951 |
|
2952 | SubMenu.prototype.gotoSubIndex = function (idx) {
|
2953 | if (idx === this.subMenuItems.length) {
|
2954 | idx = 0;
|
2955 | } else if (idx < 0) {
|
2956 | idx = this.subMenuItems.length - 1;
|
2957 | }
|
2958 | this.subMenuItems[idx].focus();
|
2959 | this.subIndex = idx;
|
2960 | };
|
2961 |
|
2962 | SubMenu.prototype.addListeners = function () {
|
2963 | var _this = this;
|
2964 |
|
2965 | var keys = aria_utils.keys;
|
2966 | var parentNode = this.parent.domNode;
|
2967 | Array.prototype.forEach.call(this.subMenuItems, function (el) {
|
2968 | el.addEventListener('keydown', function (event) {
|
2969 | var prevDef = false;
|
2970 | switch (event.keyCode) {
|
2971 | case keys.down:
|
2972 | _this.gotoSubIndex(_this.subIndex + 1);
|
2973 | prevDef = true;
|
2974 | break;
|
2975 | case keys.up:
|
2976 | _this.gotoSubIndex(_this.subIndex - 1);
|
2977 | prevDef = true;
|
2978 | break;
|
2979 | case keys.tab:
|
2980 | aria_utils.triggerEvent(parentNode, 'mouseleave');
|
2981 | break;
|
2982 | case keys.enter:
|
2983 | case keys.space:
|
2984 | prevDef = true;
|
2985 | event.currentTarget.click();
|
2986 | break;
|
2987 | }
|
2988 | if (prevDef) {
|
2989 | event.preventDefault();
|
2990 | event.stopPropagation();
|
2991 | }
|
2992 | return false;
|
2993 | });
|
2994 | });
|
2995 | };
|
2996 |
|
2997 | var aria_submenu = (SubMenu);
|
2998 |
|
2999 |
|
3000 |
|
3001 |
|
3002 | var MenuItem = function MenuItem(domNode) {
|
3003 | this.domNode = domNode;
|
3004 | this.submenu = null;
|
3005 | this.init();
|
3006 | };
|
3007 |
|
3008 | MenuItem.prototype.init = function () {
|
3009 | this.domNode.setAttribute('tabindex', '0');
|
3010 | var menuChild = this.domNode.querySelector('.el-menu');
|
3011 | if (menuChild) {
|
3012 | this.submenu = new aria_submenu(this, menuChild);
|
3013 | }
|
3014 | this.addListeners();
|
3015 | };
|
3016 |
|
3017 | MenuItem.prototype.addListeners = function () {
|
3018 | var _this = this;
|
3019 |
|
3020 | var keys = aria_utils.keys;
|
3021 | this.domNode.addEventListener('keydown', function (event) {
|
3022 | var prevDef = false;
|
3023 | switch (event.keyCode) {
|
3024 | case keys.down:
|
3025 | aria_utils.triggerEvent(event.currentTarget, 'mouseenter');
|
3026 | _this.submenu && _this.submenu.gotoSubIndex(0);
|
3027 | prevDef = true;
|
3028 | break;
|
3029 | case keys.up:
|
3030 | aria_utils.triggerEvent(event.currentTarget, 'mouseenter');
|
3031 | _this.submenu && _this.submenu.gotoSubIndex(_this.submenu.subMenuItems.length - 1);
|
3032 | prevDef = true;
|
3033 | break;
|
3034 | case keys.tab:
|
3035 | aria_utils.triggerEvent(event.currentTarget, 'mouseleave');
|
3036 | break;
|
3037 | case keys.enter:
|
3038 | case keys.space:
|
3039 | prevDef = true;
|
3040 | event.currentTarget.click();
|
3041 | break;
|
3042 | }
|
3043 | if (prevDef) {
|
3044 | event.preventDefault();
|
3045 | }
|
3046 | });
|
3047 | };
|
3048 |
|
3049 | var aria_menuitem = (MenuItem);
|
3050 |
|
3051 |
|
3052 |
|
3053 | var Menu = function Menu(domNode) {
|
3054 | this.domNode = domNode;
|
3055 | this.init();
|
3056 | };
|
3057 |
|
3058 | Menu.prototype.init = function () {
|
3059 | var menuChildren = this.domNode.childNodes;
|
3060 | [].filter.call(menuChildren, function (child) {
|
3061 | return child.nodeType === 1;
|
3062 | }).forEach(function (child) {
|
3063 | new aria_menuitem(child);
|
3064 | });
|
3065 | };
|
3066 | var aria_menubar = (Menu);
|
3067 |
|
3068 | var dom_ = __webpack_require__(1);
|
3069 |
|
3070 |
|
3071 |
|
3072 |
|
3073 |
|
3074 |
|
3075 |
|
3076 |
|
3077 | var menuvue_type_script_lang_js_ = ({
|
3078 | name: 'ElMenu',
|
3079 |
|
3080 | render: function render(h) {
|
3081 | var component = h(
|
3082 | 'ul',
|
3083 | {
|
3084 | attrs: {
|
3085 | role: 'menubar'
|
3086 | },
|
3087 | key: +this.collapse,
|
3088 | style: { backgroundColor: this.backgroundColor || '' },
|
3089 | 'class': {
|
3090 | 'el-menu--horizontal': this.mode === 'horizontal',
|
3091 | 'el-menu--collapse': this.collapse,
|
3092 | "el-menu": true
|
3093 | }
|
3094 | },
|
3095 | [this.$slots.default]
|
3096 | );
|
3097 |
|
3098 | if (this.collapseTransition) {
|
3099 | return h('el-menu-collapse-transition', [component]);
|
3100 | } else {
|
3101 | return component;
|
3102 | }
|
3103 | },
|
3104 |
|
3105 |
|
3106 | componentName: 'ElMenu',
|
3107 |
|
3108 | mixins: [emitter_default.a, migrating_default.a],
|
3109 |
|
3110 | provide: function provide() {
|
3111 | return {
|
3112 | rootMenu: this
|
3113 | };
|
3114 | },
|
3115 |
|
3116 |
|
3117 | components: {
|
3118 | 'el-menu-collapse-transition': {
|
3119 | functional: true,
|
3120 | render: function render(createElement, context) {
|
3121 | var data = {
|
3122 | props: {
|
3123 | mode: 'out-in'
|
3124 | },
|
3125 | on: {
|
3126 | beforeEnter: function beforeEnter(el) {
|
3127 | el.style.opacity = 0.2;
|
3128 | },
|
3129 | enter: function enter(el) {
|
3130 | Object(dom_["addClass"])(el, 'el-opacity-transition');
|
3131 | el.style.opacity = 1;
|
3132 | },
|
3133 | afterEnter: function afterEnter(el) {
|
3134 | Object(dom_["removeClass"])(el, 'el-opacity-transition');
|
3135 | el.style.opacity = '';
|
3136 | },
|
3137 | beforeLeave: function beforeLeave(el) {
|
3138 | if (!el.dataset) el.dataset = {};
|
3139 |
|
3140 | if (Object(dom_["hasClass"])(el, 'el-menu--collapse')) {
|
3141 | Object(dom_["removeClass"])(el, 'el-menu--collapse');
|
3142 | el.dataset.oldOverflow = el.style.overflow;
|
3143 | el.dataset.scrollWidth = el.clientWidth;
|
3144 | Object(dom_["addClass"])(el, 'el-menu--collapse');
|
3145 | } else {
|
3146 | Object(dom_["addClass"])(el, 'el-menu--collapse');
|
3147 | el.dataset.oldOverflow = el.style.overflow;
|
3148 | el.dataset.scrollWidth = el.clientWidth;
|
3149 | Object(dom_["removeClass"])(el, 'el-menu--collapse');
|
3150 | }
|
3151 |
|
3152 | el.style.width = el.scrollWidth + 'px';
|
3153 | el.style.overflow = 'hidden';
|
3154 | },
|
3155 | leave: function leave(el) {
|
3156 | Object(dom_["addClass"])(el, 'horizontal-collapse-transition');
|
3157 | el.style.width = el.dataset.scrollWidth + 'px';
|
3158 | }
|
3159 | }
|
3160 | };
|
3161 | return createElement('transition', data, context.children);
|
3162 | }
|
3163 | }
|
3164 | },
|
3165 |
|
3166 | props: {
|
3167 | mode: {
|
3168 | type: String,
|
3169 | default: 'vertical'
|
3170 | },
|
3171 | defaultActive: {
|
3172 | type: String,
|
3173 | default: ''
|
3174 | },
|
3175 | defaultOpeneds: Array,
|
3176 | uniqueOpened: Boolean,
|
3177 | router: Boolean,
|
3178 | menuTrigger: {
|
3179 | type: String,
|
3180 | default: 'hover'
|
3181 | },
|
3182 | collapse: Boolean,
|
3183 | backgroundColor: String,
|
3184 | textColor: String,
|
3185 | activeTextColor: String,
|
3186 | collapseTransition: {
|
3187 | type: Boolean,
|
3188 | default: true
|
3189 | }
|
3190 | },
|
3191 | data: function data() {
|
3192 | return {
|
3193 | activeIndex: this.defaultActive,
|
3194 | openedMenus: this.defaultOpeneds && !this.collapse ? this.defaultOpeneds.slice(0) : [],
|
3195 | items: {},
|
3196 | submenus: {}
|
3197 | };
|
3198 | },
|
3199 |
|
3200 | computed: {
|
3201 | hoverBackground: function hoverBackground() {
|
3202 | return this.backgroundColor ? this.mixColor(this.backgroundColor, 0.2) : '';
|
3203 | },
|
3204 | isMenuPopup: function isMenuPopup() {
|
3205 | return this.mode === 'horizontal' || this.mode === 'vertical' && this.collapse;
|
3206 | }
|
3207 | },
|
3208 | watch: {
|
3209 | defaultActive: function defaultActive(value) {
|
3210 | if (!this.items[value]) {
|
3211 | this.activeIndex = null;
|
3212 | }
|
3213 | this.updateActiveIndex(value);
|
3214 | },
|
3215 | defaultOpeneds: function defaultOpeneds(value) {
|
3216 | if (!this.collapse) {
|
3217 | this.openedMenus = value;
|
3218 | }
|
3219 | },
|
3220 | collapse: function collapse(value) {
|
3221 | if (value) this.openedMenus = [];
|
3222 | this.broadcast('ElSubmenu', 'toggle-collapse', value);
|
3223 | }
|
3224 | },
|
3225 | methods: {
|
3226 | updateActiveIndex: function updateActiveIndex(val) {
|
3227 | var item = this.items[val] || this.items[this.activeIndex] || this.items[this.defaultActive];
|
3228 | if (item) {
|
3229 | this.activeIndex = item.index;
|
3230 | this.initOpenedMenu();
|
3231 | } else {
|
3232 | this.activeIndex = null;
|
3233 | }
|
3234 | },
|
3235 | getMigratingConfig: function getMigratingConfig() {
|
3236 | return {
|
3237 | props: {
|
3238 | 'theme': 'theme is removed.'
|
3239 | }
|
3240 | };
|
3241 | },
|
3242 | getColorChannels: function getColorChannels(color) {
|
3243 | color = color.replace('#', '');
|
3244 | if (/^[0-9a-fA-F]{3}$/.test(color)) {
|
3245 | color = color.split('');
|
3246 | for (var i = 2; i >= 0; i--) {
|
3247 | color.splice(i, 0, color[i]);
|
3248 | }
|
3249 | color = color.join('');
|
3250 | }
|
3251 | if (/^[0-9a-fA-F]{6}$/.test(color)) {
|
3252 | return {
|
3253 | red: parseInt(color.slice(0, 2), 16),
|
3254 | green: parseInt(color.slice(2, 4), 16),
|
3255 | blue: parseInt(color.slice(4, 6), 16)
|
3256 | };
|
3257 | } else {
|
3258 | return {
|
3259 | red: 255,
|
3260 | green: 255,
|
3261 | blue: 255
|
3262 | };
|
3263 | }
|
3264 | },
|
3265 | mixColor: function mixColor(color, percent) {
|
3266 | var _getColorChannels = this.getColorChannels(color),
|
3267 | red = _getColorChannels.red,
|
3268 | green = _getColorChannels.green,
|
3269 | blue = _getColorChannels.blue;
|
3270 |
|
3271 | if (percent > 0) {
|
3272 |
|
3273 | red *= 1 - percent;
|
3274 | green *= 1 - percent;
|
3275 | blue *= 1 - percent;
|
3276 | } else {
|
3277 |
|
3278 | red += (255 - red) * percent;
|
3279 | green += (255 - green) * percent;
|
3280 | blue += (255 - blue) * percent;
|
3281 | }
|
3282 | return 'rgb(' + Math.round(red) + ', ' + Math.round(green) + ', ' + Math.round(blue) + ')';
|
3283 | },
|
3284 | addItem: function addItem(item) {
|
3285 | this.$set(this.items, item.index, item);
|
3286 | },
|
3287 | removeItem: function removeItem(item) {
|
3288 | delete this.items[item.index];
|
3289 | },
|
3290 | addSubmenu: function addSubmenu(item) {
|
3291 | this.$set(this.submenus, item.index, item);
|
3292 | },
|
3293 | removeSubmenu: function removeSubmenu(item) {
|
3294 | delete this.submenus[item.index];
|
3295 | },
|
3296 | openMenu: function openMenu(index, indexPath) {
|
3297 | var openedMenus = this.openedMenus;
|
3298 | if (openedMenus.indexOf(index) !== -1) return;
|
3299 |
|
3300 |
|
3301 | if (this.uniqueOpened) {
|
3302 | this.openedMenus = openedMenus.filter(function (index) {
|
3303 | return indexPath.indexOf(index) !== -1;
|
3304 | });
|
3305 | }
|
3306 | this.openedMenus.push(index);
|
3307 | },
|
3308 | closeMenu: function closeMenu(index) {
|
3309 | var i = this.openedMenus.indexOf(index);
|
3310 | if (i !== -1) {
|
3311 | this.openedMenus.splice(i, 1);
|
3312 | }
|
3313 | },
|
3314 | handleSubmenuClick: function handleSubmenuClick(submenu) {
|
3315 | var index = submenu.index,
|
3316 | indexPath = submenu.indexPath;
|
3317 |
|
3318 | var isOpened = this.openedMenus.indexOf(index) !== -1;
|
3319 |
|
3320 | if (isOpened) {
|
3321 | this.closeMenu(index);
|
3322 | this.$emit('close', index, indexPath);
|
3323 | } else {
|
3324 | this.openMenu(index, indexPath);
|
3325 | this.$emit('open', index, indexPath);
|
3326 | }
|
3327 | },
|
3328 | handleItemClick: function handleItemClick(item) {
|
3329 | var _this = this;
|
3330 |
|
3331 | var index = item.index,
|
3332 | indexPath = item.indexPath;
|
3333 |
|
3334 | var oldActiveIndex = this.activeIndex;
|
3335 | var hasIndex = item.index !== null;
|
3336 |
|
3337 | if (hasIndex) {
|
3338 | this.activeIndex = item.index;
|
3339 | }
|
3340 |
|
3341 | this.$emit('select', index, indexPath, item);
|
3342 |
|
3343 | if (this.mode === 'horizontal' || this.collapse) {
|
3344 | this.openedMenus = [];
|
3345 | }
|
3346 |
|
3347 | if (this.router && hasIndex) {
|
3348 | this.routeToItem(item, function (error) {
|
3349 | _this.activeIndex = oldActiveIndex;
|
3350 | if (error) {
|
3351 |
|
3352 |
|
3353 | if (error.name === 'NavigationDuplicated') return;
|
3354 | console.error(error);
|
3355 | }
|
3356 | });
|
3357 | }
|
3358 | },
|
3359 |
|
3360 |
|
3361 |
|
3362 | initOpenedMenu: function initOpenedMenu() {
|
3363 | var _this2 = this;
|
3364 |
|
3365 | var index = this.activeIndex;
|
3366 | var activeItem = this.items[index];
|
3367 | if (!activeItem || this.mode === 'horizontal' || this.collapse) return;
|
3368 |
|
3369 | var indexPath = activeItem.indexPath;
|
3370 |
|
3371 |
|
3372 |
|
3373 | indexPath.forEach(function (index) {
|
3374 | var submenu = _this2.submenus[index];
|
3375 | submenu && _this2.openMenu(index, submenu.indexPath);
|
3376 | });
|
3377 | },
|
3378 | routeToItem: function routeToItem(item, onError) {
|
3379 | var route = item.route || item.index;
|
3380 | try {
|
3381 | this.$router.push(route, function () {}, onError);
|
3382 | } catch (e) {
|
3383 | console.error(e);
|
3384 | }
|
3385 | },
|
3386 | open: function open(index) {
|
3387 | var _this3 = this;
|
3388 |
|
3389 | var indexPath = this.submenus[index.toString()].indexPath;
|
3390 |
|
3391 | indexPath.forEach(function (i) {
|
3392 | return _this3.openMenu(i, indexPath);
|
3393 | });
|
3394 | },
|
3395 | close: function close(index) {
|
3396 | this.closeMenu(index);
|
3397 | }
|
3398 | },
|
3399 | mounted: function mounted() {
|
3400 | this.initOpenedMenu();
|
3401 | this.$on('item-click', this.handleItemClick);
|
3402 | this.$on('submenu-click', this.handleSubmenuClick);
|
3403 | if (this.mode === 'horizontal') {
|
3404 | new aria_menubar(this.$el);
|
3405 | }
|
3406 | this.$watch('items', this.updateActiveIndex);
|
3407 | }
|
3408 | });
|
3409 |
|
3410 | var src_menuvue_type_script_lang_js_ = (menuvue_type_script_lang_js_);
|
3411 |
|
3412 | var menu_render, menu_staticRenderFns
|
3413 |
|
3414 |
|
3415 |
|
3416 |
|
3417 |
|
3418 |
|
3419 | var menu_component = normalizeComponent(
|
3420 | src_menuvue_type_script_lang_js_,
|
3421 | menu_render,
|
3422 | menu_staticRenderFns,
|
3423 | false,
|
3424 | null,
|
3425 | null,
|
3426 | null
|
3427 |
|
3428 | )
|
3429 |
|
3430 |
|
3431 | if (false) { var menu_api; }
|
3432 | menu_component.options.__file = "packages/menu/src/menu.vue"
|
3433 | var src_menu = (menu_component.exports);
|
3434 |
|
3435 |
|
3436 |
|
3437 |
|
3438 | src_menu.install = function (Vue) {
|
3439 | Vue.component(src_menu.name, src_menu);
|
3440 | };
|
3441 |
|
3442 | var packages_menu = (src_menu);
|
3443 |
|
3444 | var collapse_transition_ = __webpack_require__(21);
|
3445 | var collapse_transition_default = __webpack_require__.n(collapse_transition_);
|
3446 |
|
3447 |
|
3448 | var menu_mixin = ({
|
3449 | inject: ['rootMenu'],
|
3450 | computed: {
|
3451 | indexPath: function indexPath() {
|
3452 | var path = [this.index];
|
3453 | var parent = this.$parent;
|
3454 | while (parent.$options.componentName !== 'ElMenu') {
|
3455 | if (parent.index) {
|
3456 | path.unshift(parent.index);
|
3457 | }
|
3458 | parent = parent.$parent;
|
3459 | }
|
3460 | return path;
|
3461 | },
|
3462 | parentMenu: function parentMenu() {
|
3463 | var parent = this.$parent;
|
3464 | while (parent && ['ElMenu', 'ElSubmenu'].indexOf(parent.$options.componentName) === -1) {
|
3465 | parent = parent.$parent;
|
3466 | }
|
3467 | return parent;
|
3468 | },
|
3469 | paddingStyle: function paddingStyle() {
|
3470 | if (this.rootMenu.mode !== 'vertical') return {};
|
3471 |
|
3472 | var padding = 20;
|
3473 | var parent = this.$parent;
|
3474 |
|
3475 | if (this.rootMenu.collapse) {
|
3476 | padding = 20;
|
3477 | } else {
|
3478 | while (parent && parent.$options.componentName !== 'ElMenu') {
|
3479 | if (parent.$options.componentName === 'ElSubmenu') {
|
3480 | padding += 20;
|
3481 | }
|
3482 | parent = parent.$parent;
|
3483 | }
|
3484 | }
|
3485 | return { paddingLeft: padding + 'px' };
|
3486 | }
|
3487 | }
|
3488 | });
|
3489 |
|
3490 |
|
3491 |
|
3492 |
|
3493 |
|
3494 |
|
3495 |
|
3496 | var poperMixins = {
|
3497 | props: {
|
3498 | transformOrigin: {
|
3499 | type: [Boolean, String],
|
3500 | default: false
|
3501 | },
|
3502 | offset: vue_popper_default.a.props.offset,
|
3503 | boundariesPadding: vue_popper_default.a.props.boundariesPadding,
|
3504 | popperOptions: vue_popper_default.a.props.popperOptions
|
3505 | },
|
3506 | data: vue_popper_default.a.data,
|
3507 | methods: vue_popper_default.a.methods,
|
3508 | beforeDestroy: vue_popper_default.a.beforeDestroy,
|
3509 | deactivated: vue_popper_default.a.deactivated
|
3510 | };
|
3511 |
|
3512 | var submenuvue_type_script_lang_js_ = ({
|
3513 | name: 'ElSubmenu',
|
3514 |
|
3515 | componentName: 'ElSubmenu',
|
3516 |
|
3517 | mixins: [menu_mixin, emitter_default.a, poperMixins],
|
3518 |
|
3519 | components: { ElCollapseTransition: collapse_transition_default.a },
|
3520 |
|
3521 | props: {
|
3522 | index: {
|
3523 | type: String,
|
3524 | required: true
|
3525 | },
|
3526 | showTimeout: {
|
3527 | type: Number,
|
3528 | default: 300
|
3529 | },
|
3530 | hideTimeout: {
|
3531 | type: Number,
|
3532 | default: 300
|
3533 | },
|
3534 | popperClass: String,
|
3535 | disabled: Boolean,
|
3536 | popperAppendToBody: {
|
3537 | type: Boolean,
|
3538 | default: undefined
|
3539 | }
|
3540 | },
|
3541 |
|
3542 | data: function data() {
|
3543 | return {
|
3544 | popperJS: null,
|
3545 | timeout: null,
|
3546 | items: {},
|
3547 | submenus: {},
|
3548 | mouseInChild: false
|
3549 | };
|
3550 | },
|
3551 |
|
3552 | watch: {
|
3553 | opened: function opened(val) {
|
3554 | var _this = this;
|
3555 |
|
3556 | if (this.isMenuPopup) {
|
3557 | this.$nextTick(function (_) {
|
3558 | _this.updatePopper();
|
3559 | });
|
3560 | }
|
3561 | }
|
3562 | },
|
3563 | computed: {
|
3564 |
|
3565 | appendToBody: function appendToBody() {
|
3566 | return this.popperAppendToBody === undefined ? this.isFirstLevel : this.popperAppendToBody;
|
3567 | },
|
3568 | menuTransitionName: function menuTransitionName() {
|
3569 | return this.rootMenu.collapse ? 'el-zoom-in-left' : 'el-zoom-in-top';
|
3570 | },
|
3571 | opened: function opened() {
|
3572 | return this.rootMenu.openedMenus.indexOf(this.index) > -1;
|
3573 | },
|
3574 | active: function active() {
|
3575 | var isActive = false;
|
3576 | var submenus = this.submenus;
|
3577 | var items = this.items;
|
3578 |
|
3579 | Object.keys(items).forEach(function (index) {
|
3580 | if (items[index].active) {
|
3581 | isActive = true;
|
3582 | }
|
3583 | });
|
3584 |
|
3585 | Object.keys(submenus).forEach(function (index) {
|
3586 | if (submenus[index].active) {
|
3587 | isActive = true;
|
3588 | }
|
3589 | });
|
3590 |
|
3591 | return isActive;
|
3592 | },
|
3593 | hoverBackground: function hoverBackground() {
|
3594 | return this.rootMenu.hoverBackground;
|
3595 | },
|
3596 | backgroundColor: function backgroundColor() {
|
3597 | return this.rootMenu.backgroundColor || '';
|
3598 | },
|
3599 | activeTextColor: function activeTextColor() {
|
3600 | return this.rootMenu.activeTextColor || '';
|
3601 | },
|
3602 | textColor: function textColor() {
|
3603 | return this.rootMenu.textColor || '';
|
3604 | },
|
3605 | mode: function mode() {
|
3606 | return this.rootMenu.mode;
|
3607 | },
|
3608 | isMenuPopup: function isMenuPopup() {
|
3609 | return this.rootMenu.isMenuPopup;
|
3610 | },
|
3611 | titleStyle: function titleStyle() {
|
3612 | if (this.mode !== 'horizontal') {
|
3613 | return {
|
3614 | color: this.textColor
|
3615 | };
|
3616 | }
|
3617 | return {
|
3618 | borderBottomColor: this.active ? this.rootMenu.activeTextColor ? this.activeTextColor : '' : 'transparent',
|
3619 | color: this.active ? this.activeTextColor : this.textColor
|
3620 | };
|
3621 | },
|
3622 | isFirstLevel: function isFirstLevel() {
|
3623 | var isFirstLevel = true;
|
3624 | var parent = this.$parent;
|
3625 | while (parent && parent !== this.rootMenu) {
|
3626 | if (['ElSubmenu', 'ElMenuItemGroup'].indexOf(parent.$options.componentName) > -1) {
|
3627 | isFirstLevel = false;
|
3628 | break;
|
3629 | } else {
|
3630 | parent = parent.$parent;
|
3631 | }
|
3632 | }
|
3633 | return isFirstLevel;
|
3634 | }
|
3635 | },
|
3636 | methods: {
|
3637 | handleCollapseToggle: function handleCollapseToggle(value) {
|
3638 | if (value) {
|
3639 | this.initPopper();
|
3640 | } else {
|
3641 | this.doDestroy();
|
3642 | }
|
3643 | },
|
3644 | addItem: function addItem(item) {
|
3645 | this.$set(this.items, item.index, item);
|
3646 | },
|
3647 | removeItem: function removeItem(item) {
|
3648 | delete this.items[item.index];
|
3649 | },
|
3650 | addSubmenu: function addSubmenu(item) {
|
3651 | this.$set(this.submenus, item.index, item);
|
3652 | },
|
3653 | removeSubmenu: function removeSubmenu(item) {
|
3654 | delete this.submenus[item.index];
|
3655 | },
|
3656 | handleClick: function handleClick() {
|
3657 | var rootMenu = this.rootMenu,
|
3658 | disabled = this.disabled;
|
3659 |
|
3660 | if (rootMenu.menuTrigger === 'hover' && rootMenu.mode === 'horizontal' || rootMenu.collapse && rootMenu.mode === 'vertical' || disabled) {
|
3661 | return;
|
3662 | }
|
3663 | this.dispatch('ElMenu', 'submenu-click', this);
|
3664 | },
|
3665 | handleMouseenter: function handleMouseenter(event) {
|
3666 | var _this2 = this;
|
3667 |
|
3668 | var showTimeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.showTimeout;
|
3669 |
|
3670 |
|
3671 | if (!('ActiveXObject' in window) && event.type === 'focus' && !event.relatedTarget) {
|
3672 | return;
|
3673 | }
|
3674 | var rootMenu = this.rootMenu,
|
3675 | disabled = this.disabled;
|
3676 |
|
3677 | if (rootMenu.menuTrigger === 'click' && rootMenu.mode === 'horizontal' || !rootMenu.collapse && rootMenu.mode === 'vertical' || disabled) {
|
3678 | return;
|
3679 | }
|
3680 | this.dispatch('ElSubmenu', 'mouse-enter-child');
|
3681 | clearTimeout(this.timeout);
|
3682 | this.timeout = setTimeout(function () {
|
3683 | _this2.rootMenu.openMenu(_this2.index, _this2.indexPath);
|
3684 | }, showTimeout);
|
3685 |
|
3686 | if (this.appendToBody) {
|
3687 | this.$parent.$el.dispatchEvent(new MouseEvent('mouseenter'));
|
3688 | }
|
3689 | },
|
3690 | handleMouseleave: function handleMouseleave() {
|
3691 | var _this3 = this;
|
3692 |
|
3693 | var deepDispatch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
3694 | var rootMenu = this.rootMenu;
|
3695 |
|
3696 | if (rootMenu.menuTrigger === 'click' && rootMenu.mode === 'horizontal' || !rootMenu.collapse && rootMenu.mode === 'vertical') {
|
3697 | return;
|
3698 | }
|
3699 | this.dispatch('ElSubmenu', 'mouse-leave-child');
|
3700 | clearTimeout(this.timeout);
|
3701 | this.timeout = setTimeout(function () {
|
3702 | !_this3.mouseInChild && _this3.rootMenu.closeMenu(_this3.index);
|
3703 | }, this.hideTimeout);
|
3704 |
|
3705 | if (this.appendToBody && deepDispatch) {
|
3706 | if (this.$parent.$options.name === 'ElSubmenu') {
|
3707 | this.$parent.handleMouseleave(true);
|
3708 | }
|
3709 | }
|
3710 | },
|
3711 | handleTitleMouseenter: function handleTitleMouseenter() {
|
3712 | if (this.mode === 'horizontal' && !this.rootMenu.backgroundColor) return;
|
3713 | var title = this.$refs['submenu-title'];
|
3714 | title && (title.style.backgroundColor = this.rootMenu.hoverBackground);
|
3715 | },
|
3716 | handleTitleMouseleave: function handleTitleMouseleave() {
|
3717 | if (this.mode === 'horizontal' && !this.rootMenu.backgroundColor) return;
|
3718 | var title = this.$refs['submenu-title'];
|
3719 | title && (title.style.backgroundColor = this.rootMenu.backgroundColor || '');
|
3720 | },
|
3721 | updatePlacement: function updatePlacement() {
|
3722 | this.currentPlacement = this.mode === 'horizontal' && this.isFirstLevel ? 'bottom-start' : 'right-start';
|
3723 | },
|
3724 | initPopper: function initPopper() {
|
3725 | this.referenceElm = this.$el;
|
3726 | this.popperElm = this.$refs.menu;
|
3727 | this.updatePlacement();
|
3728 | }
|
3729 | },
|
3730 | created: function created() {
|
3731 | var _this4 = this;
|
3732 |
|
3733 | this.$on('toggle-collapse', this.handleCollapseToggle);
|
3734 | this.$on('mouse-enter-child', function () {
|
3735 | _this4.mouseInChild = true;
|
3736 | clearTimeout(_this4.timeout);
|
3737 | });
|
3738 | this.$on('mouse-leave-child', function () {
|
3739 | _this4.mouseInChild = false;
|
3740 | clearTimeout(_this4.timeout);
|
3741 | });
|
3742 | },
|
3743 | mounted: function mounted() {
|
3744 | this.parentMenu.addSubmenu(this);
|
3745 | this.rootMenu.addSubmenu(this);
|
3746 | this.initPopper();
|
3747 | },
|
3748 | beforeDestroy: function beforeDestroy() {
|
3749 | this.parentMenu.removeSubmenu(this);
|
3750 | this.rootMenu.removeSubmenu(this);
|
3751 | },
|
3752 | render: function render(h) {
|
3753 | var _this5 = this;
|
3754 |
|
3755 | var active = this.active,
|
3756 | opened = this.opened,
|
3757 | paddingStyle = this.paddingStyle,
|
3758 | titleStyle = this.titleStyle,
|
3759 | backgroundColor = this.backgroundColor,
|
3760 | rootMenu = this.rootMenu,
|
3761 | currentPlacement = this.currentPlacement,
|
3762 | menuTransitionName = this.menuTransitionName,
|
3763 | mode = this.mode,
|
3764 | disabled = this.disabled,
|
3765 | popperClass = this.popperClass,
|
3766 | $slots = this.$slots,
|
3767 | isFirstLevel = this.isFirstLevel;
|
3768 |
|
3769 |
|
3770 | var popupMenu = h(
|
3771 | 'transition',
|
3772 | {
|
3773 | attrs: { name: menuTransitionName }
|
3774 | },
|
3775 | [h(
|
3776 | 'div',
|
3777 | {
|
3778 | ref: 'menu',
|
3779 | directives: [{
|
3780 | name: 'show',
|
3781 | value: opened
|
3782 | }],
|
3783 |
|
3784 | 'class': ['el-menu--' + mode, popperClass],
|
3785 | on: {
|
3786 | 'mouseenter': function mouseenter($event) {
|
3787 | return _this5.handleMouseenter($event, 100);
|
3788 | },
|
3789 | 'mouseleave': function mouseleave() {
|
3790 | return _this5.handleMouseleave(true);
|
3791 | },
|
3792 | 'focus': function focus($event) {
|
3793 | return _this5.handleMouseenter($event, 100);
|
3794 | }
|
3795 | }
|
3796 | },
|
3797 | [h(
|
3798 | 'ul',
|
3799 | {
|
3800 | attrs: {
|
3801 | role: 'menu'
|
3802 | },
|
3803 | 'class': ['el-menu el-menu--popup', 'el-menu--popup-' + currentPlacement],
|
3804 | style: { backgroundColor: rootMenu.backgroundColor || '' } },
|
3805 | [$slots.default]
|
3806 | )]
|
3807 | )]
|
3808 | );
|
3809 |
|
3810 | var inlineMenu = h('el-collapse-transition', [h(
|
3811 | 'ul',
|
3812 | {
|
3813 | attrs: {
|
3814 | role: 'menu'
|
3815 | },
|
3816 | 'class': 'el-menu el-menu--inline',
|
3817 | directives: [{
|
3818 | name: 'show',
|
3819 | value: opened
|
3820 | }],
|
3821 |
|
3822 | style: { backgroundColor: rootMenu.backgroundColor || '' } },
|
3823 | [$slots.default]
|
3824 | )]);
|
3825 |
|
3826 | var submenuTitleIcon = rootMenu.mode === 'horizontal' && isFirstLevel || rootMenu.mode === 'vertical' && !rootMenu.collapse ? 'el-icon-arrow-down' : 'el-icon-arrow-right';
|
3827 |
|
3828 | return h(
|
3829 | 'li',
|
3830 | {
|
3831 | 'class': {
|
3832 | 'el-submenu': true,
|
3833 | 'is-active': active,
|
3834 | 'is-opened': opened,
|
3835 | 'is-disabled': disabled
|
3836 | },
|
3837 | attrs: { role: 'menuitem',
|
3838 | 'aria-haspopup': 'true',
|
3839 | 'aria-expanded': opened
|
3840 | },
|
3841 | on: {
|
3842 | 'mouseenter': this.handleMouseenter,
|
3843 | 'mouseleave': function mouseleave() {
|
3844 | return _this5.handleMouseleave(false);
|
3845 | },
|
3846 | 'focus': this.handleMouseenter
|
3847 | }
|
3848 | },
|
3849 | [h(
|
3850 | 'div',
|
3851 | {
|
3852 | 'class': 'el-submenu__title',
|
3853 | ref: 'submenu-title',
|
3854 | on: {
|
3855 | 'click': this.handleClick,
|
3856 | 'mouseenter': this.handleTitleMouseenter,
|
3857 | 'mouseleave': this.handleTitleMouseleave
|
3858 | },
|
3859 |
|
3860 | style: [paddingStyle, titleStyle, { backgroundColor: backgroundColor }]
|
3861 | },
|
3862 | [$slots.title, h('i', { 'class': ['el-submenu__icon-arrow', submenuTitleIcon] })]
|
3863 | ), this.isMenuPopup ? popupMenu : inlineMenu]
|
3864 | );
|
3865 | }
|
3866 | });
|
3867 |
|
3868 | var src_submenuvue_type_script_lang_js_ = (submenuvue_type_script_lang_js_);
|
3869 |
|
3870 | var submenu_render, submenu_staticRenderFns
|
3871 |
|
3872 |
|
3873 |
|
3874 |
|
3875 |
|
3876 |
|
3877 | var submenu_component = normalizeComponent(
|
3878 | src_submenuvue_type_script_lang_js_,
|
3879 | submenu_render,
|
3880 | submenu_staticRenderFns,
|
3881 | false,
|
3882 | null,
|
3883 | null,
|
3884 | null
|
3885 |
|
3886 | )
|
3887 |
|
3888 |
|
3889 | if (false) { var submenu_api; }
|
3890 | submenu_component.options.__file = "packages/menu/src/submenu.vue"
|
3891 | var submenu = (submenu_component.exports);
|
3892 |
|
3893 |
|
3894 |
|
3895 |
|
3896 | submenu.install = function (Vue) {
|
3897 | Vue.component(submenu.name, submenu);
|
3898 | };
|
3899 |
|
3900 | var packages_submenu = (submenu);
|
3901 |
|
3902 | var menu_itemvue_type_template_id_2a5dbfea_render = function() {
|
3903 | var _vm = this
|
3904 | var _h = _vm.$createElement
|
3905 | var _c = _vm._self._c || _h
|
3906 | return _c(
|
3907 | "li",
|
3908 | {
|
3909 | staticClass: "el-menu-item",
|
3910 | class: {
|
3911 | "is-active": _vm.active,
|
3912 | "is-disabled": _vm.disabled
|
3913 | },
|
3914 | style: [
|
3915 | _vm.paddingStyle,
|
3916 | _vm.itemStyle,
|
3917 | { backgroundColor: _vm.backgroundColor }
|
3918 | ],
|
3919 | attrs: { role: "menuitem", tabindex: "-1" },
|
3920 | on: {
|
3921 | click: _vm.handleClick,
|
3922 | mouseenter: _vm.onMouseEnter,
|
3923 | focus: _vm.onMouseEnter,
|
3924 | blur: _vm.onMouseLeave,
|
3925 | mouseleave: _vm.onMouseLeave
|
3926 | }
|
3927 | },
|
3928 | [
|
3929 | _vm.parentMenu.$options.componentName === "ElMenu" &&
|
3930 | _vm.rootMenu.collapse &&
|
3931 | _vm.$slots.title
|
3932 | ? _c("el-tooltip", { attrs: { effect: "dark", placement: "right" } }, [
|
3933 | _c(
|
3934 | "div",
|
3935 | { attrs: { slot: "content" }, slot: "content" },
|
3936 | [_vm._t("title")],
|
3937 | 2
|
3938 | ),
|
3939 | _c(
|
3940 | "div",
|
3941 | {
|
3942 | staticStyle: {
|
3943 | position: "absolute",
|
3944 | left: "0",
|
3945 | top: "0",
|
3946 | height: "100%",
|
3947 | width: "100%",
|
3948 | display: "inline-block",
|
3949 | "box-sizing": "border-box",
|
3950 | padding: "0 20px"
|
3951 | }
|
3952 | },
|
3953 | [_vm._t("default")],
|
3954 | 2
|
3955 | )
|
3956 | ])
|
3957 | : [_vm._t("default"), _vm._t("title")]
|
3958 | ],
|
3959 | 2
|
3960 | )
|
3961 | }
|
3962 | var menu_itemvue_type_template_id_2a5dbfea_staticRenderFns = []
|
3963 | menu_itemvue_type_template_id_2a5dbfea_render._withStripped = true
|
3964 |
|
3965 |
|
3966 |
|
3967 |
|
3968 |
|
3969 | var tooltip_ = __webpack_require__(26);
|
3970 | var tooltip_default = __webpack_require__.n(tooltip_);
|
3971 |
|
3972 |
|
3973 |
|
3974 |
|
3975 |
|
3976 |
|
3977 |
|
3978 |
|
3979 |
|
3980 |
|
3981 |
|
3982 |
|
3983 |
|
3984 |
|
3985 |
|
3986 |
|
3987 |
|
3988 |
|
3989 |
|
3990 |
|
3991 |
|
3992 |
|
3993 |
|
3994 |
|
3995 |
|
3996 |
|
3997 |
|
3998 |
|
3999 |
|
4000 |
|
4001 |
|
4002 |
|
4003 |
|
4004 |
|
4005 |
|
4006 |
|
4007 |
|
4008 | var menu_itemvue_type_script_lang_js_ = ({
|
4009 | name: 'ElMenuItem',
|
4010 |
|
4011 | componentName: 'ElMenuItem',
|
4012 |
|
4013 | mixins: [menu_mixin, emitter_default.a],
|
4014 |
|
4015 | components: { ElTooltip: tooltip_default.a },
|
4016 |
|
4017 | props: {
|
4018 | index: {
|
4019 | default: null,
|
4020 | validator: function validator(val) {
|
4021 | return typeof val === 'string' || val === null;
|
4022 | }
|
4023 | },
|
4024 | route: [String, Object],
|
4025 | disabled: Boolean
|
4026 | },
|
4027 | computed: {
|
4028 | active: function active() {
|
4029 | return this.index === this.rootMenu.activeIndex;
|
4030 | },
|
4031 | hoverBackground: function hoverBackground() {
|
4032 | return this.rootMenu.hoverBackground;
|
4033 | },
|
4034 | backgroundColor: function backgroundColor() {
|
4035 | return this.rootMenu.backgroundColor || '';
|
4036 | },
|
4037 | activeTextColor: function activeTextColor() {
|
4038 | return this.rootMenu.activeTextColor || '';
|
4039 | },
|
4040 | textColor: function textColor() {
|
4041 | return this.rootMenu.textColor || '';
|
4042 | },
|
4043 | mode: function mode() {
|
4044 | return this.rootMenu.mode;
|
4045 | },
|
4046 | itemStyle: function itemStyle() {
|
4047 | var style = {
|
4048 | color: this.active ? this.activeTextColor : this.textColor
|
4049 | };
|
4050 | if (this.mode === 'horizontal' && !this.isNested) {
|
4051 | style.borderBottomColor = this.active ? this.rootMenu.activeTextColor ? this.activeTextColor : '' : 'transparent';
|
4052 | }
|
4053 | return style;
|
4054 | },
|
4055 | isNested: function isNested() {
|
4056 | return this.parentMenu !== this.rootMenu;
|
4057 | }
|
4058 | },
|
4059 | methods: {
|
4060 | onMouseEnter: function onMouseEnter() {
|
4061 | if (this.mode === 'horizontal' && !this.rootMenu.backgroundColor) return;
|
4062 | this.$el.style.backgroundColor = this.hoverBackground;
|
4063 | },
|
4064 | onMouseLeave: function onMouseLeave() {
|
4065 | if (this.mode === 'horizontal' && !this.rootMenu.backgroundColor) return;
|
4066 | this.$el.style.backgroundColor = this.backgroundColor;
|
4067 | },
|
4068 | handleClick: function handleClick() {
|
4069 | if (!this.disabled) {
|
4070 | this.dispatch('ElMenu', 'item-click', this);
|
4071 | this.$emit('click', this);
|
4072 | }
|
4073 | }
|
4074 | },
|
4075 | mounted: function mounted() {
|
4076 | this.parentMenu.addItem(this);
|
4077 | this.rootMenu.addItem(this);
|
4078 | },
|
4079 | beforeDestroy: function beforeDestroy() {
|
4080 | this.parentMenu.removeItem(this);
|
4081 | this.rootMenu.removeItem(this);
|
4082 | }
|
4083 | });
|
4084 |
|
4085 | var src_menu_itemvue_type_script_lang_js_ = (menu_itemvue_type_script_lang_js_);
|
4086 |
|
4087 |
|
4088 |
|
4089 |
|
4090 |
|
4091 |
|
4092 |
|
4093 |
|
4094 | var menu_item_component = normalizeComponent(
|
4095 | src_menu_itemvue_type_script_lang_js_,
|
4096 | menu_itemvue_type_template_id_2a5dbfea_render,
|
4097 | menu_itemvue_type_template_id_2a5dbfea_staticRenderFns,
|
4098 | false,
|
4099 | null,
|
4100 | null,
|
4101 | null
|
4102 |
|
4103 | )
|
4104 |
|
4105 |
|
4106 | if (false) { var menu_item_api; }
|
4107 | menu_item_component.options.__file = "packages/menu/src/menu-item.vue"
|
4108 | var menu_item = (menu_item_component.exports);
|
4109 |
|
4110 |
|
4111 |
|
4112 |
|
4113 | menu_item.install = function (Vue) {
|
4114 | Vue.component(menu_item.name, menu_item);
|
4115 | };
|
4116 |
|
4117 | var packages_menu_item = (menu_item);
|
4118 |
|
4119 | var menu_item_groupvue_type_template_id_543b7bdc_render = function() {
|
4120 | var _vm = this
|
4121 | var _h = _vm.$createElement
|
4122 | var _c = _vm._self._c || _h
|
4123 | return _c("li", { staticClass: "el-menu-item-group" }, [
|
4124 | _c(
|
4125 | "div",
|
4126 | {
|
4127 | staticClass: "el-menu-item-group__title",
|
4128 | style: { paddingLeft: _vm.levelPadding + "px" }
|
4129 | },
|
4130 | [!_vm.$slots.title ? [_vm._v(_vm._s(_vm.title))] : _vm._t("title")],
|
4131 | 2
|
4132 | ),
|
4133 | _c("ul", [_vm._t("default")], 2)
|
4134 | ])
|
4135 | }
|
4136 | var menu_item_groupvue_type_template_id_543b7bdc_staticRenderFns = []
|
4137 | menu_item_groupvue_type_template_id_543b7bdc_render._withStripped = true
|
4138 |
|
4139 |
|
4140 |
|
4141 |
|
4142 |
|
4143 |
|
4144 |
|
4145 |
|
4146 |
|
4147 |
|
4148 |
|
4149 |
|
4150 |
|
4151 |
|
4152 |
|
4153 |
|
4154 |
|
4155 | var menu_item_groupvue_type_script_lang_js_ = ({
|
4156 | name: 'ElMenuItemGroup',
|
4157 |
|
4158 | componentName: 'ElMenuItemGroup',
|
4159 |
|
4160 | inject: ['rootMenu'],
|
4161 | props: {
|
4162 | title: {
|
4163 | type: String
|
4164 | }
|
4165 | },
|
4166 | data: function data() {
|
4167 | return {
|
4168 | paddingLeft: 20
|
4169 | };
|
4170 | },
|
4171 |
|
4172 | computed: {
|
4173 | levelPadding: function levelPadding() {
|
4174 | var padding = 20;
|
4175 | var parent = this.$parent;
|
4176 | if (this.rootMenu.collapse) return 20;
|
4177 | while (parent && parent.$options.componentName !== 'ElMenu') {
|
4178 | if (parent.$options.componentName === 'ElSubmenu') {
|
4179 | padding += 20;
|
4180 | }
|
4181 | parent = parent.$parent;
|
4182 | }
|
4183 | return padding;
|
4184 | }
|
4185 | }
|
4186 | });
|
4187 |
|
4188 | var src_menu_item_groupvue_type_script_lang_js_ = (menu_item_groupvue_type_script_lang_js_);
|
4189 |
|
4190 |
|
4191 |
|
4192 |
|
4193 |
|
4194 |
|
4195 |
|
4196 |
|
4197 | var menu_item_group_component = normalizeComponent(
|
4198 | src_menu_item_groupvue_type_script_lang_js_,
|
4199 | menu_item_groupvue_type_template_id_543b7bdc_render,
|
4200 | menu_item_groupvue_type_template_id_543b7bdc_staticRenderFns,
|
4201 | false,
|
4202 | null,
|
4203 | null,
|
4204 | null
|
4205 |
|
4206 | )
|
4207 |
|
4208 |
|
4209 | if (false) { var menu_item_group_api; }
|
4210 | menu_item_group_component.options.__file = "packages/menu/src/menu-item-group.vue"
|
4211 | var menu_item_group = (menu_item_group_component.exports);
|
4212 |
|
4213 |
|
4214 |
|
4215 |
|
4216 | menu_item_group.install = function (Vue) {
|
4217 | Vue.component(menu_item_group.name, menu_item_group);
|
4218 | };
|
4219 |
|
4220 | var packages_menu_item_group = (menu_item_group);
|
4221 |
|
4222 | var inputvue_type_template_id_343dd774_render = function() {
|
4223 | var _vm = this
|
4224 | var _h = _vm.$createElement
|
4225 | var _c = _vm._self._c || _h
|
4226 | return _c(
|
4227 | "div",
|
4228 | {
|
4229 | class: [
|
4230 | _vm.type === "textarea" ? "el-textarea" : "el-input",
|
4231 | _vm.inputSize ? "el-input--" + _vm.inputSize : "",
|
4232 | {
|
4233 | "is-disabled": _vm.inputDisabled,
|
4234 | "is-exceed": _vm.inputExceed,
|
4235 | "el-input-group": _vm.$slots.prepend || _vm.$slots.append,
|
4236 | "el-input-group--append": _vm.$slots.append,
|
4237 | "el-input-group--prepend": _vm.$slots.prepend,
|
4238 | "el-input--prefix": _vm.$slots.prefix || _vm.prefixIcon,
|
4239 | "el-input--suffix":
|
4240 | _vm.$slots.suffix ||
|
4241 | _vm.suffixIcon ||
|
4242 | _vm.clearable ||
|
4243 | _vm.showPassword
|
4244 | }
|
4245 | ],
|
4246 | on: {
|
4247 | mouseenter: function($event) {
|
4248 | _vm.hovering = true
|
4249 | },
|
4250 | mouseleave: function($event) {
|
4251 | _vm.hovering = false
|
4252 | }
|
4253 | }
|
4254 | },
|
4255 | [
|
4256 | _vm.type !== "textarea"
|
4257 | ? [
|
4258 | _vm.$slots.prepend
|
4259 | ? _c(
|
4260 | "div",
|
4261 | { staticClass: "el-input-group__prepend" },
|
4262 | [_vm._t("prepend")],
|
4263 | 2
|
4264 | )
|
4265 | : _vm._e(),
|
4266 | _vm.type !== "textarea"
|
4267 | ? _c(
|
4268 | "input",
|
4269 | _vm._b(
|
4270 | {
|
4271 | ref: "input",
|
4272 | staticClass: "el-input__inner",
|
4273 | attrs: {
|
4274 | tabindex: _vm.tabindex,
|
4275 | type: _vm.showPassword
|
4276 | ? _vm.passwordVisible
|
4277 | ? "text"
|
4278 | : "password"
|
4279 | : _vm.type,
|
4280 | disabled: _vm.inputDisabled,
|
4281 | readonly: _vm.readonly,
|
4282 | autocomplete: _vm.autoComplete || _vm.autocomplete,
|
4283 | "aria-label": _vm.label
|
4284 | },
|
4285 | on: {
|
4286 | compositionstart: _vm.handleCompositionStart,
|
4287 | compositionupdate: _vm.handleCompositionUpdate,
|
4288 | compositionend: _vm.handleCompositionEnd,
|
4289 | input: _vm.handleInput,
|
4290 | focus: _vm.handleFocus,
|
4291 | blur: _vm.handleBlur,
|
4292 | change: _vm.handleChange
|
4293 | }
|
4294 | },
|
4295 | "input",
|
4296 | _vm.$attrs,
|
4297 | false
|
4298 | )
|
4299 | )
|
4300 | : _vm._e(),
|
4301 | _vm.$slots.prefix || _vm.prefixIcon
|
4302 | ? _c(
|
4303 | "span",
|
4304 | { staticClass: "el-input__prefix" },
|
4305 | [
|
4306 | _vm._t("prefix"),
|
4307 | _vm.prefixIcon
|
4308 | ? _c("i", {
|
4309 | staticClass: "el-input__icon",
|
4310 | class: _vm.prefixIcon
|
4311 | })
|
4312 | : _vm._e()
|
4313 | ],
|
4314 | 2
|
4315 | )
|
4316 | : _vm._e(),
|
4317 | _vm.getSuffixVisible()
|
4318 | ? _c("span", { staticClass: "el-input__suffix" }, [
|
4319 | _c(
|
4320 | "span",
|
4321 | { staticClass: "el-input__suffix-inner" },
|
4322 | [
|
4323 | !_vm.showClear ||
|
4324 | !_vm.showPwdVisible ||
|
4325 | !_vm.isWordLimitVisible
|
4326 | ? [
|
4327 | _vm._t("suffix"),
|
4328 | _vm.suffixIcon
|
4329 | ? _c("i", {
|
4330 | staticClass: "el-input__icon",
|
4331 | class: _vm.suffixIcon
|
4332 | })
|
4333 | : _vm._e()
|
4334 | ]
|
4335 | : _vm._e(),
|
4336 | _vm.showClear
|
4337 | ? _c("i", {
|
4338 | staticClass:
|
4339 | "el-input__icon el-icon-circle-close el-input__clear",
|
4340 | on: {
|
4341 | mousedown: function($event) {
|
4342 | $event.preventDefault()
|
4343 | },
|
4344 | click: _vm.clear
|
4345 | }
|
4346 | })
|
4347 | : _vm._e(),
|
4348 | _vm.showPwdVisible
|
4349 | ? _c("i", {
|
4350 | staticClass:
|
4351 | "el-input__icon el-icon-view el-input__clear",
|
4352 | on: { click: _vm.handlePasswordVisible }
|
4353 | })
|
4354 | : _vm._e(),
|
4355 | _vm.isWordLimitVisible
|
4356 | ? _c("span", { staticClass: "el-input__count" }, [
|
4357 | _c(
|
4358 | "span",
|
4359 | { staticClass: "el-input__count-inner" },
|
4360 | [
|
4361 | _vm._v(
|
4362 | "\n " +
|
4363 | _vm._s(_vm.textLength) +
|
4364 | "/" +
|
4365 | _vm._s(_vm.upperLimit) +
|
4366 | "\n "
|
4367 | )
|
4368 | ]
|
4369 | )
|
4370 | ])
|
4371 | : _vm._e()
|
4372 | ],
|
4373 | 2
|
4374 | ),
|
4375 | _vm.validateState
|
4376 | ? _c("i", {
|
4377 | staticClass: "el-input__icon",
|
4378 | class: ["el-input__validateIcon", _vm.validateIcon]
|
4379 | })
|
4380 | : _vm._e()
|
4381 | ])
|
4382 | : _vm._e(),
|
4383 | _vm.$slots.append
|
4384 | ? _c(
|
4385 | "div",
|
4386 | { staticClass: "el-input-group__append" },
|
4387 | [_vm._t("append")],
|
4388 | 2
|
4389 | )
|
4390 | : _vm._e()
|
4391 | ]
|
4392 | : _c(
|
4393 | "textarea",
|
4394 | _vm._b(
|
4395 | {
|
4396 | ref: "textarea",
|
4397 | staticClass: "el-textarea__inner",
|
4398 | style: _vm.textareaStyle,
|
4399 | attrs: {
|
4400 | tabindex: _vm.tabindex,
|
4401 | disabled: _vm.inputDisabled,
|
4402 | readonly: _vm.readonly,
|
4403 | autocomplete: _vm.autoComplete || _vm.autocomplete,
|
4404 | "aria-label": _vm.label
|
4405 | },
|
4406 | on: {
|
4407 | compositionstart: _vm.handleCompositionStart,
|
4408 | compositionupdate: _vm.handleCompositionUpdate,
|
4409 | compositionend: _vm.handleCompositionEnd,
|
4410 | input: _vm.handleInput,
|
4411 | focus: _vm.handleFocus,
|
4412 | blur: _vm.handleBlur,
|
4413 | change: _vm.handleChange
|
4414 | }
|
4415 | },
|
4416 | "textarea",
|
4417 | _vm.$attrs,
|
4418 | false
|
4419 | )
|
4420 | ),
|
4421 | _vm.isWordLimitVisible && _vm.type === "textarea"
|
4422 | ? _c("span", { staticClass: "el-input__count" }, [
|
4423 | _vm._v(_vm._s(_vm.textLength) + "/" + _vm._s(_vm.upperLimit))
|
4424 | ])
|
4425 | : _vm._e()
|
4426 | ],
|
4427 | 2
|
4428 | )
|
4429 | }
|
4430 | var inputvue_type_template_id_343dd774_staticRenderFns = []
|
4431 | inputvue_type_template_id_343dd774_render._withStripped = true
|
4432 |
|
4433 |
|
4434 |
|
4435 |
|
4436 |
|
4437 | var hiddenTextarea = void 0;
|
4438 |
|
4439 | var HIDDEN_STYLE = '\n height:0 !important;\n visibility:hidden !important;\n overflow:hidden !important;\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important\n';
|
4440 |
|
4441 | var CONTEXT_STYLE = ['letter-spacing', 'line-height', 'padding-top', 'padding-bottom', 'font-family', 'font-weight', 'font-size', 'text-rendering', 'text-transform', 'width', 'text-indent', 'padding-left', 'padding-right', 'border-width', 'box-sizing'];
|
4442 |
|
4443 | function calculateNodeStyling(targetElement) {
|
4444 | var style = window.getComputedStyle(targetElement);
|
4445 |
|
4446 | var boxSizing = style.getPropertyValue('box-sizing');
|
4447 |
|
4448 | var paddingSize = parseFloat(style.getPropertyValue('padding-bottom')) + parseFloat(style.getPropertyValue('padding-top'));
|
4449 |
|
4450 | var borderSize = parseFloat(style.getPropertyValue('border-bottom-width')) + parseFloat(style.getPropertyValue('border-top-width'));
|
4451 |
|
4452 | var contextStyle = CONTEXT_STYLE.map(function (name) {
|
4453 | return name + ':' + style.getPropertyValue(name);
|
4454 | }).join(';');
|
4455 |
|
4456 | return { contextStyle: contextStyle, paddingSize: paddingSize, borderSize: borderSize, boxSizing: boxSizing };
|
4457 | }
|
4458 |
|
4459 | function calcTextareaHeight(targetElement) {
|
4460 | var minRows = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
4461 | var maxRows = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
4462 |
|
4463 | if (!hiddenTextarea) {
|
4464 | hiddenTextarea = document.createElement('textarea');
|
4465 | document.body.appendChild(hiddenTextarea);
|
4466 | }
|
4467 |
|
4468 | var _calculateNodeStyling = calculateNodeStyling(targetElement),
|
4469 | paddingSize = _calculateNodeStyling.paddingSize,
|
4470 | borderSize = _calculateNodeStyling.borderSize,
|
4471 | boxSizing = _calculateNodeStyling.boxSizing,
|
4472 | contextStyle = _calculateNodeStyling.contextStyle;
|
4473 |
|
4474 | hiddenTextarea.setAttribute('style', contextStyle + ';' + HIDDEN_STYLE);
|
4475 | hiddenTextarea.value = targetElement.value || targetElement.placeholder || '';
|
4476 |
|
4477 | var height = hiddenTextarea.scrollHeight;
|
4478 | var result = {};
|
4479 |
|
4480 | if (boxSizing === 'border-box') {
|
4481 | height = height + borderSize;
|
4482 | } else if (boxSizing === 'content-box') {
|
4483 | height = height - paddingSize;
|
4484 | }
|
4485 |
|
4486 | hiddenTextarea.value = '';
|
4487 | var singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
|
4488 |
|
4489 | if (minRows !== null) {
|
4490 | var minHeight = singleRowHeight * minRows;
|
4491 | if (boxSizing === 'border-box') {
|
4492 | minHeight = minHeight + paddingSize + borderSize;
|
4493 | }
|
4494 | height = Math.max(minHeight, height);
|
4495 | result.minHeight = minHeight + 'px';
|
4496 | }
|
4497 | if (maxRows !== null) {
|
4498 | var maxHeight = singleRowHeight * maxRows;
|
4499 | if (boxSizing === 'border-box') {
|
4500 | maxHeight = maxHeight + paddingSize + borderSize;
|
4501 | }
|
4502 | height = Math.min(maxHeight, height);
|
4503 | }
|
4504 | result.height = height + 'px';
|
4505 | hiddenTextarea.parentNode && hiddenTextarea.parentNode.removeChild(hiddenTextarea);
|
4506 | hiddenTextarea = null;
|
4507 | return result;
|
4508 | };
|
4509 |
|
4510 | var merge_ = __webpack_require__(7);
|
4511 | var merge_default = __webpack_require__.n(merge_);
|
4512 |
|
4513 |
|
4514 | var shared_ = __webpack_require__(19);
|
4515 |
|
4516 |
|
4517 |
|
4518 |
|
4519 |
|
4520 |
|
4521 |
|
4522 |
|
4523 |
|
4524 |
|
4525 |
|
4526 |
|
4527 |
|
4528 |
|
4529 |
|
4530 |
|
4531 |
|
4532 |
|
4533 |
|
4534 |
|
4535 |
|
4536 |
|
4537 |
|
4538 |
|
4539 |
|
4540 |
|
4541 |
|
4542 |
|
4543 |
|
4544 |
|
4545 |
|
4546 |
|
4547 |
|
4548 |
|
4549 |
|
4550 |
|
4551 |
|
4552 |
|
4553 |
|
4554 |
|
4555 |
|
4556 |
|
4557 |
|
4558 |
|
4559 |
|
4560 |
|
4561 |
|
4562 |
|
4563 |
|
4564 |
|
4565 |
|
4566 |
|
4567 |
|
4568 |
|
4569 |
|
4570 |
|
4571 |
|
4572 |
|
4573 |
|
4574 |
|
4575 |
|
4576 |
|
4577 |
|
4578 |
|
4579 |
|
4580 |
|
4581 |
|
4582 |
|
4583 |
|
4584 |
|
4585 |
|
4586 |
|
4587 |
|
4588 |
|
4589 |
|
4590 |
|
4591 |
|
4592 |
|
4593 |
|
4594 |
|
4595 |
|
4596 |
|
4597 |
|
4598 |
|
4599 |
|
4600 |
|
4601 |
|
4602 |
|
4603 |
|
4604 |
|
4605 |
|
4606 |
|
4607 |
|
4608 |
|
4609 |
|
4610 |
|
4611 |
|
4612 |
|
4613 |
|
4614 |
|
4615 |
|
4616 |
|
4617 |
|
4618 |
|
4619 |
|
4620 |
|
4621 |
|
4622 |
|
4623 |
|
4624 |
|
4625 |
|
4626 |
|
4627 |
|
4628 |
|
4629 |
|
4630 |
|
4631 |
|
4632 |
|
4633 | var inputvue_type_script_lang_js_ = ({
|
4634 | name: 'ElInput',
|
4635 |
|
4636 | componentName: 'ElInput',
|
4637 |
|
4638 | mixins: [emitter_default.a, migrating_default.a],
|
4639 |
|
4640 | inheritAttrs: false,
|
4641 |
|
4642 | inject: {
|
4643 | elForm: {
|
4644 | default: ''
|
4645 | },
|
4646 | elFormItem: {
|
4647 | default: ''
|
4648 | }
|
4649 | },
|
4650 |
|
4651 | data: function data() {
|
4652 | return {
|
4653 | textareaCalcStyle: {},
|
4654 | hovering: false,
|
4655 | focused: false,
|
4656 | isComposing: false,
|
4657 | passwordVisible: false
|
4658 | };
|
4659 | },
|
4660 |
|
4661 |
|
4662 | props: {
|
4663 | value: [String, Number],
|
4664 | size: String,
|
4665 | resize: String,
|
4666 | form: String,
|
4667 | disabled: Boolean,
|
4668 | readonly: Boolean,
|
4669 | type: {
|
4670 | type: String,
|
4671 | default: 'text'
|
4672 | },
|
4673 | autosize: {
|
4674 | type: [Boolean, Object],
|
4675 | default: false
|
4676 | },
|
4677 | autocomplete: {
|
4678 | type: String,
|
4679 | default: 'off'
|
4680 | },
|
4681 |
|
4682 | autoComplete: {
|
4683 | type: String,
|
4684 | validator: function validator(val) {
|
4685 | false && false;
|
4686 | return true;
|
4687 | }
|
4688 | },
|
4689 | validateEvent: {
|
4690 | type: Boolean,
|
4691 | default: true
|
4692 | },
|
4693 | suffixIcon: String,
|
4694 | prefixIcon: String,
|
4695 | label: String,
|
4696 | clearable: {
|
4697 | type: Boolean,
|
4698 | default: false
|
4699 | },
|
4700 | showPassword: {
|
4701 | type: Boolean,
|
4702 | default: false
|
4703 | },
|
4704 | showWordLimit: {
|
4705 | type: Boolean,
|
4706 | default: false
|
4707 | },
|
4708 | tabindex: String
|
4709 | },
|
4710 |
|
4711 | computed: {
|
4712 | _elFormItemSize: function _elFormItemSize() {
|
4713 | return (this.elFormItem || {}).elFormItemSize;
|
4714 | },
|
4715 | validateState: function validateState() {
|
4716 | return this.elFormItem ? this.elFormItem.validateState : '';
|
4717 | },
|
4718 | needStatusIcon: function needStatusIcon() {
|
4719 | return this.elForm ? this.elForm.statusIcon : false;
|
4720 | },
|
4721 | validateIcon: function validateIcon() {
|
4722 | return {
|
4723 | validating: 'el-icon-loading',
|
4724 | success: 'el-icon-circle-check',
|
4725 | error: 'el-icon-circle-close'
|
4726 | }[this.validateState];
|
4727 | },
|
4728 | textareaStyle: function textareaStyle() {
|
4729 | return merge_default()({}, this.textareaCalcStyle, { resize: this.resize });
|
4730 | },
|
4731 | inputSize: function inputSize() {
|
4732 | return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
4733 | },
|
4734 | inputDisabled: function inputDisabled() {
|
4735 | return this.disabled || (this.elForm || {}).disabled;
|
4736 | },
|
4737 | nativeInputValue: function nativeInputValue() {
|
4738 | return this.value === null || this.value === undefined ? '' : String(this.value);
|
4739 | },
|
4740 | showClear: function showClear() {
|
4741 | return this.clearable && !this.inputDisabled && !this.readonly && this.nativeInputValue && (this.focused || this.hovering);
|
4742 | },
|
4743 | showPwdVisible: function showPwdVisible() {
|
4744 | return this.showPassword && !this.inputDisabled && !this.readonly && (!!this.nativeInputValue || this.focused);
|
4745 | },
|
4746 | isWordLimitVisible: function isWordLimitVisible() {
|
4747 | return this.showWordLimit && this.$attrs.maxlength && (this.type === 'text' || this.type === 'textarea') && !this.inputDisabled && !this.readonly && !this.showPassword;
|
4748 | },
|
4749 | upperLimit: function upperLimit() {
|
4750 | return this.$attrs.maxlength;
|
4751 | },
|
4752 | textLength: function textLength() {
|
4753 | if (typeof this.value === 'number') {
|
4754 | return String(this.value).length;
|
4755 | }
|
4756 |
|
4757 | return (this.value || '').length;
|
4758 | },
|
4759 | inputExceed: function inputExceed() {
|
4760 |
|
4761 | return this.isWordLimitVisible && this.textLength > this.upperLimit;
|
4762 | }
|
4763 | },
|
4764 |
|
4765 | watch: {
|
4766 | value: function value(val) {
|
4767 | this.$nextTick(this.resizeTextarea);
|
4768 | if (this.validateEvent) {
|
4769 | this.dispatch('ElFormItem', 'el.form.change', [val]);
|
4770 | }
|
4771 | },
|
4772 |
|
4773 |
|
4774 |
|
4775 |
|
4776 | nativeInputValue: function nativeInputValue() {
|
4777 | this.setNativeInputValue();
|
4778 | },
|
4779 |
|
4780 |
|
4781 |
|
4782 |
|
4783 | type: function type() {
|
4784 | var _this = this;
|
4785 |
|
4786 | this.$nextTick(function () {
|
4787 | _this.setNativeInputValue();
|
4788 | _this.resizeTextarea();
|
4789 | _this.updateIconOffset();
|
4790 | });
|
4791 | }
|
4792 | },
|
4793 |
|
4794 | methods: {
|
4795 | focus: function focus() {
|
4796 | this.getInput().focus();
|
4797 | },
|
4798 | blur: function blur() {
|
4799 | this.getInput().blur();
|
4800 | },
|
4801 | getMigratingConfig: function getMigratingConfig() {
|
4802 | return {
|
4803 | props: {
|
4804 | 'icon': 'icon is removed, use suffix-icon / prefix-icon instead.',
|
4805 | 'on-icon-click': 'on-icon-click is removed.'
|
4806 | },
|
4807 | events: {
|
4808 | 'click': 'click is removed.'
|
4809 | }
|
4810 | };
|
4811 | },
|
4812 | handleBlur: function handleBlur(event) {
|
4813 | this.focused = false;
|
4814 | this.$emit('blur', event);
|
4815 | if (this.validateEvent) {
|
4816 | this.dispatch('ElFormItem', 'el.form.blur', [this.value]);
|
4817 | }
|
4818 | },
|
4819 | select: function select() {
|
4820 | this.getInput().select();
|
4821 | },
|
4822 | resizeTextarea: function resizeTextarea() {
|
4823 | if (this.$isServer) return;
|
4824 | var autosize = this.autosize,
|
4825 | type = this.type;
|
4826 |
|
4827 | if (type !== 'textarea') return;
|
4828 | if (!autosize) {
|
4829 | this.textareaCalcStyle = {
|
4830 | minHeight: calcTextareaHeight(this.$refs.textarea).minHeight
|
4831 | };
|
4832 | return;
|
4833 | }
|
4834 | var minRows = autosize.minRows;
|
4835 | var maxRows = autosize.maxRows;
|
4836 |
|
4837 | this.textareaCalcStyle = calcTextareaHeight(this.$refs.textarea, minRows, maxRows);
|
4838 | },
|
4839 | setNativeInputValue: function setNativeInputValue() {
|
4840 | var input = this.getInput();
|
4841 | if (!input) return;
|
4842 | if (input.value === this.nativeInputValue) return;
|
4843 | input.value = this.nativeInputValue;
|
4844 | },
|
4845 | handleFocus: function handleFocus(event) {
|
4846 | this.focused = true;
|
4847 | this.$emit('focus', event);
|
4848 | },
|
4849 | handleCompositionStart: function handleCompositionStart() {
|
4850 | this.isComposing = true;
|
4851 | },
|
4852 | handleCompositionUpdate: function handleCompositionUpdate(event) {
|
4853 | var text = event.target.value;
|
4854 | var lastCharacter = text[text.length - 1] || '';
|
4855 | this.isComposing = !Object(shared_["isKorean"])(lastCharacter);
|
4856 | },
|
4857 | handleCompositionEnd: function handleCompositionEnd(event) {
|
4858 | if (this.isComposing) {
|
4859 | this.isComposing = false;
|
4860 | this.handleInput(event);
|
4861 | }
|
4862 | },
|
4863 | handleInput: function handleInput(event) {
|
4864 |
|
4865 |
|
4866 | if (this.isComposing) return;
|
4867 |
|
4868 |
|
4869 |
|
4870 | if (event.target.value === this.nativeInputValue) return;
|
4871 |
|
4872 | this.$emit('input', event.target.value);
|
4873 |
|
4874 |
|
4875 |
|
4876 | this.$nextTick(this.setNativeInputValue);
|
4877 | },
|
4878 | handleChange: function handleChange(event) {
|
4879 | this.$emit('change', event.target.value);
|
4880 | },
|
4881 | calcIconOffset: function calcIconOffset(place) {
|
4882 | var elList = [].slice.call(this.$el.querySelectorAll('.el-input__' + place) || []);
|
4883 | if (!elList.length) return;
|
4884 | var el = null;
|
4885 | for (var i = 0; i < elList.length; i++) {
|
4886 | if (elList[i].parentNode === this.$el) {
|
4887 | el = elList[i];
|
4888 | break;
|
4889 | }
|
4890 | }
|
4891 | if (!el) return;
|
4892 | var pendantMap = {
|
4893 | suffix: 'append',
|
4894 | prefix: 'prepend'
|
4895 | };
|
4896 |
|
4897 | var pendant = pendantMap[place];
|
4898 | if (this.$slots[pendant]) {
|
4899 | el.style.transform = 'translateX(' + (place === 'suffix' ? '-' : '') + this.$el.querySelector('.el-input-group__' + pendant).offsetWidth + 'px)';
|
4900 | } else {
|
4901 | el.removeAttribute('style');
|
4902 | }
|
4903 | },
|
4904 | updateIconOffset: function updateIconOffset() {
|
4905 | this.calcIconOffset('prefix');
|
4906 | this.calcIconOffset('suffix');
|
4907 | },
|
4908 | clear: function clear() {
|
4909 | this.$emit('input', '');
|
4910 | this.$emit('change', '');
|
4911 | this.$emit('clear');
|
4912 | },
|
4913 | handlePasswordVisible: function handlePasswordVisible() {
|
4914 | this.passwordVisible = !this.passwordVisible;
|
4915 | this.focus();
|
4916 | },
|
4917 | getInput: function getInput() {
|
4918 | return this.$refs.input || this.$refs.textarea;
|
4919 | },
|
4920 | getSuffixVisible: function getSuffixVisible() {
|
4921 | return this.$slots.suffix || this.suffixIcon || this.showClear || this.showPassword || this.isWordLimitVisible || this.validateState && this.needStatusIcon;
|
4922 | }
|
4923 | },
|
4924 |
|
4925 | created: function created() {
|
4926 | this.$on('inputSelect', this.select);
|
4927 | },
|
4928 | mounted: function mounted() {
|
4929 | this.setNativeInputValue();
|
4930 | this.resizeTextarea();
|
4931 | this.updateIconOffset();
|
4932 | },
|
4933 | updated: function updated() {
|
4934 | this.$nextTick(this.updateIconOffset);
|
4935 | }
|
4936 | });
|
4937 |
|
4938 | var src_inputvue_type_script_lang_js_ = (inputvue_type_script_lang_js_);
|
4939 |
|
4940 |
|
4941 |
|
4942 |
|
4943 |
|
4944 |
|
4945 |
|
4946 |
|
4947 | var input_component = normalizeComponent(
|
4948 | src_inputvue_type_script_lang_js_,
|
4949 | inputvue_type_template_id_343dd774_render,
|
4950 | inputvue_type_template_id_343dd774_staticRenderFns,
|
4951 | false,
|
4952 | null,
|
4953 | null,
|
4954 | null
|
4955 |
|
4956 | )
|
4957 |
|
4958 |
|
4959 | if (false) { var input_api; }
|
4960 | input_component.options.__file = "packages/input/src/input.vue"
|
4961 | var src_input = (input_component.exports);
|
4962 |
|
4963 |
|
4964 |
|
4965 |
|
4966 | src_input.install = function (Vue) {
|
4967 | Vue.component(src_input.name, src_input);
|
4968 | };
|
4969 |
|
4970 | var packages_input = (src_input);
|
4971 |
|
4972 | var input_numbervue_type_template_id_42f8cf66_render = function() {
|
4973 | var _vm = this
|
4974 | var _h = _vm.$createElement
|
4975 | var _c = _vm._self._c || _h
|
4976 | return _c(
|
4977 | "div",
|
4978 | {
|
4979 | class: [
|
4980 | "el-input-number",
|
4981 | _vm.inputNumberSize ? "el-input-number--" + _vm.inputNumberSize : "",
|
4982 | { "is-disabled": _vm.inputNumberDisabled },
|
4983 | { "is-without-controls": !_vm.controls },
|
4984 | { "is-controls-right": _vm.controlsAtRight }
|
4985 | ],
|
4986 | on: {
|
4987 | dragstart: function($event) {
|
4988 | $event.preventDefault()
|
4989 | }
|
4990 | }
|
4991 | },
|
4992 | [
|
4993 | _vm.controls
|
4994 | ? _c(
|
4995 | "span",
|
4996 | {
|
4997 | directives: [
|
4998 | {
|
4999 | name: "repeat-click",
|
5000 | rawName: "v-repeat-click",
|
5001 | value: _vm.decrease,
|
5002 | expression: "decrease"
|
5003 | }
|
5004 | ],
|
5005 | staticClass: "el-input-number__decrease",
|
5006 | class: { "is-disabled": _vm.minDisabled },
|
5007 | attrs: { role: "button" },
|
5008 | on: {
|
5009 | keydown: function($event) {
|
5010 | if (
|
5011 | !("button" in $event) &&
|
5012 | _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
|
5013 | ) {
|
5014 | return null
|
5015 | }
|
5016 | return _vm.decrease($event)
|
5017 | }
|
5018 | }
|
5019 | },
|
5020 | [
|
5021 | _c("i", {
|
5022 | class:
|
5023 | "el-icon-" + (_vm.controlsAtRight ? "arrow-down" : "minus")
|
5024 | })
|
5025 | ]
|
5026 | )
|
5027 | : _vm._e(),
|
5028 | _vm.controls
|
5029 | ? _c(
|
5030 | "span",
|
5031 | {
|
5032 | directives: [
|
5033 | {
|
5034 | name: "repeat-click",
|
5035 | rawName: "v-repeat-click",
|
5036 | value: _vm.increase,
|
5037 | expression: "increase"
|
5038 | }
|
5039 | ],
|
5040 | staticClass: "el-input-number__increase",
|
5041 | class: { "is-disabled": _vm.maxDisabled },
|
5042 | attrs: { role: "button" },
|
5043 | on: {
|
5044 | keydown: function($event) {
|
5045 | if (
|
5046 | !("button" in $event) &&
|
5047 | _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
|
5048 | ) {
|
5049 | return null
|
5050 | }
|
5051 | return _vm.increase($event)
|
5052 | }
|
5053 | }
|
5054 | },
|
5055 | [
|
5056 | _c("i", {
|
5057 | class: "el-icon-" + (_vm.controlsAtRight ? "arrow-up" : "plus")
|
5058 | })
|
5059 | ]
|
5060 | )
|
5061 | : _vm._e(),
|
5062 | _c("el-input", {
|
5063 | ref: "input",
|
5064 | attrs: {
|
5065 | value: _vm.displayValue,
|
5066 | placeholder: _vm.placeholder,
|
5067 | disabled: _vm.inputNumberDisabled,
|
5068 | size: _vm.inputNumberSize,
|
5069 | max: _vm.max,
|
5070 | min: _vm.min,
|
5071 | name: _vm.name,
|
5072 | label: _vm.label
|
5073 | },
|
5074 | on: {
|
5075 | blur: _vm.handleBlur,
|
5076 | focus: _vm.handleFocus,
|
5077 | input: _vm.handleInput,
|
5078 | change: _vm.handleInputChange
|
5079 | },
|
5080 | nativeOn: {
|
5081 | keydown: [
|
5082 | function($event) {
|
5083 | if (
|
5084 | !("button" in $event) &&
|
5085 | _vm._k($event.keyCode, "up", 38, $event.key, ["Up", "ArrowUp"])
|
5086 | ) {
|
5087 | return null
|
5088 | }
|
5089 | $event.preventDefault()
|
5090 | return _vm.increase($event)
|
5091 | },
|
5092 | function($event) {
|
5093 | if (
|
5094 | !("button" in $event) &&
|
5095 | _vm._k($event.keyCode, "down", 40, $event.key, [
|
5096 | "Down",
|
5097 | "ArrowDown"
|
5098 | ])
|
5099 | ) {
|
5100 | return null
|
5101 | }
|
5102 | $event.preventDefault()
|
5103 | return _vm.decrease($event)
|
5104 | }
|
5105 | ]
|
5106 | }
|
5107 | })
|
5108 | ],
|
5109 | 1
|
5110 | )
|
5111 | }
|
5112 | var input_numbervue_type_template_id_42f8cf66_staticRenderFns = []
|
5113 | input_numbervue_type_template_id_42f8cf66_render._withStripped = true
|
5114 |
|
5115 |
|
5116 |
|
5117 |
|
5118 |
|
5119 |
|
5120 |
|
5121 | var repeat_click = ({
|
5122 | bind: function bind(el, binding, vnode) {
|
5123 | var interval = null;
|
5124 | var startTime = void 0;
|
5125 | var handler = function handler() {
|
5126 | return vnode.context[binding.expression].apply();
|
5127 | };
|
5128 | var clear = function clear() {
|
5129 | if (Date.now() - startTime < 100) {
|
5130 | handler();
|
5131 | }
|
5132 | clearInterval(interval);
|
5133 | interval = null;
|
5134 | };
|
5135 |
|
5136 | Object(dom_["on"])(el, 'mousedown', function (e) {
|
5137 | if (e.button !== 0) return;
|
5138 | startTime = Date.now();
|
5139 | Object(dom_["once"])(document, 'mouseup', clear);
|
5140 | clearInterval(interval);
|
5141 | interval = setInterval(handler, 100);
|
5142 | });
|
5143 | }
|
5144 | });
|
5145 |
|
5146 |
|
5147 |
|
5148 |
|
5149 |
|
5150 |
|
5151 |
|
5152 |
|
5153 |
|
5154 |
|
5155 |
|
5156 |
|
5157 |
|
5158 |
|
5159 |
|
5160 |
|
5161 |
|
5162 |
|
5163 |
|
5164 |
|
5165 |
|
5166 |
|
5167 |
|
5168 |
|
5169 |
|
5170 |
|
5171 |
|
5172 |
|
5173 |
|
5174 |
|
5175 |
|
5176 |
|
5177 |
|
5178 |
|
5179 |
|
5180 |
|
5181 |
|
5182 |
|
5183 |
|
5184 |
|
5185 |
|
5186 |
|
5187 |
|
5188 |
|
5189 |
|
5190 |
|
5191 |
|
5192 |
|
5193 |
|
5194 |
|
5195 |
|
5196 |
|
5197 |
|
5198 | var input_numbervue_type_script_lang_js_ = ({
|
5199 | name: 'ElInputNumber',
|
5200 | mixins: [focus_default()('input')],
|
5201 | inject: {
|
5202 | elForm: {
|
5203 | default: ''
|
5204 | },
|
5205 | elFormItem: {
|
5206 | default: ''
|
5207 | }
|
5208 | },
|
5209 | directives: {
|
5210 | repeatClick: repeat_click
|
5211 | },
|
5212 | components: {
|
5213 | ElInput: input_default.a
|
5214 | },
|
5215 | props: {
|
5216 | step: {
|
5217 | type: Number,
|
5218 | default: 1
|
5219 | },
|
5220 | stepStrictly: {
|
5221 | type: Boolean,
|
5222 | default: false
|
5223 | },
|
5224 | max: {
|
5225 | type: Number,
|
5226 | default: Infinity
|
5227 | },
|
5228 | min: {
|
5229 | type: Number,
|
5230 | default: -Infinity
|
5231 | },
|
5232 | value: {},
|
5233 | disabled: Boolean,
|
5234 | size: String,
|
5235 | controls: {
|
5236 | type: Boolean,
|
5237 | default: true
|
5238 | },
|
5239 | controlsPosition: {
|
5240 | type: String,
|
5241 | default: ''
|
5242 | },
|
5243 | name: String,
|
5244 | label: String,
|
5245 | placeholder: String,
|
5246 | precision: {
|
5247 | type: Number,
|
5248 | validator: function validator(val) {
|
5249 | return val >= 0 && val === parseInt(val, 10);
|
5250 | }
|
5251 | }
|
5252 | },
|
5253 | data: function data() {
|
5254 | return {
|
5255 | currentValue: 0,
|
5256 | userInput: null
|
5257 | };
|
5258 | },
|
5259 |
|
5260 | watch: {
|
5261 | value: {
|
5262 | immediate: true,
|
5263 | handler: function handler(value) {
|
5264 | var newVal = value === undefined ? value : Number(value);
|
5265 | if (newVal !== undefined) {
|
5266 | if (isNaN(newVal)) {
|
5267 | return;
|
5268 | }
|
5269 |
|
5270 | if (this.stepStrictly) {
|
5271 | var stepPrecision = this.getPrecision(this.step);
|
5272 | var precisionFactor = Math.pow(10, stepPrecision);
|
5273 | newVal = Math.round(newVal / this.step) * precisionFactor * this.step / precisionFactor;
|
5274 | }
|
5275 |
|
5276 | if (this.precision !== undefined) {
|
5277 | newVal = this.toPrecision(newVal, this.precision);
|
5278 | }
|
5279 | }
|
5280 | if (newVal >= this.max) newVal = this.max;
|
5281 | if (newVal <= this.min) newVal = this.min;
|
5282 | this.currentValue = newVal;
|
5283 | this.userInput = null;
|
5284 | this.$emit('input', newVal);
|
5285 | }
|
5286 | }
|
5287 | },
|
5288 | computed: {
|
5289 | minDisabled: function minDisabled() {
|
5290 | return this._decrease(this.value, this.step) < this.min;
|
5291 | },
|
5292 | maxDisabled: function maxDisabled() {
|
5293 | return this._increase(this.value, this.step) > this.max;
|
5294 | },
|
5295 | numPrecision: function numPrecision() {
|
5296 | var value = this.value,
|
5297 | step = this.step,
|
5298 | getPrecision = this.getPrecision,
|
5299 | precision = this.precision;
|
5300 |
|
5301 | var stepPrecision = getPrecision(step);
|
5302 | if (precision !== undefined) {
|
5303 | if (stepPrecision > precision) {
|
5304 | console.warn('[Element Warn][InputNumber]precision should not be less than the decimal places of step');
|
5305 | }
|
5306 | return precision;
|
5307 | } else {
|
5308 | return Math.max(getPrecision(value), stepPrecision);
|
5309 | }
|
5310 | },
|
5311 | controlsAtRight: function controlsAtRight() {
|
5312 | return this.controls && this.controlsPosition === 'right';
|
5313 | },
|
5314 | _elFormItemSize: function _elFormItemSize() {
|
5315 | return (this.elFormItem || {}).elFormItemSize;
|
5316 | },
|
5317 | inputNumberSize: function inputNumberSize() {
|
5318 | return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
5319 | },
|
5320 | inputNumberDisabled: function inputNumberDisabled() {
|
5321 | return this.disabled || !!(this.elForm || {}).disabled;
|
5322 | },
|
5323 | displayValue: function displayValue() {
|
5324 | if (this.userInput !== null) {
|
5325 | return this.userInput;
|
5326 | }
|
5327 |
|
5328 | var currentValue = this.currentValue;
|
5329 |
|
5330 | if (typeof currentValue === 'number') {
|
5331 | if (this.stepStrictly) {
|
5332 | var stepPrecision = this.getPrecision(this.step);
|
5333 | var precisionFactor = Math.pow(10, stepPrecision);
|
5334 | currentValue = Math.round(currentValue / this.step) * precisionFactor * this.step / precisionFactor;
|
5335 | }
|
5336 |
|
5337 | if (this.precision !== undefined) {
|
5338 | currentValue = currentValue.toFixed(this.precision);
|
5339 | }
|
5340 | }
|
5341 |
|
5342 | return currentValue;
|
5343 | }
|
5344 | },
|
5345 | methods: {
|
5346 | toPrecision: function toPrecision(num, precision) {
|
5347 | if (precision === undefined) precision = this.numPrecision;
|
5348 | return parseFloat(Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision));
|
5349 | },
|
5350 | getPrecision: function getPrecision(value) {
|
5351 | if (value === undefined) return 0;
|
5352 | var valueString = value.toString();
|
5353 | var dotPosition = valueString.indexOf('.');
|
5354 | var precision = 0;
|
5355 | if (dotPosition !== -1) {
|
5356 | precision = valueString.length - dotPosition - 1;
|
5357 | }
|
5358 | return precision;
|
5359 | },
|
5360 | _increase: function _increase(val, step) {
|
5361 | if (typeof val !== 'number' && val !== undefined) return this.currentValue;
|
5362 |
|
5363 | var precisionFactor = Math.pow(10, this.numPrecision);
|
5364 |
|
5365 | return this.toPrecision((precisionFactor * val + precisionFactor * step) / precisionFactor);
|
5366 | },
|
5367 | _decrease: function _decrease(val, step) {
|
5368 | if (typeof val !== 'number' && val !== undefined) return this.currentValue;
|
5369 |
|
5370 | var precisionFactor = Math.pow(10, this.numPrecision);
|
5371 |
|
5372 | return this.toPrecision((precisionFactor * val - precisionFactor * step) / precisionFactor);
|
5373 | },
|
5374 | increase: function increase() {
|
5375 | if (this.inputNumberDisabled || this.maxDisabled) return;
|
5376 | var value = this.value || 0;
|
5377 | var newVal = this._increase(value, this.step);
|
5378 | this.setCurrentValue(newVal);
|
5379 | },
|
5380 | decrease: function decrease() {
|
5381 | if (this.inputNumberDisabled || this.minDisabled) return;
|
5382 | var value = this.value || 0;
|
5383 | var newVal = this._decrease(value, this.step);
|
5384 | this.setCurrentValue(newVal);
|
5385 | },
|
5386 | handleBlur: function handleBlur(event) {
|
5387 | this.$emit('blur', event);
|
5388 | },
|
5389 | handleFocus: function handleFocus(event) {
|
5390 | this.$emit('focus', event);
|
5391 | },
|
5392 | setCurrentValue: function setCurrentValue(newVal) {
|
5393 | var oldVal = this.currentValue;
|
5394 | if (typeof newVal === 'number' && this.precision !== undefined) {
|
5395 | newVal = this.toPrecision(newVal, this.precision);
|
5396 | }
|
5397 | if (newVal >= this.max) newVal = this.max;
|
5398 | if (newVal <= this.min) newVal = this.min;
|
5399 | if (oldVal === newVal) return;
|
5400 | this.userInput = null;
|
5401 | this.$emit('input', newVal);
|
5402 | this.$emit('change', newVal, oldVal);
|
5403 | this.currentValue = newVal;
|
5404 | },
|
5405 | handleInput: function handleInput(value) {
|
5406 | this.userInput = value;
|
5407 | },
|
5408 | handleInputChange: function handleInputChange(value) {
|
5409 | var newVal = value === '' ? undefined : Number(value);
|
5410 | if (!isNaN(newVal) || value === '') {
|
5411 | this.setCurrentValue(newVal);
|
5412 | }
|
5413 | this.userInput = null;
|
5414 | },
|
5415 | select: function select() {
|
5416 | this.$refs.input.select();
|
5417 | }
|
5418 | },
|
5419 | mounted: function mounted() {
|
5420 | var innerInput = this.$refs.input.$refs.input;
|
5421 | innerInput.setAttribute('role', 'spinbutton');
|
5422 | innerInput.setAttribute('aria-valuemax', this.max);
|
5423 | innerInput.setAttribute('aria-valuemin', this.min);
|
5424 | innerInput.setAttribute('aria-valuenow', this.currentValue);
|
5425 | innerInput.setAttribute('aria-disabled', this.inputNumberDisabled);
|
5426 | },
|
5427 | updated: function updated() {
|
5428 | if (!this.$refs || !this.$refs.input) return;
|
5429 | var innerInput = this.$refs.input.$refs.input;
|
5430 | innerInput.setAttribute('aria-valuenow', this.currentValue);
|
5431 | }
|
5432 | });
|
5433 |
|
5434 | var src_input_numbervue_type_script_lang_js_ = (input_numbervue_type_script_lang_js_);
|
5435 |
|
5436 |
|
5437 |
|
5438 |
|
5439 |
|
5440 |
|
5441 |
|
5442 |
|
5443 | var input_number_component = normalizeComponent(
|
5444 | src_input_numbervue_type_script_lang_js_,
|
5445 | input_numbervue_type_template_id_42f8cf66_render,
|
5446 | input_numbervue_type_template_id_42f8cf66_staticRenderFns,
|
5447 | false,
|
5448 | null,
|
5449 | null,
|
5450 | null
|
5451 |
|
5452 | )
|
5453 |
|
5454 |
|
5455 | if (false) { var input_number_api; }
|
5456 | input_number_component.options.__file = "packages/input-number/src/input-number.vue"
|
5457 | var input_number = (input_number_component.exports);
|
5458 |
|
5459 |
|
5460 |
|
5461 |
|
5462 | input_number.install = function (Vue) {
|
5463 | Vue.component(input_number.name, input_number);
|
5464 | };
|
5465 |
|
5466 | var packages_input_number = (input_number);
|
5467 |
|
5468 | var radiovue_type_template_id_69cd6268_render = function() {
|
5469 | var _vm = this
|
5470 | var _h = _vm.$createElement
|
5471 | var _c = _vm._self._c || _h
|
5472 | return _c(
|
5473 | "label",
|
5474 | {
|
5475 | staticClass: "el-radio",
|
5476 | class: [
|
5477 | _vm.border && _vm.radioSize ? "el-radio--" + _vm.radioSize : "",
|
5478 | { "is-disabled": _vm.isDisabled },
|
5479 | { "is-focus": _vm.focus },
|
5480 | { "is-bordered": _vm.border },
|
5481 | { "is-checked": _vm.model === _vm.label }
|
5482 | ],
|
5483 | attrs: {
|
5484 | role: "radio",
|
5485 | "aria-checked": _vm.model === _vm.label,
|
5486 | "aria-disabled": _vm.isDisabled,
|
5487 | tabindex: _vm.tabIndex
|
5488 | },
|
5489 | on: {
|
5490 | keydown: function($event) {
|
5491 | if (
|
5492 | !("button" in $event) &&
|
5493 | _vm._k($event.keyCode, "space", 32, $event.key, [" ", "Spacebar"])
|
5494 | ) {
|
5495 | return null
|
5496 | }
|
5497 | $event.stopPropagation()
|
5498 | $event.preventDefault()
|
5499 | _vm.model = _vm.isDisabled ? _vm.model : _vm.label
|
5500 | }
|
5501 | }
|
5502 | },
|
5503 | [
|
5504 | _c(
|
5505 | "span",
|
5506 | {
|
5507 | staticClass: "el-radio__input",
|
5508 | class: {
|
5509 | "is-disabled": _vm.isDisabled,
|
5510 | "is-checked": _vm.model === _vm.label
|
5511 | }
|
5512 | },
|
5513 | [
|
5514 | _c("span", { staticClass: "el-radio__inner" }),
|
5515 | _c("input", {
|
5516 | directives: [
|
5517 | {
|
5518 | name: "model",
|
5519 | rawName: "v-model",
|
5520 | value: _vm.model,
|
5521 | expression: "model"
|
5522 | }
|
5523 | ],
|
5524 | ref: "radio",
|
5525 | staticClass: "el-radio__original",
|
5526 | attrs: {
|
5527 | type: "radio",
|
5528 | "aria-hidden": "true",
|
5529 | name: _vm.name,
|
5530 | disabled: _vm.isDisabled,
|
5531 | tabindex: "-1"
|
5532 | },
|
5533 | domProps: {
|
5534 | value: _vm.label,
|
5535 | checked: _vm._q(_vm.model, _vm.label)
|
5536 | },
|
5537 | on: {
|
5538 | focus: function($event) {
|
5539 | _vm.focus = true
|
5540 | },
|
5541 | blur: function($event) {
|
5542 | _vm.focus = false
|
5543 | },
|
5544 | change: [
|
5545 | function($event) {
|
5546 | _vm.model = _vm.label
|
5547 | },
|
5548 | _vm.handleChange
|
5549 | ]
|
5550 | }
|
5551 | })
|
5552 | ]
|
5553 | ),
|
5554 | _c(
|
5555 | "span",
|
5556 | {
|
5557 | staticClass: "el-radio__label",
|
5558 | on: {
|
5559 | keydown: function($event) {
|
5560 | $event.stopPropagation()
|
5561 | }
|
5562 | }
|
5563 | },
|
5564 | [
|
5565 | _vm._t("default"),
|
5566 | !_vm.$slots.default ? [_vm._v(_vm._s(_vm.label))] : _vm._e()
|
5567 | ],
|
5568 | 2
|
5569 | )
|
5570 | ]
|
5571 | )
|
5572 | }
|
5573 | var radiovue_type_template_id_69cd6268_staticRenderFns = []
|
5574 | radiovue_type_template_id_69cd6268_render._withStripped = true
|
5575 |
|
5576 |
|
5577 |
|
5578 |
|
5579 |
|
5580 |
|
5581 |
|
5582 |
|
5583 |
|
5584 |
|
5585 |
|
5586 |
|
5587 |
|
5588 |
|
5589 |
|
5590 |
|
5591 |
|
5592 |
|
5593 |
|
5594 |
|
5595 |
|
5596 |
|
5597 |
|
5598 |
|
5599 |
|
5600 |
|
5601 |
|
5602 |
|
5603 |
|
5604 |
|
5605 |
|
5606 |
|
5607 |
|
5608 |
|
5609 |
|
5610 |
|
5611 |
|
5612 |
|
5613 |
|
5614 |
|
5615 |
|
5616 |
|
5617 |
|
5618 |
|
5619 |
|
5620 |
|
5621 |
|
5622 |
|
5623 |
|
5624 |
|
5625 |
|
5626 |
|
5627 | var radiovue_type_script_lang_js_ = ({
|
5628 | name: 'ElRadio',
|
5629 |
|
5630 | mixins: [emitter_default.a],
|
5631 |
|
5632 | inject: {
|
5633 | elForm: {
|
5634 | default: ''
|
5635 | },
|
5636 |
|
5637 | elFormItem: {
|
5638 | default: ''
|
5639 | }
|
5640 | },
|
5641 |
|
5642 | componentName: 'ElRadio',
|
5643 |
|
5644 | props: {
|
5645 | value: {},
|
5646 | label: {},
|
5647 | disabled: Boolean,
|
5648 | name: String,
|
5649 | border: Boolean,
|
5650 | size: String
|
5651 | },
|
5652 |
|
5653 | data: function data() {
|
5654 | return {
|
5655 | focus: false
|
5656 | };
|
5657 | },
|
5658 |
|
5659 | computed: {
|
5660 | isGroup: function isGroup() {
|
5661 | var parent = this.$parent;
|
5662 | while (parent) {
|
5663 | if (parent.$options.componentName !== 'ElRadioGroup') {
|
5664 | parent = parent.$parent;
|
5665 | } else {
|
5666 | this._radioGroup = parent;
|
5667 | return true;
|
5668 | }
|
5669 | }
|
5670 | return false;
|
5671 | },
|
5672 |
|
5673 | model: {
|
5674 | get: function get() {
|
5675 | return this.isGroup ? this._radioGroup.value : this.value;
|
5676 | },
|
5677 | set: function set(val) {
|
5678 | if (this.isGroup) {
|
5679 | this.dispatch('ElRadioGroup', 'input', [val]);
|
5680 | } else {
|
5681 | this.$emit('input', val);
|
5682 | }
|
5683 | this.$refs.radio && (this.$refs.radio.checked = this.model === this.label);
|
5684 | }
|
5685 | },
|
5686 | _elFormItemSize: function _elFormItemSize() {
|
5687 | return (this.elFormItem || {}).elFormItemSize;
|
5688 | },
|
5689 | radioSize: function radioSize() {
|
5690 | var temRadioSize = this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
5691 | return this.isGroup ? this._radioGroup.radioGroupSize || temRadioSize : temRadioSize;
|
5692 | },
|
5693 | isDisabled: function isDisabled() {
|
5694 | return this.isGroup ? this._radioGroup.disabled || this.disabled || (this.elForm || {}).disabled : this.disabled || (this.elForm || {}).disabled;
|
5695 | },
|
5696 | tabIndex: function tabIndex() {
|
5697 | return this.isDisabled || this.isGroup && this.model !== this.label ? -1 : 0;
|
5698 | }
|
5699 | },
|
5700 |
|
5701 | methods: {
|
5702 | handleChange: function handleChange() {
|
5703 | var _this = this;
|
5704 |
|
5705 | this.$nextTick(function () {
|
5706 | _this.$emit('change', _this.model);
|
5707 | _this.isGroup && _this.dispatch('ElRadioGroup', 'handleChange', _this.model);
|
5708 | });
|
5709 | }
|
5710 | }
|
5711 | });
|
5712 |
|
5713 | var src_radiovue_type_script_lang_js_ = (radiovue_type_script_lang_js_);
|
5714 |
|
5715 |
|
5716 |
|
5717 |
|
5718 |
|
5719 |
|
5720 |
|
5721 |
|
5722 | var radio_component = normalizeComponent(
|
5723 | src_radiovue_type_script_lang_js_,
|
5724 | radiovue_type_template_id_69cd6268_render,
|
5725 | radiovue_type_template_id_69cd6268_staticRenderFns,
|
5726 | false,
|
5727 | null,
|
5728 | null,
|
5729 | null
|
5730 |
|
5731 | )
|
5732 |
|
5733 |
|
5734 | if (false) { var radio_api; }
|
5735 | radio_component.options.__file = "packages/radio/src/radio.vue"
|
5736 | var src_radio = (radio_component.exports);
|
5737 |
|
5738 |
|
5739 |
|
5740 |
|
5741 | src_radio.install = function (Vue) {
|
5742 | Vue.component(src_radio.name, src_radio);
|
5743 | };
|
5744 |
|
5745 | var packages_radio = (src_radio);
|
5746 |
|
5747 | var radio_groupvue_type_template_id_818a704c_render = function() {
|
5748 | var _vm = this
|
5749 | var _h = _vm.$createElement
|
5750 | var _c = _vm._self._c || _h
|
5751 | return _c(
|
5752 | _vm._elTag,
|
5753 | {
|
5754 | tag: "component",
|
5755 | staticClass: "el-radio-group",
|
5756 | attrs: { role: "radiogroup" },
|
5757 | on: { keydown: _vm.handleKeydown }
|
5758 | },
|
5759 | [_vm._t("default")],
|
5760 | 2
|
5761 | )
|
5762 | }
|
5763 | var radio_groupvue_type_template_id_818a704c_staticRenderFns = []
|
5764 | radio_groupvue_type_template_id_818a704c_render._withStripped = true
|
5765 |
|
5766 |
|
5767 |
|
5768 |
|
5769 |
|
5770 |
|
5771 |
|
5772 |
|
5773 |
|
5774 |
|
5775 |
|
5776 |
|
5777 |
|
5778 |
|
5779 |
|
5780 |
|
5781 |
|
5782 |
|
5783 | var keyCode = Object.freeze({
|
5784 | LEFT: 37,
|
5785 | UP: 38,
|
5786 | RIGHT: 39,
|
5787 | DOWN: 40
|
5788 | });
|
5789 | var radio_groupvue_type_script_lang_js_ = ({
|
5790 | name: 'ElRadioGroup',
|
5791 |
|
5792 | componentName: 'ElRadioGroup',
|
5793 |
|
5794 | inject: {
|
5795 | elFormItem: {
|
5796 | default: ''
|
5797 | }
|
5798 | },
|
5799 |
|
5800 | mixins: [emitter_default.a],
|
5801 |
|
5802 | props: {
|
5803 | value: {},
|
5804 | size: String,
|
5805 | fill: String,
|
5806 | textColor: String,
|
5807 | disabled: Boolean
|
5808 | },
|
5809 |
|
5810 | computed: {
|
5811 | _elFormItemSize: function _elFormItemSize() {
|
5812 | return (this.elFormItem || {}).elFormItemSize;
|
5813 | },
|
5814 | _elTag: function _elTag() {
|
5815 | return (this.$vnode.data || {}).tag || 'div';
|
5816 | },
|
5817 | radioGroupSize: function radioGroupSize() {
|
5818 | return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
5819 | }
|
5820 | },
|
5821 |
|
5822 | created: function created() {
|
5823 | var _this = this;
|
5824 |
|
5825 | this.$on('handleChange', function (value) {
|
5826 | _this.$emit('change', value);
|
5827 | });
|
5828 | },
|
5829 | mounted: function mounted() {
|
5830 |
|
5831 | var radios = this.$el.querySelectorAll('[type=radio]');
|
5832 | var firstLabel = this.$el.querySelectorAll('[role=radio]')[0];
|
5833 | if (![].some.call(radios, function (radio) {
|
5834 | return radio.checked;
|
5835 | }) && firstLabel) {
|
5836 | firstLabel.tabIndex = 0;
|
5837 | }
|
5838 | },
|
5839 |
|
5840 | methods: {
|
5841 | handleKeydown: function handleKeydown(e) {
|
5842 |
|
5843 | var target = e.target;
|
5844 | var className = target.nodeName === 'INPUT' ? '[type=radio]' : '[role=radio]';
|
5845 | var radios = this.$el.querySelectorAll(className);
|
5846 | var length = radios.length;
|
5847 | var index = [].indexOf.call(radios, target);
|
5848 | var roleRadios = this.$el.querySelectorAll('[role=radio]');
|
5849 | switch (e.keyCode) {
|
5850 | case keyCode.LEFT:
|
5851 | case keyCode.UP:
|
5852 | e.stopPropagation();
|
5853 | e.preventDefault();
|
5854 | if (index === 0) {
|
5855 | roleRadios[length - 1].click();
|
5856 | roleRadios[length - 1].focus();
|
5857 | } else {
|
5858 | roleRadios[index - 1].click();
|
5859 | roleRadios[index - 1].focus();
|
5860 | }
|
5861 | break;
|
5862 | case keyCode.RIGHT:
|
5863 | case keyCode.DOWN:
|
5864 | if (index === length - 1) {
|
5865 | e.stopPropagation();
|
5866 | e.preventDefault();
|
5867 | roleRadios[0].click();
|
5868 | roleRadios[0].focus();
|
5869 | } else {
|
5870 | roleRadios[index + 1].click();
|
5871 | roleRadios[index + 1].focus();
|
5872 | }
|
5873 | break;
|
5874 | default:
|
5875 | break;
|
5876 | }
|
5877 | }
|
5878 | },
|
5879 | watch: {
|
5880 | value: function value(_value) {
|
5881 | this.dispatch('ElFormItem', 'el.form.change', [this.value]);
|
5882 | }
|
5883 | }
|
5884 | });
|
5885 |
|
5886 | var src_radio_groupvue_type_script_lang_js_ = (radio_groupvue_type_script_lang_js_);
|
5887 |
|
5888 |
|
5889 |
|
5890 |
|
5891 |
|
5892 |
|
5893 |
|
5894 |
|
5895 | var radio_group_component = normalizeComponent(
|
5896 | src_radio_groupvue_type_script_lang_js_,
|
5897 | radio_groupvue_type_template_id_818a704c_render,
|
5898 | radio_groupvue_type_template_id_818a704c_staticRenderFns,
|
5899 | false,
|
5900 | null,
|
5901 | null,
|
5902 | null
|
5903 |
|
5904 | )
|
5905 |
|
5906 |
|
5907 | if (false) { var radio_group_api; }
|
5908 | radio_group_component.options.__file = "packages/radio/src/radio-group.vue"
|
5909 | var radio_group = (radio_group_component.exports);
|
5910 |
|
5911 |
|
5912 |
|
5913 |
|
5914 | radio_group.install = function (Vue) {
|
5915 | Vue.component(radio_group.name, radio_group);
|
5916 | };
|
5917 |
|
5918 | var packages_radio_group = (radio_group);
|
5919 |
|
5920 | var radio_buttonvue_type_template_id_18a77a32_render = function() {
|
5921 | var _vm = this
|
5922 | var _h = _vm.$createElement
|
5923 | var _c = _vm._self._c || _h
|
5924 | return _c(
|
5925 | "label",
|
5926 | {
|
5927 | staticClass: "el-radio-button",
|
5928 | class: [
|
5929 | _vm.size ? "el-radio-button--" + _vm.size : "",
|
5930 | { "is-active": _vm.value === _vm.label },
|
5931 | { "is-disabled": _vm.isDisabled },
|
5932 | { "is-focus": _vm.focus }
|
5933 | ],
|
5934 | attrs: {
|
5935 | role: "radio",
|
5936 | "aria-checked": _vm.value === _vm.label,
|
5937 | "aria-disabled": _vm.isDisabled,
|
5938 | tabindex: _vm.tabIndex
|
5939 | },
|
5940 | on: {
|
5941 | keydown: function($event) {
|
5942 | if (
|
5943 | !("button" in $event) &&
|
5944 | _vm._k($event.keyCode, "space", 32, $event.key, [" ", "Spacebar"])
|
5945 | ) {
|
5946 | return null
|
5947 | }
|
5948 | $event.stopPropagation()
|
5949 | $event.preventDefault()
|
5950 | _vm.value = _vm.isDisabled ? _vm.value : _vm.label
|
5951 | }
|
5952 | }
|
5953 | },
|
5954 | [
|
5955 | _c("input", {
|
5956 | directives: [
|
5957 | {
|
5958 | name: "model",
|
5959 | rawName: "v-model",
|
5960 | value: _vm.value,
|
5961 | expression: "value"
|
5962 | }
|
5963 | ],
|
5964 | staticClass: "el-radio-button__orig-radio",
|
5965 | attrs: {
|
5966 | type: "radio",
|
5967 | name: _vm.name,
|
5968 | disabled: _vm.isDisabled,
|
5969 | tabindex: "-1"
|
5970 | },
|
5971 | domProps: { value: _vm.label, checked: _vm._q(_vm.value, _vm.label) },
|
5972 | on: {
|
5973 | change: [
|
5974 | function($event) {
|
5975 | _vm.value = _vm.label
|
5976 | },
|
5977 | _vm.handleChange
|
5978 | ],
|
5979 | focus: function($event) {
|
5980 | _vm.focus = true
|
5981 | },
|
5982 | blur: function($event) {
|
5983 | _vm.focus = false
|
5984 | }
|
5985 | }
|
5986 | }),
|
5987 | _c(
|
5988 | "span",
|
5989 | {
|
5990 | staticClass: "el-radio-button__inner",
|
5991 | style: _vm.value === _vm.label ? _vm.activeStyle : null,
|
5992 | on: {
|
5993 | keydown: function($event) {
|
5994 | $event.stopPropagation()
|
5995 | }
|
5996 | }
|
5997 | },
|
5998 | [
|
5999 | _vm._t("default"),
|
6000 | !_vm.$slots.default ? [_vm._v(_vm._s(_vm.label))] : _vm._e()
|
6001 | ],
|
6002 | 2
|
6003 | )
|
6004 | ]
|
6005 | )
|
6006 | }
|
6007 | var radio_buttonvue_type_template_id_18a77a32_staticRenderFns = []
|
6008 | radio_buttonvue_type_template_id_18a77a32_render._withStripped = true
|
6009 |
|
6010 |
|
6011 |
|
6012 |
|
6013 |
|
6014 |
|
6015 |
|
6016 |
|
6017 |
|
6018 |
|
6019 |
|
6020 |
|
6021 |
|
6022 |
|
6023 |
|
6024 |
|
6025 |
|
6026 |
|
6027 |
|
6028 |
|
6029 |
|
6030 |
|
6031 |
|
6032 |
|
6033 |
|
6034 |
|
6035 |
|
6036 |
|
6037 |
|
6038 |
|
6039 |
|
6040 |
|
6041 |
|
6042 |
|
6043 |
|
6044 |
|
6045 |
|
6046 |
|
6047 |
|
6048 |
|
6049 |
|
6050 |
|
6051 |
|
6052 |
|
6053 | var radio_buttonvue_type_script_lang_js_ = ({
|
6054 | name: 'ElRadioButton',
|
6055 |
|
6056 | mixins: [emitter_default.a],
|
6057 |
|
6058 | inject: {
|
6059 | elForm: {
|
6060 | default: ''
|
6061 | },
|
6062 | elFormItem: {
|
6063 | default: ''
|
6064 | }
|
6065 | },
|
6066 |
|
6067 | props: {
|
6068 | label: {},
|
6069 | disabled: Boolean,
|
6070 | name: String
|
6071 | },
|
6072 | data: function data() {
|
6073 | return {
|
6074 | focus: false
|
6075 | };
|
6076 | },
|
6077 |
|
6078 | computed: {
|
6079 | value: {
|
6080 | get: function get() {
|
6081 | return this._radioGroup.value;
|
6082 | },
|
6083 | set: function set(value) {
|
6084 | this._radioGroup.$emit('input', value);
|
6085 | }
|
6086 | },
|
6087 | _radioGroup: function _radioGroup() {
|
6088 | var parent = this.$parent;
|
6089 | while (parent) {
|
6090 | if (parent.$options.componentName !== 'ElRadioGroup') {
|
6091 | parent = parent.$parent;
|
6092 | } else {
|
6093 | return parent;
|
6094 | }
|
6095 | }
|
6096 | return false;
|
6097 | },
|
6098 | activeStyle: function activeStyle() {
|
6099 | return {
|
6100 | backgroundColor: this._radioGroup.fill || '',
|
6101 | borderColor: this._radioGroup.fill || '',
|
6102 | boxShadow: this._radioGroup.fill ? '-1px 0 0 0 ' + this._radioGroup.fill : '',
|
6103 | color: this._radioGroup.textColor || ''
|
6104 | };
|
6105 | },
|
6106 | _elFormItemSize: function _elFormItemSize() {
|
6107 | return (this.elFormItem || {}).elFormItemSize;
|
6108 | },
|
6109 | size: function size() {
|
6110 | return this._radioGroup.radioGroupSize || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
6111 | },
|
6112 | isDisabled: function isDisabled() {
|
6113 | return this.disabled || this._radioGroup.disabled || (this.elForm || {}).disabled;
|
6114 | },
|
6115 | tabIndex: function tabIndex() {
|
6116 | return this.isDisabled || this._radioGroup && this.value !== this.label ? -1 : 0;
|
6117 | }
|
6118 | },
|
6119 |
|
6120 | methods: {
|
6121 | handleChange: function handleChange() {
|
6122 | var _this = this;
|
6123 |
|
6124 | this.$nextTick(function () {
|
6125 | _this.dispatch('ElRadioGroup', 'handleChange', _this.value);
|
6126 | });
|
6127 | }
|
6128 | }
|
6129 | });
|
6130 |
|
6131 | var src_radio_buttonvue_type_script_lang_js_ = (radio_buttonvue_type_script_lang_js_);
|
6132 |
|
6133 |
|
6134 |
|
6135 |
|
6136 |
|
6137 |
|
6138 |
|
6139 |
|
6140 | var radio_button_component = normalizeComponent(
|
6141 | src_radio_buttonvue_type_script_lang_js_,
|
6142 | radio_buttonvue_type_template_id_18a77a32_render,
|
6143 | radio_buttonvue_type_template_id_18a77a32_staticRenderFns,
|
6144 | false,
|
6145 | null,
|
6146 | null,
|
6147 | null
|
6148 |
|
6149 | )
|
6150 |
|
6151 |
|
6152 | if (false) { var radio_button_api; }
|
6153 | radio_button_component.options.__file = "packages/radio/src/radio-button.vue"
|
6154 | var radio_button = (radio_button_component.exports);
|
6155 |
|
6156 |
|
6157 |
|
6158 |
|
6159 | radio_button.install = function (Vue) {
|
6160 | Vue.component(radio_button.name, radio_button);
|
6161 | };
|
6162 |
|
6163 | var packages_radio_button = (radio_button);
|
6164 |
|
6165 | var checkboxvue_type_template_id_d0387074_render = function() {
|
6166 | var _vm = this
|
6167 | var _h = _vm.$createElement
|
6168 | var _c = _vm._self._c || _h
|
6169 | return _c(
|
6170 | "label",
|
6171 | {
|
6172 | staticClass: "el-checkbox",
|
6173 | class: [
|
6174 | _vm.border && _vm.checkboxSize
|
6175 | ? "el-checkbox--" + _vm.checkboxSize
|
6176 | : "",
|
6177 | { "is-disabled": _vm.isDisabled },
|
6178 | { "is-bordered": _vm.border },
|
6179 | { "is-checked": _vm.isChecked }
|
6180 | ],
|
6181 | attrs: { id: _vm.id }
|
6182 | },
|
6183 | [
|
6184 | _c(
|
6185 | "span",
|
6186 | {
|
6187 | staticClass: "el-checkbox__input",
|
6188 | class: {
|
6189 | "is-disabled": _vm.isDisabled,
|
6190 | "is-checked": _vm.isChecked,
|
6191 | "is-indeterminate": _vm.indeterminate,
|
6192 | "is-focus": _vm.focus
|
6193 | },
|
6194 | attrs: {
|
6195 | tabindex: _vm.indeterminate ? 0 : false,
|
6196 | role: _vm.indeterminate ? "checkbox" : false,
|
6197 | "aria-checked": _vm.indeterminate ? "mixed" : false
|
6198 | }
|
6199 | },
|
6200 | [
|
6201 | _c("span", { staticClass: "el-checkbox__inner" }),
|
6202 | _vm.trueLabel || _vm.falseLabel
|
6203 | ? _c("input", {
|
6204 | directives: [
|
6205 | {
|
6206 | name: "model",
|
6207 | rawName: "v-model",
|
6208 | value: _vm.model,
|
6209 | expression: "model"
|
6210 | }
|
6211 | ],
|
6212 | staticClass: "el-checkbox__original",
|
6213 | attrs: {
|
6214 | type: "checkbox",
|
6215 | "aria-hidden": _vm.indeterminate ? "true" : "false",
|
6216 | name: _vm.name,
|
6217 | disabled: _vm.isDisabled,
|
6218 | "true-value": _vm.trueLabel,
|
6219 | "false-value": _vm.falseLabel
|
6220 | },
|
6221 | domProps: {
|
6222 | checked: Array.isArray(_vm.model)
|
6223 | ? _vm._i(_vm.model, null) > -1
|
6224 | : _vm._q(_vm.model, _vm.trueLabel)
|
6225 | },
|
6226 | on: {
|
6227 | change: [
|
6228 | function($event) {
|
6229 | var $$a = _vm.model,
|
6230 | $$el = $event.target,
|
6231 | $$c = $$el.checked ? _vm.trueLabel : _vm.falseLabel
|
6232 | if (Array.isArray($$a)) {
|
6233 | var $$v = null,
|
6234 | $$i = _vm._i($$a, $$v)
|
6235 | if ($$el.checked) {
|
6236 | $$i < 0 && (_vm.model = $$a.concat([$$v]))
|
6237 | } else {
|
6238 | $$i > -1 &&
|
6239 | (_vm.model = $$a
|
6240 | .slice(0, $$i)
|
6241 | .concat($$a.slice($$i + 1)))
|
6242 | }
|
6243 | } else {
|
6244 | _vm.model = $$c
|
6245 | }
|
6246 | },
|
6247 | _vm.handleChange
|
6248 | ],
|
6249 | focus: function($event) {
|
6250 | _vm.focus = true
|
6251 | },
|
6252 | blur: function($event) {
|
6253 | _vm.focus = false
|
6254 | }
|
6255 | }
|
6256 | })
|
6257 | : _c("input", {
|
6258 | directives: [
|
6259 | {
|
6260 | name: "model",
|
6261 | rawName: "v-model",
|
6262 | value: _vm.model,
|
6263 | expression: "model"
|
6264 | }
|
6265 | ],
|
6266 | staticClass: "el-checkbox__original",
|
6267 | attrs: {
|
6268 | type: "checkbox",
|
6269 | "aria-hidden": _vm.indeterminate ? "true" : "false",
|
6270 | disabled: _vm.isDisabled,
|
6271 | name: _vm.name
|
6272 | },
|
6273 | domProps: {
|
6274 | value: _vm.label,
|
6275 | checked: Array.isArray(_vm.model)
|
6276 | ? _vm._i(_vm.model, _vm.label) > -1
|
6277 | : _vm.model
|
6278 | },
|
6279 | on: {
|
6280 | change: [
|
6281 | function($event) {
|
6282 | var $$a = _vm.model,
|
6283 | $$el = $event.target,
|
6284 | $$c = $$el.checked ? true : false
|
6285 | if (Array.isArray($$a)) {
|
6286 | var $$v = _vm.label,
|
6287 | $$i = _vm._i($$a, $$v)
|
6288 | if ($$el.checked) {
|
6289 | $$i < 0 && (_vm.model = $$a.concat([$$v]))
|
6290 | } else {
|
6291 | $$i > -1 &&
|
6292 | (_vm.model = $$a
|
6293 | .slice(0, $$i)
|
6294 | .concat($$a.slice($$i + 1)))
|
6295 | }
|
6296 | } else {
|
6297 | _vm.model = $$c
|
6298 | }
|
6299 | },
|
6300 | _vm.handleChange
|
6301 | ],
|
6302 | focus: function($event) {
|
6303 | _vm.focus = true
|
6304 | },
|
6305 | blur: function($event) {
|
6306 | _vm.focus = false
|
6307 | }
|
6308 | }
|
6309 | })
|
6310 | ]
|
6311 | ),
|
6312 | _vm.$slots.default || _vm.label
|
6313 | ? _c(
|
6314 | "span",
|
6315 | { staticClass: "el-checkbox__label" },
|
6316 | [
|
6317 | _vm._t("default"),
|
6318 | !_vm.$slots.default ? [_vm._v(_vm._s(_vm.label))] : _vm._e()
|
6319 | ],
|
6320 | 2
|
6321 | )
|
6322 | : _vm._e()
|
6323 | ]
|
6324 | )
|
6325 | }
|
6326 | var checkboxvue_type_template_id_d0387074_staticRenderFns = []
|
6327 | checkboxvue_type_template_id_d0387074_render._withStripped = true
|
6328 |
|
6329 |
|
6330 |
|
6331 |
|
6332 |
|
6333 |
|
6334 |
|
6335 |
|
6336 |
|
6337 |
|
6338 |
|
6339 |
|
6340 |
|
6341 |
|
6342 |
|
6343 |
|
6344 |
|
6345 |
|
6346 |
|
6347 |
|
6348 |
|
6349 |
|
6350 |
|
6351 |
|
6352 |
|
6353 |
|
6354 |
|
6355 |
|
6356 |
|
6357 |
|
6358 |
|
6359 |
|
6360 |
|
6361 |
|
6362 |
|
6363 |
|
6364 |
|
6365 |
|
6366 |
|
6367 |
|
6368 |
|
6369 |
|
6370 |
|
6371 |
|
6372 |
|
6373 |
|
6374 |
|
6375 |
|
6376 |
|
6377 |
|
6378 |
|
6379 |
|
6380 |
|
6381 |
|
6382 |
|
6383 |
|
6384 |
|
6385 |
|
6386 |
|
6387 |
|
6388 |
|
6389 |
|
6390 |
|
6391 | var checkboxvue_type_script_lang_js_ = ({
|
6392 | name: 'ElCheckbox',
|
6393 |
|
6394 | mixins: [emitter_default.a],
|
6395 |
|
6396 | inject: {
|
6397 | elForm: {
|
6398 | default: ''
|
6399 | },
|
6400 | elFormItem: {
|
6401 | default: ''
|
6402 | }
|
6403 | },
|
6404 |
|
6405 | componentName: 'ElCheckbox',
|
6406 |
|
6407 | data: function data() {
|
6408 | return {
|
6409 | selfModel: false,
|
6410 | focus: false,
|
6411 | isLimitExceeded: false
|
6412 | };
|
6413 | },
|
6414 |
|
6415 |
|
6416 | computed: {
|
6417 | model: {
|
6418 | get: function get() {
|
6419 | return this.isGroup ? this.store : this.value !== undefined ? this.value : this.selfModel;
|
6420 | },
|
6421 | set: function set(val) {
|
6422 | if (this.isGroup) {
|
6423 | this.isLimitExceeded = false;
|
6424 | this._checkboxGroup.min !== undefined && val.length < this._checkboxGroup.min && (this.isLimitExceeded = true);
|
6425 |
|
6426 | this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (this.isLimitExceeded = true);
|
6427 |
|
6428 | this.isLimitExceeded === false && this.dispatch('ElCheckboxGroup', 'input', [val]);
|
6429 | } else {
|
6430 | this.$emit('input', val);
|
6431 | this.selfModel = val;
|
6432 | }
|
6433 | }
|
6434 | },
|
6435 |
|
6436 | isChecked: function isChecked() {
|
6437 | if ({}.toString.call(this.model) === '[object Boolean]') {
|
6438 | return this.model;
|
6439 | } else if (Array.isArray(this.model)) {
|
6440 | return this.model.indexOf(this.label) > -1;
|
6441 | } else if (this.model !== null && this.model !== undefined) {
|
6442 | return this.model === this.trueLabel;
|
6443 | }
|
6444 | },
|
6445 | isGroup: function isGroup() {
|
6446 | var parent = this.$parent;
|
6447 | while (parent) {
|
6448 | if (parent.$options.componentName !== 'ElCheckboxGroup') {
|
6449 | parent = parent.$parent;
|
6450 | } else {
|
6451 | this._checkboxGroup = parent;
|
6452 | return true;
|
6453 | }
|
6454 | }
|
6455 | return false;
|
6456 | },
|
6457 | store: function store() {
|
6458 | return this._checkboxGroup ? this._checkboxGroup.value : this.value;
|
6459 | },
|
6460 |
|
6461 |
|
6462 |
|
6463 | isLimitDisabled: function isLimitDisabled() {
|
6464 | var _checkboxGroup = this._checkboxGroup,
|
6465 | max = _checkboxGroup.max,
|
6466 | min = _checkboxGroup.min;
|
6467 |
|
6468 | return !!(max || min) && this.model.length >= max && !this.isChecked || this.model.length <= min && this.isChecked;
|
6469 | },
|
6470 | isDisabled: function isDisabled() {
|
6471 | return this.isGroup ? this._checkboxGroup.disabled || this.disabled || (this.elForm || {}).disabled || this.isLimitDisabled : this.disabled || (this.elForm || {}).disabled;
|
6472 | },
|
6473 | _elFormItemSize: function _elFormItemSize() {
|
6474 | return (this.elFormItem || {}).elFormItemSize;
|
6475 | },
|
6476 | checkboxSize: function checkboxSize() {
|
6477 | var temCheckboxSize = this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
6478 | return this.isGroup ? this._checkboxGroup.checkboxGroupSize || temCheckboxSize : temCheckboxSize;
|
6479 | }
|
6480 | },
|
6481 |
|
6482 | props: {
|
6483 | value: {},
|
6484 | label: {},
|
6485 | indeterminate: Boolean,
|
6486 | disabled: Boolean,
|
6487 | checked: Boolean,
|
6488 | name: String,
|
6489 | trueLabel: [String, Number],
|
6490 | falseLabel: [String, Number],
|
6491 | id: String,
|
6492 | controls: String,
|
6493 | border: Boolean,
|
6494 | size: String
|
6495 | },
|
6496 |
|
6497 | methods: {
|
6498 | addToStore: function addToStore() {
|
6499 | if (Array.isArray(this.model) && this.model.indexOf(this.label) === -1) {
|
6500 | this.model.push(this.label);
|
6501 | } else {
|
6502 | this.model = this.trueLabel || true;
|
6503 | }
|
6504 | },
|
6505 | handleChange: function handleChange(ev) {
|
6506 | var _this = this;
|
6507 |
|
6508 | if (this.isLimitExceeded) return;
|
6509 | var value = void 0;
|
6510 | if (ev.target.checked) {
|
6511 | value = this.trueLabel === undefined ? true : this.trueLabel;
|
6512 | } else {
|
6513 | value = this.falseLabel === undefined ? false : this.falseLabel;
|
6514 | }
|
6515 | this.$emit('change', value, ev);
|
6516 | this.$nextTick(function () {
|
6517 | if (_this.isGroup) {
|
6518 | _this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
|
6519 | }
|
6520 | });
|
6521 | }
|
6522 | },
|
6523 |
|
6524 | created: function created() {
|
6525 | this.checked && this.addToStore();
|
6526 | },
|
6527 | mounted: function mounted() {
|
6528 |
|
6529 | if (this.indeterminate) {
|
6530 | this.$el.setAttribute('aria-controls', this.controls);
|
6531 | }
|
6532 | },
|
6533 |
|
6534 |
|
6535 | watch: {
|
6536 | value: function value(_value) {
|
6537 | this.dispatch('ElFormItem', 'el.form.change', _value);
|
6538 | }
|
6539 | }
|
6540 | });
|
6541 |
|
6542 | var src_checkboxvue_type_script_lang_js_ = (checkboxvue_type_script_lang_js_);
|
6543 |
|
6544 |
|
6545 |
|
6546 |
|
6547 |
|
6548 |
|
6549 |
|
6550 |
|
6551 | var checkbox_component = normalizeComponent(
|
6552 | src_checkboxvue_type_script_lang_js_,
|
6553 | checkboxvue_type_template_id_d0387074_render,
|
6554 | checkboxvue_type_template_id_d0387074_staticRenderFns,
|
6555 | false,
|
6556 | null,
|
6557 | null,
|
6558 | null
|
6559 |
|
6560 | )
|
6561 |
|
6562 |
|
6563 | if (false) { var checkbox_api; }
|
6564 | checkbox_component.options.__file = "packages/checkbox/src/checkbox.vue"
|
6565 | var src_checkbox = (checkbox_component.exports);
|
6566 |
|
6567 |
|
6568 |
|
6569 |
|
6570 | src_checkbox.install = function (Vue) {
|
6571 | Vue.component(src_checkbox.name, src_checkbox);
|
6572 | };
|
6573 |
|
6574 | var packages_checkbox = (src_checkbox);
|
6575 |
|
6576 | var checkbox_buttonvue_type_template_id_478e906e_render = function() {
|
6577 | var _vm = this
|
6578 | var _h = _vm.$createElement
|
6579 | var _c = _vm._self._c || _h
|
6580 | return _c(
|
6581 | "label",
|
6582 | {
|
6583 | staticClass: "el-checkbox-button",
|
6584 | class: [
|
6585 | _vm.size ? "el-checkbox-button--" + _vm.size : "",
|
6586 | { "is-disabled": _vm.isDisabled },
|
6587 | { "is-checked": _vm.isChecked },
|
6588 | { "is-focus": _vm.focus }
|
6589 | ],
|
6590 | attrs: {
|
6591 | role: "checkbox",
|
6592 | "aria-checked": _vm.isChecked,
|
6593 | "aria-disabled": _vm.isDisabled
|
6594 | }
|
6595 | },
|
6596 | [
|
6597 | _vm.trueLabel || _vm.falseLabel
|
6598 | ? _c("input", {
|
6599 | directives: [
|
6600 | {
|
6601 | name: "model",
|
6602 | rawName: "v-model",
|
6603 | value: _vm.model,
|
6604 | expression: "model"
|
6605 | }
|
6606 | ],
|
6607 | staticClass: "el-checkbox-button__original",
|
6608 | attrs: {
|
6609 | type: "checkbox",
|
6610 | name: _vm.name,
|
6611 | disabled: _vm.isDisabled,
|
6612 | "true-value": _vm.trueLabel,
|
6613 | "false-value": _vm.falseLabel
|
6614 | },
|
6615 | domProps: {
|
6616 | checked: Array.isArray(_vm.model)
|
6617 | ? _vm._i(_vm.model, null) > -1
|
6618 | : _vm._q(_vm.model, _vm.trueLabel)
|
6619 | },
|
6620 | on: {
|
6621 | change: [
|
6622 | function($event) {
|
6623 | var $$a = _vm.model,
|
6624 | $$el = $event.target,
|
6625 | $$c = $$el.checked ? _vm.trueLabel : _vm.falseLabel
|
6626 | if (Array.isArray($$a)) {
|
6627 | var $$v = null,
|
6628 | $$i = _vm._i($$a, $$v)
|
6629 | if ($$el.checked) {
|
6630 | $$i < 0 && (_vm.model = $$a.concat([$$v]))
|
6631 | } else {
|
6632 | $$i > -1 &&
|
6633 | (_vm.model = $$a
|
6634 | .slice(0, $$i)
|
6635 | .concat($$a.slice($$i + 1)))
|
6636 | }
|
6637 | } else {
|
6638 | _vm.model = $$c
|
6639 | }
|
6640 | },
|
6641 | _vm.handleChange
|
6642 | ],
|
6643 | focus: function($event) {
|
6644 | _vm.focus = true
|
6645 | },
|
6646 | blur: function($event) {
|
6647 | _vm.focus = false
|
6648 | }
|
6649 | }
|
6650 | })
|
6651 | : _c("input", {
|
6652 | directives: [
|
6653 | {
|
6654 | name: "model",
|
6655 | rawName: "v-model",
|
6656 | value: _vm.model,
|
6657 | expression: "model"
|
6658 | }
|
6659 | ],
|
6660 | staticClass: "el-checkbox-button__original",
|
6661 | attrs: {
|
6662 | type: "checkbox",
|
6663 | name: _vm.name,
|
6664 | disabled: _vm.isDisabled
|
6665 | },
|
6666 | domProps: {
|
6667 | value: _vm.label,
|
6668 | checked: Array.isArray(_vm.model)
|
6669 | ? _vm._i(_vm.model, _vm.label) > -1
|
6670 | : _vm.model
|
6671 | },
|
6672 | on: {
|
6673 | change: [
|
6674 | function($event) {
|
6675 | var $$a = _vm.model,
|
6676 | $$el = $event.target,
|
6677 | $$c = $$el.checked ? true : false
|
6678 | if (Array.isArray($$a)) {
|
6679 | var $$v = _vm.label,
|
6680 | $$i = _vm._i($$a, $$v)
|
6681 | if ($$el.checked) {
|
6682 | $$i < 0 && (_vm.model = $$a.concat([$$v]))
|
6683 | } else {
|
6684 | $$i > -1 &&
|
6685 | (_vm.model = $$a
|
6686 | .slice(0, $$i)
|
6687 | .concat($$a.slice($$i + 1)))
|
6688 | }
|
6689 | } else {
|
6690 | _vm.model = $$c
|
6691 | }
|
6692 | },
|
6693 | _vm.handleChange
|
6694 | ],
|
6695 | focus: function($event) {
|
6696 | _vm.focus = true
|
6697 | },
|
6698 | blur: function($event) {
|
6699 | _vm.focus = false
|
6700 | }
|
6701 | }
|
6702 | }),
|
6703 | _vm.$slots.default || _vm.label
|
6704 | ? _c(
|
6705 | "span",
|
6706 | {
|
6707 | staticClass: "el-checkbox-button__inner",
|
6708 | style: _vm.isChecked ? _vm.activeStyle : null
|
6709 | },
|
6710 | [_vm._t("default", [_vm._v(_vm._s(_vm.label))])],
|
6711 | 2
|
6712 | )
|
6713 | : _vm._e()
|
6714 | ]
|
6715 | )
|
6716 | }
|
6717 | var checkbox_buttonvue_type_template_id_478e906e_staticRenderFns = []
|
6718 | checkbox_buttonvue_type_template_id_478e906e_render._withStripped = true
|
6719 |
|
6720 |
|
6721 |
|
6722 |
|
6723 |
|
6724 |
|
6725 |
|
6726 |
|
6727 |
|
6728 |
|
6729 |
|
6730 |
|
6731 |
|
6732 |
|
6733 |
|
6734 |
|
6735 |
|
6736 |
|
6737 |
|
6738 |
|
6739 |
|
6740 |
|
6741 |
|
6742 |
|
6743 |
|
6744 |
|
6745 |
|
6746 |
|
6747 |
|
6748 |
|
6749 |
|
6750 |
|
6751 |
|
6752 |
|
6753 |
|
6754 |
|
6755 |
|
6756 |
|
6757 |
|
6758 |
|
6759 |
|
6760 |
|
6761 |
|
6762 |
|
6763 |
|
6764 |
|
6765 |
|
6766 |
|
6767 |
|
6768 |
|
6769 |
|
6770 |
|
6771 |
|
6772 | var checkbox_buttonvue_type_script_lang_js_ = ({
|
6773 | name: 'ElCheckboxButton',
|
6774 |
|
6775 | mixins: [emitter_default.a],
|
6776 |
|
6777 | inject: {
|
6778 | elForm: {
|
6779 | default: ''
|
6780 | },
|
6781 | elFormItem: {
|
6782 | default: ''
|
6783 | }
|
6784 | },
|
6785 |
|
6786 | data: function data() {
|
6787 | return {
|
6788 | selfModel: false,
|
6789 | focus: false,
|
6790 | isLimitExceeded: false
|
6791 | };
|
6792 | },
|
6793 |
|
6794 |
|
6795 | props: {
|
6796 | value: {},
|
6797 | label: {},
|
6798 | disabled: Boolean,
|
6799 | checked: Boolean,
|
6800 | name: String,
|
6801 | trueLabel: [String, Number],
|
6802 | falseLabel: [String, Number]
|
6803 | },
|
6804 | computed: {
|
6805 | model: {
|
6806 | get: function get() {
|
6807 | return this._checkboxGroup ? this.store : this.value !== undefined ? this.value : this.selfModel;
|
6808 | },
|
6809 | set: function set(val) {
|
6810 | if (this._checkboxGroup) {
|
6811 | this.isLimitExceeded = false;
|
6812 | this._checkboxGroup.min !== undefined && val.length < this._checkboxGroup.min && (this.isLimitExceeded = true);
|
6813 |
|
6814 | this._checkboxGroup.max !== undefined && val.length > this._checkboxGroup.max && (this.isLimitExceeded = true);
|
6815 |
|
6816 | this.isLimitExceeded === false && this.dispatch('ElCheckboxGroup', 'input', [val]);
|
6817 | } else if (this.value !== undefined) {
|
6818 | this.$emit('input', val);
|
6819 | } else {
|
6820 | this.selfModel = val;
|
6821 | }
|
6822 | }
|
6823 | },
|
6824 |
|
6825 | isChecked: function isChecked() {
|
6826 | if ({}.toString.call(this.model) === '[object Boolean]') {
|
6827 | return this.model;
|
6828 | } else if (Array.isArray(this.model)) {
|
6829 | return this.model.indexOf(this.label) > -1;
|
6830 | } else if (this.model !== null && this.model !== undefined) {
|
6831 | return this.model === this.trueLabel;
|
6832 | }
|
6833 | },
|
6834 | _checkboxGroup: function _checkboxGroup() {
|
6835 | var parent = this.$parent;
|
6836 | while (parent) {
|
6837 | if (parent.$options.componentName !== 'ElCheckboxGroup') {
|
6838 | parent = parent.$parent;
|
6839 | } else {
|
6840 | return parent;
|
6841 | }
|
6842 | }
|
6843 | return false;
|
6844 | },
|
6845 | store: function store() {
|
6846 | return this._checkboxGroup ? this._checkboxGroup.value : this.value;
|
6847 | },
|
6848 | activeStyle: function activeStyle() {
|
6849 | return {
|
6850 | backgroundColor: this._checkboxGroup.fill || '',
|
6851 | borderColor: this._checkboxGroup.fill || '',
|
6852 | color: this._checkboxGroup.textColor || '',
|
6853 | 'box-shadow': '-1px 0 0 0 ' + this._checkboxGroup.fill
|
6854 |
|
6855 | };
|
6856 | },
|
6857 | _elFormItemSize: function _elFormItemSize() {
|
6858 | return (this.elFormItem || {}).elFormItemSize;
|
6859 | },
|
6860 | size: function size() {
|
6861 | return this._checkboxGroup.checkboxGroupSize || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
6862 | },
|
6863 |
|
6864 |
|
6865 |
|
6866 | isLimitDisabled: function isLimitDisabled() {
|
6867 | var _checkboxGroup2 = this._checkboxGroup,
|
6868 | max = _checkboxGroup2.max,
|
6869 | min = _checkboxGroup2.min;
|
6870 |
|
6871 | return !!(max || min) && this.model.length >= max && !this.isChecked || this.model.length <= min && this.isChecked;
|
6872 | },
|
6873 | isDisabled: function isDisabled() {
|
6874 | return this._checkboxGroup ? this._checkboxGroup.disabled || this.disabled || (this.elForm || {}).disabled || this.isLimitDisabled : this.disabled || (this.elForm || {}).disabled;
|
6875 | }
|
6876 | },
|
6877 | methods: {
|
6878 | addToStore: function addToStore() {
|
6879 | if (Array.isArray(this.model) && this.model.indexOf(this.label) === -1) {
|
6880 | this.model.push(this.label);
|
6881 | } else {
|
6882 | this.model = this.trueLabel || true;
|
6883 | }
|
6884 | },
|
6885 | handleChange: function handleChange(ev) {
|
6886 | var _this = this;
|
6887 |
|
6888 | if (this.isLimitExceeded) return;
|
6889 | var value = void 0;
|
6890 | if (ev.target.checked) {
|
6891 | value = this.trueLabel === undefined ? true : this.trueLabel;
|
6892 | } else {
|
6893 | value = this.falseLabel === undefined ? false : this.falseLabel;
|
6894 | }
|
6895 | this.$emit('change', value, ev);
|
6896 | this.$nextTick(function () {
|
6897 | if (_this._checkboxGroup) {
|
6898 | _this.dispatch('ElCheckboxGroup', 'change', [_this._checkboxGroup.value]);
|
6899 | }
|
6900 | });
|
6901 | }
|
6902 | },
|
6903 |
|
6904 | created: function created() {
|
6905 | this.checked && this.addToStore();
|
6906 | }
|
6907 | });
|
6908 |
|
6909 | var src_checkbox_buttonvue_type_script_lang_js_ = (checkbox_buttonvue_type_script_lang_js_);
|
6910 |
|
6911 |
|
6912 |
|
6913 |
|
6914 |
|
6915 |
|
6916 |
|
6917 |
|
6918 | var checkbox_button_component = normalizeComponent(
|
6919 | src_checkbox_buttonvue_type_script_lang_js_,
|
6920 | checkbox_buttonvue_type_template_id_478e906e_render,
|
6921 | checkbox_buttonvue_type_template_id_478e906e_staticRenderFns,
|
6922 | false,
|
6923 | null,
|
6924 | null,
|
6925 | null
|
6926 |
|
6927 | )
|
6928 |
|
6929 |
|
6930 | if (false) { var checkbox_button_api; }
|
6931 | checkbox_button_component.options.__file = "packages/checkbox/src/checkbox-button.vue"
|
6932 | var checkbox_button = (checkbox_button_component.exports);
|
6933 |
|
6934 |
|
6935 |
|
6936 |
|
6937 | checkbox_button.install = function (Vue) {
|
6938 | Vue.component(checkbox_button.name, checkbox_button);
|
6939 | };
|
6940 |
|
6941 | var packages_checkbox_button = (checkbox_button);
|
6942 |
|
6943 | var checkbox_groupvue_type_template_id_7289a290_render = function() {
|
6944 | var _vm = this
|
6945 | var _h = _vm.$createElement
|
6946 | var _c = _vm._self._c || _h
|
6947 | return _c(
|
6948 | "div",
|
6949 | {
|
6950 | staticClass: "el-checkbox-group",
|
6951 | attrs: { role: "group", "aria-label": "checkbox-group" }
|
6952 | },
|
6953 | [_vm._t("default")],
|
6954 | 2
|
6955 | )
|
6956 | }
|
6957 | var checkbox_groupvue_type_template_id_7289a290_staticRenderFns = []
|
6958 | checkbox_groupvue_type_template_id_7289a290_render._withStripped = true
|
6959 |
|
6960 |
|
6961 |
|
6962 |
|
6963 |
|
6964 |
|
6965 |
|
6966 |
|
6967 | var checkbox_groupvue_type_script_lang_js_ = ({
|
6968 | name: 'ElCheckboxGroup',
|
6969 |
|
6970 | componentName: 'ElCheckboxGroup',
|
6971 |
|
6972 | mixins: [emitter_default.a],
|
6973 |
|
6974 | inject: {
|
6975 | elFormItem: {
|
6976 | default: ''
|
6977 | }
|
6978 | },
|
6979 |
|
6980 | props: {
|
6981 | value: {},
|
6982 | disabled: Boolean,
|
6983 | min: Number,
|
6984 | max: Number,
|
6985 | size: String,
|
6986 | fill: String,
|
6987 | textColor: String
|
6988 | },
|
6989 |
|
6990 | computed: {
|
6991 | _elFormItemSize: function _elFormItemSize() {
|
6992 | return (this.elFormItem || {}).elFormItemSize;
|
6993 | },
|
6994 | checkboxGroupSize: function checkboxGroupSize() {
|
6995 | return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
6996 | }
|
6997 | },
|
6998 |
|
6999 | watch: {
|
7000 | value: function value(_value) {
|
7001 | this.dispatch('ElFormItem', 'el.form.change', [_value]);
|
7002 | }
|
7003 | }
|
7004 | });
|
7005 |
|
7006 | var src_checkbox_groupvue_type_script_lang_js_ = (checkbox_groupvue_type_script_lang_js_);
|
7007 |
|
7008 |
|
7009 |
|
7010 |
|
7011 |
|
7012 |
|
7013 |
|
7014 |
|
7015 | var checkbox_group_component = normalizeComponent(
|
7016 | src_checkbox_groupvue_type_script_lang_js_,
|
7017 | checkbox_groupvue_type_template_id_7289a290_render,
|
7018 | checkbox_groupvue_type_template_id_7289a290_staticRenderFns,
|
7019 | false,
|
7020 | null,
|
7021 | null,
|
7022 | null
|
7023 |
|
7024 | )
|
7025 |
|
7026 |
|
7027 | if (false) { var checkbox_group_api; }
|
7028 | checkbox_group_component.options.__file = "packages/checkbox/src/checkbox-group.vue"
|
7029 | var checkbox_group = (checkbox_group_component.exports);
|
7030 |
|
7031 |
|
7032 |
|
7033 |
|
7034 | checkbox_group.install = function (Vue) {
|
7035 | Vue.component(checkbox_group.name, checkbox_group);
|
7036 | };
|
7037 |
|
7038 | var packages_checkbox_group = (checkbox_group);
|
7039 |
|
7040 | var componentvue_type_template_id_2dcd8fbb_render = function() {
|
7041 | var _vm = this
|
7042 | var _h = _vm.$createElement
|
7043 | var _c = _vm._self._c || _h
|
7044 | return _c(
|
7045 | "div",
|
7046 | {
|
7047 | staticClass: "el-switch",
|
7048 | class: { "is-disabled": _vm.switchDisabled, "is-checked": _vm.checked },
|
7049 | attrs: {
|
7050 | role: "switch",
|
7051 | "aria-checked": _vm.checked,
|
7052 | "aria-disabled": _vm.switchDisabled
|
7053 | },
|
7054 | on: {
|
7055 | click: function($event) {
|
7056 | $event.preventDefault()
|
7057 | return _vm.switchValue($event)
|
7058 | }
|
7059 | }
|
7060 | },
|
7061 | [
|
7062 | _c("input", {
|
7063 | ref: "input",
|
7064 | staticClass: "el-switch__input",
|
7065 | attrs: {
|
7066 | type: "checkbox",
|
7067 | id: _vm.id,
|
7068 | name: _vm.name,
|
7069 | "true-value": _vm.activeValue,
|
7070 | "false-value": _vm.inactiveValue,
|
7071 | disabled: _vm.switchDisabled
|
7072 | },
|
7073 | on: {
|
7074 | change: _vm.handleChange,
|
7075 | keydown: function($event) {
|
7076 | if (
|
7077 | !("button" in $event) &&
|
7078 | _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
|
7079 | ) {
|
7080 | return null
|
7081 | }
|
7082 | return _vm.switchValue($event)
|
7083 | }
|
7084 | }
|
7085 | }),
|
7086 | _vm.inactiveIconClass || _vm.inactiveText
|
7087 | ? _c(
|
7088 | "span",
|
7089 | {
|
7090 | class: [
|
7091 | "el-switch__label",
|
7092 | "el-switch__label--left",
|
7093 | !_vm.checked ? "is-active" : ""
|
7094 | ]
|
7095 | },
|
7096 | [
|
7097 | _vm.inactiveIconClass
|
7098 | ? _c("i", { class: [_vm.inactiveIconClass] })
|
7099 | : _vm._e(),
|
7100 | !_vm.inactiveIconClass && _vm.inactiveText
|
7101 | ? _c("span", { attrs: { "aria-hidden": _vm.checked } }, [
|
7102 | _vm._v(_vm._s(_vm.inactiveText))
|
7103 | ])
|
7104 | : _vm._e()
|
7105 | ]
|
7106 | )
|
7107 | : _vm._e(),
|
7108 | _c("span", {
|
7109 | ref: "core",
|
7110 | staticClass: "el-switch__core",
|
7111 | style: { width: _vm.coreWidth + "px" }
|
7112 | }),
|
7113 | _vm.activeIconClass || _vm.activeText
|
7114 | ? _c(
|
7115 | "span",
|
7116 | {
|
7117 | class: [
|
7118 | "el-switch__label",
|
7119 | "el-switch__label--right",
|
7120 | _vm.checked ? "is-active" : ""
|
7121 | ]
|
7122 | },
|
7123 | [
|
7124 | _vm.activeIconClass
|
7125 | ? _c("i", { class: [_vm.activeIconClass] })
|
7126 | : _vm._e(),
|
7127 | !_vm.activeIconClass && _vm.activeText
|
7128 | ? _c("span", { attrs: { "aria-hidden": !_vm.checked } }, [
|
7129 | _vm._v(_vm._s(_vm.activeText))
|
7130 | ])
|
7131 | : _vm._e()
|
7132 | ]
|
7133 | )
|
7134 | : _vm._e()
|
7135 | ]
|
7136 | )
|
7137 | }
|
7138 | var componentvue_type_template_id_2dcd8fbb_staticRenderFns = []
|
7139 | componentvue_type_template_id_2dcd8fbb_render._withStripped = true
|
7140 |
|
7141 |
|
7142 |
|
7143 |
|
7144 |
|
7145 |
|
7146 |
|
7147 |
|
7148 |
|
7149 |
|
7150 |
|
7151 |
|
7152 |
|
7153 |
|
7154 |
|
7155 |
|
7156 |
|
7157 |
|
7158 |
|
7159 |
|
7160 |
|
7161 |
|
7162 |
|
7163 |
|
7164 |
|
7165 |
|
7166 |
|
7167 |
|
7168 |
|
7169 |
|
7170 |
|
7171 |
|
7172 |
|
7173 |
|
7174 |
|
7175 |
|
7176 |
|
7177 |
|
7178 |
|
7179 |
|
7180 |
|
7181 |
|
7182 |
|
7183 |
|
7184 |
|
7185 |
|
7186 |
|
7187 | var switch_src_componentvue_type_script_lang_js_ = ({
|
7188 | name: 'ElSwitch',
|
7189 | mixins: [focus_default()('input'), migrating_default.a, emitter_default.a],
|
7190 | inject: {
|
7191 | elForm: {
|
7192 | default: ''
|
7193 | }
|
7194 | },
|
7195 | props: {
|
7196 | value: {
|
7197 | type: [Boolean, String, Number],
|
7198 | default: false
|
7199 | },
|
7200 | disabled: {
|
7201 | type: Boolean,
|
7202 | default: false
|
7203 | },
|
7204 | width: {
|
7205 | type: Number,
|
7206 | default: 40
|
7207 | },
|
7208 | activeIconClass: {
|
7209 | type: String,
|
7210 | default: ''
|
7211 | },
|
7212 | inactiveIconClass: {
|
7213 | type: String,
|
7214 | default: ''
|
7215 | },
|
7216 | activeText: String,
|
7217 | inactiveText: String,
|
7218 | activeColor: {
|
7219 | type: String,
|
7220 | default: ''
|
7221 | },
|
7222 | inactiveColor: {
|
7223 | type: String,
|
7224 | default: ''
|
7225 | },
|
7226 | activeValue: {
|
7227 | type: [Boolean, String, Number],
|
7228 | default: true
|
7229 | },
|
7230 | inactiveValue: {
|
7231 | type: [Boolean, String, Number],
|
7232 | default: false
|
7233 | },
|
7234 | name: {
|
7235 | type: String,
|
7236 | default: ''
|
7237 | },
|
7238 | validateEvent: {
|
7239 | type: Boolean,
|
7240 | default: true
|
7241 | },
|
7242 | id: String
|
7243 | },
|
7244 | data: function data() {
|
7245 | return {
|
7246 | coreWidth: this.width
|
7247 | };
|
7248 | },
|
7249 | created: function created() {
|
7250 | if (!~[this.activeValue, this.inactiveValue].indexOf(this.value)) {
|
7251 | this.$emit('input', this.inactiveValue);
|
7252 | }
|
7253 | },
|
7254 |
|
7255 | computed: {
|
7256 | checked: function checked() {
|
7257 | return this.value === this.activeValue;
|
7258 | },
|
7259 | switchDisabled: function switchDisabled() {
|
7260 | return this.disabled || (this.elForm || {}).disabled;
|
7261 | }
|
7262 | },
|
7263 | watch: {
|
7264 | checked: function checked() {
|
7265 | this.$refs.input.checked = this.checked;
|
7266 | if (this.activeColor || this.inactiveColor) {
|
7267 | this.setBackgroundColor();
|
7268 | }
|
7269 | if (this.validateEvent) {
|
7270 | this.dispatch('ElFormItem', 'el.form.change', [this.value]);
|
7271 | }
|
7272 | }
|
7273 | },
|
7274 | methods: {
|
7275 | handleChange: function handleChange(event) {
|
7276 | var _this = this;
|
7277 |
|
7278 | var val = this.checked ? this.inactiveValue : this.activeValue;
|
7279 | this.$emit('input', val);
|
7280 | this.$emit('change', val);
|
7281 | this.$nextTick(function () {
|
7282 |
|
7283 |
|
7284 | _this.$refs.input.checked = _this.checked;
|
7285 | });
|
7286 | },
|
7287 | setBackgroundColor: function setBackgroundColor() {
|
7288 | var newColor = this.checked ? this.activeColor : this.inactiveColor;
|
7289 | this.$refs.core.style.borderColor = newColor;
|
7290 | this.$refs.core.style.backgroundColor = newColor;
|
7291 | },
|
7292 | switchValue: function switchValue() {
|
7293 | !this.switchDisabled && this.handleChange();
|
7294 | },
|
7295 | getMigratingConfig: function getMigratingConfig() {
|
7296 | return {
|
7297 | props: {
|
7298 | 'on-color': 'on-color is renamed to active-color.',
|
7299 | 'off-color': 'off-color is renamed to inactive-color.',
|
7300 | 'on-text': 'on-text is renamed to active-text.',
|
7301 | 'off-text': 'off-text is renamed to inactive-text.',
|
7302 | 'on-value': 'on-value is renamed to active-value.',
|
7303 | 'off-value': 'off-value is renamed to inactive-value.',
|
7304 | 'on-icon-class': 'on-icon-class is renamed to active-icon-class.',
|
7305 | 'off-icon-class': 'off-icon-class is renamed to inactive-icon-class.'
|
7306 | }
|
7307 | };
|
7308 | }
|
7309 | },
|
7310 | mounted: function mounted() {
|
7311 |
|
7312 | this.coreWidth = this.width || 40;
|
7313 | if (this.activeColor || this.inactiveColor) {
|
7314 | this.setBackgroundColor();
|
7315 | }
|
7316 | this.$refs.input.checked = this.checked;
|
7317 | }
|
7318 | });
|
7319 |
|
7320 | var packages_switch_src_componentvue_type_script_lang_js_ = (switch_src_componentvue_type_script_lang_js_);
|
7321 |
|
7322 |
|
7323 |
|
7324 |
|
7325 |
|
7326 |
|
7327 |
|
7328 |
|
7329 | var src_component_component = normalizeComponent(
|
7330 | packages_switch_src_componentvue_type_script_lang_js_,
|
7331 | componentvue_type_template_id_2dcd8fbb_render,
|
7332 | componentvue_type_template_id_2dcd8fbb_staticRenderFns,
|
7333 | false,
|
7334 | null,
|
7335 | null,
|
7336 | null
|
7337 |
|
7338 | )
|
7339 |
|
7340 |
|
7341 | if (false) { var src_component_api; }
|
7342 | src_component_component.options.__file = "packages/switch/src/component.vue"
|
7343 | var switch_src_component = (src_component_component.exports);
|
7344 |
|
7345 |
|
7346 |
|
7347 |
|
7348 | switch_src_component.install = function (Vue) {
|
7349 | Vue.component(switch_src_component.name, switch_src_component);
|
7350 | };
|
7351 |
|
7352 | var packages_switch = (switch_src_component);
|
7353 |
|
7354 | var selectvue_type_template_id_0e4aade6_render = function() {
|
7355 | var _vm = this
|
7356 | var _h = _vm.$createElement
|
7357 | var _c = _vm._self._c || _h
|
7358 | return _c(
|
7359 | "div",
|
7360 | {
|
7361 | directives: [
|
7362 | {
|
7363 | name: "clickoutside",
|
7364 | rawName: "v-clickoutside",
|
7365 | value: _vm.handleClose,
|
7366 | expression: "handleClose"
|
7367 | }
|
7368 | ],
|
7369 | staticClass: "el-select",
|
7370 | class: [_vm.selectSize ? "el-select--" + _vm.selectSize : ""],
|
7371 | on: {
|
7372 | click: function($event) {
|
7373 | $event.stopPropagation()
|
7374 | return _vm.toggleMenu($event)
|
7375 | }
|
7376 | }
|
7377 | },
|
7378 | [
|
7379 | _vm.multiple
|
7380 | ? _c(
|
7381 | "div",
|
7382 | {
|
7383 | ref: "tags",
|
7384 | staticClass: "el-select__tags",
|
7385 | style: { "max-width": _vm.inputWidth - 32 + "px", width: "100%" }
|
7386 | },
|
7387 | [
|
7388 | _vm.collapseTags && _vm.selected.length
|
7389 | ? _c(
|
7390 | "span",
|
7391 | [
|
7392 | _c(
|
7393 | "el-tag",
|
7394 | {
|
7395 | attrs: {
|
7396 | closable: !_vm.selectDisabled,
|
7397 | size: _vm.collapseTagSize,
|
7398 | hit: _vm.selected[0].hitState,
|
7399 | type: "info",
|
7400 | "disable-transitions": ""
|
7401 | },
|
7402 | on: {
|
7403 | close: function($event) {
|
7404 | _vm.deleteTag($event, _vm.selected[0])
|
7405 | }
|
7406 | }
|
7407 | },
|
7408 | [
|
7409 | _c("span", { staticClass: "el-select__tags-text" }, [
|
7410 | _vm._v(_vm._s(_vm.selected[0].currentLabel))
|
7411 | ])
|
7412 | ]
|
7413 | ),
|
7414 | _vm.selected.length > 1
|
7415 | ? _c(
|
7416 | "el-tag",
|
7417 | {
|
7418 | attrs: {
|
7419 | closable: false,
|
7420 | size: _vm.collapseTagSize,
|
7421 | type: "info",
|
7422 | "disable-transitions": ""
|
7423 | }
|
7424 | },
|
7425 | [
|
7426 | _c(
|
7427 | "span",
|
7428 | { staticClass: "el-select__tags-text" },
|
7429 | [_vm._v("+ " + _vm._s(_vm.selected.length - 1))]
|
7430 | )
|
7431 | ]
|
7432 | )
|
7433 | : _vm._e()
|
7434 | ],
|
7435 | 1
|
7436 | )
|
7437 | : _vm._e(),
|
7438 | !_vm.collapseTags
|
7439 | ? _c(
|
7440 | "transition-group",
|
7441 | { on: { "after-leave": _vm.resetInputHeight } },
|
7442 | _vm._l(_vm.selected, function(item) {
|
7443 | return _c(
|
7444 | "el-tag",
|
7445 | {
|
7446 | key: _vm.getValueKey(item),
|
7447 | attrs: {
|
7448 | closable: !_vm.selectDisabled,
|
7449 | size: _vm.collapseTagSize,
|
7450 | hit: item.hitState,
|
7451 | type: "info",
|
7452 | "disable-transitions": ""
|
7453 | },
|
7454 | on: {
|
7455 | close: function($event) {
|
7456 | _vm.deleteTag($event, item)
|
7457 | }
|
7458 | }
|
7459 | },
|
7460 | [
|
7461 | _c("span", { staticClass: "el-select__tags-text" }, [
|
7462 | _vm._v(_vm._s(item.currentLabel))
|
7463 | ])
|
7464 | ]
|
7465 | )
|
7466 | }),
|
7467 | 1
|
7468 | )
|
7469 | : _vm._e(),
|
7470 | _vm.filterable
|
7471 | ? _c("input", {
|
7472 | directives: [
|
7473 | {
|
7474 | name: "model",
|
7475 | rawName: "v-model",
|
7476 | value: _vm.query,
|
7477 | expression: "query"
|
7478 | }
|
7479 | ],
|
7480 | ref: "input",
|
7481 | staticClass: "el-select__input",
|
7482 | class: [_vm.selectSize ? "is-" + _vm.selectSize : ""],
|
7483 | style: {
|
7484 | "flex-grow": "1",
|
7485 | width: _vm.inputLength / (_vm.inputWidth - 32) + "%",
|
7486 | "max-width": _vm.inputWidth - 42 + "px"
|
7487 | },
|
7488 | attrs: {
|
7489 | type: "text",
|
7490 | disabled: _vm.selectDisabled,
|
7491 | autocomplete: _vm.autoComplete || _vm.autocomplete
|
7492 | },
|
7493 | domProps: { value: _vm.query },
|
7494 | on: {
|
7495 | focus: _vm.handleFocus,
|
7496 | blur: function($event) {
|
7497 | _vm.softFocus = false
|
7498 | },
|
7499 | keyup: _vm.managePlaceholder,
|
7500 | keydown: [
|
7501 | _vm.resetInputState,
|
7502 | function($event) {
|
7503 | if (
|
7504 | !("button" in $event) &&
|
7505 | _vm._k($event.keyCode, "down", 40, $event.key, [
|
7506 | "Down",
|
7507 | "ArrowDown"
|
7508 | ])
|
7509 | ) {
|
7510 | return null
|
7511 | }
|
7512 | $event.preventDefault()
|
7513 | _vm.navigateOptions("next")
|
7514 | },
|
7515 | function($event) {
|
7516 | if (
|
7517 | !("button" in $event) &&
|
7518 | _vm._k($event.keyCode, "up", 38, $event.key, [
|
7519 | "Up",
|
7520 | "ArrowUp"
|
7521 | ])
|
7522 | ) {
|
7523 | return null
|
7524 | }
|
7525 | $event.preventDefault()
|
7526 | _vm.navigateOptions("prev")
|
7527 | },
|
7528 | function($event) {
|
7529 | if (
|
7530 | !("button" in $event) &&
|
7531 | _vm._k(
|
7532 | $event.keyCode,
|
7533 | "enter",
|
7534 | 13,
|
7535 | $event.key,
|
7536 | "Enter"
|
7537 | )
|
7538 | ) {
|
7539 | return null
|
7540 | }
|
7541 | $event.preventDefault()
|
7542 | return _vm.selectOption($event)
|
7543 | },
|
7544 | function($event) {
|
7545 | if (
|
7546 | !("button" in $event) &&
|
7547 | _vm._k($event.keyCode, "esc", 27, $event.key, [
|
7548 | "Esc",
|
7549 | "Escape"
|
7550 | ])
|
7551 | ) {
|
7552 | return null
|
7553 | }
|
7554 | $event.stopPropagation()
|
7555 | $event.preventDefault()
|
7556 | _vm.visible = false
|
7557 | },
|
7558 | function($event) {
|
7559 | if (
|
7560 | !("button" in $event) &&
|
7561 | _vm._k(
|
7562 | $event.keyCode,
|
7563 | "delete",
|
7564 | [8, 46],
|
7565 | $event.key,
|
7566 | ["Backspace", "Delete", "Del"]
|
7567 | )
|
7568 | ) {
|
7569 | return null
|
7570 | }
|
7571 | return _vm.deletePrevTag($event)
|
7572 | },
|
7573 | function($event) {
|
7574 | if (
|
7575 | !("button" in $event) &&
|
7576 | _vm._k($event.keyCode, "tab", 9, $event.key, "Tab")
|
7577 | ) {
|
7578 | return null
|
7579 | }
|
7580 | _vm.visible = false
|
7581 | }
|
7582 | ],
|
7583 | compositionstart: _vm.handleComposition,
|
7584 | compositionupdate: _vm.handleComposition,
|
7585 | compositionend: _vm.handleComposition,
|
7586 | input: [
|
7587 | function($event) {
|
7588 | if ($event.target.composing) {
|
7589 | return
|
7590 | }
|
7591 | _vm.query = $event.target.value
|
7592 | },
|
7593 | _vm.debouncedQueryChange
|
7594 | ]
|
7595 | }
|
7596 | })
|
7597 | : _vm._e()
|
7598 | ],
|
7599 | 1
|
7600 | )
|
7601 | : _vm._e(),
|
7602 | _c(
|
7603 | "el-input",
|
7604 | {
|
7605 | ref: "reference",
|
7606 | class: { "is-focus": _vm.visible },
|
7607 | attrs: {
|
7608 | type: "text",
|
7609 | placeholder: _vm.currentPlaceholder,
|
7610 | name: _vm.name,
|
7611 | id: _vm.id,
|
7612 | autocomplete: _vm.autoComplete || _vm.autocomplete,
|
7613 | size: _vm.selectSize,
|
7614 | disabled: _vm.selectDisabled,
|
7615 | readonly: _vm.readonly,
|
7616 | "validate-event": false,
|
7617 | tabindex: _vm.multiple && _vm.filterable ? "-1" : null
|
7618 | },
|
7619 | on: { focus: _vm.handleFocus, blur: _vm.handleBlur },
|
7620 | nativeOn: {
|
7621 | keyup: function($event) {
|
7622 | return _vm.debouncedOnInputChange($event)
|
7623 | },
|
7624 | keydown: [
|
7625 | function($event) {
|
7626 | if (
|
7627 | !("button" in $event) &&
|
7628 | _vm._k($event.keyCode, "down", 40, $event.key, [
|
7629 | "Down",
|
7630 | "ArrowDown"
|
7631 | ])
|
7632 | ) {
|
7633 | return null
|
7634 | }
|
7635 | $event.stopPropagation()
|
7636 | $event.preventDefault()
|
7637 | _vm.navigateOptions("next")
|
7638 | },
|
7639 | function($event) {
|
7640 | if (
|
7641 | !("button" in $event) &&
|
7642 | _vm._k($event.keyCode, "up", 38, $event.key, [
|
7643 | "Up",
|
7644 | "ArrowUp"
|
7645 | ])
|
7646 | ) {
|
7647 | return null
|
7648 | }
|
7649 | $event.stopPropagation()
|
7650 | $event.preventDefault()
|
7651 | _vm.navigateOptions("prev")
|
7652 | },
|
7653 | function($event) {
|
7654 | if (
|
7655 | !("button" in $event) &&
|
7656 | _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
|
7657 | ) {
|
7658 | return null
|
7659 | }
|
7660 | $event.preventDefault()
|
7661 | return _vm.selectOption($event)
|
7662 | },
|
7663 | function($event) {
|
7664 | if (
|
7665 | !("button" in $event) &&
|
7666 | _vm._k($event.keyCode, "esc", 27, $event.key, [
|
7667 | "Esc",
|
7668 | "Escape"
|
7669 | ])
|
7670 | ) {
|
7671 | return null
|
7672 | }
|
7673 | $event.stopPropagation()
|
7674 | $event.preventDefault()
|
7675 | _vm.visible = false
|
7676 | },
|
7677 | function($event) {
|
7678 | if (
|
7679 | !("button" in $event) &&
|
7680 | _vm._k($event.keyCode, "tab", 9, $event.key, "Tab")
|
7681 | ) {
|
7682 | return null
|
7683 | }
|
7684 | _vm.visible = false
|
7685 | }
|
7686 | ],
|
7687 | paste: function($event) {
|
7688 | return _vm.debouncedOnInputChange($event)
|
7689 | },
|
7690 | mouseenter: function($event) {
|
7691 | _vm.inputHovering = true
|
7692 | },
|
7693 | mouseleave: function($event) {
|
7694 | _vm.inputHovering = false
|
7695 | }
|
7696 | },
|
7697 | model: {
|
7698 | value: _vm.selectedLabel,
|
7699 | callback: function($$v) {
|
7700 | _vm.selectedLabel = $$v
|
7701 | },
|
7702 | expression: "selectedLabel"
|
7703 | }
|
7704 | },
|
7705 | [
|
7706 | _vm.$slots.prefix
|
7707 | ? _c("template", { slot: "prefix" }, [_vm._t("prefix")], 2)
|
7708 | : _vm._e(),
|
7709 | _c("template", { slot: "suffix" }, [
|
7710 | _c("i", {
|
7711 | directives: [
|
7712 | {
|
7713 | name: "show",
|
7714 | rawName: "v-show",
|
7715 | value: !_vm.showClose,
|
7716 | expression: "!showClose"
|
7717 | }
|
7718 | ],
|
7719 | class: [
|
7720 | "el-select__caret",
|
7721 | "el-input__icon",
|
7722 | "el-icon-" + _vm.iconClass
|
7723 | ]
|
7724 | }),
|
7725 | _vm.showClose
|
7726 | ? _c("i", {
|
7727 | staticClass:
|
7728 | "el-select__caret el-input__icon el-icon-circle-close",
|
7729 | on: { click: _vm.handleClearClick }
|
7730 | })
|
7731 | : _vm._e()
|
7732 | ])
|
7733 | ],
|
7734 | 2
|
7735 | ),
|
7736 | _c(
|
7737 | "transition",
|
7738 | {
|
7739 | attrs: { name: "el-zoom-in-top" },
|
7740 | on: {
|
7741 | "before-enter": _vm.handleMenuEnter,
|
7742 | "after-leave": _vm.doDestroy
|
7743 | }
|
7744 | },
|
7745 | [
|
7746 | _c(
|
7747 | "el-select-menu",
|
7748 | {
|
7749 | directives: [
|
7750 | {
|
7751 | name: "show",
|
7752 | rawName: "v-show",
|
7753 | value: _vm.visible && _vm.emptyText !== false,
|
7754 | expression: "visible && emptyText !== false"
|
7755 | }
|
7756 | ],
|
7757 | ref: "popper",
|
7758 | attrs: { "append-to-body": _vm.popperAppendToBody }
|
7759 | },
|
7760 | [
|
7761 | _c(
|
7762 | "el-scrollbar",
|
7763 | {
|
7764 | directives: [
|
7765 | {
|
7766 | name: "show",
|
7767 | rawName: "v-show",
|
7768 | value: _vm.options.length > 0 && !_vm.loading,
|
7769 | expression: "options.length > 0 && !loading"
|
7770 | }
|
7771 | ],
|
7772 | ref: "scrollbar",
|
7773 | class: {
|
7774 | "is-empty":
|
7775 | !_vm.allowCreate &&
|
7776 | _vm.query &&
|
7777 | _vm.filteredOptionsCount === 0
|
7778 | },
|
7779 | attrs: {
|
7780 | tag: "ul",
|
7781 | "wrap-class": "el-select-dropdown__wrap",
|
7782 | "view-class": "el-select-dropdown__list"
|
7783 | }
|
7784 | },
|
7785 | [
|
7786 | _vm.showNewOption
|
7787 | ? _c("el-option", {
|
7788 | attrs: { value: _vm.query, created: "" }
|
7789 | })
|
7790 | : _vm._e(),
|
7791 | _vm._t("default")
|
7792 | ],
|
7793 | 2
|
7794 | ),
|
7795 | _vm.emptyText &&
|
7796 | (!_vm.allowCreate ||
|
7797 | _vm.loading ||
|
7798 | (_vm.allowCreate && _vm.options.length === 0))
|
7799 | ? [
|
7800 | _vm.$slots.empty
|
7801 | ? _vm._t("empty")
|
7802 | : _c("p", { staticClass: "el-select-dropdown__empty" }, [
|
7803 | _vm._v(
|
7804 | "\n " +
|
7805 | _vm._s(_vm.emptyText) +
|
7806 | "\n "
|
7807 | )
|
7808 | ])
|
7809 | ]
|
7810 | : _vm._e()
|
7811 | ],
|
7812 | 2
|
7813 | )
|
7814 | ],
|
7815 | 1
|
7816 | )
|
7817 | ],
|
7818 | 1
|
7819 | )
|
7820 | }
|
7821 | var selectvue_type_template_id_0e4aade6_staticRenderFns = []
|
7822 | selectvue_type_template_id_0e4aade6_render._withStripped = true
|
7823 |
|
7824 |
|
7825 |
|
7826 |
|
7827 |
|
7828 | var select_dropdownvue_type_template_id_06828748_render = function() {
|
7829 | var _vm = this
|
7830 | var _h = _vm.$createElement
|
7831 | var _c = _vm._self._c || _h
|
7832 | return _c(
|
7833 | "div",
|
7834 | {
|
7835 | staticClass: "el-select-dropdown el-popper",
|
7836 | class: [{ "is-multiple": _vm.$parent.multiple }, _vm.popperClass],
|
7837 | style: { minWidth: _vm.minWidth }
|
7838 | },
|
7839 | [_vm._t("default")],
|
7840 | 2
|
7841 | )
|
7842 | }
|
7843 | var select_dropdownvue_type_template_id_06828748_staticRenderFns = []
|
7844 | select_dropdownvue_type_template_id_06828748_render._withStripped = true
|
7845 |
|
7846 |
|
7847 |
|
7848 |
|
7849 |
|
7850 |
|
7851 |
|
7852 |
|
7853 |
|
7854 |
|
7855 |
|
7856 |
|
7857 |
|
7858 |
|
7859 |
|
7860 |
|
7861 |
|
7862 | var select_dropdownvue_type_script_lang_js_ = ({
|
7863 | name: 'ElSelectDropdown',
|
7864 |
|
7865 | componentName: 'ElSelectDropdown',
|
7866 |
|
7867 | mixins: [vue_popper_default.a],
|
7868 |
|
7869 | props: {
|
7870 | placement: {
|
7871 | default: 'bottom-start'
|
7872 | },
|
7873 |
|
7874 | boundariesPadding: {
|
7875 | default: 0
|
7876 | },
|
7877 |
|
7878 | popperOptions: {
|
7879 | default: function _default() {
|
7880 | return {
|
7881 | gpuAcceleration: false
|
7882 | };
|
7883 | }
|
7884 | },
|
7885 |
|
7886 | visibleArrow: {
|
7887 | default: true
|
7888 | },
|
7889 |
|
7890 | appendToBody: {
|
7891 | type: Boolean,
|
7892 | default: true
|
7893 | }
|
7894 | },
|
7895 |
|
7896 | data: function data() {
|
7897 | return {
|
7898 | minWidth: ''
|
7899 | };
|
7900 | },
|
7901 |
|
7902 |
|
7903 | computed: {
|
7904 | popperClass: function popperClass() {
|
7905 | return this.$parent.popperClass;
|
7906 | }
|
7907 | },
|
7908 |
|
7909 | watch: {
|
7910 | '$parent.inputWidth': function $parentInputWidth() {
|
7911 | this.minWidth = this.$parent.$el.getBoundingClientRect().width + 'px';
|
7912 | }
|
7913 | },
|
7914 |
|
7915 | mounted: function mounted() {
|
7916 | var _this = this;
|
7917 |
|
7918 | this.referenceElm = this.$parent.$refs.reference.$el;
|
7919 | this.$parent.popperElm = this.popperElm = this.$el;
|
7920 | this.$on('updatePopper', function () {
|
7921 | if (_this.$parent.visible) _this.updatePopper();
|
7922 | });
|
7923 | this.$on('destroyPopper', this.destroyPopper);
|
7924 | }
|
7925 | });
|
7926 |
|
7927 | var src_select_dropdownvue_type_script_lang_js_ = (select_dropdownvue_type_script_lang_js_);
|
7928 |
|
7929 |
|
7930 |
|
7931 |
|
7932 |
|
7933 |
|
7934 |
|
7935 |
|
7936 | var select_dropdown_component = normalizeComponent(
|
7937 | src_select_dropdownvue_type_script_lang_js_,
|
7938 | select_dropdownvue_type_template_id_06828748_render,
|
7939 | select_dropdownvue_type_template_id_06828748_staticRenderFns,
|
7940 | false,
|
7941 | null,
|
7942 | null,
|
7943 | null
|
7944 |
|
7945 | )
|
7946 |
|
7947 |
|
7948 | if (false) { var select_dropdown_api; }
|
7949 | select_dropdown_component.options.__file = "packages/select/src/select-dropdown.vue"
|
7950 | var select_dropdown = (select_dropdown_component.exports);
|
7951 |
|
7952 | var optionvue_type_template_id_7a44c642_render = function() {
|
7953 | var _vm = this
|
7954 | var _h = _vm.$createElement
|
7955 | var _c = _vm._self._c || _h
|
7956 | return _c(
|
7957 | "li",
|
7958 | {
|
7959 | directives: [
|
7960 | {
|
7961 | name: "show",
|
7962 | rawName: "v-show",
|
7963 | value: _vm.visible,
|
7964 | expression: "visible"
|
7965 | }
|
7966 | ],
|
7967 | staticClass: "el-select-dropdown__item",
|
7968 | class: {
|
7969 | selected: _vm.itemSelected,
|
7970 | "is-disabled": _vm.disabled || _vm.groupDisabled || _vm.limitReached,
|
7971 | hover: _vm.hover
|
7972 | },
|
7973 | on: {
|
7974 | mouseenter: _vm.hoverItem,
|
7975 | click: function($event) {
|
7976 | $event.stopPropagation()
|
7977 | return _vm.selectOptionClick($event)
|
7978 | }
|
7979 | }
|
7980 | },
|
7981 | [_vm._t("default", [_c("span", [_vm._v(_vm._s(_vm.currentLabel))])])],
|
7982 | 2
|
7983 | )
|
7984 | }
|
7985 | var optionvue_type_template_id_7a44c642_staticRenderFns = []
|
7986 | optionvue_type_template_id_7a44c642_render._withStripped = true
|
7987 |
|
7988 |
|
7989 |
|
7990 |
|
7991 |
|
7992 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
7993 |
|
7994 |
|
7995 |
|
7996 |
|
7997 |
|
7998 |
|
7999 |
|
8000 |
|
8001 |
|
8002 |
|
8003 |
|
8004 |
|
8005 |
|
8006 |
|
8007 |
|
8008 |
|
8009 |
|
8010 |
|
8011 |
|
8012 |
|
8013 |
|
8014 |
|
8015 | var optionvue_type_script_lang_js_ = ({
|
8016 | mixins: [emitter_default.a],
|
8017 |
|
8018 | name: 'ElOption',
|
8019 |
|
8020 | componentName: 'ElOption',
|
8021 |
|
8022 | inject: ['select'],
|
8023 |
|
8024 | props: {
|
8025 | value: {
|
8026 | required: true
|
8027 | },
|
8028 | label: [String, Number],
|
8029 | created: Boolean,
|
8030 | disabled: {
|
8031 | type: Boolean,
|
8032 | default: false
|
8033 | }
|
8034 | },
|
8035 |
|
8036 | data: function data() {
|
8037 | return {
|
8038 | index: -1,
|
8039 | groupDisabled: false,
|
8040 | visible: true,
|
8041 | hitState: false,
|
8042 | hover: false
|
8043 | };
|
8044 | },
|
8045 |
|
8046 |
|
8047 | computed: {
|
8048 | isObject: function isObject() {
|
8049 | return Object.prototype.toString.call(this.value).toLowerCase() === '[object object]';
|
8050 | },
|
8051 | currentLabel: function currentLabel() {
|
8052 | return this.label || (this.isObject ? '' : this.value);
|
8053 | },
|
8054 | currentValue: function currentValue() {
|
8055 | return this.value || this.label || '';
|
8056 | },
|
8057 | itemSelected: function itemSelected() {
|
8058 | if (!this.select.multiple) {
|
8059 | return this.isEqual(this.value, this.select.value);
|
8060 | } else {
|
8061 | return this.contains(this.select.value, this.value);
|
8062 | }
|
8063 | },
|
8064 | limitReached: function limitReached() {
|
8065 | if (this.select.multiple) {
|
8066 | return !this.itemSelected && (this.select.value || []).length >= this.select.multipleLimit && this.select.multipleLimit > 0;
|
8067 | } else {
|
8068 | return false;
|
8069 | }
|
8070 | }
|
8071 | },
|
8072 |
|
8073 | watch: {
|
8074 | currentLabel: function currentLabel() {
|
8075 | if (!this.created && !this.select.remote) this.dispatch('ElSelect', 'setSelected');
|
8076 | },
|
8077 | value: function value(val, oldVal) {
|
8078 | var _select = this.select,
|
8079 | remote = _select.remote,
|
8080 | valueKey = _select.valueKey;
|
8081 |
|
8082 | if (!this.created && !remote) {
|
8083 | if (valueKey && (typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object' && (typeof oldVal === 'undefined' ? 'undefined' : _typeof(oldVal)) === 'object' && val[valueKey] === oldVal[valueKey]) {
|
8084 | return;
|
8085 | }
|
8086 | this.dispatch('ElSelect', 'setSelected');
|
8087 | }
|
8088 | }
|
8089 | },
|
8090 |
|
8091 | methods: {
|
8092 | isEqual: function isEqual(a, b) {
|
8093 | if (!this.isObject) {
|
8094 | return a === b;
|
8095 | } else {
|
8096 | var valueKey = this.select.valueKey;
|
8097 | return Object(util_["getValueByPath"])(a, valueKey) === Object(util_["getValueByPath"])(b, valueKey);
|
8098 | }
|
8099 | },
|
8100 | contains: function contains() {
|
8101 | var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
8102 | var target = arguments[1];
|
8103 |
|
8104 | if (!this.isObject) {
|
8105 | return arr && arr.indexOf(target) > -1;
|
8106 | } else {
|
8107 | var valueKey = this.select.valueKey;
|
8108 | return arr && arr.some(function (item) {
|
8109 | return Object(util_["getValueByPath"])(item, valueKey) === Object(util_["getValueByPath"])(target, valueKey);
|
8110 | });
|
8111 | }
|
8112 | },
|
8113 | handleGroupDisabled: function handleGroupDisabled(val) {
|
8114 | this.groupDisabled = val;
|
8115 | },
|
8116 | hoverItem: function hoverItem() {
|
8117 | if (!this.disabled && !this.groupDisabled) {
|
8118 | this.select.hoverIndex = this.select.options.indexOf(this);
|
8119 | }
|
8120 | },
|
8121 | selectOptionClick: function selectOptionClick() {
|
8122 | if (this.disabled !== true && this.groupDisabled !== true) {
|
8123 | this.dispatch('ElSelect', 'handleOptionClick', [this, true]);
|
8124 | }
|
8125 | },
|
8126 | queryChange: function queryChange(query) {
|
8127 | this.visible = new RegExp(Object(util_["escapeRegexpString"])(query), 'i').test(this.currentLabel) || this.created;
|
8128 | if (!this.visible) {
|
8129 | this.select.filteredOptionsCount--;
|
8130 | }
|
8131 | }
|
8132 | },
|
8133 |
|
8134 | created: function created() {
|
8135 | this.select.options.push(this);
|
8136 | this.select.cachedOptions.push(this);
|
8137 | this.select.optionsCount++;
|
8138 | this.select.filteredOptionsCount++;
|
8139 |
|
8140 | this.$on('queryChange', this.queryChange);
|
8141 | this.$on('handleGroupDisabled', this.handleGroupDisabled);
|
8142 | },
|
8143 | beforeDestroy: function beforeDestroy() {
|
8144 | var _select2 = this.select,
|
8145 | selected = _select2.selected,
|
8146 | multiple = _select2.multiple;
|
8147 |
|
8148 | var selectedOptions = multiple ? selected : [selected];
|
8149 | var index = this.select.cachedOptions.indexOf(this);
|
8150 | var selectedIndex = selectedOptions.indexOf(this);
|
8151 |
|
8152 |
|
8153 | if (index > -1 && selectedIndex < 0) {
|
8154 | this.select.cachedOptions.splice(index, 1);
|
8155 | }
|
8156 | this.select.onOptionDestroy(this.select.options.indexOf(this));
|
8157 | }
|
8158 | });
|
8159 |
|
8160 | var src_optionvue_type_script_lang_js_ = (optionvue_type_script_lang_js_);
|
8161 |
|
8162 |
|
8163 |
|
8164 |
|
8165 |
|
8166 |
|
8167 |
|
8168 |
|
8169 | var option_component = normalizeComponent(
|
8170 | src_optionvue_type_script_lang_js_,
|
8171 | optionvue_type_template_id_7a44c642_render,
|
8172 | optionvue_type_template_id_7a44c642_staticRenderFns,
|
8173 | false,
|
8174 | null,
|
8175 | null,
|
8176 | null
|
8177 |
|
8178 | )
|
8179 |
|
8180 |
|
8181 | if (false) { var option_api; }
|
8182 | option_component.options.__file = "packages/select/src/option.vue"
|
8183 | var src_option = (option_component.exports);
|
8184 |
|
8185 | var tag_ = __webpack_require__(30);
|
8186 | var tag_default = __webpack_require__.n(tag_);
|
8187 |
|
8188 |
|
8189 | var resize_event_ = __webpack_require__(13);
|
8190 |
|
8191 |
|
8192 | var lib_locale_ = __webpack_require__(11);
|
8193 | var lib_locale_default = __webpack_require__.n(lib_locale_);
|
8194 |
|
8195 |
|
8196 | var scroll_into_view_ = __webpack_require__(27);
|
8197 | var scroll_into_view_default = __webpack_require__.n(scroll_into_view_);
|
8198 |
|
8199 |
|
8200 | var navigation_mixin = ({
|
8201 | data: function data() {
|
8202 | return {
|
8203 | hoverOption: -1
|
8204 | };
|
8205 | },
|
8206 |
|
8207 |
|
8208 | computed: {
|
8209 | optionsAllDisabled: function optionsAllDisabled() {
|
8210 | return this.options.filter(function (option) {
|
8211 | return option.visible;
|
8212 | }).every(function (option) {
|
8213 | return option.disabled;
|
8214 | });
|
8215 | }
|
8216 | },
|
8217 |
|
8218 | watch: {
|
8219 | hoverIndex: function hoverIndex(val) {
|
8220 | var _this = this;
|
8221 |
|
8222 | if (typeof val === 'number' && val > -1) {
|
8223 | this.hoverOption = this.options[val] || {};
|
8224 | }
|
8225 | this.options.forEach(function (option) {
|
8226 | option.hover = _this.hoverOption === option;
|
8227 | });
|
8228 | }
|
8229 | },
|
8230 |
|
8231 | methods: {
|
8232 | navigateOptions: function navigateOptions(direction) {
|
8233 | var _this2 = this;
|
8234 |
|
8235 | if (!this.visible) {
|
8236 | this.visible = true;
|
8237 | return;
|
8238 | }
|
8239 | if (this.options.length === 0 || this.filteredOptionsCount === 0) return;
|
8240 | if (!this.optionsAllDisabled) {
|
8241 | if (direction === 'next') {
|
8242 | this.hoverIndex++;
|
8243 | if (this.hoverIndex === this.options.length) {
|
8244 | this.hoverIndex = 0;
|
8245 | }
|
8246 | } else if (direction === 'prev') {
|
8247 | this.hoverIndex--;
|
8248 | if (this.hoverIndex < 0) {
|
8249 | this.hoverIndex = this.options.length - 1;
|
8250 | }
|
8251 | }
|
8252 | var option = this.options[this.hoverIndex];
|
8253 | if (option.disabled === true || option.groupDisabled === true || !option.visible) {
|
8254 | this.navigateOptions(direction);
|
8255 | }
|
8256 | this.$nextTick(function () {
|
8257 | return _this2.scrollToOption(_this2.hoverOption);
|
8258 | });
|
8259 | }
|
8260 | }
|
8261 | }
|
8262 | });
|
8263 |
|
8264 |
|
8265 |
|
8266 |
|
8267 |
|
8268 |
|
8269 |
|
8270 |
|
8271 |
|
8272 |
|
8273 |
|
8274 |
|
8275 |
|
8276 |
|
8277 |
|
8278 |
|
8279 |
|
8280 |
|
8281 |
|
8282 |
|
8283 |
|
8284 |
|
8285 |
|
8286 |
|
8287 |
|
8288 |
|
8289 |
|
8290 |
|
8291 |
|
8292 |
|
8293 |
|
8294 |
|
8295 |
|
8296 |
|
8297 |
|
8298 |
|
8299 |
|
8300 |
|
8301 |
|
8302 |
|
8303 |
|
8304 |
|
8305 |
|
8306 |
|
8307 |
|
8308 |
|
8309 |
|
8310 |
|
8311 |
|
8312 |
|
8313 |
|
8314 |
|
8315 |
|
8316 |
|
8317 |
|
8318 |
|
8319 |
|
8320 |
|
8321 |
|
8322 |
|
8323 |
|
8324 |
|
8325 |
|
8326 |
|
8327 |
|
8328 |
|
8329 |
|
8330 |
|
8331 |
|
8332 |
|
8333 |
|
8334 |
|
8335 |
|
8336 |
|
8337 |
|
8338 |
|
8339 |
|
8340 |
|
8341 |
|
8342 |
|
8343 |
|
8344 |
|
8345 |
|
8346 |
|
8347 |
|
8348 |
|
8349 |
|
8350 |
|
8351 |
|
8352 |
|
8353 |
|
8354 |
|
8355 |
|
8356 |
|
8357 |
|
8358 |
|
8359 |
|
8360 |
|
8361 |
|
8362 |
|
8363 |
|
8364 |
|
8365 |
|
8366 |
|
8367 |
|
8368 |
|
8369 |
|
8370 |
|
8371 |
|
8372 |
|
8373 |
|
8374 |
|
8375 |
|
8376 |
|
8377 |
|
8378 |
|
8379 |
|
8380 |
|
8381 |
|
8382 |
|
8383 |
|
8384 |
|
8385 |
|
8386 |
|
8387 |
|
8388 |
|
8389 |
|
8390 |
|
8391 |
|
8392 |
|
8393 |
|
8394 |
|
8395 |
|
8396 |
|
8397 |
|
8398 |
|
8399 |
|
8400 |
|
8401 |
|
8402 |
|
8403 |
|
8404 |
|
8405 |
|
8406 |
|
8407 |
|
8408 |
|
8409 |
|
8410 |
|
8411 |
|
8412 |
|
8413 |
|
8414 |
|
8415 |
|
8416 |
|
8417 | var selectvue_type_script_lang_js_ = ({
|
8418 | mixins: [emitter_default.a, locale_default.a, focus_default()('reference'), navigation_mixin],
|
8419 |
|
8420 | name: 'ElSelect',
|
8421 |
|
8422 | componentName: 'ElSelect',
|
8423 |
|
8424 | inject: {
|
8425 | elForm: {
|
8426 | default: ''
|
8427 | },
|
8428 |
|
8429 | elFormItem: {
|
8430 | default: ''
|
8431 | }
|
8432 | },
|
8433 |
|
8434 | provide: function provide() {
|
8435 | return {
|
8436 | 'select': this
|
8437 | };
|
8438 | },
|
8439 |
|
8440 |
|
8441 | computed: {
|
8442 | _elFormItemSize: function _elFormItemSize() {
|
8443 | return (this.elFormItem || {}).elFormItemSize;
|
8444 | },
|
8445 | readonly: function readonly() {
|
8446 | return !this.filterable || this.multiple || !Object(util_["isIE"])() && !Object(util_["isEdge"])() && !this.visible;
|
8447 | },
|
8448 | showClose: function showClose() {
|
8449 | var hasValue = this.multiple ? Array.isArray(this.value) && this.value.length > 0 : this.value !== undefined && this.value !== null && this.value !== '';
|
8450 | var criteria = this.clearable && !this.selectDisabled && this.inputHovering && hasValue;
|
8451 | return criteria;
|
8452 | },
|
8453 | iconClass: function iconClass() {
|
8454 | return this.remote && this.filterable ? '' : this.visible ? 'arrow-up is-reverse' : 'arrow-up';
|
8455 | },
|
8456 | debounce: function debounce() {
|
8457 | return this.remote ? 300 : 0;
|
8458 | },
|
8459 | emptyText: function emptyText() {
|
8460 | if (this.loading) {
|
8461 | return this.loadingText || this.t('el.select.loading');
|
8462 | } else {
|
8463 | if (this.remote && this.query === '' && this.options.length === 0) return false;
|
8464 | if (this.filterable && this.query && this.options.length > 0 && this.filteredOptionsCount === 0) {
|
8465 | return this.noMatchText || this.t('el.select.noMatch');
|
8466 | }
|
8467 | if (this.options.length === 0) {
|
8468 | return this.noDataText || this.t('el.select.noData');
|
8469 | }
|
8470 | }
|
8471 | return null;
|
8472 | },
|
8473 | showNewOption: function showNewOption() {
|
8474 | var _this = this;
|
8475 |
|
8476 | var hasExistingOption = this.options.filter(function (option) {
|
8477 | return !option.created;
|
8478 | }).some(function (option) {
|
8479 | return option.currentLabel === _this.query;
|
8480 | });
|
8481 | return this.filterable && this.allowCreate && this.query !== '' && !hasExistingOption;
|
8482 | },
|
8483 | selectSize: function selectSize() {
|
8484 | return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
8485 | },
|
8486 | selectDisabled: function selectDisabled() {
|
8487 | return this.disabled || (this.elForm || {}).disabled;
|
8488 | },
|
8489 | collapseTagSize: function collapseTagSize() {
|
8490 | return ['small', 'mini'].indexOf(this.selectSize) > -1 ? 'mini' : 'small';
|
8491 | }
|
8492 | },
|
8493 |
|
8494 | components: {
|
8495 | ElInput: input_default.a,
|
8496 | ElSelectMenu: select_dropdown,
|
8497 | ElOption: src_option,
|
8498 | ElTag: tag_default.a,
|
8499 | ElScrollbar: scrollbar_default.a
|
8500 | },
|
8501 |
|
8502 | directives: { Clickoutside: clickoutside_default.a },
|
8503 |
|
8504 | props: {
|
8505 | name: String,
|
8506 | id: String,
|
8507 | value: {
|
8508 | required: true
|
8509 | },
|
8510 | autocomplete: {
|
8511 | type: String,
|
8512 | default: 'off'
|
8513 | },
|
8514 |
|
8515 | autoComplete: {
|
8516 | type: String,
|
8517 | validator: function validator(val) {
|
8518 | false && false;
|
8519 | return true;
|
8520 | }
|
8521 | },
|
8522 | automaticDropdown: Boolean,
|
8523 | size: String,
|
8524 | disabled: Boolean,
|
8525 | clearable: Boolean,
|
8526 | filterable: Boolean,
|
8527 | allowCreate: Boolean,
|
8528 | loading: Boolean,
|
8529 | popperClass: String,
|
8530 | remote: Boolean,
|
8531 | loadingText: String,
|
8532 | noMatchText: String,
|
8533 | noDataText: String,
|
8534 | remoteMethod: Function,
|
8535 | filterMethod: Function,
|
8536 | multiple: Boolean,
|
8537 | multipleLimit: {
|
8538 | type: Number,
|
8539 | default: 0
|
8540 | },
|
8541 | placeholder: {
|
8542 | type: String,
|
8543 | default: function _default() {
|
8544 | return Object(lib_locale_["t"])('el.select.placeholder');
|
8545 | }
|
8546 | },
|
8547 | defaultFirstOption: Boolean,
|
8548 | reserveKeyword: Boolean,
|
8549 | valueKey: {
|
8550 | type: String,
|
8551 | default: 'value'
|
8552 | },
|
8553 | collapseTags: Boolean,
|
8554 | popperAppendToBody: {
|
8555 | type: Boolean,
|
8556 | default: true
|
8557 | }
|
8558 | },
|
8559 |
|
8560 | data: function data() {
|
8561 | return {
|
8562 | options: [],
|
8563 | cachedOptions: [],
|
8564 | createdLabel: null,
|
8565 | createdSelected: false,
|
8566 | selected: this.multiple ? [] : {},
|
8567 | inputLength: 20,
|
8568 | inputWidth: 0,
|
8569 | initialInputHeight: 0,
|
8570 | cachedPlaceHolder: '',
|
8571 | optionsCount: 0,
|
8572 | filteredOptionsCount: 0,
|
8573 | visible: false,
|
8574 | softFocus: false,
|
8575 | selectedLabel: '',
|
8576 | hoverIndex: -1,
|
8577 | query: '',
|
8578 | previousQuery: null,
|
8579 | inputHovering: false,
|
8580 | currentPlaceholder: '',
|
8581 | menuVisibleOnFocus: false,
|
8582 | isOnComposition: false,
|
8583 | isSilentBlur: false
|
8584 | };
|
8585 | },
|
8586 |
|
8587 |
|
8588 | watch: {
|
8589 | selectDisabled: function selectDisabled() {
|
8590 | var _this2 = this;
|
8591 |
|
8592 | this.$nextTick(function () {
|
8593 | _this2.resetInputHeight();
|
8594 | });
|
8595 | },
|
8596 | placeholder: function placeholder(val) {
|
8597 | this.cachedPlaceHolder = this.currentPlaceholder = val;
|
8598 | },
|
8599 | value: function value(val, oldVal) {
|
8600 | if (this.multiple) {
|
8601 | this.resetInputHeight();
|
8602 | if (val && val.length > 0 || this.$refs.input && this.query !== '') {
|
8603 | this.currentPlaceholder = '';
|
8604 | } else {
|
8605 | this.currentPlaceholder = this.cachedPlaceHolder;
|
8606 | }
|
8607 | if (this.filterable && !this.reserveKeyword) {
|
8608 | this.query = '';
|
8609 | this.handleQueryChange(this.query);
|
8610 | }
|
8611 | }
|
8612 | this.setSelected();
|
8613 | if (this.filterable && !this.multiple) {
|
8614 | this.inputLength = 20;
|
8615 | }
|
8616 | if (!Object(util_["valueEquals"])(val, oldVal)) {
|
8617 | this.dispatch('ElFormItem', 'el.form.change', val);
|
8618 | }
|
8619 | },
|
8620 | visible: function visible(val) {
|
8621 | var _this3 = this;
|
8622 |
|
8623 | if (!val) {
|
8624 | this.broadcast('ElSelectDropdown', 'destroyPopper');
|
8625 | if (this.$refs.input) {
|
8626 | this.$refs.input.blur();
|
8627 | }
|
8628 | this.query = '';
|
8629 | this.previousQuery = null;
|
8630 | this.selectedLabel = '';
|
8631 | this.inputLength = 20;
|
8632 | this.menuVisibleOnFocus = false;
|
8633 | this.resetHoverIndex();
|
8634 | this.$nextTick(function () {
|
8635 | if (_this3.$refs.input && _this3.$refs.input.value === '' && _this3.selected.length === 0) {
|
8636 | _this3.currentPlaceholder = _this3.cachedPlaceHolder;
|
8637 | }
|
8638 | });
|
8639 | if (!this.multiple) {
|
8640 | if (this.selected) {
|
8641 | if (this.filterable && this.allowCreate && this.createdSelected && this.createdLabel) {
|
8642 | this.selectedLabel = this.createdLabel;
|
8643 | } else {
|
8644 | this.selectedLabel = this.selected.currentLabel;
|
8645 | }
|
8646 | if (this.filterable) this.query = this.selectedLabel;
|
8647 | }
|
8648 |
|
8649 | if (this.filterable) {
|
8650 | this.currentPlaceholder = this.cachedPlaceHolder;
|
8651 | }
|
8652 | }
|
8653 | } else {
|
8654 | this.broadcast('ElSelectDropdown', 'updatePopper');
|
8655 | if (this.filterable) {
|
8656 | this.query = this.remote ? '' : this.selectedLabel;
|
8657 | this.handleQueryChange(this.query);
|
8658 | if (this.multiple) {
|
8659 | this.$refs.input.focus();
|
8660 | } else {
|
8661 | if (!this.remote) {
|
8662 | this.broadcast('ElOption', 'queryChange', '');
|
8663 | this.broadcast('ElOptionGroup', 'queryChange');
|
8664 | }
|
8665 |
|
8666 | if (this.selectedLabel) {
|
8667 | this.currentPlaceholder = this.selectedLabel;
|
8668 | this.selectedLabel = '';
|
8669 | }
|
8670 | }
|
8671 | }
|
8672 | }
|
8673 | this.$emit('visible-change', val);
|
8674 | },
|
8675 | options: function options() {
|
8676 | var _this4 = this;
|
8677 |
|
8678 | if (this.$isServer) return;
|
8679 | this.$nextTick(function () {
|
8680 | _this4.broadcast('ElSelectDropdown', 'updatePopper');
|
8681 | });
|
8682 | if (this.multiple) {
|
8683 | this.resetInputHeight();
|
8684 | }
|
8685 | var inputs = this.$el.querySelectorAll('input');
|
8686 | if ([].indexOf.call(inputs, document.activeElement) === -1) {
|
8687 | this.setSelected();
|
8688 | }
|
8689 | if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
|
8690 | this.checkDefaultFirstOption();
|
8691 | }
|
8692 | }
|
8693 | },
|
8694 |
|
8695 | methods: {
|
8696 | handleComposition: function handleComposition(event) {
|
8697 | var _this5 = this;
|
8698 |
|
8699 | var text = event.target.value;
|
8700 | if (event.type === 'compositionend') {
|
8701 | this.isOnComposition = false;
|
8702 | this.$nextTick(function (_) {
|
8703 | return _this5.handleQueryChange(text);
|
8704 | });
|
8705 | } else {
|
8706 | var lastCharacter = text[text.length - 1] || '';
|
8707 | this.isOnComposition = !Object(shared_["isKorean"])(lastCharacter);
|
8708 | }
|
8709 | },
|
8710 | handleQueryChange: function handleQueryChange(val) {
|
8711 | var _this6 = this;
|
8712 |
|
8713 | if (this.previousQuery === val || this.isOnComposition) return;
|
8714 | if (this.previousQuery === null && (typeof this.filterMethod === 'function' || typeof this.remoteMethod === 'function')) {
|
8715 | this.previousQuery = val;
|
8716 | return;
|
8717 | }
|
8718 | this.previousQuery = val;
|
8719 | this.$nextTick(function () {
|
8720 | if (_this6.visible) _this6.broadcast('ElSelectDropdown', 'updatePopper');
|
8721 | });
|
8722 | this.hoverIndex = -1;
|
8723 | if (this.multiple && this.filterable) {
|
8724 | this.$nextTick(function () {
|
8725 | var length = _this6.$refs.input.value.length * 15 + 20;
|
8726 | _this6.inputLength = _this6.collapseTags ? Math.min(50, length) : length;
|
8727 | _this6.managePlaceholder();
|
8728 | _this6.resetInputHeight();
|
8729 | });
|
8730 | }
|
8731 | if (this.remote && typeof this.remoteMethod === 'function') {
|
8732 | this.hoverIndex = -1;
|
8733 | this.remoteMethod(val);
|
8734 | } else if (typeof this.filterMethod === 'function') {
|
8735 | this.filterMethod(val);
|
8736 | this.broadcast('ElOptionGroup', 'queryChange');
|
8737 | } else {
|
8738 | this.filteredOptionsCount = this.optionsCount;
|
8739 | this.broadcast('ElOption', 'queryChange', val);
|
8740 | this.broadcast('ElOptionGroup', 'queryChange');
|
8741 | }
|
8742 | if (this.defaultFirstOption && (this.filterable || this.remote) && this.filteredOptionsCount) {
|
8743 | this.checkDefaultFirstOption();
|
8744 | }
|
8745 | },
|
8746 | scrollToOption: function scrollToOption(option) {
|
8747 | var target = Array.isArray(option) && option[0] ? option[0].$el : option.$el;
|
8748 | if (this.$refs.popper && target) {
|
8749 | var menu = this.$refs.popper.$el.querySelector('.el-select-dropdown__wrap');
|
8750 | scroll_into_view_default()(menu, target);
|
8751 | }
|
8752 | this.$refs.scrollbar && this.$refs.scrollbar.handleScroll();
|
8753 | },
|
8754 | handleMenuEnter: function handleMenuEnter() {
|
8755 | var _this7 = this;
|
8756 |
|
8757 | this.$nextTick(function () {
|
8758 | return _this7.scrollToOption(_this7.selected);
|
8759 | });
|
8760 | },
|
8761 | emitChange: function emitChange(val) {
|
8762 | if (!Object(util_["valueEquals"])(this.value, val)) {
|
8763 | this.$emit('change', val);
|
8764 | }
|
8765 | },
|
8766 | getOption: function getOption(value) {
|
8767 | var option = void 0;
|
8768 | var isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
|
8769 | var isNull = Object.prototype.toString.call(value).toLowerCase() === '[object null]';
|
8770 | var isUndefined = Object.prototype.toString.call(value).toLowerCase() === '[object undefined]';
|
8771 |
|
8772 | for (var i = this.cachedOptions.length - 1; i >= 0; i--) {
|
8773 | var cachedOption = this.cachedOptions[i];
|
8774 | var isEqual = isObject ? Object(util_["getValueByPath"])(cachedOption.value, this.valueKey) === Object(util_["getValueByPath"])(value, this.valueKey) : cachedOption.value === value;
|
8775 | if (isEqual) {
|
8776 | option = cachedOption;
|
8777 | break;
|
8778 | }
|
8779 | }
|
8780 | if (option) return option;
|
8781 | var label = !isObject && !isNull && !isUndefined ? value : '';
|
8782 | var newOption = {
|
8783 | value: value,
|
8784 | currentLabel: label
|
8785 | };
|
8786 | if (this.multiple) {
|
8787 | newOption.hitState = false;
|
8788 | }
|
8789 | return newOption;
|
8790 | },
|
8791 | setSelected: function setSelected() {
|
8792 | var _this8 = this;
|
8793 |
|
8794 | if (!this.multiple) {
|
8795 | var option = this.getOption(this.value);
|
8796 | if (option.created) {
|
8797 | this.createdLabel = option.currentLabel;
|
8798 | this.createdSelected = true;
|
8799 | } else {
|
8800 | this.createdSelected = false;
|
8801 | }
|
8802 | this.selectedLabel = option.currentLabel;
|
8803 | this.selected = option;
|
8804 | if (this.filterable) this.query = this.selectedLabel;
|
8805 | return;
|
8806 | }
|
8807 | var result = [];
|
8808 | if (Array.isArray(this.value)) {
|
8809 | this.value.forEach(function (value) {
|
8810 | result.push(_this8.getOption(value));
|
8811 | });
|
8812 | }
|
8813 | this.selected = result;
|
8814 | this.$nextTick(function () {
|
8815 | _this8.resetInputHeight();
|
8816 | });
|
8817 | },
|
8818 | handleFocus: function handleFocus(event) {
|
8819 | if (!this.softFocus) {
|
8820 | if (this.automaticDropdown || this.filterable) {
|
8821 | this.visible = true;
|
8822 | if (this.filterable) {
|
8823 | this.menuVisibleOnFocus = true;
|
8824 | }
|
8825 | }
|
8826 | this.$emit('focus', event);
|
8827 | } else {
|
8828 | this.softFocus = false;
|
8829 | }
|
8830 | },
|
8831 | blur: function blur() {
|
8832 | this.visible = false;
|
8833 | this.$refs.reference.blur();
|
8834 | },
|
8835 | handleBlur: function handleBlur(event) {
|
8836 | var _this9 = this;
|
8837 |
|
8838 | setTimeout(function () {
|
8839 | if (_this9.isSilentBlur) {
|
8840 | _this9.isSilentBlur = false;
|
8841 | } else {
|
8842 | _this9.$emit('blur', event);
|
8843 | }
|
8844 | }, 50);
|
8845 | this.softFocus = false;
|
8846 | },
|
8847 | handleClearClick: function handleClearClick(event) {
|
8848 | this.deleteSelected(event);
|
8849 | },
|
8850 | doDestroy: function doDestroy() {
|
8851 | this.$refs.popper && this.$refs.popper.doDestroy();
|
8852 | },
|
8853 | handleClose: function handleClose() {
|
8854 | this.visible = false;
|
8855 | },
|
8856 | toggleLastOptionHitState: function toggleLastOptionHitState(hit) {
|
8857 | if (!Array.isArray(this.selected)) return;
|
8858 | var option = this.selected[this.selected.length - 1];
|
8859 | if (!option) return;
|
8860 |
|
8861 | if (hit === true || hit === false) {
|
8862 | option.hitState = hit;
|
8863 | return hit;
|
8864 | }
|
8865 |
|
8866 | option.hitState = !option.hitState;
|
8867 | return option.hitState;
|
8868 | },
|
8869 | deletePrevTag: function deletePrevTag(e) {
|
8870 | if (e.target.value.length <= 0 && !this.toggleLastOptionHitState()) {
|
8871 | var value = this.value.slice();
|
8872 | value.pop();
|
8873 | this.$emit('input', value);
|
8874 | this.emitChange(value);
|
8875 | }
|
8876 | },
|
8877 | managePlaceholder: function managePlaceholder() {
|
8878 | if (this.currentPlaceholder !== '') {
|
8879 | this.currentPlaceholder = this.$refs.input.value ? '' : this.cachedPlaceHolder;
|
8880 | }
|
8881 | },
|
8882 | resetInputState: function resetInputState(e) {
|
8883 | if (e.keyCode !== 8) this.toggleLastOptionHitState(false);
|
8884 | this.inputLength = this.$refs.input.value.length * 15 + 20;
|
8885 | this.resetInputHeight();
|
8886 | },
|
8887 | resetInputHeight: function resetInputHeight() {
|
8888 | var _this10 = this;
|
8889 |
|
8890 | if (this.collapseTags && !this.filterable) return;
|
8891 | this.$nextTick(function () {
|
8892 | if (!_this10.$refs.reference) return;
|
8893 | var inputChildNodes = _this10.$refs.reference.$el.childNodes;
|
8894 | var input = [].filter.call(inputChildNodes, function (item) {
|
8895 | return item.tagName === 'INPUT';
|
8896 | })[0];
|
8897 | var tags = _this10.$refs.tags;
|
8898 | var sizeInMap = _this10.initialInputHeight || 40;
|
8899 | input.style.height = _this10.selected.length === 0 ? sizeInMap + 'px' : Math.max(tags ? tags.clientHeight + (tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap) + 'px';
|
8900 | if (_this10.visible && _this10.emptyText !== false) {
|
8901 | _this10.broadcast('ElSelectDropdown', 'updatePopper');
|
8902 | }
|
8903 | });
|
8904 | },
|
8905 | resetHoverIndex: function resetHoverIndex() {
|
8906 | var _this11 = this;
|
8907 |
|
8908 | setTimeout(function () {
|
8909 | if (!_this11.multiple) {
|
8910 | _this11.hoverIndex = _this11.options.indexOf(_this11.selected);
|
8911 | } else {
|
8912 | if (_this11.selected.length > 0) {
|
8913 | _this11.hoverIndex = Math.min.apply(null, _this11.selected.map(function (item) {
|
8914 | return _this11.options.indexOf(item);
|
8915 | }));
|
8916 | } else {
|
8917 | _this11.hoverIndex = -1;
|
8918 | }
|
8919 | }
|
8920 | }, 300);
|
8921 | },
|
8922 | handleOptionSelect: function handleOptionSelect(option, byClick) {
|
8923 | var _this12 = this;
|
8924 |
|
8925 | if (this.multiple) {
|
8926 | var value = (this.value || []).slice();
|
8927 | var optionIndex = this.getValueIndex(value, option.value);
|
8928 | if (optionIndex > -1) {
|
8929 | value.splice(optionIndex, 1);
|
8930 | } else if (this.multipleLimit <= 0 || value.length < this.multipleLimit) {
|
8931 | value.push(option.value);
|
8932 | }
|
8933 | this.$emit('input', value);
|
8934 | this.emitChange(value);
|
8935 | if (option.created) {
|
8936 | this.query = '';
|
8937 | this.handleQueryChange('');
|
8938 | this.inputLength = 20;
|
8939 | }
|
8940 | if (this.filterable) this.$refs.input.focus();
|
8941 | } else {
|
8942 | this.$emit('input', option.value);
|
8943 | this.emitChange(option.value);
|
8944 | this.visible = false;
|
8945 | }
|
8946 | this.isSilentBlur = byClick;
|
8947 | this.setSoftFocus();
|
8948 | if (this.visible) return;
|
8949 | this.$nextTick(function () {
|
8950 | _this12.scrollToOption(option);
|
8951 | });
|
8952 | },
|
8953 | setSoftFocus: function setSoftFocus() {
|
8954 | this.softFocus = true;
|
8955 | var input = this.$refs.input || this.$refs.reference;
|
8956 | if (input) {
|
8957 | input.focus();
|
8958 | }
|
8959 | },
|
8960 | getValueIndex: function getValueIndex() {
|
8961 | var arr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
8962 | var value = arguments[1];
|
8963 |
|
8964 | var isObject = Object.prototype.toString.call(value).toLowerCase() === '[object object]';
|
8965 | if (!isObject) {
|
8966 | return arr.indexOf(value);
|
8967 | } else {
|
8968 | var valueKey = this.valueKey;
|
8969 | var index = -1;
|
8970 | arr.some(function (item, i) {
|
8971 | if (Object(util_["getValueByPath"])(item, valueKey) === Object(util_["getValueByPath"])(value, valueKey)) {
|
8972 | index = i;
|
8973 | return true;
|
8974 | }
|
8975 | return false;
|
8976 | });
|
8977 | return index;
|
8978 | }
|
8979 | },
|
8980 | toggleMenu: function toggleMenu() {
|
8981 | if (!this.selectDisabled) {
|
8982 | if (this.menuVisibleOnFocus) {
|
8983 | this.menuVisibleOnFocus = false;
|
8984 | } else {
|
8985 | this.visible = !this.visible;
|
8986 | }
|
8987 | if (this.visible) {
|
8988 | (this.$refs.input || this.$refs.reference).focus();
|
8989 | }
|
8990 | }
|
8991 | },
|
8992 | selectOption: function selectOption() {
|
8993 | if (!this.visible) {
|
8994 | this.toggleMenu();
|
8995 | } else {
|
8996 | if (this.options[this.hoverIndex]) {
|
8997 | this.handleOptionSelect(this.options[this.hoverIndex]);
|
8998 | }
|
8999 | }
|
9000 | },
|
9001 | deleteSelected: function deleteSelected(event) {
|
9002 | event.stopPropagation();
|
9003 | var value = this.multiple ? [] : '';
|
9004 | this.$emit('input', value);
|
9005 | this.emitChange(value);
|
9006 | this.visible = false;
|
9007 | this.$emit('clear');
|
9008 | },
|
9009 | deleteTag: function deleteTag(event, tag) {
|
9010 | var index = this.selected.indexOf(tag);
|
9011 | if (index > -1 && !this.selectDisabled) {
|
9012 | var value = this.value.slice();
|
9013 | value.splice(index, 1);
|
9014 | this.$emit('input', value);
|
9015 | this.emitChange(value);
|
9016 | this.$emit('remove-tag', tag.value);
|
9017 | }
|
9018 | event.stopPropagation();
|
9019 | },
|
9020 | onInputChange: function onInputChange() {
|
9021 | if (this.filterable && this.query !== this.selectedLabel) {
|
9022 | this.query = this.selectedLabel;
|
9023 | this.handleQueryChange(this.query);
|
9024 | }
|
9025 | },
|
9026 | onOptionDestroy: function onOptionDestroy(index) {
|
9027 | if (index > -1) {
|
9028 | this.optionsCount--;
|
9029 | this.filteredOptionsCount--;
|
9030 | this.options.splice(index, 1);
|
9031 | }
|
9032 | },
|
9033 | resetInputWidth: function resetInputWidth() {
|
9034 | this.inputWidth = this.$refs.reference.$el.getBoundingClientRect().width;
|
9035 | },
|
9036 | handleResize: function handleResize() {
|
9037 | this.resetInputWidth();
|
9038 | if (this.multiple) this.resetInputHeight();
|
9039 | },
|
9040 | checkDefaultFirstOption: function checkDefaultFirstOption() {
|
9041 | this.hoverIndex = -1;
|
9042 |
|
9043 | var hasCreated = false;
|
9044 | for (var i = this.options.length - 1; i >= 0; i--) {
|
9045 | if (this.options[i].created) {
|
9046 | hasCreated = true;
|
9047 | this.hoverIndex = i;
|
9048 | break;
|
9049 | }
|
9050 | }
|
9051 | if (hasCreated) return;
|
9052 | for (var _i = 0; _i !== this.options.length; ++_i) {
|
9053 | var option = this.options[_i];
|
9054 | if (this.query) {
|
9055 |
|
9056 | if (!option.disabled && !option.groupDisabled && option.visible) {
|
9057 | this.hoverIndex = _i;
|
9058 | break;
|
9059 | }
|
9060 | } else {
|
9061 |
|
9062 | if (option.itemSelected) {
|
9063 | this.hoverIndex = _i;
|
9064 | break;
|
9065 | }
|
9066 | }
|
9067 | }
|
9068 | },
|
9069 | getValueKey: function getValueKey(item) {
|
9070 | if (Object.prototype.toString.call(item.value).toLowerCase() !== '[object object]') {
|
9071 | return item.value;
|
9072 | } else {
|
9073 | return Object(util_["getValueByPath"])(item.value, this.valueKey);
|
9074 | }
|
9075 | }
|
9076 | },
|
9077 |
|
9078 | created: function created() {
|
9079 | var _this13 = this;
|
9080 |
|
9081 | this.cachedPlaceHolder = this.currentPlaceholder = this.placeholder;
|
9082 | if (this.multiple && !Array.isArray(this.value)) {
|
9083 | this.$emit('input', []);
|
9084 | }
|
9085 | if (!this.multiple && Array.isArray(this.value)) {
|
9086 | this.$emit('input', '');
|
9087 | }
|
9088 |
|
9089 | this.debouncedOnInputChange = debounce_default()(this.debounce, function () {
|
9090 | _this13.onInputChange();
|
9091 | });
|
9092 |
|
9093 | this.debouncedQueryChange = debounce_default()(this.debounce, function (e) {
|
9094 | _this13.handleQueryChange(e.target.value);
|
9095 | });
|
9096 |
|
9097 | this.$on('handleOptionClick', this.handleOptionSelect);
|
9098 | this.$on('setSelected', this.setSelected);
|
9099 | },
|
9100 | mounted: function mounted() {
|
9101 | var _this14 = this;
|
9102 |
|
9103 | if (this.multiple && Array.isArray(this.value) && this.value.length > 0) {
|
9104 | this.currentPlaceholder = '';
|
9105 | }
|
9106 | Object(resize_event_["addResizeListener"])(this.$el, this.handleResize);
|
9107 |
|
9108 | var reference = this.$refs.reference;
|
9109 | if (reference && reference.$el) {
|
9110 | var sizeMap = {
|
9111 | medium: 36,
|
9112 | small: 32,
|
9113 | mini: 28
|
9114 | };
|
9115 | var input = reference.$el.querySelector('input');
|
9116 | this.initialInputHeight = input.getBoundingClientRect().height || sizeMap[this.selectSize];
|
9117 | }
|
9118 | if (this.remote && this.multiple) {
|
9119 | this.resetInputHeight();
|
9120 | }
|
9121 | this.$nextTick(function () {
|
9122 | if (reference && reference.$el) {
|
9123 | _this14.inputWidth = reference.$el.getBoundingClientRect().width;
|
9124 | }
|
9125 | });
|
9126 | this.setSelected();
|
9127 | },
|
9128 | beforeDestroy: function beforeDestroy() {
|
9129 | if (this.$el && this.handleResize) Object(resize_event_["removeResizeListener"])(this.$el, this.handleResize);
|
9130 | }
|
9131 | });
|
9132 |
|
9133 | var src_selectvue_type_script_lang_js_ = (selectvue_type_script_lang_js_);
|
9134 |
|
9135 |
|
9136 |
|
9137 |
|
9138 |
|
9139 |
|
9140 |
|
9141 |
|
9142 | var select_component = normalizeComponent(
|
9143 | src_selectvue_type_script_lang_js_,
|
9144 | selectvue_type_template_id_0e4aade6_render,
|
9145 | selectvue_type_template_id_0e4aade6_staticRenderFns,
|
9146 | false,
|
9147 | null,
|
9148 | null,
|
9149 | null
|
9150 |
|
9151 | )
|
9152 |
|
9153 |
|
9154 | if (false) { var select_api; }
|
9155 | select_component.options.__file = "packages/select/src/select.vue"
|
9156 | var src_select = (select_component.exports);
|
9157 |
|
9158 |
|
9159 |
|
9160 |
|
9161 | src_select.install = function (Vue) {
|
9162 | Vue.component(src_select.name, src_select);
|
9163 | };
|
9164 |
|
9165 | var packages_select = (src_select);
|
9166 |
|
9167 |
|
9168 |
|
9169 |
|
9170 | src_option.install = function (Vue) {
|
9171 | Vue.component(src_option.name, src_option);
|
9172 | };
|
9173 |
|
9174 | var packages_option = (src_option);
|
9175 |
|
9176 | var option_groupvue_type_template_id_6685e5de_render = function() {
|
9177 | var _vm = this
|
9178 | var _h = _vm.$createElement
|
9179 | var _c = _vm._self._c || _h
|
9180 | return _c(
|
9181 | "ul",
|
9182 | {
|
9183 | directives: [
|
9184 | {
|
9185 | name: "show",
|
9186 | rawName: "v-show",
|
9187 | value: _vm.visible,
|
9188 | expression: "visible"
|
9189 | }
|
9190 | ],
|
9191 | staticClass: "el-select-group__wrap"
|
9192 | },
|
9193 | [
|
9194 | _c("li", { staticClass: "el-select-group__title" }, [
|
9195 | _vm._v(_vm._s(_vm.label))
|
9196 | ]),
|
9197 | _c("li", [
|
9198 | _c("ul", { staticClass: "el-select-group" }, [_vm._t("default")], 2)
|
9199 | ])
|
9200 | ]
|
9201 | )
|
9202 | }
|
9203 | var option_groupvue_type_template_id_6685e5de_staticRenderFns = []
|
9204 | option_groupvue_type_template_id_6685e5de_render._withStripped = true
|
9205 |
|
9206 |
|
9207 |
|
9208 |
|
9209 |
|
9210 |
|
9211 |
|
9212 |
|
9213 |
|
9214 |
|
9215 |
|
9216 |
|
9217 |
|
9218 |
|
9219 |
|
9220 |
|
9221 |
|
9222 |
|
9223 |
|
9224 | var option_groupvue_type_script_lang_js_ = ({
|
9225 | mixins: [emitter_default.a],
|
9226 |
|
9227 | name: 'ElOptionGroup',
|
9228 |
|
9229 | componentName: 'ElOptionGroup',
|
9230 |
|
9231 | props: {
|
9232 | label: String,
|
9233 | disabled: {
|
9234 | type: Boolean,
|
9235 | default: false
|
9236 | }
|
9237 | },
|
9238 |
|
9239 | data: function data() {
|
9240 | return {
|
9241 | visible: true
|
9242 | };
|
9243 | },
|
9244 |
|
9245 |
|
9246 | watch: {
|
9247 | disabled: function disabled(val) {
|
9248 | this.broadcast('ElOption', 'handleGroupDisabled', val);
|
9249 | }
|
9250 | },
|
9251 |
|
9252 | methods: {
|
9253 | queryChange: function queryChange() {
|
9254 | this.visible = this.$children && Array.isArray(this.$children) && this.$children.some(function (option) {
|
9255 | return option.visible === true;
|
9256 | });
|
9257 | }
|
9258 | },
|
9259 |
|
9260 | created: function created() {
|
9261 | this.$on('queryChange', this.queryChange);
|
9262 | },
|
9263 | mounted: function mounted() {
|
9264 | if (this.disabled) {
|
9265 | this.broadcast('ElOption', 'handleGroupDisabled', this.disabled);
|
9266 | }
|
9267 | }
|
9268 | });
|
9269 |
|
9270 | var src_option_groupvue_type_script_lang_js_ = (option_groupvue_type_script_lang_js_);
|
9271 |
|
9272 |
|
9273 |
|
9274 |
|
9275 |
|
9276 |
|
9277 |
|
9278 |
|
9279 | var option_group_component = normalizeComponent(
|
9280 | src_option_groupvue_type_script_lang_js_,
|
9281 | option_groupvue_type_template_id_6685e5de_render,
|
9282 | option_groupvue_type_template_id_6685e5de_staticRenderFns,
|
9283 | false,
|
9284 | null,
|
9285 | null,
|
9286 | null
|
9287 |
|
9288 | )
|
9289 |
|
9290 |
|
9291 | if (false) { var option_group_api; }
|
9292 | option_group_component.options.__file = "packages/select/src/option-group.vue"
|
9293 | var option_group = (option_group_component.exports);
|
9294 |
|
9295 |
|
9296 |
|
9297 |
|
9298 | option_group.install = function (Vue) {
|
9299 | Vue.component(option_group.name, option_group);
|
9300 | };
|
9301 |
|
9302 | var packages_option_group = (option_group);
|
9303 |
|
9304 | var buttonvue_type_template_id_ca859fb4_render = function() {
|
9305 | var _vm = this
|
9306 | var _h = _vm.$createElement
|
9307 | var _c = _vm._self._c || _h
|
9308 | return _c(
|
9309 | "button",
|
9310 | {
|
9311 | staticClass: "el-button",
|
9312 | class: [
|
9313 | _vm.type ? "el-button--" + _vm.type : "",
|
9314 | _vm.buttonSize ? "el-button--" + _vm.buttonSize : "",
|
9315 | {
|
9316 | "is-disabled": _vm.buttonDisabled,
|
9317 | "is-loading": _vm.loading,
|
9318 | "is-plain": _vm.plain,
|
9319 | "is-round": _vm.round,
|
9320 | "is-circle": _vm.circle
|
9321 | }
|
9322 | ],
|
9323 | attrs: {
|
9324 | disabled: _vm.buttonDisabled || _vm.loading,
|
9325 | autofocus: _vm.autofocus,
|
9326 | type: _vm.nativeType
|
9327 | },
|
9328 | on: { click: _vm.handleClick }
|
9329 | },
|
9330 | [
|
9331 | _vm.loading ? _c("i", { staticClass: "el-icon-loading" }) : _vm._e(),
|
9332 | _vm.icon && !_vm.loading ? _c("i", { class: _vm.icon }) : _vm._e(),
|
9333 | _vm.$slots.default ? _c("span", [_vm._t("default")], 2) : _vm._e()
|
9334 | ]
|
9335 | )
|
9336 | }
|
9337 | var buttonvue_type_template_id_ca859fb4_staticRenderFns = []
|
9338 | buttonvue_type_template_id_ca859fb4_render._withStripped = true
|
9339 |
|
9340 |
|
9341 |
|
9342 |
|
9343 |
|
9344 |
|
9345 |
|
9346 |
|
9347 |
|
9348 |
|
9349 |
|
9350 |
|
9351 |
|
9352 |
|
9353 |
|
9354 |
|
9355 |
|
9356 |
|
9357 |
|
9358 |
|
9359 |
|
9360 |
|
9361 |
|
9362 |
|
9363 |
|
9364 |
|
9365 |
|
9366 |
|
9367 |
|
9368 |
|
9369 | var buttonvue_type_script_lang_js_ = ({
|
9370 | name: 'ElButton',
|
9371 |
|
9372 | inject: {
|
9373 | elForm: {
|
9374 | default: ''
|
9375 | },
|
9376 | elFormItem: {
|
9377 | default: ''
|
9378 | }
|
9379 | },
|
9380 |
|
9381 | props: {
|
9382 | type: {
|
9383 | type: String,
|
9384 | default: 'default'
|
9385 | },
|
9386 | size: String,
|
9387 | icon: {
|
9388 | type: String,
|
9389 | default: ''
|
9390 | },
|
9391 | nativeType: {
|
9392 | type: String,
|
9393 | default: 'button'
|
9394 | },
|
9395 | loading: Boolean,
|
9396 | disabled: Boolean,
|
9397 | plain: Boolean,
|
9398 | autofocus: Boolean,
|
9399 | round: Boolean,
|
9400 | circle: Boolean
|
9401 | },
|
9402 |
|
9403 | computed: {
|
9404 | _elFormItemSize: function _elFormItemSize() {
|
9405 | return (this.elFormItem || {}).elFormItemSize;
|
9406 | },
|
9407 | buttonSize: function buttonSize() {
|
9408 | return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
9409 | },
|
9410 | buttonDisabled: function buttonDisabled() {
|
9411 | return this.disabled || (this.elForm || {}).disabled;
|
9412 | }
|
9413 | },
|
9414 |
|
9415 | methods: {
|
9416 | handleClick: function handleClick(evt) {
|
9417 | this.$emit('click', evt);
|
9418 | }
|
9419 | }
|
9420 | });
|
9421 |
|
9422 | var src_buttonvue_type_script_lang_js_ = (buttonvue_type_script_lang_js_);
|
9423 |
|
9424 |
|
9425 |
|
9426 |
|
9427 |
|
9428 |
|
9429 |
|
9430 |
|
9431 | var button_component = normalizeComponent(
|
9432 | src_buttonvue_type_script_lang_js_,
|
9433 | buttonvue_type_template_id_ca859fb4_render,
|
9434 | buttonvue_type_template_id_ca859fb4_staticRenderFns,
|
9435 | false,
|
9436 | null,
|
9437 | null,
|
9438 | null
|
9439 |
|
9440 | )
|
9441 |
|
9442 |
|
9443 | if (false) { var button_api; }
|
9444 | button_component.options.__file = "packages/button/src/button.vue"
|
9445 | var src_button = (button_component.exports);
|
9446 |
|
9447 |
|
9448 |
|
9449 |
|
9450 | src_button.install = function (Vue) {
|
9451 | Vue.component(src_button.name, src_button);
|
9452 | };
|
9453 |
|
9454 | var packages_button = (src_button);
|
9455 |
|
9456 | var button_groupvue_type_template_id_3d8661d0_render = function() {
|
9457 | var _vm = this
|
9458 | var _h = _vm.$createElement
|
9459 | var _c = _vm._self._c || _h
|
9460 | return _c("div", { staticClass: "el-button-group" }, [_vm._t("default")], 2)
|
9461 | }
|
9462 | var button_groupvue_type_template_id_3d8661d0_staticRenderFns = []
|
9463 | button_groupvue_type_template_id_3d8661d0_render._withStripped = true
|
9464 |
|
9465 |
|
9466 |
|
9467 |
|
9468 |
|
9469 |
|
9470 |
|
9471 |
|
9472 |
|
9473 |
|
9474 |
|
9475 | var button_groupvue_type_script_lang_js_ = ({
|
9476 | name: 'ElButtonGroup'
|
9477 | });
|
9478 |
|
9479 | var src_button_groupvue_type_script_lang_js_ = (button_groupvue_type_script_lang_js_);
|
9480 |
|
9481 |
|
9482 |
|
9483 |
|
9484 |
|
9485 |
|
9486 |
|
9487 |
|
9488 | var button_group_component = normalizeComponent(
|
9489 | src_button_groupvue_type_script_lang_js_,
|
9490 | button_groupvue_type_template_id_3d8661d0_render,
|
9491 | button_groupvue_type_template_id_3d8661d0_staticRenderFns,
|
9492 | false,
|
9493 | null,
|
9494 | null,
|
9495 | null
|
9496 |
|
9497 | )
|
9498 |
|
9499 |
|
9500 | if (false) { var button_group_api; }
|
9501 | button_group_component.options.__file = "packages/button/src/button-group.vue"
|
9502 | var button_group = (button_group_component.exports);
|
9503 |
|
9504 |
|
9505 |
|
9506 |
|
9507 | button_group.install = function (Vue) {
|
9508 | Vue.component(button_group.name, button_group);
|
9509 | };
|
9510 |
|
9511 | var packages_button_group = (button_group);
|
9512 |
|
9513 | var tablevue_type_template_id_493fe34e_render = function() {
|
9514 | var _vm = this
|
9515 | var _h = _vm.$createElement
|
9516 | var _c = _vm._self._c || _h
|
9517 | return _c(
|
9518 | "div",
|
9519 | {
|
9520 | staticClass: "el-table",
|
9521 | class: [
|
9522 | {
|
9523 | "el-table--fit": _vm.fit,
|
9524 | "el-table--striped": _vm.stripe,
|
9525 | "el-table--border": _vm.border || _vm.isGroup,
|
9526 | "el-table--hidden": _vm.isHidden,
|
9527 | "el-table--group": _vm.isGroup,
|
9528 | "el-table--fluid-height": _vm.maxHeight,
|
9529 | "el-table--scrollable-x": _vm.layout.scrollX,
|
9530 | "el-table--scrollable-y": _vm.layout.scrollY,
|
9531 | "el-table--enable-row-hover": !_vm.store.states.isComplex,
|
9532 | "el-table--enable-row-transition":
|
9533 | (_vm.store.states.data || []).length !== 0 &&
|
9534 | (_vm.store.states.data || []).length < 100
|
9535 | },
|
9536 | _vm.tableSize ? "el-table--" + _vm.tableSize : ""
|
9537 | ],
|
9538 | on: {
|
9539 | mouseleave: function($event) {
|
9540 | _vm.handleMouseLeave($event)
|
9541 | }
|
9542 | }
|
9543 | },
|
9544 | [
|
9545 | _c(
|
9546 | "div",
|
9547 | { ref: "hiddenColumns", staticClass: "hidden-columns" },
|
9548 | [_vm._t("default")],
|
9549 | 2
|
9550 | ),
|
9551 | _vm.showHeader
|
9552 | ? _c(
|
9553 | "div",
|
9554 | {
|
9555 | directives: [
|
9556 | {
|
9557 | name: "mousewheel",
|
9558 | rawName: "v-mousewheel",
|
9559 | value: _vm.handleHeaderFooterMousewheel,
|
9560 | expression: "handleHeaderFooterMousewheel"
|
9561 | }
|
9562 | ],
|
9563 | ref: "headerWrapper",
|
9564 | staticClass: "el-table__header-wrapper"
|
9565 | },
|
9566 | [
|
9567 | _c("table-header", {
|
9568 | ref: "tableHeader",
|
9569 | style: {
|
9570 | width: _vm.layout.bodyWidth ? _vm.layout.bodyWidth + "px" : ""
|
9571 | },
|
9572 | attrs: {
|
9573 | store: _vm.store,
|
9574 | border: _vm.border,
|
9575 | "default-sort": _vm.defaultSort
|
9576 | }
|
9577 | })
|
9578 | ],
|
9579 | 1
|
9580 | )
|
9581 | : _vm._e(),
|
9582 | _c(
|
9583 | "div",
|
9584 | {
|
9585 | ref: "bodyWrapper",
|
9586 | staticClass: "el-table__body-wrapper",
|
9587 | class: [
|
9588 | _vm.layout.scrollX
|
9589 | ? "is-scrolling-" + _vm.scrollPosition
|
9590 | : "is-scrolling-none"
|
9591 | ],
|
9592 | style: [_vm.bodyHeight]
|
9593 | },
|
9594 | [
|
9595 | _c("table-body", {
|
9596 | style: {
|
9597 | width: _vm.bodyWidth
|
9598 | },
|
9599 | attrs: {
|
9600 | context: _vm.context,
|
9601 | store: _vm.store,
|
9602 | stripe: _vm.stripe,
|
9603 | "row-class-name": _vm.rowClassName,
|
9604 | "row-style": _vm.rowStyle,
|
9605 | highlight: _vm.highlightCurrentRow
|
9606 | }
|
9607 | }),
|
9608 | !_vm.data || _vm.data.length === 0
|
9609 | ? _c(
|
9610 | "div",
|
9611 | {
|
9612 | ref: "emptyBlock",
|
9613 | staticClass: "el-table__empty-block",
|
9614 | style: _vm.emptyBlockStyle
|
9615 | },
|
9616 | [
|
9617 | _c(
|
9618 | "span",
|
9619 | { staticClass: "el-table__empty-text" },
|
9620 | [
|
9621 | _vm._t("empty", [
|
9622 | _vm._v(
|
9623 | _vm._s(_vm.emptyText || _vm.t("el.table.emptyText"))
|
9624 | )
|
9625 | ])
|
9626 | ],
|
9627 | 2
|
9628 | )
|
9629 | ]
|
9630 | )
|
9631 | : _vm._e(),
|
9632 | _vm.$slots.append
|
9633 | ? _c(
|
9634 | "div",
|
9635 | {
|
9636 | ref: "appendWrapper",
|
9637 | staticClass: "el-table__append-wrapper"
|
9638 | },
|
9639 | [_vm._t("append")],
|
9640 | 2
|
9641 | )
|
9642 | : _vm._e()
|
9643 | ],
|
9644 | 1
|
9645 | ),
|
9646 | _vm.showSummary
|
9647 | ? _c(
|
9648 | "div",
|
9649 | {
|
9650 | directives: [
|
9651 | {
|
9652 | name: "show",
|
9653 | rawName: "v-show",
|
9654 | value: _vm.data && _vm.data.length > 0,
|
9655 | expression: "data && data.length > 0"
|
9656 | },
|
9657 | {
|
9658 | name: "mousewheel",
|
9659 | rawName: "v-mousewheel",
|
9660 | value: _vm.handleHeaderFooterMousewheel,
|
9661 | expression: "handleHeaderFooterMousewheel"
|
9662 | }
|
9663 | ],
|
9664 | ref: "footerWrapper",
|
9665 | staticClass: "el-table__footer-wrapper"
|
9666 | },
|
9667 | [
|
9668 | _c("table-footer", {
|
9669 | style: {
|
9670 | width: _vm.layout.bodyWidth ? _vm.layout.bodyWidth + "px" : ""
|
9671 | },
|
9672 | attrs: {
|
9673 | store: _vm.store,
|
9674 | border: _vm.border,
|
9675 | "sum-text": _vm.sumText || _vm.t("el.table.sumText"),
|
9676 | "summary-method": _vm.summaryMethod,
|
9677 | "default-sort": _vm.defaultSort
|
9678 | }
|
9679 | })
|
9680 | ],
|
9681 | 1
|
9682 | )
|
9683 | : _vm._e(),
|
9684 | _vm.fixedColumns.length > 0
|
9685 | ? _c(
|
9686 | "div",
|
9687 | {
|
9688 | directives: [
|
9689 | {
|
9690 | name: "mousewheel",
|
9691 | rawName: "v-mousewheel",
|
9692 | value: _vm.handleFixedMousewheel,
|
9693 | expression: "handleFixedMousewheel"
|
9694 | }
|
9695 | ],
|
9696 | ref: "fixedWrapper",
|
9697 | staticClass: "el-table__fixed",
|
9698 | style: [
|
9699 | {
|
9700 | width: _vm.layout.fixedWidth
|
9701 | ? _vm.layout.fixedWidth + "px"
|
9702 | : ""
|
9703 | },
|
9704 | _vm.fixedHeight
|
9705 | ]
|
9706 | },
|
9707 | [
|
9708 | _vm.showHeader
|
9709 | ? _c(
|
9710 | "div",
|
9711 | {
|
9712 | ref: "fixedHeaderWrapper",
|
9713 | staticClass: "el-table__fixed-header-wrapper"
|
9714 | },
|
9715 | [
|
9716 | _c("table-header", {
|
9717 | ref: "fixedTableHeader",
|
9718 | style: {
|
9719 | width: _vm.bodyWidth
|
9720 | },
|
9721 | attrs: {
|
9722 | fixed: "left",
|
9723 | border: _vm.border,
|
9724 | store: _vm.store
|
9725 | }
|
9726 | })
|
9727 | ],
|
9728 | 1
|
9729 | )
|
9730 | : _vm._e(),
|
9731 | _c(
|
9732 | "div",
|
9733 | {
|
9734 | ref: "fixedBodyWrapper",
|
9735 | staticClass: "el-table__fixed-body-wrapper",
|
9736 | style: [
|
9737 | {
|
9738 | top: _vm.layout.headerHeight + "px"
|
9739 | },
|
9740 | _vm.fixedBodyHeight
|
9741 | ]
|
9742 | },
|
9743 | [
|
9744 | _c("table-body", {
|
9745 | style: {
|
9746 | width: _vm.bodyWidth
|
9747 | },
|
9748 | attrs: {
|
9749 | fixed: "left",
|
9750 | store: _vm.store,
|
9751 | stripe: _vm.stripe,
|
9752 | highlight: _vm.highlightCurrentRow,
|
9753 | "row-class-name": _vm.rowClassName,
|
9754 | "row-style": _vm.rowStyle
|
9755 | }
|
9756 | }),
|
9757 | _vm.$slots.append
|
9758 | ? _c("div", {
|
9759 | staticClass: "el-table__append-gutter",
|
9760 | style: { height: _vm.layout.appendHeight + "px" }
|
9761 | })
|
9762 | : _vm._e()
|
9763 | ],
|
9764 | 1
|
9765 | ),
|
9766 | _vm.showSummary
|
9767 | ? _c(
|
9768 | "div",
|
9769 | {
|
9770 | directives: [
|
9771 | {
|
9772 | name: "show",
|
9773 | rawName: "v-show",
|
9774 | value: _vm.data && _vm.data.length > 0,
|
9775 | expression: "data && data.length > 0"
|
9776 | }
|
9777 | ],
|
9778 | ref: "fixedFooterWrapper",
|
9779 | staticClass: "el-table__fixed-footer-wrapper"
|
9780 | },
|
9781 | [
|
9782 | _c("table-footer", {
|
9783 | style: {
|
9784 | width: _vm.bodyWidth
|
9785 | },
|
9786 | attrs: {
|
9787 | fixed: "left",
|
9788 | border: _vm.border,
|
9789 | "sum-text": _vm.sumText || _vm.t("el.table.sumText"),
|
9790 | "summary-method": _vm.summaryMethod,
|
9791 | store: _vm.store
|
9792 | }
|
9793 | })
|
9794 | ],
|
9795 | 1
|
9796 | )
|
9797 | : _vm._e()
|
9798 | ]
|
9799 | )
|
9800 | : _vm._e(),
|
9801 | _vm.rightFixedColumns.length > 0
|
9802 | ? _c(
|
9803 | "div",
|
9804 | {
|
9805 | directives: [
|
9806 | {
|
9807 | name: "mousewheel",
|
9808 | rawName: "v-mousewheel",
|
9809 | value: _vm.handleFixedMousewheel,
|
9810 | expression: "handleFixedMousewheel"
|
9811 | }
|
9812 | ],
|
9813 | ref: "rightFixedWrapper",
|
9814 | staticClass: "el-table__fixed-right",
|
9815 | style: [
|
9816 | {
|
9817 | width: _vm.layout.rightFixedWidth
|
9818 | ? _vm.layout.rightFixedWidth + "px"
|
9819 | : "",
|
9820 | right: _vm.layout.scrollY
|
9821 | ? (_vm.border
|
9822 | ? _vm.layout.gutterWidth
|
9823 | : _vm.layout.gutterWidth || 0) + "px"
|
9824 | : ""
|
9825 | },
|
9826 | _vm.fixedHeight
|
9827 | ]
|
9828 | },
|
9829 | [
|
9830 | _vm.showHeader
|
9831 | ? _c(
|
9832 | "div",
|
9833 | {
|
9834 | ref: "rightFixedHeaderWrapper",
|
9835 | staticClass: "el-table__fixed-header-wrapper"
|
9836 | },
|
9837 | [
|
9838 | _c("table-header", {
|
9839 | ref: "rightFixedTableHeader",
|
9840 | style: {
|
9841 | width: _vm.bodyWidth
|
9842 | },
|
9843 | attrs: {
|
9844 | fixed: "right",
|
9845 | border: _vm.border,
|
9846 | store: _vm.store
|
9847 | }
|
9848 | })
|
9849 | ],
|
9850 | 1
|
9851 | )
|
9852 | : _vm._e(),
|
9853 | _c(
|
9854 | "div",
|
9855 | {
|
9856 | ref: "rightFixedBodyWrapper",
|
9857 | staticClass: "el-table__fixed-body-wrapper",
|
9858 | style: [
|
9859 | {
|
9860 | top: _vm.layout.headerHeight + "px"
|
9861 | },
|
9862 | _vm.fixedBodyHeight
|
9863 | ]
|
9864 | },
|
9865 | [
|
9866 | _c("table-body", {
|
9867 | style: {
|
9868 | width: _vm.bodyWidth
|
9869 | },
|
9870 | attrs: {
|
9871 | fixed: "right",
|
9872 | store: _vm.store,
|
9873 | stripe: _vm.stripe,
|
9874 | "row-class-name": _vm.rowClassName,
|
9875 | "row-style": _vm.rowStyle,
|
9876 | highlight: _vm.highlightCurrentRow
|
9877 | }
|
9878 | }),
|
9879 | _vm.$slots.append
|
9880 | ? _c("div", {
|
9881 | staticClass: "el-table__append-gutter",
|
9882 | style: { height: _vm.layout.appendHeight + "px" }
|
9883 | })
|
9884 | : _vm._e()
|
9885 | ],
|
9886 | 1
|
9887 | ),
|
9888 | _vm.showSummary
|
9889 | ? _c(
|
9890 | "div",
|
9891 | {
|
9892 | directives: [
|
9893 | {
|
9894 | name: "show",
|
9895 | rawName: "v-show",
|
9896 | value: _vm.data && _vm.data.length > 0,
|
9897 | expression: "data && data.length > 0"
|
9898 | }
|
9899 | ],
|
9900 | ref: "rightFixedFooterWrapper",
|
9901 | staticClass: "el-table__fixed-footer-wrapper"
|
9902 | },
|
9903 | [
|
9904 | _c("table-footer", {
|
9905 | style: {
|
9906 | width: _vm.bodyWidth
|
9907 | },
|
9908 | attrs: {
|
9909 | fixed: "right",
|
9910 | border: _vm.border,
|
9911 | "sum-text": _vm.sumText || _vm.t("el.table.sumText"),
|
9912 | "summary-method": _vm.summaryMethod,
|
9913 | store: _vm.store
|
9914 | }
|
9915 | })
|
9916 | ],
|
9917 | 1
|
9918 | )
|
9919 | : _vm._e()
|
9920 | ]
|
9921 | )
|
9922 | : _vm._e(),
|
9923 | _vm.rightFixedColumns.length > 0
|
9924 | ? _c("div", {
|
9925 | ref: "rightFixedPatch",
|
9926 | staticClass: "el-table__fixed-right-patch",
|
9927 | style: {
|
9928 | width: _vm.layout.scrollY ? _vm.layout.gutterWidth + "px" : "0",
|
9929 | height: _vm.layout.headerHeight + "px"
|
9930 | }
|
9931 | })
|
9932 | : _vm._e(),
|
9933 | _c("div", {
|
9934 | directives: [
|
9935 | {
|
9936 | name: "show",
|
9937 | rawName: "v-show",
|
9938 | value: _vm.resizeProxyVisible,
|
9939 | expression: "resizeProxyVisible"
|
9940 | }
|
9941 | ],
|
9942 | ref: "resizeProxy",
|
9943 | staticClass: "el-table__column-resize-proxy"
|
9944 | })
|
9945 | ]
|
9946 | )
|
9947 | }
|
9948 | var tablevue_type_template_id_493fe34e_staticRenderFns = []
|
9949 | tablevue_type_template_id_493fe34e_render._withStripped = true
|
9950 |
|
9951 |
|
9952 |
|
9953 |
|
9954 |
|
9955 | var checkbox_ = __webpack_require__(16);
|
9956 | var checkbox_default = __webpack_require__.n(checkbox_);
|
9957 |
|
9958 |
|
9959 | var external_throttle_debounce_ = __webpack_require__(35);
|
9960 |
|
9961 |
|
9962 | var external_normalize_wheel_ = __webpack_require__(38);
|
9963 | var external_normalize_wheel_default = __webpack_require__.n(external_normalize_wheel_);
|
9964 |
|
9965 |
|
9966 |
|
9967 |
|
9968 | var isFirefox = typeof navigator !== 'undefined' && navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
9969 |
|
9970 | var mousewheel_mousewheel = function mousewheel(element, callback) {
|
9971 | if (element && element.addEventListener) {
|
9972 | element.addEventListener(isFirefox ? 'DOMMouseScroll' : 'mousewheel', function (event) {
|
9973 | var normalized = external_normalize_wheel_default()(event);
|
9974 | callback && callback.apply(this, [event, normalized]);
|
9975 | });
|
9976 | }
|
9977 | };
|
9978 |
|
9979 | var directives_mousewheel = ({
|
9980 | bind: function bind(el, binding) {
|
9981 | mousewheel_mousewheel(el, binding.value);
|
9982 | }
|
9983 | });
|
9984 |
|
9985 | var external_vue_ = __webpack_require__(6);
|
9986 | var external_vue_default = __webpack_require__.n(external_vue_);
|
9987 |
|
9988 |
|
9989 | var util_typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
9990 |
|
9991 |
|
9992 |
|
9993 | var getCell = function getCell(event) {
|
9994 | var cell = event.target;
|
9995 |
|
9996 | while (cell && cell.tagName.toUpperCase() !== 'HTML') {
|
9997 | if (cell.tagName.toUpperCase() === 'TD') {
|
9998 | return cell;
|
9999 | }
|
10000 | cell = cell.parentNode;
|
10001 | }
|
10002 |
|
10003 | return null;
|
10004 | };
|
10005 |
|
10006 | var util_isObject = function isObject(obj) {
|
10007 | return obj !== null && (typeof obj === 'undefined' ? 'undefined' : util_typeof(obj)) === 'object';
|
10008 | };
|
10009 |
|
10010 | var util_orderBy = function orderBy(array, sortKey, reverse, sortMethod, sortBy) {
|
10011 | if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
|
10012 | return array;
|
10013 | }
|
10014 | if (typeof reverse === 'string') {
|
10015 | reverse = reverse === 'descending' ? -1 : 1;
|
10016 | } else {
|
10017 | reverse = reverse && reverse < 0 ? -1 : 1;
|
10018 | }
|
10019 | var getKey = sortMethod ? null : function (value, index) {
|
10020 | if (sortBy) {
|
10021 | if (!Array.isArray(sortBy)) {
|
10022 | sortBy = [sortBy];
|
10023 | }
|
10024 | return sortBy.map(function (by) {
|
10025 | if (typeof by === 'string') {
|
10026 | return Object(util_["getValueByPath"])(value, by);
|
10027 | } else {
|
10028 | return by(value, index, array);
|
10029 | }
|
10030 | });
|
10031 | }
|
10032 | if (sortKey !== '$key') {
|
10033 | if (util_isObject(value) && '$value' in value) value = value.$value;
|
10034 | }
|
10035 | return [util_isObject(value) ? Object(util_["getValueByPath"])(value, sortKey) : value];
|
10036 | };
|
10037 | var compare = function compare(a, b) {
|
10038 | if (sortMethod) {
|
10039 | return sortMethod(a.value, b.value);
|
10040 | }
|
10041 | for (var i = 0, len = a.key.length; i < len; i++) {
|
10042 | if (a.key[i] < b.key[i]) {
|
10043 | return -1;
|
10044 | }
|
10045 | if (a.key[i] > b.key[i]) {
|
10046 | return 1;
|
10047 | }
|
10048 | }
|
10049 | return 0;
|
10050 | };
|
10051 | return array.map(function (value, index) {
|
10052 | return {
|
10053 | value: value,
|
10054 | index: index,
|
10055 | key: getKey ? getKey(value, index) : null
|
10056 | };
|
10057 | }).sort(function (a, b) {
|
10058 | var order = compare(a, b);
|
10059 | if (!order) {
|
10060 |
|
10061 | order = a.index - b.index;
|
10062 | }
|
10063 | return order * reverse;
|
10064 | }).map(function (item) {
|
10065 | return item.value;
|
10066 | });
|
10067 | };
|
10068 |
|
10069 | var getColumnById = function getColumnById(table, columnId) {
|
10070 | var column = null;
|
10071 | table.columns.forEach(function (item) {
|
10072 | if (item.id === columnId) {
|
10073 | column = item;
|
10074 | }
|
10075 | });
|
10076 | return column;
|
10077 | };
|
10078 |
|
10079 | var getColumnByKey = function getColumnByKey(table, columnKey) {
|
10080 | var column = null;
|
10081 | for (var i = 0; i < table.columns.length; i++) {
|
10082 | var item = table.columns[i];
|
10083 | if (item.columnKey === columnKey) {
|
10084 | column = item;
|
10085 | break;
|
10086 | }
|
10087 | }
|
10088 | return column;
|
10089 | };
|
10090 |
|
10091 | var getColumnByCell = function getColumnByCell(table, cell) {
|
10092 | var matches = (cell.className || '').match(/el-table_[^\s]+/gm);
|
10093 | if (matches) {
|
10094 | return getColumnById(table, matches[0]);
|
10095 | }
|
10096 | return null;
|
10097 | };
|
10098 |
|
10099 | var getRowIdentity = function getRowIdentity(row, rowKey) {
|
10100 | if (!row) throw new Error('row is required when get row identity');
|
10101 | if (typeof rowKey === 'string') {
|
10102 | if (rowKey.indexOf('.') < 0) {
|
10103 | return row[rowKey];
|
10104 | }
|
10105 | var key = rowKey.split('.');
|
10106 | var current = row;
|
10107 | for (var i = 0; i < key.length; i++) {
|
10108 | current = current[key[i]];
|
10109 | }
|
10110 | return current;
|
10111 | } else if (typeof rowKey === 'function') {
|
10112 | return rowKey.call(null, row);
|
10113 | }
|
10114 | };
|
10115 |
|
10116 | var getKeysMap = function getKeysMap(array, rowKey) {
|
10117 | var arrayMap = {};
|
10118 | (array || []).forEach(function (row, index) {
|
10119 | arrayMap[getRowIdentity(row, rowKey)] = { row: row, index: index };
|
10120 | });
|
10121 | return arrayMap;
|
10122 | };
|
10123 |
|
10124 | function hasOwn(obj, key) {
|
10125 | return Object.prototype.hasOwnProperty.call(obj, key);
|
10126 | }
|
10127 |
|
10128 | function mergeOptions(defaults, config) {
|
10129 | var options = {};
|
10130 | var key = void 0;
|
10131 | for (key in defaults) {
|
10132 | options[key] = defaults[key];
|
10133 | }
|
10134 | for (key in config) {
|
10135 | if (hasOwn(config, key)) {
|
10136 | var value = config[key];
|
10137 | if (typeof value !== 'undefined') {
|
10138 | options[key] = value;
|
10139 | }
|
10140 | }
|
10141 | }
|
10142 | return options;
|
10143 | }
|
10144 |
|
10145 | function parseWidth(width) {
|
10146 | if (width !== undefined) {
|
10147 | width = parseInt(width, 10);
|
10148 | if (isNaN(width)) {
|
10149 | width = null;
|
10150 | }
|
10151 | }
|
10152 | return width;
|
10153 | }
|
10154 |
|
10155 | function parseMinWidth(minWidth) {
|
10156 | if (typeof minWidth !== 'undefined') {
|
10157 | minWidth = parseWidth(minWidth);
|
10158 | if (isNaN(minWidth)) {
|
10159 | minWidth = 80;
|
10160 | }
|
10161 | }
|
10162 | return minWidth;
|
10163 | };
|
10164 |
|
10165 | function parseHeight(height) {
|
10166 | if (typeof height === 'number') {
|
10167 | return height;
|
10168 | }
|
10169 | if (typeof height === 'string') {
|
10170 | if (/^\d+(?:px)?$/.test(height)) {
|
10171 | return parseInt(height, 10);
|
10172 | } else {
|
10173 | return height;
|
10174 | }
|
10175 | }
|
10176 | return null;
|
10177 | }
|
10178 |
|
10179 |
|
10180 | function compose() {
|
10181 | for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {
|
10182 | funcs[_key] = arguments[_key];
|
10183 | }
|
10184 |
|
10185 | if (funcs.length === 0) {
|
10186 | return function (arg) {
|
10187 | return arg;
|
10188 | };
|
10189 | }
|
10190 | if (funcs.length === 1) {
|
10191 | return funcs[0];
|
10192 | }
|
10193 | return funcs.reduce(function (a, b) {
|
10194 | return function () {
|
10195 | return a(b.apply(undefined, arguments));
|
10196 | };
|
10197 | });
|
10198 | }
|
10199 |
|
10200 | function toggleRowStatus(statusArr, row, newVal) {
|
10201 | var changed = false;
|
10202 | var index = statusArr.indexOf(row);
|
10203 | var included = index !== -1;
|
10204 |
|
10205 | var addRow = function addRow() {
|
10206 | statusArr.push(row);
|
10207 | changed = true;
|
10208 | };
|
10209 | var removeRow = function removeRow() {
|
10210 | statusArr.splice(index, 1);
|
10211 | changed = true;
|
10212 | };
|
10213 |
|
10214 | if (typeof newVal === 'boolean') {
|
10215 | if (newVal && !included) {
|
10216 | addRow();
|
10217 | } else if (!newVal && included) {
|
10218 | removeRow();
|
10219 | }
|
10220 | } else {
|
10221 | if (included) {
|
10222 | removeRow();
|
10223 | } else {
|
10224 | addRow();
|
10225 | }
|
10226 | }
|
10227 | return changed;
|
10228 | }
|
10229 |
|
10230 | function walkTreeNode(root, cb) {
|
10231 | var childrenKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'children';
|
10232 | var lazyKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'hasChildren';
|
10233 |
|
10234 | var isNil = function isNil(array) {
|
10235 | return !(Array.isArray(array) && array.length);
|
10236 | };
|
10237 |
|
10238 | function _walker(parent, children, level) {
|
10239 | cb(parent, children, level);
|
10240 | children.forEach(function (item) {
|
10241 | if (item[lazyKey]) {
|
10242 | cb(item, null, level + 1);
|
10243 | return;
|
10244 | }
|
10245 | var children = item[childrenKey];
|
10246 | if (!isNil(children)) {
|
10247 | _walker(item, children, level + 1);
|
10248 | }
|
10249 | });
|
10250 | }
|
10251 |
|
10252 | root.forEach(function (item) {
|
10253 | if (item[lazyKey]) {
|
10254 | cb(item, null, 0);
|
10255 | return;
|
10256 | }
|
10257 | var children = item[childrenKey];
|
10258 | if (!isNil(children)) {
|
10259 | _walker(item, children, 0);
|
10260 | }
|
10261 | });
|
10262 | }
|
10263 |
|
10264 |
|
10265 |
|
10266 | var expand = ({
|
10267 | data: function data() {
|
10268 | return {
|
10269 | states: {
|
10270 | defaultExpandAll: false,
|
10271 | expandRows: []
|
10272 | }
|
10273 | };
|
10274 | },
|
10275 |
|
10276 |
|
10277 | methods: {
|
10278 | updateExpandRows: function updateExpandRows() {
|
10279 | var _states = this.states,
|
10280 | _states$data = _states.data,
|
10281 | data = _states$data === undefined ? [] : _states$data,
|
10282 | rowKey = _states.rowKey,
|
10283 | defaultExpandAll = _states.defaultExpandAll,
|
10284 | expandRows = _states.expandRows;
|
10285 |
|
10286 | if (defaultExpandAll) {
|
10287 | this.states.expandRows = data.slice();
|
10288 | } else if (rowKey) {
|
10289 |
|
10290 | var expandRowsMap = getKeysMap(expandRows, rowKey);
|
10291 | this.states.expandRows = data.reduce(function (prev, row) {
|
10292 | var rowId = getRowIdentity(row, rowKey);
|
10293 | var rowInfo = expandRowsMap[rowId];
|
10294 | if (rowInfo) {
|
10295 | prev.push(row);
|
10296 | }
|
10297 | return prev;
|
10298 | }, []);
|
10299 | } else {
|
10300 | this.states.expandRows = [];
|
10301 | }
|
10302 | },
|
10303 | toggleRowExpansion: function toggleRowExpansion(row, expanded) {
|
10304 | var changed = toggleRowStatus(this.states.expandRows, row, expanded);
|
10305 | if (changed) {
|
10306 | this.table.$emit('expand-change', row, this.states.expandRows.slice());
|
10307 | this.scheduleLayout();
|
10308 | }
|
10309 | },
|
10310 | setExpandRowKeys: function setExpandRowKeys(rowKeys) {
|
10311 | this.assertRowKey();
|
10312 |
|
10313 | var _states2 = this.states,
|
10314 | data = _states2.data,
|
10315 | rowKey = _states2.rowKey;
|
10316 |
|
10317 | var keysMap = getKeysMap(data, rowKey);
|
10318 | this.states.expandRows = rowKeys.reduce(function (prev, cur) {
|
10319 | var info = keysMap[cur];
|
10320 | if (info) {
|
10321 | prev.push(info.row);
|
10322 | }
|
10323 | return prev;
|
10324 | }, []);
|
10325 | },
|
10326 | isRowExpanded: function isRowExpanded(row) {
|
10327 | var _states3 = this.states,
|
10328 | _states3$expandRows = _states3.expandRows,
|
10329 | expandRows = _states3$expandRows === undefined ? [] : _states3$expandRows,
|
10330 | rowKey = _states3.rowKey;
|
10331 |
|
10332 | if (rowKey) {
|
10333 | var expandMap = getKeysMap(expandRows, rowKey);
|
10334 | return !!expandMap[getRowIdentity(row, rowKey)];
|
10335 | }
|
10336 | return expandRows.indexOf(row) !== -1;
|
10337 | }
|
10338 | }
|
10339 | });
|
10340 |
|
10341 |
|
10342 |
|
10343 |
|
10344 | var current = ({
|
10345 | data: function data() {
|
10346 | return {
|
10347 | states: {
|
10348 |
|
10349 |
|
10350 | _currentRowKey: null,
|
10351 | currentRow: null
|
10352 | }
|
10353 | };
|
10354 | },
|
10355 |
|
10356 |
|
10357 | methods: {
|
10358 | setCurrentRowKey: function setCurrentRowKey(key) {
|
10359 | this.assertRowKey();
|
10360 | this.states._currentRowKey = key;
|
10361 | this.setCurrentRowByKey(key);
|
10362 | },
|
10363 | restoreCurrentRowKey: function restoreCurrentRowKey() {
|
10364 | this.states._currentRowKey = null;
|
10365 | },
|
10366 | setCurrentRowByKey: function setCurrentRowByKey(key) {
|
10367 | var states = this.states;
|
10368 | var _states$data = states.data,
|
10369 | data = _states$data === undefined ? [] : _states$data,
|
10370 | rowKey = states.rowKey;
|
10371 |
|
10372 | var currentRow = null;
|
10373 | if (rowKey) {
|
10374 | currentRow = Object(util_["arrayFind"])(data, function (item) {
|
10375 | return getRowIdentity(item, rowKey) === key;
|
10376 | });
|
10377 | }
|
10378 | states.currentRow = currentRow;
|
10379 | },
|
10380 | updateCurrentRow: function updateCurrentRow(currentRow) {
|
10381 | var states = this.states,
|
10382 | table = this.table;
|
10383 |
|
10384 | var oldCurrentRow = states.currentRow;
|
10385 | if (currentRow && currentRow !== oldCurrentRow) {
|
10386 | states.currentRow = currentRow;
|
10387 | table.$emit('current-change', currentRow, oldCurrentRow);
|
10388 | return;
|
10389 | }
|
10390 | if (!currentRow && oldCurrentRow) {
|
10391 | states.currentRow = null;
|
10392 | table.$emit('current-change', null, oldCurrentRow);
|
10393 | }
|
10394 | },
|
10395 | updateCurrentRowData: function updateCurrentRowData() {
|
10396 | var states = this.states,
|
10397 | table = this.table;
|
10398 | var rowKey = states.rowKey,
|
10399 | _currentRowKey = states._currentRowKey;
|
10400 |
|
10401 |
|
10402 | var data = states.data || [];
|
10403 | var oldCurrentRow = states.currentRow;
|
10404 |
|
10405 |
|
10406 | if (data.indexOf(oldCurrentRow) === -1 && oldCurrentRow) {
|
10407 | if (rowKey) {
|
10408 | var currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
|
10409 | this.setCurrentRowByKey(currentRowKey);
|
10410 | } else {
|
10411 | states.currentRow = null;
|
10412 | }
|
10413 | if (states.currentRow === null) {
|
10414 | table.$emit('current-change', null, oldCurrentRow);
|
10415 | }
|
10416 | } else if (_currentRowKey) {
|
10417 |
|
10418 | this.setCurrentRowByKey(_currentRowKey);
|
10419 | this.restoreCurrentRowKey();
|
10420 | }
|
10421 | }
|
10422 | }
|
10423 | });
|
10424 |
|
10425 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
10426 |
|
10427 |
|
10428 |
|
10429 | var tree = ({
|
10430 | data: function data() {
|
10431 | return {
|
10432 | states: {
|
10433 |
|
10434 |
|
10435 |
|
10436 | expandRowKeys: [],
|
10437 | treeData: {},
|
10438 | indent: 16,
|
10439 | lazy: false,
|
10440 | lazyTreeNodeMap: {},
|
10441 | lazyColumnIdentifier: 'hasChildren',
|
10442 | childrenColumnName: 'children'
|
10443 | }
|
10444 | };
|
10445 | },
|
10446 |
|
10447 |
|
10448 | computed: {
|
10449 |
|
10450 |
|
10451 |
|
10452 | normalizedData: function normalizedData() {
|
10453 | if (!this.states.rowKey) return {};
|
10454 | var data = this.states.data || [];
|
10455 | return this.normalize(data);
|
10456 | },
|
10457 |
|
10458 |
|
10459 |
|
10460 | normalizedLazyNode: function normalizedLazyNode() {
|
10461 | var _states = this.states,
|
10462 | rowKey = _states.rowKey,
|
10463 | lazyTreeNodeMap = _states.lazyTreeNodeMap,
|
10464 | lazyColumnIdentifier = _states.lazyColumnIdentifier;
|
10465 |
|
10466 | var keys = Object.keys(lazyTreeNodeMap);
|
10467 | var res = {};
|
10468 | if (!keys.length) return res;
|
10469 | keys.forEach(function (key) {
|
10470 | if (lazyTreeNodeMap[key].length) {
|
10471 | var item = { children: [] };
|
10472 | lazyTreeNodeMap[key].forEach(function (row) {
|
10473 | var currentRowKey = getRowIdentity(row, rowKey);
|
10474 | item.children.push(currentRowKey);
|
10475 | if (row[lazyColumnIdentifier] && !res[currentRowKey]) {
|
10476 | res[currentRowKey] = { children: [] };
|
10477 | }
|
10478 | });
|
10479 | res[key] = item;
|
10480 | }
|
10481 | });
|
10482 | return res;
|
10483 | }
|
10484 | },
|
10485 |
|
10486 | watch: {
|
10487 | normalizedData: 'updateTreeData',
|
10488 | normalizedLazyNode: 'updateTreeData'
|
10489 | },
|
10490 |
|
10491 | methods: {
|
10492 | normalize: function normalize(data) {
|
10493 | var _states2 = this.states,
|
10494 | childrenColumnName = _states2.childrenColumnName,
|
10495 | lazyColumnIdentifier = _states2.lazyColumnIdentifier,
|
10496 | rowKey = _states2.rowKey,
|
10497 | lazy = _states2.lazy;
|
10498 |
|
10499 | var res = {};
|
10500 | walkTreeNode(data, function (parent, children, level) {
|
10501 | var parentId = getRowIdentity(parent, rowKey);
|
10502 | if (Array.isArray(children)) {
|
10503 | res[parentId] = {
|
10504 | children: children.map(function (row) {
|
10505 | return getRowIdentity(row, rowKey);
|
10506 | }),
|
10507 | level: level
|
10508 | };
|
10509 | } else if (lazy) {
|
10510 |
|
10511 | res[parentId] = {
|
10512 | children: [],
|
10513 | lazy: true,
|
10514 | level: level
|
10515 | };
|
10516 | }
|
10517 | }, childrenColumnName, lazyColumnIdentifier);
|
10518 | return res;
|
10519 | },
|
10520 | updateTreeData: function updateTreeData() {
|
10521 | var nested = this.normalizedData;
|
10522 | var normalizedLazyNode = this.normalizedLazyNode;
|
10523 | var keys = Object.keys(nested);
|
10524 | var newTreeData = {};
|
10525 | if (keys.length) {
|
10526 | var _states3 = this.states,
|
10527 | oldTreeData = _states3.treeData,
|
10528 | defaultExpandAll = _states3.defaultExpandAll,
|
10529 | expandRowKeys = _states3.expandRowKeys,
|
10530 | lazy = _states3.lazy;
|
10531 |
|
10532 | var rootLazyRowKeys = [];
|
10533 | var getExpanded = function getExpanded(oldValue, key) {
|
10534 | var included = defaultExpandAll || expandRowKeys && expandRowKeys.indexOf(key) !== -1;
|
10535 | return !!(oldValue && oldValue.expanded || included);
|
10536 | };
|
10537 |
|
10538 | keys.forEach(function (key) {
|
10539 | var oldValue = oldTreeData[key];
|
10540 | var newValue = _extends({}, nested[key]);
|
10541 | newValue.expanded = getExpanded(oldValue, key);
|
10542 | if (newValue.lazy) {
|
10543 | var _ref = oldValue || {},
|
10544 | _ref$loaded = _ref.loaded,
|
10545 | loaded = _ref$loaded === undefined ? false : _ref$loaded,
|
10546 | _ref$loading = _ref.loading,
|
10547 | loading = _ref$loading === undefined ? false : _ref$loading;
|
10548 |
|
10549 | newValue.loaded = !!loaded;
|
10550 | newValue.loading = !!loading;
|
10551 | rootLazyRowKeys.push(key);
|
10552 | }
|
10553 | newTreeData[key] = newValue;
|
10554 | });
|
10555 |
|
10556 | var lazyKeys = Object.keys(normalizedLazyNode);
|
10557 | if (lazy && lazyKeys.length && rootLazyRowKeys.length) {
|
10558 | lazyKeys.forEach(function (key) {
|
10559 | var oldValue = oldTreeData[key];
|
10560 | var lazyNodeChildren = normalizedLazyNode[key].children;
|
10561 | if (rootLazyRowKeys.indexOf(key) !== -1) {
|
10562 |
|
10563 | if (newTreeData[key].children.length !== 0) {
|
10564 | throw new Error('[ElTable]children must be an empty array.');
|
10565 | }
|
10566 | newTreeData[key].children = lazyNodeChildren;
|
10567 | } else {
|
10568 | var _ref2 = oldValue || {},
|
10569 | _ref2$loaded = _ref2.loaded,
|
10570 | loaded = _ref2$loaded === undefined ? false : _ref2$loaded,
|
10571 | _ref2$loading = _ref2.loading,
|
10572 | loading = _ref2$loading === undefined ? false : _ref2$loading;
|
10573 |
|
10574 | newTreeData[key] = {
|
10575 | lazy: true,
|
10576 | loaded: !!loaded,
|
10577 | loading: !!loading,
|
10578 | expanded: getExpanded(oldValue, key),
|
10579 | children: lazyNodeChildren,
|
10580 | level: ''
|
10581 | };
|
10582 | }
|
10583 | });
|
10584 | }
|
10585 | }
|
10586 | this.states.treeData = newTreeData;
|
10587 | this.updateTableScrollY();
|
10588 | },
|
10589 | updateTreeExpandKeys: function updateTreeExpandKeys(value) {
|
10590 | this.states.expandRowKeys = value;
|
10591 | this.updateTreeData();
|
10592 | },
|
10593 | toggleTreeExpansion: function toggleTreeExpansion(row, expanded) {
|
10594 | this.assertRowKey();
|
10595 |
|
10596 | var _states4 = this.states,
|
10597 | rowKey = _states4.rowKey,
|
10598 | treeData = _states4.treeData;
|
10599 |
|
10600 | var id = getRowIdentity(row, rowKey);
|
10601 | var data = id && treeData[id];
|
10602 | if (id && data && 'expanded' in data) {
|
10603 | var oldExpanded = data.expanded;
|
10604 | expanded = typeof expanded === 'undefined' ? !data.expanded : expanded;
|
10605 | treeData[id].expanded = expanded;
|
10606 | if (oldExpanded !== expanded) {
|
10607 | this.table.$emit('expand-change', row, expanded);
|
10608 | }
|
10609 | this.updateTableScrollY();
|
10610 | }
|
10611 | },
|
10612 | loadOrToggle: function loadOrToggle(row) {
|
10613 | this.assertRowKey();
|
10614 | var _states5 = this.states,
|
10615 | lazy = _states5.lazy,
|
10616 | treeData = _states5.treeData,
|
10617 | rowKey = _states5.rowKey;
|
10618 |
|
10619 | var id = getRowIdentity(row, rowKey);
|
10620 | var data = treeData[id];
|
10621 | if (lazy && data && 'loaded' in data && !data.loaded) {
|
10622 | this.loadData(row, id, data);
|
10623 | } else {
|
10624 | this.toggleTreeExpansion(row);
|
10625 | }
|
10626 | },
|
10627 | loadData: function loadData(row, key, treeNode) {
|
10628 | var _this = this;
|
10629 |
|
10630 | var load = this.table.load;
|
10631 | var _states6 = this.states,
|
10632 | lazyTreeNodeMap = _states6.lazyTreeNodeMap,
|
10633 | treeData = _states6.treeData;
|
10634 |
|
10635 | if (load && !treeData[key].loaded) {
|
10636 | treeData[key].loading = true;
|
10637 | load(row, treeNode, function (data) {
|
10638 | if (!Array.isArray(data)) {
|
10639 | throw new Error('[ElTable] data must be an array');
|
10640 | }
|
10641 | treeData[key].loading = false;
|
10642 | treeData[key].loaded = true;
|
10643 | treeData[key].expanded = true;
|
10644 | if (data.length) {
|
10645 | _this.$set(lazyTreeNodeMap, key, data);
|
10646 | }
|
10647 | _this.table.$emit('expand-change', row, true);
|
10648 | });
|
10649 | }
|
10650 | }
|
10651 | }
|
10652 | });
|
10653 | // CONCATENATED MODULE: ./packages/table/src/store/watcher.js
|
10654 |
|
10655 |
|
10656 |
|
10657 |
|
10658 |
|
10659 |
|
10660 |
|
10661 | var watcher_sortData = function sortData(data, states) {
|
10662 | var sortingColumn = states.sortingColumn;
|
10663 | if (!sortingColumn || typeof sortingColumn.sortable === 'string') {
|
10664 | return data;
|
10665 | }
|
10666 | return util_orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
|
10667 | };
|
10668 |
|
10669 | var doFlattenColumns = function doFlattenColumns(columns) {
|
10670 | var result = [];
|
10671 | columns.forEach(function (column) {
|
10672 | if (column.children) {
|
10673 | result.push.apply(result, doFlattenColumns(column.children));
|
10674 | } else {
|
10675 | result.push(column);
|
10676 | }
|
10677 | });
|
10678 | return result;
|
10679 | };
|
10680 |
|
10681 | var watcher = (external_vue_default.a.extend({
|
10682 | data: function data() {
|
10683 | return {
|
10684 | states: {
|
10685 |
|
10686 | rowKey: null,
|
10687 |
|
10688 |
|
10689 | data: [],
|
10690 |
|
10691 |
|
10692 | isComplex: false,
|
10693 |
|
10694 |
|
10695 | _columns: [],
|
10696 | originColumns: [],
|
10697 | columns: [],
|
10698 | fixedColumns: [],
|
10699 | rightFixedColumns: [],
|
10700 | leafColumns: [],
|
10701 | fixedLeafColumns: [],
|
10702 | rightFixedLeafColumns: [],
|
10703 | leafColumnsLength: 0,
|
10704 | fixedLeafColumnsLength: 0,
|
10705 | rightFixedLeafColumnsLength: 0,
|
10706 |
|
10707 |
|
10708 | isAllSelected: false,
|
10709 | selection: [],
|
10710 | reserveSelection: false,
|
10711 | selectOnIndeterminate: false,
|
10712 | selectable: null,
|
10713 |
|
10714 |
|
10715 | filters: {},
|
10716 | filteredData: null,
|
10717 |
|
10718 |
|
10719 | sortingColumn: null,
|
10720 | sortProp: null,
|
10721 | sortOrder: null,
|
10722 |
|
10723 | hoverRow: null
|
10724 | }
|
10725 | };
|
10726 | },
|
10727 |
|
10728 |
|
10729 | mixins: [expand, current, tree],
|
10730 |
|
10731 | methods: {
|
10732 |
|
10733 | assertRowKey: function assertRowKey() {
|
10734 | var rowKey = this.states.rowKey;
|
10735 | if (!rowKey) throw new Error('[ElTable] prop row-key is required');
|
10736 | },
|
10737 |
|
10738 |
|
10739 |
|
10740 | updateColumns: function updateColumns() {
|
10741 | var states = this.states;
|
10742 | var _columns = states._columns || [];
|
10743 | states.fixedColumns = _columns.filter(function (column) {
|
10744 | return column.fixed === true || column.fixed === 'left';
|
10745 | });
|
10746 | states.rightFixedColumns = _columns.filter(function (column) {
|
10747 | return column.fixed === 'right';
|
10748 | });
|
10749 |
|
10750 | if (states.fixedColumns.length > 0 && _columns[0] && _columns[0].type === 'selection' && !_columns[0].fixed) {
|
10751 | _columns[0].fixed = true;
|
10752 | states.fixedColumns.unshift(_columns[0]);
|
10753 | }
|
10754 |
|
10755 | var notFixedColumns = _columns.filter(function (column) {
|
10756 | return !column.fixed;
|
10757 | });
|
10758 | states.originColumns = [].concat(states.fixedColumns).concat(notFixedColumns).concat(states.rightFixedColumns);
|
10759 |
|
10760 | var leafColumns = doFlattenColumns(notFixedColumns);
|
10761 | var fixedLeafColumns = doFlattenColumns(states.fixedColumns);
|
10762 | var rightFixedLeafColumns = doFlattenColumns(states.rightFixedColumns);
|
10763 |
|
10764 | states.leafColumnsLength = leafColumns.length;
|
10765 | states.fixedLeafColumnsLength = fixedLeafColumns.length;
|
10766 | states.rightFixedLeafColumnsLength = rightFixedLeafColumns.length;
|
10767 |
|
10768 | states.columns = [].concat(fixedLeafColumns).concat(leafColumns).concat(rightFixedLeafColumns);
|
10769 | states.isComplex = states.fixedColumns.length > 0 || states.rightFixedColumns.length > 0;
|
10770 | },
|
10771 |
|
10772 |
|
10773 |
|
10774 | scheduleLayout: function scheduleLayout(needUpdateColumns) {
|
10775 | if (needUpdateColumns) {
|
10776 | this.updateColumns();
|
10777 | }
|
10778 | this.table.debouncedUpdateLayout();
|
10779 | },
|
10780 |
|
10781 |
|
10782 |
|
10783 | isSelected: function isSelected(row) {
|
10784 | var _states$selection = this.states.selection,
|
10785 | selection = _states$selection === undefined ? [] : _states$selection;
|
10786 |
|
10787 | return selection.indexOf(row) > -1;
|
10788 | },
|
10789 | clearSelection: function clearSelection() {
|
10790 | var states = this.states;
|
10791 | states.isAllSelected = false;
|
10792 | var oldSelection = states.selection;
|
10793 | if (oldSelection.length) {
|
10794 | states.selection = [];
|
10795 | this.table.$emit('selection-change', []);
|
10796 | }
|
10797 | },
|
10798 | cleanSelection: function cleanSelection() {
|
10799 | var states = this.states;
|
10800 | var data = states.data,
|
10801 | rowKey = states.rowKey,
|
10802 | selection = states.selection;
|
10803 |
|
10804 | var deleted = void 0;
|
10805 | if (rowKey) {
|
10806 | deleted = [];
|
10807 | var selectedMap = getKeysMap(selection, rowKey);
|
10808 | var dataMap = getKeysMap(data, rowKey);
|
10809 | for (var key in selectedMap) {
|
10810 | if (selectedMap.hasOwnProperty(key) && !dataMap[key]) {
|
10811 | deleted.push(selectedMap[key].row);
|
10812 | }
|
10813 | }
|
10814 | } else {
|
10815 | deleted = selection.filter(function (item) {
|
10816 | return data.indexOf(item) === -1;
|
10817 | });
|
10818 | }
|
10819 | if (deleted.length) {
|
10820 | var newSelection = selection.filter(function (item) {
|
10821 | return deleted.indexOf(item) === -1;
|
10822 | });
|
10823 | states.selection = newSelection;
|
10824 | this.table.$emit('selection-change', newSelection.slice());
|
10825 | }
|
10826 | },
|
10827 | toggleRowSelection: function toggleRowSelection(row, selected) {
|
10828 | var emitChange = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
10829 |
|
10830 | var changed = toggleRowStatus(this.states.selection, row, selected);
|
10831 | if (changed) {
|
10832 | var newSelection = (this.states.selection || []).slice();
|
10833 |
|
10834 | if (emitChange) {
|
10835 | this.table.$emit('select', newSelection, row);
|
10836 | }
|
10837 | this.table.$emit('selection-change', newSelection);
|
10838 | }
|
10839 | },
|
10840 | _toggleAllSelection: function _toggleAllSelection() {
|
10841 | var states = this.states;
|
10842 | var _states$data = states.data,
|
10843 | data = _states$data === undefined ? [] : _states$data,
|
10844 | selection = states.selection;
|
10845 |
|
10846 |
|
10847 |
|
10848 | var value = states.selectOnIndeterminate ? !states.isAllSelected : !(states.isAllSelected || selection.length);
|
10849 | states.isAllSelected = value;
|
10850 |
|
10851 | var selectionChanged = false;
|
10852 | data.forEach(function (row, index) {
|
10853 | if (states.selectable) {
|
10854 | if (states.selectable.call(null, row, index) && toggleRowStatus(selection, row, value)) {
|
10855 | selectionChanged = true;
|
10856 | }
|
10857 | } else {
|
10858 | if (toggleRowStatus(selection, row, value)) {
|
10859 | selectionChanged = true;
|
10860 | }
|
10861 | }
|
10862 | });
|
10863 |
|
10864 | if (selectionChanged) {
|
10865 | this.table.$emit('selection-change', selection ? selection.slice() : []);
|
10866 | }
|
10867 | this.table.$emit('select-all', selection);
|
10868 | },
|
10869 | updateSelectionByRowKey: function updateSelectionByRowKey() {
|
10870 | var states = this.states;
|
10871 | var selection = states.selection,
|
10872 | rowKey = states.rowKey,
|
10873 | data = states.data;
|
10874 |
|
10875 | var selectedMap = getKeysMap(selection, rowKey);
|
10876 | data.forEach(function (row) {
|
10877 | var rowId = getRowIdentity(row, rowKey);
|
10878 | var rowInfo = selectedMap[rowId];
|
10879 | if (rowInfo) {
|
10880 | selection[rowInfo.index] = row;
|
10881 | }
|
10882 | });
|
10883 | },
|
10884 | updateAllSelected: function updateAllSelected() {
|
10885 | var states = this.states;
|
10886 | var selection = states.selection,
|
10887 | rowKey = states.rowKey,
|
10888 | selectable = states.selectable;
|
10889 |
|
10890 |
|
10891 | var data = states.data || [];
|
10892 | if (data.length === 0) {
|
10893 | states.isAllSelected = false;
|
10894 | return;
|
10895 | }
|
10896 |
|
10897 | var selectedMap = void 0;
|
10898 | if (rowKey) {
|
10899 | selectedMap = getKeysMap(selection, rowKey);
|
10900 | }
|
10901 | var isSelected = function isSelected(row) {
|
10902 | if (selectedMap) {
|
10903 | return !!selectedMap[getRowIdentity(row, rowKey)];
|
10904 | } else {
|
10905 | return selection.indexOf(row) !== -1;
|
10906 | }
|
10907 | };
|
10908 | var isAllSelected = true;
|
10909 | var selectedCount = 0;
|
10910 | for (var i = 0, j = data.length; i < j; i++) {
|
10911 | var item = data[i];
|
10912 | var isRowSelectable = selectable && selectable.call(null, item, i);
|
10913 | if (!isSelected(item)) {
|
10914 | if (!selectable || isRowSelectable) {
|
10915 | isAllSelected = false;
|
10916 | break;
|
10917 | }
|
10918 | } else {
|
10919 | selectedCount++;
|
10920 | }
|
10921 | }
|
10922 |
|
10923 | if (selectedCount === 0) isAllSelected = false;
|
10924 | states.isAllSelected = isAllSelected;
|
10925 | },
|
10926 |
|
10927 |
|
10928 |
|
10929 | updateFilters: function updateFilters(columns, values) {
|
10930 | if (!Array.isArray(columns)) {
|
10931 | columns = [columns];
|
10932 | }
|
10933 | var states = this.states;
|
10934 | var filters = {};
|
10935 | columns.forEach(function (col) {
|
10936 | states.filters[col.id] = values;
|
10937 | filters[col.columnKey || col.id] = values;
|
10938 | });
|
10939 |
|
10940 | return filters;
|
10941 | },
|
10942 | updateSort: function updateSort(column, prop, order) {
|
10943 | if (this.states.sortingColumn && this.states.sortingColumn !== column) {
|
10944 | this.states.sortingColumn.order = null;
|
10945 | }
|
10946 | this.states.sortingColumn = column;
|
10947 | this.states.sortProp = prop;
|
10948 | this.states.sortOrder = order;
|
10949 | },
|
10950 | execFilter: function execFilter() {
|
10951 | var _this = this;
|
10952 |
|
10953 | var states = this.states;
|
10954 | var _data = states._data,
|
10955 | filters = states.filters;
|
10956 |
|
10957 | var data = _data;
|
10958 |
|
10959 | Object.keys(filters).forEach(function (columnId) {
|
10960 | var values = states.filters[columnId];
|
10961 | if (!values || values.length === 0) return;
|
10962 | var column = getColumnById(_this.states, columnId);
|
10963 | if (column && column.filterMethod) {
|
10964 | data = data.filter(function (row) {
|
10965 | return values.some(function (value) {
|
10966 | return column.filterMethod.call(null, value, row, column);
|
10967 | });
|
10968 | });
|
10969 | }
|
10970 | });
|
10971 |
|
10972 | states.filteredData = data;
|
10973 | },
|
10974 | execSort: function execSort() {
|
10975 | var states = this.states;
|
10976 | states.data = watcher_sortData(states.filteredData, states);
|
10977 | },
|
10978 |
|
10979 |
|
10980 |
|
10981 | execQuery: function execQuery(ignore) {
|
10982 | if (!(ignore && ignore.filter)) {
|
10983 | this.execFilter();
|
10984 | }
|
10985 | this.execSort();
|
10986 | },
|
10987 | clearFilter: function clearFilter(columnKeys) {
|
10988 | var states = this.states;
|
10989 | var _table$$refs = this.table.$refs,
|
10990 | tableHeader = _table$$refs.tableHeader,
|
10991 | fixedTableHeader = _table$$refs.fixedTableHeader,
|
10992 | rightFixedTableHeader = _table$$refs.rightFixedTableHeader;
|
10993 |
|
10994 |
|
10995 | var panels = {};
|
10996 | if (tableHeader) panels = merge_default()(panels, tableHeader.filterPanels);
|
10997 | if (fixedTableHeader) panels = merge_default()(panels, fixedTableHeader.filterPanels);
|
10998 | if (rightFixedTableHeader) panels = merge_default()(panels, rightFixedTableHeader.filterPanels);
|
10999 |
|
11000 | var keys = Object.keys(panels);
|
11001 | if (!keys.length) return;
|
11002 |
|
11003 | if (typeof columnKeys === 'string') {
|
11004 | columnKeys = [columnKeys];
|
11005 | }
|
11006 |
|
11007 | if (Array.isArray(columnKeys)) {
|
11008 | var columns = columnKeys.map(function (key) {
|
11009 | return getColumnByKey(states, key);
|
11010 | });
|
11011 | keys.forEach(function (key) {
|
11012 | var column = columns.find(function (col) {
|
11013 | return col.id === key;
|
11014 | });
|
11015 | if (column) {
|
11016 |
|
11017 | panels[key].filteredValue = [];
|
11018 | }
|
11019 | });
|
11020 | this.commit('filterChange', {
|
11021 | column: columns,
|
11022 | values: [],
|
11023 | silent: true,
|
11024 | multi: true
|
11025 | });
|
11026 | } else {
|
11027 | keys.forEach(function (key) {
|
11028 |
|
11029 | panels[key].filteredValue = [];
|
11030 | });
|
11031 |
|
11032 | states.filters = {};
|
11033 | this.commit('filterChange', {
|
11034 | column: {},
|
11035 | values: [],
|
11036 | silent: true
|
11037 | });
|
11038 | }
|
11039 | },
|
11040 | clearSort: function clearSort() {
|
11041 | var states = this.states;
|
11042 | if (!states.sortingColumn) return;
|
11043 |
|
11044 | this.updateSort(null, null, null);
|
11045 | this.commit('changeSortCondition', {
|
11046 | silent: true
|
11047 | });
|
11048 | },
|
11049 |
|
11050 |
|
11051 |
|
11052 | setExpandRowKeysAdapter: function setExpandRowKeysAdapter(val) {
|
11053 |
|
11054 | this.setExpandRowKeys(val);
|
11055 | this.updateTreeExpandKeys(val);
|
11056 | },
|
11057 |
|
11058 |
|
11059 |
|
11060 | toggleRowExpansionAdapter: function toggleRowExpansionAdapter(row, expanded) {
|
11061 | var hasExpandColumn = this.states.columns.some(function (_ref) {
|
11062 | var type = _ref.type;
|
11063 | return type === 'expand';
|
11064 | });
|
11065 | if (hasExpandColumn) {
|
11066 | this.toggleRowExpansion(row, expanded);
|
11067 | } else {
|
11068 | this.toggleTreeExpansion(row, expanded);
|
11069 | }
|
11070 | }
|
11071 | }
|
11072 | }));
|
11073 |
|
11074 |
|
11075 |
|
11076 |
|
11077 |
|
11078 | watcher.prototype.mutations = {
|
11079 | setData: function setData(states, data) {
|
11080 | var dataInstanceChanged = states._data !== data;
|
11081 | states._data = data;
|
11082 |
|
11083 | this.execQuery();
|
11084 |
|
11085 |
|
11086 | this.updateCurrentRowData();
|
11087 | this.updateExpandRows();
|
11088 | if (states.reserveSelection) {
|
11089 | this.assertRowKey();
|
11090 | this.updateSelectionByRowKey();
|
11091 | } else {
|
11092 | if (dataInstanceChanged) {
|
11093 | this.clearSelection();
|
11094 | } else {
|
11095 | this.cleanSelection();
|
11096 | }
|
11097 | }
|
11098 | this.updateAllSelected();
|
11099 |
|
11100 | this.updateTableScrollY();
|
11101 | },
|
11102 | insertColumn: function insertColumn(states, column, index, parent) {
|
11103 | var array = states._columns;
|
11104 | if (parent) {
|
11105 | array = parent.children;
|
11106 | if (!array) array = parent.children = [];
|
11107 | }
|
11108 |
|
11109 | if (typeof index !== 'undefined') {
|
11110 | array.splice(index, 0, column);
|
11111 | } else {
|
11112 | array.push(column);
|
11113 | }
|
11114 |
|
11115 | if (column.type === 'selection') {
|
11116 | states.selectable = column.selectable;
|
11117 | states.reserveSelection = column.reserveSelection;
|
11118 | }
|
11119 |
|
11120 | if (this.table.$ready) {
|
11121 | this.updateColumns();
|
11122 | this.scheduleLayout();
|
11123 | }
|
11124 | },
|
11125 | removeColumn: function removeColumn(states, column, parent) {
|
11126 | var array = states._columns;
|
11127 | if (parent) {
|
11128 | array = parent.children;
|
11129 | if (!array) array = parent.children = [];
|
11130 | }
|
11131 | if (array) {
|
11132 | array.splice(array.indexOf(column), 1);
|
11133 | }
|
11134 |
|
11135 | if (this.table.$ready) {
|
11136 | this.updateColumns();
|
11137 | this.scheduleLayout();
|
11138 | }
|
11139 | },
|
11140 | sort: function sort(states, options) {
|
11141 | var prop = options.prop,
|
11142 | order = options.order,
|
11143 | init = options.init;
|
11144 |
|
11145 | if (prop) {
|
11146 | var column = Object(util_["arrayFind"])(states.columns, function (column) {
|
11147 | return column.property === prop;
|
11148 | });
|
11149 | if (column) {
|
11150 | column.order = order;
|
11151 | this.updateSort(column, prop, order);
|
11152 | this.commit('changeSortCondition', { init: init });
|
11153 | }
|
11154 | }
|
11155 | },
|
11156 | changeSortCondition: function changeSortCondition(states, options) {
|
11157 |
|
11158 | var column = states.sortingColumn,
|
11159 | prop = states.sortProp,
|
11160 | order = states.sortOrder;
|
11161 |
|
11162 | if (order === null) {
|
11163 | states.sortingColumn = null;
|
11164 | states.sortProp = null;
|
11165 | }
|
11166 | var ingore = { filter: true };
|
11167 | this.execQuery(ingore);
|
11168 |
|
11169 | if (!options || !(options.silent || options.init)) {
|
11170 | this.table.$emit('sort-change', {
|
11171 | column: column,
|
11172 | prop: prop,
|
11173 | order: order
|
11174 | });
|
11175 | }
|
11176 |
|
11177 | this.updateTableScrollY();
|
11178 | },
|
11179 | filterChange: function filterChange(states, options) {
|
11180 | var column = options.column,
|
11181 | values = options.values,
|
11182 | silent = options.silent;
|
11183 |
|
11184 | var newFilters = this.updateFilters(column, values);
|
11185 |
|
11186 | this.execQuery();
|
11187 |
|
11188 | if (!silent) {
|
11189 | this.table.$emit('filter-change', newFilters);
|
11190 | }
|
11191 |
|
11192 | this.updateTableScrollY();
|
11193 | },
|
11194 | toggleAllSelection: function toggleAllSelection() {
|
11195 | this.toggleAllSelection();
|
11196 | },
|
11197 | rowSelectedChanged: function rowSelectedChanged(states, row) {
|
11198 | this.toggleRowSelection(row);
|
11199 | this.updateAllSelected();
|
11200 | },
|
11201 | setHoverRow: function setHoverRow(states, row) {
|
11202 | states.hoverRow = row;
|
11203 | },
|
11204 | setCurrentRow: function setCurrentRow(states, row) {
|
11205 | this.updateCurrentRow(row);
|
11206 | }
|
11207 | };
|
11208 |
|
11209 | watcher.prototype.commit = function (name) {
|
11210 | var mutations = this.mutations;
|
11211 | if (mutations[name]) {
|
11212 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
11213 | args[_key - 1] = arguments[_key];
|
11214 | }
|
11215 |
|
11216 | mutations[name].apply(this, [this.states].concat(args));
|
11217 | } else {
|
11218 | throw new Error('Action not found: ' + name);
|
11219 | }
|
11220 | };
|
11221 |
|
11222 | watcher.prototype.updateTableScrollY = function () {
|
11223 | external_vue_default.a.nextTick(this.table.updateScrollY);
|
11224 | };
|
11225 |
|
11226 | var src_store = (watcher);
|
11227 |
|
11228 |
|
11229 |
|
11230 |
|
11231 | function createStore(table) {
|
11232 | var initialState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
11233 |
|
11234 | if (!table) {
|
11235 | throw new Error('Table is required.');
|
11236 | }
|
11237 |
|
11238 | var store = new src_store();
|
11239 | store.table = table;
|
11240 |
|
11241 |
|
11242 | store.toggleAllSelection = debounce_default()(10, store._toggleAllSelection);
|
11243 | Object.keys(initialState).forEach(function (key) {
|
11244 | store.states[key] = initialState[key];
|
11245 | });
|
11246 | return store;
|
11247 | }
|
11248 |
|
11249 | function mapStates(mapper) {
|
11250 | var res = {};
|
11251 | Object.keys(mapper).forEach(function (key) {
|
11252 | var value = mapper[key];
|
11253 | var fn = void 0;
|
11254 | if (typeof value === 'string') {
|
11255 | fn = function fn() {
|
11256 | return this.store.states[value];
|
11257 | };
|
11258 | } else if (typeof value === 'function') {
|
11259 | fn = function fn() {
|
11260 | return value.call(this, this.store.states);
|
11261 | };
|
11262 | } else {
|
11263 | console.error('invalid value type');
|
11264 | }
|
11265 | if (fn) {
|
11266 | res[key] = fn;
|
11267 | }
|
11268 | });
|
11269 | return res;
|
11270 | };
|
11271 |
|
11272 | var scrollbar_width_ = __webpack_require__(31);
|
11273 | var scrollbar_width_default = __webpack_require__.n(scrollbar_width_);
|
11274 |
|
11275 |
|
11276 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
11277 |
|
11278 |
|
11279 |
|
11280 |
|
11281 |
|
11282 | var table_layout_TableLayout = function () {
|
11283 | function TableLayout(options) {
|
11284 | _classCallCheck(this, TableLayout);
|
11285 |
|
11286 | this.observers = [];
|
11287 | this.table = null;
|
11288 | this.store = null;
|
11289 | this.columns = null;
|
11290 | this.fit = true;
|
11291 | this.showHeader = true;
|
11292 |
|
11293 | this.height = null;
|
11294 | this.scrollX = false;
|
11295 | this.scrollY = false;
|
11296 | this.bodyWidth = null;
|
11297 | this.fixedWidth = null;
|
11298 | this.rightFixedWidth = null;
|
11299 | this.tableHeight = null;
|
11300 | this.headerHeight = 44;
|
11301 | this.appendHeight = 0;
|
11302 | this.footerHeight = 44;
|
11303 | this.viewportHeight = null;
|
11304 | this.bodyHeight = null;
|
11305 | this.fixedBodyHeight = null;
|
11306 | this.gutterWidth = scrollbar_width_default()();
|
11307 |
|
11308 | for (var name in options) {
|
11309 | if (options.hasOwnProperty(name)) {
|
11310 | this[name] = options[name];
|
11311 | }
|
11312 | }
|
11313 |
|
11314 | if (!this.table) {
|
11315 | throw new Error('table is required for Table Layout');
|
11316 | }
|
11317 | if (!this.store) {
|
11318 | throw new Error('store is required for Table Layout');
|
11319 | }
|
11320 | }
|
11321 |
|
11322 | TableLayout.prototype.updateScrollY = function updateScrollY() {
|
11323 | var height = this.height;
|
11324 | if (height === null) return false;
|
11325 | var bodyWrapper = this.table.bodyWrapper;
|
11326 | if (this.table.$el && bodyWrapper) {
|
11327 | var body = bodyWrapper.querySelector('.el-table__body');
|
11328 | var prevScrollY = this.scrollY;
|
11329 | var scrollY = body.offsetHeight > this.bodyHeight;
|
11330 | this.scrollY = scrollY;
|
11331 | return prevScrollY !== scrollY;
|
11332 | }
|
11333 | return false;
|
11334 | };
|
11335 |
|
11336 | TableLayout.prototype.setHeight = function setHeight(value) {
|
11337 | var _this = this;
|
11338 |
|
11339 | var prop = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'height';
|
11340 |
|
11341 | if (external_vue_default.a.prototype.$isServer) return;
|
11342 | var el = this.table.$el;
|
11343 | value = parseHeight(value);
|
11344 | this.height = value;
|
11345 |
|
11346 | if (!el && (value || value === 0)) return external_vue_default.a.nextTick(function () {
|
11347 | return _this.setHeight(value, prop);
|
11348 | });
|
11349 |
|
11350 | if (typeof value === 'number') {
|
11351 | el.style[prop] = value + 'px';
|
11352 | this.updateElsHeight();
|
11353 | } else if (typeof value === 'string') {
|
11354 | el.style[prop] = value;
|
11355 | this.updateElsHeight();
|
11356 | }
|
11357 | };
|
11358 |
|
11359 | TableLayout.prototype.setMaxHeight = function setMaxHeight(value) {
|
11360 | this.setHeight(value, 'max-height');
|
11361 | };
|
11362 |
|
11363 | TableLayout.prototype.getFlattenColumns = function getFlattenColumns() {
|
11364 | var flattenColumns = [];
|
11365 | var columns = this.table.columns;
|
11366 | columns.forEach(function (column) {
|
11367 | if (column.isColumnGroup) {
|
11368 | flattenColumns.push.apply(flattenColumns, column.columns);
|
11369 | } else {
|
11370 | flattenColumns.push(column);
|
11371 | }
|
11372 | });
|
11373 |
|
11374 | return flattenColumns;
|
11375 | };
|
11376 |
|
11377 | TableLayout.prototype.updateElsHeight = function updateElsHeight() {
|
11378 | var _this2 = this;
|
11379 |
|
11380 | if (!this.table.$ready) return external_vue_default.a.nextTick(function () {
|
11381 | return _this2.updateElsHeight();
|
11382 | });
|
11383 | var _table$$refs = this.table.$refs,
|
11384 | headerWrapper = _table$$refs.headerWrapper,
|
11385 | appendWrapper = _table$$refs.appendWrapper,
|
11386 | footerWrapper = _table$$refs.footerWrapper;
|
11387 |
|
11388 | this.appendHeight = appendWrapper ? appendWrapper.offsetHeight : 0;
|
11389 |
|
11390 | if (this.showHeader && !headerWrapper) return;
|
11391 |
|
11392 |
|
11393 | var headerTrElm = headerWrapper ? headerWrapper.querySelector('.el-table__header tr') : null;
|
11394 | var noneHeader = this.headerDisplayNone(headerTrElm);
|
11395 |
|
11396 | var headerHeight = this.headerHeight = !this.showHeader ? 0 : headerWrapper.offsetHeight;
|
11397 | if (this.showHeader && !noneHeader && headerWrapper.offsetWidth > 0 && (this.table.columns || []).length > 0 && headerHeight < 2) {
|
11398 | return external_vue_default.a.nextTick(function () {
|
11399 | return _this2.updateElsHeight();
|
11400 | });
|
11401 | }
|
11402 | var tableHeight = this.tableHeight = this.table.$el.clientHeight;
|
11403 | var footerHeight = this.footerHeight = footerWrapper ? footerWrapper.offsetHeight : 0;
|
11404 | if (this.height !== null) {
|
11405 | this.bodyHeight = tableHeight - headerHeight - footerHeight + (footerWrapper ? 1 : 0);
|
11406 | }
|
11407 | this.fixedBodyHeight = this.scrollX ? this.bodyHeight - this.gutterWidth : this.bodyHeight;
|
11408 |
|
11409 | var noData = !(this.store.states.data && this.store.states.data.length);
|
11410 | this.viewportHeight = this.scrollX ? tableHeight - (noData ? 0 : this.gutterWidth) : tableHeight;
|
11411 |
|
11412 | this.updateScrollY();
|
11413 | this.notifyObservers('scrollable');
|
11414 | };
|
11415 |
|
11416 | TableLayout.prototype.headerDisplayNone = function headerDisplayNone(elm) {
|
11417 | if (!elm) return true;
|
11418 | var headerChild = elm;
|
11419 | while (headerChild.tagName !== 'DIV') {
|
11420 | if (getComputedStyle(headerChild).display === 'none') {
|
11421 | return true;
|
11422 | }
|
11423 | headerChild = headerChild.parentElement;
|
11424 | }
|
11425 | return false;
|
11426 | };
|
11427 |
|
11428 | TableLayout.prototype.updateColumnsWidth = function updateColumnsWidth() {
|
11429 | if (external_vue_default.a.prototype.$isServer) return;
|
11430 | var fit = this.fit;
|
11431 | var bodyWidth = this.table.$el.clientWidth;
|
11432 | var bodyMinWidth = 0;
|
11433 |
|
11434 | var flattenColumns = this.getFlattenColumns();
|
11435 | var flexColumns = flattenColumns.filter(function (column) {
|
11436 | return typeof column.width !== 'number';
|
11437 | });
|
11438 |
|
11439 | flattenColumns.forEach(function (column) {
|
11440 |
|
11441 | if (typeof column.width === 'number' && column.realWidth) column.realWidth = null;
|
11442 | });
|
11443 |
|
11444 | if (flexColumns.length > 0 && fit) {
|
11445 | flattenColumns.forEach(function (column) {
|
11446 | bodyMinWidth += column.width || column.minWidth || 80;
|
11447 | });
|
11448 |
|
11449 | var scrollYWidth = this.scrollY ? this.gutterWidth : 0;
|
11450 |
|
11451 | if (bodyMinWidth <= bodyWidth - scrollYWidth) {
|
11452 |
|
11453 | this.scrollX = false;
|
11454 |
|
11455 | var totalFlexWidth = bodyWidth - scrollYWidth - bodyMinWidth;
|
11456 |
|
11457 | if (flexColumns.length === 1) {
|
11458 | flexColumns[0].realWidth = (flexColumns[0].minWidth || 80) + totalFlexWidth;
|
11459 | } else {
|
11460 | var allColumnsWidth = flexColumns.reduce(function (prev, column) {
|
11461 | return prev + (column.minWidth || 80);
|
11462 | }, 0);
|
11463 | var flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
|
11464 | var noneFirstWidth = 0;
|
11465 |
|
11466 | flexColumns.forEach(function (column, index) {
|
11467 | if (index === 0) return;
|
11468 | var flexWidth = Math.floor((column.minWidth || 80) * flexWidthPerPixel);
|
11469 | noneFirstWidth += flexWidth;
|
11470 | column.realWidth = (column.minWidth || 80) + flexWidth;
|
11471 | });
|
11472 |
|
11473 | flexColumns[0].realWidth = (flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
|
11474 | }
|
11475 | } else {
|
11476 |
|
11477 | this.scrollX = true;
|
11478 | flexColumns.forEach(function (column) {
|
11479 | column.realWidth = column.minWidth;
|
11480 | });
|
11481 | }
|
11482 |
|
11483 | this.bodyWidth = Math.max(bodyMinWidth, bodyWidth);
|
11484 | this.table.resizeState.width = this.bodyWidth;
|
11485 | } else {
|
11486 | flattenColumns.forEach(function (column) {
|
11487 | if (!column.width && !column.minWidth) {
|
11488 | column.realWidth = 80;
|
11489 | } else {
|
11490 | column.realWidth = column.width || column.minWidth;
|
11491 | }
|
11492 |
|
11493 | bodyMinWidth += column.realWidth;
|
11494 | });
|
11495 | this.scrollX = bodyMinWidth > bodyWidth;
|
11496 |
|
11497 | this.bodyWidth = bodyMinWidth;
|
11498 | }
|
11499 |
|
11500 | var fixedColumns = this.store.states.fixedColumns;
|
11501 |
|
11502 | if (fixedColumns.length > 0) {
|
11503 | var fixedWidth = 0;
|
11504 | fixedColumns.forEach(function (column) {
|
11505 | fixedWidth += column.realWidth || column.width;
|
11506 | });
|
11507 |
|
11508 | this.fixedWidth = fixedWidth;
|
11509 | }
|
11510 |
|
11511 | var rightFixedColumns = this.store.states.rightFixedColumns;
|
11512 | if (rightFixedColumns.length > 0) {
|
11513 | var rightFixedWidth = 0;
|
11514 | rightFixedColumns.forEach(function (column) {
|
11515 | rightFixedWidth += column.realWidth || column.width;
|
11516 | });
|
11517 |
|
11518 | this.rightFixedWidth = rightFixedWidth;
|
11519 | }
|
11520 |
|
11521 | this.notifyObservers('columns');
|
11522 | };
|
11523 |
|
11524 | TableLayout.prototype.addObserver = function addObserver(observer) {
|
11525 | this.observers.push(observer);
|
11526 | };
|
11527 |
|
11528 | TableLayout.prototype.removeObserver = function removeObserver(observer) {
|
11529 | var index = this.observers.indexOf(observer);
|
11530 | if (index !== -1) {
|
11531 | this.observers.splice(index, 1);
|
11532 | }
|
11533 | };
|
11534 |
|
11535 | TableLayout.prototype.notifyObservers = function notifyObservers(event) {
|
11536 | var _this3 = this;
|
11537 |
|
11538 | var observers = this.observers;
|
11539 | observers.forEach(function (observer) {
|
11540 | switch (event) {
|
11541 | case 'columns':
|
11542 | observer.onColumnsChange(_this3);
|
11543 | break;
|
11544 | case 'scrollable':
|
11545 | observer.onScrollableChange(_this3);
|
11546 | break;
|
11547 | default:
|
11548 | throw new Error('Table Layout don\'t have event ' + event + '.');
|
11549 | }
|
11550 | });
|
11551 | };
|
11552 |
|
11553 | return TableLayout;
|
11554 | }();
|
11555 |
|
11556 | var table_layout = (table_layout_TableLayout);
|
11557 |
|
11558 | var layout_observer = ({
|
11559 | created: function created() {
|
11560 | this.tableLayout.addObserver(this);
|
11561 | },
|
11562 | destroyed: function destroyed() {
|
11563 | this.tableLayout.removeObserver(this);
|
11564 | },
|
11565 |
|
11566 |
|
11567 | computed: {
|
11568 | tableLayout: function tableLayout() {
|
11569 | var layout = this.layout;
|
11570 | if (!layout && this.table) {
|
11571 | layout = this.table.layout;
|
11572 | }
|
11573 | if (!layout) {
|
11574 | throw new Error('Can not find table layout.');
|
11575 | }
|
11576 | return layout;
|
11577 | }
|
11578 | },
|
11579 |
|
11580 | mounted: function mounted() {
|
11581 | this.onColumnsChange(this.tableLayout);
|
11582 | this.onScrollableChange(this.tableLayout);
|
11583 | },
|
11584 | updated: function updated() {
|
11585 | if (this.__updated__) return;
|
11586 | this.onColumnsChange(this.tableLayout);
|
11587 | this.onScrollableChange(this.tableLayout);
|
11588 | this.__updated__ = true;
|
11589 | },
|
11590 |
|
11591 |
|
11592 | methods: {
|
11593 | onColumnsChange: function onColumnsChange(layout) {
|
11594 | var cols = this.$el.querySelectorAll('colgroup > col');
|
11595 | if (!cols.length) return;
|
11596 | var flattenColumns = layout.getFlattenColumns();
|
11597 | var columnsMap = {};
|
11598 | flattenColumns.forEach(function (column) {
|
11599 | columnsMap[column.id] = column;
|
11600 | });
|
11601 | for (var i = 0, j = cols.length; i < j; i++) {
|
11602 | var col = cols[i];
|
11603 | var name = col.getAttribute('name');
|
11604 | var column = columnsMap[name];
|
11605 | if (column) {
|
11606 | col.setAttribute('width', column.realWidth || column.width);
|
11607 | }
|
11608 | }
|
11609 | },
|
11610 | onScrollableChange: function onScrollableChange(layout) {
|
11611 | var cols = this.$el.querySelectorAll('colgroup > col[name=gutter]');
|
11612 | for (var i = 0, j = cols.length; i < j; i++) {
|
11613 | var col = cols[i];
|
11614 | col.setAttribute('width', layout.scrollY ? layout.gutterWidth : '0');
|
11615 | }
|
11616 | var ths = this.$el.querySelectorAll('th.gutter');
|
11617 | for (var _i = 0, _j = ths.length; _i < _j; _i++) {
|
11618 | var th = ths[_i];
|
11619 | th.style.width = layout.scrollY ? layout.gutterWidth + 'px' : '0';
|
11620 | th.style.display = layout.scrollY ? '' : 'none';
|
11621 | }
|
11622 | }
|
11623 | }
|
11624 | });
|
11625 |
|
11626 | var table_body_typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
11627 |
|
11628 | var table_body_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
11629 |
|
11630 |
|
11631 |
|
11632 |
|
11633 |
|
11634 |
|
11635 |
|
11636 |
|
11637 |
|
11638 |
|
11639 | var table_body = ({
|
11640 | name: 'ElTableBody',
|
11641 |
|
11642 | mixins: [layout_observer],
|
11643 |
|
11644 | components: {
|
11645 | ElCheckbox: checkbox_default.a,
|
11646 | ElTooltip: tooltip_default.a
|
11647 | },
|
11648 |
|
11649 | props: {
|
11650 | store: {
|
11651 | required: true
|
11652 | },
|
11653 | stripe: Boolean,
|
11654 | context: {},
|
11655 | rowClassName: [String, Function],
|
11656 | rowStyle: [Object, Function],
|
11657 | fixed: String,
|
11658 | highlight: Boolean
|
11659 | },
|
11660 |
|
11661 | render: function render(h) {
|
11662 | var _this = this;
|
11663 |
|
11664 | var data = this.data || [];
|
11665 | return h(
|
11666 | 'table',
|
11667 | {
|
11668 | 'class': 'el-table__body',
|
11669 | attrs: { cellspacing: '0',
|
11670 | cellpadding: '0',
|
11671 | border: '0' }
|
11672 | },
|
11673 | [h('colgroup', [this.columns.map(function (column) {
|
11674 | return h('col', {
|
11675 | attrs: { name: column.id },
|
11676 | key: column.id });
|
11677 | })]), h('tbody', [data.reduce(function (acc, row) {
|
11678 | return acc.concat(_this.wrappedRowRender(row, acc.length));
|
11679 | }, []), h('el-tooltip', {
|
11680 | attrs: { effect: this.table.tooltipEffect, placement: 'top', content: this.tooltipContent },
|
11681 | ref: 'tooltip' })])]
|
11682 | );
|
11683 | },
|
11684 |
|
11685 |
|
11686 | computed: table_body_extends({
|
11687 | table: function table() {
|
11688 | return this.$parent;
|
11689 | }
|
11690 | }, mapStates({
|
11691 | data: 'data',
|
11692 | columns: 'columns',
|
11693 | treeIndent: 'indent',
|
11694 | leftFixedLeafCount: 'fixedLeafColumnsLength',
|
11695 | rightFixedLeafCount: 'rightFixedLeafColumnsLength',
|
11696 | columnsCount: function columnsCount(states) {
|
11697 | return states.columns.length;
|
11698 | },
|
11699 | leftFixedCount: function leftFixedCount(states) {
|
11700 | return states.fixedColumns.length;
|
11701 | },
|
11702 | rightFixedCount: function rightFixedCount(states) {
|
11703 | return states.rightFixedColumns.length;
|
11704 | },
|
11705 | hasExpandColumn: function hasExpandColumn(states) {
|
11706 | return states.columns.some(function (_ref) {
|
11707 | var type = _ref.type;
|
11708 | return type === 'expand';
|
11709 | });
|
11710 | }
|
11711 | }), {
|
11712 | firstDefaultColumnIndex: function firstDefaultColumnIndex() {
|
11713 | return Object(util_["arrayFindIndex"])(this.columns, function (_ref2) {
|
11714 | var type = _ref2.type;
|
11715 | return type === 'default';
|
11716 | });
|
11717 | }
|
11718 | }),
|
11719 |
|
11720 | watch: {
|
11721 |
|
11722 |
|
11723 | 'store.states.hoverRow': function storeStatesHoverRow(newVal, oldVal) {
|
11724 | var _this2 = this;
|
11725 |
|
11726 | if (!this.store.states.isComplex || this.$isServer) return;
|
11727 | var raf = window.requestAnimationFrame;
|
11728 | if (!raf) {
|
11729 | raf = function raf(fn) {
|
11730 | return setTimeout(fn, 16);
|
11731 | };
|
11732 | }
|
11733 | raf(function () {
|
11734 | var rows = _this2.$el.querySelectorAll('.el-table__row');
|
11735 | var oldRow = rows[oldVal];
|
11736 | var newRow = rows[newVal];
|
11737 | if (oldRow) {
|
11738 | Object(dom_["removeClass"])(oldRow, 'hover-row');
|
11739 | }
|
11740 | if (newRow) {
|
11741 | Object(dom_["addClass"])(newRow, 'hover-row');
|
11742 | }
|
11743 | });
|
11744 | }
|
11745 | },
|
11746 |
|
11747 | data: function data() {
|
11748 | return {
|
11749 | tooltipContent: ''
|
11750 | };
|
11751 | },
|
11752 | created: function created() {
|
11753 | this.activateTooltip = debounce_default()(50, function (tooltip) {
|
11754 | return tooltip.handleShowPopper();
|
11755 | });
|
11756 | },
|
11757 |
|
11758 |
|
11759 | methods: {
|
11760 | getKeyOfRow: function getKeyOfRow(row, index) {
|
11761 | var rowKey = this.table.rowKey;
|
11762 | if (rowKey) {
|
11763 | return getRowIdentity(row, rowKey);
|
11764 | }
|
11765 | return index;
|
11766 | },
|
11767 | isColumnHidden: function isColumnHidden(index) {
|
11768 | if (this.fixed === true || this.fixed === 'left') {
|
11769 | return index >= this.leftFixedLeafCount;
|
11770 | } else if (this.fixed === 'right') {
|
11771 | return index < this.columnsCount - this.rightFixedLeafCount;
|
11772 | } else {
|
11773 | return index < this.leftFixedLeafCount || index >= this.columnsCount - this.rightFixedLeafCount;
|
11774 | }
|
11775 | },
|
11776 | getSpan: function getSpan(row, column, rowIndex, columnIndex) {
|
11777 | var rowspan = 1;
|
11778 | var colspan = 1;
|
11779 | var fn = this.table.spanMethod;
|
11780 | if (typeof fn === 'function') {
|
11781 | var result = fn({
|
11782 | row: row,
|
11783 | column: column,
|
11784 | rowIndex: rowIndex,
|
11785 | columnIndex: columnIndex
|
11786 | });
|
11787 | if (Array.isArray(result)) {
|
11788 | rowspan = result[0];
|
11789 | colspan = result[1];
|
11790 | } else if ((typeof result === 'undefined' ? 'undefined' : table_body_typeof(result)) === 'object') {
|
11791 | rowspan = result.rowspan;
|
11792 | colspan = result.colspan;
|
11793 | }
|
11794 | }
|
11795 | return { rowspan: rowspan, colspan: colspan };
|
11796 | },
|
11797 | getRowStyle: function getRowStyle(row, rowIndex) {
|
11798 | var rowStyle = this.table.rowStyle;
|
11799 | if (typeof rowStyle === 'function') {
|
11800 | return rowStyle.call(null, {
|
11801 | row: row,
|
11802 | rowIndex: rowIndex
|
11803 | });
|
11804 | }
|
11805 | return rowStyle || null;
|
11806 | },
|
11807 | getRowClass: function getRowClass(row, rowIndex) {
|
11808 | var classes = ['el-table__row'];
|
11809 | if (this.table.highlightCurrentRow && row === this.store.states.currentRow) {
|
11810 | classes.push('current-row');
|
11811 | }
|
11812 |
|
11813 | if (this.stripe && rowIndex % 2 === 1) {
|
11814 | classes.push('el-table__row--striped');
|
11815 | }
|
11816 | var rowClassName = this.table.rowClassName;
|
11817 | if (typeof rowClassName === 'string') {
|
11818 | classes.push(rowClassName);
|
11819 | } else if (typeof rowClassName === 'function') {
|
11820 | classes.push(rowClassName.call(null, {
|
11821 | row: row,
|
11822 | rowIndex: rowIndex
|
11823 | }));
|
11824 | }
|
11825 |
|
11826 | if (this.store.states.expandRows.indexOf(row) > -1) {
|
11827 | classes.push('expanded');
|
11828 | }
|
11829 |
|
11830 | return classes;
|
11831 | },
|
11832 | getCellStyle: function getCellStyle(rowIndex, columnIndex, row, column) {
|
11833 | var cellStyle = this.table.cellStyle;
|
11834 | if (typeof cellStyle === 'function') {
|
11835 | return cellStyle.call(null, {
|
11836 | rowIndex: rowIndex,
|
11837 | columnIndex: columnIndex,
|
11838 | row: row,
|
11839 | column: column
|
11840 | });
|
11841 | }
|
11842 | return cellStyle;
|
11843 | },
|
11844 | getCellClass: function getCellClass(rowIndex, columnIndex, row, column) {
|
11845 | var classes = [column.id, column.align, column.className];
|
11846 |
|
11847 | if (this.isColumnHidden(columnIndex)) {
|
11848 | classes.push('is-hidden');
|
11849 | }
|
11850 |
|
11851 | var cellClassName = this.table.cellClassName;
|
11852 | if (typeof cellClassName === 'string') {
|
11853 | classes.push(cellClassName);
|
11854 | } else if (typeof cellClassName === 'function') {
|
11855 | classes.push(cellClassName.call(null, {
|
11856 | rowIndex: rowIndex,
|
11857 | columnIndex: columnIndex,
|
11858 | row: row,
|
11859 | column: column
|
11860 | }));
|
11861 | }
|
11862 |
|
11863 | return classes.join(' ');
|
11864 | },
|
11865 | getColspanRealWidth: function getColspanRealWidth(columns, colspan, index) {
|
11866 | if (colspan < 1) {
|
11867 | return columns[index].realWidth;
|
11868 | }
|
11869 | var widthArr = columns.map(function (_ref3) {
|
11870 | var realWidth = _ref3.realWidth;
|
11871 | return realWidth;
|
11872 | }).slice(index, index + colspan);
|
11873 | return widthArr.reduce(function (acc, width) {
|
11874 | return acc + width;
|
11875 | }, -1);
|
11876 | },
|
11877 | handleCellMouseEnter: function handleCellMouseEnter(event, row) {
|
11878 | var table = this.table;
|
11879 | var cell = getCell(event);
|
11880 |
|
11881 | if (cell) {
|
11882 | var column = getColumnByCell(table, cell);
|
11883 | var hoverState = table.hoverState = { cell: cell, column: column, row: row };
|
11884 | table.$emit('cell-mouse-enter', hoverState.row, hoverState.column, hoverState.cell, event);
|
11885 | }
|
11886 |
|
11887 |
|
11888 | var cellChild = event.target.querySelector('.cell');
|
11889 | if (!(Object(dom_["hasClass"])(cellChild, 'el-tooltip') && cellChild.childNodes.length)) {
|
11890 | return;
|
11891 | }
|
11892 |
|
11893 |
|
11894 | var range = document.createRange();
|
11895 | range.setStart(cellChild, 0);
|
11896 | range.setEnd(cellChild, cellChild.childNodes.length);
|
11897 | var rangeWidth = range.getBoundingClientRect().width;
|
11898 | var padding = (parseInt(Object(dom_["getStyle"])(cellChild, 'paddingLeft'), 10) || 0) + (parseInt(Object(dom_["getStyle"])(cellChild, 'paddingRight'), 10) || 0);
|
11899 | if ((rangeWidth + padding > cellChild.offsetWidth || cellChild.scrollWidth > cellChild.offsetWidth) && this.$refs.tooltip) {
|
11900 | var tooltip = this.$refs.tooltip;
|
11901 |
|
11902 | this.tooltipContent = cell.innerText || cell.textContent;
|
11903 | tooltip.referenceElm = cell;
|
11904 | tooltip.$refs.popper && (tooltip.$refs.popper.style.display = 'none');
|
11905 | tooltip.doDestroy();
|
11906 | tooltip.setExpectedState(true);
|
11907 | this.activateTooltip(tooltip);
|
11908 | }
|
11909 | },
|
11910 | handleCellMouseLeave: function handleCellMouseLeave(event) {
|
11911 | var tooltip = this.$refs.tooltip;
|
11912 | if (tooltip) {
|
11913 | tooltip.setExpectedState(false);
|
11914 | tooltip.handleClosePopper();
|
11915 | }
|
11916 | var cell = getCell(event);
|
11917 | if (!cell) return;
|
11918 |
|
11919 | var oldHoverState = this.table.hoverState || {};
|
11920 | this.table.$emit('cell-mouse-leave', oldHoverState.row, oldHoverState.column, oldHoverState.cell, event);
|
11921 | },
|
11922 |
|
11923 |
|
11924 | handleMouseEnter: debounce_default()(30, function (index) {
|
11925 | this.store.commit('setHoverRow', index);
|
11926 | }),
|
11927 |
|
11928 | handleMouseLeave: debounce_default()(30, function () {
|
11929 | this.store.commit('setHoverRow', null);
|
11930 | }),
|
11931 |
|
11932 | handleContextMenu: function handleContextMenu(event, row) {
|
11933 | this.handleEvent(event, row, 'contextmenu');
|
11934 | },
|
11935 | handleDoubleClick: function handleDoubleClick(event, row) {
|
11936 | this.handleEvent(event, row, 'dblclick');
|
11937 | },
|
11938 | handleClick: function handleClick(event, row) {
|
11939 | this.store.commit('setCurrentRow', row);
|
11940 | this.handleEvent(event, row, 'click');
|
11941 | },
|
11942 | handleEvent: function handleEvent(event, row, name) {
|
11943 | var table = this.table;
|
11944 | var cell = getCell(event);
|
11945 | var column = void 0;
|
11946 | if (cell) {
|
11947 | column = getColumnByCell(table, cell);
|
11948 | if (column) {
|
11949 | table.$emit('cell-' + name, row, column, cell, event);
|
11950 | }
|
11951 | }
|
11952 | table.$emit('row-' + name, row, column, event);
|
11953 | },
|
11954 | rowRender: function rowRender(row, $index, treeRowData) {
|
11955 | var _this3 = this;
|
11956 |
|
11957 | var h = this.$createElement;
|
11958 | var treeIndent = this.treeIndent,
|
11959 | columns = this.columns,
|
11960 | firstDefaultColumnIndex = this.firstDefaultColumnIndex;
|
11961 |
|
11962 | var columnsHidden = columns.map(function (column, index) {
|
11963 | return _this3.isColumnHidden(index);
|
11964 | });
|
11965 | var rowClasses = this.getRowClass(row, $index);
|
11966 | var display = true;
|
11967 | if (treeRowData) {
|
11968 | rowClasses.push('el-table__row--level-' + treeRowData.level);
|
11969 | display = treeRowData.display;
|
11970 | }
|
11971 |
|
11972 |
|
11973 | var displayStyle = display ? null : {
|
11974 | display: 'none'
|
11975 | };
|
11976 | return h(
|
11977 | 'tr',
|
11978 | {
|
11979 | style: [displayStyle, this.getRowStyle(row, $index)],
|
11980 | 'class': rowClasses,
|
11981 | key: this.getKeyOfRow(row, $index),
|
11982 | on: {
|
11983 | 'dblclick': function dblclick($event) {
|
11984 | return _this3.handleDoubleClick($event, row);
|
11985 | },
|
11986 | 'click': function click($event) {
|
11987 | return _this3.handleClick($event, row);
|
11988 | },
|
11989 | 'contextmenu': function contextmenu($event) {
|
11990 | return _this3.handleContextMenu($event, row);
|
11991 | },
|
11992 | 'mouseenter': function mouseenter(_) {
|
11993 | return _this3.handleMouseEnter($index);
|
11994 | },
|
11995 | 'mouseleave': this.handleMouseLeave
|
11996 | }
|
11997 | },
|
11998 | [columns.map(function (column, cellIndex) {
|
11999 | var _getSpan = _this3.getSpan(row, column, $index, cellIndex),
|
12000 | rowspan = _getSpan.rowspan,
|
12001 | colspan = _getSpan.colspan;
|
12002 |
|
12003 | if (!rowspan || !colspan) {
|
12004 | return null;
|
12005 | }
|
12006 | var columnData = table_body_extends({}, column);
|
12007 | columnData.realWidth = _this3.getColspanRealWidth(columns, colspan, cellIndex);
|
12008 | var data = {
|
12009 | store: _this3.store,
|
12010 | _self: _this3.context || _this3.table.$vnode.context,
|
12011 | column: columnData,
|
12012 | row: row,
|
12013 | $index: $index
|
12014 | };
|
12015 | if (cellIndex === firstDefaultColumnIndex && treeRowData) {
|
12016 | data.treeNode = {
|
12017 | indent: treeRowData.level * treeIndent,
|
12018 | level: treeRowData.level
|
12019 | };
|
12020 | if (typeof treeRowData.expanded === 'boolean') {
|
12021 | data.treeNode.expanded = treeRowData.expanded;
|
12022 |
|
12023 | if ('loading' in treeRowData) {
|
12024 | data.treeNode.loading = treeRowData.loading;
|
12025 | }
|
12026 | if ('noLazyChildren' in treeRowData) {
|
12027 | data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
|
12028 | }
|
12029 | }
|
12030 | }
|
12031 | return h(
|
12032 | 'td',
|
12033 | {
|
12034 | style: _this3.getCellStyle($index, cellIndex, row, column),
|
12035 | 'class': _this3.getCellClass($index, cellIndex, row, column),
|
12036 | attrs: { rowspan: rowspan,
|
12037 | colspan: colspan
|
12038 | },
|
12039 | on: {
|
12040 | 'mouseenter': function mouseenter($event) {
|
12041 | return _this3.handleCellMouseEnter($event, row);
|
12042 | },
|
12043 | 'mouseleave': _this3.handleCellMouseLeave
|
12044 | }
|
12045 | },
|
12046 | [column.renderCell.call(_this3._renderProxy, _this3.$createElement, data, columnsHidden[cellIndex])]
|
12047 | );
|
12048 | })]
|
12049 | );
|
12050 | },
|
12051 | wrappedRowRender: function wrappedRowRender(row, $index) {
|
12052 | var _this4 = this;
|
12053 |
|
12054 | var h = this.$createElement;
|
12055 |
|
12056 | var store = this.store;
|
12057 | var isRowExpanded = store.isRowExpanded,
|
12058 | assertRowKey = store.assertRowKey;
|
12059 | var _store$states = store.states,
|
12060 | treeData = _store$states.treeData,
|
12061 | lazyTreeNodeMap = _store$states.lazyTreeNodeMap,
|
12062 | childrenColumnName = _store$states.childrenColumnName,
|
12063 | rowKey = _store$states.rowKey;
|
12064 |
|
12065 | if (this.hasExpandColumn && isRowExpanded(row)) {
|
12066 | var renderExpanded = this.table.renderExpanded;
|
12067 | var tr = this.rowRender(row, $index);
|
12068 | if (!renderExpanded) {
|
12069 | console.error('[Element Error]renderExpanded is required.');
|
12070 | return tr;
|
12071 | }
|
12072 |
|
12073 | return [[tr, h(
|
12074 | 'tr',
|
12075 | { key: 'expanded-row__' + tr.key },
|
12076 | [h(
|
12077 | 'td',
|
12078 | {
|
12079 | attrs: { colspan: this.columnsCount },
|
12080 | 'class': 'el-table__expanded-cell' },
|
12081 | [renderExpanded(this.$createElement, { row: row, $index: $index, store: this.store })]
|
12082 | )]
|
12083 | )]];
|
12084 | } else if (Object.keys(treeData).length) {
|
12085 | assertRowKey();
|
12086 |
|
12087 |
|
12088 | var key = getRowIdentity(row, rowKey);
|
12089 | var cur = treeData[key];
|
12090 | var treeRowData = null;
|
12091 | if (cur) {
|
12092 | treeRowData = {
|
12093 | expanded: cur.expanded,
|
12094 | level: cur.level,
|
12095 | display: true
|
12096 | };
|
12097 | if (typeof cur.lazy === 'boolean') {
|
12098 | if (typeof cur.loaded === 'boolean' && cur.loaded) {
|
12099 | treeRowData.noLazyChildren = !(cur.children && cur.children.length);
|
12100 | }
|
12101 | treeRowData.loading = cur.loading;
|
12102 | }
|
12103 | }
|
12104 | var tmp = [this.rowRender(row, $index, treeRowData)];
|
12105 |
|
12106 | if (cur) {
|
12107 |
|
12108 | var i = 0;
|
12109 | var traverse = function traverse(children, parent) {
|
12110 | if (!(children && children.length && parent)) return;
|
12111 | children.forEach(function (node) {
|
12112 |
|
12113 | var innerTreeRowData = {
|
12114 | display: parent.display && parent.expanded,
|
12115 | level: parent.level + 1
|
12116 | };
|
12117 | var childKey = getRowIdentity(node, rowKey);
|
12118 | if (childKey === undefined || childKey === null) {
|
12119 | throw new Error('for nested data item, row-key is required.');
|
12120 | }
|
12121 | cur = table_body_extends({}, treeData[childKey]);
|
12122 |
|
12123 |
|
12124 |
|
12125 | if (cur) {
|
12126 | innerTreeRowData.expanded = cur.expanded;
|
12127 |
|
12128 | cur.level = cur.level || innerTreeRowData.level;
|
12129 | cur.display = !!(cur.expanded && innerTreeRowData.display);
|
12130 | if (typeof cur.lazy === 'boolean') {
|
12131 | if (typeof cur.loaded === 'boolean' && cur.loaded) {
|
12132 | innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
|
12133 | }
|
12134 | innerTreeRowData.loading = cur.loading;
|
12135 | }
|
12136 | }
|
12137 | i++;
|
12138 | tmp.push(_this4.rowRender(node, $index + i, innerTreeRowData));
|
12139 | if (cur) {
|
12140 | var _nodes = lazyTreeNodeMap[childKey] || node[childrenColumnName];
|
12141 | traverse(_nodes, cur);
|
12142 | }
|
12143 | });
|
12144 | };
|
12145 |
|
12146 | cur.display = true;
|
12147 | var nodes = lazyTreeNodeMap[key] || row[childrenColumnName];
|
12148 | traverse(nodes, cur);
|
12149 | }
|
12150 | return tmp;
|
12151 | } else {
|
12152 | return this.rowRender(row, $index);
|
12153 | }
|
12154 | }
|
12155 | }
|
12156 | });
|
12157 |
|
12158 | var filter_panelvue_type_template_id_7f2c919f_render = function() {
|
12159 | var _vm = this
|
12160 | var _h = _vm.$createElement
|
12161 | var _c = _vm._self._c || _h
|
12162 | return _c("transition", { attrs: { name: "el-zoom-in-top" } }, [
|
12163 | _vm.multiple
|
12164 | ? _c(
|
12165 | "div",
|
12166 | {
|
12167 | directives: [
|
12168 | {
|
12169 | name: "clickoutside",
|
12170 | rawName: "v-clickoutside",
|
12171 | value: _vm.handleOutsideClick,
|
12172 | expression: "handleOutsideClick"
|
12173 | },
|
12174 | {
|
12175 | name: "show",
|
12176 | rawName: "v-show",
|
12177 | value: _vm.showPopper,
|
12178 | expression: "showPopper"
|
12179 | }
|
12180 | ],
|
12181 | staticClass: "el-table-filter"
|
12182 | },
|
12183 | [
|
12184 | _c(
|
12185 | "div",
|
12186 | { staticClass: "el-table-filter__content" },
|
12187 | [
|
12188 | _c(
|
12189 | "el-scrollbar",
|
12190 | { attrs: { "wrap-class": "el-table-filter__wrap" } },
|
12191 | [
|
12192 | _c(
|
12193 | "el-checkbox-group",
|
12194 | {
|
12195 | staticClass: "el-table-filter__checkbox-group",
|
12196 | model: {
|
12197 | value: _vm.filteredValue,
|
12198 | callback: function($$v) {
|
12199 | _vm.filteredValue = $$v
|
12200 | },
|
12201 | expression: "filteredValue"
|
12202 | }
|
12203 | },
|
12204 | _vm._l(_vm.filters, function(filter) {
|
12205 | return _c(
|
12206 | "el-checkbox",
|
12207 | { key: filter.value, attrs: { label: filter.value } },
|
12208 | [_vm._v(_vm._s(filter.text))]
|
12209 | )
|
12210 | }),
|
12211 | 1
|
12212 | )
|
12213 | ],
|
12214 | 1
|
12215 | )
|
12216 | ],
|
12217 | 1
|
12218 | ),
|
12219 | _c("div", { staticClass: "el-table-filter__bottom" }, [
|
12220 | _c(
|
12221 | "button",
|
12222 | {
|
12223 | class: { "is-disabled": _vm.filteredValue.length === 0 },
|
12224 | attrs: { disabled: _vm.filteredValue.length === 0 },
|
12225 | on: { click: _vm.handleConfirm }
|
12226 | },
|
12227 | [_vm._v(_vm._s(_vm.t("el.table.confirmFilter")))]
|
12228 | ),
|
12229 | _c("button", { on: { click: _vm.handleReset } }, [
|
12230 | _vm._v(_vm._s(_vm.t("el.table.resetFilter")))
|
12231 | ])
|
12232 | ])
|
12233 | ]
|
12234 | )
|
12235 | : _c(
|
12236 | "div",
|
12237 | {
|
12238 | directives: [
|
12239 | {
|
12240 | name: "clickoutside",
|
12241 | rawName: "v-clickoutside",
|
12242 | value: _vm.handleOutsideClick,
|
12243 | expression: "handleOutsideClick"
|
12244 | },
|
12245 | {
|
12246 | name: "show",
|
12247 | rawName: "v-show",
|
12248 | value: _vm.showPopper,
|
12249 | expression: "showPopper"
|
12250 | }
|
12251 | ],
|
12252 | staticClass: "el-table-filter"
|
12253 | },
|
12254 | [
|
12255 | _c(
|
12256 | "ul",
|
12257 | { staticClass: "el-table-filter__list" },
|
12258 | [
|
12259 | _c(
|
12260 | "li",
|
12261 | {
|
12262 | staticClass: "el-table-filter__list-item",
|
12263 | class: {
|
12264 | "is-active":
|
12265 | _vm.filterValue === undefined ||
|
12266 | _vm.filterValue === null
|
12267 | },
|
12268 | on: {
|
12269 | click: function($event) {
|
12270 | _vm.handleSelect(null)
|
12271 | }
|
12272 | }
|
12273 | },
|
12274 | [_vm._v(_vm._s(_vm.t("el.table.clearFilter")))]
|
12275 | ),
|
12276 | _vm._l(_vm.filters, function(filter) {
|
12277 | return _c(
|
12278 | "li",
|
12279 | {
|
12280 | key: filter.value,
|
12281 | staticClass: "el-table-filter__list-item",
|
12282 | class: { "is-active": _vm.isActive(filter) },
|
12283 | attrs: { label: filter.value },
|
12284 | on: {
|
12285 | click: function($event) {
|
12286 | _vm.handleSelect(filter.value)
|
12287 | }
|
12288 | }
|
12289 | },
|
12290 | [_vm._v(_vm._s(filter.text))]
|
12291 | )
|
12292 | })
|
12293 | ],
|
12294 | 2
|
12295 | )
|
12296 | ]
|
12297 | )
|
12298 | ])
|
12299 | }
|
12300 | var filter_panelvue_type_template_id_7f2c919f_staticRenderFns = []
|
12301 | filter_panelvue_type_template_id_7f2c919f_render._withStripped = true
|
12302 |
|
12303 |
|
12304 |
|
12305 |
|
12306 |
|
12307 |
|
12308 | var dropdowns = [];
|
12309 |
|
12310 | !external_vue_default.a.prototype.$isServer && document.addEventListener('click', function (event) {
|
12311 | dropdowns.forEach(function (dropdown) {
|
12312 | var target = event.target;
|
12313 | if (!dropdown || !dropdown.$el) return;
|
12314 | if (target === dropdown.$el || dropdown.$el.contains(target)) {
|
12315 | return;
|
12316 | }
|
12317 | dropdown.handleOutsideClick && dropdown.handleOutsideClick(event);
|
12318 | });
|
12319 | });
|
12320 |
|
12321 | var src_dropdown = ({
|
12322 | open: function open(instance) {
|
12323 | if (instance) {
|
12324 | dropdowns.push(instance);
|
12325 | }
|
12326 | },
|
12327 | close: function close(instance) {
|
12328 | var index = dropdowns.indexOf(instance);
|
12329 | if (index !== -1) {
|
12330 | dropdowns.splice(instance, 1);
|
12331 | }
|
12332 | }
|
12333 | });
|
12334 |
|
12335 | var checkbox_group_ = __webpack_require__(32);
|
12336 | var checkbox_group_default = __webpack_require__.n(checkbox_group_);
|
12337 |
|
12338 |
|
12339 |
|
12340 |
|
12341 |
|
12342 |
|
12343 |
|
12344 |
|
12345 |
|
12346 |
|
12347 |
|
12348 |
|
12349 |
|
12350 |
|
12351 |
|
12352 |
|
12353 |
|
12354 |
|
12355 |
|
12356 |
|
12357 |
|
12358 |
|
12359 |
|
12360 |
|
12361 |
|
12362 |
|
12363 |
|
12364 |
|
12365 |
|
12366 |
|
12367 |
|
12368 |
|
12369 |
|
12370 |
|
12371 |
|
12372 |
|
12373 |
|
12374 |
|
12375 |
|
12376 |
|
12377 |
|
12378 |
|
12379 |
|
12380 |
|
12381 |
|
12382 |
|
12383 |
|
12384 |
|
12385 |
|
12386 |
|
12387 |
|
12388 |
|
12389 |
|
12390 |
|
12391 |
|
12392 |
|
12393 | var filter_panelvue_type_script_lang_js_ = ({
|
12394 | name: 'ElTableFilterPanel',
|
12395 |
|
12396 | mixins: [vue_popper_default.a, locale_default.a],
|
12397 |
|
12398 | directives: {
|
12399 | Clickoutside: clickoutside_default.a
|
12400 | },
|
12401 |
|
12402 | components: {
|
12403 | ElCheckbox: checkbox_default.a,
|
12404 | ElCheckboxGroup: checkbox_group_default.a,
|
12405 | ElScrollbar: scrollbar_default.a
|
12406 | },
|
12407 |
|
12408 | props: {
|
12409 | placement: {
|
12410 | type: String,
|
12411 | default: 'bottom-end'
|
12412 | }
|
12413 | },
|
12414 |
|
12415 | methods: {
|
12416 | isActive: function isActive(filter) {
|
12417 | return filter.value === this.filterValue;
|
12418 | },
|
12419 | handleOutsideClick: function handleOutsideClick() {
|
12420 | var _this = this;
|
12421 |
|
12422 | setTimeout(function () {
|
12423 | _this.showPopper = false;
|
12424 | }, 16);
|
12425 | },
|
12426 | handleConfirm: function handleConfirm() {
|
12427 | this.confirmFilter(this.filteredValue);
|
12428 | this.handleOutsideClick();
|
12429 | },
|
12430 | handleReset: function handleReset() {
|
12431 | this.filteredValue = [];
|
12432 | this.confirmFilter(this.filteredValue);
|
12433 | this.handleOutsideClick();
|
12434 | },
|
12435 | handleSelect: function handleSelect(filterValue) {
|
12436 | this.filterValue = filterValue;
|
12437 |
|
12438 | if (typeof filterValue !== 'undefined' && filterValue !== null) {
|
12439 | this.confirmFilter(this.filteredValue);
|
12440 | } else {
|
12441 | this.confirmFilter([]);
|
12442 | }
|
12443 |
|
12444 | this.handleOutsideClick();
|
12445 | },
|
12446 | confirmFilter: function confirmFilter(filteredValue) {
|
12447 | this.table.store.commit('filterChange', {
|
12448 | column: this.column,
|
12449 | values: filteredValue
|
12450 | });
|
12451 | this.table.store.updateAllSelected();
|
12452 | }
|
12453 | },
|
12454 |
|
12455 | data: function data() {
|
12456 | return {
|
12457 | table: null,
|
12458 | cell: null,
|
12459 | column: null
|
12460 | };
|
12461 | },
|
12462 |
|
12463 |
|
12464 | computed: {
|
12465 | filters: function filters() {
|
12466 | return this.column && this.column.filters;
|
12467 | },
|
12468 |
|
12469 |
|
12470 | filterValue: {
|
12471 | get: function get() {
|
12472 | return (this.column.filteredValue || [])[0];
|
12473 | },
|
12474 | set: function set(value) {
|
12475 | if (this.filteredValue) {
|
12476 | if (typeof value !== 'undefined' && value !== null) {
|
12477 | this.filteredValue.splice(0, 1, value);
|
12478 | } else {
|
12479 | this.filteredValue.splice(0, 1);
|
12480 | }
|
12481 | }
|
12482 | }
|
12483 | },
|
12484 |
|
12485 | filteredValue: {
|
12486 | get: function get() {
|
12487 | if (this.column) {
|
12488 | return this.column.filteredValue || [];
|
12489 | }
|
12490 | return [];
|
12491 | },
|
12492 | set: function set(value) {
|
12493 | if (this.column) {
|
12494 | this.column.filteredValue = value;
|
12495 | }
|
12496 | }
|
12497 | },
|
12498 |
|
12499 | multiple: function multiple() {
|
12500 | if (this.column) {
|
12501 | return this.column.filterMultiple;
|
12502 | }
|
12503 | return true;
|
12504 | }
|
12505 | },
|
12506 |
|
12507 | mounted: function mounted() {
|
12508 | var _this2 = this;
|
12509 |
|
12510 | this.popperElm = this.$el;
|
12511 | this.referenceElm = this.cell;
|
12512 | this.table.bodyWrapper.addEventListener('scroll', function () {
|
12513 | _this2.updatePopper();
|
12514 | });
|
12515 |
|
12516 | this.$watch('showPopper', function (value) {
|
12517 | if (_this2.column) _this2.column.filterOpened = value;
|
12518 | if (value) {
|
12519 | src_dropdown.open(_this2);
|
12520 | } else {
|
12521 | src_dropdown.close(_this2);
|
12522 | }
|
12523 | });
|
12524 | },
|
12525 |
|
12526 | watch: {
|
12527 | showPopper: function showPopper(val) {
|
12528 | if (val === true && parseInt(this.popperJS._popper.style.zIndex, 10) < popup_["PopupManager"].zIndex) {
|
12529 | this.popperJS._popper.style.zIndex = popup_["PopupManager"].nextZIndex();
|
12530 | }
|
12531 | }
|
12532 | }
|
12533 | });
|
12534 |
|
12535 | var src_filter_panelvue_type_script_lang_js_ = (filter_panelvue_type_script_lang_js_);
|
12536 |
|
12537 |
|
12538 |
|
12539 |
|
12540 |
|
12541 |
|
12542 |
|
12543 |
|
12544 | var filter_panel_component = normalizeComponent(
|
12545 | src_filter_panelvue_type_script_lang_js_,
|
12546 | filter_panelvue_type_template_id_7f2c919f_render,
|
12547 | filter_panelvue_type_template_id_7f2c919f_staticRenderFns,
|
12548 | false,
|
12549 | null,
|
12550 | null,
|
12551 | null
|
12552 |
|
12553 | )
|
12554 |
|
12555 |
|
12556 | if (false) { var filter_panel_api; }
|
12557 | filter_panel_component.options.__file = "packages/table/src/filter-panel.vue"
|
12558 | var filter_panel = (filter_panel_component.exports);
|
12559 |
|
12560 | var table_header_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
12561 |
|
12562 |
|
12563 |
|
12564 |
|
12565 |
|
12566 |
|
12567 |
|
12568 |
|
12569 | var getAllColumns = function getAllColumns(columns) {
|
12570 | var result = [];
|
12571 | columns.forEach(function (column) {
|
12572 | if (column.children) {
|
12573 | result.push(column);
|
12574 | result.push.apply(result, getAllColumns(column.children));
|
12575 | } else {
|
12576 | result.push(column);
|
12577 | }
|
12578 | });
|
12579 | return result;
|
12580 | };
|
12581 |
|
12582 | var convertToRows = function convertToRows(originColumns) {
|
12583 | var maxLevel = 1;
|
12584 | var traverse = function traverse(column, parent) {
|
12585 | if (parent) {
|
12586 | column.level = parent.level + 1;
|
12587 | if (maxLevel < column.level) {
|
12588 | maxLevel = column.level;
|
12589 | }
|
12590 | }
|
12591 | if (column.children) {
|
12592 | var colSpan = 0;
|
12593 | column.children.forEach(function (subColumn) {
|
12594 | traverse(subColumn, column);
|
12595 | colSpan += subColumn.colSpan;
|
12596 | });
|
12597 | column.colSpan = colSpan;
|
12598 | } else {
|
12599 | column.colSpan = 1;
|
12600 | }
|
12601 | };
|
12602 |
|
12603 | originColumns.forEach(function (column) {
|
12604 | column.level = 1;
|
12605 | traverse(column);
|
12606 | });
|
12607 |
|
12608 | var rows = [];
|
12609 | for (var i = 0; i < maxLevel; i++) {
|
12610 | rows.push([]);
|
12611 | }
|
12612 |
|
12613 | var allColumns = getAllColumns(originColumns);
|
12614 |
|
12615 | allColumns.forEach(function (column) {
|
12616 | if (!column.children) {
|
12617 | column.rowSpan = maxLevel - column.level + 1;
|
12618 | } else {
|
12619 | column.rowSpan = 1;
|
12620 | }
|
12621 | rows[column.level - 1].push(column);
|
12622 | });
|
12623 |
|
12624 | return rows;
|
12625 | };
|
12626 |
|
12627 | var table_header = ({
|
12628 | name: 'ElTableHeader',
|
12629 |
|
12630 | mixins: [layout_observer],
|
12631 |
|
12632 | render: function render(h) {
|
12633 | var _this = this;
|
12634 |
|
12635 | var originColumns = this.store.states.originColumns;
|
12636 | var columnRows = convertToRows(originColumns, this.columns);
|
12637 |
|
12638 | var isGroup = columnRows.length > 1;
|
12639 | if (isGroup) this.$parent.isGroup = true;
|
12640 | return h(
|
12641 | 'table',
|
12642 | {
|
12643 | 'class': 'el-table__header',
|
12644 | attrs: { cellspacing: '0',
|
12645 | cellpadding: '0',
|
12646 | border: '0' }
|
12647 | },
|
12648 | [h('colgroup', [this.columns.map(function (column) {
|
12649 | return h('col', {
|
12650 | attrs: { name: column.id },
|
12651 | key: column.id });
|
12652 | }), this.hasGutter ? h('col', {
|
12653 | attrs: { name: 'gutter' }
|
12654 | }) : '']), h(
|
12655 | 'thead',
|
12656 | { 'class': [{ 'is-group': isGroup, 'has-gutter': this.hasGutter }] },
|
12657 | [this._l(columnRows, function (columns, rowIndex) {
|
12658 | return h(
|
12659 | 'tr',
|
12660 | {
|
12661 | style: _this.getHeaderRowStyle(rowIndex),
|
12662 | 'class': _this.getHeaderRowClass(rowIndex)
|
12663 | },
|
12664 | [columns.map(function (column, cellIndex) {
|
12665 | return h(
|
12666 | 'th',
|
12667 | {
|
12668 | attrs: {
|
12669 | colspan: column.colSpan,
|
12670 | rowspan: column.rowSpan
|
12671 | },
|
12672 | on: {
|
12673 | 'mousemove': function mousemove($event) {
|
12674 | return _this.handleMouseMove($event, column);
|
12675 | },
|
12676 | 'mouseout': _this.handleMouseOut,
|
12677 | 'mousedown': function mousedown($event) {
|
12678 | return _this.handleMouseDown($event, column);
|
12679 | },
|
12680 | 'click': function click($event) {
|
12681 | return _this.handleHeaderClick($event, column);
|
12682 | },
|
12683 | 'contextmenu': function contextmenu($event) {
|
12684 | return _this.handleHeaderContextMenu($event, column);
|
12685 | }
|
12686 | },
|
12687 |
|
12688 | style: _this.getHeaderCellStyle(rowIndex, cellIndex, columns, column),
|
12689 | 'class': _this.getHeaderCellClass(rowIndex, cellIndex, columns, column),
|
12690 | key: column.id },
|
12691 | [h(
|
12692 | 'div',
|
12693 | { 'class': ['cell', column.filteredValue && column.filteredValue.length > 0 ? 'highlight' : '', column.labelClassName] },
|
12694 | [column.renderHeader ? column.renderHeader.call(_this._renderProxy, h, { column: column, $index: cellIndex, store: _this.store, _self: _this.$parent.$vnode.context }) : column.label, column.sortable ? h(
|
12695 | 'span',
|
12696 | {
|
12697 | 'class': 'caret-wrapper',
|
12698 | on: {
|
12699 | 'click': function click($event) {
|
12700 | return _this.handleSortClick($event, column);
|
12701 | }
|
12702 | }
|
12703 | },
|
12704 | [h('i', { 'class': 'sort-caret ascending',
|
12705 | on: {
|
12706 | 'click': function click($event) {
|
12707 | return _this.handleSortClick($event, column, 'ascending');
|
12708 | }
|
12709 | }
|
12710 | }), h('i', { 'class': 'sort-caret descending',
|
12711 | on: {
|
12712 | 'click': function click($event) {
|
12713 | return _this.handleSortClick($event, column, 'descending');
|
12714 | }
|
12715 | }
|
12716 | })]
|
12717 | ) : '', column.filterable ? h(
|
12718 | 'span',
|
12719 | {
|
12720 | 'class': 'el-table__column-filter-trigger',
|
12721 | on: {
|
12722 | 'click': function click($event) {
|
12723 | return _this.handleFilterClick($event, column);
|
12724 | }
|
12725 | }
|
12726 | },
|
12727 | [h('i', { 'class': ['el-icon-arrow-down', column.filterOpened ? 'el-icon-arrow-up' : ''] })]
|
12728 | ) : '']
|
12729 | )]
|
12730 | );
|
12731 | }), _this.hasGutter ? h('th', { 'class': 'gutter' }) : '']
|
12732 | );
|
12733 | })]
|
12734 | )]
|
12735 | );
|
12736 | },
|
12737 |
|
12738 |
|
12739 | props: {
|
12740 | fixed: String,
|
12741 | store: {
|
12742 | required: true
|
12743 | },
|
12744 | border: Boolean,
|
12745 | defaultSort: {
|
12746 | type: Object,
|
12747 | default: function _default() {
|
12748 | return {
|
12749 | prop: '',
|
12750 | order: ''
|
12751 | };
|
12752 | }
|
12753 | }
|
12754 | },
|
12755 |
|
12756 | components: {
|
12757 | ElCheckbox: checkbox_default.a
|
12758 | },
|
12759 |
|
12760 | computed: table_header_extends({
|
12761 | table: function table() {
|
12762 | return this.$parent;
|
12763 | },
|
12764 | hasGutter: function hasGutter() {
|
12765 | return !this.fixed && this.tableLayout.gutterWidth;
|
12766 | }
|
12767 | }, mapStates({
|
12768 | columns: 'columns',
|
12769 | isAllSelected: 'isAllSelected',
|
12770 | leftFixedLeafCount: 'fixedLeafColumnsLength',
|
12771 | rightFixedLeafCount: 'rightFixedLeafColumnsLength',
|
12772 | columnsCount: function columnsCount(states) {
|
12773 | return states.columns.length;
|
12774 | },
|
12775 | leftFixedCount: function leftFixedCount(states) {
|
12776 | return states.fixedColumns.length;
|
12777 | },
|
12778 | rightFixedCount: function rightFixedCount(states) {
|
12779 | return states.rightFixedColumns.length;
|
12780 | }
|
12781 | })),
|
12782 |
|
12783 | created: function created() {
|
12784 | this.filterPanels = {};
|
12785 | },
|
12786 | mounted: function mounted() {
|
12787 | var _this2 = this;
|
12788 |
|
12789 |
|
12790 | this.$nextTick(function () {
|
12791 | var _defaultSort = _this2.defaultSort,
|
12792 | prop = _defaultSort.prop,
|
12793 | order = _defaultSort.order;
|
12794 |
|
12795 | var init = true;
|
12796 | _this2.store.commit('sort', { prop: prop, order: order, init: init });
|
12797 | });
|
12798 | },
|
12799 | beforeDestroy: function beforeDestroy() {
|
12800 | var panels = this.filterPanels;
|
12801 | for (var prop in panels) {
|
12802 | if (panels.hasOwnProperty(prop) && panels[prop]) {
|
12803 | panels[prop].$destroy(true);
|
12804 | }
|
12805 | }
|
12806 | },
|
12807 |
|
12808 |
|
12809 | methods: {
|
12810 | isCellHidden: function isCellHidden(index, columns) {
|
12811 | var start = 0;
|
12812 | for (var i = 0; i < index; i++) {
|
12813 | start += columns[i].colSpan;
|
12814 | }
|
12815 | var after = start + columns[index].colSpan - 1;
|
12816 | if (this.fixed === true || this.fixed === 'left') {
|
12817 | return after >= this.leftFixedLeafCount;
|
12818 | } else if (this.fixed === 'right') {
|
12819 | return start < this.columnsCount - this.rightFixedLeafCount;
|
12820 | } else {
|
12821 | return after < this.leftFixedLeafCount || start >= this.columnsCount - this.rightFixedLeafCount;
|
12822 | }
|
12823 | },
|
12824 | getHeaderRowStyle: function getHeaderRowStyle(rowIndex) {
|
12825 | var headerRowStyle = this.table.headerRowStyle;
|
12826 | if (typeof headerRowStyle === 'function') {
|
12827 | return headerRowStyle.call(null, { rowIndex: rowIndex });
|
12828 | }
|
12829 | return headerRowStyle;
|
12830 | },
|
12831 | getHeaderRowClass: function getHeaderRowClass(rowIndex) {
|
12832 | var classes = [];
|
12833 |
|
12834 | var headerRowClassName = this.table.headerRowClassName;
|
12835 | if (typeof headerRowClassName === 'string') {
|
12836 | classes.push(headerRowClassName);
|
12837 | } else if (typeof headerRowClassName === 'function') {
|
12838 | classes.push(headerRowClassName.call(null, { rowIndex: rowIndex }));
|
12839 | }
|
12840 |
|
12841 | return classes.join(' ');
|
12842 | },
|
12843 | getHeaderCellStyle: function getHeaderCellStyle(rowIndex, columnIndex, row, column) {
|
12844 | var headerCellStyle = this.table.headerCellStyle;
|
12845 | if (typeof headerCellStyle === 'function') {
|
12846 | return headerCellStyle.call(null, {
|
12847 | rowIndex: rowIndex,
|
12848 | columnIndex: columnIndex,
|
12849 | row: row,
|
12850 | column: column
|
12851 | });
|
12852 | }
|
12853 | return headerCellStyle;
|
12854 | },
|
12855 | getHeaderCellClass: function getHeaderCellClass(rowIndex, columnIndex, row, column) {
|
12856 | var classes = [column.id, column.order, column.headerAlign, column.className, column.labelClassName];
|
12857 |
|
12858 | if (rowIndex === 0 && this.isCellHidden(columnIndex, row)) {
|
12859 | classes.push('is-hidden');
|
12860 | }
|
12861 |
|
12862 | if (!column.children) {
|
12863 | classes.push('is-leaf');
|
12864 | }
|
12865 |
|
12866 | if (column.sortable) {
|
12867 | classes.push('is-sortable');
|
12868 | }
|
12869 |
|
12870 | var headerCellClassName = this.table.headerCellClassName;
|
12871 | if (typeof headerCellClassName === 'string') {
|
12872 | classes.push(headerCellClassName);
|
12873 | } else if (typeof headerCellClassName === 'function') {
|
12874 | classes.push(headerCellClassName.call(null, {
|
12875 | rowIndex: rowIndex,
|
12876 | columnIndex: columnIndex,
|
12877 | row: row,
|
12878 | column: column
|
12879 | }));
|
12880 | }
|
12881 |
|
12882 | return classes.join(' ');
|
12883 | },
|
12884 | toggleAllSelection: function toggleAllSelection(event) {
|
12885 | event.stopPropagation();
|
12886 | this.store.commit('toggleAllSelection');
|
12887 | },
|
12888 | handleFilterClick: function handleFilterClick(event, column) {
|
12889 | event.stopPropagation();
|
12890 | var target = event.target;
|
12891 | var cell = target.tagName === 'TH' ? target : target.parentNode;
|
12892 | if (Object(dom_["hasClass"])(cell, 'noclick')) return;
|
12893 | cell = cell.querySelector('.el-table__column-filter-trigger') || cell;
|
12894 | var table = this.$parent;
|
12895 |
|
12896 | var filterPanel = this.filterPanels[column.id];
|
12897 |
|
12898 | if (filterPanel && column.filterOpened) {
|
12899 | filterPanel.showPopper = false;
|
12900 | return;
|
12901 | }
|
12902 |
|
12903 | if (!filterPanel) {
|
12904 | filterPanel = new external_vue_default.a(filter_panel);
|
12905 | this.filterPanels[column.id] = filterPanel;
|
12906 | if (column.filterPlacement) {
|
12907 | filterPanel.placement = column.filterPlacement;
|
12908 | }
|
12909 | filterPanel.table = table;
|
12910 | filterPanel.cell = cell;
|
12911 | filterPanel.column = column;
|
12912 | !this.$isServer && filterPanel.$mount(document.createElement('div'));
|
12913 | }
|
12914 |
|
12915 | setTimeout(function () {
|
12916 | filterPanel.showPopper = true;
|
12917 | }, 16);
|
12918 | },
|
12919 | handleHeaderClick: function handleHeaderClick(event, column) {
|
12920 | if (!column.filters && column.sortable) {
|
12921 | this.handleSortClick(event, column);
|
12922 | } else if (column.filterable && !column.sortable) {
|
12923 | this.handleFilterClick(event, column);
|
12924 | }
|
12925 |
|
12926 | this.$parent.$emit('header-click', column, event);
|
12927 | },
|
12928 | handleHeaderContextMenu: function handleHeaderContextMenu(event, column) {
|
12929 | this.$parent.$emit('header-contextmenu', column, event);
|
12930 | },
|
12931 | handleMouseDown: function handleMouseDown(event, column) {
|
12932 | var _this3 = this;
|
12933 |
|
12934 | if (this.$isServer) return;
|
12935 | if (column.children && column.children.length > 0) return;
|
12936 |
|
12937 | if (this.draggingColumn && this.border) {
|
12938 | this.dragging = true;
|
12939 |
|
12940 | this.$parent.resizeProxyVisible = true;
|
12941 |
|
12942 | var table = this.$parent;
|
12943 | var tableEl = table.$el;
|
12944 | var tableLeft = tableEl.getBoundingClientRect().left;
|
12945 | var columnEl = this.$el.querySelector('th.' + column.id);
|
12946 | var columnRect = columnEl.getBoundingClientRect();
|
12947 | var minLeft = columnRect.left - tableLeft + 30;
|
12948 |
|
12949 | Object(dom_["addClass"])(columnEl, 'noclick');
|
12950 |
|
12951 | this.dragState = {
|
12952 | startMouseLeft: event.clientX,
|
12953 | startLeft: columnRect.right - tableLeft,
|
12954 | startColumnLeft: columnRect.left - tableLeft,
|
12955 | tableLeft: tableLeft
|
12956 | };
|
12957 |
|
12958 | var resizeProxy = table.$refs.resizeProxy;
|
12959 | resizeProxy.style.left = this.dragState.startLeft + 'px';
|
12960 |
|
12961 | document.onselectstart = function () {
|
12962 | return false;
|
12963 | };
|
12964 | document.ondragstart = function () {
|
12965 | return false;
|
12966 | };
|
12967 |
|
12968 | var handleMouseMove = function handleMouseMove(event) {
|
12969 | var deltaLeft = event.clientX - _this3.dragState.startMouseLeft;
|
12970 | var proxyLeft = _this3.dragState.startLeft + deltaLeft;
|
12971 |
|
12972 | resizeProxy.style.left = Math.max(minLeft, proxyLeft) + 'px';
|
12973 | };
|
12974 |
|
12975 | var handleMouseUp = function handleMouseUp() {
|
12976 | if (_this3.dragging) {
|
12977 | var _dragState = _this3.dragState,
|
12978 | startColumnLeft = _dragState.startColumnLeft,
|
12979 | startLeft = _dragState.startLeft;
|
12980 |
|
12981 | var finalLeft = parseInt(resizeProxy.style.left, 10);
|
12982 | var columnWidth = finalLeft - startColumnLeft;
|
12983 | column.width = column.realWidth = columnWidth;
|
12984 | table.$emit('header-dragend', column.width, startLeft - startColumnLeft, column, event);
|
12985 |
|
12986 | _this3.store.scheduleLayout();
|
12987 |
|
12988 | document.body.style.cursor = '';
|
12989 | _this3.dragging = false;
|
12990 | _this3.draggingColumn = null;
|
12991 | _this3.dragState = {};
|
12992 |
|
12993 | table.resizeProxyVisible = false;
|
12994 | }
|
12995 |
|
12996 | document.removeEventListener('mousemove', handleMouseMove);
|
12997 | document.removeEventListener('mouseup', handleMouseUp);
|
12998 | document.onselectstart = null;
|
12999 | document.ondragstart = null;
|
13000 |
|
13001 | setTimeout(function () {
|
13002 | Object(dom_["removeClass"])(columnEl, 'noclick');
|
13003 | }, 0);
|
13004 | };
|
13005 |
|
13006 | document.addEventListener('mousemove', handleMouseMove);
|
13007 | document.addEventListener('mouseup', handleMouseUp);
|
13008 | }
|
13009 | },
|
13010 | handleMouseMove: function handleMouseMove(event, column) {
|
13011 | if (column.children && column.children.length > 0) return;
|
13012 | var target = event.target;
|
13013 | while (target && target.tagName !== 'TH') {
|
13014 | target = target.parentNode;
|
13015 | }
|
13016 |
|
13017 | if (!column || !column.resizable) return;
|
13018 |
|
13019 | if (!this.dragging && this.border) {
|
13020 | var rect = target.getBoundingClientRect();
|
13021 |
|
13022 | var bodyStyle = document.body.style;
|
13023 | if (rect.width > 12 && rect.right - event.pageX < 8) {
|
13024 | bodyStyle.cursor = 'col-resize';
|
13025 | if (Object(dom_["hasClass"])(target, 'is-sortable')) {
|
13026 | target.style.cursor = 'col-resize';
|
13027 | }
|
13028 | this.draggingColumn = column;
|
13029 | } else if (!this.dragging) {
|
13030 | bodyStyle.cursor = '';
|
13031 | if (Object(dom_["hasClass"])(target, 'is-sortable')) {
|
13032 | target.style.cursor = 'pointer';
|
13033 | }
|
13034 | this.draggingColumn = null;
|
13035 | }
|
13036 | }
|
13037 | },
|
13038 | handleMouseOut: function handleMouseOut() {
|
13039 | if (this.$isServer) return;
|
13040 | document.body.style.cursor = '';
|
13041 | },
|
13042 | toggleOrder: function toggleOrder(_ref) {
|
13043 | var order = _ref.order,
|
13044 | sortOrders = _ref.sortOrders;
|
13045 |
|
13046 | if (order === '') return sortOrders[0];
|
13047 | var index = sortOrders.indexOf(order || null);
|
13048 | return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
|
13049 | },
|
13050 | handleSortClick: function handleSortClick(event, column, givenOrder) {
|
13051 | event.stopPropagation();
|
13052 | var order = column.order === givenOrder ? null : givenOrder || this.toggleOrder(column);
|
13053 |
|
13054 | var target = event.target;
|
13055 | while (target && target.tagName !== 'TH') {
|
13056 | target = target.parentNode;
|
13057 | }
|
13058 |
|
13059 | if (target && target.tagName === 'TH') {
|
13060 | if (Object(dom_["hasClass"])(target, 'noclick')) {
|
13061 | Object(dom_["removeClass"])(target, 'noclick');
|
13062 | return;
|
13063 | }
|
13064 | }
|
13065 |
|
13066 | if (!column.sortable) return;
|
13067 |
|
13068 | var states = this.store.states;
|
13069 | var sortProp = states.sortProp;
|
13070 | var sortOrder = void 0;
|
13071 | var sortingColumn = states.sortingColumn;
|
13072 |
|
13073 | if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
|
13074 | if (sortingColumn) {
|
13075 | sortingColumn.order = null;
|
13076 | }
|
13077 | states.sortingColumn = column;
|
13078 | sortProp = column.property;
|
13079 | }
|
13080 |
|
13081 | if (!order) {
|
13082 | sortOrder = column.order = null;
|
13083 | } else {
|
13084 | sortOrder = column.order = order;
|
13085 | }
|
13086 |
|
13087 | states.sortProp = sortProp;
|
13088 | states.sortOrder = sortOrder;
|
13089 |
|
13090 | this.store.commit('changeSortCondition');
|
13091 | }
|
13092 | },
|
13093 |
|
13094 | data: function data() {
|
13095 | return {
|
13096 | draggingColumn: null,
|
13097 | dragging: false,
|
13098 | dragState: {}
|
13099 | };
|
13100 | }
|
13101 | });
|
13102 |
|
13103 | var table_footer_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
13104 |
|
13105 |
|
13106 |
|
13107 |
|
13108 | var table_footer = ({
|
13109 | name: 'ElTableFooter',
|
13110 |
|
13111 | mixins: [layout_observer],
|
13112 |
|
13113 | render: function render(h) {
|
13114 | var _this = this;
|
13115 |
|
13116 | var sums = [];
|
13117 | if (this.summaryMethod) {
|
13118 | sums = this.summaryMethod({ columns: this.columns, data: this.store.states.data });
|
13119 | } else {
|
13120 | this.columns.forEach(function (column, index) {
|
13121 | if (index === 0) {
|
13122 | sums[index] = _this.sumText;
|
13123 | return;
|
13124 | }
|
13125 | var values = _this.store.states.data.map(function (item) {
|
13126 | return Number(item[column.property]);
|
13127 | });
|
13128 | var precisions = [];
|
13129 | var notNumber = true;
|
13130 | values.forEach(function (value) {
|
13131 | if (!isNaN(value)) {
|
13132 | notNumber = false;
|
13133 | var decimal = ('' + value).split('.')[1];
|
13134 | precisions.push(decimal ? decimal.length : 0);
|
13135 | }
|
13136 | });
|
13137 | var precision = Math.max.apply(null, precisions);
|
13138 | if (!notNumber) {
|
13139 | sums[index] = values.reduce(function (prev, curr) {
|
13140 | var value = Number(curr);
|
13141 | if (!isNaN(value)) {
|
13142 | return parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
|
13143 | } else {
|
13144 | return prev;
|
13145 | }
|
13146 | }, 0);
|
13147 | } else {
|
13148 | sums[index] = '';
|
13149 | }
|
13150 | });
|
13151 | }
|
13152 |
|
13153 | return h(
|
13154 | 'table',
|
13155 | {
|
13156 | 'class': 'el-table__footer',
|
13157 | attrs: { cellspacing: '0',
|
13158 | cellpadding: '0',
|
13159 | border: '0' }
|
13160 | },
|
13161 | [h('colgroup', [this.columns.map(function (column) {
|
13162 | return h('col', {
|
13163 | attrs: { name: column.id },
|
13164 | key: column.id });
|
13165 | }), this.hasGutter ? h('col', {
|
13166 | attrs: { name: 'gutter' }
|
13167 | }) : '']), h(
|
13168 | 'tbody',
|
13169 | { 'class': [{ 'has-gutter': this.hasGutter }] },
|
13170 | [h('tr', [this.columns.map(function (column, cellIndex) {
|
13171 | return h(
|
13172 | 'td',
|
13173 | {
|
13174 | key: cellIndex,
|
13175 | attrs: { colspan: column.colSpan,
|
13176 | rowspan: column.rowSpan
|
13177 | },
|
13178 | 'class': _this.getRowClasses(column, cellIndex) },
|
13179 | [h(
|
13180 | 'div',
|
13181 | { 'class': ['cell', column.labelClassName] },
|
13182 | [sums[cellIndex]]
|
13183 | )]
|
13184 | );
|
13185 | }), this.hasGutter ? h('th', { 'class': 'gutter' }) : ''])]
|
13186 | )]
|
13187 | );
|
13188 | },
|
13189 |
|
13190 |
|
13191 | props: {
|
13192 | fixed: String,
|
13193 | store: {
|
13194 | required: true
|
13195 | },
|
13196 | summaryMethod: Function,
|
13197 | sumText: String,
|
13198 | border: Boolean,
|
13199 | defaultSort: {
|
13200 | type: Object,
|
13201 | default: function _default() {
|
13202 | return {
|
13203 | prop: '',
|
13204 | order: ''
|
13205 | };
|
13206 | }
|
13207 | }
|
13208 | },
|
13209 |
|
13210 | computed: table_footer_extends({
|
13211 | table: function table() {
|
13212 | return this.$parent;
|
13213 | },
|
13214 | hasGutter: function hasGutter() {
|
13215 | return !this.fixed && this.tableLayout.gutterWidth;
|
13216 | }
|
13217 | }, mapStates({
|
13218 | columns: 'columns',
|
13219 | isAllSelected: 'isAllSelected',
|
13220 | leftFixedLeafCount: 'fixedLeafColumnsLength',
|
13221 | rightFixedLeafCount: 'rightFixedLeafColumnsLength',
|
13222 | columnsCount: function columnsCount(states) {
|
13223 | return states.columns.length;
|
13224 | },
|
13225 | leftFixedCount: function leftFixedCount(states) {
|
13226 | return states.fixedColumns.length;
|
13227 | },
|
13228 | rightFixedCount: function rightFixedCount(states) {
|
13229 | return states.rightFixedColumns.length;
|
13230 | }
|
13231 | })),
|
13232 |
|
13233 | methods: {
|
13234 | isCellHidden: function isCellHidden(index, columns, column) {
|
13235 | if (this.fixed === true || this.fixed === 'left') {
|
13236 | return index >= this.leftFixedLeafCount;
|
13237 | } else if (this.fixed === 'right') {
|
13238 | var before = 0;
|
13239 | for (var i = 0; i < index; i++) {
|
13240 | before += columns[i].colSpan;
|
13241 | }
|
13242 | return before < this.columnsCount - this.rightFixedLeafCount;
|
13243 | } else if (!this.fixed && column.fixed) {
|
13244 |
|
13245 | return true;
|
13246 | } else {
|
13247 | return index < this.leftFixedCount || index >= this.columnsCount - this.rightFixedCount;
|
13248 | }
|
13249 | },
|
13250 | getRowClasses: function getRowClasses(column, cellIndex) {
|
13251 | var classes = [column.id, column.align, column.labelClassName];
|
13252 | if (column.className) {
|
13253 | classes.push(column.className);
|
13254 | }
|
13255 | if (this.isCellHidden(cellIndex, this.columns, column)) {
|
13256 | classes.push('is-hidden');
|
13257 | }
|
13258 | if (!column.children) {
|
13259 | classes.push('is-leaf');
|
13260 | }
|
13261 | return classes;
|
13262 | }
|
13263 | }
|
13264 | });
|
13265 |
|
13266 | var tablevue_type_script_lang_js_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
13267 |
|
13268 |
|
13269 |
|
13270 |
|
13271 |
|
13272 |
|
13273 |
|
13274 |
|
13275 |
|
13276 |
|
13277 |
|
13278 |
|
13279 |
|
13280 |
|
13281 |
|
13282 |
|
13283 |
|
13284 |
|
13285 |
|
13286 |
|
13287 |
|
13288 |
|
13289 |
|
13290 |
|
13291 |
|
13292 |
|
13293 |
|
13294 |
|
13295 |
|
13296 |
|
13297 |
|
13298 |
|
13299 |
|
13300 |
|
13301 |
|
13302 |
|
13303 |
|
13304 |
|
13305 |
|
13306 |
|
13307 |
|
13308 |
|
13309 |
|
13310 |
|
13311 |
|
13312 |
|
13313 |
|
13314 |
|
13315 |
|
13316 |
|
13317 |
|
13318 |
|
13319 |
|
13320 |
|
13321 |
|
13322 |
|
13323 |
|
13324 |
|
13325 |
|
13326 |
|
13327 |
|
13328 |
|
13329 |
|
13330 |
|
13331 |
|
13332 |
|
13333 |
|
13334 |
|
13335 |
|
13336 |
|
13337 |
|
13338 |
|
13339 |
|
13340 |
|
13341 |
|
13342 |
|
13343 |
|
13344 |
|
13345 |
|
13346 |
|
13347 |
|
13348 |
|
13349 |
|
13350 |
|
13351 |
|
13352 |
|
13353 |
|
13354 |
|
13355 |
|
13356 |
|
13357 |
|
13358 |
|
13359 |
|
13360 |
|
13361 |
|
13362 |
|
13363 |
|
13364 |
|
13365 |
|
13366 |
|
13367 |
|
13368 |
|
13369 |
|
13370 |
|
13371 |
|
13372 |
|
13373 |
|
13374 |
|
13375 |
|
13376 |
|
13377 |
|
13378 |
|
13379 |
|
13380 |
|
13381 |
|
13382 |
|
13383 |
|
13384 |
|
13385 |
|
13386 |
|
13387 |
|
13388 |
|
13389 |
|
13390 |
|
13391 |
|
13392 |
|
13393 |
|
13394 |
|
13395 |
|
13396 |
|
13397 |
|
13398 |
|
13399 |
|
13400 |
|
13401 |
|
13402 |
|
13403 |
|
13404 |
|
13405 |
|
13406 |
|
13407 |
|
13408 |
|
13409 |
|
13410 |
|
13411 |
|
13412 |
|
13413 |
|
13414 |
|
13415 |
|
13416 |
|
13417 |
|
13418 |
|
13419 |
|
13420 |
|
13421 |
|
13422 |
|
13423 |
|
13424 |
|
13425 |
|
13426 |
|
13427 |
|
13428 |
|
13429 |
|
13430 |
|
13431 |
|
13432 |
|
13433 |
|
13434 |
|
13435 |
|
13436 |
|
13437 |
|
13438 |
|
13439 |
|
13440 |
|
13441 |
|
13442 |
|
13443 |
|
13444 |
|
13445 |
|
13446 |
|
13447 |
|
13448 |
|
13449 |
|
13450 |
|
13451 |
|
13452 |
|
13453 |
|
13454 |
|
13455 |
|
13456 |
|
13457 |
|
13458 |
|
13459 |
|
13460 |
|
13461 |
|
13462 |
|
13463 |
|
13464 |
|
13465 |
|
13466 |
|
13467 |
|
13468 |
|
13469 |
|
13470 |
|
13471 |
|
13472 |
|
13473 |
|
13474 |
|
13475 |
|
13476 |
|
13477 |
|
13478 |
|
13479 |
|
13480 |
|
13481 |
|
13482 |
|
13483 |
|
13484 |
|
13485 |
|
13486 |
|
13487 |
|
13488 |
|
13489 |
|
13490 |
|
13491 |
|
13492 |
|
13493 |
|
13494 |
|
13495 |
|
13496 | var tableIdSeed = 1;
|
13497 |
|
13498 | var tablevue_type_script_lang_js_ = ({
|
13499 | name: 'ElTable',
|
13500 |
|
13501 | mixins: [locale_default.a, migrating_default.a],
|
13502 |
|
13503 | directives: {
|
13504 | Mousewheel: directives_mousewheel
|
13505 | },
|
13506 |
|
13507 | props: {
|
13508 | data: {
|
13509 | type: Array,
|
13510 | default: function _default() {
|
13511 | return [];
|
13512 | }
|
13513 | },
|
13514 |
|
13515 | size: String,
|
13516 |
|
13517 | width: [String, Number],
|
13518 |
|
13519 | height: [String, Number],
|
13520 |
|
13521 | maxHeight: [String, Number],
|
13522 |
|
13523 | fit: {
|
13524 | type: Boolean,
|
13525 | default: true
|
13526 | },
|
13527 |
|
13528 | stripe: Boolean,
|
13529 |
|
13530 | border: Boolean,
|
13531 |
|
13532 | rowKey: [String, Function],
|
13533 |
|
13534 | context: {},
|
13535 |
|
13536 | showHeader: {
|
13537 | type: Boolean,
|
13538 | default: true
|
13539 | },
|
13540 |
|
13541 | showSummary: Boolean,
|
13542 |
|
13543 | sumText: String,
|
13544 |
|
13545 | summaryMethod: Function,
|
13546 |
|
13547 | rowClassName: [String, Function],
|
13548 |
|
13549 | rowStyle: [Object, Function],
|
13550 |
|
13551 | cellClassName: [String, Function],
|
13552 |
|
13553 | cellStyle: [Object, Function],
|
13554 |
|
13555 | headerRowClassName: [String, Function],
|
13556 |
|
13557 | headerRowStyle: [Object, Function],
|
13558 |
|
13559 | headerCellClassName: [String, Function],
|
13560 |
|
13561 | headerCellStyle: [Object, Function],
|
13562 |
|
13563 | highlightCurrentRow: Boolean,
|
13564 |
|
13565 | currentRowKey: [String, Number],
|
13566 |
|
13567 | emptyText: String,
|
13568 |
|
13569 | expandRowKeys: Array,
|
13570 |
|
13571 | defaultExpandAll: Boolean,
|
13572 |
|
13573 | defaultSort: Object,
|
13574 |
|
13575 | tooltipEffect: String,
|
13576 |
|
13577 | spanMethod: Function,
|
13578 |
|
13579 | selectOnIndeterminate: {
|
13580 | type: Boolean,
|
13581 | default: true
|
13582 | },
|
13583 |
|
13584 | indent: {
|
13585 | type: Number,
|
13586 | default: 16
|
13587 | },
|
13588 |
|
13589 | treeProps: {
|
13590 | type: Object,
|
13591 | default: function _default() {
|
13592 | return {
|
13593 | hasChildren: 'hasChildren',
|
13594 | children: 'children'
|
13595 | };
|
13596 | }
|
13597 | },
|
13598 |
|
13599 | lazy: Boolean,
|
13600 |
|
13601 | load: Function
|
13602 | },
|
13603 |
|
13604 | components: {
|
13605 | TableHeader: table_header,
|
13606 | TableFooter: table_footer,
|
13607 | TableBody: table_body,
|
13608 | ElCheckbox: checkbox_default.a
|
13609 | },
|
13610 |
|
13611 | methods: {
|
13612 | getMigratingConfig: function getMigratingConfig() {
|
13613 | return {
|
13614 | events: {
|
13615 | expand: 'expand is renamed to expand-change'
|
13616 | }
|
13617 | };
|
13618 | },
|
13619 | setCurrentRow: function setCurrentRow(row) {
|
13620 | this.store.commit('setCurrentRow', row);
|
13621 | },
|
13622 | toggleRowSelection: function toggleRowSelection(row, selected) {
|
13623 | this.store.toggleRowSelection(row, selected, false);
|
13624 | this.store.updateAllSelected();
|
13625 | },
|
13626 | toggleRowExpansion: function toggleRowExpansion(row, expanded) {
|
13627 | this.store.toggleRowExpansionAdapter(row, expanded);
|
13628 | },
|
13629 | clearSelection: function clearSelection() {
|
13630 | this.store.clearSelection();
|
13631 | },
|
13632 | clearFilter: function clearFilter(columnKeys) {
|
13633 | this.store.clearFilter(columnKeys);
|
13634 | },
|
13635 | clearSort: function clearSort() {
|
13636 | this.store.clearSort();
|
13637 | },
|
13638 | handleMouseLeave: function handleMouseLeave() {
|
13639 | this.store.commit('setHoverRow', null);
|
13640 | if (this.hoverState) this.hoverState = null;
|
13641 | },
|
13642 | updateScrollY: function updateScrollY() {
|
13643 | var changed = this.layout.updateScrollY();
|
13644 | if (changed) {
|
13645 | this.layout.notifyObservers('scrollable');
|
13646 | this.layout.updateColumnsWidth();
|
13647 | }
|
13648 | },
|
13649 | handleFixedMousewheel: function handleFixedMousewheel(event, data) {
|
13650 | var bodyWrapper = this.bodyWrapper;
|
13651 | if (Math.abs(data.spinY) > 0) {
|
13652 | var currentScrollTop = bodyWrapper.scrollTop;
|
13653 | if (data.pixelY < 0 && currentScrollTop !== 0) {
|
13654 | event.preventDefault();
|
13655 | }
|
13656 | if (data.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
|
13657 | event.preventDefault();
|
13658 | }
|
13659 | bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5);
|
13660 | } else {
|
13661 | bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5);
|
13662 | }
|
13663 | },
|
13664 | handleHeaderFooterMousewheel: function handleHeaderFooterMousewheel(event, data) {
|
13665 | var pixelX = data.pixelX,
|
13666 | pixelY = data.pixelY;
|
13667 |
|
13668 | if (Math.abs(pixelX) >= Math.abs(pixelY)) {
|
13669 | this.bodyWrapper.scrollLeft += data.pixelX / 5;
|
13670 | }
|
13671 | },
|
13672 |
|
13673 |
|
13674 |
|
13675 | syncPostion: Object(external_throttle_debounce_["throttle"])(20, function () {
|
13676 | var _bodyWrapper = this.bodyWrapper,
|
13677 | scrollLeft = _bodyWrapper.scrollLeft,
|
13678 | scrollTop = _bodyWrapper.scrollTop,
|
13679 | offsetWidth = _bodyWrapper.offsetWidth,
|
13680 | scrollWidth = _bodyWrapper.scrollWidth;
|
13681 | var _$refs = this.$refs,
|
13682 | headerWrapper = _$refs.headerWrapper,
|
13683 | footerWrapper = _$refs.footerWrapper,
|
13684 | fixedBodyWrapper = _$refs.fixedBodyWrapper,
|
13685 | rightFixedBodyWrapper = _$refs.rightFixedBodyWrapper;
|
13686 |
|
13687 | if (headerWrapper) headerWrapper.scrollLeft = scrollLeft;
|
13688 | if (footerWrapper) footerWrapper.scrollLeft = scrollLeft;
|
13689 | if (fixedBodyWrapper) fixedBodyWrapper.scrollTop = scrollTop;
|
13690 | if (rightFixedBodyWrapper) rightFixedBodyWrapper.scrollTop = scrollTop;
|
13691 | var maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
|
13692 | if (scrollLeft >= maxScrollLeftPosition) {
|
13693 | this.scrollPosition = 'right';
|
13694 | } else if (scrollLeft === 0) {
|
13695 | this.scrollPosition = 'left';
|
13696 | } else {
|
13697 | this.scrollPosition = 'middle';
|
13698 | }
|
13699 | }),
|
13700 |
|
13701 | bindEvents: function bindEvents() {
|
13702 | this.bodyWrapper.addEventListener('scroll', this.syncPostion, { passive: true });
|
13703 | if (this.fit) {
|
13704 | Object(resize_event_["addResizeListener"])(this.$el, this.resizeListener);
|
13705 | }
|
13706 | },
|
13707 | unbindEvents: function unbindEvents() {
|
13708 | this.bodyWrapper.removeEventListener('scroll', this.syncPostion, { passive: true });
|
13709 | if (this.fit) {
|
13710 | Object(resize_event_["removeResizeListener"])(this.$el, this.resizeListener);
|
13711 | }
|
13712 | },
|
13713 | resizeListener: function resizeListener() {
|
13714 | if (!this.$ready) return;
|
13715 | var shouldUpdateLayout = false;
|
13716 | var el = this.$el;
|
13717 | var _resizeState = this.resizeState,
|
13718 | oldWidth = _resizeState.width,
|
13719 | oldHeight = _resizeState.height;
|
13720 |
|
13721 |
|
13722 | var width = el.offsetWidth;
|
13723 | if (oldWidth !== width) {
|
13724 | shouldUpdateLayout = true;
|
13725 | }
|
13726 |
|
13727 | var height = el.offsetHeight;
|
13728 | if ((this.height || this.shouldUpdateHeight) && oldHeight !== height) {
|
13729 | shouldUpdateLayout = true;
|
13730 | }
|
13731 |
|
13732 | if (shouldUpdateLayout) {
|
13733 | this.resizeState.width = width;
|
13734 | this.resizeState.height = height;
|
13735 | this.doLayout();
|
13736 | }
|
13737 | },
|
13738 | doLayout: function doLayout() {
|
13739 | if (this.shouldUpdateHeight) {
|
13740 | this.layout.updateElsHeight();
|
13741 | }
|
13742 | this.layout.updateColumnsWidth();
|
13743 | },
|
13744 | sort: function sort(prop, order) {
|
13745 | this.store.commit('sort', { prop: prop, order: order });
|
13746 | },
|
13747 | toggleAllSelection: function toggleAllSelection() {
|
13748 | this.store.commit('toggleAllSelection');
|
13749 | }
|
13750 | },
|
13751 |
|
13752 | computed: tablevue_type_script_lang_js_extends({
|
13753 | tableSize: function tableSize() {
|
13754 | return this.size || (this.$ELEMENT || {}).size;
|
13755 | },
|
13756 | bodyWrapper: function bodyWrapper() {
|
13757 | return this.$refs.bodyWrapper;
|
13758 | },
|
13759 | shouldUpdateHeight: function shouldUpdateHeight() {
|
13760 | return this.height || this.maxHeight || this.fixedColumns.length > 0 || this.rightFixedColumns.length > 0;
|
13761 | },
|
13762 | bodyWidth: function bodyWidth() {
|
13763 | var _layout = this.layout,
|
13764 | bodyWidth = _layout.bodyWidth,
|
13765 | scrollY = _layout.scrollY,
|
13766 | gutterWidth = _layout.gutterWidth;
|
13767 |
|
13768 | return bodyWidth ? bodyWidth - (scrollY ? gutterWidth : 0) + 'px' : '';
|
13769 | },
|
13770 | bodyHeight: function bodyHeight() {
|
13771 | var _layout2 = this.layout,
|
13772 | _layout2$headerHeight = _layout2.headerHeight,
|
13773 | headerHeight = _layout2$headerHeight === undefined ? 0 : _layout2$headerHeight,
|
13774 | bodyHeight = _layout2.bodyHeight,
|
13775 | _layout2$footerHeight = _layout2.footerHeight,
|
13776 | footerHeight = _layout2$footerHeight === undefined ? 0 : _layout2$footerHeight;
|
13777 |
|
13778 | if (this.height) {
|
13779 | return {
|
13780 | height: bodyHeight ? bodyHeight + 'px' : ''
|
13781 | };
|
13782 | } else if (this.maxHeight) {
|
13783 | var maxHeight = parseHeight(this.maxHeight);
|
13784 | if (typeof maxHeight === 'number') {
|
13785 | return {
|
13786 | 'max-height': maxHeight - footerHeight - (this.showHeader ? headerHeight : 0) + 'px'
|
13787 | };
|
13788 | }
|
13789 | }
|
13790 | return {};
|
13791 | },
|
13792 | fixedBodyHeight: function fixedBodyHeight() {
|
13793 | if (this.height) {
|
13794 | return {
|
13795 | height: this.layout.fixedBodyHeight ? this.layout.fixedBodyHeight + 'px' : ''
|
13796 | };
|
13797 | } else if (this.maxHeight) {
|
13798 | var maxHeight = parseHeight(this.maxHeight);
|
13799 | if (typeof maxHeight === 'number') {
|
13800 | maxHeight = this.layout.scrollX ? maxHeight - this.layout.gutterWidth : maxHeight;
|
13801 | if (this.showHeader) {
|
13802 | maxHeight -= this.layout.headerHeight;
|
13803 | }
|
13804 | maxHeight -= this.layout.footerHeight;
|
13805 | return {
|
13806 | 'max-height': maxHeight + 'px'
|
13807 | };
|
13808 | }
|
13809 | }
|
13810 | return {};
|
13811 | },
|
13812 | fixedHeight: function fixedHeight() {
|
13813 | if (this.maxHeight) {
|
13814 | if (this.showSummary) {
|
13815 | return {
|
13816 | bottom: 0
|
13817 | };
|
13818 | }
|
13819 | return {
|
13820 | bottom: this.layout.scrollX && this.data.length ? this.layout.gutterWidth + 'px' : ''
|
13821 | };
|
13822 | } else {
|
13823 | if (this.showSummary) {
|
13824 | return {
|
13825 | height: this.layout.tableHeight ? this.layout.tableHeight + 'px' : ''
|
13826 | };
|
13827 | }
|
13828 | return {
|
13829 | height: this.layout.viewportHeight ? this.layout.viewportHeight + 'px' : ''
|
13830 | };
|
13831 | }
|
13832 | },
|
13833 | emptyBlockStyle: function emptyBlockStyle() {
|
13834 | if (this.data && this.data.length) return null;
|
13835 | var height = '100%';
|
13836 | if (this.layout.appendHeight) {
|
13837 | height = 'calc(100% - ' + this.layout.appendHeight + 'px)';
|
13838 | }
|
13839 | return {
|
13840 | width: this.bodyWidth,
|
13841 | height: height
|
13842 | };
|
13843 | }
|
13844 | }, mapStates({
|
13845 | selection: 'selection',
|
13846 | columns: 'columns',
|
13847 | tableData: 'data',
|
13848 | fixedColumns: 'fixedColumns',
|
13849 | rightFixedColumns: 'rightFixedColumns'
|
13850 | })),
|
13851 |
|
13852 | watch: {
|
13853 | height: {
|
13854 | immediate: true,
|
13855 | handler: function handler(value) {
|
13856 | this.layout.setHeight(value);
|
13857 | }
|
13858 | },
|
13859 |
|
13860 | maxHeight: {
|
13861 | immediate: true,
|
13862 | handler: function handler(value) {
|
13863 | this.layout.setMaxHeight(value);
|
13864 | }
|
13865 | },
|
13866 |
|
13867 | currentRowKey: {
|
13868 | immediate: true,
|
13869 | handler: function handler(value) {
|
13870 | if (!this.rowKey) return;
|
13871 | this.store.setCurrentRowKey(value);
|
13872 | }
|
13873 | },
|
13874 |
|
13875 | data: {
|
13876 | immediate: true,
|
13877 | handler: function handler(value) {
|
13878 | this.store.commit('setData', value);
|
13879 | }
|
13880 | },
|
13881 |
|
13882 | expandRowKeys: {
|
13883 | immediate: true,
|
13884 | handler: function handler(newVal) {
|
13885 | if (newVal) {
|
13886 | this.store.setExpandRowKeysAdapter(newVal);
|
13887 | }
|
13888 | }
|
13889 | }
|
13890 | },
|
13891 |
|
13892 | created: function created() {
|
13893 | var _this = this;
|
13894 |
|
13895 | this.tableId = 'el-table_' + tableIdSeed++;
|
13896 | this.debouncedUpdateLayout = Object(external_throttle_debounce_["debounce"])(50, function () {
|
13897 | return _this.doLayout();
|
13898 | });
|
13899 | },
|
13900 | mounted: function mounted() {
|
13901 | var _this2 = this;
|
13902 |
|
13903 | this.bindEvents();
|
13904 | this.store.updateColumns();
|
13905 | this.doLayout();
|
13906 |
|
13907 | this.resizeState = {
|
13908 | width: this.$el.offsetWidth,
|
13909 | height: this.$el.offsetHeight
|
13910 | };
|
13911 |
|
13912 |
|
13913 | this.store.states.columns.forEach(function (column) {
|
13914 | if (column.filteredValue && column.filteredValue.length) {
|
13915 | _this2.store.commit('filterChange', {
|
13916 | column: column,
|
13917 | values: column.filteredValue,
|
13918 | silent: true
|
13919 | });
|
13920 | }
|
13921 | });
|
13922 |
|
13923 | this.$ready = true;
|
13924 | },
|
13925 | destroyed: function destroyed() {
|
13926 | this.unbindEvents();
|
13927 | },
|
13928 | data: function data() {
|
13929 | var _treeProps = this.treeProps,
|
13930 | _treeProps$hasChildre = _treeProps.hasChildren,
|
13931 | hasChildren = _treeProps$hasChildre === undefined ? 'hasChildren' : _treeProps$hasChildre,
|
13932 | _treeProps$children = _treeProps.children,
|
13933 | children = _treeProps$children === undefined ? 'children' : _treeProps$children;
|
13934 |
|
13935 | this.store = createStore(this, {
|
13936 | rowKey: this.rowKey,
|
13937 | defaultExpandAll: this.defaultExpandAll,
|
13938 | selectOnIndeterminate: this.selectOnIndeterminate,
|
13939 |
|
13940 | indent: this.indent,
|
13941 | lazy: this.lazy,
|
13942 | lazyColumnIdentifier: hasChildren,
|
13943 | childrenColumnName: children
|
13944 | });
|
13945 | var layout = new table_layout({
|
13946 | store: this.store,
|
13947 | table: this,
|
13948 | fit: this.fit,
|
13949 | showHeader: this.showHeader
|
13950 | });
|
13951 | return {
|
13952 | layout: layout,
|
13953 | isHidden: false,
|
13954 | renderExpanded: null,
|
13955 | resizeProxyVisible: false,
|
13956 | resizeState: {
|
13957 | width: null,
|
13958 | height: null
|
13959 | },
|
13960 |
|
13961 | isGroup: false,
|
13962 | scrollPosition: 'left'
|
13963 | };
|
13964 | }
|
13965 | });
|
13966 |
|
13967 | var src_tablevue_type_script_lang_js_ = (tablevue_type_script_lang_js_);
|
13968 |
|
13969 |
|
13970 |
|
13971 |
|
13972 |
|
13973 |
|
13974 |
|
13975 |
|
13976 | var table_component = normalizeComponent(
|
13977 | src_tablevue_type_script_lang_js_,
|
13978 | tablevue_type_template_id_493fe34e_render,
|
13979 | tablevue_type_template_id_493fe34e_staticRenderFns,
|
13980 | false,
|
13981 | null,
|
13982 | null,
|
13983 | null
|
13984 |
|
13985 | )
|
13986 |
|
13987 |
|
13988 | if (false) { var table_api; }
|
13989 | table_component.options.__file = "packages/table/src/table.vue"
|
13990 | var src_table = (table_component.exports);
|
13991 |
|
13992 |
|
13993 |
|
13994 |
|
13995 | src_table.install = function (Vue) {
|
13996 | Vue.component(src_table.name, src_table);
|
13997 | };
|
13998 |
|
13999 | var packages_table = (src_table);
|
14000 |
|
14001 |
|
14002 |
|
14003 | var cellStarts = {
|
14004 | default: {
|
14005 | order: ''
|
14006 | },
|
14007 | selection: {
|
14008 | width: 48,
|
14009 | minWidth: 48,
|
14010 | realWidth: 48,
|
14011 | order: '',
|
14012 | className: 'el-table-column--selection'
|
14013 | },
|
14014 | expand: {
|
14015 | width: 48,
|
14016 | minWidth: 48,
|
14017 | realWidth: 48,
|
14018 | order: ''
|
14019 | },
|
14020 | index: {
|
14021 | width: 48,
|
14022 | minWidth: 48,
|
14023 | realWidth: 48,
|
14024 | order: ''
|
14025 | }
|
14026 | };
|
14027 |
|
14028 |
|
14029 | var cellForced = {
|
14030 | selection: {
|
14031 | renderHeader: function renderHeader(h, _ref) {
|
14032 | var store = _ref.store;
|
14033 |
|
14034 | return h('el-checkbox', {
|
14035 | attrs: {
|
14036 | disabled: store.states.data && store.states.data.length === 0,
|
14037 | indeterminate: store.states.selection.length > 0 && !this.isAllSelected,
|
14038 |
|
14039 | value: this.isAllSelected },
|
14040 | nativeOn: {
|
14041 | 'click': this.toggleAllSelection
|
14042 | }
|
14043 | });
|
14044 | },
|
14045 | renderCell: function renderCell(h, _ref2) {
|
14046 | var row = _ref2.row,
|
14047 | column = _ref2.column,
|
14048 | store = _ref2.store,
|
14049 | $index = _ref2.$index;
|
14050 |
|
14051 | return h('el-checkbox', {
|
14052 | nativeOn: {
|
14053 | 'click': function click(event) {
|
14054 | return event.stopPropagation();
|
14055 | }
|
14056 | },
|
14057 | attrs: {
|
14058 | value: store.isSelected(row),
|
14059 | disabled: column.selectable ? !column.selectable.call(null, row, $index) : false
|
14060 | },
|
14061 | on: {
|
14062 | 'input': function input() {
|
14063 | store.commit('rowSelectedChanged', row);
|
14064 | }
|
14065 | }
|
14066 | });
|
14067 | },
|
14068 | sortable: false,
|
14069 | resizable: false
|
14070 | },
|
14071 | index: {
|
14072 | renderHeader: function renderHeader(h, _ref3) {
|
14073 | var column = _ref3.column;
|
14074 |
|
14075 | return column.label || '#';
|
14076 | },
|
14077 | renderCell: function renderCell(h, _ref4) {
|
14078 | var $index = _ref4.$index,
|
14079 | column = _ref4.column;
|
14080 |
|
14081 | var i = $index + 1;
|
14082 | var index = column.index;
|
14083 |
|
14084 | if (typeof index === 'number') {
|
14085 | i = $index + index;
|
14086 | } else if (typeof index === 'function') {
|
14087 | i = index($index);
|
14088 | }
|
14089 |
|
14090 | return h('div', [i]);
|
14091 | },
|
14092 | sortable: false
|
14093 | },
|
14094 | expand: {
|
14095 | renderHeader: function renderHeader(h, _ref5) {
|
14096 | var column = _ref5.column;
|
14097 |
|
14098 | return column.label || '';
|
14099 | },
|
14100 | renderCell: function renderCell(h, _ref6) {
|
14101 | var row = _ref6.row,
|
14102 | store = _ref6.store;
|
14103 |
|
14104 | var classes = ['el-table__expand-icon'];
|
14105 | if (store.states.expandRows.indexOf(row) > -1) {
|
14106 | classes.push('el-table__expand-icon--expanded');
|
14107 | }
|
14108 | var callback = function callback(e) {
|
14109 | e.stopPropagation();
|
14110 | store.toggleRowExpansion(row);
|
14111 | };
|
14112 | return h(
|
14113 | 'div',
|
14114 | { 'class': classes,
|
14115 | on: {
|
14116 | 'click': callback
|
14117 | }
|
14118 | },
|
14119 | [h('i', { 'class': 'el-icon el-icon-arrow-right' })]
|
14120 | );
|
14121 | },
|
14122 | sortable: false,
|
14123 | resizable: false,
|
14124 | className: 'el-table__expand-column'
|
14125 | }
|
14126 | };
|
14127 |
|
14128 | function defaultRenderCell(h, _ref7) {
|
14129 | var row = _ref7.row,
|
14130 | column = _ref7.column,
|
14131 | $index = _ref7.$index;
|
14132 |
|
14133 | var property = column.property;
|
14134 | var value = property && Object(util_["getPropByPath"])(row, property).v;
|
14135 | if (column && column.formatter) {
|
14136 | return column.formatter(row, column, value, $index);
|
14137 | }
|
14138 | return value;
|
14139 | }
|
14140 |
|
14141 | function treeCellPrefix(h, _ref8) {
|
14142 | var row = _ref8.row,
|
14143 | treeNode = _ref8.treeNode,
|
14144 | store = _ref8.store;
|
14145 |
|
14146 | if (!treeNode) return null;
|
14147 | var ele = [];
|
14148 | var callback = function callback(e) {
|
14149 | e.stopPropagation();
|
14150 | store.loadOrToggle(row);
|
14151 | };
|
14152 | if (treeNode.indent) {
|
14153 | ele.push(h('span', { 'class': 'el-table__indent', style: { 'padding-left': treeNode.indent + 'px' } }));
|
14154 | }
|
14155 | if (typeof treeNode.expanded === 'boolean' && !treeNode.noLazyChildren) {
|
14156 | var expandClasses = ['el-table__expand-icon', treeNode.expanded ? 'el-table__expand-icon--expanded' : ''];
|
14157 | var iconClasses = ['el-icon-arrow-right'];
|
14158 | if (treeNode.loading) {
|
14159 | iconClasses = ['el-icon-loading'];
|
14160 | }
|
14161 | ele.push(h(
|
14162 | 'div',
|
14163 | { 'class': expandClasses,
|
14164 | on: {
|
14165 | 'click': callback
|
14166 | }
|
14167 | },
|
14168 | [h('i', { 'class': iconClasses })]
|
14169 | ));
|
14170 | } else {
|
14171 | ele.push(h('span', { 'class': 'el-table__placeholder' }));
|
14172 | }
|
14173 | return ele;
|
14174 | }
|
14175 |
|
14176 | var table_column_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
14177 |
|
14178 |
|
14179 |
|
14180 |
|
14181 |
|
14182 | var columnIdSeed = 1;
|
14183 |
|
14184 | var table_column = ({
|
14185 | name: 'ElTableColumn',
|
14186 |
|
14187 | props: {
|
14188 | type: {
|
14189 | type: String,
|
14190 | default: 'default'
|
14191 | },
|
14192 | label: String,
|
14193 | className: String,
|
14194 | labelClassName: String,
|
14195 | property: String,
|
14196 | prop: String,
|
14197 | width: {},
|
14198 | minWidth: {},
|
14199 | renderHeader: Function,
|
14200 | sortable: {
|
14201 | type: [Boolean, String],
|
14202 | default: false
|
14203 | },
|
14204 | sortMethod: Function,
|
14205 | sortBy: [String, Function, Array],
|
14206 | resizable: {
|
14207 | type: Boolean,
|
14208 | default: true
|
14209 | },
|
14210 | columnKey: String,
|
14211 | align: String,
|
14212 | headerAlign: String,
|
14213 | showTooltipWhenOverflow: Boolean,
|
14214 | showOverflowTooltip: Boolean,
|
14215 | fixed: [Boolean, String],
|
14216 | formatter: Function,
|
14217 | selectable: Function,
|
14218 | reserveSelection: Boolean,
|
14219 | filterMethod: Function,
|
14220 | filteredValue: Array,
|
14221 | filters: Array,
|
14222 | filterPlacement: String,
|
14223 | filterMultiple: {
|
14224 | type: Boolean,
|
14225 | default: true
|
14226 | },
|
14227 | index: [Number, Function],
|
14228 | sortOrders: {
|
14229 | type: Array,
|
14230 | default: function _default() {
|
14231 | return ['ascending', 'descending', null];
|
14232 | },
|
14233 | validator: function validator(val) {
|
14234 | return val.every(function (order) {
|
14235 | return ['ascending', 'descending', null].indexOf(order) > -1;
|
14236 | });
|
14237 | }
|
14238 | }
|
14239 | },
|
14240 |
|
14241 | data: function data() {
|
14242 | return {
|
14243 | isSubColumn: false,
|
14244 | columns: []
|
14245 | };
|
14246 | },
|
14247 |
|
14248 |
|
14249 | computed: {
|
14250 | owner: function owner() {
|
14251 | var parent = this.$parent;
|
14252 | while (parent && !parent.tableId) {
|
14253 | parent = parent.$parent;
|
14254 | }
|
14255 | return parent;
|
14256 | },
|
14257 | columnOrTableParent: function columnOrTableParent() {
|
14258 | var parent = this.$parent;
|
14259 | while (parent && !parent.tableId && !parent.columnId) {
|
14260 | parent = parent.$parent;
|
14261 | }
|
14262 | return parent;
|
14263 | },
|
14264 | realWidth: function realWidth() {
|
14265 | return parseWidth(this.width);
|
14266 | },
|
14267 | realMinWidth: function realMinWidth() {
|
14268 | return parseMinWidth(this.minWidth);
|
14269 | },
|
14270 | realAlign: function realAlign() {
|
14271 | return this.align ? 'is-' + this.align : null;
|
14272 | },
|
14273 | realHeaderAlign: function realHeaderAlign() {
|
14274 | return this.headerAlign ? 'is-' + this.headerAlign : this.realAlign;
|
14275 | }
|
14276 | },
|
14277 |
|
14278 | methods: {
|
14279 | getPropsData: function getPropsData() {
|
14280 | var _this = this;
|
14281 |
|
14282 | for (var _len = arguments.length, props = Array(_len), _key = 0; _key < _len; _key++) {
|
14283 | props[_key] = arguments[_key];
|
14284 | }
|
14285 |
|
14286 | return props.reduce(function (prev, cur) {
|
14287 | if (Array.isArray(cur)) {
|
14288 | cur.forEach(function (key) {
|
14289 | prev[key] = _this[key];
|
14290 | });
|
14291 | }
|
14292 | return prev;
|
14293 | }, {});
|
14294 | },
|
14295 | getColumnElIndex: function getColumnElIndex(children, child) {
|
14296 | return [].indexOf.call(children, child);
|
14297 | },
|
14298 | setColumnWidth: function setColumnWidth(column) {
|
14299 | if (this.realWidth) {
|
14300 | column.width = this.realWidth;
|
14301 | }
|
14302 | if (this.realMinWidth) {
|
14303 | column.minWidth = this.realMinWidth;
|
14304 | }
|
14305 | if (!column.minWidth) {
|
14306 | column.minWidth = 80;
|
14307 | }
|
14308 | column.realWidth = column.width === undefined ? column.minWidth : column.width;
|
14309 | return column;
|
14310 | },
|
14311 | setColumnForcedProps: function setColumnForcedProps(column) {
|
14312 |
|
14313 | var type = column.type;
|
14314 | var source = cellForced[type] || {};
|
14315 | Object.keys(source).forEach(function (prop) {
|
14316 | var value = source[prop];
|
14317 | if (value !== undefined) {
|
14318 | column[prop] = prop === 'className' ? column[prop] + ' ' + value : value;
|
14319 | }
|
14320 | });
|
14321 | return column;
|
14322 | },
|
14323 | setColumnRenders: function setColumnRenders(column) {
|
14324 | var _this2 = this;
|
14325 |
|
14326 | var h = this.$createElement;
|
14327 |
|
14328 |
|
14329 | if (this.renderHeader) {
|
14330 | console.warn('[Element Warn][TableColumn]Comparing to render-header, scoped-slot header is easier to use. We recommend users to use scoped-slot header.');
|
14331 | } else if (column.type !== 'selection') {
|
14332 | column.renderHeader = function (h, scope) {
|
14333 | var renderHeader = _this2.$scopedSlots.header;
|
14334 | return renderHeader ? renderHeader(scope) : column.label;
|
14335 | };
|
14336 | }
|
14337 |
|
14338 | var originRenderCell = column.renderCell;
|
14339 |
|
14340 | if (column.type === 'expand') {
|
14341 |
|
14342 | column.renderCell = function (h, data) {
|
14343 | return h(
|
14344 | 'div',
|
14345 | { 'class': 'cell' },
|
14346 | [originRenderCell(h, data)]
|
14347 | );
|
14348 | };
|
14349 | this.owner.renderExpanded = function (h, data) {
|
14350 | return _this2.$scopedSlots.default ? _this2.$scopedSlots.default(data) : _this2.$slots.default;
|
14351 | };
|
14352 | } else {
|
14353 | originRenderCell = originRenderCell || defaultRenderCell;
|
14354 |
|
14355 | column.renderCell = function (h, data) {
|
14356 | var children = null;
|
14357 | if (_this2.$scopedSlots.default) {
|
14358 | children = _this2.$scopedSlots.default(data);
|
14359 | } else {
|
14360 | children = originRenderCell(h, data);
|
14361 | }
|
14362 | var prefix = treeCellPrefix(h, data);
|
14363 | var props = {
|
14364 | class: 'cell',
|
14365 | style: {}
|
14366 | };
|
14367 | if (column.showOverflowTooltip) {
|
14368 | props.class += ' el-tooltip';
|
14369 | props.style = { width: (data.column.realWidth || data.column.width) - 1 + 'px' };
|
14370 | }
|
14371 | return h(
|
14372 | 'div',
|
14373 | props,
|
14374 | [prefix, children]
|
14375 | );
|
14376 | };
|
14377 | }
|
14378 | return column;
|
14379 | },
|
14380 | registerNormalWatchers: function registerNormalWatchers() {
|
14381 | var _this3 = this;
|
14382 |
|
14383 | var props = ['label', 'property', 'filters', 'filterMultiple', 'sortable', 'index', 'formatter', 'className', 'labelClassName', 'showOverflowTooltip'];
|
14384 |
|
14385 | var aliases = {
|
14386 | prop: 'property',
|
14387 | realAlign: 'align',
|
14388 | realHeaderAlign: 'headerAlign',
|
14389 | realWidth: 'width'
|
14390 | };
|
14391 | var allAliases = props.reduce(function (prev, cur) {
|
14392 | prev[cur] = cur;
|
14393 | return prev;
|
14394 | }, aliases);
|
14395 |
|
14396 | Object.keys(allAliases).forEach(function (key) {
|
14397 | var columnKey = aliases[key];
|
14398 |
|
14399 | _this3.$watch(key, function (newVal) {
|
14400 | _this3.columnConfig[columnKey] = newVal;
|
14401 | });
|
14402 | });
|
14403 | },
|
14404 | registerComplexWatchers: function registerComplexWatchers() {
|
14405 | var _this4 = this;
|
14406 |
|
14407 | var props = ['fixed'];
|
14408 | var aliases = {
|
14409 | realWidth: 'width',
|
14410 | realMinWidth: 'minWidth'
|
14411 | };
|
14412 | var allAliases = props.reduce(function (prev, cur) {
|
14413 | prev[cur] = cur;
|
14414 | return prev;
|
14415 | }, aliases);
|
14416 |
|
14417 | Object.keys(allAliases).forEach(function (key) {
|
14418 | var columnKey = aliases[key];
|
14419 |
|
14420 | _this4.$watch(key, function (newVal) {
|
14421 | _this4.columnConfig[columnKey] = newVal;
|
14422 | var updateColumns = columnKey === 'fixed';
|
14423 | _this4.owner.store.scheduleLayout(updateColumns);
|
14424 | });
|
14425 | });
|
14426 | }
|
14427 | },
|
14428 |
|
14429 | components: {
|
14430 | ElCheckbox: checkbox_default.a
|
14431 | },
|
14432 |
|
14433 | beforeCreate: function beforeCreate() {
|
14434 | this.row = {};
|
14435 | this.column = {};
|
14436 | this.$index = 0;
|
14437 | this.columnId = '';
|
14438 | },
|
14439 | created: function created() {
|
14440 | var parent = this.columnOrTableParent;
|
14441 | this.isSubColumn = this.owner !== parent;
|
14442 | this.columnId = (parent.tableId || parent.columnId) + '_column_' + columnIdSeed++;
|
14443 |
|
14444 | var type = this.type || 'default';
|
14445 | var sortable = this.sortable === '' ? true : this.sortable;
|
14446 | var defaults = table_column_extends({}, cellStarts[type], {
|
14447 | id: this.columnId,
|
14448 | type: type,
|
14449 | property: this.prop || this.property,
|
14450 | align: this.realAlign,
|
14451 | headerAlign: this.realHeaderAlign,
|
14452 | showOverflowTooltip: this.showOverflowTooltip || this.showTooltipWhenOverflow,
|
14453 |
|
14454 | filterable: this.filters || this.filterMethod,
|
14455 | filteredValue: [],
|
14456 | filterPlacement: '',
|
14457 | isColumnGroup: false,
|
14458 | filterOpened: false,
|
14459 |
|
14460 | sortable: sortable,
|
14461 |
|
14462 | index: this.index
|
14463 | });
|
14464 |
|
14465 | var basicProps = ['columnKey', 'label', 'className', 'labelClassName', 'type', 'renderHeader', 'formatter', 'fixed', 'resizable'];
|
14466 | var sortProps = ['sortMethod', 'sortBy', 'sortOrders'];
|
14467 | var selectProps = ['selectable', 'reserveSelection'];
|
14468 | var filterProps = ['filterMethod', 'filters', 'filterMultiple', 'filterOpened', 'filteredValue', 'filterPlacement'];
|
14469 |
|
14470 | var column = this.getPropsData(basicProps, sortProps, selectProps, filterProps);
|
14471 | column = mergeOptions(defaults, column);
|
14472 |
|
14473 |
|
14474 | var chains = compose(this.setColumnRenders, this.setColumnWidth, this.setColumnForcedProps);
|
14475 | column = chains(column);
|
14476 |
|
14477 | this.columnConfig = column;
|
14478 |
|
14479 |
|
14480 | this.registerNormalWatchers();
|
14481 | this.registerComplexWatchers();
|
14482 | },
|
14483 | mounted: function mounted() {
|
14484 | var owner = this.owner;
|
14485 | var parent = this.columnOrTableParent;
|
14486 | var children = this.isSubColumn ? parent.$el.children : parent.$refs.hiddenColumns.children;
|
14487 | var columnIndex = this.getColumnElIndex(children, this.$el);
|
14488 |
|
14489 | owner.store.commit('insertColumn', this.columnConfig, columnIndex, this.isSubColumn ? parent.columnConfig : null);
|
14490 | },
|
14491 | destroyed: function destroyed() {
|
14492 | if (!this.$parent) return;
|
14493 | var parent = this.$parent;
|
14494 | this.owner.store.commit('removeColumn', this.columnConfig, this.isSubColumn ? parent.columnConfig : null);
|
14495 | },
|
14496 | render: function render(h) {
|
14497 |
|
14498 | return h('div', this.$slots.default);
|
14499 | }
|
14500 | });
|
14501 |
|
14502 |
|
14503 |
|
14504 |
|
14505 | table_column.install = function (Vue) {
|
14506 | Vue.component(table_column.name, table_column);
|
14507 | };
|
14508 |
|
14509 | var packages_table_column = (table_column);
|
14510 |
|
14511 | var pickervue_type_template_id_79ae069f_render = function() {
|
14512 | var _vm = this
|
14513 | var _h = _vm.$createElement
|
14514 | var _c = _vm._self._c || _h
|
14515 | return !_vm.ranged
|
14516 | ? _c(
|
14517 | "el-input",
|
14518 | _vm._b(
|
14519 | {
|
14520 | directives: [
|
14521 | {
|
14522 | name: "clickoutside",
|
14523 | rawName: "v-clickoutside",
|
14524 | value: _vm.handleClose,
|
14525 | expression: "handleClose"
|
14526 | }
|
14527 | ],
|
14528 | ref: "reference",
|
14529 | staticClass: "el-date-editor",
|
14530 | class: "el-date-editor--" + _vm.type,
|
14531 | attrs: {
|
14532 | readonly:
|
14533 | !_vm.editable ||
|
14534 | _vm.readonly ||
|
14535 | _vm.type === "dates" ||
|
14536 | _vm.type === "week",
|
14537 | disabled: _vm.pickerDisabled,
|
14538 | size: _vm.pickerSize,
|
14539 | name: _vm.name,
|
14540 | placeholder: _vm.placeholder,
|
14541 | value: _vm.displayValue,
|
14542 | validateEvent: false
|
14543 | },
|
14544 | on: {
|
14545 | focus: _vm.handleFocus,
|
14546 | input: function(value) {
|
14547 | return (_vm.userInput = value)
|
14548 | },
|
14549 | change: _vm.handleChange
|
14550 | },
|
14551 | nativeOn: {
|
14552 | keydown: function($event) {
|
14553 | return _vm.handleKeydown($event)
|
14554 | },
|
14555 | mouseenter: function($event) {
|
14556 | return _vm.handleMouseEnter($event)
|
14557 | },
|
14558 | mouseleave: function($event) {
|
14559 | _vm.showClose = false
|
14560 | }
|
14561 | }
|
14562 | },
|
14563 | "el-input",
|
14564 | _vm.firstInputId,
|
14565 | false
|
14566 | ),
|
14567 | [
|
14568 | _c("i", {
|
14569 | staticClass: "el-input__icon",
|
14570 | class: _vm.triggerClass,
|
14571 | attrs: { slot: "prefix" },
|
14572 | on: { click: _vm.handleFocus },
|
14573 | slot: "prefix"
|
14574 | }),
|
14575 | _vm.haveTrigger
|
14576 | ? _c("i", {
|
14577 | staticClass: "el-input__icon",
|
14578 | class: [_vm.showClose ? "" + _vm.clearIcon : ""],
|
14579 | attrs: { slot: "suffix" },
|
14580 | on: { click: _vm.handleClickIcon },
|
14581 | slot: "suffix"
|
14582 | })
|
14583 | : _vm._e()
|
14584 | ]
|
14585 | )
|
14586 | : _c(
|
14587 | "div",
|
14588 | {
|
14589 | directives: [
|
14590 | {
|
14591 | name: "clickoutside",
|
14592 | rawName: "v-clickoutside",
|
14593 | value: _vm.handleClose,
|
14594 | expression: "handleClose"
|
14595 | }
|
14596 | ],
|
14597 | ref: "reference",
|
14598 | staticClass: "el-date-editor el-range-editor el-input__inner",
|
14599 | class: [
|
14600 | "el-date-editor--" + _vm.type,
|
14601 | _vm.pickerSize ? "el-range-editor--" + _vm.pickerSize : "",
|
14602 | _vm.pickerDisabled ? "is-disabled" : "",
|
14603 | _vm.pickerVisible ? "is-active" : ""
|
14604 | ],
|
14605 | on: {
|
14606 | click: _vm.handleRangeClick,
|
14607 | mouseenter: _vm.handleMouseEnter,
|
14608 | mouseleave: function($event) {
|
14609 | _vm.showClose = false
|
14610 | },
|
14611 | keydown: _vm.handleKeydown
|
14612 | }
|
14613 | },
|
14614 | [
|
14615 | _c("i", {
|
14616 | class: ["el-input__icon", "el-range__icon", _vm.triggerClass]
|
14617 | }),
|
14618 | _c(
|
14619 | "input",
|
14620 | _vm._b(
|
14621 | {
|
14622 | staticClass: "el-range-input",
|
14623 | attrs: {
|
14624 | autocomplete: "off",
|
14625 | placeholder: _vm.startPlaceholder,
|
14626 | disabled: _vm.pickerDisabled,
|
14627 | readonly: !_vm.editable || _vm.readonly,
|
14628 | name: _vm.name && _vm.name[0]
|
14629 | },
|
14630 | domProps: { value: _vm.displayValue && _vm.displayValue[0] },
|
14631 | on: {
|
14632 | input: _vm.handleStartInput,
|
14633 | change: _vm.handleStartChange,
|
14634 | focus: _vm.handleFocus
|
14635 | }
|
14636 | },
|
14637 | "input",
|
14638 | _vm.firstInputId,
|
14639 | false
|
14640 | )
|
14641 | ),
|
14642 | _vm._t("range-separator", [
|
14643 | _c("span", { staticClass: "el-range-separator" }, [
|
14644 | _vm._v(_vm._s(_vm.rangeSeparator))
|
14645 | ])
|
14646 | ]),
|
14647 | _c(
|
14648 | "input",
|
14649 | _vm._b(
|
14650 | {
|
14651 | staticClass: "el-range-input",
|
14652 | attrs: {
|
14653 | autocomplete: "off",
|
14654 | placeholder: _vm.endPlaceholder,
|
14655 | disabled: _vm.pickerDisabled,
|
14656 | readonly: !_vm.editable || _vm.readonly,
|
14657 | name: _vm.name && _vm.name[1]
|
14658 | },
|
14659 | domProps: { value: _vm.displayValue && _vm.displayValue[1] },
|
14660 | on: {
|
14661 | input: _vm.handleEndInput,
|
14662 | change: _vm.handleEndChange,
|
14663 | focus: _vm.handleFocus
|
14664 | }
|
14665 | },
|
14666 | "input",
|
14667 | _vm.secondInputId,
|
14668 | false
|
14669 | )
|
14670 | ),
|
14671 | _vm.haveTrigger
|
14672 | ? _c("i", {
|
14673 | staticClass: "el-input__icon el-range__close-icon",
|
14674 | class: [_vm.showClose ? "" + _vm.clearIcon : ""],
|
14675 | on: { click: _vm.handleClickIcon }
|
14676 | })
|
14677 | : _vm._e()
|
14678 | ],
|
14679 | 2
|
14680 | )
|
14681 | }
|
14682 | var pickervue_type_template_id_79ae069f_staticRenderFns = []
|
14683 | pickervue_type_template_id_79ae069f_render._withStripped = true
|
14684 |
|
14685 |
|
14686 |
|
14687 |
|
14688 |
|
14689 | var date_util_ = __webpack_require__(0);
|
14690 |
|
14691 |
|
14692 |
|
14693 |
|
14694 |
|
14695 |
|
14696 |
|
14697 |
|
14698 |
|
14699 |
|
14700 |
|
14701 |
|
14702 |
|
14703 |
|
14704 |
|
14705 |
|
14706 |
|
14707 |
|
14708 |
|
14709 |
|
14710 |
|
14711 |
|
14712 |
|
14713 |
|
14714 |
|
14715 |
|
14716 |
|
14717 |
|
14718 |
|
14719 |
|
14720 |
|
14721 |
|
14722 |
|
14723 |
|
14724 |
|
14725 |
|
14726 |
|
14727 |
|
14728 |
|
14729 |
|
14730 |
|
14731 |
|
14732 |
|
14733 |
|
14734 |
|
14735 |
|
14736 |
|
14737 |
|
14738 |
|
14739 |
|
14740 |
|
14741 |
|
14742 |
|
14743 |
|
14744 |
|
14745 |
|
14746 |
|
14747 |
|
14748 |
|
14749 |
|
14750 |
|
14751 |
|
14752 |
|
14753 |
|
14754 |
|
14755 |
|
14756 |
|
14757 |
|
14758 |
|
14759 |
|
14760 |
|
14761 |
|
14762 |
|
14763 |
|
14764 |
|
14765 |
|
14766 |
|
14767 |
|
14768 |
|
14769 |
|
14770 |
|
14771 |
|
14772 |
|
14773 |
|
14774 |
|
14775 |
|
14776 |
|
14777 |
|
14778 |
|
14779 |
|
14780 |
|
14781 |
|
14782 |
|
14783 |
|
14784 |
|
14785 |
|
14786 | var NewPopper = {
|
14787 | props: {
|
14788 | appendToBody: vue_popper_default.a.props.appendToBody,
|
14789 | offset: vue_popper_default.a.props.offset,
|
14790 | boundariesPadding: vue_popper_default.a.props.boundariesPadding,
|
14791 | arrowOffset: vue_popper_default.a.props.arrowOffset
|
14792 | },
|
14793 | methods: vue_popper_default.a.methods,
|
14794 | data: function data() {
|
14795 | return merge_default()({ visibleArrow: true }, vue_popper_default.a.data);
|
14796 | },
|
14797 |
|
14798 | beforeDestroy: vue_popper_default.a.beforeDestroy
|
14799 | };
|
14800 |
|
14801 | var DEFAULT_FORMATS = {
|
14802 | date: 'yyyy-MM-dd',
|
14803 | month: 'yyyy-MM',
|
14804 | datetime: 'yyyy-MM-dd HH:mm:ss',
|
14805 | time: 'HH:mm:ss',
|
14806 | week: 'yyyywWW',
|
14807 | timerange: 'HH:mm:ss',
|
14808 | daterange: 'yyyy-MM-dd',
|
14809 | monthrange: 'yyyy-MM',
|
14810 | datetimerange: 'yyyy-MM-dd HH:mm:ss',
|
14811 | year: 'yyyy'
|
14812 | };
|
14813 | var HAVE_TRIGGER_TYPES = ['date', 'datetime', 'time', 'time-select', 'week', 'month', 'year', 'daterange', 'monthrange', 'timerange', 'datetimerange', 'dates'];
|
14814 | var pickervue_type_script_lang_js_DATE_FORMATTER = function DATE_FORMATTER(value, format) {
|
14815 | if (format === 'timestamp') return value.getTime();
|
14816 | return Object(date_util_["formatDate"])(value, format);
|
14817 | };
|
14818 | var pickervue_type_script_lang_js_DATE_PARSER = function DATE_PARSER(text, format) {
|
14819 | if (format === 'timestamp') return new Date(Number(text));
|
14820 | return Object(date_util_["parseDate"])(text, format);
|
14821 | };
|
14822 | var RANGE_FORMATTER = function RANGE_FORMATTER(value, format) {
|
14823 | if (Array.isArray(value) && value.length === 2) {
|
14824 | var start = value[0];
|
14825 | var end = value[1];
|
14826 |
|
14827 | if (start && end) {
|
14828 | return [pickervue_type_script_lang_js_DATE_FORMATTER(start, format), pickervue_type_script_lang_js_DATE_FORMATTER(end, format)];
|
14829 | }
|
14830 | }
|
14831 | return '';
|
14832 | };
|
14833 | var RANGE_PARSER = function RANGE_PARSER(array, format, separator) {
|
14834 | if (!Array.isArray(array)) {
|
14835 | array = array.split(separator);
|
14836 | }
|
14837 | if (array.length === 2) {
|
14838 | var range1 = array[0];
|
14839 | var range2 = array[1];
|
14840 |
|
14841 | return [pickervue_type_script_lang_js_DATE_PARSER(range1, format), pickervue_type_script_lang_js_DATE_PARSER(range2, format)];
|
14842 | }
|
14843 | return [];
|
14844 | };
|
14845 | var TYPE_VALUE_RESOLVER_MAP = {
|
14846 | default: {
|
14847 | formatter: function formatter(value) {
|
14848 | if (!value) return '';
|
14849 | return '' + value;
|
14850 | },
|
14851 | parser: function parser(text) {
|
14852 | if (text === undefined || text === '') return null;
|
14853 | return text;
|
14854 | }
|
14855 | },
|
14856 | week: {
|
14857 | formatter: function formatter(value, format) {
|
14858 | var week = Object(date_util_["getWeekNumber"])(value);
|
14859 | var month = value.getMonth();
|
14860 | var trueDate = new Date(value);
|
14861 | if (week === 1 && month === 11) {
|
14862 | trueDate.setHours(0, 0, 0, 0);
|
14863 | trueDate.setDate(trueDate.getDate() + 3 - (trueDate.getDay() + 6) % 7);
|
14864 | }
|
14865 | var date = Object(date_util_["formatDate"])(trueDate, format);
|
14866 |
|
14867 | date = /WW/.test(date) ? date.replace(/WW/, week < 10 ? '0' + week : week) : date.replace(/W/, week);
|
14868 | return date;
|
14869 | },
|
14870 | parser: function parser(text, format) {
|
14871 |
|
14872 | return TYPE_VALUE_RESOLVER_MAP.date.parser(text, format);
|
14873 | }
|
14874 | },
|
14875 | date: {
|
14876 | formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
|
14877 | parser: pickervue_type_script_lang_js_DATE_PARSER
|
14878 | },
|
14879 | datetime: {
|
14880 | formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
|
14881 | parser: pickervue_type_script_lang_js_DATE_PARSER
|
14882 | },
|
14883 | daterange: {
|
14884 | formatter: RANGE_FORMATTER,
|
14885 | parser: RANGE_PARSER
|
14886 | },
|
14887 | monthrange: {
|
14888 | formatter: RANGE_FORMATTER,
|
14889 | parser: RANGE_PARSER
|
14890 | },
|
14891 | datetimerange: {
|
14892 | formatter: RANGE_FORMATTER,
|
14893 | parser: RANGE_PARSER
|
14894 | },
|
14895 | timerange: {
|
14896 | formatter: RANGE_FORMATTER,
|
14897 | parser: RANGE_PARSER
|
14898 | },
|
14899 | time: {
|
14900 | formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
|
14901 | parser: pickervue_type_script_lang_js_DATE_PARSER
|
14902 | },
|
14903 | month: {
|
14904 | formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
|
14905 | parser: pickervue_type_script_lang_js_DATE_PARSER
|
14906 | },
|
14907 | year: {
|
14908 | formatter: pickervue_type_script_lang_js_DATE_FORMATTER,
|
14909 | parser: pickervue_type_script_lang_js_DATE_PARSER
|
14910 | },
|
14911 | number: {
|
14912 | formatter: function formatter(value) {
|
14913 | if (!value) return '';
|
14914 | return '' + value;
|
14915 | },
|
14916 | parser: function parser(text) {
|
14917 | var result = Number(text);
|
14918 |
|
14919 | if (!isNaN(text)) {
|
14920 | return result;
|
14921 | } else {
|
14922 | return null;
|
14923 | }
|
14924 | }
|
14925 | },
|
14926 | dates: {
|
14927 | formatter: function formatter(value, format) {
|
14928 | return value.map(function (date) {
|
14929 | return pickervue_type_script_lang_js_DATE_FORMATTER(date, format);
|
14930 | });
|
14931 | },
|
14932 | parser: function parser(value, format) {
|
14933 | return (typeof value === 'string' ? value.split(', ') : value).map(function (date) {
|
14934 | return date instanceof Date ? date : pickervue_type_script_lang_js_DATE_PARSER(date, format);
|
14935 | });
|
14936 | }
|
14937 | }
|
14938 | };
|
14939 | var PLACEMENT_MAP = {
|
14940 | left: 'bottom-start',
|
14941 | center: 'bottom',
|
14942 | right: 'bottom-end'
|
14943 | };
|
14944 |
|
14945 | var parseAsFormatAndType = function parseAsFormatAndType(value, customFormat, type) {
|
14946 | var rangeSeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '-';
|
14947 |
|
14948 | if (!value) return null;
|
14949 | var parser = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).parser;
|
14950 | var format = customFormat || DEFAULT_FORMATS[type];
|
14951 | return parser(value, format, rangeSeparator);
|
14952 | };
|
14953 |
|
14954 | var formatAsFormatAndType = function formatAsFormatAndType(value, customFormat, type) {
|
14955 | if (!value) return null;
|
14956 | var formatter = (TYPE_VALUE_RESOLVER_MAP[type] || TYPE_VALUE_RESOLVER_MAP['default']).formatter;
|
14957 | var format = customFormat || DEFAULT_FORMATS[type];
|
14958 | return formatter(value, format);
|
14959 | };
|
14960 |
|
14961 |
|
14962 |
|
14963 |
|
14964 |
|
14965 |
|
14966 |
|
14967 | var valueEquals = function valueEquals(a, b) {
|
14968 |
|
14969 | var dateEquals = function dateEquals(a, b) {
|
14970 | var aIsDate = a instanceof Date;
|
14971 | var bIsDate = b instanceof Date;
|
14972 | if (aIsDate && bIsDate) {
|
14973 | return a.getTime() === b.getTime();
|
14974 | }
|
14975 | if (!aIsDate && !bIsDate) {
|
14976 | return a === b;
|
14977 | }
|
14978 | return false;
|
14979 | };
|
14980 |
|
14981 | var aIsArray = a instanceof Array;
|
14982 | var bIsArray = b instanceof Array;
|
14983 | if (aIsArray && bIsArray) {
|
14984 | if (a.length !== b.length) {
|
14985 | return false;
|
14986 | }
|
14987 | return a.every(function (item, index) {
|
14988 | return dateEquals(item, b[index]);
|
14989 | });
|
14990 | }
|
14991 | if (!aIsArray && !bIsArray) {
|
14992 | return dateEquals(a, b);
|
14993 | }
|
14994 | return false;
|
14995 | };
|
14996 |
|
14997 | var isString = function isString(val) {
|
14998 | return typeof val === 'string' || val instanceof String;
|
14999 | };
|
15000 |
|
15001 | var pickervue_type_script_lang_js_validator = function validator(val) {
|
15002 |
|
15003 | return val === null || val === undefined || isString(val) || Array.isArray(val) && val.length === 2 && val.every(isString);
|
15004 | };
|
15005 |
|
15006 | var pickervue_type_script_lang_js_ = ({
|
15007 | mixins: [emitter_default.a, NewPopper],
|
15008 |
|
15009 | inject: {
|
15010 | elForm: {
|
15011 | default: ''
|
15012 | },
|
15013 | elFormItem: {
|
15014 | default: ''
|
15015 | }
|
15016 | },
|
15017 |
|
15018 | props: {
|
15019 | size: String,
|
15020 | format: String,
|
15021 | valueFormat: String,
|
15022 | readonly: Boolean,
|
15023 | placeholder: String,
|
15024 | startPlaceholder: String,
|
15025 | endPlaceholder: String,
|
15026 | prefixIcon: String,
|
15027 | clearIcon: {
|
15028 | type: String,
|
15029 | default: 'el-icon-circle-close'
|
15030 | },
|
15031 | name: {
|
15032 | default: '',
|
15033 | validator: pickervue_type_script_lang_js_validator
|
15034 | },
|
15035 | disabled: Boolean,
|
15036 | clearable: {
|
15037 | type: Boolean,
|
15038 | default: true
|
15039 | },
|
15040 | id: {
|
15041 | default: '',
|
15042 | validator: pickervue_type_script_lang_js_validator
|
15043 | },
|
15044 | popperClass: String,
|
15045 | editable: {
|
15046 | type: Boolean,
|
15047 | default: true
|
15048 | },
|
15049 | align: {
|
15050 | type: String,
|
15051 | default: 'left'
|
15052 | },
|
15053 | value: {},
|
15054 | defaultValue: {},
|
15055 | defaultTime: {},
|
15056 | rangeSeparator: {
|
15057 | default: '-'
|
15058 | },
|
15059 | pickerOptions: {},
|
15060 | unlinkPanels: Boolean,
|
15061 | validateEvent: {
|
15062 | type: Boolean,
|
15063 | default: true
|
15064 | }
|
15065 | },
|
15066 |
|
15067 | components: { ElInput: input_default.a },
|
15068 |
|
15069 | directives: { Clickoutside: clickoutside_default.a },
|
15070 |
|
15071 | data: function data() {
|
15072 | return {
|
15073 | pickerVisible: false,
|
15074 | showClose: false,
|
15075 | userInput: null,
|
15076 | valueOnOpen: null,
|
15077 | unwatchPickerOptions: null
|
15078 | };
|
15079 | },
|
15080 |
|
15081 |
|
15082 | watch: {
|
15083 | pickerVisible: function pickerVisible(val) {
|
15084 | if (this.readonly || this.pickerDisabled) return;
|
15085 | if (val) {
|
15086 | this.showPicker();
|
15087 | this.valueOnOpen = Array.isArray(this.value) ? [].concat(this.value) : this.value;
|
15088 | } else {
|
15089 | this.hidePicker();
|
15090 | this.emitChange(this.value);
|
15091 | this.userInput = null;
|
15092 | if (this.validateEvent) {
|
15093 | this.dispatch('ElFormItem', 'el.form.blur');
|
15094 | }
|
15095 | this.$emit('blur', this);
|
15096 | this.blur();
|
15097 | }
|
15098 | },
|
15099 |
|
15100 | parsedValue: {
|
15101 | immediate: true,
|
15102 | handler: function handler(val) {
|
15103 | if (this.picker) {
|
15104 | this.picker.value = val;
|
15105 | }
|
15106 | }
|
15107 | },
|
15108 | defaultValue: function defaultValue(val) {
|
15109 |
|
15110 | if (this.picker) {
|
15111 | this.picker.defaultValue = val;
|
15112 | }
|
15113 | },
|
15114 | value: function value(val, oldVal) {
|
15115 | if (!valueEquals(val, oldVal) && !this.pickerVisible && this.validateEvent) {
|
15116 | this.dispatch('ElFormItem', 'el.form.change', val);
|
15117 | }
|
15118 | }
|
15119 | },
|
15120 |
|
15121 | computed: {
|
15122 | ranged: function ranged() {
|
15123 | return this.type.indexOf('range') > -1;
|
15124 | },
|
15125 | reference: function reference() {
|
15126 | var reference = this.$refs.reference;
|
15127 | return reference.$el || reference;
|
15128 | },
|
15129 | refInput: function refInput() {
|
15130 | if (this.reference) {
|
15131 | return [].slice.call(this.reference.querySelectorAll('input'));
|
15132 | }
|
15133 | return [];
|
15134 | },
|
15135 | valueIsEmpty: function valueIsEmpty() {
|
15136 | var val = this.value;
|
15137 | if (Array.isArray(val)) {
|
15138 | for (var i = 0, len = val.length; i < len; i++) {
|
15139 | if (val[i]) {
|
15140 | return false;
|
15141 | }
|
15142 | }
|
15143 | } else {
|
15144 | if (val) {
|
15145 | return false;
|
15146 | }
|
15147 | }
|
15148 | return true;
|
15149 | },
|
15150 | triggerClass: function triggerClass() {
|
15151 | return this.prefixIcon || (this.type.indexOf('time') !== -1 ? 'el-icon-time' : 'el-icon-date');
|
15152 | },
|
15153 | selectionMode: function selectionMode() {
|
15154 | if (this.type === 'week') {
|
15155 | return 'week';
|
15156 | } else if (this.type === 'month') {
|
15157 | return 'month';
|
15158 | } else if (this.type === 'year') {
|
15159 | return 'year';
|
15160 | } else if (this.type === 'dates') {
|
15161 | return 'dates';
|
15162 | }
|
15163 |
|
15164 | return 'day';
|
15165 | },
|
15166 | haveTrigger: function haveTrigger() {
|
15167 | if (typeof this.showTrigger !== 'undefined') {
|
15168 | return this.showTrigger;
|
15169 | }
|
15170 | return HAVE_TRIGGER_TYPES.indexOf(this.type) !== -1;
|
15171 | },
|
15172 | displayValue: function displayValue() {
|
15173 | var formattedValue = formatAsFormatAndType(this.parsedValue, this.format, this.type, this.rangeSeparator);
|
15174 | if (Array.isArray(this.userInput)) {
|
15175 | return [this.userInput[0] || formattedValue && formattedValue[0] || '', this.userInput[1] || formattedValue && formattedValue[1] || ''];
|
15176 | } else if (this.userInput !== null) {
|
15177 | return this.userInput;
|
15178 | } else if (formattedValue) {
|
15179 | return this.type === 'dates' ? formattedValue.join(', ') : formattedValue;
|
15180 | } else {
|
15181 | return '';
|
15182 | }
|
15183 | },
|
15184 | parsedValue: function parsedValue() {
|
15185 | if (!this.value) return this.value;
|
15186 | if (this.type === 'time-select') return this.value;
|
15187 |
|
15188 | var valueIsDateObject = Object(date_util_["isDateObject"])(this.value) || Array.isArray(this.value) && this.value.every(date_util_["isDateObject"]);
|
15189 | if (valueIsDateObject) {
|
15190 | return this.value;
|
15191 | }
|
15192 |
|
15193 | if (this.valueFormat) {
|
15194 | return parseAsFormatAndType(this.value, this.valueFormat, this.type, this.rangeSeparator) || this.value;
|
15195 | }
|
15196 |
|
15197 |
|
15198 |
|
15199 | return Array.isArray(this.value) ? this.value.map(function (val) {
|
15200 | return new Date(val);
|
15201 | }) : new Date(this.value);
|
15202 | },
|
15203 | _elFormItemSize: function _elFormItemSize() {
|
15204 | return (this.elFormItem || {}).elFormItemSize;
|
15205 | },
|
15206 | pickerSize: function pickerSize() {
|
15207 | return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
15208 | },
|
15209 | pickerDisabled: function pickerDisabled() {
|
15210 | return this.disabled || (this.elForm || {}).disabled;
|
15211 | },
|
15212 | firstInputId: function firstInputId() {
|
15213 | var obj = {};
|
15214 | var id = void 0;
|
15215 | if (this.ranged) {
|
15216 | id = this.id && this.id[0];
|
15217 | } else {
|
15218 | id = this.id;
|
15219 | }
|
15220 | if (id) obj.id = id;
|
15221 | return obj;
|
15222 | },
|
15223 | secondInputId: function secondInputId() {
|
15224 | var obj = {};
|
15225 | var id = void 0;
|
15226 | if (this.ranged) {
|
15227 | id = this.id && this.id[1];
|
15228 | }
|
15229 | if (id) obj.id = id;
|
15230 | return obj;
|
15231 | }
|
15232 | },
|
15233 |
|
15234 | created: function created() {
|
15235 |
|
15236 | this.popperOptions = {
|
15237 | boundariesPadding: 0,
|
15238 | gpuAcceleration: false
|
15239 | };
|
15240 | this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
|
15241 |
|
15242 | this.$on('fieldReset', this.handleFieldReset);
|
15243 | },
|
15244 |
|
15245 |
|
15246 | methods: {
|
15247 | focus: function focus() {
|
15248 | if (!this.ranged) {
|
15249 | this.$refs.reference.focus();
|
15250 | } else {
|
15251 | this.handleFocus();
|
15252 | }
|
15253 | },
|
15254 | blur: function blur() {
|
15255 | this.refInput.forEach(function (input) {
|
15256 | return input.blur();
|
15257 | });
|
15258 | },
|
15259 |
|
15260 |
|
15261 |
|
15262 | parseValue: function parseValue(value) {
|
15263 | var isParsed = Object(date_util_["isDateObject"])(value) || Array.isArray(value) && value.every(date_util_["isDateObject"]);
|
15264 | if (this.valueFormat && !isParsed) {
|
15265 | return parseAsFormatAndType(value, this.valueFormat, this.type, this.rangeSeparator) || value;
|
15266 | } else {
|
15267 | return value;
|
15268 | }
|
15269 | },
|
15270 | formatToValue: function formatToValue(date) {
|
15271 | var isFormattable = Object(date_util_["isDateObject"])(date) || Array.isArray(date) && date.every(date_util_["isDateObject"]);
|
15272 | if (this.valueFormat && isFormattable) {
|
15273 | return formatAsFormatAndType(date, this.valueFormat, this.type, this.rangeSeparator);
|
15274 | } else {
|
15275 | return date;
|
15276 | }
|
15277 | },
|
15278 |
|
15279 |
|
15280 |
|
15281 | parseString: function parseString(value) {
|
15282 | var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
|
15283 | return parseAsFormatAndType(value, this.format, type);
|
15284 | },
|
15285 | formatToString: function formatToString(value) {
|
15286 | var type = Array.isArray(value) ? this.type : this.type.replace('range', '');
|
15287 | return formatAsFormatAndType(value, this.format, type);
|
15288 | },
|
15289 | handleMouseEnter: function handleMouseEnter() {
|
15290 | if (this.readonly || this.pickerDisabled) return;
|
15291 | if (!this.valueIsEmpty && this.clearable) {
|
15292 | this.showClose = true;
|
15293 | }
|
15294 | },
|
15295 | handleChange: function handleChange() {
|
15296 | if (this.userInput) {
|
15297 | var value = this.parseString(this.displayValue);
|
15298 | if (value) {
|
15299 | this.picker.value = value;
|
15300 | if (this.isValidValue(value)) {
|
15301 | this.emitInput(value);
|
15302 | this.userInput = null;
|
15303 | }
|
15304 | }
|
15305 | }
|
15306 | if (this.userInput === '') {
|
15307 | this.emitInput(null);
|
15308 | this.emitChange(null);
|
15309 | this.userInput = null;
|
15310 | }
|
15311 | },
|
15312 | handleStartInput: function handleStartInput(event) {
|
15313 | if (this.userInput) {
|
15314 | this.userInput = [event.target.value, this.userInput[1]];
|
15315 | } else {
|
15316 | this.userInput = [event.target.value, null];
|
15317 | }
|
15318 | },
|
15319 | handleEndInput: function handleEndInput(event) {
|
15320 | if (this.userInput) {
|
15321 | this.userInput = [this.userInput[0], event.target.value];
|
15322 | } else {
|
15323 | this.userInput = [null, event.target.value];
|
15324 | }
|
15325 | },
|
15326 | handleStartChange: function handleStartChange(event) {
|
15327 | var value = this.parseString(this.userInput && this.userInput[0]);
|
15328 | if (value) {
|
15329 | this.userInput = [this.formatToString(value), this.displayValue[1]];
|
15330 | var newValue = [value, this.picker.value && this.picker.value[1]];
|
15331 | this.picker.value = newValue;
|
15332 | if (this.isValidValue(newValue)) {
|
15333 | this.emitInput(newValue);
|
15334 | this.userInput = null;
|
15335 | }
|
15336 | }
|
15337 | },
|
15338 | handleEndChange: function handleEndChange(event) {
|
15339 | var value = this.parseString(this.userInput && this.userInput[1]);
|
15340 | if (value) {
|
15341 | this.userInput = [this.displayValue[0], this.formatToString(value)];
|
15342 | var newValue = [this.picker.value && this.picker.value[0], value];
|
15343 | this.picker.value = newValue;
|
15344 | if (this.isValidValue(newValue)) {
|
15345 | this.emitInput(newValue);
|
15346 | this.userInput = null;
|
15347 | }
|
15348 | }
|
15349 | },
|
15350 | handleClickIcon: function handleClickIcon(event) {
|
15351 | if (this.readonly || this.pickerDisabled) return;
|
15352 | if (this.showClose) {
|
15353 | this.valueOnOpen = this.value;
|
15354 | event.stopPropagation();
|
15355 | this.emitInput(null);
|
15356 | this.emitChange(null);
|
15357 | this.showClose = false;
|
15358 | if (this.picker && typeof this.picker.handleClear === 'function') {
|
15359 | this.picker.handleClear();
|
15360 | }
|
15361 | } else {
|
15362 | this.pickerVisible = !this.pickerVisible;
|
15363 | }
|
15364 | },
|
15365 | handleClose: function handleClose() {
|
15366 | if (!this.pickerVisible) return;
|
15367 | this.pickerVisible = false;
|
15368 |
|
15369 | if (this.type === 'dates') {
|
15370 |
|
15371 | var oldValue = parseAsFormatAndType(this.valueOnOpen, this.valueFormat, this.type, this.rangeSeparator) || this.valueOnOpen;
|
15372 | this.emitInput(oldValue);
|
15373 | }
|
15374 | },
|
15375 | handleFieldReset: function handleFieldReset(initialValue) {
|
15376 | this.userInput = initialValue === '' ? null : initialValue;
|
15377 | },
|
15378 | handleFocus: function handleFocus() {
|
15379 | var type = this.type;
|
15380 |
|
15381 | if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
|
15382 | this.pickerVisible = true;
|
15383 | }
|
15384 | this.$emit('focus', this);
|
15385 | },
|
15386 | handleKeydown: function handleKeydown(event) {
|
15387 | var _this = this;
|
15388 |
|
15389 | var keyCode = event.keyCode;
|
15390 |
|
15391 |
|
15392 | if (keyCode === 27) {
|
15393 | this.pickerVisible = false;
|
15394 | event.stopPropagation();
|
15395 | return;
|
15396 | }
|
15397 |
|
15398 |
|
15399 | if (keyCode === 9) {
|
15400 | if (!this.ranged) {
|
15401 | this.handleChange();
|
15402 | this.pickerVisible = this.picker.visible = false;
|
15403 | this.blur();
|
15404 | event.stopPropagation();
|
15405 | } else {
|
15406 |
|
15407 | setTimeout(function () {
|
15408 | if (_this.refInput.indexOf(document.activeElement) === -1) {
|
15409 | _this.pickerVisible = false;
|
15410 | _this.blur();
|
15411 | event.stopPropagation();
|
15412 | }
|
15413 | }, 0);
|
15414 | }
|
15415 | return;
|
15416 | }
|
15417 |
|
15418 |
|
15419 | if (keyCode === 13) {
|
15420 | if (this.userInput === '' || this.isValidValue(this.parseString(this.displayValue))) {
|
15421 | this.handleChange();
|
15422 | this.pickerVisible = this.picker.visible = false;
|
15423 | this.blur();
|
15424 | }
|
15425 | event.stopPropagation();
|
15426 | return;
|
15427 | }
|
15428 |
|
15429 |
|
15430 | if (this.userInput) {
|
15431 | event.stopPropagation();
|
15432 | return;
|
15433 | }
|
15434 |
|
15435 |
|
15436 | if (this.picker && this.picker.handleKeydown) {
|
15437 | this.picker.handleKeydown(event);
|
15438 | }
|
15439 | },
|
15440 | handleRangeClick: function handleRangeClick() {
|
15441 | var type = this.type;
|
15442 |
|
15443 | if (HAVE_TRIGGER_TYPES.indexOf(type) !== -1 && !this.pickerVisible) {
|
15444 | this.pickerVisible = true;
|
15445 | }
|
15446 | this.$emit('focus', this);
|
15447 | },
|
15448 | hidePicker: function hidePicker() {
|
15449 | if (this.picker) {
|
15450 | this.picker.resetView && this.picker.resetView();
|
15451 | this.pickerVisible = this.picker.visible = false;
|
15452 | this.destroyPopper();
|
15453 | }
|
15454 | },
|
15455 | showPicker: function showPicker() {
|
15456 | var _this2 = this;
|
15457 |
|
15458 | if (this.$isServer) return;
|
15459 | if (!this.picker) {
|
15460 | this.mountPicker();
|
15461 | }
|
15462 | this.pickerVisible = this.picker.visible = true;
|
15463 |
|
15464 | this.updatePopper();
|
15465 |
|
15466 | this.picker.value = this.parsedValue;
|
15467 | this.picker.resetView && this.picker.resetView();
|
15468 |
|
15469 | this.$nextTick(function () {
|
15470 | _this2.picker.adjustSpinners && _this2.picker.adjustSpinners();
|
15471 | });
|
15472 | },
|
15473 | mountPicker: function mountPicker() {
|
15474 | var _this3 = this;
|
15475 |
|
15476 | this.picker = new external_vue_default.a(this.panel).$mount();
|
15477 | this.picker.defaultValue = this.defaultValue;
|
15478 | this.picker.defaultTime = this.defaultTime;
|
15479 | this.picker.popperClass = this.popperClass;
|
15480 | this.popperElm = this.picker.$el;
|
15481 | this.picker.width = this.reference.getBoundingClientRect().width;
|
15482 | this.picker.showTime = this.type === 'datetime' || this.type === 'datetimerange';
|
15483 | this.picker.selectionMode = this.selectionMode;
|
15484 | this.picker.unlinkPanels = this.unlinkPanels;
|
15485 | this.picker.arrowControl = this.arrowControl || this.timeArrowControl || false;
|
15486 | this.$watch('format', function (format) {
|
15487 | _this3.picker.format = format;
|
15488 | });
|
15489 |
|
15490 | var updateOptions = function updateOptions() {
|
15491 | var options = _this3.pickerOptions;
|
15492 |
|
15493 | if (options && options.selectableRange) {
|
15494 | var ranges = options.selectableRange;
|
15495 | var parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
|
15496 | var format = DEFAULT_FORMATS.timerange;
|
15497 |
|
15498 | ranges = Array.isArray(ranges) ? ranges : [ranges];
|
15499 | _this3.picker.selectableRange = ranges.map(function (range) {
|
15500 | return parser(range, format, _this3.rangeSeparator);
|
15501 | });
|
15502 | }
|
15503 |
|
15504 | for (var option in options) {
|
15505 | if (options.hasOwnProperty(option) &&
|
15506 |
|
15507 | option !== 'selectableRange') {
|
15508 | _this3.picker[option] = options[option];
|
15509 | }
|
15510 | }
|
15511 |
|
15512 |
|
15513 | if (_this3.format) {
|
15514 | _this3.picker.format = _this3.format;
|
15515 | }
|
15516 | };
|
15517 | updateOptions();
|
15518 | this.unwatchPickerOptions = this.$watch('pickerOptions', function () {
|
15519 | return updateOptions();
|
15520 | }, { deep: true });
|
15521 | this.$el.appendChild(this.picker.$el);
|
15522 | this.picker.resetView && this.picker.resetView();
|
15523 |
|
15524 | this.picker.$on('dodestroy', this.doDestroy);
|
15525 | this.picker.$on('pick', function () {
|
15526 | var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
15527 | var visible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
15528 |
|
15529 | _this3.userInput = null;
|
15530 | _this3.pickerVisible = _this3.picker.visible = visible;
|
15531 | _this3.emitInput(date);
|
15532 | _this3.picker.resetView && _this3.picker.resetView();
|
15533 | });
|
15534 |
|
15535 | this.picker.$on('select-range', function (start, end, pos) {
|
15536 | if (_this3.refInput.length === 0) return;
|
15537 | if (!pos || pos === 'min') {
|
15538 | _this3.refInput[0].setSelectionRange(start, end);
|
15539 | _this3.refInput[0].focus();
|
15540 | } else if (pos === 'max') {
|
15541 | _this3.refInput[1].setSelectionRange(start, end);
|
15542 | _this3.refInput[1].focus();
|
15543 | }
|
15544 | });
|
15545 | },
|
15546 | unmountPicker: function unmountPicker() {
|
15547 | if (this.picker) {
|
15548 | this.picker.$destroy();
|
15549 | this.picker.$off();
|
15550 | if (typeof this.unwatchPickerOptions === 'function') {
|
15551 | this.unwatchPickerOptions();
|
15552 | }
|
15553 | this.picker.$el.parentNode.removeChild(this.picker.$el);
|
15554 | }
|
15555 | },
|
15556 | emitChange: function emitChange(val) {
|
15557 |
|
15558 | if (!valueEquals(val, this.valueOnOpen)) {
|
15559 | this.$emit('change', val);
|
15560 | this.valueOnOpen = val;
|
15561 | if (this.validateEvent) {
|
15562 | this.dispatch('ElFormItem', 'el.form.change', val);
|
15563 | }
|
15564 | }
|
15565 | },
|
15566 | emitInput: function emitInput(val) {
|
15567 | var formatted = this.formatToValue(val);
|
15568 | if (!valueEquals(this.value, formatted)) {
|
15569 | this.$emit('input', formatted);
|
15570 | }
|
15571 | },
|
15572 | isValidValue: function isValidValue(value) {
|
15573 | if (!this.picker) {
|
15574 | this.mountPicker();
|
15575 | }
|
15576 | if (this.picker.isValidValue) {
|
15577 | return value && this.picker.isValidValue(value);
|
15578 | } else {
|
15579 | return true;
|
15580 | }
|
15581 | }
|
15582 | }
|
15583 | });
|
15584 |
|
15585 | var src_pickervue_type_script_lang_js_ = (pickervue_type_script_lang_js_);
|
15586 |
|
15587 |
|
15588 |
|
15589 |
|
15590 |
|
15591 |
|
15592 |
|
15593 |
|
15594 | var picker_component = normalizeComponent(
|
15595 | src_pickervue_type_script_lang_js_,
|
15596 | pickervue_type_template_id_79ae069f_render,
|
15597 | pickervue_type_template_id_79ae069f_staticRenderFns,
|
15598 | false,
|
15599 | null,
|
15600 | null,
|
15601 | null
|
15602 |
|
15603 | )
|
15604 |
|
15605 |
|
15606 | if (false) { var picker_api; }
|
15607 | picker_component.options.__file = "packages/date-picker/src/picker.vue"
|
15608 | var picker = (picker_component.exports);
|
15609 |
|
15610 | var datevue_type_template_id_2440d4ea_render = function() {
|
15611 | var _vm = this
|
15612 | var _h = _vm.$createElement
|
15613 | var _c = _vm._self._c || _h
|
15614 | return _c(
|
15615 | "transition",
|
15616 | {
|
15617 | attrs: { name: "el-zoom-in-top" },
|
15618 | on: { "after-enter": _vm.handleEnter, "after-leave": _vm.handleLeave }
|
15619 | },
|
15620 | [
|
15621 | _c(
|
15622 | "div",
|
15623 | {
|
15624 | directives: [
|
15625 | {
|
15626 | name: "show",
|
15627 | rawName: "v-show",
|
15628 | value: _vm.visible,
|
15629 | expression: "visible"
|
15630 | }
|
15631 | ],
|
15632 | staticClass: "el-picker-panel el-date-picker el-popper",
|
15633 | class: [
|
15634 | {
|
15635 | "has-sidebar": _vm.$slots.sidebar || _vm.shortcuts,
|
15636 | "has-time": _vm.showTime
|
15637 | },
|
15638 | _vm.popperClass
|
15639 | ]
|
15640 | },
|
15641 | [
|
15642 | _c(
|
15643 | "div",
|
15644 | { staticClass: "el-picker-panel__body-wrapper" },
|
15645 | [
|
15646 | _vm._t("sidebar"),
|
15647 | _vm.shortcuts
|
15648 | ? _c(
|
15649 | "div",
|
15650 | { staticClass: "el-picker-panel__sidebar" },
|
15651 | _vm._l(_vm.shortcuts, function(shortcut, key) {
|
15652 | return _c(
|
15653 | "button",
|
15654 | {
|
15655 | key: key,
|
15656 | staticClass: "el-picker-panel__shortcut",
|
15657 | attrs: { type: "button" },
|
15658 | on: {
|
15659 | click: function($event) {
|
15660 | _vm.handleShortcutClick(shortcut)
|
15661 | }
|
15662 | }
|
15663 | },
|
15664 | [_vm._v(_vm._s(shortcut.text))]
|
15665 | )
|
15666 | }),
|
15667 | 0
|
15668 | )
|
15669 | : _vm._e(),
|
15670 | _c("div", { staticClass: "el-picker-panel__body" }, [
|
15671 | _vm.showTime
|
15672 | ? _c("div", { staticClass: "el-date-picker__time-header" }, [
|
15673 | _c(
|
15674 | "span",
|
15675 | { staticClass: "el-date-picker__editor-wrap" },
|
15676 | [
|
15677 | _c("el-input", {
|
15678 | attrs: {
|
15679 | placeholder: _vm.t("el.datepicker.selectDate"),
|
15680 | value: _vm.visibleDate,
|
15681 | size: "small"
|
15682 | },
|
15683 | on: {
|
15684 | input: function(val) {
|
15685 | return (_vm.userInputDate = val)
|
15686 | },
|
15687 | change: _vm.handleVisibleDateChange
|
15688 | }
|
15689 | })
|
15690 | ],
|
15691 | 1
|
15692 | ),
|
15693 | _c(
|
15694 | "span",
|
15695 | {
|
15696 | directives: [
|
15697 | {
|
15698 | name: "clickoutside",
|
15699 | rawName: "v-clickoutside",
|
15700 | value: _vm.handleTimePickClose,
|
15701 | expression: "handleTimePickClose"
|
15702 | }
|
15703 | ],
|
15704 | staticClass: "el-date-picker__editor-wrap"
|
15705 | },
|
15706 | [
|
15707 | _c("el-input", {
|
15708 | ref: "input",
|
15709 | attrs: {
|
15710 | placeholder: _vm.t("el.datepicker.selectTime"),
|
15711 | value: _vm.visibleTime,
|
15712 | size: "small"
|
15713 | },
|
15714 | on: {
|
15715 | focus: function($event) {
|
15716 | _vm.timePickerVisible = true
|
15717 | },
|
15718 | input: function(val) {
|
15719 | return (_vm.userInputTime = val)
|
15720 | },
|
15721 | change: _vm.handleVisibleTimeChange
|
15722 | }
|
15723 | }),
|
15724 | _c("time-picker", {
|
15725 | ref: "timepicker",
|
15726 | attrs: {
|
15727 | "time-arrow-control": _vm.arrowControl,
|
15728 | visible: _vm.timePickerVisible
|
15729 | },
|
15730 | on: {
|
15731 | pick: _vm.handleTimePick,
|
15732 | mounted: _vm.proxyTimePickerDataProperties
|
15733 | }
|
15734 | })
|
15735 | ],
|
15736 | 1
|
15737 | )
|
15738 | ])
|
15739 | : _vm._e(),
|
15740 | _c(
|
15741 | "div",
|
15742 | {
|
15743 | directives: [
|
15744 | {
|
15745 | name: "show",
|
15746 | rawName: "v-show",
|
15747 | value: _vm.currentView !== "time",
|
15748 | expression: "currentView !== 'time'"
|
15749 | }
|
15750 | ],
|
15751 | staticClass: "el-date-picker__header",
|
15752 | class: {
|
15753 | "el-date-picker__header--bordered":
|
15754 | _vm.currentView === "year" ||
|
15755 | _vm.currentView === "month"
|
15756 | }
|
15757 | },
|
15758 | [
|
15759 | _c("button", {
|
15760 | staticClass:
|
15761 | "el-picker-panel__icon-btn el-date-picker__prev-btn el-icon-d-arrow-left",
|
15762 | attrs: {
|
15763 | type: "button",
|
15764 | "aria-label": _vm.t("el.datepicker.prevYear")
|
15765 | },
|
15766 | on: { click: _vm.prevYear }
|
15767 | }),
|
15768 | _c("button", {
|
15769 | directives: [
|
15770 | {
|
15771 | name: "show",
|
15772 | rawName: "v-show",
|
15773 | value: _vm.currentView === "date",
|
15774 | expression: "currentView === 'date'"
|
15775 | }
|
15776 | ],
|
15777 | staticClass:
|
15778 | "el-picker-panel__icon-btn el-date-picker__prev-btn el-icon-arrow-left",
|
15779 | attrs: {
|
15780 | type: "button",
|
15781 | "aria-label": _vm.t("el.datepicker.prevMonth")
|
15782 | },
|
15783 | on: { click: _vm.prevMonth }
|
15784 | }),
|
15785 | _c(
|
15786 | "span",
|
15787 | {
|
15788 | staticClass: "el-date-picker__header-label",
|
15789 | attrs: { role: "button" },
|
15790 | on: { click: _vm.showYearPicker }
|
15791 | },
|
15792 | [_vm._v(_vm._s(_vm.yearLabel))]
|
15793 | ),
|
15794 | _c(
|
15795 | "span",
|
15796 | {
|
15797 | directives: [
|
15798 | {
|
15799 | name: "show",
|
15800 | rawName: "v-show",
|
15801 | value: _vm.currentView === "date",
|
15802 | expression: "currentView === 'date'"
|
15803 | }
|
15804 | ],
|
15805 | staticClass: "el-date-picker__header-label",
|
15806 | class: { active: _vm.currentView === "month" },
|
15807 | attrs: { role: "button" },
|
15808 | on: { click: _vm.showMonthPicker }
|
15809 | },
|
15810 | [
|
15811 | _vm._v(
|
15812 | _vm._s(_vm.t("el.datepicker.month" + (_vm.month + 1)))
|
15813 | )
|
15814 | ]
|
15815 | ),
|
15816 | _c("button", {
|
15817 | staticClass:
|
15818 | "el-picker-panel__icon-btn el-date-picker__next-btn el-icon-d-arrow-right",
|
15819 | attrs: {
|
15820 | type: "button",
|
15821 | "aria-label": _vm.t("el.datepicker.nextYear")
|
15822 | },
|
15823 | on: { click: _vm.nextYear }
|
15824 | }),
|
15825 | _c("button", {
|
15826 | directives: [
|
15827 | {
|
15828 | name: "show",
|
15829 | rawName: "v-show",
|
15830 | value: _vm.currentView === "date",
|
15831 | expression: "currentView === 'date'"
|
15832 | }
|
15833 | ],
|
15834 | staticClass:
|
15835 | "el-picker-panel__icon-btn el-date-picker__next-btn el-icon-arrow-right",
|
15836 | attrs: {
|
15837 | type: "button",
|
15838 | "aria-label": _vm.t("el.datepicker.nextMonth")
|
15839 | },
|
15840 | on: { click: _vm.nextMonth }
|
15841 | })
|
15842 | ]
|
15843 | ),
|
15844 | _c(
|
15845 | "div",
|
15846 | { staticClass: "el-picker-panel__content" },
|
15847 | [
|
15848 | _c("date-table", {
|
15849 | directives: [
|
15850 | {
|
15851 | name: "show",
|
15852 | rawName: "v-show",
|
15853 | value: _vm.currentView === "date",
|
15854 | expression: "currentView === 'date'"
|
15855 | }
|
15856 | ],
|
15857 | attrs: {
|
15858 | "selection-mode": _vm.selectionMode,
|
15859 | "first-day-of-week": _vm.firstDayOfWeek,
|
15860 | value: _vm.value,
|
15861 | "default-value": _vm.defaultValue
|
15862 | ? new Date(_vm.defaultValue)
|
15863 | : null,
|
15864 | date: _vm.date,
|
15865 | "cell-class-name": _vm.cellClassName,
|
15866 | "disabled-date": _vm.disabledDate
|
15867 | },
|
15868 | on: { pick: _vm.handleDatePick }
|
15869 | }),
|
15870 | _c("year-table", {
|
15871 | directives: [
|
15872 | {
|
15873 | name: "show",
|
15874 | rawName: "v-show",
|
15875 | value: _vm.currentView === "year",
|
15876 | expression: "currentView === 'year'"
|
15877 | }
|
15878 | ],
|
15879 | attrs: {
|
15880 | value: _vm.value,
|
15881 | "default-value": _vm.defaultValue
|
15882 | ? new Date(_vm.defaultValue)
|
15883 | : null,
|
15884 | date: _vm.date,
|
15885 | "disabled-date": _vm.disabledDate
|
15886 | },
|
15887 | on: { pick: _vm.handleYearPick }
|
15888 | }),
|
15889 | _c("month-table", {
|
15890 | directives: [
|
15891 | {
|
15892 | name: "show",
|
15893 | rawName: "v-show",
|
15894 | value: _vm.currentView === "month",
|
15895 | expression: "currentView === 'month'"
|
15896 | }
|
15897 | ],
|
15898 | attrs: {
|
15899 | value: _vm.value,
|
15900 | "default-value": _vm.defaultValue
|
15901 | ? new Date(_vm.defaultValue)
|
15902 | : null,
|
15903 | date: _vm.date,
|
15904 | "disabled-date": _vm.disabledDate
|
15905 | },
|
15906 | on: { pick: _vm.handleMonthPick }
|
15907 | })
|
15908 | ],
|
15909 | 1
|
15910 | )
|
15911 | ])
|
15912 | ],
|
15913 | 2
|
15914 | ),
|
15915 | _c(
|
15916 | "div",
|
15917 | {
|
15918 | directives: [
|
15919 | {
|
15920 | name: "show",
|
15921 | rawName: "v-show",
|
15922 | value: _vm.footerVisible && _vm.currentView === "date",
|
15923 | expression: "footerVisible && currentView === 'date'"
|
15924 | }
|
15925 | ],
|
15926 | staticClass: "el-picker-panel__footer"
|
15927 | },
|
15928 | [
|
15929 | _c(
|
15930 | "el-button",
|
15931 | {
|
15932 | directives: [
|
15933 | {
|
15934 | name: "show",
|
15935 | rawName: "v-show",
|
15936 | value: _vm.selectionMode !== "dates",
|
15937 | expression: "selectionMode !== 'dates'"
|
15938 | }
|
15939 | ],
|
15940 | staticClass: "el-picker-panel__link-btn",
|
15941 | attrs: { size: "mini", type: "text" },
|
15942 | on: { click: _vm.changeToNow }
|
15943 | },
|
15944 | [
|
15945 | _vm._v(
|
15946 | "\n " +
|
15947 | _vm._s(_vm.t("el.datepicker.now")) +
|
15948 | "\n "
|
15949 | )
|
15950 | ]
|
15951 | ),
|
15952 | _c(
|
15953 | "el-button",
|
15954 | {
|
15955 | staticClass: "el-picker-panel__link-btn",
|
15956 | attrs: { plain: "", size: "mini" },
|
15957 | on: { click: _vm.confirm }
|
15958 | },
|
15959 | [
|
15960 | _vm._v(
|
15961 | "\n " +
|
15962 | _vm._s(_vm.t("el.datepicker.confirm")) +
|
15963 | "\n "
|
15964 | )
|
15965 | ]
|
15966 | )
|
15967 | ],
|
15968 | 1
|
15969 | )
|
15970 | ]
|
15971 | )
|
15972 | ]
|
15973 | )
|
15974 | }
|
15975 | var datevue_type_template_id_2440d4ea_staticRenderFns = []
|
15976 | datevue_type_template_id_2440d4ea_render._withStripped = true
|
15977 |
|
15978 |
|
15979 |
|
15980 |
|
15981 |
|
15982 | var timevue_type_template_id_3d939089_render = function() {
|
15983 | var _vm = this
|
15984 | var _h = _vm.$createElement
|
15985 | var _c = _vm._self._c || _h
|
15986 | return _c(
|
15987 | "transition",
|
15988 | {
|
15989 | attrs: { name: "el-zoom-in-top" },
|
15990 | on: {
|
15991 | "after-leave": function($event) {
|
15992 | _vm.$emit("dodestroy")
|
15993 | }
|
15994 | }
|
15995 | },
|
15996 | [
|
15997 | _c(
|
15998 | "div",
|
15999 | {
|
16000 | directives: [
|
16001 | {
|
16002 | name: "show",
|
16003 | rawName: "v-show",
|
16004 | value: _vm.visible,
|
16005 | expression: "visible"
|
16006 | }
|
16007 | ],
|
16008 | staticClass: "el-time-panel el-popper",
|
16009 | class: _vm.popperClass
|
16010 | },
|
16011 | [
|
16012 | _c(
|
16013 | "div",
|
16014 | {
|
16015 | staticClass: "el-time-panel__content",
|
16016 | class: { "has-seconds": _vm.showSeconds }
|
16017 | },
|
16018 | [
|
16019 | _c("time-spinner", {
|
16020 | ref: "spinner",
|
16021 | attrs: {
|
16022 | "arrow-control": _vm.useArrow,
|
16023 | "show-seconds": _vm.showSeconds,
|
16024 | "am-pm-mode": _vm.amPmMode,
|
16025 | date: _vm.date
|
16026 | },
|
16027 | on: {
|
16028 | change: _vm.handleChange,
|
16029 | "select-range": _vm.setSelectionRange
|
16030 | }
|
16031 | })
|
16032 | ],
|
16033 | 1
|
16034 | ),
|
16035 | _c("div", { staticClass: "el-time-panel__footer" }, [
|
16036 | _c(
|
16037 | "button",
|
16038 | {
|
16039 | staticClass: "el-time-panel__btn cancel",
|
16040 | attrs: { type: "button" },
|
16041 | on: { click: _vm.handleCancel }
|
16042 | },
|
16043 | [_vm._v(_vm._s(_vm.t("el.datepicker.cancel")))]
|
16044 | ),
|
16045 | _c(
|
16046 | "button",
|
16047 | {
|
16048 | staticClass: "el-time-panel__btn",
|
16049 | class: { confirm: !_vm.disabled },
|
16050 | attrs: { type: "button" },
|
16051 | on: {
|
16052 | click: function($event) {
|
16053 | _vm.handleConfirm()
|
16054 | }
|
16055 | }
|
16056 | },
|
16057 | [_vm._v(_vm._s(_vm.t("el.datepicker.confirm")))]
|
16058 | )
|
16059 | ])
|
16060 | ]
|
16061 | )
|
16062 | ]
|
16063 | )
|
16064 | }
|
16065 | var timevue_type_template_id_3d939089_staticRenderFns = []
|
16066 | timevue_type_template_id_3d939089_render._withStripped = true
|
16067 |
|
16068 |
|
16069 |
|
16070 |
|
16071 |
|
16072 | var time_spinnervue_type_template_id_1facadeb_render = function() {
|
16073 | var _vm = this
|
16074 | var _h = _vm.$createElement
|
16075 | var _c = _vm._self._c || _h
|
16076 | return _c(
|
16077 | "div",
|
16078 | {
|
16079 | staticClass: "el-time-spinner",
|
16080 | class: { "has-seconds": _vm.showSeconds }
|
16081 | },
|
16082 | [
|
16083 | !_vm.arrowControl
|
16084 | ? [
|
16085 | _c(
|
16086 | "el-scrollbar",
|
16087 | {
|
16088 | ref: "hours",
|
16089 | staticClass: "el-time-spinner__wrapper",
|
16090 | attrs: {
|
16091 | "wrap-style": "max-height: inherit;",
|
16092 | "view-class": "el-time-spinner__list",
|
16093 | noresize: "",
|
16094 | tag: "ul"
|
16095 | },
|
16096 | nativeOn: {
|
16097 | mouseenter: function($event) {
|
16098 | _vm.emitSelectRange("hours")
|
16099 | },
|
16100 | mousemove: function($event) {
|
16101 | _vm.adjustCurrentSpinner("hours")
|
16102 | }
|
16103 | }
|
16104 | },
|
16105 | _vm._l(_vm.hoursList, function(disabled, hour) {
|
16106 | return _c(
|
16107 | "li",
|
16108 | {
|
16109 | key: hour,
|
16110 | staticClass: "el-time-spinner__item",
|
16111 | class: { active: hour === _vm.hours, disabled: disabled },
|
16112 | on: {
|
16113 | click: function($event) {
|
16114 | _vm.handleClick("hours", {
|
16115 | value: hour,
|
16116 | disabled: disabled
|
16117 | })
|
16118 | }
|
16119 | }
|
16120 | },
|
16121 | [
|
16122 | _vm._v(
|
16123 | _vm._s(
|
16124 | ("0" + (_vm.amPmMode ? hour % 12 || 12 : hour)).slice(
|
16125 | -2
|
16126 | )
|
16127 | ) + _vm._s(_vm.amPm(hour))
|
16128 | )
|
16129 | ]
|
16130 | )
|
16131 | }),
|
16132 | 0
|
16133 | ),
|
16134 | _c(
|
16135 | "el-scrollbar",
|
16136 | {
|
16137 | ref: "minutes",
|
16138 | staticClass: "el-time-spinner__wrapper",
|
16139 | attrs: {
|
16140 | "wrap-style": "max-height: inherit;",
|
16141 | "view-class": "el-time-spinner__list",
|
16142 | noresize: "",
|
16143 | tag: "ul"
|
16144 | },
|
16145 | nativeOn: {
|
16146 | mouseenter: function($event) {
|
16147 | _vm.emitSelectRange("minutes")
|
16148 | },
|
16149 | mousemove: function($event) {
|
16150 | _vm.adjustCurrentSpinner("minutes")
|
16151 | }
|
16152 | }
|
16153 | },
|
16154 | _vm._l(_vm.minutesList, function(enabled, key) {
|
16155 | return _c(
|
16156 | "li",
|
16157 | {
|
16158 | key: key,
|
16159 | staticClass: "el-time-spinner__item",
|
16160 | class: { active: key === _vm.minutes, disabled: !enabled },
|
16161 | on: {
|
16162 | click: function($event) {
|
16163 | _vm.handleClick("minutes", {
|
16164 | value: key,
|
16165 | disabled: false
|
16166 | })
|
16167 | }
|
16168 | }
|
16169 | },
|
16170 | [_vm._v(_vm._s(("0" + key).slice(-2)))]
|
16171 | )
|
16172 | }),
|
16173 | 0
|
16174 | ),
|
16175 | _c(
|
16176 | "el-scrollbar",
|
16177 | {
|
16178 | directives: [
|
16179 | {
|
16180 | name: "show",
|
16181 | rawName: "v-show",
|
16182 | value: _vm.showSeconds,
|
16183 | expression: "showSeconds"
|
16184 | }
|
16185 | ],
|
16186 | ref: "seconds",
|
16187 | staticClass: "el-time-spinner__wrapper",
|
16188 | attrs: {
|
16189 | "wrap-style": "max-height: inherit;",
|
16190 | "view-class": "el-time-spinner__list",
|
16191 | noresize: "",
|
16192 | tag: "ul"
|
16193 | },
|
16194 | nativeOn: {
|
16195 | mouseenter: function($event) {
|
16196 | _vm.emitSelectRange("seconds")
|
16197 | },
|
16198 | mousemove: function($event) {
|
16199 | _vm.adjustCurrentSpinner("seconds")
|
16200 | }
|
16201 | }
|
16202 | },
|
16203 | _vm._l(60, function(second, key) {
|
16204 | return _c(
|
16205 | "li",
|
16206 | {
|
16207 | key: key,
|
16208 | staticClass: "el-time-spinner__item",
|
16209 | class: { active: key === _vm.seconds },
|
16210 | on: {
|
16211 | click: function($event) {
|
16212 | _vm.handleClick("seconds", {
|
16213 | value: key,
|
16214 | disabled: false
|
16215 | })
|
16216 | }
|
16217 | }
|
16218 | },
|
16219 | [_vm._v(_vm._s(("0" + key).slice(-2)))]
|
16220 | )
|
16221 | }),
|
16222 | 0
|
16223 | )
|
16224 | ]
|
16225 | : _vm._e(),
|
16226 | _vm.arrowControl
|
16227 | ? [
|
16228 | _c(
|
16229 | "div",
|
16230 | {
|
16231 | staticClass: "el-time-spinner__wrapper is-arrow",
|
16232 | on: {
|
16233 | mouseenter: function($event) {
|
16234 | _vm.emitSelectRange("hours")
|
16235 | }
|
16236 | }
|
16237 | },
|
16238 | [
|
16239 | _c("i", {
|
16240 | directives: [
|
16241 | {
|
16242 | name: "repeat-click",
|
16243 | rawName: "v-repeat-click",
|
16244 | value: _vm.decrease,
|
16245 | expression: "decrease"
|
16246 | }
|
16247 | ],
|
16248 | staticClass: "el-time-spinner__arrow el-icon-arrow-up"
|
16249 | }),
|
16250 | _c("i", {
|
16251 | directives: [
|
16252 | {
|
16253 | name: "repeat-click",
|
16254 | rawName: "v-repeat-click",
|
16255 | value: _vm.increase,
|
16256 | expression: "increase"
|
16257 | }
|
16258 | ],
|
16259 | staticClass: "el-time-spinner__arrow el-icon-arrow-down"
|
16260 | }),
|
16261 | _c(
|
16262 | "ul",
|
16263 | { ref: "hours", staticClass: "el-time-spinner__list" },
|
16264 | _vm._l(_vm.arrowHourList, function(hour, key) {
|
16265 | return _c(
|
16266 | "li",
|
16267 | {
|
16268 | key: key,
|
16269 | staticClass: "el-time-spinner__item",
|
16270 | class: {
|
16271 | active: hour === _vm.hours,
|
16272 | disabled: _vm.hoursList[hour]
|
16273 | }
|
16274 | },
|
16275 | [
|
16276 | _vm._v(
|
16277 | _vm._s(
|
16278 | hour === undefined
|
16279 | ? ""
|
16280 | : (
|
16281 | "0" + (_vm.amPmMode ? hour % 12 || 12 : hour)
|
16282 | ).slice(-2) + _vm.amPm(hour)
|
16283 | )
|
16284 | )
|
16285 | ]
|
16286 | )
|
16287 | }),
|
16288 | 0
|
16289 | )
|
16290 | ]
|
16291 | ),
|
16292 | _c(
|
16293 | "div",
|
16294 | {
|
16295 | staticClass: "el-time-spinner__wrapper is-arrow",
|
16296 | on: {
|
16297 | mouseenter: function($event) {
|
16298 | _vm.emitSelectRange("minutes")
|
16299 | }
|
16300 | }
|
16301 | },
|
16302 | [
|
16303 | _c("i", {
|
16304 | directives: [
|
16305 | {
|
16306 | name: "repeat-click",
|
16307 | rawName: "v-repeat-click",
|
16308 | value: _vm.decrease,
|
16309 | expression: "decrease"
|
16310 | }
|
16311 | ],
|
16312 | staticClass: "el-time-spinner__arrow el-icon-arrow-up"
|
16313 | }),
|
16314 | _c("i", {
|
16315 | directives: [
|
16316 | {
|
16317 | name: "repeat-click",
|
16318 | rawName: "v-repeat-click",
|
16319 | value: _vm.increase,
|
16320 | expression: "increase"
|
16321 | }
|
16322 | ],
|
16323 | staticClass: "el-time-spinner__arrow el-icon-arrow-down"
|
16324 | }),
|
16325 | _c(
|
16326 | "ul",
|
16327 | { ref: "minutes", staticClass: "el-time-spinner__list" },
|
16328 | _vm._l(_vm.arrowMinuteList, function(minute, key) {
|
16329 | return _c(
|
16330 | "li",
|
16331 | {
|
16332 | key: key,
|
16333 | staticClass: "el-time-spinner__item",
|
16334 | class: { active: minute === _vm.minutes }
|
16335 | },
|
16336 | [
|
16337 | _vm._v(
|
16338 | "\n " +
|
16339 | _vm._s(
|
16340 | minute === undefined
|
16341 | ? ""
|
16342 | : ("0" + minute).slice(-2)
|
16343 | ) +
|
16344 | "\n "
|
16345 | )
|
16346 | ]
|
16347 | )
|
16348 | }),
|
16349 | 0
|
16350 | )
|
16351 | ]
|
16352 | ),
|
16353 | _vm.showSeconds
|
16354 | ? _c(
|
16355 | "div",
|
16356 | {
|
16357 | staticClass: "el-time-spinner__wrapper is-arrow",
|
16358 | on: {
|
16359 | mouseenter: function($event) {
|
16360 | _vm.emitSelectRange("seconds")
|
16361 | }
|
16362 | }
|
16363 | },
|
16364 | [
|
16365 | _c("i", {
|
16366 | directives: [
|
16367 | {
|
16368 | name: "repeat-click",
|
16369 | rawName: "v-repeat-click",
|
16370 | value: _vm.decrease,
|
16371 | expression: "decrease"
|
16372 | }
|
16373 | ],
|
16374 | staticClass: "el-time-spinner__arrow el-icon-arrow-up"
|
16375 | }),
|
16376 | _c("i", {
|
16377 | directives: [
|
16378 | {
|
16379 | name: "repeat-click",
|
16380 | rawName: "v-repeat-click",
|
16381 | value: _vm.increase,
|
16382 | expression: "increase"
|
16383 | }
|
16384 | ],
|
16385 | staticClass: "el-time-spinner__arrow el-icon-arrow-down"
|
16386 | }),
|
16387 | _c(
|
16388 | "ul",
|
16389 | { ref: "seconds", staticClass: "el-time-spinner__list" },
|
16390 | _vm._l(_vm.arrowSecondList, function(second, key) {
|
16391 | return _c(
|
16392 | "li",
|
16393 | {
|
16394 | key: key,
|
16395 | staticClass: "el-time-spinner__item",
|
16396 | class: { active: second === _vm.seconds }
|
16397 | },
|
16398 | [
|
16399 | _vm._v(
|
16400 | "\n " +
|
16401 | _vm._s(
|
16402 | second === undefined
|
16403 | ? ""
|
16404 | : ("0" + second).slice(-2)
|
16405 | ) +
|
16406 | "\n "
|
16407 | )
|
16408 | ]
|
16409 | )
|
16410 | }),
|
16411 | 0
|
16412 | )
|
16413 | ]
|
16414 | )
|
16415 | : _vm._e()
|
16416 | ]
|
16417 | : _vm._e()
|
16418 | ],
|
16419 | 2
|
16420 | )
|
16421 | }
|
16422 | var time_spinnervue_type_template_id_1facadeb_staticRenderFns = []
|
16423 | time_spinnervue_type_template_id_1facadeb_render._withStripped = true
|
16424 |
|
16425 |
|
16426 |
|
16427 |
|
16428 |
|
16429 |
|
16430 |
|
16431 |
|
16432 |
|
16433 |
|
16434 |
|
16435 |
|
16436 |
|
16437 |
|
16438 |
|
16439 |
|
16440 |
|
16441 |
|
16442 |
|
16443 |
|
16444 |
|
16445 |
|
16446 |
|
16447 |
|
16448 |
|
16449 |
|
16450 |
|
16451 |
|
16452 |
|
16453 |
|
16454 |
|
16455 |
|
16456 |
|
16457 |
|
16458 |
|
16459 |
|
16460 |
|
16461 |
|
16462 |
|
16463 |
|
16464 |
|
16465 |
|
16466 |
|
16467 |
|
16468 |
|
16469 |
|
16470 |
|
16471 |
|
16472 |
|
16473 |
|
16474 |
|
16475 |
|
16476 |
|
16477 |
|
16478 |
|
16479 |
|
16480 |
|
16481 |
|
16482 |
|
16483 |
|
16484 |
|
16485 |
|
16486 |
|
16487 |
|
16488 |
|
16489 |
|
16490 |
|
16491 |
|
16492 |
|
16493 |
|
16494 |
|
16495 |
|
16496 |
|
16497 |
|
16498 |
|
16499 |
|
16500 |
|
16501 |
|
16502 |
|
16503 |
|
16504 |
|
16505 |
|
16506 |
|
16507 |
|
16508 |
|
16509 |
|
16510 |
|
16511 |
|
16512 |
|
16513 |
|
16514 |
|
16515 |
|
16516 |
|
16517 |
|
16518 |
|
16519 |
|
16520 |
|
16521 |
|
16522 |
|
16523 |
|
16524 |
|
16525 |
|
16526 |
|
16527 |
|
16528 |
|
16529 |
|
16530 |
|
16531 |
|
16532 |
|
16533 |
|
16534 |
|
16535 |
|
16536 | var time_spinnervue_type_script_lang_js_ = ({
|
16537 | components: { ElScrollbar: scrollbar_default.a },
|
16538 |
|
16539 | directives: {
|
16540 | repeatClick: repeat_click
|
16541 | },
|
16542 |
|
16543 | props: {
|
16544 | date: {},
|
16545 | defaultValue: {},
|
16546 | showSeconds: {
|
16547 | type: Boolean,
|
16548 | default: true
|
16549 | },
|
16550 | arrowControl: Boolean,
|
16551 | amPmMode: {
|
16552 | type: String,
|
16553 | default: ''
|
16554 | }
|
16555 | },
|
16556 |
|
16557 | computed: {
|
16558 | hours: function hours() {
|
16559 | return this.date.getHours();
|
16560 | },
|
16561 | minutes: function minutes() {
|
16562 | return this.date.getMinutes();
|
16563 | },
|
16564 | seconds: function seconds() {
|
16565 | return this.date.getSeconds();
|
16566 | },
|
16567 | hoursList: function hoursList() {
|
16568 | return Object(date_util_["getRangeHours"])(this.selectableRange);
|
16569 | },
|
16570 | minutesList: function minutesList() {
|
16571 | return Object(date_util_["getRangeMinutes"])(this.selectableRange, this.hours);
|
16572 | },
|
16573 | arrowHourList: function arrowHourList() {
|
16574 | var hours = this.hours;
|
16575 | return [hours > 0 ? hours - 1 : undefined, hours, hours < 23 ? hours + 1 : undefined];
|
16576 | },
|
16577 | arrowMinuteList: function arrowMinuteList() {
|
16578 | var minutes = this.minutes;
|
16579 | return [minutes > 0 ? minutes - 1 : undefined, minutes, minutes < 59 ? minutes + 1 : undefined];
|
16580 | },
|
16581 | arrowSecondList: function arrowSecondList() {
|
16582 | var seconds = this.seconds;
|
16583 | return [seconds > 0 ? seconds - 1 : undefined, seconds, seconds < 59 ? seconds + 1 : undefined];
|
16584 | }
|
16585 | },
|
16586 |
|
16587 | data: function data() {
|
16588 | return {
|
16589 | selectableRange: [],
|
16590 | currentScrollbar: null
|
16591 | };
|
16592 | },
|
16593 | mounted: function mounted() {
|
16594 | var _this = this;
|
16595 |
|
16596 | this.$nextTick(function () {
|
16597 | !_this.arrowControl && _this.bindScrollEvent();
|
16598 | });
|
16599 | },
|
16600 |
|
16601 |
|
16602 | methods: {
|
16603 | increase: function increase() {
|
16604 | this.scrollDown(1);
|
16605 | },
|
16606 | decrease: function decrease() {
|
16607 | this.scrollDown(-1);
|
16608 | },
|
16609 | modifyDateField: function modifyDateField(type, value) {
|
16610 | switch (type) {
|
16611 | case 'hours':
|
16612 | this.$emit('change', Object(date_util_["modifyTime"])(this.date, value, this.minutes, this.seconds));break;
|
16613 | case 'minutes':
|
16614 | this.$emit('change', Object(date_util_["modifyTime"])(this.date, this.hours, value, this.seconds));break;
|
16615 | case 'seconds':
|
16616 | this.$emit('change', Object(date_util_["modifyTime"])(this.date, this.hours, this.minutes, value));break;
|
16617 | }
|
16618 | },
|
16619 | handleClick: function handleClick(type, _ref) {
|
16620 | var value = _ref.value,
|
16621 | disabled = _ref.disabled;
|
16622 |
|
16623 | if (!disabled) {
|
16624 | this.modifyDateField(type, value);
|
16625 | this.emitSelectRange(type);
|
16626 | this.adjustSpinner(type, value);
|
16627 | }
|
16628 | },
|
16629 | emitSelectRange: function emitSelectRange(type) {
|
16630 | if (type === 'hours') {
|
16631 | this.$emit('select-range', 0, 2);
|
16632 | } else if (type === 'minutes') {
|
16633 | this.$emit('select-range', 3, 5);
|
16634 | } else if (type === 'seconds') {
|
16635 | this.$emit('select-range', 6, 8);
|
16636 | }
|
16637 | this.currentScrollbar = type;
|
16638 | },
|
16639 | bindScrollEvent: function bindScrollEvent() {
|
16640 | var _this2 = this;
|
16641 |
|
16642 | var bindFuntion = function bindFuntion(type) {
|
16643 | _this2.$refs[type].wrap.onscroll = function (e) {
|
16644 |
|
16645 |
|
16646 | _this2.handleScroll(type, e);
|
16647 | };
|
16648 | };
|
16649 | bindFuntion('hours');
|
16650 | bindFuntion('minutes');
|
16651 | bindFuntion('seconds');
|
16652 | },
|
16653 | handleScroll: function handleScroll(type) {
|
16654 | var value = Math.min(Math.round((this.$refs[type].wrap.scrollTop - (this.scrollBarHeight(type) * 0.5 - 10) / this.typeItemHeight(type) + 3) / this.typeItemHeight(type)), type === 'hours' ? 23 : 59);
|
16655 | this.modifyDateField(type, value);
|
16656 | },
|
16657 |
|
16658 |
|
16659 |
|
16660 |
|
16661 |
|
16662 | adjustSpinners: function adjustSpinners() {
|
16663 | this.adjustSpinner('hours', this.hours);
|
16664 | this.adjustSpinner('minutes', this.minutes);
|
16665 | this.adjustSpinner('seconds', this.seconds);
|
16666 | },
|
16667 | adjustCurrentSpinner: function adjustCurrentSpinner(type) {
|
16668 | this.adjustSpinner(type, this[type]);
|
16669 | },
|
16670 | adjustSpinner: function adjustSpinner(type, value) {
|
16671 | if (this.arrowControl) return;
|
16672 | var el = this.$refs[type].wrap;
|
16673 | if (el) {
|
16674 | el.scrollTop = Math.max(0, value * this.typeItemHeight(type));
|
16675 | }
|
16676 | },
|
16677 | scrollDown: function scrollDown(step) {
|
16678 | var _this3 = this;
|
16679 |
|
16680 | if (!this.currentScrollbar) {
|
16681 | this.emitSelectRange('hours');
|
16682 | }
|
16683 |
|
16684 | var label = this.currentScrollbar;
|
16685 | var hoursList = this.hoursList;
|
16686 | var now = this[label];
|
16687 |
|
16688 | if (this.currentScrollbar === 'hours') {
|
16689 | var total = Math.abs(step);
|
16690 | step = step > 0 ? 1 : -1;
|
16691 | var length = hoursList.length;
|
16692 | while (length-- && total) {
|
16693 | now = (now + step + hoursList.length) % hoursList.length;
|
16694 | if (hoursList[now]) {
|
16695 | continue;
|
16696 | }
|
16697 | total--;
|
16698 | }
|
16699 | if (hoursList[now]) return;
|
16700 | } else {
|
16701 | now = (now + step + 60) % 60;
|
16702 | }
|
16703 |
|
16704 | this.modifyDateField(label, now);
|
16705 | this.adjustSpinner(label, now);
|
16706 | this.$nextTick(function () {
|
16707 | return _this3.emitSelectRange(_this3.currentScrollbar);
|
16708 | });
|
16709 | },
|
16710 | amPm: function amPm(hour) {
|
16711 | var shouldShowAmPm = this.amPmMode.toLowerCase() === 'a';
|
16712 | if (!shouldShowAmPm) return '';
|
16713 | var isCapital = this.amPmMode === 'A';
|
16714 | var content = hour < 12 ? ' am' : ' pm';
|
16715 | if (isCapital) content = content.toUpperCase();
|
16716 | return content;
|
16717 | },
|
16718 | typeItemHeight: function typeItemHeight(type) {
|
16719 | return this.$refs[type].$el.querySelector('li').offsetHeight;
|
16720 | },
|
16721 | scrollBarHeight: function scrollBarHeight(type) {
|
16722 | return this.$refs[type].$el.offsetHeight;
|
16723 | }
|
16724 | }
|
16725 | });
|
16726 |
|
16727 | var basic_time_spinnervue_type_script_lang_js_ = (time_spinnervue_type_script_lang_js_);
|
16728 |
|
16729 |
|
16730 |
|
16731 |
|
16732 |
|
16733 |
|
16734 |
|
16735 |
|
16736 | var time_spinner_component = normalizeComponent(
|
16737 | basic_time_spinnervue_type_script_lang_js_,
|
16738 | time_spinnervue_type_template_id_1facadeb_render,
|
16739 | time_spinnervue_type_template_id_1facadeb_staticRenderFns,
|
16740 | false,
|
16741 | null,
|
16742 | null,
|
16743 | null
|
16744 |
|
16745 | )
|
16746 |
|
16747 |
|
16748 | if (false) { var time_spinner_api; }
|
16749 | time_spinner_component.options.__file = "packages/date-picker/src/basic/time-spinner.vue"
|
16750 | var time_spinner = (time_spinner_component.exports);
|
16751 |
|
16752 |
|
16753 |
|
16754 |
|
16755 |
|
16756 |
|
16757 |
|
16758 |
|
16759 |
|
16760 |
|
16761 |
|
16762 |
|
16763 |
|
16764 |
|
16765 |
|
16766 |
|
16767 |
|
16768 |
|
16769 |
|
16770 |
|
16771 |
|
16772 |
|
16773 |
|
16774 |
|
16775 |
|
16776 |
|
16777 |
|
16778 |
|
16779 |
|
16780 |
|
16781 |
|
16782 |
|
16783 |
|
16784 |
|
16785 |
|
16786 |
|
16787 |
|
16788 |
|
16789 | var timevue_type_script_lang_js_ = ({
|
16790 | mixins: [locale_default.a],
|
16791 |
|
16792 | components: {
|
16793 | TimeSpinner: time_spinner
|
16794 | },
|
16795 |
|
16796 | props: {
|
16797 | visible: Boolean,
|
16798 | timeArrowControl: Boolean
|
16799 | },
|
16800 |
|
16801 | watch: {
|
16802 | visible: function visible(val) {
|
16803 | var _this = this;
|
16804 |
|
16805 | if (val) {
|
16806 | this.oldValue = this.value;
|
16807 | this.$nextTick(function () {
|
16808 | return _this.$refs.spinner.emitSelectRange('hours');
|
16809 | });
|
16810 | } else {
|
16811 | this.needInitAdjust = true;
|
16812 | }
|
16813 | },
|
16814 | value: function value(newVal) {
|
16815 | var _this2 = this;
|
16816 |
|
16817 | var date = void 0;
|
16818 | if (newVal instanceof Date) {
|
16819 | date = Object(date_util_["limitTimeRange"])(newVal, this.selectableRange, this.format);
|
16820 | } else if (!newVal) {
|
16821 | date = this.defaultValue ? new Date(this.defaultValue) : new Date();
|
16822 | }
|
16823 |
|
16824 | this.date = date;
|
16825 | if (this.visible && this.needInitAdjust) {
|
16826 | this.$nextTick(function (_) {
|
16827 | return _this2.adjustSpinners();
|
16828 | });
|
16829 | this.needInitAdjust = false;
|
16830 | }
|
16831 | },
|
16832 | selectableRange: function selectableRange(val) {
|
16833 | this.$refs.spinner.selectableRange = val;
|
16834 | },
|
16835 | defaultValue: function defaultValue(val) {
|
16836 | if (!Object(date_util_["isDate"])(this.value)) {
|
16837 | this.date = val ? new Date(val) : new Date();
|
16838 | }
|
16839 | }
|
16840 | },
|
16841 |
|
16842 | data: function data() {
|
16843 | return {
|
16844 | popperClass: '',
|
16845 | format: 'HH:mm:ss',
|
16846 | value: '',
|
16847 | defaultValue: null,
|
16848 | date: new Date(),
|
16849 | oldValue: new Date(),
|
16850 | selectableRange: [],
|
16851 | selectionRange: [0, 2],
|
16852 | disabled: false,
|
16853 | arrowControl: false,
|
16854 | needInitAdjust: true
|
16855 | };
|
16856 | },
|
16857 |
|
16858 |
|
16859 | computed: {
|
16860 | showSeconds: function showSeconds() {
|
16861 | return (this.format || '').indexOf('ss') !== -1;
|
16862 | },
|
16863 | useArrow: function useArrow() {
|
16864 | return this.arrowControl || this.timeArrowControl || false;
|
16865 | },
|
16866 | amPmMode: function amPmMode() {
|
16867 | if ((this.format || '').indexOf('A') !== -1) return 'A';
|
16868 | if ((this.format || '').indexOf('a') !== -1) return 'a';
|
16869 | return '';
|
16870 | }
|
16871 | },
|
16872 |
|
16873 | methods: {
|
16874 | handleCancel: function handleCancel() {
|
16875 | this.$emit('pick', this.oldValue, false);
|
16876 | },
|
16877 | handleChange: function handleChange(date) {
|
16878 |
|
16879 | if (this.visible) {
|
16880 | this.date = Object(date_util_["clearMilliseconds"])(date);
|
16881 |
|
16882 | if (this.isValidValue(this.date)) {
|
16883 | this.$emit('pick', this.date, true);
|
16884 | }
|
16885 | }
|
16886 | },
|
16887 | setSelectionRange: function setSelectionRange(start, end) {
|
16888 | this.$emit('select-range', start, end);
|
16889 | this.selectionRange = [start, end];
|
16890 | },
|
16891 | handleConfirm: function handleConfirm() {
|
16892 | var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
16893 | var first = arguments[1];
|
16894 |
|
16895 | if (first) return;
|
16896 | var date = Object(date_util_["clearMilliseconds"])(Object(date_util_["limitTimeRange"])(this.date, this.selectableRange, this.format));
|
16897 | this.$emit('pick', date, visible, first);
|
16898 | },
|
16899 | handleKeydown: function handleKeydown(event) {
|
16900 | var keyCode = event.keyCode;
|
16901 | var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
|
16902 |
|
16903 |
|
16904 | if (keyCode === 37 || keyCode === 39) {
|
16905 | var step = mapping[keyCode];
|
16906 | this.changeSelectionRange(step);
|
16907 | event.preventDefault();
|
16908 | return;
|
16909 | }
|
16910 |
|
16911 |
|
16912 | if (keyCode === 38 || keyCode === 40) {
|
16913 | var _step = mapping[keyCode];
|
16914 | this.$refs.spinner.scrollDown(_step);
|
16915 | event.preventDefault();
|
16916 | return;
|
16917 | }
|
16918 | },
|
16919 | isValidValue: function isValidValue(date) {
|
16920 | return Object(date_util_["timeWithinRange"])(date, this.selectableRange, this.format);
|
16921 | },
|
16922 | adjustSpinners: function adjustSpinners() {
|
16923 | return this.$refs.spinner.adjustSpinners();
|
16924 | },
|
16925 | changeSelectionRange: function changeSelectionRange(step) {
|
16926 | var list = [0, 3].concat(this.showSeconds ? [6] : []);
|
16927 | var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []);
|
16928 | var index = list.indexOf(this.selectionRange[0]);
|
16929 | var next = (index + step + list.length) % list.length;
|
16930 | this.$refs.spinner.emitSelectRange(mapping[next]);
|
16931 | }
|
16932 | },
|
16933 |
|
16934 | mounted: function mounted() {
|
16935 | var _this3 = this;
|
16936 |
|
16937 | this.$nextTick(function () {
|
16938 | return _this3.handleConfirm(true, true);
|
16939 | });
|
16940 | this.$emit('mounted');
|
16941 | }
|
16942 | });
|
16943 |
|
16944 | var panel_timevue_type_script_lang_js_ = (timevue_type_script_lang_js_);
|
16945 |
|
16946 |
|
16947 |
|
16948 |
|
16949 |
|
16950 |
|
16951 |
|
16952 |
|
16953 | var time_component = normalizeComponent(
|
16954 | panel_timevue_type_script_lang_js_,
|
16955 | timevue_type_template_id_3d939089_render,
|
16956 | timevue_type_template_id_3d939089_staticRenderFns,
|
16957 | false,
|
16958 | null,
|
16959 | null,
|
16960 | null
|
16961 |
|
16962 | )
|
16963 |
|
16964 |
|
16965 | if (false) { var time_api; }
|
16966 | time_component.options.__file = "packages/date-picker/src/panel/time.vue"
|
16967 | var panel_time = (time_component.exports);
|
16968 |
|
16969 | var year_tablevue_type_template_id_c86ab5e0_render = function() {
|
16970 | var _vm = this
|
16971 | var _h = _vm.$createElement
|
16972 | var _c = _vm._self._c || _h
|
16973 | return _c(
|
16974 | "table",
|
16975 | { staticClass: "el-year-table", on: { click: _vm.handleYearTableClick } },
|
16976 | [
|
16977 | _c("tbody", [
|
16978 | _c("tr", [
|
16979 | _c(
|
16980 | "td",
|
16981 | {
|
16982 | staticClass: "available",
|
16983 | class: _vm.getCellStyle(_vm.startYear + 0)
|
16984 | },
|
16985 | [_c("a", { staticClass: "cell" }, [_vm._v(_vm._s(_vm.startYear))])]
|
16986 | ),
|
16987 | _c(
|
16988 | "td",
|
16989 | {
|
16990 | staticClass: "available",
|
16991 | class: _vm.getCellStyle(_vm.startYear + 1)
|
16992 | },
|
16993 | [
|
16994 | _c("a", { staticClass: "cell" }, [
|
16995 | _vm._v(_vm._s(_vm.startYear + 1))
|
16996 | ])
|
16997 | ]
|
16998 | ),
|
16999 | _c(
|
17000 | "td",
|
17001 | {
|
17002 | staticClass: "available",
|
17003 | class: _vm.getCellStyle(_vm.startYear + 2)
|
17004 | },
|
17005 | [
|
17006 | _c("a", { staticClass: "cell" }, [
|
17007 | _vm._v(_vm._s(_vm.startYear + 2))
|
17008 | ])
|
17009 | ]
|
17010 | ),
|
17011 | _c(
|
17012 | "td",
|
17013 | {
|
17014 | staticClass: "available",
|
17015 | class: _vm.getCellStyle(_vm.startYear + 3)
|
17016 | },
|
17017 | [
|
17018 | _c("a", { staticClass: "cell" }, [
|
17019 | _vm._v(_vm._s(_vm.startYear + 3))
|
17020 | ])
|
17021 | ]
|
17022 | )
|
17023 | ]),
|
17024 | _c("tr", [
|
17025 | _c(
|
17026 | "td",
|
17027 | {
|
17028 | staticClass: "available",
|
17029 | class: _vm.getCellStyle(_vm.startYear + 4)
|
17030 | },
|
17031 | [
|
17032 | _c("a", { staticClass: "cell" }, [
|
17033 | _vm._v(_vm._s(_vm.startYear + 4))
|
17034 | ])
|
17035 | ]
|
17036 | ),
|
17037 | _c(
|
17038 | "td",
|
17039 | {
|
17040 | staticClass: "available",
|
17041 | class: _vm.getCellStyle(_vm.startYear + 5)
|
17042 | },
|
17043 | [
|
17044 | _c("a", { staticClass: "cell" }, [
|
17045 | _vm._v(_vm._s(_vm.startYear + 5))
|
17046 | ])
|
17047 | ]
|
17048 | ),
|
17049 | _c(
|
17050 | "td",
|
17051 | {
|
17052 | staticClass: "available",
|
17053 | class: _vm.getCellStyle(_vm.startYear + 6)
|
17054 | },
|
17055 | [
|
17056 | _c("a", { staticClass: "cell" }, [
|
17057 | _vm._v(_vm._s(_vm.startYear + 6))
|
17058 | ])
|
17059 | ]
|
17060 | ),
|
17061 | _c(
|
17062 | "td",
|
17063 | {
|
17064 | staticClass: "available",
|
17065 | class: _vm.getCellStyle(_vm.startYear + 7)
|
17066 | },
|
17067 | [
|
17068 | _c("a", { staticClass: "cell" }, [
|
17069 | _vm._v(_vm._s(_vm.startYear + 7))
|
17070 | ])
|
17071 | ]
|
17072 | )
|
17073 | ]),
|
17074 | _c("tr", [
|
17075 | _c(
|
17076 | "td",
|
17077 | {
|
17078 | staticClass: "available",
|
17079 | class: _vm.getCellStyle(_vm.startYear + 8)
|
17080 | },
|
17081 | [
|
17082 | _c("a", { staticClass: "cell" }, [
|
17083 | _vm._v(_vm._s(_vm.startYear + 8))
|
17084 | ])
|
17085 | ]
|
17086 | ),
|
17087 | _c(
|
17088 | "td",
|
17089 | {
|
17090 | staticClass: "available",
|
17091 | class: _vm.getCellStyle(_vm.startYear + 9)
|
17092 | },
|
17093 | [
|
17094 | _c("a", { staticClass: "cell" }, [
|
17095 | _vm._v(_vm._s(_vm.startYear + 9))
|
17096 | ])
|
17097 | ]
|
17098 | ),
|
17099 | _c("td"),
|
17100 | _c("td")
|
17101 | ])
|
17102 | ])
|
17103 | ]
|
17104 | )
|
17105 | }
|
17106 | var year_tablevue_type_template_id_c86ab5e0_staticRenderFns = []
|
17107 | year_tablevue_type_template_id_c86ab5e0_render._withStripped = true
|
17108 |
|
17109 |
|
17110 |
|
17111 |
|
17112 |
|
17113 |
|
17114 |
|
17115 |
|
17116 |
|
17117 |
|
17118 |
|
17119 |
|
17120 |
|
17121 |
|
17122 |
|
17123 |
|
17124 |
|
17125 |
|
17126 |
|
17127 |
|
17128 |
|
17129 |
|
17130 |
|
17131 |
|
17132 |
|
17133 |
|
17134 |
|
17135 |
|
17136 |
|
17137 |
|
17138 |
|
17139 |
|
17140 |
|
17141 |
|
17142 |
|
17143 |
|
17144 |
|
17145 |
|
17146 |
|
17147 |
|
17148 |
|
17149 |
|
17150 |
|
17151 |
|
17152 |
|
17153 |
|
17154 |
|
17155 |
|
17156 |
|
17157 |
|
17158 |
|
17159 |
|
17160 |
|
17161 |
|
17162 |
|
17163 | var year_tablevue_type_script_lang_js_datesInYear = function datesInYear(year) {
|
17164 | var numOfDays = Object(date_util_["getDayCountOfYear"])(year);
|
17165 | var firstDay = new Date(year, 0, 1);
|
17166 | return Object(date_util_["range"])(numOfDays).map(function (n) {
|
17167 | return Object(date_util_["nextDate"])(firstDay, n);
|
17168 | });
|
17169 | };
|
17170 |
|
17171 | var year_tablevue_type_script_lang_js_ = ({
|
17172 | props: {
|
17173 | disabledDate: {},
|
17174 | value: {},
|
17175 | defaultValue: {
|
17176 | validator: function validator(val) {
|
17177 |
|
17178 | return val === null || val instanceof Date && Object(date_util_["isDate"])(val);
|
17179 | }
|
17180 | },
|
17181 | date: {}
|
17182 | },
|
17183 |
|
17184 | computed: {
|
17185 | startYear: function startYear() {
|
17186 | return Math.floor(this.date.getFullYear() / 10) * 10;
|
17187 | }
|
17188 | },
|
17189 |
|
17190 | methods: {
|
17191 | getCellStyle: function getCellStyle(year) {
|
17192 | var style = {};
|
17193 | var today = new Date();
|
17194 |
|
17195 | style.disabled = typeof this.disabledDate === 'function' ? year_tablevue_type_script_lang_js_datesInYear(year).every(this.disabledDate) : false;
|
17196 | style.current = Object(util_["arrayFindIndex"])(Object(util_["coerceTruthyValueToArray"])(this.value), function (date) {
|
17197 | return date.getFullYear() === year;
|
17198 | }) >= 0;
|
17199 | style.today = today.getFullYear() === year;
|
17200 | style.default = this.defaultValue && this.defaultValue.getFullYear() === year;
|
17201 |
|
17202 | return style;
|
17203 | },
|
17204 | handleYearTableClick: function handleYearTableClick(event) {
|
17205 | var target = event.target;
|
17206 | if (target.tagName === 'A') {
|
17207 | if (Object(dom_["hasClass"])(target.parentNode, 'disabled')) return;
|
17208 | var year = target.textContent || target.innerText;
|
17209 | this.$emit('pick', Number(year));
|
17210 | }
|
17211 | }
|
17212 | }
|
17213 | });
|
17214 |
|
17215 | var basic_year_tablevue_type_script_lang_js_ = (year_tablevue_type_script_lang_js_);
|
17216 |
|
17217 |
|
17218 |
|
17219 |
|
17220 |
|
17221 |
|
17222 |
|
17223 |
|
17224 | var year_table_component = normalizeComponent(
|
17225 | basic_year_tablevue_type_script_lang_js_,
|
17226 | year_tablevue_type_template_id_c86ab5e0_render,
|
17227 | year_tablevue_type_template_id_c86ab5e0_staticRenderFns,
|
17228 | false,
|
17229 | null,
|
17230 | null,
|
17231 | null
|
17232 |
|
17233 | )
|
17234 |
|
17235 |
|
17236 | if (false) { var year_table_api; }
|
17237 | year_table_component.options.__file = "packages/date-picker/src/basic/year-table.vue"
|
17238 | var year_table = (year_table_component.exports);
|
17239 |
|
17240 | var month_tablevue_type_template_id_654d4f42_render = function() {
|
17241 | var _vm = this
|
17242 | var _h = _vm.$createElement
|
17243 | var _c = _vm._self._c || _h
|
17244 | return _c(
|
17245 | "table",
|
17246 | {
|
17247 | staticClass: "el-month-table",
|
17248 | on: { click: _vm.handleMonthTableClick, mousemove: _vm.handleMouseMove }
|
17249 | },
|
17250 | [
|
17251 | _c(
|
17252 | "tbody",
|
17253 | _vm._l(_vm.rows, function(row, key) {
|
17254 | return _c(
|
17255 | "tr",
|
17256 | { key: key },
|
17257 | _vm._l(row, function(cell, key) {
|
17258 | return _c("td", { key: key, class: _vm.getCellStyle(cell) }, [
|
17259 | _c("div", [
|
17260 | _c("a", { staticClass: "cell" }, [
|
17261 | _vm._v(
|
17262 | _vm._s(
|
17263 | _vm.t("el.datepicker.months." + _vm.months[cell.text])
|
17264 | )
|
17265 | )
|
17266 | ])
|
17267 | ])
|
17268 | ])
|
17269 | }),
|
17270 | 0
|
17271 | )
|
17272 | }),
|
17273 | 0
|
17274 | )
|
17275 | ]
|
17276 | )
|
17277 | }
|
17278 | var month_tablevue_type_template_id_654d4f42_staticRenderFns = []
|
17279 | month_tablevue_type_template_id_654d4f42_render._withStripped = true
|
17280 |
|
17281 |
|
17282 |
|
17283 |
|
17284 |
|
17285 |
|
17286 |
|
17287 |
|
17288 |
|
17289 |
|
17290 |
|
17291 |
|
17292 |
|
17293 |
|
17294 |
|
17295 |
|
17296 |
|
17297 |
|
17298 |
|
17299 |
|
17300 |
|
17301 |
|
17302 |
|
17303 |
|
17304 |
|
17305 | var month_tablevue_type_script_lang_js_datesInMonth = function datesInMonth(year, month) {
|
17306 | var numOfDays = Object(date_util_["getDayCountOfMonth"])(year, month);
|
17307 | var firstDay = new Date(year, month, 1);
|
17308 | return Object(date_util_["range"])(numOfDays).map(function (n) {
|
17309 | return Object(date_util_["nextDate"])(firstDay, n);
|
17310 | });
|
17311 | };
|
17312 |
|
17313 | var clearDate = function clearDate(date) {
|
17314 | return new Date(date.getFullYear(), date.getMonth());
|
17315 | };
|
17316 |
|
17317 | var getMonthTimestamp = function getMonthTimestamp(time) {
|
17318 | if (typeof time === 'number' || typeof time === 'string') {
|
17319 | return clearDate(new Date(time)).getTime();
|
17320 | } else if (time instanceof Date) {
|
17321 | return clearDate(time).getTime();
|
17322 | } else {
|
17323 | return NaN;
|
17324 | }
|
17325 | };
|
17326 | var month_tablevue_type_script_lang_js_ = ({
|
17327 | props: {
|
17328 | disabledDate: {},
|
17329 | value: {},
|
17330 | selectionMode: {
|
17331 | default: 'month'
|
17332 | },
|
17333 | minDate: {},
|
17334 |
|
17335 | maxDate: {},
|
17336 | defaultValue: {
|
17337 | validator: function validator(val) {
|
17338 |
|
17339 | return val === null || Object(date_util_["isDate"])(val) || Array.isArray(val) && val.every(date_util_["isDate"]);
|
17340 | }
|
17341 | },
|
17342 | date: {},
|
17343 | rangeState: {
|
17344 | default: function _default() {
|
17345 | return {
|
17346 | endDate: null,
|
17347 | selecting: false
|
17348 | };
|
17349 | }
|
17350 | }
|
17351 | },
|
17352 |
|
17353 | mixins: [locale_default.a],
|
17354 |
|
17355 | watch: {
|
17356 | 'rangeState.endDate': function rangeStateEndDate(newVal) {
|
17357 | this.markRange(this.minDate, newVal);
|
17358 | },
|
17359 | minDate: function minDate(newVal, oldVal) {
|
17360 | if (getMonthTimestamp(newVal) !== getMonthTimestamp(oldVal)) {
|
17361 | this.markRange(this.minDate, this.maxDate);
|
17362 | }
|
17363 | },
|
17364 | maxDate: function maxDate(newVal, oldVal) {
|
17365 | if (getMonthTimestamp(newVal) !== getMonthTimestamp(oldVal)) {
|
17366 | this.markRange(this.minDate, this.maxDate);
|
17367 | }
|
17368 | }
|
17369 | },
|
17370 |
|
17371 | data: function data() {
|
17372 | return {
|
17373 | months: ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'],
|
17374 | tableRows: [[], [], []],
|
17375 | lastRow: null,
|
17376 | lastColumn: null
|
17377 | };
|
17378 | },
|
17379 |
|
17380 |
|
17381 | methods: {
|
17382 | cellMatchesDate: function cellMatchesDate(cell, date) {
|
17383 | var value = new Date(date);
|
17384 | return this.date.getFullYear() === value.getFullYear() && Number(cell.text) === value.getMonth();
|
17385 | },
|
17386 | getCellStyle: function getCellStyle(cell) {
|
17387 | var _this = this;
|
17388 |
|
17389 | var style = {};
|
17390 | var year = this.date.getFullYear();
|
17391 | var today = new Date();
|
17392 | var month = cell.text;
|
17393 | var defaultValue = this.defaultValue ? Array.isArray(this.defaultValue) ? this.defaultValue : [this.defaultValue] : [];
|
17394 | style.disabled = typeof this.disabledDate === 'function' ? month_tablevue_type_script_lang_js_datesInMonth(year, month).every(this.disabledDate) : false;
|
17395 | style.current = Object(util_["arrayFindIndex"])(Object(util_["coerceTruthyValueToArray"])(this.value), function (date) {
|
17396 | return date.getFullYear() === year && date.getMonth() === month;
|
17397 | }) >= 0;
|
17398 | style.today = today.getFullYear() === year && today.getMonth() === month;
|
17399 | style.default = defaultValue.some(function (date) {
|
17400 | return _this.cellMatchesDate(cell, date);
|
17401 | });
|
17402 |
|
17403 | if (cell.inRange) {
|
17404 | style['in-range'] = true;
|
17405 |
|
17406 | if (cell.start) {
|
17407 | style['start-date'] = true;
|
17408 | }
|
17409 |
|
17410 | if (cell.end) {
|
17411 | style['end-date'] = true;
|
17412 | }
|
17413 | }
|
17414 | return style;
|
17415 | },
|
17416 | getMonthOfCell: function getMonthOfCell(month) {
|
17417 | var year = this.date.getFullYear();
|
17418 | return new Date(year, month, 1);
|
17419 | },
|
17420 | markRange: function markRange(minDate, maxDate) {
|
17421 | minDate = getMonthTimestamp(minDate);
|
17422 | maxDate = getMonthTimestamp(maxDate) || minDate;
|
17423 | var _ref = [Math.min(minDate, maxDate), Math.max(minDate, maxDate)];
|
17424 | minDate = _ref[0];
|
17425 | maxDate = _ref[1];
|
17426 |
|
17427 | var rows = this.rows;
|
17428 | for (var i = 0, k = rows.length; i < k; i++) {
|
17429 | var row = rows[i];
|
17430 | for (var j = 0, l = row.length; j < l; j++) {
|
17431 |
|
17432 | var cell = row[j];
|
17433 | var index = i * 4 + j;
|
17434 | var time = new Date(this.date.getFullYear(), index).getTime();
|
17435 |
|
17436 | cell.inRange = minDate && time >= minDate && time <= maxDate;
|
17437 | cell.start = minDate && time === minDate;
|
17438 | cell.end = maxDate && time === maxDate;
|
17439 | }
|
17440 | }
|
17441 | },
|
17442 | handleMouseMove: function handleMouseMove(event) {
|
17443 | if (!this.rangeState.selecting) return;
|
17444 |
|
17445 | var target = event.target;
|
17446 | if (target.tagName === 'A') {
|
17447 | target = target.parentNode.parentNode;
|
17448 | }
|
17449 | if (target.tagName === 'DIV') {
|
17450 | target = target.parentNode;
|
17451 | }
|
17452 | if (target.tagName !== 'TD') return;
|
17453 |
|
17454 | var row = target.parentNode.rowIndex;
|
17455 | var column = target.cellIndex;
|
17456 |
|
17457 | if (this.rows[row][column].disabled) return;
|
17458 |
|
17459 |
|
17460 |
|
17461 | if (row !== this.lastRow || column !== this.lastColumn) {
|
17462 | this.lastRow = row;
|
17463 | this.lastColumn = column;
|
17464 | this.$emit('changerange', {
|
17465 | minDate: this.minDate,
|
17466 | maxDate: this.maxDate,
|
17467 | rangeState: {
|
17468 | selecting: true,
|
17469 | endDate: this.getMonthOfCell(row * 4 + column)
|
17470 | }
|
17471 | });
|
17472 | }
|
17473 | },
|
17474 | handleMonthTableClick: function handleMonthTableClick(event) {
|
17475 | var target = event.target;
|
17476 | if (target.tagName === 'A') {
|
17477 | target = target.parentNode.parentNode;
|
17478 | }
|
17479 | if (target.tagName === 'DIV') {
|
17480 | target = target.parentNode;
|
17481 | }
|
17482 | if (target.tagName !== 'TD') return;
|
17483 | if (Object(dom_["hasClass"])(target, 'disabled')) return;
|
17484 | var column = target.cellIndex;
|
17485 | var row = target.parentNode.rowIndex;
|
17486 | var month = row * 4 + column;
|
17487 | var newDate = this.getMonthOfCell(month);
|
17488 | if (this.selectionMode === 'range') {
|
17489 | if (!this.rangeState.selecting) {
|
17490 | this.$emit('pick', { minDate: newDate, maxDate: null });
|
17491 | this.rangeState.selecting = true;
|
17492 | } else {
|
17493 | if (newDate >= this.minDate) {
|
17494 | this.$emit('pick', { minDate: this.minDate, maxDate: newDate });
|
17495 | } else {
|
17496 | this.$emit('pick', { minDate: newDate, maxDate: this.minDate });
|
17497 | }
|
17498 | this.rangeState.selecting = false;
|
17499 | }
|
17500 | } else {
|
17501 | this.$emit('pick', month);
|
17502 | }
|
17503 | }
|
17504 | },
|
17505 |
|
17506 | computed: {
|
17507 | rows: function rows() {
|
17508 | var _this2 = this;
|
17509 |
|
17510 |
|
17511 | var rows = this.tableRows;
|
17512 | var disabledDate = this.disabledDate;
|
17513 | var selectedDate = [];
|
17514 | var now = getMonthTimestamp(new Date());
|
17515 |
|
17516 | for (var i = 0; i < 3; i++) {
|
17517 | var row = rows[i];
|
17518 |
|
17519 | var _loop = function _loop(j) {
|
17520 | var cell = row[j];
|
17521 | if (!cell) {
|
17522 | cell = { row: i, column: j, type: 'normal', inRange: false, start: false, end: false };
|
17523 | }
|
17524 |
|
17525 | cell.type = 'normal';
|
17526 |
|
17527 | var index = i * 4 + j;
|
17528 | var time = new Date(_this2.date.getFullYear(), index).getTime();
|
17529 | cell.inRange = time >= getMonthTimestamp(_this2.minDate) && time <= getMonthTimestamp(_this2.maxDate);
|
17530 | cell.start = _this2.minDate && time === getMonthTimestamp(_this2.minDate);
|
17531 | cell.end = _this2.maxDate && time === getMonthTimestamp(_this2.maxDate);
|
17532 | var isToday = time === now;
|
17533 |
|
17534 | if (isToday) {
|
17535 | cell.type = 'today';
|
17536 | }
|
17537 | cell.text = index;
|
17538 | var cellDate = new Date(time);
|
17539 | cell.disabled = typeof disabledDate === 'function' && disabledDate(cellDate);
|
17540 | cell.selected = Object(util_["arrayFind"])(selectedDate, function (date) {
|
17541 | return date.getTime() === cellDate.getTime();
|
17542 | });
|
17543 |
|
17544 | _this2.$set(row, j, cell);
|
17545 | };
|
17546 |
|
17547 | for (var j = 0; j < 4; j++) {
|
17548 | _loop(j);
|
17549 | }
|
17550 | }
|
17551 | return rows;
|
17552 | }
|
17553 | }
|
17554 | });
|
17555 |
|
17556 | var basic_month_tablevue_type_script_lang_js_ = (month_tablevue_type_script_lang_js_);
|
17557 |
|
17558 |
|
17559 |
|
17560 |
|
17561 |
|
17562 |
|
17563 |
|
17564 |
|
17565 | var month_table_component = normalizeComponent(
|
17566 | basic_month_tablevue_type_script_lang_js_,
|
17567 | month_tablevue_type_template_id_654d4f42_render,
|
17568 | month_tablevue_type_template_id_654d4f42_staticRenderFns,
|
17569 | false,
|
17570 | null,
|
17571 | null,
|
17572 | null
|
17573 |
|
17574 | )
|
17575 |
|
17576 |
|
17577 | if (false) { var month_table_api; }
|
17578 | month_table_component.options.__file = "packages/date-picker/src/basic/month-table.vue"
|
17579 | var month_table = (month_table_component.exports);
|
17580 |
|
17581 | var date_tablevue_type_template_id_5d1f3341_render = function() {
|
17582 | var _vm = this
|
17583 | var _h = _vm.$createElement
|
17584 | var _c = _vm._self._c || _h
|
17585 | return _c(
|
17586 | "table",
|
17587 | {
|
17588 | staticClass: "el-date-table",
|
17589 | class: { "is-week-mode": _vm.selectionMode === "week" },
|
17590 | attrs: { cellspacing: "0", cellpadding: "0" },
|
17591 | on: { click: _vm.handleClick, mousemove: _vm.handleMouseMove }
|
17592 | },
|
17593 | [
|
17594 | _c(
|
17595 | "tbody",
|
17596 | [
|
17597 | _c(
|
17598 | "tr",
|
17599 | [
|
17600 | _vm.showWeekNumber
|
17601 | ? _c("th", [_vm._v(_vm._s(_vm.t("el.datepicker.week")))])
|
17602 | : _vm._e(),
|
17603 | _vm._l(_vm.WEEKS, function(week, key) {
|
17604 | return _c("th", { key: key }, [
|
17605 | _vm._v(_vm._s(_vm.t("el.datepicker.weeks." + week)))
|
17606 | ])
|
17607 | })
|
17608 | ],
|
17609 | 2
|
17610 | ),
|
17611 | _vm._l(_vm.rows, function(row, key) {
|
17612 | return _c(
|
17613 | "tr",
|
17614 | {
|
17615 | key: key,
|
17616 | staticClass: "el-date-table__row",
|
17617 | class: { current: _vm.isWeekActive(row[1]) }
|
17618 | },
|
17619 | _vm._l(row, function(cell, key) {
|
17620 | return _c("td", { key: key, class: _vm.getCellClasses(cell) }, [
|
17621 | _c("div", [
|
17622 | _c("span", [
|
17623 | _vm._v("\n " + _vm._s(cell.text) + "\n ")
|
17624 | ])
|
17625 | ])
|
17626 | ])
|
17627 | }),
|
17628 | 0
|
17629 | )
|
17630 | })
|
17631 | ],
|
17632 | 2
|
17633 | )
|
17634 | ]
|
17635 | )
|
17636 | }
|
17637 | var date_tablevue_type_template_id_5d1f3341_staticRenderFns = []
|
17638 | date_tablevue_type_template_id_5d1f3341_render._withStripped = true
|
17639 |
|
17640 |
|
17641 |
|
17642 |
|
17643 |
|
17644 |
|
17645 |
|
17646 |
|
17647 |
|
17648 |
|
17649 |
|
17650 |
|
17651 |
|
17652 |
|
17653 |
|
17654 |
|
17655 |
|
17656 |
|
17657 |
|
17658 |
|
17659 |
|
17660 |
|
17661 |
|
17662 |
|
17663 |
|
17664 |
|
17665 |
|
17666 |
|
17667 |
|
17668 |
|
17669 |
|
17670 |
|
17671 |
|
17672 |
|
17673 |
|
17674 |
|
17675 |
|
17676 |
|
17677 |
|
17678 |
|
17679 |
|
17680 |
|
17681 |
|
17682 | var _WEEKS = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
|
17683 | var date_tablevue_type_script_lang_js_getDateTimestamp = function getDateTimestamp(time) {
|
17684 | if (typeof time === 'number' || typeof time === 'string') {
|
17685 | return Object(date_util_["clearTime"])(new Date(time)).getTime();
|
17686 | } else if (time instanceof Date) {
|
17687 | return Object(date_util_["clearTime"])(time).getTime();
|
17688 | } else {
|
17689 | return NaN;
|
17690 | }
|
17691 | };
|
17692 |
|
17693 |
|
17694 |
|
17695 |
|
17696 | var date_tablevue_type_script_lang_js_removeFromArray = function removeFromArray(arr, pred) {
|
17697 | var idx = typeof pred === 'function' ? Object(util_["arrayFindIndex"])(arr, pred) : arr.indexOf(pred);
|
17698 | return idx >= 0 ? [].concat(arr.slice(0, idx), arr.slice(idx + 1)) : arr;
|
17699 | };
|
17700 |
|
17701 | var date_tablevue_type_script_lang_js_ = ({
|
17702 | mixins: [locale_default.a],
|
17703 |
|
17704 | props: {
|
17705 | firstDayOfWeek: {
|
17706 | default: 7,
|
17707 | type: Number,
|
17708 | validator: function validator(val) {
|
17709 | return val >= 1 && val <= 7;
|
17710 | }
|
17711 | },
|
17712 |
|
17713 | value: {},
|
17714 |
|
17715 | defaultValue: {
|
17716 | validator: function validator(val) {
|
17717 |
|
17718 | return val === null || Object(date_util_["isDate"])(val) || Array.isArray(val) && val.every(date_util_["isDate"]);
|
17719 | }
|
17720 | },
|
17721 |
|
17722 | date: {},
|
17723 |
|
17724 | selectionMode: {
|
17725 | default: 'day'
|
17726 | },
|
17727 |
|
17728 | showWeekNumber: {
|
17729 | type: Boolean,
|
17730 | default: false
|
17731 | },
|
17732 |
|
17733 | disabledDate: {},
|
17734 |
|
17735 | cellClassName: {},
|
17736 |
|
17737 | minDate: {},
|
17738 |
|
17739 | maxDate: {},
|
17740 |
|
17741 | rangeState: {
|
17742 | default: function _default() {
|
17743 | return {
|
17744 | endDate: null,
|
17745 | selecting: false
|
17746 | };
|
17747 | }
|
17748 | }
|
17749 | },
|
17750 |
|
17751 | computed: {
|
17752 | offsetDay: function offsetDay() {
|
17753 | var week = this.firstDayOfWeek;
|
17754 |
|
17755 | return week > 3 ? 7 - week : -week;
|
17756 | },
|
17757 | WEEKS: function WEEKS() {
|
17758 | var week = this.firstDayOfWeek;
|
17759 | return _WEEKS.concat(_WEEKS).slice(week, week + 7);
|
17760 | },
|
17761 | year: function year() {
|
17762 | return this.date.getFullYear();
|
17763 | },
|
17764 | month: function month() {
|
17765 | return this.date.getMonth();
|
17766 | },
|
17767 | startDate: function startDate() {
|
17768 | return Object(date_util_["getStartDateOfMonth"])(this.year, this.month);
|
17769 | },
|
17770 | rows: function rows() {
|
17771 | var _this = this;
|
17772 |
|
17773 |
|
17774 | var date = new Date(this.year, this.month, 1);
|
17775 | var day = Object(date_util_["getFirstDayOfMonth"])(date);
|
17776 | var dateCountOfMonth = Object(date_util_["getDayCountOfMonth"])(date.getFullYear(), date.getMonth());
|
17777 | var dateCountOfLastMonth = Object(date_util_["getDayCountOfMonth"])(date.getFullYear(), date.getMonth() === 0 ? 11 : date.getMonth() - 1);
|
17778 |
|
17779 | day = day === 0 ? 7 : day;
|
17780 |
|
17781 | var offset = this.offsetDay;
|
17782 | var rows = this.tableRows;
|
17783 | var count = 1;
|
17784 |
|
17785 | var startDate = this.startDate;
|
17786 | var disabledDate = this.disabledDate;
|
17787 | var cellClassName = this.cellClassName;
|
17788 | var selectedDate = this.selectionMode === 'dates' ? Object(util_["coerceTruthyValueToArray"])(this.value) : [];
|
17789 | var now = date_tablevue_type_script_lang_js_getDateTimestamp(new Date());
|
17790 |
|
17791 | for (var i = 0; i < 6; i++) {
|
17792 | var row = rows[i];
|
17793 |
|
17794 | if (this.showWeekNumber) {
|
17795 | if (!row[0]) {
|
17796 | row[0] = { type: 'week', text: Object(date_util_["getWeekNumber"])(Object(date_util_["nextDate"])(startDate, i * 7 + 1)) };
|
17797 | }
|
17798 | }
|
17799 |
|
17800 | var _loop = function _loop(j) {
|
17801 | var cell = row[_this.showWeekNumber ? j + 1 : j];
|
17802 | if (!cell) {
|
17803 | cell = { row: i, column: j, type: 'normal', inRange: false, start: false, end: false };
|
17804 | }
|
17805 |
|
17806 | cell.type = 'normal';
|
17807 |
|
17808 | var index = i * 7 + j;
|
17809 | var time = Object(date_util_["nextDate"])(startDate, index - offset).getTime();
|
17810 | cell.inRange = time >= date_tablevue_type_script_lang_js_getDateTimestamp(_this.minDate) && time <= date_tablevue_type_script_lang_js_getDateTimestamp(_this.maxDate);
|
17811 | cell.start = _this.minDate && time === date_tablevue_type_script_lang_js_getDateTimestamp(_this.minDate);
|
17812 | cell.end = _this.maxDate && time === date_tablevue_type_script_lang_js_getDateTimestamp(_this.maxDate);
|
17813 | var isToday = time === now;
|
17814 |
|
17815 | if (isToday) {
|
17816 | cell.type = 'today';
|
17817 | }
|
17818 |
|
17819 | if (i >= 0 && i <= 1) {
|
17820 | var numberOfDaysFromPreviousMonth = day + offset < 0 ? 7 + day + offset : day + offset;
|
17821 |
|
17822 | if (j + i * 7 >= numberOfDaysFromPreviousMonth) {
|
17823 | cell.text = count++;
|
17824 | } else {
|
17825 | cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - j % 7) + 1 + i * 7;
|
17826 | cell.type = 'prev-month';
|
17827 | }
|
17828 | } else {
|
17829 | if (count <= dateCountOfMonth) {
|
17830 | cell.text = count++;
|
17831 | } else {
|
17832 | cell.text = count++ - dateCountOfMonth;
|
17833 | cell.type = 'next-month';
|
17834 | }
|
17835 | }
|
17836 |
|
17837 | var cellDate = new Date(time);
|
17838 | cell.disabled = typeof disabledDate === 'function' && disabledDate(cellDate);
|
17839 | cell.selected = Object(util_["arrayFind"])(selectedDate, function (date) {
|
17840 | return date.getTime() === cellDate.getTime();
|
17841 | });
|
17842 | cell.customClass = typeof cellClassName === 'function' && cellClassName(cellDate);
|
17843 | _this.$set(row, _this.showWeekNumber ? j + 1 : j, cell);
|
17844 | };
|
17845 |
|
17846 | for (var j = 0; j < 7; j++) {
|
17847 | _loop(j);
|
17848 | }
|
17849 |
|
17850 | if (this.selectionMode === 'week') {
|
17851 | var start = this.showWeekNumber ? 1 : 0;
|
17852 | var end = this.showWeekNumber ? 7 : 6;
|
17853 | var isWeekActive = this.isWeekActive(row[start + 1]);
|
17854 |
|
17855 | row[start].inRange = isWeekActive;
|
17856 | row[start].start = isWeekActive;
|
17857 | row[end].inRange = isWeekActive;
|
17858 | row[end].end = isWeekActive;
|
17859 | }
|
17860 | }
|
17861 |
|
17862 | return rows;
|
17863 | }
|
17864 | },
|
17865 |
|
17866 | watch: {
|
17867 | 'rangeState.endDate': function rangeStateEndDate(newVal) {
|
17868 | this.markRange(this.minDate, newVal);
|
17869 | },
|
17870 | minDate: function minDate(newVal, oldVal) {
|
17871 | if (date_tablevue_type_script_lang_js_getDateTimestamp(newVal) !== date_tablevue_type_script_lang_js_getDateTimestamp(oldVal)) {
|
17872 | this.markRange(this.minDate, this.maxDate);
|
17873 | }
|
17874 | },
|
17875 | maxDate: function maxDate(newVal, oldVal) {
|
17876 | if (date_tablevue_type_script_lang_js_getDateTimestamp(newVal) !== date_tablevue_type_script_lang_js_getDateTimestamp(oldVal)) {
|
17877 | this.markRange(this.minDate, this.maxDate);
|
17878 | }
|
17879 | }
|
17880 | },
|
17881 |
|
17882 | data: function data() {
|
17883 | return {
|
17884 | tableRows: [[], [], [], [], [], []],
|
17885 | lastRow: null,
|
17886 | lastColumn: null
|
17887 | };
|
17888 | },
|
17889 |
|
17890 |
|
17891 | methods: {
|
17892 | cellMatchesDate: function cellMatchesDate(cell, date) {
|
17893 | var value = new Date(date);
|
17894 | return this.year === value.getFullYear() && this.month === value.getMonth() && Number(cell.text) === value.getDate();
|
17895 | },
|
17896 | getCellClasses: function getCellClasses(cell) {
|
17897 | var _this2 = this;
|
17898 |
|
17899 | var selectionMode = this.selectionMode;
|
17900 | var defaultValue = this.defaultValue ? Array.isArray(this.defaultValue) ? this.defaultValue : [this.defaultValue] : [];
|
17901 |
|
17902 | var classes = [];
|
17903 | if ((cell.type === 'normal' || cell.type === 'today') && !cell.disabled) {
|
17904 | classes.push('available');
|
17905 | if (cell.type === 'today') {
|
17906 | classes.push('today');
|
17907 | }
|
17908 | } else {
|
17909 | classes.push(cell.type);
|
17910 | }
|
17911 |
|
17912 | if (cell.type === 'normal' && defaultValue.some(function (date) {
|
17913 | return _this2.cellMatchesDate(cell, date);
|
17914 | })) {
|
17915 | classes.push('default');
|
17916 | }
|
17917 |
|
17918 | if (selectionMode === 'day' && (cell.type === 'normal' || cell.type === 'today') && this.cellMatchesDate(cell, this.value)) {
|
17919 | classes.push('current');
|
17920 | }
|
17921 |
|
17922 | if (cell.inRange && (cell.type === 'normal' || cell.type === 'today' || this.selectionMode === 'week')) {
|
17923 | classes.push('in-range');
|
17924 |
|
17925 | if (cell.start) {
|
17926 | classes.push('start-date');
|
17927 | }
|
17928 |
|
17929 | if (cell.end) {
|
17930 | classes.push('end-date');
|
17931 | }
|
17932 | }
|
17933 |
|
17934 | if (cell.disabled) {
|
17935 | classes.push('disabled');
|
17936 | }
|
17937 |
|
17938 | if (cell.selected) {
|
17939 | classes.push('selected');
|
17940 | }
|
17941 |
|
17942 | if (cell.customClass) {
|
17943 | classes.push(cell.customClass);
|
17944 | }
|
17945 |
|
17946 | return classes.join(' ');
|
17947 | },
|
17948 | getDateOfCell: function getDateOfCell(row, column) {
|
17949 | var offsetFromStart = row * 7 + (column - (this.showWeekNumber ? 1 : 0)) - this.offsetDay;
|
17950 | return Object(date_util_["nextDate"])(this.startDate, offsetFromStart);
|
17951 | },
|
17952 | isWeekActive: function isWeekActive(cell) {
|
17953 | if (this.selectionMode !== 'week') return false;
|
17954 | var newDate = new Date(this.year, this.month, 1);
|
17955 | var year = newDate.getFullYear();
|
17956 | var month = newDate.getMonth();
|
17957 |
|
17958 | if (cell.type === 'prev-month') {
|
17959 | newDate.setMonth(month === 0 ? 11 : month - 1);
|
17960 | newDate.setFullYear(month === 0 ? year - 1 : year);
|
17961 | }
|
17962 |
|
17963 | if (cell.type === 'next-month') {
|
17964 | newDate.setMonth(month === 11 ? 0 : month + 1);
|
17965 | newDate.setFullYear(month === 11 ? year + 1 : year);
|
17966 | }
|
17967 |
|
17968 | newDate.setDate(parseInt(cell.text, 10));
|
17969 |
|
17970 | if (Object(date_util_["isDate"])(this.value)) {
|
17971 | var dayOffset = (this.value.getDay() - this.firstDayOfWeek + 7) % 7 - 1;
|
17972 | var weekDate = Object(date_util_["prevDate"])(this.value, dayOffset);
|
17973 | return weekDate.getTime() === newDate.getTime();
|
17974 | }
|
17975 | return false;
|
17976 | },
|
17977 | markRange: function markRange(minDate, maxDate) {
|
17978 | minDate = date_tablevue_type_script_lang_js_getDateTimestamp(minDate);
|
17979 | maxDate = date_tablevue_type_script_lang_js_getDateTimestamp(maxDate) || minDate;
|
17980 | var _ref = [Math.min(minDate, maxDate), Math.max(minDate, maxDate)];
|
17981 | minDate = _ref[0];
|
17982 | maxDate = _ref[1];
|
17983 |
|
17984 |
|
17985 | var startDate = this.startDate;
|
17986 | var rows = this.rows;
|
17987 | for (var i = 0, k = rows.length; i < k; i++) {
|
17988 | var row = rows[i];
|
17989 | for (var j = 0, l = row.length; j < l; j++) {
|
17990 | if (this.showWeekNumber && j === 0) continue;
|
17991 |
|
17992 | var _cell = row[j];
|
17993 | var index = i * 7 + j + (this.showWeekNumber ? -1 : 0);
|
17994 | var time = Object(date_util_["nextDate"])(startDate, index - this.offsetDay).getTime();
|
17995 |
|
17996 | _cell.inRange = minDate && time >= minDate && time <= maxDate;
|
17997 | _cell.start = minDate && time === minDate;
|
17998 | _cell.end = maxDate && time === maxDate;
|
17999 | }
|
18000 | }
|
18001 | },
|
18002 | handleMouseMove: function handleMouseMove(event) {
|
18003 | if (!this.rangeState.selecting) return;
|
18004 |
|
18005 | var target = event.target;
|
18006 | if (target.tagName === 'SPAN') {
|
18007 | target = target.parentNode.parentNode;
|
18008 | }
|
18009 | if (target.tagName === 'DIV') {
|
18010 | target = target.parentNode;
|
18011 | }
|
18012 | if (target.tagName !== 'TD') return;
|
18013 |
|
18014 | var row = target.parentNode.rowIndex - 1;
|
18015 | var column = target.cellIndex;
|
18016 |
|
18017 |
|
18018 | if (this.rows[row][column].disabled) return;
|
18019 |
|
18020 |
|
18021 |
|
18022 | if (row !== this.lastRow || column !== this.lastColumn) {
|
18023 | this.lastRow = row;
|
18024 | this.lastColumn = column;
|
18025 | this.$emit('changerange', {
|
18026 | minDate: this.minDate,
|
18027 | maxDate: this.maxDate,
|
18028 | rangeState: {
|
18029 | selecting: true,
|
18030 | endDate: this.getDateOfCell(row, column)
|
18031 | }
|
18032 | });
|
18033 | }
|
18034 | },
|
18035 | handleClick: function handleClick(event) {
|
18036 | var target = event.target;
|
18037 | if (target.tagName === 'SPAN') {
|
18038 | target = target.parentNode.parentNode;
|
18039 | }
|
18040 | if (target.tagName === 'DIV') {
|
18041 | target = target.parentNode;
|
18042 | }
|
18043 |
|
18044 | if (target.tagName !== 'TD') return;
|
18045 |
|
18046 | var row = target.parentNode.rowIndex - 1;
|
18047 | var column = this.selectionMode === 'week' ? 1 : target.cellIndex;
|
18048 | var cell = this.rows[row][column];
|
18049 |
|
18050 | if (cell.disabled || cell.type === 'week') return;
|
18051 |
|
18052 | var newDate = this.getDateOfCell(row, column);
|
18053 |
|
18054 | if (this.selectionMode === 'range') {
|
18055 | if (!this.rangeState.selecting) {
|
18056 | this.$emit('pick', { minDate: newDate, maxDate: null });
|
18057 | this.rangeState.selecting = true;
|
18058 | } else {
|
18059 | if (newDate >= this.minDate) {
|
18060 | this.$emit('pick', { minDate: this.minDate, maxDate: newDate });
|
18061 | } else {
|
18062 | this.$emit('pick', { minDate: newDate, maxDate: this.minDate });
|
18063 | }
|
18064 | this.rangeState.selecting = false;
|
18065 | }
|
18066 | } else if (this.selectionMode === 'day') {
|
18067 | this.$emit('pick', newDate);
|
18068 | } else if (this.selectionMode === 'week') {
|
18069 | var weekNumber = Object(date_util_["getWeekNumber"])(newDate);
|
18070 | var value = newDate.getFullYear() + 'w' + weekNumber;
|
18071 | this.$emit('pick', {
|
18072 | year: newDate.getFullYear(),
|
18073 | week: weekNumber,
|
18074 | value: value,
|
18075 | date: newDate
|
18076 | });
|
18077 | } else if (this.selectionMode === 'dates') {
|
18078 | var _value = this.value || [];
|
18079 | var newValue = cell.selected ? date_tablevue_type_script_lang_js_removeFromArray(_value, function (date) {
|
18080 | return date.getTime() === newDate.getTime();
|
18081 | }) : [].concat(_value, [newDate]);
|
18082 | this.$emit('pick', newValue);
|
18083 | }
|
18084 | }
|
18085 | }
|
18086 | });
|
18087 |
|
18088 | var basic_date_tablevue_type_script_lang_js_ = (date_tablevue_type_script_lang_js_);
|
18089 |
|
18090 |
|
18091 |
|
18092 |
|
18093 |
|
18094 |
|
18095 |
|
18096 |
|
18097 | var date_table_component = normalizeComponent(
|
18098 | basic_date_tablevue_type_script_lang_js_,
|
18099 | date_tablevue_type_template_id_5d1f3341_render,
|
18100 | date_tablevue_type_template_id_5d1f3341_staticRenderFns,
|
18101 | false,
|
18102 | null,
|
18103 | null,
|
18104 | null
|
18105 |
|
18106 | )
|
18107 |
|
18108 |
|
18109 | if (false) { var date_table_api; }
|
18110 | date_table_component.options.__file = "packages/date-picker/src/basic/date-table.vue"
|
18111 | var date_table = (date_table_component.exports);
|
18112 |
|
18113 |
|
18114 |
|
18115 |
|
18116 |
|
18117 |
|
18118 |
|
18119 |
|
18120 |
|
18121 |
|
18122 |
|
18123 |
|
18124 |
|
18125 |
|
18126 |
|
18127 |
|
18128 |
|
18129 |
|
18130 |
|
18131 |
|
18132 |
|
18133 |
|
18134 |
|
18135 |
|
18136 |
|
18137 |
|
18138 |
|
18139 |
|
18140 |
|
18141 |
|
18142 |
|
18143 |
|
18144 |
|
18145 |
|
18146 |
|
18147 |
|
18148 |
|
18149 |
|
18150 |
|
18151 |
|
18152 |
|
18153 |
|
18154 |
|
18155 |
|
18156 |
|
18157 |
|
18158 |
|
18159 |
|
18160 |
|
18161 |
|
18162 |
|
18163 |
|
18164 |
|
18165 |
|
18166 |
|
18167 |
|
18168 |
|
18169 |
|
18170 |
|
18171 |
|
18172 |
|
18173 |
|
18174 |
|
18175 |
|
18176 |
|
18177 |
|
18178 |
|
18179 |
|
18180 |
|
18181 |
|
18182 |
|
18183 |
|
18184 |
|
18185 |
|
18186 |
|
18187 |
|
18188 |
|
18189 |
|
18190 |
|
18191 |
|
18192 |
|
18193 |
|
18194 |
|
18195 |
|
18196 |
|
18197 |
|
18198 |
|
18199 |
|
18200 |
|
18201 |
|
18202 |
|
18203 |
|
18204 |
|
18205 |
|
18206 |
|
18207 |
|
18208 |
|
18209 |
|
18210 |
|
18211 |
|
18212 |
|
18213 |
|
18214 |
|
18215 |
|
18216 |
|
18217 |
|
18218 |
|
18219 |
|
18220 |
|
18221 |
|
18222 |
|
18223 |
|
18224 |
|
18225 |
|
18226 |
|
18227 |
|
18228 |
|
18229 |
|
18230 |
|
18231 |
|
18232 |
|
18233 |
|
18234 |
|
18235 |
|
18236 |
|
18237 |
|
18238 |
|
18239 |
|
18240 |
|
18241 |
|
18242 |
|
18243 |
|
18244 |
|
18245 |
|
18246 |
|
18247 |
|
18248 |
|
18249 |
|
18250 |
|
18251 |
|
18252 |
|
18253 |
|
18254 |
|
18255 |
|
18256 |
|
18257 |
|
18258 |
|
18259 |
|
18260 |
|
18261 |
|
18262 |
|
18263 |
|
18264 |
|
18265 |
|
18266 |
|
18267 |
|
18268 | var datevue_type_script_lang_js_ = ({
|
18269 | mixins: [locale_default.a],
|
18270 |
|
18271 | directives: { Clickoutside: clickoutside_default.a },
|
18272 |
|
18273 | watch: {
|
18274 | showTime: function showTime(val) {
|
18275 | var _this = this;
|
18276 |
|
18277 |
|
18278 | if (!val) return;
|
18279 | this.$nextTick(function (_) {
|
18280 | var inputElm = _this.$refs.input.$el;
|
18281 | if (inputElm) {
|
18282 | _this.pickerWidth = inputElm.getBoundingClientRect().width + 10;
|
18283 | }
|
18284 | });
|
18285 | },
|
18286 | value: function value(val) {
|
18287 | if (this.selectionMode === 'dates' && this.value) return;
|
18288 | if (Object(date_util_["isDate"])(val)) {
|
18289 | this.date = new Date(val);
|
18290 | } else {
|
18291 | this.date = this.getDefaultValue();
|
18292 | }
|
18293 | },
|
18294 | defaultValue: function defaultValue(val) {
|
18295 | if (!Object(date_util_["isDate"])(this.value)) {
|
18296 | this.date = val ? new Date(val) : new Date();
|
18297 | }
|
18298 | },
|
18299 | timePickerVisible: function timePickerVisible(val) {
|
18300 | var _this2 = this;
|
18301 |
|
18302 | if (val) this.$nextTick(function () {
|
18303 | return _this2.$refs.timepicker.adjustSpinners();
|
18304 | });
|
18305 | },
|
18306 | selectionMode: function selectionMode(newVal) {
|
18307 | if (newVal === 'month') {
|
18308 |
|
18309 | if (this.currentView !== 'year' || this.currentView !== 'month') {
|
18310 | this.currentView = 'month';
|
18311 | }
|
18312 | } else if (newVal === 'dates') {
|
18313 | this.currentView = 'date';
|
18314 | }
|
18315 | }
|
18316 | },
|
18317 |
|
18318 | methods: {
|
18319 | proxyTimePickerDataProperties: function proxyTimePickerDataProperties() {
|
18320 | var _this3 = this;
|
18321 |
|
18322 | var format = function format(timeFormat) {
|
18323 | _this3.$refs.timepicker.format = timeFormat;
|
18324 | };
|
18325 | var value = function value(_value) {
|
18326 | _this3.$refs.timepicker.value = _value;
|
18327 | };
|
18328 | var date = function date(_date) {
|
18329 | _this3.$refs.timepicker.date = _date;
|
18330 | };
|
18331 | var selectableRange = function selectableRange(_selectableRange) {
|
18332 | _this3.$refs.timepicker.selectableRange = _selectableRange;
|
18333 | };
|
18334 |
|
18335 | this.$watch('value', value);
|
18336 | this.$watch('date', date);
|
18337 | this.$watch('selectableRange', selectableRange);
|
18338 |
|
18339 | format(this.timeFormat);
|
18340 | value(this.value);
|
18341 | date(this.date);
|
18342 | selectableRange(this.selectableRange);
|
18343 | },
|
18344 | handleClear: function handleClear() {
|
18345 | this.date = this.getDefaultValue();
|
18346 | this.$emit('pick', null);
|
18347 | },
|
18348 | emit: function emit(value) {
|
18349 | var _this4 = this;
|
18350 |
|
18351 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
18352 | args[_key - 1] = arguments[_key];
|
18353 | }
|
18354 |
|
18355 | if (!value) {
|
18356 | this.$emit.apply(this, ['pick', value].concat(args));
|
18357 | } else if (Array.isArray(value)) {
|
18358 | var dates = value.map(function (date) {
|
18359 | return _this4.showTime ? Object(date_util_["clearMilliseconds"])(date) : Object(date_util_["clearTime"])(date);
|
18360 | });
|
18361 | this.$emit.apply(this, ['pick', dates].concat(args));
|
18362 | } else {
|
18363 | this.$emit.apply(this, ['pick', this.showTime ? Object(date_util_["clearMilliseconds"])(value) : Object(date_util_["clearTime"])(value)].concat(args));
|
18364 | }
|
18365 | this.userInputDate = null;
|
18366 | this.userInputTime = null;
|
18367 | },
|
18368 |
|
18369 |
|
18370 |
|
18371 |
|
18372 |
|
18373 |
|
18374 | showMonthPicker: function showMonthPicker() {
|
18375 | this.currentView = 'month';
|
18376 | },
|
18377 | showYearPicker: function showYearPicker() {
|
18378 | this.currentView = 'year';
|
18379 | },
|
18380 |
|
18381 |
|
18382 |
|
18383 |
|
18384 |
|
18385 |
|
18386 |
|
18387 |
|
18388 |
|
18389 |
|
18390 |
|
18391 | prevMonth: function prevMonth() {
|
18392 | this.date = Object(date_util_["prevMonth"])(this.date);
|
18393 | },
|
18394 | nextMonth: function nextMonth() {
|
18395 | this.date = Object(date_util_["nextMonth"])(this.date);
|
18396 | },
|
18397 | prevYear: function prevYear() {
|
18398 | if (this.currentView === 'year') {
|
18399 | this.date = Object(date_util_["prevYear"])(this.date, 10);
|
18400 | } else {
|
18401 | this.date = Object(date_util_["prevYear"])(this.date);
|
18402 | }
|
18403 | },
|
18404 | nextYear: function nextYear() {
|
18405 | if (this.currentView === 'year') {
|
18406 | this.date = Object(date_util_["nextYear"])(this.date, 10);
|
18407 | } else {
|
18408 | this.date = Object(date_util_["nextYear"])(this.date);
|
18409 | }
|
18410 | },
|
18411 | handleShortcutClick: function handleShortcutClick(shortcut) {
|
18412 | if (shortcut.onClick) {
|
18413 | shortcut.onClick(this);
|
18414 | }
|
18415 | },
|
18416 | handleTimePick: function handleTimePick(value, visible, first) {
|
18417 | if (Object(date_util_["isDate"])(value)) {
|
18418 | var newDate = this.value ? Object(date_util_["modifyTime"])(this.value, value.getHours(), value.getMinutes(), value.getSeconds()) : Object(date_util_["modifyWithTimeString"])(this.getDefaultValue(), this.defaultTime);
|
18419 | this.date = newDate;
|
18420 | this.emit(this.date, true);
|
18421 | } else {
|
18422 | this.emit(value, true);
|
18423 | }
|
18424 | if (!first) {
|
18425 | this.timePickerVisible = visible;
|
18426 | }
|
18427 | },
|
18428 | handleTimePickClose: function handleTimePickClose() {
|
18429 | this.timePickerVisible = false;
|
18430 | },
|
18431 | handleMonthPick: function handleMonthPick(month) {
|
18432 | if (this.selectionMode === 'month') {
|
18433 | this.date = Object(date_util_["modifyDate"])(this.date, this.year, month, 1);
|
18434 | this.emit(this.date);
|
18435 | } else {
|
18436 | this.date = Object(date_util_["changeYearMonthAndClampDate"])(this.date, this.year, month);
|
18437 |
|
18438 |
|
18439 | this.currentView = 'date';
|
18440 | }
|
18441 | },
|
18442 | handleDatePick: function handleDatePick(value) {
|
18443 | if (this.selectionMode === 'day') {
|
18444 | var newDate = this.value ? Object(date_util_["modifyDate"])(this.value, value.getFullYear(), value.getMonth(), value.getDate()) : Object(date_util_["modifyWithTimeString"])(value, this.defaultTime);
|
18445 |
|
18446 | if (!this.checkDateWithinRange(newDate)) {
|
18447 | newDate = Object(date_util_["modifyDate"])(this.selectableRange[0][0], value.getFullYear(), value.getMonth(), value.getDate());
|
18448 | }
|
18449 | this.date = newDate;
|
18450 | this.emit(this.date, this.showTime);
|
18451 | } else if (this.selectionMode === 'week') {
|
18452 | this.emit(value.date);
|
18453 | } else if (this.selectionMode === 'dates') {
|
18454 | this.emit(value, true);
|
18455 | }
|
18456 | },
|
18457 | handleYearPick: function handleYearPick(year) {
|
18458 | if (this.selectionMode === 'year') {
|
18459 | this.date = Object(date_util_["modifyDate"])(this.date, year, 0, 1);
|
18460 | this.emit(this.date);
|
18461 | } else {
|
18462 | this.date = Object(date_util_["changeYearMonthAndClampDate"])(this.date, year, this.month);
|
18463 |
|
18464 |
|
18465 | this.currentView = 'month';
|
18466 | }
|
18467 | },
|
18468 | changeToNow: function changeToNow() {
|
18469 |
|
18470 |
|
18471 | if ((!this.disabledDate || !this.disabledDate(new Date())) && this.checkDateWithinRange(new Date())) {
|
18472 | this.date = new Date();
|
18473 | this.emit(this.date);
|
18474 | }
|
18475 | },
|
18476 | confirm: function confirm() {
|
18477 | if (this.selectionMode === 'dates') {
|
18478 | this.emit(this.value);
|
18479 | } else {
|
18480 |
|
18481 |
|
18482 | var value = this.value ? this.value : Object(date_util_["modifyWithTimeString"])(this.getDefaultValue(), this.defaultTime);
|
18483 | this.date = new Date(value);
|
18484 | this.emit(value);
|
18485 | }
|
18486 | },
|
18487 | resetView: function resetView() {
|
18488 | if (this.selectionMode === 'month') {
|
18489 | this.currentView = 'month';
|
18490 | } else if (this.selectionMode === 'year') {
|
18491 | this.currentView = 'year';
|
18492 | } else {
|
18493 | this.currentView = 'date';
|
18494 | }
|
18495 | },
|
18496 | handleEnter: function handleEnter() {
|
18497 | document.body.addEventListener('keydown', this.handleKeydown);
|
18498 | },
|
18499 | handleLeave: function handleLeave() {
|
18500 | this.$emit('dodestroy');
|
18501 | document.body.removeEventListener('keydown', this.handleKeydown);
|
18502 | },
|
18503 | handleKeydown: function handleKeydown(event) {
|
18504 | var keyCode = event.keyCode;
|
18505 | var list = [38, 40, 37, 39];
|
18506 | if (this.visible && !this.timePickerVisible) {
|
18507 | if (list.indexOf(keyCode) !== -1) {
|
18508 | this.handleKeyControl(keyCode);
|
18509 | event.stopPropagation();
|
18510 | event.preventDefault();
|
18511 | }
|
18512 | if (keyCode === 13 && this.userInputDate === null && this.userInputTime === null) {
|
18513 |
|
18514 | this.emit(this.date, false);
|
18515 | }
|
18516 | }
|
18517 | },
|
18518 | handleKeyControl: function handleKeyControl(keyCode) {
|
18519 | var mapping = {
|
18520 | 'year': {
|
18521 | 38: -4, 40: 4, 37: -1, 39: 1, offset: function offset(date, step) {
|
18522 | return date.setFullYear(date.getFullYear() + step);
|
18523 | }
|
18524 | },
|
18525 | 'month': {
|
18526 | 38: -4, 40: 4, 37: -1, 39: 1, offset: function offset(date, step) {
|
18527 | return date.setMonth(date.getMonth() + step);
|
18528 | }
|
18529 | },
|
18530 | 'week': {
|
18531 | 38: -1, 40: 1, 37: -1, 39: 1, offset: function offset(date, step) {
|
18532 | return date.setDate(date.getDate() + step * 7);
|
18533 | }
|
18534 | },
|
18535 | 'day': {
|
18536 | 38: -7, 40: 7, 37: -1, 39: 1, offset: function offset(date, step) {
|
18537 | return date.setDate(date.getDate() + step);
|
18538 | }
|
18539 | }
|
18540 | };
|
18541 | var mode = this.selectionMode;
|
18542 | var year = 3.1536e10;
|
18543 | var now = this.date.getTime();
|
18544 | var newDate = new Date(this.date.getTime());
|
18545 | while (Math.abs(now - newDate.getTime()) <= year) {
|
18546 | var map = mapping[mode];
|
18547 | map.offset(newDate, map[keyCode]);
|
18548 | if (typeof this.disabledDate === 'function' && this.disabledDate(newDate)) {
|
18549 | continue;
|
18550 | }
|
18551 | this.date = newDate;
|
18552 | this.$emit('pick', newDate, true);
|
18553 | break;
|
18554 | }
|
18555 | },
|
18556 | handleVisibleTimeChange: function handleVisibleTimeChange(value) {
|
18557 | var time = Object(date_util_["parseDate"])(value, this.timeFormat);
|
18558 | if (time && this.checkDateWithinRange(time)) {
|
18559 | this.date = Object(date_util_["modifyDate"])(time, this.year, this.month, this.monthDate);
|
18560 | this.userInputTime = null;
|
18561 | this.$refs.timepicker.value = this.date;
|
18562 | this.timePickerVisible = false;
|
18563 | this.emit(this.date, true);
|
18564 | }
|
18565 | },
|
18566 | handleVisibleDateChange: function handleVisibleDateChange(value) {
|
18567 | var date = Object(date_util_["parseDate"])(value, this.dateFormat);
|
18568 | if (date) {
|
18569 | if (typeof this.disabledDate === 'function' && this.disabledDate(date)) {
|
18570 | return;
|
18571 | }
|
18572 | this.date = Object(date_util_["modifyTime"])(date, this.date.getHours(), this.date.getMinutes(), this.date.getSeconds());
|
18573 | this.userInputDate = null;
|
18574 | this.resetView();
|
18575 | this.emit(this.date, true);
|
18576 | }
|
18577 | },
|
18578 | isValidValue: function isValidValue(value) {
|
18579 | return value && !isNaN(value) && (typeof this.disabledDate === 'function' ? !this.disabledDate(value) : true) && this.checkDateWithinRange(value);
|
18580 | },
|
18581 | getDefaultValue: function getDefaultValue() {
|
18582 |
|
18583 |
|
18584 | return this.defaultValue ? new Date(this.defaultValue) : new Date();
|
18585 | },
|
18586 | checkDateWithinRange: function checkDateWithinRange(date) {
|
18587 | return this.selectableRange.length > 0 ? Object(date_util_["timeWithinRange"])(date, this.selectableRange, this.format || 'HH:mm:ss') : true;
|
18588 | }
|
18589 | },
|
18590 |
|
18591 | components: {
|
18592 | TimePicker: panel_time, YearTable: year_table, MonthTable: month_table, DateTable: date_table, ElInput: input_default.a, ElButton: button_default.a
|
18593 | },
|
18594 |
|
18595 | data: function data() {
|
18596 | return {
|
18597 | popperClass: '',
|
18598 | date: new Date(),
|
18599 | value: '',
|
18600 | defaultValue: null,
|
18601 | defaultTime: null,
|
18602 | showTime: false,
|
18603 | selectionMode: 'day',
|
18604 | shortcuts: '',
|
18605 | visible: false,
|
18606 | currentView: 'date',
|
18607 | disabledDate: '',
|
18608 | cellClassName: '',
|
18609 | selectableRange: [],
|
18610 | firstDayOfWeek: 7,
|
18611 | showWeekNumber: false,
|
18612 | timePickerVisible: false,
|
18613 | format: '',
|
18614 | arrowControl: false,
|
18615 | userInputDate: null,
|
18616 | userInputTime: null
|
18617 | };
|
18618 | },
|
18619 |
|
18620 |
|
18621 | computed: {
|
18622 | year: function year() {
|
18623 | return this.date.getFullYear();
|
18624 | },
|
18625 | month: function month() {
|
18626 | return this.date.getMonth();
|
18627 | },
|
18628 | week: function week() {
|
18629 | return Object(date_util_["getWeekNumber"])(this.date);
|
18630 | },
|
18631 | monthDate: function monthDate() {
|
18632 | return this.date.getDate();
|
18633 | },
|
18634 | footerVisible: function footerVisible() {
|
18635 | return this.showTime || this.selectionMode === 'dates';
|
18636 | },
|
18637 | visibleTime: function visibleTime() {
|
18638 | if (this.userInputTime !== null) {
|
18639 | return this.userInputTime;
|
18640 | } else {
|
18641 | return Object(date_util_["formatDate"])(this.value || this.defaultValue, this.timeFormat);
|
18642 | }
|
18643 | },
|
18644 | visibleDate: function visibleDate() {
|
18645 | if (this.userInputDate !== null) {
|
18646 | return this.userInputDate;
|
18647 | } else {
|
18648 | return Object(date_util_["formatDate"])(this.value || this.defaultValue, this.dateFormat);
|
18649 | }
|
18650 | },
|
18651 | yearLabel: function yearLabel() {
|
18652 | var yearTranslation = this.t('el.datepicker.year');
|
18653 | if (this.currentView === 'year') {
|
18654 | var startYear = Math.floor(this.year / 10) * 10;
|
18655 | if (yearTranslation) {
|
18656 | return startYear + ' ' + yearTranslation + ' - ' + (startYear + 9) + ' ' + yearTranslation;
|
18657 | }
|
18658 | return startYear + ' - ' + (startYear + 9);
|
18659 | }
|
18660 | return this.year + ' ' + yearTranslation;
|
18661 | },
|
18662 | timeFormat: function timeFormat() {
|
18663 | if (this.format) {
|
18664 | return Object(date_util_["extractTimeFormat"])(this.format);
|
18665 | } else {
|
18666 | return 'HH:mm:ss';
|
18667 | }
|
18668 | },
|
18669 | dateFormat: function dateFormat() {
|
18670 | if (this.format) {
|
18671 | return Object(date_util_["extractDateFormat"])(this.format);
|
18672 | } else {
|
18673 | return 'yyyy-MM-dd';
|
18674 | }
|
18675 | }
|
18676 | }
|
18677 | });
|
18678 |
|
18679 | var panel_datevue_type_script_lang_js_ = (datevue_type_script_lang_js_);
|
18680 |
|
18681 |
|
18682 |
|
18683 |
|
18684 |
|
18685 |
|
18686 |
|
18687 |
|
18688 | var date_component = normalizeComponent(
|
18689 | panel_datevue_type_script_lang_js_,
|
18690 | datevue_type_template_id_2440d4ea_render,
|
18691 | datevue_type_template_id_2440d4ea_staticRenderFns,
|
18692 | false,
|
18693 | null,
|
18694 | null,
|
18695 | null
|
18696 |
|
18697 | )
|
18698 |
|
18699 |
|
18700 | if (false) { var date_api; }
|
18701 | date_component.options.__file = "packages/date-picker/src/panel/date.vue"
|
18702 | var panel_date = (date_component.exports);
|
18703 |
|
18704 | var date_rangevue_type_template_id_2652849a_render = function() {
|
18705 | var _vm = this
|
18706 | var _h = _vm.$createElement
|
18707 | var _c = _vm._self._c || _h
|
18708 | return _c(
|
18709 | "transition",
|
18710 | {
|
18711 | attrs: { name: "el-zoom-in-top" },
|
18712 | on: {
|
18713 | "after-leave": function($event) {
|
18714 | _vm.$emit("dodestroy")
|
18715 | }
|
18716 | }
|
18717 | },
|
18718 | [
|
18719 | _c(
|
18720 | "div",
|
18721 | {
|
18722 | directives: [
|
18723 | {
|
18724 | name: "show",
|
18725 | rawName: "v-show",
|
18726 | value: _vm.visible,
|
18727 | expression: "visible"
|
18728 | }
|
18729 | ],
|
18730 | staticClass: "el-picker-panel el-date-range-picker el-popper",
|
18731 | class: [
|
18732 | {
|
18733 | "has-sidebar": _vm.$slots.sidebar || _vm.shortcuts,
|
18734 | "has-time": _vm.showTime
|
18735 | },
|
18736 | _vm.popperClass
|
18737 | ]
|
18738 | },
|
18739 | [
|
18740 | _c(
|
18741 | "div",
|
18742 | { staticClass: "el-picker-panel__body-wrapper" },
|
18743 | [
|
18744 | _vm._t("sidebar"),
|
18745 | _vm.shortcuts
|
18746 | ? _c(
|
18747 | "div",
|
18748 | { staticClass: "el-picker-panel__sidebar" },
|
18749 | _vm._l(_vm.shortcuts, function(shortcut, key) {
|
18750 | return _c(
|
18751 | "button",
|
18752 | {
|
18753 | key: key,
|
18754 | staticClass: "el-picker-panel__shortcut",
|
18755 | attrs: { type: "button" },
|
18756 | on: {
|
18757 | click: function($event) {
|
18758 | _vm.handleShortcutClick(shortcut)
|
18759 | }
|
18760 | }
|
18761 | },
|
18762 | [_vm._v(_vm._s(shortcut.text))]
|
18763 | )
|
18764 | }),
|
18765 | 0
|
18766 | )
|
18767 | : _vm._e(),
|
18768 | _c("div", { staticClass: "el-picker-panel__body" }, [
|
18769 | _vm.showTime
|
18770 | ? _c(
|
18771 | "div",
|
18772 | { staticClass: "el-date-range-picker__time-header" },
|
18773 | [
|
18774 | _c(
|
18775 | "span",
|
18776 | { staticClass: "el-date-range-picker__editors-wrap" },
|
18777 | [
|
18778 | _c(
|
18779 | "span",
|
18780 | {
|
18781 | staticClass:
|
18782 | "el-date-range-picker__time-picker-wrap"
|
18783 | },
|
18784 | [
|
18785 | _c("el-input", {
|
18786 | ref: "minInput",
|
18787 | staticClass: "el-date-range-picker__editor",
|
18788 | attrs: {
|
18789 | size: "small",
|
18790 | disabled: _vm.rangeState.selecting,
|
18791 | placeholder: _vm.t(
|
18792 | "el.datepicker.startDate"
|
18793 | ),
|
18794 | value: _vm.minVisibleDate
|
18795 | },
|
18796 | on: {
|
18797 | input: function(val) {
|
18798 | return _vm.handleDateInput(val, "min")
|
18799 | },
|
18800 | change: function(val) {
|
18801 | return _vm.handleDateChange(val, "min")
|
18802 | }
|
18803 | }
|
18804 | })
|
18805 | ],
|
18806 | 1
|
18807 | ),
|
18808 | _c(
|
18809 | "span",
|
18810 | {
|
18811 | directives: [
|
18812 | {
|
18813 | name: "clickoutside",
|
18814 | rawName: "v-clickoutside",
|
18815 | value: _vm.handleMinTimeClose,
|
18816 | expression: "handleMinTimeClose"
|
18817 | }
|
18818 | ],
|
18819 | staticClass:
|
18820 | "el-date-range-picker__time-picker-wrap"
|
18821 | },
|
18822 | [
|
18823 | _c("el-input", {
|
18824 | staticClass: "el-date-range-picker__editor",
|
18825 | attrs: {
|
18826 | size: "small",
|
18827 | disabled: _vm.rangeState.selecting,
|
18828 | placeholder: _vm.t(
|
18829 | "el.datepicker.startTime"
|
18830 | ),
|
18831 | value: _vm.minVisibleTime
|
18832 | },
|
18833 | on: {
|
18834 | focus: function($event) {
|
18835 | _vm.minTimePickerVisible = true
|
18836 | },
|
18837 | input: function(val) {
|
18838 | return _vm.handleTimeInput(val, "min")
|
18839 | },
|
18840 | change: function(val) {
|
18841 | return _vm.handleTimeChange(val, "min")
|
18842 | }
|
18843 | }
|
18844 | }),
|
18845 | _c("time-picker", {
|
18846 | ref: "minTimePicker",
|
18847 | attrs: {
|
18848 | "time-arrow-control": _vm.arrowControl,
|
18849 | visible: _vm.minTimePickerVisible
|
18850 | },
|
18851 | on: {
|
18852 | pick: _vm.handleMinTimePick,
|
18853 | mounted: function($event) {
|
18854 | _vm.$refs.minTimePicker.format =
|
18855 | _vm.timeFormat
|
18856 | }
|
18857 | }
|
18858 | })
|
18859 | ],
|
18860 | 1
|
18861 | )
|
18862 | ]
|
18863 | ),
|
18864 | _c("span", { staticClass: "el-icon-arrow-right" }),
|
18865 | _c(
|
18866 | "span",
|
18867 | {
|
18868 | staticClass:
|
18869 | "el-date-range-picker__editors-wrap is-right"
|
18870 | },
|
18871 | [
|
18872 | _c(
|
18873 | "span",
|
18874 | {
|
18875 | staticClass:
|
18876 | "el-date-range-picker__time-picker-wrap"
|
18877 | },
|
18878 | [
|
18879 | _c("el-input", {
|
18880 | staticClass: "el-date-range-picker__editor",
|
18881 | attrs: {
|
18882 | size: "small",
|
18883 | disabled: _vm.rangeState.selecting,
|
18884 | placeholder: _vm.t("el.datepicker.endDate"),
|
18885 | value: _vm.maxVisibleDate,
|
18886 | readonly: !_vm.minDate
|
18887 | },
|
18888 | on: {
|
18889 | input: function(val) {
|
18890 | return _vm.handleDateInput(val, "max")
|
18891 | },
|
18892 | change: function(val) {
|
18893 | return _vm.handleDateChange(val, "max")
|
18894 | }
|
18895 | }
|
18896 | })
|
18897 | ],
|
18898 | 1
|
18899 | ),
|
18900 | _c(
|
18901 | "span",
|
18902 | {
|
18903 | directives: [
|
18904 | {
|
18905 | name: "clickoutside",
|
18906 | rawName: "v-clickoutside",
|
18907 | value: _vm.handleMaxTimeClose,
|
18908 | expression: "handleMaxTimeClose"
|
18909 | }
|
18910 | ],
|
18911 | staticClass:
|
18912 | "el-date-range-picker__time-picker-wrap"
|
18913 | },
|
18914 | [
|
18915 | _c("el-input", {
|
18916 | staticClass: "el-date-range-picker__editor",
|
18917 | attrs: {
|
18918 | size: "small",
|
18919 | disabled: _vm.rangeState.selecting,
|
18920 | placeholder: _vm.t("el.datepicker.endTime"),
|
18921 | value: _vm.maxVisibleTime,
|
18922 | readonly: !_vm.minDate
|
18923 | },
|
18924 | on: {
|
18925 | focus: function($event) {
|
18926 | _vm.minDate &&
|
18927 | (_vm.maxTimePickerVisible = true)
|
18928 | },
|
18929 | input: function(val) {
|
18930 | return _vm.handleTimeInput(val, "max")
|
18931 | },
|
18932 | change: function(val) {
|
18933 | return _vm.handleTimeChange(val, "max")
|
18934 | }
|
18935 | }
|
18936 | }),
|
18937 | _c("time-picker", {
|
18938 | ref: "maxTimePicker",
|
18939 | attrs: {
|
18940 | "time-arrow-control": _vm.arrowControl,
|
18941 | visible: _vm.maxTimePickerVisible
|
18942 | },
|
18943 | on: {
|
18944 | pick: _vm.handleMaxTimePick,
|
18945 | mounted: function($event) {
|
18946 | _vm.$refs.maxTimePicker.format =
|
18947 | _vm.timeFormat
|
18948 | }
|
18949 | }
|
18950 | })
|
18951 | ],
|
18952 | 1
|
18953 | )
|
18954 | ]
|
18955 | )
|
18956 | ]
|
18957 | )
|
18958 | : _vm._e(),
|
18959 | _c(
|
18960 | "div",
|
18961 | {
|
18962 | staticClass:
|
18963 | "el-picker-panel__content el-date-range-picker__content is-left"
|
18964 | },
|
18965 | [
|
18966 | _c("div", { staticClass: "el-date-range-picker__header" }, [
|
18967 | _c("button", {
|
18968 | staticClass:
|
18969 | "el-picker-panel__icon-btn el-icon-d-arrow-left",
|
18970 | attrs: { type: "button" },
|
18971 | on: { click: _vm.leftPrevYear }
|
18972 | }),
|
18973 | _c("button", {
|
18974 | staticClass:
|
18975 | "el-picker-panel__icon-btn el-icon-arrow-left",
|
18976 | attrs: { type: "button" },
|
18977 | on: { click: _vm.leftPrevMonth }
|
18978 | }),
|
18979 | _vm.unlinkPanels
|
18980 | ? _c("button", {
|
18981 | staticClass:
|
18982 | "el-picker-panel__icon-btn el-icon-d-arrow-right",
|
18983 | class: { "is-disabled": !_vm.enableYearArrow },
|
18984 | attrs: {
|
18985 | type: "button",
|
18986 | disabled: !_vm.enableYearArrow
|
18987 | },
|
18988 | on: { click: _vm.leftNextYear }
|
18989 | })
|
18990 | : _vm._e(),
|
18991 | _vm.unlinkPanels
|
18992 | ? _c("button", {
|
18993 | staticClass:
|
18994 | "el-picker-panel__icon-btn el-icon-arrow-right",
|
18995 | class: { "is-disabled": !_vm.enableMonthArrow },
|
18996 | attrs: {
|
18997 | type: "button",
|
18998 | disabled: !_vm.enableMonthArrow
|
18999 | },
|
19000 | on: { click: _vm.leftNextMonth }
|
19001 | })
|
19002 | : _vm._e(),
|
19003 | _c("div", [_vm._v(_vm._s(_vm.leftLabel))])
|
19004 | ]),
|
19005 | _c("date-table", {
|
19006 | attrs: {
|
19007 | "selection-mode": "range",
|
19008 | date: _vm.leftDate,
|
19009 | "default-value": _vm.defaultValue,
|
19010 | "min-date": _vm.minDate,
|
19011 | "max-date": _vm.maxDate,
|
19012 | "range-state": _vm.rangeState,
|
19013 | "disabled-date": _vm.disabledDate,
|
19014 | "cell-class-name": _vm.cellClassName,
|
19015 | "first-day-of-week": _vm.firstDayOfWeek
|
19016 | },
|
19017 | on: {
|
19018 | changerange: _vm.handleChangeRange,
|
19019 | pick: _vm.handleRangePick
|
19020 | }
|
19021 | })
|
19022 | ],
|
19023 | 1
|
19024 | ),
|
19025 | _c(
|
19026 | "div",
|
19027 | {
|
19028 | staticClass:
|
19029 | "el-picker-panel__content el-date-range-picker__content is-right"
|
19030 | },
|
19031 | [
|
19032 | _c("div", { staticClass: "el-date-range-picker__header" }, [
|
19033 | _vm.unlinkPanels
|
19034 | ? _c("button", {
|
19035 | staticClass:
|
19036 | "el-picker-panel__icon-btn el-icon-d-arrow-left",
|
19037 | class: { "is-disabled": !_vm.enableYearArrow },
|
19038 | attrs: {
|
19039 | type: "button",
|
19040 | disabled: !_vm.enableYearArrow
|
19041 | },
|
19042 | on: { click: _vm.rightPrevYear }
|
19043 | })
|
19044 | : _vm._e(),
|
19045 | _vm.unlinkPanels
|
19046 | ? _c("button", {
|
19047 | staticClass:
|
19048 | "el-picker-panel__icon-btn el-icon-arrow-left",
|
19049 | class: { "is-disabled": !_vm.enableMonthArrow },
|
19050 | attrs: {
|
19051 | type: "button",
|
19052 | disabled: !_vm.enableMonthArrow
|
19053 | },
|
19054 | on: { click: _vm.rightPrevMonth }
|
19055 | })
|
19056 | : _vm._e(),
|
19057 | _c("button", {
|
19058 | staticClass:
|
19059 | "el-picker-panel__icon-btn el-icon-d-arrow-right",
|
19060 | attrs: { type: "button" },
|
19061 | on: { click: _vm.rightNextYear }
|
19062 | }),
|
19063 | _c("button", {
|
19064 | staticClass:
|
19065 | "el-picker-panel__icon-btn el-icon-arrow-right",
|
19066 | attrs: { type: "button" },
|
19067 | on: { click: _vm.rightNextMonth }
|
19068 | }),
|
19069 | _c("div", [_vm._v(_vm._s(_vm.rightLabel))])
|
19070 | ]),
|
19071 | _c("date-table", {
|
19072 | attrs: {
|
19073 | "selection-mode": "range",
|
19074 | date: _vm.rightDate,
|
19075 | "default-value": _vm.defaultValue,
|
19076 | "min-date": _vm.minDate,
|
19077 | "max-date": _vm.maxDate,
|
19078 | "range-state": _vm.rangeState,
|
19079 | "disabled-date": _vm.disabledDate,
|
19080 | "cell-class-name": _vm.cellClassName,
|
19081 | "first-day-of-week": _vm.firstDayOfWeek
|
19082 | },
|
19083 | on: {
|
19084 | changerange: _vm.handleChangeRange,
|
19085 | pick: _vm.handleRangePick
|
19086 | }
|
19087 | })
|
19088 | ],
|
19089 | 1
|
19090 | )
|
19091 | ])
|
19092 | ],
|
19093 | 2
|
19094 | ),
|
19095 | _vm.showTime
|
19096 | ? _c(
|
19097 | "div",
|
19098 | { staticClass: "el-picker-panel__footer" },
|
19099 | [
|
19100 | _c(
|
19101 | "el-button",
|
19102 | {
|
19103 | staticClass: "el-picker-panel__link-btn",
|
19104 | attrs: { size: "mini", type: "text" },
|
19105 | on: { click: _vm.handleClear }
|
19106 | },
|
19107 | [
|
19108 | _vm._v(
|
19109 | "\n " +
|
19110 | _vm._s(_vm.t("el.datepicker.clear")) +
|
19111 | "\n "
|
19112 | )
|
19113 | ]
|
19114 | ),
|
19115 | _c(
|
19116 | "el-button",
|
19117 | {
|
19118 | staticClass: "el-picker-panel__link-btn",
|
19119 | attrs: {
|
19120 | plain: "",
|
19121 | size: "mini",
|
19122 | disabled: _vm.btnDisabled
|
19123 | },
|
19124 | on: {
|
19125 | click: function($event) {
|
19126 | _vm.handleConfirm(false)
|
19127 | }
|
19128 | }
|
19129 | },
|
19130 | [
|
19131 | _vm._v(
|
19132 | "\n " +
|
19133 | _vm._s(_vm.t("el.datepicker.confirm")) +
|
19134 | "\n "
|
19135 | )
|
19136 | ]
|
19137 | )
|
19138 | ],
|
19139 | 1
|
19140 | )
|
19141 | : _vm._e()
|
19142 | ]
|
19143 | )
|
19144 | ]
|
19145 | )
|
19146 | }
|
19147 | var date_rangevue_type_template_id_2652849a_staticRenderFns = []
|
19148 | date_rangevue_type_template_id_2652849a_render._withStripped = true
|
19149 |
|
19150 |
|
19151 |
|
19152 |
|
19153 |
|
19154 |
|
19155 |
|
19156 |
|
19157 |
|
19158 |
|
19159 |
|
19160 |
|
19161 |
|
19162 |
|
19163 |
|
19164 |
|
19165 |
|
19166 |
|
19167 |
|
19168 |
|
19169 |
|
19170 |
|
19171 |
|
19172 |
|
19173 |
|
19174 |
|
19175 |
|
19176 |
|
19177 |
|
19178 |
|
19179 |
|
19180 |
|
19181 |
|
19182 |
|
19183 |
|
19184 |
|
19185 |
|
19186 |
|
19187 |
|
19188 |
|
19189 |
|
19190 |
|
19191 |
|
19192 |
|
19193 |
|
19194 |
|
19195 |
|
19196 |
|
19197 |
|
19198 |
|
19199 |
|
19200 |
|
19201 |
|
19202 |
|
19203 |
|
19204 |
|
19205 |
|
19206 |
|
19207 |
|
19208 |
|
19209 |
|
19210 |
|
19211 |
|
19212 |
|
19213 |
|
19214 |
|
19215 |
|
19216 |
|
19217 |
|
19218 |
|
19219 |
|
19220 |
|
19221 |
|
19222 |
|
19223 |
|
19224 |
|
19225 |
|
19226 |
|
19227 |
|
19228 |
|
19229 |
|
19230 |
|
19231 |
|
19232 |
|
19233 |
|
19234 |
|
19235 |
|
19236 |
|
19237 |
|
19238 |
|
19239 |
|
19240 |
|
19241 |
|
19242 |
|
19243 |
|
19244 |
|
19245 |
|
19246 |
|
19247 |
|
19248 |
|
19249 |
|
19250 |
|
19251 |
|
19252 |
|
19253 |
|
19254 |
|
19255 |
|
19256 |
|
19257 |
|
19258 |
|
19259 |
|
19260 |
|
19261 |
|
19262 |
|
19263 |
|
19264 |
|
19265 |
|
19266 |
|
19267 |
|
19268 |
|
19269 |
|
19270 |
|
19271 |
|
19272 |
|
19273 |
|
19274 |
|
19275 |
|
19276 |
|
19277 |
|
19278 |
|
19279 |
|
19280 |
|
19281 |
|
19282 |
|
19283 |
|
19284 |
|
19285 |
|
19286 |
|
19287 |
|
19288 |
|
19289 |
|
19290 |
|
19291 |
|
19292 |
|
19293 |
|
19294 |
|
19295 |
|
19296 |
|
19297 |
|
19298 |
|
19299 |
|
19300 |
|
19301 |
|
19302 |
|
19303 |
|
19304 |
|
19305 |
|
19306 |
|
19307 |
|
19308 |
|
19309 |
|
19310 |
|
19311 |
|
19312 |
|
19313 |
|
19314 |
|
19315 |
|
19316 |
|
19317 |
|
19318 |
|
19319 |
|
19320 |
|
19321 |
|
19322 |
|
19323 |
|
19324 |
|
19325 |
|
19326 |
|
19327 |
|
19328 |
|
19329 |
|
19330 |
|
19331 |
|
19332 |
|
19333 |
|
19334 |
|
19335 |
|
19336 |
|
19337 |
|
19338 |
|
19339 |
|
19340 |
|
19341 |
|
19342 |
|
19343 |
|
19344 |
|
19345 |
|
19346 |
|
19347 |
|
19348 |
|
19349 |
|
19350 |
|
19351 |
|
19352 | var date_rangevue_type_script_lang_js_calcDefaultValue = function calcDefaultValue(defaultValue) {
|
19353 | if (Array.isArray(defaultValue)) {
|
19354 | return [new Date(defaultValue[0]), new Date(defaultValue[1])];
|
19355 | } else if (defaultValue) {
|
19356 | return [new Date(defaultValue), Object(date_util_["nextDate"])(new Date(defaultValue), 1)];
|
19357 | } else {
|
19358 | return [new Date(), Object(date_util_["nextDate"])(new Date(), 1)];
|
19359 | }
|
19360 | };
|
19361 |
|
19362 | var date_rangevue_type_script_lang_js_ = ({
|
19363 | mixins: [locale_default.a],
|
19364 |
|
19365 | directives: { Clickoutside: clickoutside_default.a },
|
19366 |
|
19367 | computed: {
|
19368 | btnDisabled: function btnDisabled() {
|
19369 | return !(this.minDate && this.maxDate && !this.selecting && this.isValidValue([this.minDate, this.maxDate]));
|
19370 | },
|
19371 | leftLabel: function leftLabel() {
|
19372 | return this.leftDate.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t('el.datepicker.month' + (this.leftDate.getMonth() + 1));
|
19373 | },
|
19374 | rightLabel: function rightLabel() {
|
19375 | return this.rightDate.getFullYear() + ' ' + this.t('el.datepicker.year') + ' ' + this.t('el.datepicker.month' + (this.rightDate.getMonth() + 1));
|
19376 | },
|
19377 | leftYear: function leftYear() {
|
19378 | return this.leftDate.getFullYear();
|
19379 | },
|
19380 | leftMonth: function leftMonth() {
|
19381 | return this.leftDate.getMonth();
|
19382 | },
|
19383 | leftMonthDate: function leftMonthDate() {
|
19384 | return this.leftDate.getDate();
|
19385 | },
|
19386 | rightYear: function rightYear() {
|
19387 | return this.rightDate.getFullYear();
|
19388 | },
|
19389 | rightMonth: function rightMonth() {
|
19390 | return this.rightDate.getMonth();
|
19391 | },
|
19392 | rightMonthDate: function rightMonthDate() {
|
19393 | return this.rightDate.getDate();
|
19394 | },
|
19395 | minVisibleDate: function minVisibleDate() {
|
19396 | if (this.dateUserInput.min !== null) return this.dateUserInput.min;
|
19397 | if (this.minDate) return Object(date_util_["formatDate"])(this.minDate, this.dateFormat);
|
19398 | return '';
|
19399 | },
|
19400 | maxVisibleDate: function maxVisibleDate() {
|
19401 | if (this.dateUserInput.max !== null) return this.dateUserInput.max;
|
19402 | if (this.maxDate || this.minDate) return Object(date_util_["formatDate"])(this.maxDate || this.minDate, this.dateFormat);
|
19403 | return '';
|
19404 | },
|
19405 | minVisibleTime: function minVisibleTime() {
|
19406 | if (this.timeUserInput.min !== null) return this.timeUserInput.min;
|
19407 | if (this.minDate) return Object(date_util_["formatDate"])(this.minDate, this.timeFormat);
|
19408 | return '';
|
19409 | },
|
19410 | maxVisibleTime: function maxVisibleTime() {
|
19411 | if (this.timeUserInput.max !== null) return this.timeUserInput.max;
|
19412 | if (this.maxDate || this.minDate) return Object(date_util_["formatDate"])(this.maxDate || this.minDate, this.timeFormat);
|
19413 | return '';
|
19414 | },
|
19415 | timeFormat: function timeFormat() {
|
19416 | if (this.format) {
|
19417 | return Object(date_util_["extractTimeFormat"])(this.format);
|
19418 | } else {
|
19419 | return 'HH:mm:ss';
|
19420 | }
|
19421 | },
|
19422 | dateFormat: function dateFormat() {
|
19423 | if (this.format) {
|
19424 | return Object(date_util_["extractDateFormat"])(this.format);
|
19425 | } else {
|
19426 | return 'yyyy-MM-dd';
|
19427 | }
|
19428 | },
|
19429 | enableMonthArrow: function enableMonthArrow() {
|
19430 | var nextMonth = (this.leftMonth + 1) % 12;
|
19431 | var yearOffset = this.leftMonth + 1 >= 12 ? 1 : 0;
|
19432 | return this.unlinkPanels && new Date(this.leftYear + yearOffset, nextMonth) < new Date(this.rightYear, this.rightMonth);
|
19433 | },
|
19434 | enableYearArrow: function enableYearArrow() {
|
19435 | return this.unlinkPanels && this.rightYear * 12 + this.rightMonth - (this.leftYear * 12 + this.leftMonth + 1) >= 12;
|
19436 | }
|
19437 | },
|
19438 |
|
19439 | data: function data() {
|
19440 | return {
|
19441 | popperClass: '',
|
19442 | value: [],
|
19443 | defaultValue: null,
|
19444 | defaultTime: null,
|
19445 | minDate: '',
|
19446 | maxDate: '',
|
19447 | leftDate: new Date(),
|
19448 | rightDate: Object(date_util_["nextMonth"])(new Date()),
|
19449 | rangeState: {
|
19450 | endDate: null,
|
19451 | selecting: false,
|
19452 | row: null,
|
19453 | column: null
|
19454 | },
|
19455 | showTime: false,
|
19456 | shortcuts: '',
|
19457 | visible: '',
|
19458 | disabledDate: '',
|
19459 | cellClassName: '',
|
19460 | firstDayOfWeek: 7,
|
19461 | minTimePickerVisible: false,
|
19462 | maxTimePickerVisible: false,
|
19463 | format: '',
|
19464 | arrowControl: false,
|
19465 | unlinkPanels: false,
|
19466 | dateUserInput: {
|
19467 | min: null,
|
19468 | max: null
|
19469 | },
|
19470 | timeUserInput: {
|
19471 | min: null,
|
19472 | max: null
|
19473 | }
|
19474 | };
|
19475 | },
|
19476 |
|
19477 |
|
19478 | watch: {
|
19479 | minDate: function minDate(val) {
|
19480 | var _this = this;
|
19481 |
|
19482 | this.dateUserInput.min = null;
|
19483 | this.timeUserInput.min = null;
|
19484 | this.$nextTick(function () {
|
19485 | if (_this.$refs.maxTimePicker && _this.maxDate && _this.maxDate < _this.minDate) {
|
19486 | var format = 'HH:mm:ss';
|
19487 | _this.$refs.maxTimePicker.selectableRange = [[Object(date_util_["parseDate"])(Object(date_util_["formatDate"])(_this.minDate, format), format), Object(date_util_["parseDate"])('23:59:59', format)]];
|
19488 | }
|
19489 | });
|
19490 | if (val && this.$refs.minTimePicker) {
|
19491 | this.$refs.minTimePicker.date = val;
|
19492 | this.$refs.minTimePicker.value = val;
|
19493 | }
|
19494 | },
|
19495 | maxDate: function maxDate(val) {
|
19496 | this.dateUserInput.max = null;
|
19497 | this.timeUserInput.max = null;
|
19498 | if (val && this.$refs.maxTimePicker) {
|
19499 | this.$refs.maxTimePicker.date = val;
|
19500 | this.$refs.maxTimePicker.value = val;
|
19501 | }
|
19502 | },
|
19503 | minTimePickerVisible: function minTimePickerVisible(val) {
|
19504 | var _this2 = this;
|
19505 |
|
19506 | if (val) {
|
19507 | this.$nextTick(function () {
|
19508 | _this2.$refs.minTimePicker.date = _this2.minDate;
|
19509 | _this2.$refs.minTimePicker.value = _this2.minDate;
|
19510 | _this2.$refs.minTimePicker.adjustSpinners();
|
19511 | });
|
19512 | }
|
19513 | },
|
19514 | maxTimePickerVisible: function maxTimePickerVisible(val) {
|
19515 | var _this3 = this;
|
19516 |
|
19517 | if (val) {
|
19518 | this.$nextTick(function () {
|
19519 | _this3.$refs.maxTimePicker.date = _this3.maxDate;
|
19520 | _this3.$refs.maxTimePicker.value = _this3.maxDate;
|
19521 | _this3.$refs.maxTimePicker.adjustSpinners();
|
19522 | });
|
19523 | }
|
19524 | },
|
19525 | value: function value(newVal) {
|
19526 | if (!newVal) {
|
19527 | this.minDate = null;
|
19528 | this.maxDate = null;
|
19529 | } else if (Array.isArray(newVal)) {
|
19530 | this.minDate = Object(date_util_["isDate"])(newVal[0]) ? new Date(newVal[0]) : null;
|
19531 | this.maxDate = Object(date_util_["isDate"])(newVal[1]) ? new Date(newVal[1]) : null;
|
19532 | if (this.minDate) {
|
19533 | this.leftDate = this.minDate;
|
19534 | if (this.unlinkPanels && this.maxDate) {
|
19535 | var minDateYear = this.minDate.getFullYear();
|
19536 | var minDateMonth = this.minDate.getMonth();
|
19537 | var maxDateYear = this.maxDate.getFullYear();
|
19538 | var maxDateMonth = this.maxDate.getMonth();
|
19539 | this.rightDate = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? Object(date_util_["nextMonth"])(this.maxDate) : this.maxDate;
|
19540 | } else {
|
19541 | this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
|
19542 | }
|
19543 | } else {
|
19544 | this.leftDate = date_rangevue_type_script_lang_js_calcDefaultValue(this.defaultValue)[0];
|
19545 | this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
|
19546 | }
|
19547 | }
|
19548 | },
|
19549 | defaultValue: function defaultValue(val) {
|
19550 | if (!Array.isArray(this.value)) {
|
19551 | var _calcDefaultValue = date_rangevue_type_script_lang_js_calcDefaultValue(val),
|
19552 | left = _calcDefaultValue[0],
|
19553 | right = _calcDefaultValue[1];
|
19554 |
|
19555 | this.leftDate = left;
|
19556 | this.rightDate = val && val[1] && this.unlinkPanels ? right : Object(date_util_["nextMonth"])(this.leftDate);
|
19557 | }
|
19558 | }
|
19559 | },
|
19560 |
|
19561 | methods: {
|
19562 | handleClear: function handleClear() {
|
19563 | this.minDate = null;
|
19564 | this.maxDate = null;
|
19565 | this.leftDate = date_rangevue_type_script_lang_js_calcDefaultValue(this.defaultValue)[0];
|
19566 | this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
|
19567 | this.$emit('pick', null);
|
19568 | },
|
19569 | handleChangeRange: function handleChangeRange(val) {
|
19570 | this.minDate = val.minDate;
|
19571 | this.maxDate = val.maxDate;
|
19572 | this.rangeState = val.rangeState;
|
19573 | },
|
19574 | handleDateInput: function handleDateInput(value, type) {
|
19575 | this.dateUserInput[type] = value;
|
19576 | if (value.length !== this.dateFormat.length) return;
|
19577 | var parsedValue = Object(date_util_["parseDate"])(value, this.dateFormat);
|
19578 |
|
19579 | if (parsedValue) {
|
19580 | if (typeof this.disabledDate === 'function' && this.disabledDate(new Date(parsedValue))) {
|
19581 | return;
|
19582 | }
|
19583 | if (type === 'min') {
|
19584 | this.minDate = Object(date_util_["modifyDate"])(this.minDate || new Date(), parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
|
19585 | this.leftDate = new Date(parsedValue);
|
19586 | if (!this.unlinkPanels) {
|
19587 | this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
|
19588 | }
|
19589 | } else {
|
19590 | this.maxDate = Object(date_util_["modifyDate"])(this.maxDate || new Date(), parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
|
19591 | this.rightDate = new Date(parsedValue);
|
19592 | if (!this.unlinkPanels) {
|
19593 | this.leftDate = Object(date_util_["prevMonth"])(parsedValue);
|
19594 | }
|
19595 | }
|
19596 | }
|
19597 | },
|
19598 | handleDateChange: function handleDateChange(value, type) {
|
19599 | var parsedValue = Object(date_util_["parseDate"])(value, this.dateFormat);
|
19600 | if (parsedValue) {
|
19601 | if (type === 'min') {
|
19602 | this.minDate = Object(date_util_["modifyDate"])(this.minDate, parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
|
19603 | if (this.minDate > this.maxDate) {
|
19604 | this.maxDate = this.minDate;
|
19605 | }
|
19606 | } else {
|
19607 | this.maxDate = Object(date_util_["modifyDate"])(this.maxDate, parsedValue.getFullYear(), parsedValue.getMonth(), parsedValue.getDate());
|
19608 | if (this.maxDate < this.minDate) {
|
19609 | this.minDate = this.maxDate;
|
19610 | }
|
19611 | }
|
19612 | }
|
19613 | },
|
19614 | handleTimeInput: function handleTimeInput(value, type) {
|
19615 | var _this4 = this;
|
19616 |
|
19617 | this.timeUserInput[type] = value;
|
19618 | if (value.length !== this.timeFormat.length) return;
|
19619 | var parsedValue = Object(date_util_["parseDate"])(value, this.timeFormat);
|
19620 |
|
19621 | if (parsedValue) {
|
19622 | if (type === 'min') {
|
19623 | this.minDate = Object(date_util_["modifyTime"])(this.minDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
|
19624 | this.$nextTick(function (_) {
|
19625 | return _this4.$refs.minTimePicker.adjustSpinners();
|
19626 | });
|
19627 | } else {
|
19628 | this.maxDate = Object(date_util_["modifyTime"])(this.maxDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
|
19629 | this.$nextTick(function (_) {
|
19630 | return _this4.$refs.maxTimePicker.adjustSpinners();
|
19631 | });
|
19632 | }
|
19633 | }
|
19634 | },
|
19635 | handleTimeChange: function handleTimeChange(value, type) {
|
19636 | var parsedValue = Object(date_util_["parseDate"])(value, this.timeFormat);
|
19637 | if (parsedValue) {
|
19638 | if (type === 'min') {
|
19639 | this.minDate = Object(date_util_["modifyTime"])(this.minDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
|
19640 | if (this.minDate > this.maxDate) {
|
19641 | this.maxDate = this.minDate;
|
19642 | }
|
19643 | this.$refs.minTimePicker.value = this.minDate;
|
19644 | this.minTimePickerVisible = false;
|
19645 | } else {
|
19646 | this.maxDate = Object(date_util_["modifyTime"])(this.maxDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
|
19647 | if (this.maxDate < this.minDate) {
|
19648 | this.minDate = this.maxDate;
|
19649 | }
|
19650 | this.$refs.maxTimePicker.value = this.minDate;
|
19651 | this.maxTimePickerVisible = false;
|
19652 | }
|
19653 | }
|
19654 | },
|
19655 | handleRangePick: function handleRangePick(val) {
|
19656 | var _this5 = this;
|
19657 |
|
19658 | var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
19659 |
|
19660 | var defaultTime = this.defaultTime || [];
|
19661 | var minDate = Object(date_util_["modifyWithTimeString"])(val.minDate, defaultTime[0]);
|
19662 | var maxDate = Object(date_util_["modifyWithTimeString"])(val.maxDate, defaultTime[1]);
|
19663 |
|
19664 | if (this.maxDate === maxDate && this.minDate === minDate) {
|
19665 | return;
|
19666 | }
|
19667 | this.onPick && this.onPick(val);
|
19668 | this.maxDate = maxDate;
|
19669 | this.minDate = minDate;
|
19670 |
|
19671 |
|
19672 | setTimeout(function () {
|
19673 | _this5.maxDate = maxDate;
|
19674 | _this5.minDate = minDate;
|
19675 | }, 10);
|
19676 | if (!close || this.showTime) return;
|
19677 | this.handleConfirm();
|
19678 | },
|
19679 | handleShortcutClick: function handleShortcutClick(shortcut) {
|
19680 | if (shortcut.onClick) {
|
19681 | shortcut.onClick(this);
|
19682 | }
|
19683 | },
|
19684 | handleMinTimePick: function handleMinTimePick(value, visible, first) {
|
19685 | this.minDate = this.minDate || new Date();
|
19686 | if (value) {
|
19687 | this.minDate = Object(date_util_["modifyTime"])(this.minDate, value.getHours(), value.getMinutes(), value.getSeconds());
|
19688 | }
|
19689 |
|
19690 | if (!first) {
|
19691 | this.minTimePickerVisible = visible;
|
19692 | }
|
19693 |
|
19694 | if (!this.maxDate || this.maxDate && this.maxDate.getTime() < this.minDate.getTime()) {
|
19695 | this.maxDate = new Date(this.minDate);
|
19696 | }
|
19697 | },
|
19698 | handleMinTimeClose: function handleMinTimeClose() {
|
19699 | this.minTimePickerVisible = false;
|
19700 | },
|
19701 | handleMaxTimePick: function handleMaxTimePick(value, visible, first) {
|
19702 | if (this.maxDate && value) {
|
19703 | this.maxDate = Object(date_util_["modifyTime"])(this.maxDate, value.getHours(), value.getMinutes(), value.getSeconds());
|
19704 | }
|
19705 |
|
19706 | if (!first) {
|
19707 | this.maxTimePickerVisible = visible;
|
19708 | }
|
19709 |
|
19710 | if (this.maxDate && this.minDate && this.minDate.getTime() > this.maxDate.getTime()) {
|
19711 | this.minDate = new Date(this.maxDate);
|
19712 | }
|
19713 | },
|
19714 | handleMaxTimeClose: function handleMaxTimeClose() {
|
19715 | this.maxTimePickerVisible = false;
|
19716 | },
|
19717 |
|
19718 |
|
19719 |
|
19720 | leftPrevYear: function leftPrevYear() {
|
19721 | this.leftDate = Object(date_util_["prevYear"])(this.leftDate);
|
19722 | if (!this.unlinkPanels) {
|
19723 | this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
|
19724 | }
|
19725 | },
|
19726 | leftPrevMonth: function leftPrevMonth() {
|
19727 | this.leftDate = Object(date_util_["prevMonth"])(this.leftDate);
|
19728 | if (!this.unlinkPanels) {
|
19729 | this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
|
19730 | }
|
19731 | },
|
19732 | rightNextYear: function rightNextYear() {
|
19733 | if (!this.unlinkPanels) {
|
19734 | this.leftDate = Object(date_util_["nextYear"])(this.leftDate);
|
19735 | this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
|
19736 | } else {
|
19737 | this.rightDate = Object(date_util_["nextYear"])(this.rightDate);
|
19738 | }
|
19739 | },
|
19740 | rightNextMonth: function rightNextMonth() {
|
19741 | if (!this.unlinkPanels) {
|
19742 | this.leftDate = Object(date_util_["nextMonth"])(this.leftDate);
|
19743 | this.rightDate = Object(date_util_["nextMonth"])(this.leftDate);
|
19744 | } else {
|
19745 | this.rightDate = Object(date_util_["nextMonth"])(this.rightDate);
|
19746 | }
|
19747 | },
|
19748 |
|
19749 |
|
19750 |
|
19751 | leftNextYear: function leftNextYear() {
|
19752 | this.leftDate = Object(date_util_["nextYear"])(this.leftDate);
|
19753 | },
|
19754 | leftNextMonth: function leftNextMonth() {
|
19755 | this.leftDate = Object(date_util_["nextMonth"])(this.leftDate);
|
19756 | },
|
19757 | rightPrevYear: function rightPrevYear() {
|
19758 | this.rightDate = Object(date_util_["prevYear"])(this.rightDate);
|
19759 | },
|
19760 | rightPrevMonth: function rightPrevMonth() {
|
19761 | this.rightDate = Object(date_util_["prevMonth"])(this.rightDate);
|
19762 | },
|
19763 | handleConfirm: function handleConfirm() {
|
19764 | var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
19765 |
|
19766 | if (this.isValidValue([this.minDate, this.maxDate])) {
|
19767 | this.$emit('pick', [this.minDate, this.maxDate], visible);
|
19768 | }
|
19769 | },
|
19770 | isValidValue: function isValidValue(value) {
|
19771 | return Array.isArray(value) && value && value[0] && value[1] && Object(date_util_["isDate"])(value[0]) && Object(date_util_["isDate"])(value[1]) && value[0].getTime() <= value[1].getTime() && (typeof this.disabledDate === 'function' ? !this.disabledDate(value[0]) && !this.disabledDate(value[1]) : true);
|
19772 | },
|
19773 | resetView: function resetView() {
|
19774 |
|
19775 |
|
19776 |
|
19777 | if (this.minDate && this.maxDate == null) this.rangeState.selecting = false;
|
19778 | this.minDate = this.value && Object(date_util_["isDate"])(this.value[0]) ? new Date(this.value[0]) : null;
|
19779 | this.maxDate = this.value && Object(date_util_["isDate"])(this.value[0]) ? new Date(this.value[1]) : null;
|
19780 | }
|
19781 | },
|
19782 |
|
19783 | components: { TimePicker: panel_time, DateTable: date_table, ElInput: input_default.a, ElButton: button_default.a }
|
19784 | });
|
19785 |
|
19786 | var panel_date_rangevue_type_script_lang_js_ = (date_rangevue_type_script_lang_js_);
|
19787 |
|
19788 |
|
19789 |
|
19790 |
|
19791 |
|
19792 |
|
19793 |
|
19794 |
|
19795 | var date_range_component = normalizeComponent(
|
19796 | panel_date_rangevue_type_script_lang_js_,
|
19797 | date_rangevue_type_template_id_2652849a_render,
|
19798 | date_rangevue_type_template_id_2652849a_staticRenderFns,
|
19799 | false,
|
19800 | null,
|
19801 | null,
|
19802 | null
|
19803 |
|
19804 | )
|
19805 |
|
19806 |
|
19807 | if (false) { var date_range_api; }
|
19808 | date_range_component.options.__file = "packages/date-picker/src/panel/date-range.vue"
|
19809 | var date_range = (date_range_component.exports);
|
19810 |
|
19811 | var month_rangevue_type_template_id_f2645fb8_render = function() {
|
19812 | var _vm = this
|
19813 | var _h = _vm.$createElement
|
19814 | var _c = _vm._self._c || _h
|
19815 | return _c(
|
19816 | "transition",
|
19817 | {
|
19818 | attrs: { name: "el-zoom-in-top" },
|
19819 | on: {
|
19820 | "after-leave": function($event) {
|
19821 | _vm.$emit("dodestroy")
|
19822 | }
|
19823 | }
|
19824 | },
|
19825 | [
|
19826 | _c(
|
19827 | "div",
|
19828 | {
|
19829 | directives: [
|
19830 | {
|
19831 | name: "show",
|
19832 | rawName: "v-show",
|
19833 | value: _vm.visible,
|
19834 | expression: "visible"
|
19835 | }
|
19836 | ],
|
19837 | staticClass: "el-picker-panel el-date-range-picker el-popper",
|
19838 | class: [
|
19839 | {
|
19840 | "has-sidebar": _vm.$slots.sidebar || _vm.shortcuts
|
19841 | },
|
19842 | _vm.popperClass
|
19843 | ]
|
19844 | },
|
19845 | [
|
19846 | _c(
|
19847 | "div",
|
19848 | { staticClass: "el-picker-panel__body-wrapper" },
|
19849 | [
|
19850 | _vm._t("sidebar"),
|
19851 | _vm.shortcuts
|
19852 | ? _c(
|
19853 | "div",
|
19854 | { staticClass: "el-picker-panel__sidebar" },
|
19855 | _vm._l(_vm.shortcuts, function(shortcut, key) {
|
19856 | return _c(
|
19857 | "button",
|
19858 | {
|
19859 | key: key,
|
19860 | staticClass: "el-picker-panel__shortcut",
|
19861 | attrs: { type: "button" },
|
19862 | on: {
|
19863 | click: function($event) {
|
19864 | _vm.handleShortcutClick(shortcut)
|
19865 | }
|
19866 | }
|
19867 | },
|
19868 | [_vm._v(_vm._s(shortcut.text))]
|
19869 | )
|
19870 | }),
|
19871 | 0
|
19872 | )
|
19873 | : _vm._e(),
|
19874 | _c("div", { staticClass: "el-picker-panel__body" }, [
|
19875 | _c(
|
19876 | "div",
|
19877 | {
|
19878 | staticClass:
|
19879 | "el-picker-panel__content el-date-range-picker__content is-left"
|
19880 | },
|
19881 | [
|
19882 | _c("div", { staticClass: "el-date-range-picker__header" }, [
|
19883 | _c("button", {
|
19884 | staticClass:
|
19885 | "el-picker-panel__icon-btn el-icon-d-arrow-left",
|
19886 | attrs: { type: "button" },
|
19887 | on: { click: _vm.leftPrevYear }
|
19888 | }),
|
19889 | _vm.unlinkPanels
|
19890 | ? _c("button", {
|
19891 | staticClass:
|
19892 | "el-picker-panel__icon-btn el-icon-d-arrow-right",
|
19893 | class: { "is-disabled": !_vm.enableYearArrow },
|
19894 | attrs: {
|
19895 | type: "button",
|
19896 | disabled: !_vm.enableYearArrow
|
19897 | },
|
19898 | on: { click: _vm.leftNextYear }
|
19899 | })
|
19900 | : _vm._e(),
|
19901 | _c("div", [_vm._v(_vm._s(_vm.leftLabel))])
|
19902 | ]),
|
19903 | _c("month-table", {
|
19904 | attrs: {
|
19905 | "selection-mode": "range",
|
19906 | date: _vm.leftDate,
|
19907 | "default-value": _vm.defaultValue,
|
19908 | "min-date": _vm.minDate,
|
19909 | "max-date": _vm.maxDate,
|
19910 | "range-state": _vm.rangeState,
|
19911 | "disabled-date": _vm.disabledDate
|
19912 | },
|
19913 | on: {
|
19914 | changerange: _vm.handleChangeRange,
|
19915 | pick: _vm.handleRangePick
|
19916 | }
|
19917 | })
|
19918 | ],
|
19919 | 1
|
19920 | ),
|
19921 | _c(
|
19922 | "div",
|
19923 | {
|
19924 | staticClass:
|
19925 | "el-picker-panel__content el-date-range-picker__content is-right"
|
19926 | },
|
19927 | [
|
19928 | _c("div", { staticClass: "el-date-range-picker__header" }, [
|
19929 | _vm.unlinkPanels
|
19930 | ? _c("button", {
|
19931 | staticClass:
|
19932 | "el-picker-panel__icon-btn el-icon-d-arrow-left",
|
19933 | class: { "is-disabled": !_vm.enableYearArrow },
|
19934 | attrs: {
|
19935 | type: "button",
|
19936 | disabled: !_vm.enableYearArrow
|
19937 | },
|
19938 | on: { click: _vm.rightPrevYear }
|
19939 | })
|
19940 | : _vm._e(),
|
19941 | _c("button", {
|
19942 | staticClass:
|
19943 | "el-picker-panel__icon-btn el-icon-d-arrow-right",
|
19944 | attrs: { type: "button" },
|
19945 | on: { click: _vm.rightNextYear }
|
19946 | }),
|
19947 | _c("div", [_vm._v(_vm._s(_vm.rightLabel))])
|
19948 | ]),
|
19949 | _c("month-table", {
|
19950 | attrs: {
|
19951 | "selection-mode": "range",
|
19952 | date: _vm.rightDate,
|
19953 | "default-value": _vm.defaultValue,
|
19954 | "min-date": _vm.minDate,
|
19955 | "max-date": _vm.maxDate,
|
19956 | "range-state": _vm.rangeState,
|
19957 | "disabled-date": _vm.disabledDate
|
19958 | },
|
19959 | on: {
|
19960 | changerange: _vm.handleChangeRange,
|
19961 | pick: _vm.handleRangePick
|
19962 | }
|
19963 | })
|
19964 | ],
|
19965 | 1
|
19966 | )
|
19967 | ])
|
19968 | ],
|
19969 | 2
|
19970 | )
|
19971 | ]
|
19972 | )
|
19973 | ]
|
19974 | )
|
19975 | }
|
19976 | var month_rangevue_type_template_id_f2645fb8_staticRenderFns = []
|
19977 | month_rangevue_type_template_id_f2645fb8_render._withStripped = true
|
19978 |
|
19979 |
|
19980 |
|
19981 |
|
19982 |
|
19983 |
|
19984 |
|
19985 |
|
19986 |
|
19987 |
|
19988 |
|
19989 |
|
19990 |
|
19991 |
|
19992 |
|
19993 |
|
19994 |
|
19995 |
|
19996 |
|
19997 |
|
19998 |
|
19999 |
|
20000 |
|
20001 |
|
20002 |
|
20003 |
|
20004 |
|
20005 |
|
20006 |
|
20007 |
|
20008 |
|
20009 |
|
20010 |
|
20011 |
|
20012 |
|
20013 |
|
20014 |
|
20015 |
|
20016 |
|
20017 |
|
20018 |
|
20019 |
|
20020 |
|
20021 |
|
20022 |
|
20023 |
|
20024 |
|
20025 |
|
20026 |
|
20027 |
|
20028 |
|
20029 |
|
20030 |
|
20031 |
|
20032 |
|
20033 |
|
20034 |
|
20035 |
|
20036 |
|
20037 |
|
20038 |
|
20039 |
|
20040 |
|
20041 |
|
20042 |
|
20043 |
|
20044 |
|
20045 |
|
20046 |
|
20047 |
|
20048 |
|
20049 |
|
20050 |
|
20051 |
|
20052 |
|
20053 |
|
20054 |
|
20055 |
|
20056 |
|
20057 |
|
20058 |
|
20059 |
|
20060 |
|
20061 |
|
20062 |
|
20063 |
|
20064 |
|
20065 |
|
20066 |
|
20067 |
|
20068 |
|
20069 |
|
20070 | var month_rangevue_type_script_lang_js_calcDefaultValue = function calcDefaultValue(defaultValue) {
|
20071 | if (Array.isArray(defaultValue)) {
|
20072 | return [new Date(defaultValue[0]), new Date(defaultValue[1])];
|
20073 | } else if (defaultValue) {
|
20074 | return [new Date(defaultValue), Object(date_util_["nextMonth"])(new Date(defaultValue))];
|
20075 | } else {
|
20076 | return [new Date(), Object(date_util_["nextMonth"])(new Date())];
|
20077 | }
|
20078 | };
|
20079 | var month_rangevue_type_script_lang_js_ = ({
|
20080 | mixins: [locale_default.a],
|
20081 |
|
20082 | directives: { Clickoutside: clickoutside_default.a },
|
20083 |
|
20084 | computed: {
|
20085 | btnDisabled: function btnDisabled() {
|
20086 | return !(this.minDate && this.maxDate && !this.selecting && this.isValidValue([this.minDate, this.maxDate]));
|
20087 | },
|
20088 | leftLabel: function leftLabel() {
|
20089 | return this.leftDate.getFullYear() + ' ' + this.t('el.datepicker.year');
|
20090 | },
|
20091 | rightLabel: function rightLabel() {
|
20092 | return this.rightDate.getFullYear() + ' ' + this.t('el.datepicker.year');
|
20093 | },
|
20094 | leftYear: function leftYear() {
|
20095 | return this.leftDate.getFullYear();
|
20096 | },
|
20097 | rightYear: function rightYear() {
|
20098 | return this.rightDate.getFullYear() === this.leftDate.getFullYear() ? this.leftDate.getFullYear() + 1 : this.rightDate.getFullYear();
|
20099 | },
|
20100 | enableYearArrow: function enableYearArrow() {
|
20101 | return this.unlinkPanels && this.rightYear > this.leftYear + 1;
|
20102 | }
|
20103 | },
|
20104 |
|
20105 | data: function data() {
|
20106 | return {
|
20107 | popperClass: '',
|
20108 | value: [],
|
20109 | defaultValue: null,
|
20110 | defaultTime: null,
|
20111 | minDate: '',
|
20112 | maxDate: '',
|
20113 | leftDate: new Date(),
|
20114 | rightDate: Object(date_util_["nextYear"])(new Date()),
|
20115 | rangeState: {
|
20116 | endDate: null,
|
20117 | selecting: false,
|
20118 | row: null,
|
20119 | column: null
|
20120 | },
|
20121 | shortcuts: '',
|
20122 | visible: '',
|
20123 | disabledDate: '',
|
20124 | format: '',
|
20125 | arrowControl: false,
|
20126 | unlinkPanels: false
|
20127 | };
|
20128 | },
|
20129 |
|
20130 |
|
20131 | watch: {
|
20132 | value: function value(newVal) {
|
20133 | if (!newVal) {
|
20134 | this.minDate = null;
|
20135 | this.maxDate = null;
|
20136 | } else if (Array.isArray(newVal)) {
|
20137 | this.minDate = Object(date_util_["isDate"])(newVal[0]) ? new Date(newVal[0]) : null;
|
20138 | this.maxDate = Object(date_util_["isDate"])(newVal[1]) ? new Date(newVal[1]) : null;
|
20139 | if (this.minDate) {
|
20140 | this.leftDate = this.minDate;
|
20141 | if (this.unlinkPanels && this.maxDate) {
|
20142 | var minDateYear = this.minDate.getFullYear();
|
20143 | var maxDateYear = this.maxDate.getFullYear();
|
20144 | this.rightDate = minDateYear === maxDateYear ? Object(date_util_["nextYear"])(this.maxDate) : this.maxDate;
|
20145 | } else {
|
20146 | this.rightDate = Object(date_util_["nextYear"])(this.leftDate);
|
20147 | }
|
20148 | } else {
|
20149 | this.leftDate = month_rangevue_type_script_lang_js_calcDefaultValue(this.defaultValue)[0];
|
20150 | this.rightDate = Object(date_util_["nextYear"])(this.leftDate);
|
20151 | }
|
20152 | }
|
20153 | },
|
20154 | defaultValue: function defaultValue(val) {
|
20155 | if (!Array.isArray(this.value)) {
|
20156 | var _calcDefaultValue = month_rangevue_type_script_lang_js_calcDefaultValue(val),
|
20157 | left = _calcDefaultValue[0],
|
20158 | right = _calcDefaultValue[1];
|
20159 |
|
20160 | this.leftDate = left;
|
20161 | this.rightDate = val && val[1] && left.getFullYear() !== right.getFullYear() && this.unlinkPanels ? right : Object(date_util_["nextYear"])(this.leftDate);
|
20162 | }
|
20163 | }
|
20164 | },
|
20165 |
|
20166 | methods: {
|
20167 | handleClear: function handleClear() {
|
20168 | this.minDate = null;
|
20169 | this.maxDate = null;
|
20170 | this.leftDate = month_rangevue_type_script_lang_js_calcDefaultValue(this.defaultValue)[0];
|
20171 | this.rightDate = Object(date_util_["nextYear"])(this.leftDate);
|
20172 | this.$emit('pick', null);
|
20173 | },
|
20174 | handleChangeRange: function handleChangeRange(val) {
|
20175 | this.minDate = val.minDate;
|
20176 | this.maxDate = val.maxDate;
|
20177 | this.rangeState = val.rangeState;
|
20178 | },
|
20179 | handleRangePick: function handleRangePick(val) {
|
20180 | var _this = this;
|
20181 |
|
20182 | var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
20183 |
|
20184 | var defaultTime = this.defaultTime || [];
|
20185 | var minDate = Object(date_util_["modifyWithTimeString"])(val.minDate, defaultTime[0]);
|
20186 | var maxDate = Object(date_util_["modifyWithTimeString"])(val.maxDate, defaultTime[1]);
|
20187 | if (this.maxDate === maxDate && this.minDate === minDate) {
|
20188 | return;
|
20189 | }
|
20190 | this.onPick && this.onPick(val);
|
20191 | this.maxDate = maxDate;
|
20192 | this.minDate = minDate;
|
20193 |
|
20194 |
|
20195 | setTimeout(function () {
|
20196 | _this.maxDate = maxDate;
|
20197 | _this.minDate = minDate;
|
20198 | }, 10);
|
20199 | if (!close) return;
|
20200 | this.handleConfirm();
|
20201 | },
|
20202 | handleShortcutClick: function handleShortcutClick(shortcut) {
|
20203 | if (shortcut.onClick) {
|
20204 | shortcut.onClick(this);
|
20205 | }
|
20206 | },
|
20207 |
|
20208 |
|
20209 |
|
20210 | leftPrevYear: function leftPrevYear() {
|
20211 | this.leftDate = Object(date_util_["prevYear"])(this.leftDate);
|
20212 | if (!this.unlinkPanels) {
|
20213 | this.rightDate = Object(date_util_["prevYear"])(this.rightDate);
|
20214 | }
|
20215 | },
|
20216 | rightNextYear: function rightNextYear() {
|
20217 | if (!this.unlinkPanels) {
|
20218 | this.leftDate = Object(date_util_["nextYear"])(this.leftDate);
|
20219 | }
|
20220 | this.rightDate = Object(date_util_["nextYear"])(this.rightDate);
|
20221 | },
|
20222 |
|
20223 |
|
20224 |
|
20225 | leftNextYear: function leftNextYear() {
|
20226 | this.leftDate = Object(date_util_["nextYear"])(this.leftDate);
|
20227 | },
|
20228 | rightPrevYear: function rightPrevYear() {
|
20229 | this.rightDate = Object(date_util_["prevYear"])(this.rightDate);
|
20230 | },
|
20231 | handleConfirm: function handleConfirm() {
|
20232 | var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
20233 |
|
20234 | if (this.isValidValue([this.minDate, this.maxDate])) {
|
20235 | this.$emit('pick', [this.minDate, this.maxDate], visible);
|
20236 | }
|
20237 | },
|
20238 | isValidValue: function isValidValue(value) {
|
20239 | return Array.isArray(value) && value && value[0] && value[1] && Object(date_util_["isDate"])(value[0]) && Object(date_util_["isDate"])(value[1]) && value[0].getTime() <= value[1].getTime() && (typeof this.disabledDate === 'function' ? !this.disabledDate(value[0]) && !this.disabledDate(value[1]) : true);
|
20240 | },
|
20241 | resetView: function resetView() {
|
20242 |
|
20243 |
|
20244 |
|
20245 | this.minDate = this.value && Object(date_util_["isDate"])(this.value[0]) ? new Date(this.value[0]) : null;
|
20246 | this.maxDate = this.value && Object(date_util_["isDate"])(this.value[0]) ? new Date(this.value[1]) : null;
|
20247 | }
|
20248 | },
|
20249 |
|
20250 | components: { MonthTable: month_table, ElInput: input_default.a, ElButton: button_default.a }
|
20251 | });
|
20252 |
|
20253 | var panel_month_rangevue_type_script_lang_js_ = (month_rangevue_type_script_lang_js_);
|
20254 |
|
20255 |
|
20256 |
|
20257 |
|
20258 |
|
20259 |
|
20260 |
|
20261 |
|
20262 | var month_range_component = normalizeComponent(
|
20263 | panel_month_rangevue_type_script_lang_js_,
|
20264 | month_rangevue_type_template_id_f2645fb8_render,
|
20265 | month_rangevue_type_template_id_f2645fb8_staticRenderFns,
|
20266 | false,
|
20267 | null,
|
20268 | null,
|
20269 | null
|
20270 |
|
20271 | )
|
20272 |
|
20273 |
|
20274 | if (false) { var month_range_api; }
|
20275 | month_range_component.options.__file = "packages/date-picker/src/panel/month-range.vue"
|
20276 | var month_range = (month_range_component.exports);
|
20277 |
|
20278 |
|
20279 |
|
20280 |
|
20281 |
|
20282 |
|
20283 | var date_picker_getPanel = function getPanel(type) {
|
20284 | if (type === 'daterange' || type === 'datetimerange') {
|
20285 | return date_range;
|
20286 | } else if (type === 'monthrange') {
|
20287 | return month_range;
|
20288 | }
|
20289 | return panel_date;
|
20290 | };
|
20291 |
|
20292 | var date_picker = ({
|
20293 | mixins: [picker],
|
20294 |
|
20295 | name: 'ElDatePicker',
|
20296 |
|
20297 | props: {
|
20298 | type: {
|
20299 | type: String,
|
20300 | default: 'date'
|
20301 | },
|
20302 | timeArrowControl: Boolean
|
20303 | },
|
20304 |
|
20305 | watch: {
|
20306 | type: function type(_type) {
|
20307 | if (this.picker) {
|
20308 | this.unmountPicker();
|
20309 | this.panel = date_picker_getPanel(_type);
|
20310 | this.mountPicker();
|
20311 | } else {
|
20312 | this.panel = date_picker_getPanel(_type);
|
20313 | }
|
20314 | }
|
20315 | },
|
20316 |
|
20317 | created: function created() {
|
20318 | this.panel = date_picker_getPanel(this.type);
|
20319 | }
|
20320 | });
|
20321 |
|
20322 |
|
20323 |
|
20324 |
|
20325 | date_picker.install = function install(Vue) {
|
20326 | Vue.component(date_picker.name, date_picker);
|
20327 | };
|
20328 |
|
20329 | var packages_date_picker = (date_picker);
|
20330 |
|
20331 | var time_selectvue_type_template_id_51ab9320_render = function() {
|
20332 | var _vm = this
|
20333 | var _h = _vm.$createElement
|
20334 | var _c = _vm._self._c || _h
|
20335 | return _c(
|
20336 | "transition",
|
20337 | {
|
20338 | attrs: { name: "el-zoom-in-top" },
|
20339 | on: {
|
20340 | "before-enter": _vm.handleMenuEnter,
|
20341 | "after-leave": function($event) {
|
20342 | _vm.$emit("dodestroy")
|
20343 | }
|
20344 | }
|
20345 | },
|
20346 | [
|
20347 | _c(
|
20348 | "div",
|
20349 | {
|
20350 | directives: [
|
20351 | {
|
20352 | name: "show",
|
20353 | rawName: "v-show",
|
20354 | value: _vm.visible,
|
20355 | expression: "visible"
|
20356 | }
|
20357 | ],
|
20358 | ref: "popper",
|
20359 | staticClass: "el-picker-panel time-select el-popper",
|
20360 | class: _vm.popperClass,
|
20361 | style: { width: _vm.width + "px" }
|
20362 | },
|
20363 | [
|
20364 | _c(
|
20365 | "el-scrollbar",
|
20366 | {
|
20367 | attrs: { noresize: "", "wrap-class": "el-picker-panel__content" }
|
20368 | },
|
20369 | _vm._l(_vm.items, function(item) {
|
20370 | return _c(
|
20371 | "div",
|
20372 | {
|
20373 | key: item.value,
|
20374 | staticClass: "time-select-item",
|
20375 | class: {
|
20376 | selected: _vm.value === item.value,
|
20377 | disabled: item.disabled,
|
20378 | default: item.value === _vm.defaultValue
|
20379 | },
|
20380 | attrs: { disabled: item.disabled },
|
20381 | on: {
|
20382 | click: function($event) {
|
20383 | _vm.handleClick(item)
|
20384 | }
|
20385 | }
|
20386 | },
|
20387 | [_vm._v(_vm._s(item.value))]
|
20388 | )
|
20389 | }),
|
20390 | 0
|
20391 | )
|
20392 | ],
|
20393 | 1
|
20394 | )
|
20395 | ]
|
20396 | )
|
20397 | }
|
20398 | var time_selectvue_type_template_id_51ab9320_staticRenderFns = []
|
20399 | time_selectvue_type_template_id_51ab9320_render._withStripped = true
|
20400 |
|
20401 |
|
20402 |
|
20403 |
|
20404 |
|
20405 |
|
20406 |
|
20407 |
|
20408 |
|
20409 |
|
20410 |
|
20411 |
|
20412 |
|
20413 |
|
20414 |
|
20415 |
|
20416 |
|
20417 |
|
20418 |
|
20419 |
|
20420 |
|
20421 |
|
20422 |
|
20423 |
|
20424 |
|
20425 |
|
20426 |
|
20427 |
|
20428 |
|
20429 | var parseTime = function parseTime(time) {
|
20430 | var values = (time || '').split(':');
|
20431 | if (values.length >= 2) {
|
20432 | var hours = parseInt(values[0], 10);
|
20433 | var minutes = parseInt(values[1], 10);
|
20434 |
|
20435 | return {
|
20436 | hours: hours,
|
20437 | minutes: minutes
|
20438 | };
|
20439 | }
|
20440 |
|
20441 | return null;
|
20442 | };
|
20443 |
|
20444 | var compareTime = function compareTime(time1, time2) {
|
20445 | var value1 = parseTime(time1);
|
20446 | var value2 = parseTime(time2);
|
20447 |
|
20448 | var minutes1 = value1.minutes + value1.hours * 60;
|
20449 | var minutes2 = value2.minutes + value2.hours * 60;
|
20450 |
|
20451 | if (minutes1 === minutes2) {
|
20452 | return 0;
|
20453 | }
|
20454 |
|
20455 | return minutes1 > minutes2 ? 1 : -1;
|
20456 | };
|
20457 |
|
20458 | var formatTime = function formatTime(time) {
|
20459 | return (time.hours < 10 ? '0' + time.hours : time.hours) + ':' + (time.minutes < 10 ? '0' + time.minutes : time.minutes);
|
20460 | };
|
20461 |
|
20462 | var nextTime = function nextTime(time, step) {
|
20463 | var timeValue = parseTime(time);
|
20464 | var stepValue = parseTime(step);
|
20465 |
|
20466 | var next = {
|
20467 | hours: timeValue.hours,
|
20468 | minutes: timeValue.minutes
|
20469 | };
|
20470 |
|
20471 | next.minutes += stepValue.minutes;
|
20472 | next.hours += stepValue.hours;
|
20473 |
|
20474 | next.hours += Math.floor(next.minutes / 60);
|
20475 | next.minutes = next.minutes % 60;
|
20476 |
|
20477 | return formatTime(next);
|
20478 | };
|
20479 |
|
20480 | var time_selectvue_type_script_lang_js_ = ({
|
20481 | components: { ElScrollbar: scrollbar_default.a },
|
20482 |
|
20483 | watch: {
|
20484 | value: function value(val) {
|
20485 | var _this = this;
|
20486 |
|
20487 | if (!val) return;
|
20488 | this.$nextTick(function () {
|
20489 | return _this.scrollToOption();
|
20490 | });
|
20491 | }
|
20492 | },
|
20493 |
|
20494 | methods: {
|
20495 | handleClick: function handleClick(item) {
|
20496 | if (!item.disabled) {
|
20497 | this.$emit('pick', item.value);
|
20498 | }
|
20499 | },
|
20500 | handleClear: function handleClear() {
|
20501 | this.$emit('pick', null);
|
20502 | },
|
20503 | scrollToOption: function scrollToOption() {
|
20504 | var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.selected';
|
20505 |
|
20506 | var menu = this.$refs.popper.querySelector('.el-picker-panel__content');
|
20507 | scroll_into_view_default()(menu, menu.querySelector(selector));
|
20508 | },
|
20509 | handleMenuEnter: function handleMenuEnter() {
|
20510 | var _this2 = this;
|
20511 |
|
20512 | var selected = this.items.map(function (item) {
|
20513 | return item.value;
|
20514 | }).indexOf(this.value) !== -1;
|
20515 | var hasDefault = this.items.map(function (item) {
|
20516 | return item.value;
|
20517 | }).indexOf(this.defaultValue) !== -1;
|
20518 | var option = selected && '.selected' || hasDefault && '.default' || '.time-select-item:not(.disabled)';
|
20519 | this.$nextTick(function () {
|
20520 | return _this2.scrollToOption(option);
|
20521 | });
|
20522 | },
|
20523 | scrollDown: function scrollDown(step) {
|
20524 | var items = this.items;
|
20525 | var length = items.length;
|
20526 | var total = items.length;
|
20527 | var index = items.map(function (item) {
|
20528 | return item.value;
|
20529 | }).indexOf(this.value);
|
20530 | while (total--) {
|
20531 | index = (index + step + length) % length;
|
20532 | if (!items[index].disabled) {
|
20533 | this.$emit('pick', items[index].value, true);
|
20534 | return;
|
20535 | }
|
20536 | }
|
20537 | },
|
20538 | isValidValue: function isValidValue(date) {
|
20539 | return this.items.filter(function (item) {
|
20540 | return !item.disabled;
|
20541 | }).map(function (item) {
|
20542 | return item.value;
|
20543 | }).indexOf(date) !== -1;
|
20544 | },
|
20545 | handleKeydown: function handleKeydown(event) {
|
20546 | var keyCode = event.keyCode;
|
20547 | if (keyCode === 38 || keyCode === 40) {
|
20548 | var mapping = { 40: 1, 38: -1 };
|
20549 | var offset = mapping[keyCode.toString()];
|
20550 | this.scrollDown(offset);
|
20551 | event.stopPropagation();
|
20552 | return;
|
20553 | }
|
20554 | }
|
20555 | },
|
20556 |
|
20557 | data: function data() {
|
20558 | return {
|
20559 | popperClass: '',
|
20560 | start: '09:00',
|
20561 | end: '18:00',
|
20562 | step: '00:30',
|
20563 | value: '',
|
20564 | defaultValue: '',
|
20565 | visible: false,
|
20566 | minTime: '',
|
20567 | maxTime: '',
|
20568 | width: 0
|
20569 | };
|
20570 | },
|
20571 |
|
20572 |
|
20573 | computed: {
|
20574 | items: function items() {
|
20575 | var start = this.start;
|
20576 | var end = this.end;
|
20577 | var step = this.step;
|
20578 |
|
20579 | var result = [];
|
20580 |
|
20581 | if (start && end && step) {
|
20582 | var current = start;
|
20583 | while (compareTime(current, end) <= 0) {
|
20584 | result.push({
|
20585 | value: current,
|
20586 | disabled: compareTime(current, this.minTime || '-1:-1') <= 0 || compareTime(current, this.maxTime || '100:100') >= 0
|
20587 | });
|
20588 | current = nextTime(current, step);
|
20589 | }
|
20590 | }
|
20591 |
|
20592 | return result;
|
20593 | }
|
20594 | }
|
20595 | });
|
20596 |
|
20597 | var panel_time_selectvue_type_script_lang_js_ = (time_selectvue_type_script_lang_js_);
|
20598 |
|
20599 |
|
20600 |
|
20601 |
|
20602 |
|
20603 |
|
20604 |
|
20605 |
|
20606 | var time_select_component = normalizeComponent(
|
20607 | panel_time_selectvue_type_script_lang_js_,
|
20608 | time_selectvue_type_template_id_51ab9320_render,
|
20609 | time_selectvue_type_template_id_51ab9320_staticRenderFns,
|
20610 | false,
|
20611 | null,
|
20612 | null,
|
20613 | null
|
20614 |
|
20615 | )
|
20616 |
|
20617 |
|
20618 | if (false) { var time_select_api; }
|
20619 | time_select_component.options.__file = "packages/date-picker/src/panel/time-select.vue"
|
20620 | var time_select = (time_select_component.exports);
|
20621 |
|
20622 |
|
20623 |
|
20624 |
|
20625 | var picker_time_select = ({
|
20626 | mixins: [picker],
|
20627 |
|
20628 | name: 'ElTimeSelect',
|
20629 |
|
20630 | componentName: 'ElTimeSelect',
|
20631 |
|
20632 | props: {
|
20633 | type: {
|
20634 | type: String,
|
20635 | default: 'time-select'
|
20636 | }
|
20637 | },
|
20638 |
|
20639 | beforeCreate: function beforeCreate() {
|
20640 | this.panel = time_select;
|
20641 | }
|
20642 | });
|
20643 |
|
20644 |
|
20645 |
|
20646 |
|
20647 | picker_time_select.install = function (Vue) {
|
20648 | Vue.component(picker_time_select.name, picker_time_select);
|
20649 | };
|
20650 |
|
20651 | var packages_time_select = (picker_time_select);
|
20652 |
|
20653 | var time_rangevue_type_template_id_fb28660e_render = function() {
|
20654 | var _vm = this
|
20655 | var _h = _vm.$createElement
|
20656 | var _c = _vm._self._c || _h
|
20657 | return _c(
|
20658 | "transition",
|
20659 | {
|
20660 | attrs: { name: "el-zoom-in-top" },
|
20661 | on: {
|
20662 | "after-leave": function($event) {
|
20663 | _vm.$emit("dodestroy")
|
20664 | }
|
20665 | }
|
20666 | },
|
20667 | [
|
20668 | _c(
|
20669 | "div",
|
20670 | {
|
20671 | directives: [
|
20672 | {
|
20673 | name: "show",
|
20674 | rawName: "v-show",
|
20675 | value: _vm.visible,
|
20676 | expression: "visible"
|
20677 | }
|
20678 | ],
|
20679 | staticClass: "el-time-range-picker el-picker-panel el-popper",
|
20680 | class: _vm.popperClass
|
20681 | },
|
20682 | [
|
20683 | _c("div", { staticClass: "el-time-range-picker__content" }, [
|
20684 | _c("div", { staticClass: "el-time-range-picker__cell" }, [
|
20685 | _c("div", { staticClass: "el-time-range-picker__header" }, [
|
20686 | _vm._v(_vm._s(_vm.t("el.datepicker.startTime")))
|
20687 | ]),
|
20688 | _c(
|
20689 | "div",
|
20690 | {
|
20691 | staticClass:
|
20692 | "el-time-range-picker__body el-time-panel__content",
|
20693 | class: {
|
20694 | "has-seconds": _vm.showSeconds,
|
20695 | "is-arrow": _vm.arrowControl
|
20696 | }
|
20697 | },
|
20698 | [
|
20699 | _c("time-spinner", {
|
20700 | ref: "minSpinner",
|
20701 | attrs: {
|
20702 | "show-seconds": _vm.showSeconds,
|
20703 | "am-pm-mode": _vm.amPmMode,
|
20704 | "arrow-control": _vm.arrowControl,
|
20705 | date: _vm.minDate
|
20706 | },
|
20707 | on: {
|
20708 | change: _vm.handleMinChange,
|
20709 | "select-range": _vm.setMinSelectionRange
|
20710 | }
|
20711 | })
|
20712 | ],
|
20713 | 1
|
20714 | )
|
20715 | ]),
|
20716 | _c("div", { staticClass: "el-time-range-picker__cell" }, [
|
20717 | _c("div", { staticClass: "el-time-range-picker__header" }, [
|
20718 | _vm._v(_vm._s(_vm.t("el.datepicker.endTime")))
|
20719 | ]),
|
20720 | _c(
|
20721 | "div",
|
20722 | {
|
20723 | staticClass:
|
20724 | "el-time-range-picker__body el-time-panel__content",
|
20725 | class: {
|
20726 | "has-seconds": _vm.showSeconds,
|
20727 | "is-arrow": _vm.arrowControl
|
20728 | }
|
20729 | },
|
20730 | [
|
20731 | _c("time-spinner", {
|
20732 | ref: "maxSpinner",
|
20733 | attrs: {
|
20734 | "show-seconds": _vm.showSeconds,
|
20735 | "am-pm-mode": _vm.amPmMode,
|
20736 | "arrow-control": _vm.arrowControl,
|
20737 | date: _vm.maxDate
|
20738 | },
|
20739 | on: {
|
20740 | change: _vm.handleMaxChange,
|
20741 | "select-range": _vm.setMaxSelectionRange
|
20742 | }
|
20743 | })
|
20744 | ],
|
20745 | 1
|
20746 | )
|
20747 | ])
|
20748 | ]),
|
20749 | _c("div", { staticClass: "el-time-panel__footer" }, [
|
20750 | _c(
|
20751 | "button",
|
20752 | {
|
20753 | staticClass: "el-time-panel__btn cancel",
|
20754 | attrs: { type: "button" },
|
20755 | on: {
|
20756 | click: function($event) {
|
20757 | _vm.handleCancel()
|
20758 | }
|
20759 | }
|
20760 | },
|
20761 | [_vm._v(_vm._s(_vm.t("el.datepicker.cancel")))]
|
20762 | ),
|
20763 | _c(
|
20764 | "button",
|
20765 | {
|
20766 | staticClass: "el-time-panel__btn confirm",
|
20767 | attrs: { type: "button", disabled: _vm.btnDisabled },
|
20768 | on: {
|
20769 | click: function($event) {
|
20770 | _vm.handleConfirm()
|
20771 | }
|
20772 | }
|
20773 | },
|
20774 | [_vm._v(_vm._s(_vm.t("el.datepicker.confirm")))]
|
20775 | )
|
20776 | ])
|
20777 | ]
|
20778 | )
|
20779 | ]
|
20780 | )
|
20781 | }
|
20782 | var time_rangevue_type_template_id_fb28660e_staticRenderFns = []
|
20783 | time_rangevue_type_template_id_fb28660e_render._withStripped = true
|
20784 |
|
20785 |
|
20786 |
|
20787 |
|
20788 |
|
20789 |
|
20790 |
|
20791 |
|
20792 |
|
20793 |
|
20794 |
|
20795 |
|
20796 |
|
20797 |
|
20798 |
|
20799 |
|
20800 |
|
20801 |
|
20802 |
|
20803 |
|
20804 |
|
20805 |
|
20806 |
|
20807 |
|
20808 |
|
20809 |
|
20810 |
|
20811 |
|
20812 |
|
20813 |
|
20814 |
|
20815 |
|
20816 |
|
20817 |
|
20818 |
|
20819 |
|
20820 |
|
20821 |
|
20822 |
|
20823 |
|
20824 |
|
20825 |
|
20826 |
|
20827 |
|
20828 |
|
20829 |
|
20830 |
|
20831 |
|
20832 |
|
20833 |
|
20834 |
|
20835 |
|
20836 |
|
20837 |
|
20838 |
|
20839 |
|
20840 |
|
20841 |
|
20842 |
|
20843 |
|
20844 |
|
20845 |
|
20846 |
|
20847 |
|
20848 |
|
20849 |
|
20850 |
|
20851 | var MIN_TIME = Object(date_util_["parseDate"])('00:00:00', 'HH:mm:ss');
|
20852 | var MAX_TIME = Object(date_util_["parseDate"])('23:59:59', 'HH:mm:ss');
|
20853 |
|
20854 | var time_rangevue_type_script_lang_js_minTimeOfDay = function minTimeOfDay(date) {
|
20855 | return Object(date_util_["modifyDate"])(MIN_TIME, date.getFullYear(), date.getMonth(), date.getDate());
|
20856 | };
|
20857 |
|
20858 | var time_rangevue_type_script_lang_js_maxTimeOfDay = function maxTimeOfDay(date) {
|
20859 | return Object(date_util_["modifyDate"])(MAX_TIME, date.getFullYear(), date.getMonth(), date.getDate());
|
20860 | };
|
20861 |
|
20862 |
|
20863 | var advanceTime = function advanceTime(date, amount) {
|
20864 | return new Date(Math.min(date.getTime() + amount, time_rangevue_type_script_lang_js_maxTimeOfDay(date).getTime()));
|
20865 | };
|
20866 |
|
20867 | var time_rangevue_type_script_lang_js_ = ({
|
20868 | mixins: [locale_default.a],
|
20869 |
|
20870 | components: { TimeSpinner: time_spinner },
|
20871 |
|
20872 | computed: {
|
20873 | showSeconds: function showSeconds() {
|
20874 | return (this.format || '').indexOf('ss') !== -1;
|
20875 | },
|
20876 | offset: function offset() {
|
20877 | return this.showSeconds ? 11 : 8;
|
20878 | },
|
20879 | spinner: function spinner() {
|
20880 | return this.selectionRange[0] < this.offset ? this.$refs.minSpinner : this.$refs.maxSpinner;
|
20881 | },
|
20882 | btnDisabled: function btnDisabled() {
|
20883 | return this.minDate.getTime() > this.maxDate.getTime();
|
20884 | },
|
20885 | amPmMode: function amPmMode() {
|
20886 | if ((this.format || '').indexOf('A') !== -1) return 'A';
|
20887 | if ((this.format || '').indexOf('a') !== -1) return 'a';
|
20888 | return '';
|
20889 | }
|
20890 | },
|
20891 |
|
20892 | data: function data() {
|
20893 | return {
|
20894 | popperClass: '',
|
20895 | minDate: new Date(),
|
20896 | maxDate: new Date(),
|
20897 | value: [],
|
20898 | oldValue: [new Date(), new Date()],
|
20899 | defaultValue: null,
|
20900 | format: 'HH:mm:ss',
|
20901 | visible: false,
|
20902 | selectionRange: [0, 2],
|
20903 | arrowControl: false
|
20904 | };
|
20905 | },
|
20906 |
|
20907 |
|
20908 | watch: {
|
20909 | value: function value(_value) {
|
20910 | if (Array.isArray(_value)) {
|
20911 | this.minDate = new Date(_value[0]);
|
20912 | this.maxDate = new Date(_value[1]);
|
20913 | } else {
|
20914 | if (Array.isArray(this.defaultValue)) {
|
20915 | this.minDate = new Date(this.defaultValue[0]);
|
20916 | this.maxDate = new Date(this.defaultValue[1]);
|
20917 | } else if (this.defaultValue) {
|
20918 | this.minDate = new Date(this.defaultValue);
|
20919 | this.maxDate = advanceTime(new Date(this.defaultValue), 60 * 60 * 1000);
|
20920 | } else {
|
20921 | this.minDate = new Date();
|
20922 | this.maxDate = advanceTime(new Date(), 60 * 60 * 1000);
|
20923 | }
|
20924 | }
|
20925 | },
|
20926 | visible: function visible(val) {
|
20927 | var _this = this;
|
20928 |
|
20929 | if (val) {
|
20930 | this.oldValue = this.value;
|
20931 | this.$nextTick(function () {
|
20932 | return _this.$refs.minSpinner.emitSelectRange('hours');
|
20933 | });
|
20934 | }
|
20935 | }
|
20936 | },
|
20937 |
|
20938 | methods: {
|
20939 | handleClear: function handleClear() {
|
20940 | this.$emit('pick', null);
|
20941 | },
|
20942 | handleCancel: function handleCancel() {
|
20943 | this.$emit('pick', this.oldValue);
|
20944 | },
|
20945 | handleMinChange: function handleMinChange(date) {
|
20946 | this.minDate = Object(date_util_["clearMilliseconds"])(date);
|
20947 | this.handleChange();
|
20948 | },
|
20949 | handleMaxChange: function handleMaxChange(date) {
|
20950 | this.maxDate = Object(date_util_["clearMilliseconds"])(date);
|
20951 | this.handleChange();
|
20952 | },
|
20953 | handleChange: function handleChange() {
|
20954 | if (this.isValidValue([this.minDate, this.maxDate])) {
|
20955 | this.$refs.minSpinner.selectableRange = [[time_rangevue_type_script_lang_js_minTimeOfDay(this.minDate), this.maxDate]];
|
20956 | this.$refs.maxSpinner.selectableRange = [[this.minDate, time_rangevue_type_script_lang_js_maxTimeOfDay(this.maxDate)]];
|
20957 | this.$emit('pick', [this.minDate, this.maxDate], true);
|
20958 | }
|
20959 | },
|
20960 | setMinSelectionRange: function setMinSelectionRange(start, end) {
|
20961 | this.$emit('select-range', start, end, 'min');
|
20962 | this.selectionRange = [start, end];
|
20963 | },
|
20964 | setMaxSelectionRange: function setMaxSelectionRange(start, end) {
|
20965 | this.$emit('select-range', start, end, 'max');
|
20966 | this.selectionRange = [start + this.offset, end + this.offset];
|
20967 | },
|
20968 | handleConfirm: function handleConfirm() {
|
20969 | var visible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
20970 |
|
20971 | var minSelectableRange = this.$refs.minSpinner.selectableRange;
|
20972 | var maxSelectableRange = this.$refs.maxSpinner.selectableRange;
|
20973 |
|
20974 | this.minDate = Object(date_util_["limitTimeRange"])(this.minDate, minSelectableRange, this.format);
|
20975 | this.maxDate = Object(date_util_["limitTimeRange"])(this.maxDate, maxSelectableRange, this.format);
|
20976 |
|
20977 | this.$emit('pick', [this.minDate, this.maxDate], visible);
|
20978 | },
|
20979 | adjustSpinners: function adjustSpinners() {
|
20980 | this.$refs.minSpinner.adjustSpinners();
|
20981 | this.$refs.maxSpinner.adjustSpinners();
|
20982 | },
|
20983 | changeSelectionRange: function changeSelectionRange(step) {
|
20984 | var list = this.showSeconds ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
|
20985 | var mapping = ['hours', 'minutes'].concat(this.showSeconds ? ['seconds'] : []);
|
20986 | var index = list.indexOf(this.selectionRange[0]);
|
20987 | var next = (index + step + list.length) % list.length;
|
20988 | var half = list.length / 2;
|
20989 | if (next < half) {
|
20990 | this.$refs.minSpinner.emitSelectRange(mapping[next]);
|
20991 | } else {
|
20992 | this.$refs.maxSpinner.emitSelectRange(mapping[next - half]);
|
20993 | }
|
20994 | },
|
20995 | isValidValue: function isValidValue(date) {
|
20996 | return Array.isArray(date) && Object(date_util_["timeWithinRange"])(this.minDate, this.$refs.minSpinner.selectableRange) && Object(date_util_["timeWithinRange"])(this.maxDate, this.$refs.maxSpinner.selectableRange);
|
20997 | },
|
20998 | handleKeydown: function handleKeydown(event) {
|
20999 | var keyCode = event.keyCode;
|
21000 | var mapping = { 38: -1, 40: 1, 37: -1, 39: 1 };
|
21001 |
|
21002 |
|
21003 | if (keyCode === 37 || keyCode === 39) {
|
21004 | var step = mapping[keyCode];
|
21005 | this.changeSelectionRange(step);
|
21006 | event.preventDefault();
|
21007 | return;
|
21008 | }
|
21009 |
|
21010 |
|
21011 | if (keyCode === 38 || keyCode === 40) {
|
21012 | var _step = mapping[keyCode];
|
21013 | this.spinner.scrollDown(_step);
|
21014 | event.preventDefault();
|
21015 | return;
|
21016 | }
|
21017 | }
|
21018 | }
|
21019 | });
|
21020 |
|
21021 | var panel_time_rangevue_type_script_lang_js_ = (time_rangevue_type_script_lang_js_);
|
21022 |
|
21023 |
|
21024 |
|
21025 |
|
21026 |
|
21027 |
|
21028 |
|
21029 |
|
21030 | var time_range_component = normalizeComponent(
|
21031 | panel_time_rangevue_type_script_lang_js_,
|
21032 | time_rangevue_type_template_id_fb28660e_render,
|
21033 | time_rangevue_type_template_id_fb28660e_staticRenderFns,
|
21034 | false,
|
21035 | null,
|
21036 | null,
|
21037 | null
|
21038 |
|
21039 | )
|
21040 |
|
21041 |
|
21042 | if (false) { var time_range_api; }
|
21043 | time_range_component.options.__file = "packages/date-picker/src/panel/time-range.vue"
|
21044 | var time_range = (time_range_component.exports);
|
21045 |
|
21046 |
|
21047 |
|
21048 |
|
21049 |
|
21050 | var time_picker = ({
|
21051 | mixins: [picker],
|
21052 |
|
21053 | name: 'ElTimePicker',
|
21054 |
|
21055 | props: {
|
21056 | isRange: Boolean,
|
21057 | arrowControl: Boolean
|
21058 | },
|
21059 |
|
21060 | data: function data() {
|
21061 | return {
|
21062 | type: ''
|
21063 | };
|
21064 | },
|
21065 |
|
21066 |
|
21067 | watch: {
|
21068 | isRange: function isRange(_isRange) {
|
21069 | if (this.picker) {
|
21070 | this.unmountPicker();
|
21071 | this.type = _isRange ? 'timerange' : 'time';
|
21072 | this.panel = _isRange ? time_range : panel_time;
|
21073 | this.mountPicker();
|
21074 | } else {
|
21075 | this.type = _isRange ? 'timerange' : 'time';
|
21076 | this.panel = _isRange ? time_range : panel_time;
|
21077 | }
|
21078 | }
|
21079 | },
|
21080 |
|
21081 | created: function created() {
|
21082 | this.type = this.isRange ? 'timerange' : 'time';
|
21083 | this.panel = this.isRange ? time_range : panel_time;
|
21084 | }
|
21085 | });
|
21086 |
|
21087 |
|
21088 |
|
21089 |
|
21090 | time_picker.install = function (Vue) {
|
21091 | Vue.component(time_picker.name, time_picker);
|
21092 | };
|
21093 |
|
21094 | var packages_time_picker = (time_picker);
|
21095 |
|
21096 | var mainvue_type_template_id_52060272_render = function() {
|
21097 | var _vm = this
|
21098 | var _h = _vm.$createElement
|
21099 | var _c = _vm._self._c || _h
|
21100 | return _c(
|
21101 | "span",
|
21102 | [
|
21103 | _c(
|
21104 | "transition",
|
21105 | {
|
21106 | attrs: { name: _vm.transition },
|
21107 | on: {
|
21108 | "after-enter": _vm.handleAfterEnter,
|
21109 | "after-leave": _vm.handleAfterLeave
|
21110 | }
|
21111 | },
|
21112 | [
|
21113 | _c(
|
21114 | "div",
|
21115 | {
|
21116 | directives: [
|
21117 | {
|
21118 | name: "show",
|
21119 | rawName: "v-show",
|
21120 | value: !_vm.disabled && _vm.showPopper,
|
21121 | expression: "!disabled && showPopper"
|
21122 | }
|
21123 | ],
|
21124 | ref: "popper",
|
21125 | staticClass: "el-popover el-popper",
|
21126 | class: [_vm.popperClass, _vm.content && "el-popover--plain"],
|
21127 | style: { width: _vm.width + "px" },
|
21128 | attrs: {
|
21129 | role: "tooltip",
|
21130 | id: _vm.tooltipId,
|
21131 | "aria-hidden":
|
21132 | _vm.disabled || !_vm.showPopper ? "true" : "false"
|
21133 | }
|
21134 | },
|
21135 | [
|
21136 | _vm.title
|
21137 | ? _c("div", {
|
21138 | staticClass: "el-popover__title",
|
21139 | domProps: { textContent: _vm._s(_vm.title) }
|
21140 | })
|
21141 | : _vm._e(),
|
21142 | _vm._t("default", [_vm._v(_vm._s(_vm.content))])
|
21143 | ],
|
21144 | 2
|
21145 | )
|
21146 | ]
|
21147 | ),
|
21148 | _vm._t("reference")
|
21149 | ],
|
21150 | 2
|
21151 | )
|
21152 | }
|
21153 | var mainvue_type_template_id_52060272_staticRenderFns = []
|
21154 | mainvue_type_template_id_52060272_render._withStripped = true
|
21155 |
|
21156 |
|
21157 |
|
21158 |
|
21159 |
|
21160 |
|
21161 |
|
21162 |
|
21163 |
|
21164 |
|
21165 |
|
21166 |
|
21167 |
|
21168 |
|
21169 |
|
21170 |
|
21171 |
|
21172 |
|
21173 |
|
21174 |
|
21175 |
|
21176 |
|
21177 |
|
21178 |
|
21179 |
|
21180 |
|
21181 |
|
21182 |
|
21183 |
|
21184 |
|
21185 |
|
21186 |
|
21187 |
|
21188 |
|
21189 | var mainvue_type_script_lang_js_ = ({
|
21190 | name: 'ElPopover',
|
21191 |
|
21192 | mixins: [vue_popper_default.a],
|
21193 |
|
21194 | props: {
|
21195 | trigger: {
|
21196 | type: String,
|
21197 | default: 'click',
|
21198 | validator: function validator(value) {
|
21199 | return ['click', 'focus', 'hover', 'manual'].indexOf(value) > -1;
|
21200 | }
|
21201 | },
|
21202 | openDelay: {
|
21203 | type: Number,
|
21204 | default: 0
|
21205 | },
|
21206 | closeDelay: {
|
21207 | type: Number,
|
21208 | default: 200
|
21209 | },
|
21210 | title: String,
|
21211 | disabled: Boolean,
|
21212 | content: String,
|
21213 | reference: {},
|
21214 | popperClass: String,
|
21215 | width: {},
|
21216 | visibleArrow: {
|
21217 | default: true
|
21218 | },
|
21219 | arrowOffset: {
|
21220 | type: Number,
|
21221 | default: 0
|
21222 | },
|
21223 | transition: {
|
21224 | type: String,
|
21225 | default: 'fade-in-linear'
|
21226 | },
|
21227 | tabindex: {
|
21228 | type: Number,
|
21229 | default: 0
|
21230 | }
|
21231 | },
|
21232 |
|
21233 | computed: {
|
21234 | tooltipId: function tooltipId() {
|
21235 | return 'el-popover-' + Object(util_["generateId"])();
|
21236 | }
|
21237 | },
|
21238 | watch: {
|
21239 | showPopper: function showPopper(val) {
|
21240 | if (this.disabled) {
|
21241 | return;
|
21242 | }
|
21243 | val ? this.$emit('show') : this.$emit('hide');
|
21244 | }
|
21245 | },
|
21246 |
|
21247 | mounted: function mounted() {
|
21248 | var _this = this;
|
21249 |
|
21250 | var reference = this.referenceElm = this.reference || this.$refs.reference;
|
21251 | var popper = this.popper || this.$refs.popper;
|
21252 |
|
21253 | if (!reference && this.$slots.reference && this.$slots.reference[0]) {
|
21254 | reference = this.referenceElm = this.$slots.reference[0].elm;
|
21255 | }
|
21256 |
|
21257 | if (reference) {
|
21258 | Object(dom_["addClass"])(reference, 'el-popover__reference');
|
21259 | reference.setAttribute('aria-describedby', this.tooltipId);
|
21260 | reference.setAttribute('tabindex', this.tabindex);
|
21261 | popper.setAttribute('tabindex', 0);
|
21262 |
|
21263 | if (this.trigger !== 'click') {
|
21264 | Object(dom_["on"])(reference, 'focusin', function () {
|
21265 | _this.handleFocus();
|
21266 | var instance = reference.__vue__;
|
21267 | if (instance && typeof instance.focus === 'function') {
|
21268 | instance.focus();
|
21269 | }
|
21270 | });
|
21271 | Object(dom_["on"])(popper, 'focusin', this.handleFocus);
|
21272 | Object(dom_["on"])(reference, 'focusout', this.handleBlur);
|
21273 | Object(dom_["on"])(popper, 'focusout', this.handleBlur);
|
21274 | }
|
21275 | Object(dom_["on"])(reference, 'keydown', this.handleKeydown);
|
21276 | Object(dom_["on"])(reference, 'click', this.handleClick);
|
21277 | }
|
21278 | if (this.trigger === 'click') {
|
21279 | Object(dom_["on"])(reference, 'click', this.doToggle);
|
21280 | Object(dom_["on"])(document, 'click', this.handleDocumentClick);
|
21281 | } else if (this.trigger === 'hover') {
|
21282 | Object(dom_["on"])(reference, 'mouseenter', this.handleMouseEnter);
|
21283 | Object(dom_["on"])(popper, 'mouseenter', this.handleMouseEnter);
|
21284 | Object(dom_["on"])(reference, 'mouseleave', this.handleMouseLeave);
|
21285 | Object(dom_["on"])(popper, 'mouseleave', this.handleMouseLeave);
|
21286 | } else if (this.trigger === 'focus') {
|
21287 | if (this.tabindex < 0) {
|
21288 | console.warn('[Element Warn][Popover]a negative taindex means that the element cannot be focused by tab key');
|
21289 | }
|
21290 | if (reference.querySelector('input, textarea')) {
|
21291 | Object(dom_["on"])(reference, 'focusin', this.doShow);
|
21292 | Object(dom_["on"])(reference, 'focusout', this.doClose);
|
21293 | } else {
|
21294 | Object(dom_["on"])(reference, 'mousedown', this.doShow);
|
21295 | Object(dom_["on"])(reference, 'mouseup', this.doClose);
|
21296 | }
|
21297 | }
|
21298 | },
|
21299 | beforeDestroy: function beforeDestroy() {
|
21300 | this.cleanup();
|
21301 | },
|
21302 | deactivated: function deactivated() {
|
21303 | this.cleanup();
|
21304 | },
|
21305 |
|
21306 |
|
21307 | methods: {
|
21308 | doToggle: function doToggle() {
|
21309 | this.showPopper = !this.showPopper;
|
21310 | },
|
21311 | doShow: function doShow() {
|
21312 | this.showPopper = true;
|
21313 | },
|
21314 | doClose: function doClose() {
|
21315 | this.showPopper = false;
|
21316 | },
|
21317 | handleFocus: function handleFocus() {
|
21318 | Object(dom_["addClass"])(this.referenceElm, 'focusing');
|
21319 | if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = true;
|
21320 | },
|
21321 | handleClick: function handleClick() {
|
21322 | Object(dom_["removeClass"])(this.referenceElm, 'focusing');
|
21323 | },
|
21324 | handleBlur: function handleBlur() {
|
21325 | Object(dom_["removeClass"])(this.referenceElm, 'focusing');
|
21326 | if (this.trigger === 'click' || this.trigger === 'focus') this.showPopper = false;
|
21327 | },
|
21328 | handleMouseEnter: function handleMouseEnter() {
|
21329 | var _this2 = this;
|
21330 |
|
21331 | clearTimeout(this._timer);
|
21332 | if (this.openDelay) {
|
21333 | this._timer = setTimeout(function () {
|
21334 | _this2.showPopper = true;
|
21335 | }, this.openDelay);
|
21336 | } else {
|
21337 | this.showPopper = true;
|
21338 | }
|
21339 | },
|
21340 | handleKeydown: function handleKeydown(ev) {
|
21341 | if (ev.keyCode === 27 && this.trigger !== 'manual') {
|
21342 |
|
21343 | this.doClose();
|
21344 | }
|
21345 | },
|
21346 | handleMouseLeave: function handleMouseLeave() {
|
21347 | var _this3 = this;
|
21348 |
|
21349 | clearTimeout(this._timer);
|
21350 | if (this.closeDelay) {
|
21351 | this._timer = setTimeout(function () {
|
21352 | _this3.showPopper = false;
|
21353 | }, this.closeDelay);
|
21354 | } else {
|
21355 | this.showPopper = false;
|
21356 | }
|
21357 | },
|
21358 | handleDocumentClick: function handleDocumentClick(e) {
|
21359 | var reference = this.reference || this.$refs.reference;
|
21360 | var popper = this.popper || this.$refs.popper;
|
21361 |
|
21362 | if (!reference && this.$slots.reference && this.$slots.reference[0]) {
|
21363 | reference = this.referenceElm = this.$slots.reference[0].elm;
|
21364 | }
|
21365 | if (!this.$el || !reference || this.$el.contains(e.target) || reference.contains(e.target) || !popper || popper.contains(e.target)) return;
|
21366 | this.showPopper = false;
|
21367 | },
|
21368 | handleAfterEnter: function handleAfterEnter() {
|
21369 | this.$emit('after-enter');
|
21370 | },
|
21371 | handleAfterLeave: function handleAfterLeave() {
|
21372 | this.$emit('after-leave');
|
21373 | this.doDestroy();
|
21374 | },
|
21375 | cleanup: function cleanup() {
|
21376 | if (this.openDelay || this.closeDelay) {
|
21377 | clearTimeout(this._timer);
|
21378 | }
|
21379 | }
|
21380 | },
|
21381 |
|
21382 | destroyed: function destroyed() {
|
21383 | var reference = this.reference;
|
21384 |
|
21385 | Object(dom_["off"])(reference, 'click', this.doToggle);
|
21386 | Object(dom_["off"])(reference, 'mouseup', this.doClose);
|
21387 | Object(dom_["off"])(reference, 'mousedown', this.doShow);
|
21388 | Object(dom_["off"])(reference, 'focusin', this.doShow);
|
21389 | Object(dom_["off"])(reference, 'focusout', this.doClose);
|
21390 | Object(dom_["off"])(reference, 'mousedown', this.doShow);
|
21391 | Object(dom_["off"])(reference, 'mouseup', this.doClose);
|
21392 | Object(dom_["off"])(reference, 'mouseleave', this.handleMouseLeave);
|
21393 | Object(dom_["off"])(reference, 'mouseenter', this.handleMouseEnter);
|
21394 | Object(dom_["off"])(document, 'click', this.handleDocumentClick);
|
21395 | }
|
21396 | });
|
21397 |
|
21398 | var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
|
21399 |
|
21400 |
|
21401 |
|
21402 |
|
21403 |
|
21404 |
|
21405 |
|
21406 |
|
21407 | var main_component = normalizeComponent(
|
21408 | src_mainvue_type_script_lang_js_,
|
21409 | mainvue_type_template_id_52060272_render,
|
21410 | mainvue_type_template_id_52060272_staticRenderFns,
|
21411 | false,
|
21412 | null,
|
21413 | null,
|
21414 | null
|
21415 |
|
21416 | )
|
21417 |
|
21418 |
|
21419 | if (false) { var main_api; }
|
21420 | main_component.options.__file = "packages/popover/src/main.vue"
|
21421 | var main = (main_component.exports);
|
21422 |
|
21423 | var getReference = function getReference(el, binding, vnode) {
|
21424 | var _ref = binding.expression ? binding.value : binding.arg;
|
21425 | var popper = vnode.context.$refs[_ref];
|
21426 | if (popper) {
|
21427 | if (Array.isArray(popper)) {
|
21428 | popper[0].$refs.reference = el;
|
21429 | } else {
|
21430 | popper.$refs.reference = el;
|
21431 | }
|
21432 | }
|
21433 | };
|
21434 |
|
21435 | var directive = ({
|
21436 | bind: function bind(el, binding, vnode) {
|
21437 | getReference(el, binding, vnode);
|
21438 | },
|
21439 | inserted: function inserted(el, binding, vnode) {
|
21440 | getReference(el, binding, vnode);
|
21441 | }
|
21442 | });
|
21443 |
|
21444 |
|
21445 |
|
21446 |
|
21447 |
|
21448 | external_vue_default.a.directive('popover', directive);
|
21449 |
|
21450 |
|
21451 | main.install = function (Vue) {
|
21452 | Vue.directive('popover', directive);
|
21453 | Vue.component(main.name, main);
|
21454 | };
|
21455 | main.directive = directive;
|
21456 |
|
21457 | var popover = (main);
|
21458 |
|
21459 |
|
21460 |
|
21461 |
|
21462 |
|
21463 |
|
21464 |
|
21465 | var src_main = ({
|
21466 | name: 'ElTooltip',
|
21467 |
|
21468 | mixins: [vue_popper_default.a],
|
21469 |
|
21470 | props: {
|
21471 | openDelay: {
|
21472 | type: Number,
|
21473 | default: 0
|
21474 | },
|
21475 | disabled: Boolean,
|
21476 | manual: Boolean,
|
21477 | effect: {
|
21478 | type: String,
|
21479 | default: 'dark'
|
21480 | },
|
21481 | arrowOffset: {
|
21482 | type: Number,
|
21483 | default: 0
|
21484 | },
|
21485 | popperClass: String,
|
21486 | content: String,
|
21487 | visibleArrow: {
|
21488 | default: true
|
21489 | },
|
21490 | transition: {
|
21491 | type: String,
|
21492 | default: 'el-fade-in-linear'
|
21493 | },
|
21494 | popperOptions: {
|
21495 | default: function _default() {
|
21496 | return {
|
21497 | boundariesPadding: 10,
|
21498 | gpuAcceleration: false
|
21499 | };
|
21500 | }
|
21501 | },
|
21502 | enterable: {
|
21503 | type: Boolean,
|
21504 | default: true
|
21505 | },
|
21506 | hideAfter: {
|
21507 | type: Number,
|
21508 | default: 0
|
21509 | },
|
21510 | tabindex: {
|
21511 | type: Number,
|
21512 | default: 0
|
21513 | }
|
21514 | },
|
21515 |
|
21516 | data: function data() {
|
21517 | return {
|
21518 | tooltipId: 'el-tooltip-' + Object(util_["generateId"])(),
|
21519 | timeoutPending: null,
|
21520 | focusing: false
|
21521 | };
|
21522 | },
|
21523 | beforeCreate: function beforeCreate() {
|
21524 | var _this = this;
|
21525 |
|
21526 | if (this.$isServer) return;
|
21527 |
|
21528 | this.popperVM = new external_vue_default.a({
|
21529 | data: { node: '' },
|
21530 | render: function render(h) {
|
21531 | return this.node;
|
21532 | }
|
21533 | }).$mount();
|
21534 |
|
21535 | this.debounceClose = debounce_default()(200, function () {
|
21536 | return _this.handleClosePopper();
|
21537 | });
|
21538 | },
|
21539 | render: function render(h) {
|
21540 | var _this2 = this;
|
21541 |
|
21542 | if (this.popperVM) {
|
21543 | this.popperVM.node = h(
|
21544 | 'transition',
|
21545 | {
|
21546 | attrs: {
|
21547 | name: this.transition
|
21548 | },
|
21549 | on: {
|
21550 | 'afterLeave': this.doDestroy
|
21551 | }
|
21552 | },
|
21553 | [h(
|
21554 | 'div',
|
21555 | {
|
21556 | on: {
|
21557 | 'mouseleave': function mouseleave() {
|
21558 | _this2.setExpectedState(false);_this2.debounceClose();
|
21559 | },
|
21560 | 'mouseenter': function mouseenter() {
|
21561 | _this2.setExpectedState(true);
|
21562 | }
|
21563 | },
|
21564 |
|
21565 | ref: 'popper',
|
21566 | attrs: { role: 'tooltip',
|
21567 | id: this.tooltipId,
|
21568 | 'aria-hidden': this.disabled || !this.showPopper ? 'true' : 'false'
|
21569 | },
|
21570 | directives: [{
|
21571 | name: 'show',
|
21572 | value: !this.disabled && this.showPopper
|
21573 | }],
|
21574 |
|
21575 | 'class': ['el-tooltip__popper', 'is-' + this.effect, this.popperClass] },
|
21576 | [this.$slots.content || this.content]
|
21577 | )]
|
21578 | );
|
21579 | }
|
21580 |
|
21581 | var firstElement = this.getFirstElement();
|
21582 | if (!firstElement) return null;
|
21583 |
|
21584 | var data = firstElement.data = firstElement.data || {};
|
21585 | data.staticClass = this.addTooltipClass(data.staticClass);
|
21586 |
|
21587 | return firstElement;
|
21588 | },
|
21589 | mounted: function mounted() {
|
21590 | var _this3 = this;
|
21591 |
|
21592 | this.referenceElm = this.$el;
|
21593 | if (this.$el.nodeType === 1) {
|
21594 | this.$el.setAttribute('aria-describedby', this.tooltipId);
|
21595 | this.$el.setAttribute('tabindex', this.tabindex);
|
21596 | Object(dom_["on"])(this.referenceElm, 'mouseenter', this.show);
|
21597 | Object(dom_["on"])(this.referenceElm, 'mouseleave', this.hide);
|
21598 | Object(dom_["on"])(this.referenceElm, 'focus', function () {
|
21599 | if (!_this3.$slots.default || !_this3.$slots.default.length) {
|
21600 | _this3.handleFocus();
|
21601 | return;
|
21602 | }
|
21603 | var instance = _this3.$slots.default[0].componentInstance;
|
21604 | if (instance && instance.focus) {
|
21605 | instance.focus();
|
21606 | } else {
|
21607 | _this3.handleFocus();
|
21608 | }
|
21609 | });
|
21610 | Object(dom_["on"])(this.referenceElm, 'blur', this.handleBlur);
|
21611 | Object(dom_["on"])(this.referenceElm, 'click', this.removeFocusing);
|
21612 | }
|
21613 |
|
21614 | if (this.value && this.popperVM) {
|
21615 | this.popperVM.$nextTick(function () {
|
21616 | if (_this3.value) {
|
21617 | _this3.updatePopper();
|
21618 | }
|
21619 | });
|
21620 | }
|
21621 | },
|
21622 |
|
21623 | watch: {
|
21624 | focusing: function focusing(val) {
|
21625 | if (val) {
|
21626 | Object(dom_["addClass"])(this.referenceElm, 'focusing');
|
21627 | } else {
|
21628 | Object(dom_["removeClass"])(this.referenceElm, 'focusing');
|
21629 | }
|
21630 | }
|
21631 | },
|
21632 | methods: {
|
21633 | show: function show() {
|
21634 | this.setExpectedState(true);
|
21635 | this.handleShowPopper();
|
21636 | },
|
21637 | hide: function hide() {
|
21638 | this.setExpectedState(false);
|
21639 | this.debounceClose();
|
21640 | },
|
21641 | handleFocus: function handleFocus() {
|
21642 | this.focusing = true;
|
21643 | this.show();
|
21644 | },
|
21645 | handleBlur: function handleBlur() {
|
21646 | this.focusing = false;
|
21647 | this.hide();
|
21648 | },
|
21649 | removeFocusing: function removeFocusing() {
|
21650 | this.focusing = false;
|
21651 | },
|
21652 | addTooltipClass: function addTooltipClass(prev) {
|
21653 | if (!prev) {
|
21654 | return 'el-tooltip';
|
21655 | } else {
|
21656 | return 'el-tooltip ' + prev.replace('el-tooltip', '');
|
21657 | }
|
21658 | },
|
21659 | handleShowPopper: function handleShowPopper() {
|
21660 | var _this4 = this;
|
21661 |
|
21662 | if (!this.expectedState || this.manual) return;
|
21663 | clearTimeout(this.timeout);
|
21664 | this.timeout = setTimeout(function () {
|
21665 | _this4.showPopper = true;
|
21666 | }, this.openDelay);
|
21667 |
|
21668 | if (this.hideAfter > 0) {
|
21669 | this.timeoutPending = setTimeout(function () {
|
21670 | _this4.showPopper = false;
|
21671 | }, this.hideAfter);
|
21672 | }
|
21673 | },
|
21674 | handleClosePopper: function handleClosePopper() {
|
21675 | if (this.enterable && this.expectedState || this.manual) return;
|
21676 | clearTimeout(this.timeout);
|
21677 |
|
21678 | if (this.timeoutPending) {
|
21679 | clearTimeout(this.timeoutPending);
|
21680 | }
|
21681 | this.showPopper = false;
|
21682 |
|
21683 | if (this.disabled) {
|
21684 | this.doDestroy();
|
21685 | }
|
21686 | },
|
21687 | setExpectedState: function setExpectedState(expectedState) {
|
21688 | if (expectedState === false) {
|
21689 | clearTimeout(this.timeoutPending);
|
21690 | }
|
21691 | this.expectedState = expectedState;
|
21692 | },
|
21693 | getFirstElement: function getFirstElement() {
|
21694 | var slots = this.$slots.default;
|
21695 | if (!Array.isArray(slots)) return null;
|
21696 | var element = null;
|
21697 | for (var index = 0; index < slots.length; index++) {
|
21698 | if (slots[index] && slots[index].tag) {
|
21699 | element = slots[index];
|
21700 | };
|
21701 | }
|
21702 | return element;
|
21703 | }
|
21704 | },
|
21705 |
|
21706 | beforeDestroy: function beforeDestroy() {
|
21707 | this.popperVM && this.popperVM.$destroy();
|
21708 | },
|
21709 | destroyed: function destroyed() {
|
21710 | var reference = this.referenceElm;
|
21711 | if (reference.nodeType === 1) {
|
21712 | Object(dom_["off"])(reference, 'mouseenter', this.show);
|
21713 | Object(dom_["off"])(reference, 'mouseleave', this.hide);
|
21714 | Object(dom_["off"])(reference, 'focus', this.handleFocus);
|
21715 | Object(dom_["off"])(reference, 'blur', this.handleBlur);
|
21716 | Object(dom_["off"])(reference, 'click', this.removeFocusing);
|
21717 | }
|
21718 | }
|
21719 | });
|
21720 |
|
21721 |
|
21722 |
|
21723 |
|
21724 | src_main.install = function (Vue) {
|
21725 | Vue.component(src_main.name, src_main);
|
21726 | };
|
21727 |
|
21728 | var packages_tooltip = (src_main);
|
21729 |
|
21730 | var mainvue_type_template_id_6b29b012_render = function() {
|
21731 | var _vm = this
|
21732 | var _h = _vm.$createElement
|
21733 | var _c = _vm._self._c || _h
|
21734 | return _c("transition", { attrs: { name: "msgbox-fade" } }, [
|
21735 | _c(
|
21736 | "div",
|
21737 | {
|
21738 | directives: [
|
21739 | {
|
21740 | name: "show",
|
21741 | rawName: "v-show",
|
21742 | value: _vm.visible,
|
21743 | expression: "visible"
|
21744 | }
|
21745 | ],
|
21746 | staticClass: "el-message-box__wrapper",
|
21747 | attrs: {
|
21748 | tabindex: "-1",
|
21749 | role: "dialog",
|
21750 | "aria-modal": "true",
|
21751 | "aria-label": _vm.title || "dialog"
|
21752 | },
|
21753 | on: {
|
21754 | click: function($event) {
|
21755 | if ($event.target !== $event.currentTarget) {
|
21756 | return null
|
21757 | }
|
21758 | return _vm.handleWrapperClick($event)
|
21759 | }
|
21760 | }
|
21761 | },
|
21762 | [
|
21763 | _c(
|
21764 | "div",
|
21765 | {
|
21766 | staticClass: "el-message-box",
|
21767 | class: [_vm.customClass, _vm.center && "el-message-box--center"]
|
21768 | },
|
21769 | [
|
21770 | _vm.title !== null
|
21771 | ? _c("div", { staticClass: "el-message-box__header" }, [
|
21772 | _c("div", { staticClass: "el-message-box__title" }, [
|
21773 | _vm.icon && _vm.center
|
21774 | ? _c("div", {
|
21775 | class: ["el-message-box__status", _vm.icon]
|
21776 | })
|
21777 | : _vm._e(),
|
21778 | _c("span", [_vm._v(_vm._s(_vm.title))])
|
21779 | ]),
|
21780 | _vm.showClose
|
21781 | ? _c(
|
21782 | "button",
|
21783 | {
|
21784 | staticClass: "el-message-box__headerbtn",
|
21785 | attrs: { type: "button", "aria-label": "Close" },
|
21786 | on: {
|
21787 | click: function($event) {
|
21788 | _vm.handleAction(
|
21789 | _vm.distinguishCancelAndClose
|
21790 | ? "close"
|
21791 | : "cancel"
|
21792 | )
|
21793 | },
|
21794 | keydown: function($event) {
|
21795 | if (
|
21796 | !("button" in $event) &&
|
21797 | _vm._k(
|
21798 | $event.keyCode,
|
21799 | "enter",
|
21800 | 13,
|
21801 | $event.key,
|
21802 | "Enter"
|
21803 | )
|
21804 | ) {
|
21805 | return null
|
21806 | }
|
21807 | _vm.handleAction(
|
21808 | _vm.distinguishCancelAndClose
|
21809 | ? "close"
|
21810 | : "cancel"
|
21811 | )
|
21812 | }
|
21813 | }
|
21814 | },
|
21815 | [
|
21816 | _c("i", {
|
21817 | staticClass: "el-message-box__close el-icon-close"
|
21818 | })
|
21819 | ]
|
21820 | )
|
21821 | : _vm._e()
|
21822 | ])
|
21823 | : _vm._e(),
|
21824 | _c("div", { staticClass: "el-message-box__content" }, [
|
21825 | _c("div", { staticClass: "el-message-box__container" }, [
|
21826 | _vm.icon && !_vm.center && _vm.message !== ""
|
21827 | ? _c("div", { class: ["el-message-box__status", _vm.icon] })
|
21828 | : _vm._e(),
|
21829 | _vm.message !== ""
|
21830 | ? _c(
|
21831 | "div",
|
21832 | { staticClass: "el-message-box__message" },
|
21833 | [
|
21834 | _vm._t("default", [
|
21835 | !_vm.dangerouslyUseHTMLString
|
21836 | ? _c("p", [_vm._v(_vm._s(_vm.message))])
|
21837 | : _c("p", {
|
21838 | domProps: { innerHTML: _vm._s(_vm.message) }
|
21839 | })
|
21840 | ])
|
21841 | ],
|
21842 | 2
|
21843 | )
|
21844 | : _vm._e()
|
21845 | ]),
|
21846 | _c(
|
21847 | "div",
|
21848 | {
|
21849 | directives: [
|
21850 | {
|
21851 | name: "show",
|
21852 | rawName: "v-show",
|
21853 | value: _vm.showInput,
|
21854 | expression: "showInput"
|
21855 | }
|
21856 | ],
|
21857 | staticClass: "el-message-box__input"
|
21858 | },
|
21859 | [
|
21860 | _c("el-input", {
|
21861 | ref: "input",
|
21862 | attrs: {
|
21863 | type: _vm.inputType,
|
21864 | placeholder: _vm.inputPlaceholder
|
21865 | },
|
21866 | nativeOn: {
|
21867 | keydown: function($event) {
|
21868 | if (
|
21869 | !("button" in $event) &&
|
21870 | _vm._k(
|
21871 | $event.keyCode,
|
21872 | "enter",
|
21873 | 13,
|
21874 | $event.key,
|
21875 | "Enter"
|
21876 | )
|
21877 | ) {
|
21878 | return null
|
21879 | }
|
21880 | return _vm.handleInputEnter($event)
|
21881 | }
|
21882 | },
|
21883 | model: {
|
21884 | value: _vm.inputValue,
|
21885 | callback: function($$v) {
|
21886 | _vm.inputValue = $$v
|
21887 | },
|
21888 | expression: "inputValue"
|
21889 | }
|
21890 | }),
|
21891 | _c(
|
21892 | "div",
|
21893 | {
|
21894 | staticClass: "el-message-box__errormsg",
|
21895 | style: {
|
21896 | visibility: !!_vm.editorErrorMessage
|
21897 | ? "visible"
|
21898 | : "hidden"
|
21899 | }
|
21900 | },
|
21901 | [_vm._v(_vm._s(_vm.editorErrorMessage))]
|
21902 | )
|
21903 | ],
|
21904 | 1
|
21905 | )
|
21906 | ]),
|
21907 | _c(
|
21908 | "div",
|
21909 | { staticClass: "el-message-box__btns" },
|
21910 | [
|
21911 | _vm.showCancelButton
|
21912 | ? _c(
|
21913 | "el-button",
|
21914 | {
|
21915 | class: [_vm.cancelButtonClasses],
|
21916 | attrs: {
|
21917 | loading: _vm.cancelButtonLoading,
|
21918 | round: _vm.roundButton,
|
21919 | size: "small"
|
21920 | },
|
21921 | on: {
|
21922 | keydown: function($event) {
|
21923 | if (
|
21924 | !("button" in $event) &&
|
21925 | _vm._k(
|
21926 | $event.keyCode,
|
21927 | "enter",
|
21928 | 13,
|
21929 | $event.key,
|
21930 | "Enter"
|
21931 | )
|
21932 | ) {
|
21933 | return null
|
21934 | }
|
21935 | _vm.handleAction("cancel")
|
21936 | }
|
21937 | },
|
21938 | nativeOn: {
|
21939 | click: function($event) {
|
21940 | _vm.handleAction("cancel")
|
21941 | }
|
21942 | }
|
21943 | },
|
21944 | [
|
21945 | _vm._v(
|
21946 | "\n " +
|
21947 | _vm._s(
|
21948 | _vm.cancelButtonText ||
|
21949 | _vm.t("el.messagebox.cancel")
|
21950 | ) +
|
21951 | "\n "
|
21952 | )
|
21953 | ]
|
21954 | )
|
21955 | : _vm._e(),
|
21956 | _c(
|
21957 | "el-button",
|
21958 | {
|
21959 | directives: [
|
21960 | {
|
21961 | name: "show",
|
21962 | rawName: "v-show",
|
21963 | value: _vm.showConfirmButton,
|
21964 | expression: "showConfirmButton"
|
21965 | }
|
21966 | ],
|
21967 | ref: "confirm",
|
21968 | class: [_vm.confirmButtonClasses],
|
21969 | attrs: {
|
21970 | loading: _vm.confirmButtonLoading,
|
21971 | round: _vm.roundButton,
|
21972 | size: "small"
|
21973 | },
|
21974 | on: {
|
21975 | keydown: function($event) {
|
21976 | if (
|
21977 | !("button" in $event) &&
|
21978 | _vm._k(
|
21979 | $event.keyCode,
|
21980 | "enter",
|
21981 | 13,
|
21982 | $event.key,
|
21983 | "Enter"
|
21984 | )
|
21985 | ) {
|
21986 | return null
|
21987 | }
|
21988 | _vm.handleAction("confirm")
|
21989 | }
|
21990 | },
|
21991 | nativeOn: {
|
21992 | click: function($event) {
|
21993 | _vm.handleAction("confirm")
|
21994 | }
|
21995 | }
|
21996 | },
|
21997 | [
|
21998 | _vm._v(
|
21999 | "\n " +
|
22000 | _vm._s(
|
22001 | _vm.confirmButtonText ||
|
22002 | _vm.t("el.messagebox.confirm")
|
22003 | ) +
|
22004 | "\n "
|
22005 | )
|
22006 | ]
|
22007 | )
|
22008 | ],
|
22009 | 1
|
22010 | )
|
22011 | ]
|
22012 | )
|
22013 | ]
|
22014 | )
|
22015 | ])
|
22016 | }
|
22017 | var mainvue_type_template_id_6b29b012_staticRenderFns = []
|
22018 | mainvue_type_template_id_6b29b012_render._withStripped = true
|
22019 |
|
22020 |
|
22021 |
|
22022 |
|
22023 |
|
22024 | var aria_dialog_ = __webpack_require__(39);
|
22025 | var aria_dialog_default = __webpack_require__.n(aria_dialog_);
|
22026 |
|
22027 |
|
22028 |
|
22029 |
|
22030 |
|
22031 |
|
22032 |
|
22033 |
|
22034 |
|
22035 |
|
22036 |
|
22037 |
|
22038 |
|
22039 |
|
22040 |
|
22041 |
|
22042 |
|
22043 |
|
22044 |
|
22045 |
|
22046 |
|
22047 |
|
22048 |
|
22049 |
|
22050 |
|
22051 |
|
22052 |
|
22053 |
|
22054 |
|
22055 |
|
22056 |
|
22057 |
|
22058 |
|
22059 |
|
22060 |
|
22061 |
|
22062 |
|
22063 |
|
22064 |
|
22065 |
|
22066 |
|
22067 |
|
22068 |
|
22069 |
|
22070 |
|
22071 |
|
22072 |
|
22073 |
|
22074 |
|
22075 |
|
22076 |
|
22077 |
|
22078 |
|
22079 |
|
22080 |
|
22081 |
|
22082 |
|
22083 |
|
22084 |
|
22085 |
|
22086 |
|
22087 |
|
22088 |
|
22089 |
|
22090 |
|
22091 |
|
22092 |
|
22093 |
|
22094 |
|
22095 |
|
22096 |
|
22097 |
|
22098 |
|
22099 |
|
22100 |
|
22101 |
|
22102 |
|
22103 |
|
22104 |
|
22105 |
|
22106 |
|
22107 |
|
22108 |
|
22109 |
|
22110 |
|
22111 |
|
22112 |
|
22113 |
|
22114 |
|
22115 |
|
22116 |
|
22117 | var messageBox = void 0;
|
22118 | var typeMap = {
|
22119 | success: 'success',
|
22120 | info: 'info',
|
22121 | warning: 'warning',
|
22122 | error: 'error'
|
22123 | };
|
22124 |
|
22125 | var message_box_src_mainvue_type_script_lang_js_ = ({
|
22126 | mixins: [popup_default.a, locale_default.a],
|
22127 |
|
22128 | props: {
|
22129 | modal: {
|
22130 | default: true
|
22131 | },
|
22132 | lockScroll: {
|
22133 | default: true
|
22134 | },
|
22135 | showClose: {
|
22136 | type: Boolean,
|
22137 | default: true
|
22138 | },
|
22139 | closeOnClickModal: {
|
22140 | default: true
|
22141 | },
|
22142 | closeOnPressEscape: {
|
22143 | default: true
|
22144 | },
|
22145 | closeOnHashChange: {
|
22146 | default: true
|
22147 | },
|
22148 | center: {
|
22149 | default: false,
|
22150 | type: Boolean
|
22151 | },
|
22152 | roundButton: {
|
22153 | default: false,
|
22154 | type: Boolean
|
22155 | }
|
22156 | },
|
22157 |
|
22158 | components: {
|
22159 | ElInput: input_default.a,
|
22160 | ElButton: button_default.a
|
22161 | },
|
22162 |
|
22163 | computed: {
|
22164 | icon: function icon() {
|
22165 | var type = this.type,
|
22166 | iconClass = this.iconClass;
|
22167 |
|
22168 | return iconClass || (type && typeMap[type] ? 'el-icon-' + typeMap[type] : '');
|
22169 | },
|
22170 | confirmButtonClasses: function confirmButtonClasses() {
|
22171 | return 'el-button--primary ' + this.confirmButtonClass;
|
22172 | },
|
22173 | cancelButtonClasses: function cancelButtonClasses() {
|
22174 | return '' + this.cancelButtonClass;
|
22175 | }
|
22176 | },
|
22177 |
|
22178 | methods: {
|
22179 | getSafeClose: function getSafeClose() {
|
22180 | var _this = this;
|
22181 |
|
22182 | var currentId = this.uid;
|
22183 | return function () {
|
22184 | _this.$nextTick(function () {
|
22185 | if (currentId === _this.uid) _this.doClose();
|
22186 | });
|
22187 | };
|
22188 | },
|
22189 | doClose: function doClose() {
|
22190 | var _this2 = this;
|
22191 |
|
22192 | if (!this.visible) return;
|
22193 | this.visible = false;
|
22194 | this._closing = true;
|
22195 |
|
22196 | this.onClose && this.onClose();
|
22197 | messageBox.closeDialog();
|
22198 | if (this.lockScroll) {
|
22199 | setTimeout(this.restoreBodyStyle, 200);
|
22200 | }
|
22201 | this.opened = false;
|
22202 | this.doAfterClose();
|
22203 | setTimeout(function () {
|
22204 | if (_this2.action) _this2.callback(_this2.action, _this2);
|
22205 | });
|
22206 | },
|
22207 | handleWrapperClick: function handleWrapperClick() {
|
22208 | if (this.closeOnClickModal) {
|
22209 | this.handleAction(this.distinguishCancelAndClose ? 'close' : 'cancel');
|
22210 | }
|
22211 | },
|
22212 | handleInputEnter: function handleInputEnter() {
|
22213 | if (this.inputType !== 'textarea') {
|
22214 | return this.handleAction('confirm');
|
22215 | }
|
22216 | },
|
22217 | handleAction: function handleAction(action) {
|
22218 | if (this.$type === 'prompt' && action === 'confirm' && !this.validate()) {
|
22219 | return;
|
22220 | }
|
22221 | this.action = action;
|
22222 | if (typeof this.beforeClose === 'function') {
|
22223 | this.close = this.getSafeClose();
|
22224 | this.beforeClose(action, this, this.close);
|
22225 | } else {
|
22226 | this.doClose();
|
22227 | }
|
22228 | },
|
22229 | validate: function validate() {
|
22230 | if (this.$type === 'prompt') {
|
22231 | var inputPattern = this.inputPattern;
|
22232 | if (inputPattern && !inputPattern.test(this.inputValue || '')) {
|
22233 | this.editorErrorMessage = this.inputErrorMessage || Object(lib_locale_["t"])('el.messagebox.error');
|
22234 | Object(dom_["addClass"])(this.getInputElement(), 'invalid');
|
22235 | return false;
|
22236 | }
|
22237 | var inputValidator = this.inputValidator;
|
22238 | if (typeof inputValidator === 'function') {
|
22239 | var validateResult = inputValidator(this.inputValue);
|
22240 | if (validateResult === false) {
|
22241 | this.editorErrorMessage = this.inputErrorMessage || Object(lib_locale_["t"])('el.messagebox.error');
|
22242 | Object(dom_["addClass"])(this.getInputElement(), 'invalid');
|
22243 | return false;
|
22244 | }
|
22245 | if (typeof validateResult === 'string') {
|
22246 | this.editorErrorMessage = validateResult;
|
22247 | Object(dom_["addClass"])(this.getInputElement(), 'invalid');
|
22248 | return false;
|
22249 | }
|
22250 | }
|
22251 | }
|
22252 | this.editorErrorMessage = '';
|
22253 | Object(dom_["removeClass"])(this.getInputElement(), 'invalid');
|
22254 | return true;
|
22255 | },
|
22256 | getFirstFocus: function getFirstFocus() {
|
22257 | var btn = this.$el.querySelector('.el-message-box__btns .el-button');
|
22258 | var title = this.$el.querySelector('.el-message-box__btns .el-message-box__title');
|
22259 | return btn || title;
|
22260 | },
|
22261 | getInputElement: function getInputElement() {
|
22262 | var inputRefs = this.$refs.input.$refs;
|
22263 | return inputRefs.input || inputRefs.textarea;
|
22264 | },
|
22265 | handleClose: function handleClose() {
|
22266 | this.handleAction('close');
|
22267 | }
|
22268 | },
|
22269 |
|
22270 | watch: {
|
22271 | inputValue: {
|
22272 | immediate: true,
|
22273 | handler: function handler(val) {
|
22274 | var _this3 = this;
|
22275 |
|
22276 | this.$nextTick(function (_) {
|
22277 | if (_this3.$type === 'prompt' && val !== null) {
|
22278 | _this3.validate();
|
22279 | }
|
22280 | });
|
22281 | }
|
22282 | },
|
22283 |
|
22284 | visible: function visible(val) {
|
22285 | var _this4 = this;
|
22286 |
|
22287 | if (val) {
|
22288 | this.uid++;
|
22289 | if (this.$type === 'alert' || this.$type === 'confirm') {
|
22290 | this.$nextTick(function () {
|
22291 | _this4.$refs.confirm.$el.focus();
|
22292 | });
|
22293 | }
|
22294 | this.focusAfterClosed = document.activeElement;
|
22295 | messageBox = new aria_dialog_default.a(this.$el, this.focusAfterClosed, this.getFirstFocus());
|
22296 | }
|
22297 |
|
22298 |
|
22299 | if (this.$type !== 'prompt') return;
|
22300 | if (val) {
|
22301 | setTimeout(function () {
|
22302 | if (_this4.$refs.input && _this4.$refs.input.$el) {
|
22303 | _this4.getInputElement().focus();
|
22304 | }
|
22305 | }, 500);
|
22306 | } else {
|
22307 | this.editorErrorMessage = '';
|
22308 | Object(dom_["removeClass"])(this.getInputElement(), 'invalid');
|
22309 | }
|
22310 | }
|
22311 | },
|
22312 |
|
22313 | mounted: function mounted() {
|
22314 | var _this5 = this;
|
22315 |
|
22316 | this.$nextTick(function () {
|
22317 | if (_this5.closeOnHashChange) {
|
22318 | window.addEventListener('hashchange', _this5.close);
|
22319 | }
|
22320 | });
|
22321 | },
|
22322 | beforeDestroy: function beforeDestroy() {
|
22323 | if (this.closeOnHashChange) {
|
22324 | window.removeEventListener('hashchange', this.close);
|
22325 | }
|
22326 | setTimeout(function () {
|
22327 | messageBox.closeDialog();
|
22328 | });
|
22329 | },
|
22330 | data: function data() {
|
22331 | return {
|
22332 | uid: 1,
|
22333 | title: undefined,
|
22334 | message: '',
|
22335 | type: '',
|
22336 | iconClass: '',
|
22337 | customClass: '',
|
22338 | showInput: false,
|
22339 | inputValue: null,
|
22340 | inputPlaceholder: '',
|
22341 | inputType: 'text',
|
22342 | inputPattern: null,
|
22343 | inputValidator: null,
|
22344 | inputErrorMessage: '',
|
22345 | showConfirmButton: true,
|
22346 | showCancelButton: false,
|
22347 | action: '',
|
22348 | confirmButtonText: '',
|
22349 | cancelButtonText: '',
|
22350 | confirmButtonLoading: false,
|
22351 | cancelButtonLoading: false,
|
22352 | confirmButtonClass: '',
|
22353 | confirmButtonDisabled: false,
|
22354 | cancelButtonClass: '',
|
22355 | editorErrorMessage: null,
|
22356 | callback: null,
|
22357 | dangerouslyUseHTMLString: false,
|
22358 | focusAfterClosed: null,
|
22359 | isOnComposition: false,
|
22360 | distinguishCancelAndClose: false
|
22361 | };
|
22362 | }
|
22363 | });
|
22364 |
|
22365 | var packages_message_box_src_mainvue_type_script_lang_js_ = (message_box_src_mainvue_type_script_lang_js_);
|
22366 |
|
22367 |
|
22368 |
|
22369 |
|
22370 |
|
22371 |
|
22372 |
|
22373 |
|
22374 | var src_main_component = normalizeComponent(
|
22375 | packages_message_box_src_mainvue_type_script_lang_js_,
|
22376 | mainvue_type_template_id_6b29b012_render,
|
22377 | mainvue_type_template_id_6b29b012_staticRenderFns,
|
22378 | false,
|
22379 | null,
|
22380 | null,
|
22381 | null
|
22382 |
|
22383 | )
|
22384 |
|
22385 |
|
22386 | if (false) { var src_main_api; }
|
22387 | src_main_component.options.__file = "packages/message-box/src/main.vue"
|
22388 | var message_box_src_main = (src_main_component.exports);
|
22389 |
|
22390 | var vdom_ = __webpack_require__(23);
|
22391 |
|
22392 |
|
22393 | var main_typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
22394 |
|
22395 | var main_defaults = {
|
22396 | title: null,
|
22397 | message: '',
|
22398 | type: '',
|
22399 | iconClass: '',
|
22400 | showInput: false,
|
22401 | showClose: true,
|
22402 | modalFade: true,
|
22403 | lockScroll: true,
|
22404 | closeOnClickModal: true,
|
22405 | closeOnPressEscape: true,
|
22406 | closeOnHashChange: true,
|
22407 | inputValue: null,
|
22408 | inputPlaceholder: '',
|
22409 | inputType: 'text',
|
22410 | inputPattern: null,
|
22411 | inputValidator: null,
|
22412 | inputErrorMessage: '',
|
22413 | showConfirmButton: true,
|
22414 | showCancelButton: false,
|
22415 | confirmButtonPosition: 'right',
|
22416 | confirmButtonHighlight: false,
|
22417 | cancelButtonHighlight: false,
|
22418 | confirmButtonText: '',
|
22419 | cancelButtonText: '',
|
22420 | confirmButtonClass: '',
|
22421 | cancelButtonClass: '',
|
22422 | customClass: '',
|
22423 | beforeClose: null,
|
22424 | dangerouslyUseHTMLString: false,
|
22425 | center: false,
|
22426 | roundButton: false,
|
22427 | distinguishCancelAndClose: false
|
22428 | };
|
22429 |
|
22430 |
|
22431 |
|
22432 |
|
22433 |
|
22434 |
|
22435 | var MessageBoxConstructor = external_vue_default.a.extend(message_box_src_main);
|
22436 |
|
22437 | var currentMsg = void 0,
|
22438 | main_instance = void 0;
|
22439 | var msgQueue = [];
|
22440 |
|
22441 | var defaultCallback = function defaultCallback(action) {
|
22442 | if (currentMsg) {
|
22443 | var callback = currentMsg.callback;
|
22444 | if (typeof callback === 'function') {
|
22445 | if (main_instance.showInput) {
|
22446 | callback(main_instance.inputValue, action);
|
22447 | } else {
|
22448 | callback(action);
|
22449 | }
|
22450 | }
|
22451 | if (currentMsg.resolve) {
|
22452 | if (action === 'confirm') {
|
22453 | if (main_instance.showInput) {
|
22454 | currentMsg.resolve({ value: main_instance.inputValue, action: action });
|
22455 | } else {
|
22456 | currentMsg.resolve(action);
|
22457 | }
|
22458 | } else if (currentMsg.reject && (action === 'cancel' || action === 'close')) {
|
22459 | currentMsg.reject(action);
|
22460 | }
|
22461 | }
|
22462 | }
|
22463 | };
|
22464 |
|
22465 | var initInstance = function initInstance() {
|
22466 | main_instance = new MessageBoxConstructor({
|
22467 | el: document.createElement('div')
|
22468 | });
|
22469 |
|
22470 | main_instance.callback = defaultCallback;
|
22471 | };
|
22472 |
|
22473 | var main_showNextMsg = function showNextMsg() {
|
22474 | if (!main_instance) {
|
22475 | initInstance();
|
22476 | }
|
22477 | main_instance.action = '';
|
22478 |
|
22479 | if (!main_instance.visible || main_instance.closeTimer) {
|
22480 | if (msgQueue.length > 0) {
|
22481 | currentMsg = msgQueue.shift();
|
22482 |
|
22483 | var options = currentMsg.options;
|
22484 | for (var prop in options) {
|
22485 | if (options.hasOwnProperty(prop)) {
|
22486 | main_instance[prop] = options[prop];
|
22487 | }
|
22488 | }
|
22489 | if (options.callback === undefined) {
|
22490 | main_instance.callback = defaultCallback;
|
22491 | }
|
22492 |
|
22493 | var oldCb = main_instance.callback;
|
22494 | main_instance.callback = function (action, instance) {
|
22495 | oldCb(action, instance);
|
22496 | showNextMsg();
|
22497 | };
|
22498 | if (Object(vdom_["isVNode"])(main_instance.message)) {
|
22499 | main_instance.$slots.default = [main_instance.message];
|
22500 | main_instance.message = null;
|
22501 | } else {
|
22502 | delete main_instance.$slots.default;
|
22503 | }
|
22504 | ['modal', 'showClose', 'closeOnClickModal', 'closeOnPressEscape', 'closeOnHashChange'].forEach(function (prop) {
|
22505 | if (main_instance[prop] === undefined) {
|
22506 | main_instance[prop] = true;
|
22507 | }
|
22508 | });
|
22509 | document.body.appendChild(main_instance.$el);
|
22510 |
|
22511 | external_vue_default.a.nextTick(function () {
|
22512 | main_instance.visible = true;
|
22513 | });
|
22514 | }
|
22515 | }
|
22516 | };
|
22517 |
|
22518 | var main_MessageBox = function MessageBox(options, callback) {
|
22519 | if (external_vue_default.a.prototype.$isServer) return;
|
22520 | if (typeof options === 'string' || Object(vdom_["isVNode"])(options)) {
|
22521 | options = {
|
22522 | message: options
|
22523 | };
|
22524 | if (typeof arguments[1] === 'string') {
|
22525 | options.title = arguments[1];
|
22526 | }
|
22527 | } else if (options.callback && !callback) {
|
22528 | callback = options.callback;
|
22529 | }
|
22530 |
|
22531 | if (typeof Promise !== 'undefined') {
|
22532 | return new Promise(function (resolve, reject) {
|
22533 |
|
22534 | msgQueue.push({
|
22535 | options: merge_default()({}, main_defaults, MessageBox.defaults, options),
|
22536 | callback: callback,
|
22537 | resolve: resolve,
|
22538 | reject: reject
|
22539 | });
|
22540 |
|
22541 | main_showNextMsg();
|
22542 | });
|
22543 | } else {
|
22544 | msgQueue.push({
|
22545 | options: merge_default()({}, main_defaults, MessageBox.defaults, options),
|
22546 | callback: callback
|
22547 | });
|
22548 |
|
22549 | main_showNextMsg();
|
22550 | }
|
22551 | };
|
22552 |
|
22553 | main_MessageBox.setDefaults = function (defaults) {
|
22554 | main_MessageBox.defaults = defaults;
|
22555 | };
|
22556 |
|
22557 | main_MessageBox.alert = function (message, title, options) {
|
22558 | if ((typeof title === 'undefined' ? 'undefined' : main_typeof(title)) === 'object') {
|
22559 | options = title;
|
22560 | title = '';
|
22561 | } else if (title === undefined) {
|
22562 | title = '';
|
22563 | }
|
22564 | return main_MessageBox(merge_default()({
|
22565 | title: title,
|
22566 | message: message,
|
22567 | $type: 'alert',
|
22568 | closeOnPressEscape: false,
|
22569 | closeOnClickModal: false
|
22570 | }, options));
|
22571 | };
|
22572 |
|
22573 | main_MessageBox.confirm = function (message, title, options) {
|
22574 | if ((typeof title === 'undefined' ? 'undefined' : main_typeof(title)) === 'object') {
|
22575 | options = title;
|
22576 | title = '';
|
22577 | } else if (title === undefined) {
|
22578 | title = '';
|
22579 | }
|
22580 | return main_MessageBox(merge_default()({
|
22581 | title: title,
|
22582 | message: message,
|
22583 | $type: 'confirm',
|
22584 | showCancelButton: true
|
22585 | }, options));
|
22586 | };
|
22587 |
|
22588 | main_MessageBox.prompt = function (message, title, options) {
|
22589 | if ((typeof title === 'undefined' ? 'undefined' : main_typeof(title)) === 'object') {
|
22590 | options = title;
|
22591 | title = '';
|
22592 | } else if (title === undefined) {
|
22593 | title = '';
|
22594 | }
|
22595 | return main_MessageBox(merge_default()({
|
22596 | title: title,
|
22597 | message: message,
|
22598 | showCancelButton: true,
|
22599 | showInput: true,
|
22600 | $type: 'prompt'
|
22601 | }, options));
|
22602 | };
|
22603 |
|
22604 | main_MessageBox.close = function () {
|
22605 | main_instance.doClose();
|
22606 | main_instance.visible = false;
|
22607 | msgQueue = [];
|
22608 | currentMsg = null;
|
22609 | };
|
22610 |
|
22611 | var packages_message_box_src_main = (main_MessageBox);
|
22612 |
|
22613 |
|
22614 |
|
22615 | var message_box = (packages_message_box_src_main);
|
22616 |
|
22617 | var breadcrumbvue_type_template_id_4b464c06_render = function() {
|
22618 | var _vm = this
|
22619 | var _h = _vm.$createElement
|
22620 | var _c = _vm._self._c || _h
|
22621 | return _c(
|
22622 | "div",
|
22623 | {
|
22624 | staticClass: "el-breadcrumb",
|
22625 | attrs: { "aria-label": "Breadcrumb", role: "navigation" }
|
22626 | },
|
22627 | [_vm._t("default")],
|
22628 | 2
|
22629 | )
|
22630 | }
|
22631 | var breadcrumbvue_type_template_id_4b464c06_staticRenderFns = []
|
22632 | breadcrumbvue_type_template_id_4b464c06_render._withStripped = true
|
22633 |
|
22634 |
|
22635 |
|
22636 |
|
22637 |
|
22638 |
|
22639 |
|
22640 |
|
22641 |
|
22642 |
|
22643 |
|
22644 | var breadcrumbvue_type_script_lang_js_ = ({
|
22645 | name: 'ElBreadcrumb',
|
22646 |
|
22647 | props: {
|
22648 | separator: {
|
22649 | type: String,
|
22650 | default: '/'
|
22651 | },
|
22652 | separatorClass: {
|
22653 | type: String,
|
22654 | default: ''
|
22655 | }
|
22656 | },
|
22657 |
|
22658 | provide: function provide() {
|
22659 | return {
|
22660 | elBreadcrumb: this
|
22661 | };
|
22662 | },
|
22663 | mounted: function mounted() {
|
22664 | var items = this.$el.querySelectorAll('.el-breadcrumb__item');
|
22665 | if (items.length) {
|
22666 | items[items.length - 1].setAttribute('aria-current', 'page');
|
22667 | }
|
22668 | }
|
22669 | });
|
22670 |
|
22671 | var src_breadcrumbvue_type_script_lang_js_ = (breadcrumbvue_type_script_lang_js_);
|
22672 |
|
22673 |
|
22674 |
|
22675 |
|
22676 |
|
22677 |
|
22678 |
|
22679 |
|
22680 | var breadcrumb_component = normalizeComponent(
|
22681 | src_breadcrumbvue_type_script_lang_js_,
|
22682 | breadcrumbvue_type_template_id_4b464c06_render,
|
22683 | breadcrumbvue_type_template_id_4b464c06_staticRenderFns,
|
22684 | false,
|
22685 | null,
|
22686 | null,
|
22687 | null
|
22688 |
|
22689 | )
|
22690 |
|
22691 |
|
22692 | if (false) { var breadcrumb_api; }
|
22693 | breadcrumb_component.options.__file = "packages/breadcrumb/src/breadcrumb.vue"
|
22694 | var breadcrumb = (breadcrumb_component.exports);
|
22695 |
|
22696 |
|
22697 |
|
22698 |
|
22699 | breadcrumb.install = function (Vue) {
|
22700 | Vue.component(breadcrumb.name, breadcrumb);
|
22701 | };
|
22702 |
|
22703 | var packages_breadcrumb = (breadcrumb);
|
22704 |
|
22705 | var breadcrumb_itemvue_type_template_id_fcf9eaac_render = function() {
|
22706 | var _vm = this
|
22707 | var _h = _vm.$createElement
|
22708 | var _c = _vm._self._c || _h
|
22709 | return _c("span", { staticClass: "el-breadcrumb__item" }, [
|
22710 | _c(
|
22711 | "span",
|
22712 | {
|
22713 | ref: "link",
|
22714 | class: ["el-breadcrumb__inner", _vm.to ? "is-link" : ""],
|
22715 | attrs: { role: "link" }
|
22716 | },
|
22717 | [_vm._t("default")],
|
22718 | 2
|
22719 | ),
|
22720 | _vm.separatorClass
|
22721 | ? _c("i", {
|
22722 | staticClass: "el-breadcrumb__separator",
|
22723 | class: _vm.separatorClass
|
22724 | })
|
22725 | : _c(
|
22726 | "span",
|
22727 | {
|
22728 | staticClass: "el-breadcrumb__separator",
|
22729 | attrs: { role: "presentation" }
|
22730 | },
|
22731 | [_vm._v(_vm._s(_vm.separator))]
|
22732 | )
|
22733 | ])
|
22734 | }
|
22735 | var breadcrumb_itemvue_type_template_id_fcf9eaac_staticRenderFns = []
|
22736 | breadcrumb_itemvue_type_template_id_fcf9eaac_render._withStripped = true
|
22737 |
|
22738 |
|
22739 |
|
22740 |
|
22741 |
|
22742 |
|
22743 |
|
22744 |
|
22745 |
|
22746 |
|
22747 |
|
22748 |
|
22749 |
|
22750 |
|
22751 |
|
22752 |
|
22753 |
|
22754 |
|
22755 | var breadcrumb_itemvue_type_script_lang_js_ = ({
|
22756 | name: 'ElBreadcrumbItem',
|
22757 | props: {
|
22758 | to: {},
|
22759 | replace: Boolean
|
22760 | },
|
22761 | data: function data() {
|
22762 | return {
|
22763 | separator: '',
|
22764 | separatorClass: ''
|
22765 | };
|
22766 | },
|
22767 |
|
22768 |
|
22769 | inject: ['elBreadcrumb'],
|
22770 |
|
22771 | mounted: function mounted() {
|
22772 | var _this = this;
|
22773 |
|
22774 | this.separator = this.elBreadcrumb.separator;
|
22775 | this.separatorClass = this.elBreadcrumb.separatorClass;
|
22776 | var link = this.$refs.link;
|
22777 | link.setAttribute('role', 'link');
|
22778 | link.addEventListener('click', function (_) {
|
22779 | var to = _this.to,
|
22780 | $router = _this.$router;
|
22781 |
|
22782 | if (!to || !$router) return;
|
22783 | _this.replace ? $router.replace(to) : $router.push(to);
|
22784 | });
|
22785 | }
|
22786 | });
|
22787 |
|
22788 | var src_breadcrumb_itemvue_type_script_lang_js_ = (breadcrumb_itemvue_type_script_lang_js_);
|
22789 |
|
22790 |
|
22791 |
|
22792 |
|
22793 |
|
22794 |
|
22795 |
|
22796 |
|
22797 | var breadcrumb_item_component = normalizeComponent(
|
22798 | src_breadcrumb_itemvue_type_script_lang_js_,
|
22799 | breadcrumb_itemvue_type_template_id_fcf9eaac_render,
|
22800 | breadcrumb_itemvue_type_template_id_fcf9eaac_staticRenderFns,
|
22801 | false,
|
22802 | null,
|
22803 | null,
|
22804 | null
|
22805 |
|
22806 | )
|
22807 |
|
22808 |
|
22809 | if (false) { var breadcrumb_item_api; }
|
22810 | breadcrumb_item_component.options.__file = "packages/breadcrumb/src/breadcrumb-item.vue"
|
22811 | var breadcrumb_item = (breadcrumb_item_component.exports);
|
22812 |
|
22813 |
|
22814 |
|
22815 |
|
22816 | breadcrumb_item.install = function (Vue) {
|
22817 | Vue.component(breadcrumb_item.name, breadcrumb_item);
|
22818 | };
|
22819 |
|
22820 | var packages_breadcrumb_item = (breadcrumb_item);
|
22821 |
|
22822 | var formvue_type_template_id_a1b5ff34_render = function() {
|
22823 | var _vm = this
|
22824 | var _h = _vm.$createElement
|
22825 | var _c = _vm._self._c || _h
|
22826 | return _c(
|
22827 | "form",
|
22828 | {
|
22829 | staticClass: "el-form",
|
22830 | class: [
|
22831 | _vm.labelPosition ? "el-form--label-" + _vm.labelPosition : "",
|
22832 | { "el-form--inline": _vm.inline }
|
22833 | ]
|
22834 | },
|
22835 | [_vm._t("default")],
|
22836 | 2
|
22837 | )
|
22838 | }
|
22839 | var formvue_type_template_id_a1b5ff34_staticRenderFns = []
|
22840 | formvue_type_template_id_a1b5ff34_render._withStripped = true
|
22841 |
|
22842 |
|
22843 |
|
22844 |
|
22845 |
|
22846 |
|
22847 |
|
22848 |
|
22849 |
|
22850 |
|
22851 |
|
22852 |
|
22853 |
|
22854 |
|
22855 |
|
22856 |
|
22857 | var formvue_type_script_lang_js_ = ({
|
22858 | name: 'ElForm',
|
22859 |
|
22860 | componentName: 'ElForm',
|
22861 |
|
22862 | provide: function provide() {
|
22863 | return {
|
22864 | elForm: this
|
22865 | };
|
22866 | },
|
22867 |
|
22868 |
|
22869 | props: {
|
22870 | model: Object,
|
22871 | rules: Object,
|
22872 | labelPosition: String,
|
22873 | labelWidth: String,
|
22874 | labelSuffix: {
|
22875 | type: String,
|
22876 | default: ''
|
22877 | },
|
22878 | inline: Boolean,
|
22879 | inlineMessage: Boolean,
|
22880 | statusIcon: Boolean,
|
22881 | showMessage: {
|
22882 | type: Boolean,
|
22883 | default: true
|
22884 | },
|
22885 | size: String,
|
22886 | disabled: Boolean,
|
22887 | validateOnRuleChange: {
|
22888 | type: Boolean,
|
22889 | default: true
|
22890 | },
|
22891 | hideRequiredAsterisk: {
|
22892 | type: Boolean,
|
22893 | default: false
|
22894 | }
|
22895 | },
|
22896 | watch: {
|
22897 | rules: function rules() {
|
22898 |
|
22899 | this.fields.forEach(function (field) {
|
22900 | field.removeValidateEvents();
|
22901 | field.addValidateEvents();
|
22902 | });
|
22903 |
|
22904 | if (this.validateOnRuleChange) {
|
22905 | this.validate(function () {});
|
22906 | }
|
22907 | }
|
22908 | },
|
22909 | computed: {
|
22910 | autoLabelWidth: function autoLabelWidth() {
|
22911 | if (!this.potentialLabelWidthArr.length) return 0;
|
22912 | var max = Math.max.apply(Math, this.potentialLabelWidthArr);
|
22913 | return max ? max + 'px' : '';
|
22914 | }
|
22915 | },
|
22916 | data: function data() {
|
22917 | return {
|
22918 | fields: [],
|
22919 | potentialLabelWidthArr: []
|
22920 | };
|
22921 | },
|
22922 | created: function created() {
|
22923 | var _this = this;
|
22924 |
|
22925 | this.$on('el.form.addField', function (field) {
|
22926 | if (field) {
|
22927 | _this.fields.push(field);
|
22928 | }
|
22929 | });
|
22930 |
|
22931 | this.$on('el.form.removeField', function (field) {
|
22932 | if (field.prop) {
|
22933 | _this.fields.splice(_this.fields.indexOf(field), 1);
|
22934 | }
|
22935 | });
|
22936 | },
|
22937 |
|
22938 | methods: {
|
22939 | resetFields: function resetFields() {
|
22940 | if (!this.model) {
|
22941 | console.warn('[Element Warn][Form]model is required for resetFields to work.');
|
22942 | return;
|
22943 | }
|
22944 | this.fields.forEach(function (field) {
|
22945 | field.resetField();
|
22946 | });
|
22947 | },
|
22948 | clearValidate: function clearValidate() {
|
22949 | var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
22950 |
|
22951 | var fields = props.length ? typeof props === 'string' ? this.fields.filter(function (field) {
|
22952 | return props === field.prop;
|
22953 | }) : this.fields.filter(function (field) {
|
22954 | return props.indexOf(field.prop) > -1;
|
22955 | }) : this.fields;
|
22956 | fields.forEach(function (field) {
|
22957 | field.clearValidate();
|
22958 | });
|
22959 | },
|
22960 | validate: function validate(callback) {
|
22961 | var _this2 = this;
|
22962 |
|
22963 | if (!this.model) {
|
22964 | console.warn('[Element Warn][Form]model is required for validate to work!');
|
22965 | return;
|
22966 | }
|
22967 |
|
22968 | var promise = void 0;
|
22969 |
|
22970 | if (typeof callback !== 'function' && window.Promise) {
|
22971 | promise = new window.Promise(function (resolve, reject) {
|
22972 | callback = function callback(valid) {
|
22973 | valid ? resolve(valid) : reject(valid);
|
22974 | };
|
22975 | });
|
22976 | }
|
22977 |
|
22978 | var valid = true;
|
22979 | var count = 0;
|
22980 |
|
22981 | if (this.fields.length === 0 && callback) {
|
22982 | callback(true);
|
22983 | }
|
22984 | var invalidFields = {};
|
22985 | this.fields.forEach(function (field) {
|
22986 | field.validate('', function (message, field) {
|
22987 | if (message) {
|
22988 | valid = false;
|
22989 | }
|
22990 | invalidFields = merge_default()({}, invalidFields, field);
|
22991 | if (typeof callback === 'function' && ++count === _this2.fields.length) {
|
22992 | callback(valid, invalidFields);
|
22993 | }
|
22994 | });
|
22995 | });
|
22996 |
|
22997 | if (promise) {
|
22998 | return promise;
|
22999 | }
|
23000 | },
|
23001 | validateField: function validateField(props, cb) {
|
23002 | props = [].concat(props);
|
23003 | var fields = this.fields.filter(function (field) {
|
23004 | return props.indexOf(field.prop) !== -1;
|
23005 | });
|
23006 | if (!fields.length) {
|
23007 | console.warn('[Element Warn]please pass correct props!');
|
23008 | return;
|
23009 | }
|
23010 |
|
23011 | fields.forEach(function (field) {
|
23012 | field.validate('', cb);
|
23013 | });
|
23014 | },
|
23015 | getLabelWidthIndex: function getLabelWidthIndex(width) {
|
23016 | var index = this.potentialLabelWidthArr.indexOf(width);
|
23017 |
|
23018 | if (index === -1) {
|
23019 | throw new Error('[ElementForm]unpected width ', width);
|
23020 | }
|
23021 | return index;
|
23022 | },
|
23023 | registerLabelWidth: function registerLabelWidth(val, oldVal) {
|
23024 | if (val && oldVal) {
|
23025 | var index = this.getLabelWidthIndex(oldVal);
|
23026 | this.potentialLabelWidthArr.splice(index, 1, val);
|
23027 | } else if (val) {
|
23028 | this.potentialLabelWidthArr.push(val);
|
23029 | }
|
23030 | },
|
23031 | deregisterLabelWidth: function deregisterLabelWidth(val) {
|
23032 | var index = this.getLabelWidthIndex(val);
|
23033 | this.potentialLabelWidthArr.splice(index, 1);
|
23034 | }
|
23035 | }
|
23036 | });
|
23037 |
|
23038 | var src_formvue_type_script_lang_js_ = (formvue_type_script_lang_js_);
|
23039 |
|
23040 |
|
23041 |
|
23042 |
|
23043 |
|
23044 |
|
23045 |
|
23046 |
|
23047 | var form_component = normalizeComponent(
|
23048 | src_formvue_type_script_lang_js_,
|
23049 | formvue_type_template_id_a1b5ff34_render,
|
23050 | formvue_type_template_id_a1b5ff34_staticRenderFns,
|
23051 | false,
|
23052 | null,
|
23053 | null,
|
23054 | null
|
23055 |
|
23056 | )
|
23057 |
|
23058 |
|
23059 | if (false) { var form_api; }
|
23060 | form_component.options.__file = "packages/form/src/form.vue"
|
23061 | var src_form = (form_component.exports);
|
23062 |
|
23063 |
|
23064 |
|
23065 |
|
23066 | src_form.install = function (Vue) {
|
23067 | Vue.component(src_form.name, src_form);
|
23068 | };
|
23069 |
|
23070 | var packages_form = (src_form);
|
23071 |
|
23072 | var form_itemvue_type_template_id_b6f3db6c_render = function() {
|
23073 | var _vm = this
|
23074 | var _h = _vm.$createElement
|
23075 | var _c = _vm._self._c || _h
|
23076 | return _c(
|
23077 | "div",
|
23078 | {
|
23079 | staticClass: "el-form-item",
|
23080 | class: [
|
23081 | {
|
23082 | "el-form-item--feedback": _vm.elForm && _vm.elForm.statusIcon,
|
23083 | "is-error": _vm.validateState === "error",
|
23084 | "is-validating": _vm.validateState === "validating",
|
23085 | "is-success": _vm.validateState === "success",
|
23086 | "is-required": _vm.isRequired || _vm.required,
|
23087 | "is-no-asterisk": _vm.elForm && _vm.elForm.hideRequiredAsterisk
|
23088 | },
|
23089 | _vm.sizeClass ? "el-form-item--" + _vm.sizeClass : ""
|
23090 | ]
|
23091 | },
|
23092 | [
|
23093 | _c(
|
23094 | "label-wrap",
|
23095 | {
|
23096 | attrs: {
|
23097 | "is-auto-width": _vm.labelStyle && _vm.labelStyle.width === "auto",
|
23098 | "update-all": _vm.form.labelWidth === "auto"
|
23099 | }
|
23100 | },
|
23101 | [
|
23102 | _vm.label || _vm.$slots.label
|
23103 | ? _c(
|
23104 | "label",
|
23105 | {
|
23106 | staticClass: "el-form-item__label",
|
23107 | style: _vm.labelStyle,
|
23108 | attrs: { for: _vm.labelFor }
|
23109 | },
|
23110 | [
|
23111 | _vm._t("label", [
|
23112 | _vm._v(_vm._s(_vm.label + _vm.form.labelSuffix))
|
23113 | ])
|
23114 | ],
|
23115 | 2
|
23116 | )
|
23117 | : _vm._e()
|
23118 | ]
|
23119 | ),
|
23120 | _c(
|
23121 | "div",
|
23122 | { staticClass: "el-form-item__content", style: _vm.contentStyle },
|
23123 | [
|
23124 | _vm._t("default"),
|
23125 | _c(
|
23126 | "transition",
|
23127 | { attrs: { name: "el-zoom-in-top" } },
|
23128 | [
|
23129 | _vm.validateState === "error" &&
|
23130 | _vm.showMessage &&
|
23131 | _vm.form.showMessage
|
23132 | ? _vm._t(
|
23133 | "error",
|
23134 | [
|
23135 | _c(
|
23136 | "div",
|
23137 | {
|
23138 | staticClass: "el-form-item__error",
|
23139 | class: {
|
23140 | "el-form-item__error--inline":
|
23141 | typeof _vm.inlineMessage === "boolean"
|
23142 | ? _vm.inlineMessage
|
23143 | : (_vm.elForm && _vm.elForm.inlineMessage) ||
|
23144 | false
|
23145 | }
|
23146 | },
|
23147 | [
|
23148 | _vm._v(
|
23149 | "\n " +
|
23150 | _vm._s(_vm.validateMessage) +
|
23151 | "\n "
|
23152 | )
|
23153 | ]
|
23154 | )
|
23155 | ],
|
23156 | { error: _vm.validateMessage }
|
23157 | )
|
23158 | : _vm._e()
|
23159 | ],
|
23160 | 2
|
23161 | )
|
23162 | ],
|
23163 | 2
|
23164 | )
|
23165 | ],
|
23166 | 1
|
23167 | )
|
23168 | }
|
23169 | var form_itemvue_type_template_id_b6f3db6c_staticRenderFns = []
|
23170 | form_itemvue_type_template_id_b6f3db6c_render._withStripped = true
|
23171 |
|
23172 |
|
23173 |
|
23174 |
|
23175 |
|
23176 | var external_async_validator_ = __webpack_require__(40);
|
23177 | var external_async_validator_default = __webpack_require__.n(external_async_validator_);
|
23178 |
|
23179 |
|
23180 |
|
23181 |
|
23182 | var label_wrapvue_type_script_lang_js_ = ({
|
23183 | props: {
|
23184 | isAutoWidth: Boolean,
|
23185 | updateAll: Boolean
|
23186 | },
|
23187 |
|
23188 | inject: ['elForm', 'elFormItem'],
|
23189 |
|
23190 | render: function render() {
|
23191 | var h = arguments[0];
|
23192 |
|
23193 | var slots = this.$slots.default;
|
23194 | if (!slots) return null;
|
23195 | if (this.isAutoWidth) {
|
23196 | var autoLabelWidth = this.elForm.autoLabelWidth;
|
23197 | var style = {};
|
23198 | if (autoLabelWidth && autoLabelWidth !== 'auto') {
|
23199 | var marginLeft = parseInt(autoLabelWidth, 10) - this.computedWidth;
|
23200 | if (marginLeft) {
|
23201 | style.marginLeft = marginLeft + 'px';
|
23202 | }
|
23203 | }
|
23204 | return h(
|
23205 | 'div',
|
23206 | { 'class': 'el-form-item__label-wrap', style: style },
|
23207 | [slots]
|
23208 | );
|
23209 | } else {
|
23210 | return slots[0];
|
23211 | }
|
23212 | },
|
23213 |
|
23214 |
|
23215 | methods: {
|
23216 | getLabelWidth: function getLabelWidth() {
|
23217 | if (this.$el && this.$el.firstElementChild) {
|
23218 | var computedWidth = window.getComputedStyle(this.$el.firstElementChild).width;
|
23219 | return Math.ceil(parseFloat(computedWidth));
|
23220 | } else {
|
23221 | return 0;
|
23222 | }
|
23223 | },
|
23224 | updateLabelWidth: function updateLabelWidth() {
|
23225 | var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'update';
|
23226 |
|
23227 | if (this.$slots.default && this.isAutoWidth && this.$el.firstElementChild) {
|
23228 | if (action === 'update') {
|
23229 | this.computedWidth = this.getLabelWidth();
|
23230 | } else if (action === 'remove') {
|
23231 | this.elForm.deregisterLabelWidth(this.computedWidth);
|
23232 | }
|
23233 | }
|
23234 | }
|
23235 | },
|
23236 |
|
23237 | watch: {
|
23238 | computedWidth: function computedWidth(val, oldVal) {
|
23239 | if (this.updateAll) {
|
23240 | this.elForm.registerLabelWidth(val, oldVal);
|
23241 | this.elFormItem.updateComputedLabelWidth(val);
|
23242 | }
|
23243 | }
|
23244 | },
|
23245 |
|
23246 | data: function data() {
|
23247 | return {
|
23248 | computedWidth: 0
|
23249 | };
|
23250 | },
|
23251 | mounted: function mounted() {
|
23252 | this.updateLabelWidth('update');
|
23253 | },
|
23254 | updated: function updated() {
|
23255 | this.updateLabelWidth('update');
|
23256 | },
|
23257 | beforeDestroy: function beforeDestroy() {
|
23258 | this.updateLabelWidth('remove');
|
23259 | }
|
23260 | });
|
23261 |
|
23262 | var src_label_wrapvue_type_script_lang_js_ = (label_wrapvue_type_script_lang_js_);
|
23263 |
|
23264 | var label_wrap_render, label_wrap_staticRenderFns
|
23265 |
|
23266 |
|
23267 |
|
23268 |
|
23269 |
|
23270 |
|
23271 | var label_wrap_component = normalizeComponent(
|
23272 | src_label_wrapvue_type_script_lang_js_,
|
23273 | label_wrap_render,
|
23274 | label_wrap_staticRenderFns,
|
23275 | false,
|
23276 | null,
|
23277 | null,
|
23278 | null
|
23279 |
|
23280 | )
|
23281 |
|
23282 |
|
23283 | if (false) { var label_wrap_api; }
|
23284 | label_wrap_component.options.__file = "packages/form/src/label-wrap.vue"
|
23285 | var label_wrap = (label_wrap_component.exports);
|
23286 |
|
23287 |
|
23288 |
|
23289 |
|
23290 |
|
23291 |
|
23292 |
|
23293 |
|
23294 |
|
23295 |
|
23296 |
|
23297 |
|
23298 |
|
23299 |
|
23300 |
|
23301 |
|
23302 |
|
23303 |
|
23304 |
|
23305 |
|
23306 |
|
23307 |
|
23308 |
|
23309 |
|
23310 |
|
23311 |
|
23312 |
|
23313 |
|
23314 |
|
23315 |
|
23316 |
|
23317 |
|
23318 |
|
23319 |
|
23320 |
|
23321 |
|
23322 |
|
23323 |
|
23324 |
|
23325 |
|
23326 |
|
23327 |
|
23328 |
|
23329 |
|
23330 |
|
23331 |
|
23332 |
|
23333 | var form_itemvue_type_script_lang_js_ = ({
|
23334 | name: 'ElFormItem',
|
23335 |
|
23336 | componentName: 'ElFormItem',
|
23337 |
|
23338 | mixins: [emitter_default.a],
|
23339 |
|
23340 | provide: function provide() {
|
23341 | return {
|
23342 | elFormItem: this
|
23343 | };
|
23344 | },
|
23345 |
|
23346 |
|
23347 | inject: ['elForm'],
|
23348 |
|
23349 | props: {
|
23350 | label: String,
|
23351 | labelWidth: String,
|
23352 | prop: String,
|
23353 | required: {
|
23354 | type: Boolean,
|
23355 | default: undefined
|
23356 | },
|
23357 | rules: [Object, Array],
|
23358 | error: String,
|
23359 | validateStatus: String,
|
23360 | for: String,
|
23361 | inlineMessage: {
|
23362 | type: [String, Boolean],
|
23363 | default: ''
|
23364 | },
|
23365 | showMessage: {
|
23366 | type: Boolean,
|
23367 | default: true
|
23368 | },
|
23369 | size: String
|
23370 | },
|
23371 | components: {
|
23372 |
|
23373 | LabelWrap: label_wrap
|
23374 | },
|
23375 | watch: {
|
23376 | error: {
|
23377 | immediate: true,
|
23378 | handler: function handler(value) {
|
23379 | this.validateMessage = value;
|
23380 | this.validateState = value ? 'error' : '';
|
23381 | }
|
23382 | },
|
23383 | validateStatus: function validateStatus(value) {
|
23384 | this.validateState = value;
|
23385 | }
|
23386 | },
|
23387 | computed: {
|
23388 | labelFor: function labelFor() {
|
23389 | return this.for || this.prop;
|
23390 | },
|
23391 | labelStyle: function labelStyle() {
|
23392 | var ret = {};
|
23393 | if (this.form.labelPosition === 'top') return ret;
|
23394 | var labelWidth = this.labelWidth || this.form.labelWidth;
|
23395 | if (labelWidth) {
|
23396 | ret.width = labelWidth;
|
23397 | }
|
23398 | return ret;
|
23399 | },
|
23400 | contentStyle: function contentStyle() {
|
23401 | var ret = {};
|
23402 | var label = this.label;
|
23403 | if (this.form.labelPosition === 'top' || this.form.inline) return ret;
|
23404 | if (!label && !this.labelWidth && this.isNested) return ret;
|
23405 | var labelWidth = this.labelWidth || this.form.labelWidth;
|
23406 | if (labelWidth === 'auto') {
|
23407 | if (this.labelWidth === 'auto') {
|
23408 | ret.marginLeft = this.computedLabelWidth;
|
23409 | } else if (this.form.labelWidth === 'auto') {
|
23410 | ret.marginLeft = this.elForm.autoLabelWidth;
|
23411 | }
|
23412 | } else {
|
23413 | ret.marginLeft = labelWidth;
|
23414 | }
|
23415 | return ret;
|
23416 | },
|
23417 | form: function form() {
|
23418 | var parent = this.$parent;
|
23419 | var parentName = parent.$options.componentName;
|
23420 | while (parentName !== 'ElForm') {
|
23421 | if (parentName === 'ElFormItem') {
|
23422 | this.isNested = true;
|
23423 | }
|
23424 | parent = parent.$parent;
|
23425 | parentName = parent.$options.componentName;
|
23426 | }
|
23427 | return parent;
|
23428 | },
|
23429 | fieldValue: function fieldValue() {
|
23430 | var model = this.form.model;
|
23431 | if (!model || !this.prop) {
|
23432 | return;
|
23433 | }
|
23434 |
|
23435 | var path = this.prop;
|
23436 | if (path.indexOf(':') !== -1) {
|
23437 | path = path.replace(/:/, '.');
|
23438 | }
|
23439 |
|
23440 | return Object(util_["getPropByPath"])(model, path, true).v;
|
23441 | },
|
23442 | isRequired: function isRequired() {
|
23443 | var rules = this.getRules();
|
23444 | var isRequired = false;
|
23445 |
|
23446 | if (rules && rules.length) {
|
23447 | rules.every(function (rule) {
|
23448 | if (rule.required) {
|
23449 | isRequired = true;
|
23450 | return false;
|
23451 | }
|
23452 | return true;
|
23453 | });
|
23454 | }
|
23455 | return isRequired;
|
23456 | },
|
23457 | _formSize: function _formSize() {
|
23458 | return this.elForm.size;
|
23459 | },
|
23460 | elFormItemSize: function elFormItemSize() {
|
23461 | return this.size || this._formSize;
|
23462 | },
|
23463 | sizeClass: function sizeClass() {
|
23464 | return this.elFormItemSize || (this.$ELEMENT || {}).size;
|
23465 | }
|
23466 | },
|
23467 | data: function data() {
|
23468 | return {
|
23469 | validateState: '',
|
23470 | validateMessage: '',
|
23471 | validateDisabled: false,
|
23472 | validator: {},
|
23473 | isNested: false,
|
23474 | computedLabelWidth: ''
|
23475 | };
|
23476 | },
|
23477 |
|
23478 | methods: {
|
23479 | validate: function validate(trigger) {
|
23480 | var _this = this;
|
23481 |
|
23482 | var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : util_["noop"];
|
23483 |
|
23484 | this.validateDisabled = false;
|
23485 | var rules = this.getFilteredRule(trigger);
|
23486 | if ((!rules || rules.length === 0) && this.required === undefined) {
|
23487 | callback();
|
23488 | return true;
|
23489 | }
|
23490 |
|
23491 | this.validateState = 'validating';
|
23492 |
|
23493 | var descriptor = {};
|
23494 | if (rules && rules.length > 0) {
|
23495 | rules.forEach(function (rule) {
|
23496 | delete rule.trigger;
|
23497 | });
|
23498 | }
|
23499 | descriptor[this.prop] = rules;
|
23500 |
|
23501 | var validator = new external_async_validator_default.a(descriptor);
|
23502 | var model = {};
|
23503 |
|
23504 | model[this.prop] = this.fieldValue;
|
23505 |
|
23506 | validator.validate(model, { firstFields: true }, function (errors, invalidFields) {
|
23507 | _this.validateState = !errors ? 'success' : 'error';
|
23508 | _this.validateMessage = errors ? errors[0].message : '';
|
23509 |
|
23510 | callback(_this.validateMessage, invalidFields);
|
23511 | _this.elForm && _this.elForm.$emit('validate', _this.prop, !errors, _this.validateMessage || null);
|
23512 | });
|
23513 | },
|
23514 | clearValidate: function clearValidate() {
|
23515 | this.validateState = '';
|
23516 | this.validateMessage = '';
|
23517 | this.validateDisabled = false;
|
23518 | },
|
23519 | resetField: function resetField() {
|
23520 | var _this2 = this;
|
23521 |
|
23522 | this.validateState = '';
|
23523 | this.validateMessage = '';
|
23524 |
|
23525 | var model = this.form.model;
|
23526 | var value = this.fieldValue;
|
23527 | var path = this.prop;
|
23528 | if (path.indexOf(':') !== -1) {
|
23529 | path = path.replace(/:/, '.');
|
23530 | }
|
23531 |
|
23532 | var prop = Object(util_["getPropByPath"])(model, path, true);
|
23533 |
|
23534 | this.validateDisabled = true;
|
23535 | if (Array.isArray(value)) {
|
23536 | prop.o[prop.k] = [].concat(this.initialValue);
|
23537 | } else {
|
23538 | prop.o[prop.k] = this.initialValue;
|
23539 | }
|
23540 |
|
23541 |
|
23542 | this.$nextTick(function () {
|
23543 | _this2.validateDisabled = false;
|
23544 | });
|
23545 |
|
23546 | this.broadcast('ElTimeSelect', 'fieldReset', this.initialValue);
|
23547 | },
|
23548 | getRules: function getRules() {
|
23549 | var formRules = this.form.rules;
|
23550 | var selfRules = this.rules;
|
23551 | var requiredRule = this.required !== undefined ? { required: !!this.required } : [];
|
23552 |
|
23553 | var prop = Object(util_["getPropByPath"])(formRules, this.prop || '');
|
23554 | formRules = formRules ? prop.o[this.prop || ''] || prop.v : [];
|
23555 |
|
23556 | return [].concat(selfRules || formRules || []).concat(requiredRule);
|
23557 | },
|
23558 | getFilteredRule: function getFilteredRule(trigger) {
|
23559 | var rules = this.getRules();
|
23560 |
|
23561 | return rules.filter(function (rule) {
|
23562 | if (!rule.trigger || trigger === '') return true;
|
23563 | if (Array.isArray(rule.trigger)) {
|
23564 | return rule.trigger.indexOf(trigger) > -1;
|
23565 | } else {
|
23566 | return rule.trigger === trigger;
|
23567 | }
|
23568 | }).map(function (rule) {
|
23569 | return merge_default()({}, rule);
|
23570 | });
|
23571 | },
|
23572 | onFieldBlur: function onFieldBlur() {
|
23573 | this.validate('blur');
|
23574 | },
|
23575 | onFieldChange: function onFieldChange() {
|
23576 | if (this.validateDisabled) {
|
23577 | this.validateDisabled = false;
|
23578 | return;
|
23579 | }
|
23580 |
|
23581 | this.validate('change');
|
23582 | },
|
23583 | updateComputedLabelWidth: function updateComputedLabelWidth(width) {
|
23584 | this.computedLabelWidth = width ? width + 'px' : '';
|
23585 | },
|
23586 | addValidateEvents: function addValidateEvents() {
|
23587 | var rules = this.getRules();
|
23588 |
|
23589 | if (rules.length || this.required !== undefined) {
|
23590 | this.$on('el.form.blur', this.onFieldBlur);
|
23591 | this.$on('el.form.change', this.onFieldChange);
|
23592 | }
|
23593 | },
|
23594 | removeValidateEvents: function removeValidateEvents() {
|
23595 | this.$off();
|
23596 | }
|
23597 | },
|
23598 | mounted: function mounted() {
|
23599 | if (this.prop) {
|
23600 | this.dispatch('ElForm', 'el.form.addField', [this]);
|
23601 |
|
23602 | var initialValue = this.fieldValue;
|
23603 | if (Array.isArray(initialValue)) {
|
23604 | initialValue = [].concat(initialValue);
|
23605 | }
|
23606 | Object.defineProperty(this, 'initialValue', {
|
23607 | value: initialValue
|
23608 | });
|
23609 |
|
23610 | this.addValidateEvents();
|
23611 | }
|
23612 | },
|
23613 | beforeDestroy: function beforeDestroy() {
|
23614 | this.dispatch('ElForm', 'el.form.removeField', [this]);
|
23615 | }
|
23616 | });
|
23617 |
|
23618 | var src_form_itemvue_type_script_lang_js_ = (form_itemvue_type_script_lang_js_);
|
23619 |
|
23620 |
|
23621 |
|
23622 |
|
23623 |
|
23624 |
|
23625 |
|
23626 |
|
23627 | var form_item_component = normalizeComponent(
|
23628 | src_form_itemvue_type_script_lang_js_,
|
23629 | form_itemvue_type_template_id_b6f3db6c_render,
|
23630 | form_itemvue_type_template_id_b6f3db6c_staticRenderFns,
|
23631 | false,
|
23632 | null,
|
23633 | null,
|
23634 | null
|
23635 |
|
23636 | )
|
23637 |
|
23638 |
|
23639 | if (false) { var form_item_api; }
|
23640 | form_item_component.options.__file = "packages/form/src/form-item.vue"
|
23641 | var form_item = (form_item_component.exports);
|
23642 |
|
23643 |
|
23644 |
|
23645 |
|
23646 | form_item.install = function (Vue) {
|
23647 | Vue.component(form_item.name, form_item);
|
23648 | };
|
23649 |
|
23650 | var packages_form_item = (form_item);
|
23651 |
|
23652 | var tab_barvue_type_template_id_2031f33a_render = function() {
|
23653 | var _vm = this
|
23654 | var _h = _vm.$createElement
|
23655 | var _c = _vm._self._c || _h
|
23656 | return _c("div", {
|
23657 | staticClass: "el-tabs__active-bar",
|
23658 | class: "is-" + _vm.rootTabs.tabPosition,
|
23659 | style: _vm.barStyle
|
23660 | })
|
23661 | }
|
23662 | var tab_barvue_type_template_id_2031f33a_staticRenderFns = []
|
23663 | tab_barvue_type_template_id_2031f33a_render._withStripped = true
|
23664 |
|
23665 |
|
23666 |
|
23667 |
|
23668 |
|
23669 |
|
23670 |
|
23671 |
|
23672 |
|
23673 |
|
23674 | var tab_barvue_type_script_lang_js_ = ({
|
23675 | name: 'TabBar',
|
23676 |
|
23677 | props: {
|
23678 | tabs: Array
|
23679 | },
|
23680 |
|
23681 | inject: ['rootTabs'],
|
23682 |
|
23683 | computed: {
|
23684 | barStyle: {
|
23685 | get: function get() {
|
23686 | var _this = this;
|
23687 |
|
23688 | var style = {};
|
23689 | var offset = 0;
|
23690 | var tabSize = 0;
|
23691 | var sizeName = ['top', 'bottom'].indexOf(this.rootTabs.tabPosition) !== -1 ? 'width' : 'height';
|
23692 | var sizeDir = sizeName === 'width' ? 'x' : 'y';
|
23693 | var firstUpperCase = function firstUpperCase(str) {
|
23694 | return str.toLowerCase().replace(/( |^)[a-z]/g, function (L) {
|
23695 | return L.toUpperCase();
|
23696 | });
|
23697 | };
|
23698 | this.tabs.every(function (tab, index) {
|
23699 | var $el = Object(util_["arrayFind"])(_this.$parent.$refs.tabs || [], function (t) {
|
23700 | return t.id.replace('tab-', '') === tab.paneName;
|
23701 | });
|
23702 | if (!$el) {
|
23703 | return false;
|
23704 | }
|
23705 |
|
23706 | if (!tab.active) {
|
23707 | offset += $el['client' + firstUpperCase(sizeName)];
|
23708 | return true;
|
23709 | } else {
|
23710 | tabSize = $el['client' + firstUpperCase(sizeName)];
|
23711 | var tabStyles = window.getComputedStyle($el);
|
23712 | if (sizeName === 'width' && _this.tabs.length > 1) {
|
23713 | tabSize -= parseFloat(tabStyles.paddingLeft) + parseFloat(tabStyles.paddingRight);
|
23714 | }
|
23715 | if (sizeName === 'width') {
|
23716 | offset += parseFloat(tabStyles.paddingLeft);
|
23717 | }
|
23718 | return false;
|
23719 | }
|
23720 | });
|
23721 |
|
23722 | var transform = 'translate' + firstUpperCase(sizeDir) + '(' + offset + 'px)';
|
23723 | style[sizeName] = tabSize + 'px';
|
23724 | style.transform = transform;
|
23725 | style.msTransform = transform;
|
23726 | style.webkitTransform = transform;
|
23727 |
|
23728 | return style;
|
23729 | }
|
23730 | }
|
23731 | }
|
23732 | });
|
23733 |
|
23734 | var src_tab_barvue_type_script_lang_js_ = (tab_barvue_type_script_lang_js_);
|
23735 |
|
23736 |
|
23737 |
|
23738 |
|
23739 |
|
23740 |
|
23741 |
|
23742 |
|
23743 | var tab_bar_component = normalizeComponent(
|
23744 | src_tab_barvue_type_script_lang_js_,
|
23745 | tab_barvue_type_template_id_2031f33a_render,
|
23746 | tab_barvue_type_template_id_2031f33a_staticRenderFns,
|
23747 | false,
|
23748 | null,
|
23749 | null,
|
23750 | null
|
23751 |
|
23752 | )
|
23753 |
|
23754 |
|
23755 | if (false) { var tab_bar_api; }
|
23756 | tab_bar_component.options.__file = "packages/tabs/src/tab-bar.vue"
|
23757 | var tab_bar = (tab_bar_component.exports);
|
23758 |
|
23759 |
|
23760 |
|
23761 |
|
23762 |
|
23763 | function noop() {}
|
23764 | var tab_navvue_type_script_lang_js_firstUpperCase = function firstUpperCase(str) {
|
23765 | return str.toLowerCase().replace(/( |^)[a-z]/g, function (L) {
|
23766 | return L.toUpperCase();
|
23767 | });
|
23768 | };
|
23769 |
|
23770 | var tab_navvue_type_script_lang_js_ = ({
|
23771 | name: 'TabNav',
|
23772 |
|
23773 | components: {
|
23774 | TabBar: tab_bar
|
23775 | },
|
23776 |
|
23777 | inject: ['rootTabs'],
|
23778 |
|
23779 | props: {
|
23780 | panes: Array,
|
23781 | currentName: String,
|
23782 | editable: Boolean,
|
23783 | onTabClick: {
|
23784 | type: Function,
|
23785 | default: noop
|
23786 | },
|
23787 | onTabRemove: {
|
23788 | type: Function,
|
23789 | default: noop
|
23790 | },
|
23791 | type: String,
|
23792 | stretch: Boolean
|
23793 | },
|
23794 |
|
23795 | data: function data() {
|
23796 | return {
|
23797 | scrollable: false,
|
23798 | navOffset: 0,
|
23799 | isFocus: false,
|
23800 | focusable: true
|
23801 | };
|
23802 | },
|
23803 |
|
23804 |
|
23805 | computed: {
|
23806 | navStyle: function navStyle() {
|
23807 | var dir = ['top', 'bottom'].indexOf(this.rootTabs.tabPosition) !== -1 ? 'X' : 'Y';
|
23808 | return {
|
23809 | transform: 'translate' + dir + '(-' + this.navOffset + 'px)'
|
23810 | };
|
23811 | },
|
23812 | sizeName: function sizeName() {
|
23813 | return ['top', 'bottom'].indexOf(this.rootTabs.tabPosition) !== -1 ? 'width' : 'height';
|
23814 | }
|
23815 | },
|
23816 |
|
23817 | methods: {
|
23818 | scrollPrev: function scrollPrev() {
|
23819 | var containerSize = this.$refs.navScroll['offset' + tab_navvue_type_script_lang_js_firstUpperCase(this.sizeName)];
|
23820 | var currentOffset = this.navOffset;
|
23821 |
|
23822 | if (!currentOffset) return;
|
23823 |
|
23824 | var newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
|
23825 |
|
23826 | this.navOffset = newOffset;
|
23827 | },
|
23828 | scrollNext: function scrollNext() {
|
23829 | var navSize = this.$refs.nav['offset' + tab_navvue_type_script_lang_js_firstUpperCase(this.sizeName)];
|
23830 | var containerSize = this.$refs.navScroll['offset' + tab_navvue_type_script_lang_js_firstUpperCase(this.sizeName)];
|
23831 | var currentOffset = this.navOffset;
|
23832 |
|
23833 | if (navSize - currentOffset <= containerSize) return;
|
23834 |
|
23835 | var newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
|
23836 |
|
23837 | this.navOffset = newOffset;
|
23838 | },
|
23839 | scrollToActiveTab: function scrollToActiveTab() {
|
23840 | if (!this.scrollable) return;
|
23841 | var nav = this.$refs.nav;
|
23842 | var activeTab = this.$el.querySelector('.is-active');
|
23843 | if (!activeTab) return;
|
23844 | var navScroll = this.$refs.navScroll;
|
23845 | var isHorizontal = ['top', 'bottom'].indexOf(this.rootTabs.tabPosition) !== -1;
|
23846 | var activeTabBounding = activeTab.getBoundingClientRect();
|
23847 | var navScrollBounding = navScroll.getBoundingClientRect();
|
23848 | var maxOffset = isHorizontal ? nav.offsetWidth - navScrollBounding.width : nav.offsetHeight - navScrollBounding.height;
|
23849 | var currentOffset = this.navOffset;
|
23850 | var newOffset = currentOffset;
|
23851 |
|
23852 | if (isHorizontal) {
|
23853 | if (activeTabBounding.left < navScrollBounding.left) {
|
23854 | newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
|
23855 | }
|
23856 | if (activeTabBounding.right > navScrollBounding.right) {
|
23857 | newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
|
23858 | }
|
23859 | } else {
|
23860 | if (activeTabBounding.top < navScrollBounding.top) {
|
23861 | newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
|
23862 | }
|
23863 | if (activeTabBounding.bottom > navScrollBounding.bottom) {
|
23864 | newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
|
23865 | }
|
23866 | }
|
23867 | newOffset = Math.max(newOffset, 0);
|
23868 | this.navOffset = Math.min(newOffset, maxOffset);
|
23869 | },
|
23870 | update: function update() {
|
23871 | if (!this.$refs.nav) return;
|
23872 | var sizeName = this.sizeName;
|
23873 | var navSize = this.$refs.nav['offset' + tab_navvue_type_script_lang_js_firstUpperCase(sizeName)];
|
23874 | var containerSize = this.$refs.navScroll['offset' + tab_navvue_type_script_lang_js_firstUpperCase(sizeName)];
|
23875 | var currentOffset = this.navOffset;
|
23876 |
|
23877 | if (containerSize < navSize) {
|
23878 | var _currentOffset = this.navOffset;
|
23879 | this.scrollable = this.scrollable || {};
|
23880 | this.scrollable.prev = _currentOffset;
|
23881 | this.scrollable.next = _currentOffset + containerSize < navSize;
|
23882 | if (navSize - _currentOffset < containerSize) {
|
23883 | this.navOffset = navSize - containerSize;
|
23884 | }
|
23885 | } else {
|
23886 | this.scrollable = false;
|
23887 | if (currentOffset > 0) {
|
23888 | this.navOffset = 0;
|
23889 | }
|
23890 | }
|
23891 | },
|
23892 | changeTab: function changeTab(e) {
|
23893 | var keyCode = e.keyCode;
|
23894 | var nextIndex = void 0;
|
23895 | var currentIndex = void 0,
|
23896 | tabList = void 0;
|
23897 | if ([37, 38, 39, 40].indexOf(keyCode) !== -1) {
|
23898 |
|
23899 | tabList = e.currentTarget.querySelectorAll('[role=tab]');
|
23900 | currentIndex = Array.prototype.indexOf.call(tabList, e.target);
|
23901 | } else {
|
23902 | return;
|
23903 | }
|
23904 | if (keyCode === 37 || keyCode === 38) {
|
23905 |
|
23906 | if (currentIndex === 0) {
|
23907 |
|
23908 | nextIndex = tabList.length - 1;
|
23909 | } else {
|
23910 | nextIndex = currentIndex - 1;
|
23911 | }
|
23912 | } else {
|
23913 |
|
23914 | if (currentIndex < tabList.length - 1) {
|
23915 |
|
23916 | nextIndex = currentIndex + 1;
|
23917 | } else {
|
23918 | nextIndex = 0;
|
23919 | }
|
23920 | }
|
23921 | tabList[nextIndex].focus();
|
23922 | tabList[nextIndex].click();
|
23923 | this.setFocus();
|
23924 | },
|
23925 | setFocus: function setFocus() {
|
23926 | if (this.focusable) {
|
23927 | this.isFocus = true;
|
23928 | }
|
23929 | },
|
23930 | removeFocus: function removeFocus() {
|
23931 | this.isFocus = false;
|
23932 | },
|
23933 | visibilityChangeHandler: function visibilityChangeHandler() {
|
23934 | var _this = this;
|
23935 |
|
23936 | var visibility = document.visibilityState;
|
23937 | if (visibility === 'hidden') {
|
23938 | this.focusable = false;
|
23939 | } else if (visibility === 'visible') {
|
23940 | setTimeout(function () {
|
23941 | _this.focusable = true;
|
23942 | }, 50);
|
23943 | }
|
23944 | },
|
23945 | windowBlurHandler: function windowBlurHandler() {
|
23946 | this.focusable = false;
|
23947 | },
|
23948 | windowFocusHandler: function windowFocusHandler() {
|
23949 | var _this2 = this;
|
23950 |
|
23951 | setTimeout(function () {
|
23952 | _this2.focusable = true;
|
23953 | }, 50);
|
23954 | }
|
23955 | },
|
23956 |
|
23957 | updated: function updated() {
|
23958 | this.update();
|
23959 | },
|
23960 | render: function render(h) {
|
23961 | var _this3 = this;
|
23962 |
|
23963 | var type = this.type,
|
23964 | panes = this.panes,
|
23965 | editable = this.editable,
|
23966 | stretch = this.stretch,
|
23967 | onTabClick = this.onTabClick,
|
23968 | onTabRemove = this.onTabRemove,
|
23969 | navStyle = this.navStyle,
|
23970 | scrollable = this.scrollable,
|
23971 | scrollNext = this.scrollNext,
|
23972 | scrollPrev = this.scrollPrev,
|
23973 | changeTab = this.changeTab,
|
23974 | setFocus = this.setFocus,
|
23975 | removeFocus = this.removeFocus;
|
23976 |
|
23977 | var scrollBtn = scrollable ? [h(
|
23978 | 'span',
|
23979 | { 'class': ['el-tabs__nav-prev', scrollable.prev ? '' : 'is-disabled'], on: {
|
23980 | 'click': scrollPrev
|
23981 | }
|
23982 | },
|
23983 | [h('i', { 'class': 'el-icon-arrow-left' })]
|
23984 | ), h(
|
23985 | 'span',
|
23986 | { 'class': ['el-tabs__nav-next', scrollable.next ? '' : 'is-disabled'], on: {
|
23987 | 'click': scrollNext
|
23988 | }
|
23989 | },
|
23990 | [h('i', { 'class': 'el-icon-arrow-right' })]
|
23991 | )] : null;
|
23992 |
|
23993 | var tabs = this._l(panes, function (pane, index) {
|
23994 | var _ref;
|
23995 |
|
23996 | var tabName = pane.name || pane.index || index;
|
23997 | var closable = pane.isClosable || editable;
|
23998 |
|
23999 | pane.index = '' + index;
|
24000 |
|
24001 | var btnClose = closable ? h('span', { 'class': 'el-icon-close', on: {
|
24002 | 'click': function click(ev) {
|
24003 | onTabRemove(pane, ev);
|
24004 | }
|
24005 | }
|
24006 | }) : null;
|
24007 |
|
24008 | var tabLabelContent = pane.$slots.label || pane.label;
|
24009 | var tabindex = pane.active ? 0 : -1;
|
24010 | return h(
|
24011 | 'div',
|
24012 | {
|
24013 | 'class': (_ref = {
|
24014 | 'el-tabs__item': true
|
24015 | }, _ref['is-' + _this3.rootTabs.tabPosition] = true, _ref['is-active'] = pane.active, _ref['is-disabled'] = pane.disabled, _ref['is-closable'] = closable, _ref['is-focus'] = _this3.isFocus, _ref),
|
24016 | attrs: { id: 'tab-' + tabName,
|
24017 |
|
24018 | 'aria-controls': 'pane-' + tabName,
|
24019 | role: 'tab',
|
24020 | 'aria-selected': pane.active,
|
24021 |
|
24022 | tabindex: tabindex
|
24023 | },
|
24024 | key: 'tab-' + tabName, ref: 'tabs', refInFor: true,
|
24025 | on: {
|
24026 | 'focus': function focus() {
|
24027 | setFocus();
|
24028 | },
|
24029 | 'blur': function blur() {
|
24030 | removeFocus();
|
24031 | },
|
24032 | 'click': function click(ev) {
|
24033 | removeFocus();onTabClick(pane, tabName, ev);
|
24034 | },
|
24035 | 'keydown': function keydown(ev) {
|
24036 | if (closable && (ev.keyCode === 46 || ev.keyCode === 8)) {
|
24037 | onTabRemove(pane, ev);
|
24038 | }
|
24039 | }
|
24040 | }
|
24041 | },
|
24042 | [tabLabelContent, btnClose]
|
24043 | );
|
24044 | });
|
24045 | return h(
|
24046 | 'div',
|
24047 | { 'class': ['el-tabs__nav-wrap', scrollable ? 'is-scrollable' : '', 'is-' + this.rootTabs.tabPosition] },
|
24048 | [scrollBtn, h(
|
24049 | 'div',
|
24050 | { 'class': ['el-tabs__nav-scroll'], ref: 'navScroll' },
|
24051 | [h(
|
24052 | 'div',
|
24053 | {
|
24054 | 'class': ['el-tabs__nav', 'is-' + this.rootTabs.tabPosition, stretch && ['top', 'bottom'].indexOf(this.rootTabs.tabPosition) !== -1 ? 'is-stretch' : ''],
|
24055 | ref: 'nav',
|
24056 | style: navStyle,
|
24057 | attrs: { role: 'tablist'
|
24058 | },
|
24059 | on: {
|
24060 | 'keydown': changeTab
|
24061 | }
|
24062 | },
|
24063 | [!type ? h('tab-bar', {
|
24064 | attrs: { tabs: panes }
|
24065 | }) : null, tabs]
|
24066 | )]
|
24067 | )]
|
24068 | );
|
24069 | },
|
24070 | mounted: function mounted() {
|
24071 | var _this4 = this;
|
24072 |
|
24073 | Object(resize_event_["addResizeListener"])(this.$el, this.update);
|
24074 | document.addEventListener('visibilitychange', this.visibilityChangeHandler);
|
24075 | window.addEventListener('blur', this.windowBlurHandler);
|
24076 | window.addEventListener('focus', this.windowFocusHandler);
|
24077 | setTimeout(function () {
|
24078 | _this4.scrollToActiveTab();
|
24079 | }, 0);
|
24080 | },
|
24081 | beforeDestroy: function beforeDestroy() {
|
24082 | if (this.$el && this.update) Object(resize_event_["removeResizeListener"])(this.$el, this.update);
|
24083 | document.removeEventListener('visibilitychange', this.visibilityChangeHandler);
|
24084 | window.removeEventListener('blur', this.windowBlurHandler);
|
24085 | window.removeEventListener('focus', this.windowFocusHandler);
|
24086 | }
|
24087 | });
|
24088 |
|
24089 | var src_tab_navvue_type_script_lang_js_ = (tab_navvue_type_script_lang_js_);
|
24090 |
|
24091 | var tab_nav_render, tab_nav_staticRenderFns
|
24092 |
|
24093 |
|
24094 |
|
24095 |
|
24096 |
|
24097 |
|
24098 | var tab_nav_component = normalizeComponent(
|
24099 | src_tab_navvue_type_script_lang_js_,
|
24100 | tab_nav_render,
|
24101 | tab_nav_staticRenderFns,
|
24102 | false,
|
24103 | null,
|
24104 | null,
|
24105 | null
|
24106 |
|
24107 | )
|
24108 |
|
24109 |
|
24110 | if (false) { var tab_nav_api; }
|
24111 | tab_nav_component.options.__file = "packages/tabs/src/tab-nav.vue"
|
24112 | var tab_nav = (tab_nav_component.exports);
|
24113 |
|
24114 |
|
24115 |
|
24116 |
|
24117 | var tabsvue_type_script_lang_js_ = ({
|
24118 | name: 'ElTabs',
|
24119 |
|
24120 | components: {
|
24121 | TabNav: tab_nav
|
24122 | },
|
24123 |
|
24124 | props: {
|
24125 | type: String,
|
24126 | activeName: String,
|
24127 | closable: Boolean,
|
24128 | addable: Boolean,
|
24129 | value: {},
|
24130 | editable: Boolean,
|
24131 | tabPosition: {
|
24132 | type: String,
|
24133 | default: 'top'
|
24134 | },
|
24135 | beforeLeave: Function,
|
24136 | stretch: Boolean
|
24137 | },
|
24138 |
|
24139 | provide: function provide() {
|
24140 | return {
|
24141 | rootTabs: this
|
24142 | };
|
24143 | },
|
24144 | data: function data() {
|
24145 | return {
|
24146 | currentName: this.value || this.activeName,
|
24147 | panes: []
|
24148 | };
|
24149 | },
|
24150 |
|
24151 |
|
24152 | watch: {
|
24153 | activeName: function activeName(value) {
|
24154 | this.setCurrentName(value);
|
24155 | },
|
24156 | value: function value(_value) {
|
24157 | this.setCurrentName(_value);
|
24158 | },
|
24159 | currentName: function currentName(value) {
|
24160 | var _this = this;
|
24161 |
|
24162 | if (this.$refs.nav) {
|
24163 | this.$nextTick(function () {
|
24164 | _this.$refs.nav.$nextTick(function (_) {
|
24165 | _this.$refs.nav.scrollToActiveTab();
|
24166 | });
|
24167 | });
|
24168 | }
|
24169 | }
|
24170 | },
|
24171 |
|
24172 | methods: {
|
24173 | calcPaneInstances: function calcPaneInstances() {
|
24174 | var _this2 = this;
|
24175 |
|
24176 | var isForceUpdate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
24177 |
|
24178 | if (this.$slots.default) {
|
24179 | var paneSlots = this.$slots.default.filter(function (vnode) {
|
24180 | return vnode.tag && vnode.componentOptions && vnode.componentOptions.Ctor.options.name === 'ElTabPane';
|
24181 | });
|
24182 |
|
24183 | var panes = paneSlots.map(function (_ref) {
|
24184 | var componentInstance = _ref.componentInstance;
|
24185 | return componentInstance;
|
24186 | });
|
24187 | var panesChanged = !(panes.length === this.panes.length && panes.every(function (pane, index) {
|
24188 | return pane === _this2.panes[index];
|
24189 | }));
|
24190 | if (isForceUpdate || panesChanged) {
|
24191 | this.panes = panes;
|
24192 | }
|
24193 | } else if (this.panes.length !== 0) {
|
24194 | this.panes = [];
|
24195 | }
|
24196 | },
|
24197 | handleTabClick: function handleTabClick(tab, tabName, event) {
|
24198 | if (tab.disabled) return;
|
24199 | this.setCurrentName(tabName);
|
24200 | this.$emit('tab-click', tab, event);
|
24201 | },
|
24202 | handleTabRemove: function handleTabRemove(pane, ev) {
|
24203 | if (pane.disabled) return;
|
24204 | ev.stopPropagation();
|
24205 | this.$emit('edit', pane.name, 'remove');
|
24206 | this.$emit('tab-remove', pane.name);
|
24207 | },
|
24208 | handleTabAdd: function handleTabAdd() {
|
24209 | this.$emit('edit', null, 'add');
|
24210 | this.$emit('tab-add');
|
24211 | },
|
24212 | setCurrentName: function setCurrentName(value) {
|
24213 | var _this3 = this;
|
24214 |
|
24215 | var changeCurrentName = function changeCurrentName() {
|
24216 | _this3.currentName = value;
|
24217 | _this3.$emit('input', value);
|
24218 | };
|
24219 | if (this.currentName !== value && this.beforeLeave) {
|
24220 | var before = this.beforeLeave(value, this.currentName);
|
24221 | if (before && before.then) {
|
24222 | before.then(function () {
|
24223 | changeCurrentName();
|
24224 | _this3.$refs.nav && _this3.$refs.nav.removeFocus();
|
24225 | }, function () {
|
24226 |
|
24227 |
|
24228 | });
|
24229 | } else if (before !== false) {
|
24230 | changeCurrentName();
|
24231 | }
|
24232 | } else {
|
24233 | changeCurrentName();
|
24234 | }
|
24235 | }
|
24236 | },
|
24237 |
|
24238 | render: function render(h) {
|
24239 | var _ref2;
|
24240 |
|
24241 | var type = this.type,
|
24242 | handleTabClick = this.handleTabClick,
|
24243 | handleTabRemove = this.handleTabRemove,
|
24244 | handleTabAdd = this.handleTabAdd,
|
24245 | currentName = this.currentName,
|
24246 | panes = this.panes,
|
24247 | editable = this.editable,
|
24248 | addable = this.addable,
|
24249 | tabPosition = this.tabPosition,
|
24250 | stretch = this.stretch;
|
24251 |
|
24252 |
|
24253 | var newButton = editable || addable ? h(
|
24254 | 'span',
|
24255 | {
|
24256 | 'class': 'el-tabs__new-tab',
|
24257 | on: {
|
24258 | 'click': handleTabAdd,
|
24259 | 'keydown': function keydown(ev) {
|
24260 | if (ev.keyCode === 13) {
|
24261 | handleTabAdd();
|
24262 | }
|
24263 | }
|
24264 | },
|
24265 | attrs: {
|
24266 | tabindex: '0'
|
24267 | }
|
24268 | },
|
24269 | [h('i', { 'class': 'el-icon-plus' })]
|
24270 | ) : null;
|
24271 |
|
24272 | var navData = {
|
24273 | props: {
|
24274 | currentName: currentName,
|
24275 | onTabClick: handleTabClick,
|
24276 | onTabRemove: handleTabRemove,
|
24277 | editable: editable,
|
24278 | type: type,
|
24279 | panes: panes,
|
24280 | stretch: stretch
|
24281 | },
|
24282 | ref: 'nav'
|
24283 | };
|
24284 | var header = h(
|
24285 | 'div',
|
24286 | { 'class': ['el-tabs__header', 'is-' + tabPosition] },
|
24287 | [newButton, h('tab-nav', navData)]
|
24288 | );
|
24289 | var panels = h(
|
24290 | 'div',
|
24291 | { 'class': 'el-tabs__content' },
|
24292 | [this.$slots.default]
|
24293 | );
|
24294 |
|
24295 | return h(
|
24296 | 'div',
|
24297 | { 'class': (_ref2 = {
|
24298 | 'el-tabs': true,
|
24299 | 'el-tabs--card': type === 'card'
|
24300 | }, _ref2['el-tabs--' + tabPosition] = true, _ref2['el-tabs--border-card'] = type === 'border-card', _ref2) },
|
24301 | [tabPosition !== 'bottom' ? [header, panels] : [panels, header]]
|
24302 | );
|
24303 | },
|
24304 | created: function created() {
|
24305 | if (!this.currentName) {
|
24306 | this.setCurrentName('0');
|
24307 | }
|
24308 |
|
24309 | this.$on('tab-nav-update', this.calcPaneInstances.bind(null, true));
|
24310 | },
|
24311 | mounted: function mounted() {
|
24312 | this.calcPaneInstances();
|
24313 | },
|
24314 | updated: function updated() {
|
24315 | this.calcPaneInstances();
|
24316 | }
|
24317 | });
|
24318 |
|
24319 | var src_tabsvue_type_script_lang_js_ = (tabsvue_type_script_lang_js_);
|
24320 |
|
24321 | var tabs_render, tabs_staticRenderFns
|
24322 |
|
24323 |
|
24324 |
|
24325 |
|
24326 |
|
24327 |
|
24328 | var tabs_component = normalizeComponent(
|
24329 | src_tabsvue_type_script_lang_js_,
|
24330 | tabs_render,
|
24331 | tabs_staticRenderFns,
|
24332 | false,
|
24333 | null,
|
24334 | null,
|
24335 | null
|
24336 |
|
24337 | )
|
24338 |
|
24339 |
|
24340 | if (false) { var tabs_api; }
|
24341 | tabs_component.options.__file = "packages/tabs/src/tabs.vue"
|
24342 | var tabs = (tabs_component.exports);
|
24343 |
|
24344 |
|
24345 |
|
24346 |
|
24347 | tabs.install = function (Vue) {
|
24348 | Vue.component(tabs.name, tabs);
|
24349 | };
|
24350 |
|
24351 | var packages_tabs = (tabs);
|
24352 |
|
24353 | var tab_panevue_type_template_id_9145a070_render = function() {
|
24354 | var _vm = this
|
24355 | var _h = _vm.$createElement
|
24356 | var _c = _vm._self._c || _h
|
24357 | return !_vm.lazy || _vm.loaded || _vm.active
|
24358 | ? _c(
|
24359 | "div",
|
24360 | {
|
24361 | directives: [
|
24362 | {
|
24363 | name: "show",
|
24364 | rawName: "v-show",
|
24365 | value: _vm.active,
|
24366 | expression: "active"
|
24367 | }
|
24368 | ],
|
24369 | staticClass: "el-tab-pane",
|
24370 | attrs: {
|
24371 | role: "tabpanel",
|
24372 | "aria-hidden": !_vm.active,
|
24373 | id: "pane-" + _vm.paneName,
|
24374 | "aria-labelledby": "tab-" + _vm.paneName
|
24375 | }
|
24376 | },
|
24377 | [_vm._t("default")],
|
24378 | 2
|
24379 | )
|
24380 | : _vm._e()
|
24381 | }
|
24382 | var tab_panevue_type_template_id_9145a070_staticRenderFns = []
|
24383 | tab_panevue_type_template_id_9145a070_render._withStripped = true
|
24384 |
|
24385 |
|
24386 |
|
24387 |
|
24388 |
|
24389 |
|
24390 |
|
24391 |
|
24392 |
|
24393 |
|
24394 |
|
24395 |
|
24396 |
|
24397 |
|
24398 |
|
24399 |
|
24400 |
|
24401 |
|
24402 |
|
24403 | var tab_panevue_type_script_lang_js_ = ({
|
24404 | name: 'ElTabPane',
|
24405 |
|
24406 | componentName: 'ElTabPane',
|
24407 |
|
24408 | props: {
|
24409 | label: String,
|
24410 | labelContent: Function,
|
24411 | name: String,
|
24412 | closable: Boolean,
|
24413 | disabled: Boolean,
|
24414 | lazy: Boolean
|
24415 | },
|
24416 |
|
24417 | data: function data() {
|
24418 | return {
|
24419 | index: null,
|
24420 | loaded: false
|
24421 | };
|
24422 | },
|
24423 |
|
24424 |
|
24425 | computed: {
|
24426 | isClosable: function isClosable() {
|
24427 | return this.closable || this.$parent.closable;
|
24428 | },
|
24429 | active: function active() {
|
24430 | var active = this.$parent.currentName === (this.name || this.index);
|
24431 | if (active) {
|
24432 | this.loaded = true;
|
24433 | }
|
24434 | return active;
|
24435 | },
|
24436 | paneName: function paneName() {
|
24437 | return this.name || this.index;
|
24438 | }
|
24439 | },
|
24440 |
|
24441 | updated: function updated() {
|
24442 | this.$parent.$emit('tab-nav-update');
|
24443 | }
|
24444 | });
|
24445 |
|
24446 | var src_tab_panevue_type_script_lang_js_ = (tab_panevue_type_script_lang_js_);
|
24447 |
|
24448 |
|
24449 |
|
24450 |
|
24451 |
|
24452 |
|
24453 |
|
24454 |
|
24455 | var tab_pane_component = normalizeComponent(
|
24456 | src_tab_panevue_type_script_lang_js_,
|
24457 | tab_panevue_type_template_id_9145a070_render,
|
24458 | tab_panevue_type_template_id_9145a070_staticRenderFns,
|
24459 | false,
|
24460 | null,
|
24461 | null,
|
24462 | null
|
24463 |
|
24464 | )
|
24465 |
|
24466 |
|
24467 | if (false) { var tab_pane_api; }
|
24468 | tab_pane_component.options.__file = "packages/tabs/src/tab-pane.vue"
|
24469 | var tab_pane = (tab_pane_component.exports);
|
24470 |
|
24471 |
|
24472 |
|
24473 |
|
24474 | tab_pane.install = function (Vue) {
|
24475 | Vue.component(tab_pane.name, tab_pane);
|
24476 | };
|
24477 |
|
24478 | var packages_tab_pane = (tab_pane);
|
24479 |
|
24480 |
|
24481 | var tagvue_type_script_lang_js_ = ({
|
24482 | name: 'ElTag',
|
24483 | props: {
|
24484 | text: String,
|
24485 | closable: Boolean,
|
24486 | type: String,
|
24487 | hit: Boolean,
|
24488 | disableTransitions: Boolean,
|
24489 | color: String,
|
24490 | size: String,
|
24491 | effect: {
|
24492 | type: String,
|
24493 | default: 'light',
|
24494 | validator: function validator(val) {
|
24495 | return ['dark', 'light', 'plain'].indexOf(val) !== -1;
|
24496 | }
|
24497 | }
|
24498 | },
|
24499 | methods: {
|
24500 | handleClose: function handleClose(event) {
|
24501 | event.stopPropagation();
|
24502 | this.$emit('close', event);
|
24503 | },
|
24504 | handleClick: function handleClick(event) {
|
24505 | this.$emit('click', event);
|
24506 | }
|
24507 | },
|
24508 | computed: {
|
24509 | tagSize: function tagSize() {
|
24510 | return this.size || (this.$ELEMENT || {}).size;
|
24511 | }
|
24512 | },
|
24513 | render: function render(h) {
|
24514 | var type = this.type,
|
24515 | tagSize = this.tagSize,
|
24516 | hit = this.hit,
|
24517 | effect = this.effect;
|
24518 |
|
24519 | var classes = ['el-tag', type ? 'el-tag--' + type : '', tagSize ? 'el-tag--' + tagSize : '', effect ? 'el-tag--' + effect : '', hit && 'is-hit'];
|
24520 | var tagEl = h(
|
24521 | 'span',
|
24522 | {
|
24523 | 'class': classes,
|
24524 | style: { backgroundColor: this.color },
|
24525 | on: {
|
24526 | 'click': this.handleClick
|
24527 | }
|
24528 | },
|
24529 | [this.$slots.default, this.closable && h('i', { 'class': 'el-tag__close el-icon-close', on: {
|
24530 | 'click': this.handleClose
|
24531 | }
|
24532 | })]
|
24533 | );
|
24534 |
|
24535 | return this.disableTransitions ? tagEl : h(
|
24536 | 'transition',
|
24537 | {
|
24538 | attrs: { name: 'el-zoom-in-center' }
|
24539 | },
|
24540 | [tagEl]
|
24541 | );
|
24542 | }
|
24543 | });
|
24544 |
|
24545 | var src_tagvue_type_script_lang_js_ = (tagvue_type_script_lang_js_);
|
24546 |
|
24547 | var tag_render, tag_staticRenderFns
|
24548 |
|
24549 |
|
24550 |
|
24551 |
|
24552 |
|
24553 |
|
24554 | var tag_component = normalizeComponent(
|
24555 | src_tagvue_type_script_lang_js_,
|
24556 | tag_render,
|
24557 | tag_staticRenderFns,
|
24558 | false,
|
24559 | null,
|
24560 | null,
|
24561 | null
|
24562 |
|
24563 | )
|
24564 |
|
24565 |
|
24566 | if (false) { var tag_api; }
|
24567 | tag_component.options.__file = "packages/tag/src/tag.vue"
|
24568 | var tag = (tag_component.exports);
|
24569 |
|
24570 |
|
24571 |
|
24572 |
|
24573 | tag.install = function (Vue) {
|
24574 | Vue.component(tag.name, tag);
|
24575 | };
|
24576 |
|
24577 | var packages_tag = (tag);
|
24578 |
|
24579 | var treevue_type_template_id_547575a6_render = function() {
|
24580 | var _vm = this
|
24581 | var _h = _vm.$createElement
|
24582 | var _c = _vm._self._c || _h
|
24583 | return _c(
|
24584 | "div",
|
24585 | {
|
24586 | staticClass: "el-tree",
|
24587 | class: {
|
24588 | "el-tree--highlight-current": _vm.highlightCurrent,
|
24589 | "is-dragging": !!_vm.dragState.draggingNode,
|
24590 | "is-drop-not-allow": !_vm.dragState.allowDrop,
|
24591 | "is-drop-inner": _vm.dragState.dropType === "inner"
|
24592 | },
|
24593 | attrs: { role: "tree" }
|
24594 | },
|
24595 | [
|
24596 | _vm._l(_vm.root.childNodes, function(child) {
|
24597 | return _c("el-tree-node", {
|
24598 | key: _vm.getNodeKey(child),
|
24599 | attrs: {
|
24600 | node: child,
|
24601 | props: _vm.props,
|
24602 | "render-after-expand": _vm.renderAfterExpand,
|
24603 | "show-checkbox": _vm.showCheckbox,
|
24604 | "render-content": _vm.renderContent
|
24605 | },
|
24606 | on: { "node-expand": _vm.handleNodeExpand }
|
24607 | })
|
24608 | }),
|
24609 | _vm.isEmpty
|
24610 | ? _c("div", { staticClass: "el-tree__empty-block" }, [
|
24611 | _c("span", { staticClass: "el-tree__empty-text" }, [
|
24612 | _vm._v(_vm._s(_vm.emptyText))
|
24613 | ])
|
24614 | ])
|
24615 | : _vm._e(),
|
24616 | _c("div", {
|
24617 | directives: [
|
24618 | {
|
24619 | name: "show",
|
24620 | rawName: "v-show",
|
24621 | value: _vm.dragState.showDropIndicator,
|
24622 | expression: "dragState.showDropIndicator"
|
24623 | }
|
24624 | ],
|
24625 | ref: "dropIndicator",
|
24626 | staticClass: "el-tree__drop-indicator"
|
24627 | })
|
24628 | ],
|
24629 | 2
|
24630 | )
|
24631 | }
|
24632 | var treevue_type_template_id_547575a6_staticRenderFns = []
|
24633 | treevue_type_template_id_547575a6_render._withStripped = true
|
24634 |
|
24635 |
|
24636 |
|
24637 |
|
24638 |
|
24639 | var NODE_KEY = '$treeNodeId';
|
24640 |
|
24641 | var markNodeData = function markNodeData(node, data) {
|
24642 | if (!data || data[NODE_KEY]) return;
|
24643 | Object.defineProperty(data, NODE_KEY, {
|
24644 | value: node.id,
|
24645 | enumerable: false,
|
24646 | configurable: false,
|
24647 | writable: false
|
24648 | });
|
24649 | };
|
24650 |
|
24651 | var util_getNodeKey = function getNodeKey(key, data) {
|
24652 | if (!key) return data[NODE_KEY];
|
24653 | return data[key];
|
24654 | };
|
24655 |
|
24656 | var findNearestComponent = function findNearestComponent(element, componentName) {
|
24657 | var target = element;
|
24658 | while (target && target.tagName !== 'BODY') {
|
24659 | if (target.__vue__ && target.__vue__.$options.name === componentName) {
|
24660 | return target.__vue__;
|
24661 | }
|
24662 | target = target.parentNode;
|
24663 | }
|
24664 | return null;
|
24665 | };
|
24666 |
|
24667 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
24668 |
|
24669 | function node_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
24670 |
|
24671 |
|
24672 |
|
24673 |
|
24674 |
|
24675 | var getChildState = function getChildState(node) {
|
24676 | var all = true;
|
24677 | var none = true;
|
24678 | var allWithoutDisable = true;
|
24679 | for (var i = 0, j = node.length; i < j; i++) {
|
24680 | var n = node[i];
|
24681 | if (n.checked !== true || n.indeterminate) {
|
24682 | all = false;
|
24683 | if (!n.disabled) {
|
24684 | allWithoutDisable = false;
|
24685 | }
|
24686 | }
|
24687 | if (n.checked !== false || n.indeterminate) {
|
24688 | none = false;
|
24689 | }
|
24690 | }
|
24691 |
|
24692 | return { all: all, none: none, allWithoutDisable: allWithoutDisable, half: !all && !none };
|
24693 | };
|
24694 |
|
24695 | var reInitChecked = function reInitChecked(node) {
|
24696 | if (node.childNodes.length === 0) return;
|
24697 |
|
24698 | var _getChildState = getChildState(node.childNodes),
|
24699 | all = _getChildState.all,
|
24700 | none = _getChildState.none,
|
24701 | half = _getChildState.half;
|
24702 |
|
24703 | if (all) {
|
24704 | node.checked = true;
|
24705 | node.indeterminate = false;
|
24706 | } else if (half) {
|
24707 | node.checked = false;
|
24708 | node.indeterminate = true;
|
24709 | } else if (none) {
|
24710 | node.checked = false;
|
24711 | node.indeterminate = false;
|
24712 | }
|
24713 |
|
24714 | var parent = node.parent;
|
24715 | if (!parent || parent.level === 0) return;
|
24716 |
|
24717 | if (!node.store.checkStrictly) {
|
24718 | reInitChecked(parent);
|
24719 | }
|
24720 | };
|
24721 |
|
24722 | var getPropertyFromData = function getPropertyFromData(node, prop) {
|
24723 | var props = node.store.props;
|
24724 | var data = node.data || {};
|
24725 | var config = props[prop];
|
24726 |
|
24727 | if (typeof config === 'function') {
|
24728 | return config(data, node);
|
24729 | } else if (typeof config === 'string') {
|
24730 | return data[config];
|
24731 | } else if (typeof config === 'undefined') {
|
24732 | var dataProp = data[prop];
|
24733 | return dataProp === undefined ? '' : dataProp;
|
24734 | }
|
24735 | };
|
24736 |
|
24737 | var nodeIdSeed = 0;
|
24738 |
|
24739 | var node_Node = function () {
|
24740 | function Node(options) {
|
24741 | node_classCallCheck(this, Node);
|
24742 |
|
24743 | this.id = nodeIdSeed++;
|
24744 | this.text = null;
|
24745 | this.checked = false;
|
24746 | this.indeterminate = false;
|
24747 | this.data = null;
|
24748 | this.expanded = false;
|
24749 | this.parent = null;
|
24750 | this.visible = true;
|
24751 | this.isCurrent = false;
|
24752 |
|
24753 | for (var name in options) {
|
24754 | if (options.hasOwnProperty(name)) {
|
24755 | this[name] = options[name];
|
24756 | }
|
24757 | }
|
24758 |
|
24759 |
|
24760 | this.level = 0;
|
24761 | this.loaded = false;
|
24762 | this.childNodes = [];
|
24763 | this.loading = false;
|
24764 |
|
24765 | if (this.parent) {
|
24766 | this.level = this.parent.level + 1;
|
24767 | }
|
24768 |
|
24769 | var store = this.store;
|
24770 | if (!store) {
|
24771 | throw new Error('[Node]store is required!');
|
24772 | }
|
24773 | store.registerNode(this);
|
24774 |
|
24775 | var props = store.props;
|
24776 | if (props && typeof props.isLeaf !== 'undefined') {
|
24777 | var isLeaf = getPropertyFromData(this, 'isLeaf');
|
24778 | if (typeof isLeaf === 'boolean') {
|
24779 | this.isLeafByUser = isLeaf;
|
24780 | }
|
24781 | }
|
24782 |
|
24783 | if (store.lazy !== true && this.data) {
|
24784 | this.setData(this.data);
|
24785 |
|
24786 | if (store.defaultExpandAll) {
|
24787 | this.expanded = true;
|
24788 | }
|
24789 | } else if (this.level > 0 && store.lazy && store.defaultExpandAll) {
|
24790 | this.expand();
|
24791 | }
|
24792 | if (!Array.isArray(this.data)) {
|
24793 | markNodeData(this, this.data);
|
24794 | }
|
24795 | if (!this.data) return;
|
24796 | var defaultExpandedKeys = store.defaultExpandedKeys;
|
24797 | var key = store.key;
|
24798 | if (key && defaultExpandedKeys && defaultExpandedKeys.indexOf(this.key) !== -1) {
|
24799 | this.expand(null, store.autoExpandParent);
|
24800 | }
|
24801 |
|
24802 | if (key && store.currentNodeKey !== undefined && this.key === store.currentNodeKey) {
|
24803 | store.currentNode = this;
|
24804 | store.currentNode.isCurrent = true;
|
24805 | }
|
24806 |
|
24807 | if (store.lazy) {
|
24808 | store._initDefaultCheckedNode(this);
|
24809 | }
|
24810 |
|
24811 | this.updateLeafState();
|
24812 | }
|
24813 |
|
24814 | Node.prototype.setData = function setData(data) {
|
24815 | if (!Array.isArray(data)) {
|
24816 | markNodeData(this, data);
|
24817 | }
|
24818 |
|
24819 | this.data = data;
|
24820 | this.childNodes = [];
|
24821 |
|
24822 | var children = void 0;
|
24823 | if (this.level === 0 && this.data instanceof Array) {
|
24824 | children = this.data;
|
24825 | } else {
|
24826 | children = getPropertyFromData(this, 'children') || [];
|
24827 | }
|
24828 |
|
24829 | for (var i = 0, j = children.length; i < j; i++) {
|
24830 | this.insertChild({ data: children[i] });
|
24831 | }
|
24832 | };
|
24833 |
|
24834 | Node.prototype.contains = function contains(target) {
|
24835 | var deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
24836 |
|
24837 | var walk = function walk(parent) {
|
24838 | var children = parent.childNodes || [];
|
24839 | var result = false;
|
24840 | for (var i = 0, j = children.length; i < j; i++) {
|
24841 | var child = children[i];
|
24842 | if (child === target || deep && walk(child)) {
|
24843 | result = true;
|
24844 | break;
|
24845 | }
|
24846 | }
|
24847 | return result;
|
24848 | };
|
24849 |
|
24850 | return walk(this);
|
24851 | };
|
24852 |
|
24853 | Node.prototype.remove = function remove() {
|
24854 | var parent = this.parent;
|
24855 | if (parent) {
|
24856 | parent.removeChild(this);
|
24857 | }
|
24858 | };
|
24859 |
|
24860 | Node.prototype.insertChild = function insertChild(child, index, batch) {
|
24861 | if (!child) throw new Error('insertChild error: child is required.');
|
24862 |
|
24863 | if (!(child instanceof Node)) {
|
24864 | if (!batch) {
|
24865 | var children = this.getChildren(true);
|
24866 | if (children.indexOf(child.data) === -1) {
|
24867 | if (typeof index === 'undefined' || index < 0) {
|
24868 | children.push(child.data);
|
24869 | } else {
|
24870 | children.splice(index, 0, child.data);
|
24871 | }
|
24872 | }
|
24873 | }
|
24874 | merge_default()(child, {
|
24875 | parent: this,
|
24876 | store: this.store
|
24877 | });
|
24878 | child = new Node(child);
|
24879 | }
|
24880 |
|
24881 | child.level = this.level + 1;
|
24882 |
|
24883 | if (typeof index === 'undefined' || index < 0) {
|
24884 | this.childNodes.push(child);
|
24885 | } else {
|
24886 | this.childNodes.splice(index, 0, child);
|
24887 | }
|
24888 |
|
24889 | this.updateLeafState();
|
24890 | };
|
24891 |
|
24892 | Node.prototype.insertBefore = function insertBefore(child, ref) {
|
24893 | var index = void 0;
|
24894 | if (ref) {
|
24895 | index = this.childNodes.indexOf(ref);
|
24896 | }
|
24897 | this.insertChild(child, index);
|
24898 | };
|
24899 |
|
24900 | Node.prototype.insertAfter = function insertAfter(child, ref) {
|
24901 | var index = void 0;
|
24902 | if (ref) {
|
24903 | index = this.childNodes.indexOf(ref);
|
24904 | if (index !== -1) index += 1;
|
24905 | }
|
24906 | this.insertChild(child, index);
|
24907 | };
|
24908 |
|
24909 | Node.prototype.removeChild = function removeChild(child) {
|
24910 | var children = this.getChildren() || [];
|
24911 | var dataIndex = children.indexOf(child.data);
|
24912 | if (dataIndex > -1) {
|
24913 | children.splice(dataIndex, 1);
|
24914 | }
|
24915 |
|
24916 | var index = this.childNodes.indexOf(child);
|
24917 |
|
24918 | if (index > -1) {
|
24919 | this.store && this.store.deregisterNode(child);
|
24920 | child.parent = null;
|
24921 | this.childNodes.splice(index, 1);
|
24922 | }
|
24923 |
|
24924 | this.updateLeafState();
|
24925 | };
|
24926 |
|
24927 | Node.prototype.removeChildByData = function removeChildByData(data) {
|
24928 | var targetNode = null;
|
24929 |
|
24930 | for (var i = 0; i < this.childNodes.length; i++) {
|
24931 | if (this.childNodes[i].data === data) {
|
24932 | targetNode = this.childNodes[i];
|
24933 | break;
|
24934 | }
|
24935 | }
|
24936 |
|
24937 | if (targetNode) {
|
24938 | this.removeChild(targetNode);
|
24939 | }
|
24940 | };
|
24941 |
|
24942 | Node.prototype.expand = function expand(callback, expandParent) {
|
24943 | var _this = this;
|
24944 |
|
24945 | var done = function done() {
|
24946 | if (expandParent) {
|
24947 | var parent = _this.parent;
|
24948 | while (parent.level > 0) {
|
24949 | parent.expanded = true;
|
24950 | parent = parent.parent;
|
24951 | }
|
24952 | }
|
24953 | _this.expanded = true;
|
24954 | if (callback) callback();
|
24955 | };
|
24956 |
|
24957 | if (this.shouldLoadData()) {
|
24958 | this.loadData(function (data) {
|
24959 | if (data instanceof Array) {
|
24960 | if (_this.checked) {
|
24961 | _this.setChecked(true, true);
|
24962 | } else if (!_this.store.checkStrictly) {
|
24963 | reInitChecked(_this);
|
24964 | }
|
24965 | done();
|
24966 | }
|
24967 | });
|
24968 | } else {
|
24969 | done();
|
24970 | }
|
24971 | };
|
24972 |
|
24973 | Node.prototype.doCreateChildren = function doCreateChildren(array) {
|
24974 | var _this2 = this;
|
24975 |
|
24976 | var defaultProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
24977 |
|
24978 | array.forEach(function (item) {
|
24979 | _this2.insertChild(merge_default()({ data: item }, defaultProps), undefined, true);
|
24980 | });
|
24981 | };
|
24982 |
|
24983 | Node.prototype.collapse = function collapse() {
|
24984 | this.expanded = false;
|
24985 | };
|
24986 |
|
24987 | Node.prototype.shouldLoadData = function shouldLoadData() {
|
24988 | return this.store.lazy === true && this.store.load && !this.loaded;
|
24989 | };
|
24990 |
|
24991 | Node.prototype.updateLeafState = function updateLeafState() {
|
24992 | if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== 'undefined') {
|
24993 | this.isLeaf = this.isLeafByUser;
|
24994 | return;
|
24995 | }
|
24996 | var childNodes = this.childNodes;
|
24997 | if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
|
24998 | this.isLeaf = !childNodes || childNodes.length === 0;
|
24999 | return;
|
25000 | }
|
25001 | this.isLeaf = false;
|
25002 | };
|
25003 |
|
25004 | Node.prototype.setChecked = function setChecked(value, deep, recursion, passValue) {
|
25005 | var _this3 = this;
|
25006 |
|
25007 | this.indeterminate = value === 'half';
|
25008 | this.checked = value === true;
|
25009 |
|
25010 | if (this.store.checkStrictly) return;
|
25011 |
|
25012 | if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
|
25013 | var _getChildState2 = getChildState(this.childNodes),
|
25014 | all = _getChildState2.all,
|
25015 | allWithoutDisable = _getChildState2.allWithoutDisable;
|
25016 |
|
25017 | if (!this.isLeaf && !all && allWithoutDisable) {
|
25018 | this.checked = false;
|
25019 | value = false;
|
25020 | }
|
25021 |
|
25022 | var handleDescendants = function handleDescendants() {
|
25023 | if (deep) {
|
25024 | var childNodes = _this3.childNodes;
|
25025 | for (var i = 0, j = childNodes.length; i < j; i++) {
|
25026 | var child = childNodes[i];
|
25027 | passValue = passValue || value !== false;
|
25028 | var isCheck = child.disabled ? child.checked : passValue;
|
25029 | child.setChecked(isCheck, deep, true, passValue);
|
25030 | }
|
25031 |
|
25032 | var _getChildState3 = getChildState(childNodes),
|
25033 | half = _getChildState3.half,
|
25034 | _all = _getChildState3.all;
|
25035 |
|
25036 | if (!_all) {
|
25037 | _this3.checked = _all;
|
25038 | _this3.indeterminate = half;
|
25039 | }
|
25040 | }
|
25041 | };
|
25042 |
|
25043 | if (this.shouldLoadData()) {
|
25044 |
|
25045 | this.loadData(function () {
|
25046 | handleDescendants();
|
25047 | reInitChecked(_this3);
|
25048 | }, {
|
25049 | checked: value !== false
|
25050 | });
|
25051 | return;
|
25052 | } else {
|
25053 | handleDescendants();
|
25054 | }
|
25055 | }
|
25056 |
|
25057 | var parent = this.parent;
|
25058 | if (!parent || parent.level === 0) return;
|
25059 |
|
25060 | if (!recursion) {
|
25061 | reInitChecked(parent);
|
25062 | }
|
25063 | };
|
25064 |
|
25065 | Node.prototype.getChildren = function getChildren() {
|
25066 | var forceInit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
25067 |
|
25068 | if (this.level === 0) return this.data;
|
25069 | var data = this.data;
|
25070 | if (!data) return null;
|
25071 |
|
25072 | var props = this.store.props;
|
25073 | var children = 'children';
|
25074 | if (props) {
|
25075 | children = props.children || 'children';
|
25076 | }
|
25077 |
|
25078 | if (data[children] === undefined) {
|
25079 | data[children] = null;
|
25080 | }
|
25081 |
|
25082 | if (forceInit && !data[children]) {
|
25083 | data[children] = [];
|
25084 | }
|
25085 |
|
25086 | return data[children];
|
25087 | };
|
25088 |
|
25089 | Node.prototype.updateChildren = function updateChildren() {
|
25090 | var _this4 = this;
|
25091 |
|
25092 | var newData = this.getChildren() || [];
|
25093 | var oldData = this.childNodes.map(function (node) {
|
25094 | return node.data;
|
25095 | });
|
25096 |
|
25097 | var newDataMap = {};
|
25098 | var newNodes = [];
|
25099 |
|
25100 | newData.forEach(function (item, index) {
|
25101 | var key = item[NODE_KEY];
|
25102 | var isNodeExists = !!key && Object(util_["arrayFindIndex"])(oldData, function (data) {
|
25103 | return data[NODE_KEY] === key;
|
25104 | }) >= 0;
|
25105 | if (isNodeExists) {
|
25106 | newDataMap[key] = { index: index, data: item };
|
25107 | } else {
|
25108 | newNodes.push({ index: index, data: item });
|
25109 | }
|
25110 | });
|
25111 |
|
25112 | if (!this.store.lazy) {
|
25113 | oldData.forEach(function (item) {
|
25114 | if (!newDataMap[item[NODE_KEY]]) _this4.removeChildByData(item);
|
25115 | });
|
25116 | }
|
25117 |
|
25118 | newNodes.forEach(function (_ref) {
|
25119 | var index = _ref.index,
|
25120 | data = _ref.data;
|
25121 |
|
25122 | _this4.insertChild({ data: data }, index);
|
25123 | });
|
25124 |
|
25125 | this.updateLeafState();
|
25126 | };
|
25127 |
|
25128 | Node.prototype.loadData = function loadData(callback) {
|
25129 | var _this5 = this;
|
25130 |
|
25131 | var defaultProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
25132 |
|
25133 | if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
|
25134 | this.loading = true;
|
25135 |
|
25136 | var resolve = function resolve(children) {
|
25137 | _this5.loaded = true;
|
25138 | _this5.loading = false;
|
25139 | _this5.childNodes = [];
|
25140 |
|
25141 | _this5.doCreateChildren(children, defaultProps);
|
25142 |
|
25143 | _this5.updateLeafState();
|
25144 | if (callback) {
|
25145 | callback.call(_this5, children);
|
25146 | }
|
25147 | };
|
25148 |
|
25149 | this.store.load(this, resolve);
|
25150 | } else {
|
25151 | if (callback) {
|
25152 | callback.call(this);
|
25153 | }
|
25154 | }
|
25155 | };
|
25156 |
|
25157 | _createClass(Node, [{
|
25158 | key: 'label',
|
25159 | get: function get() {
|
25160 | return getPropertyFromData(this, 'label');
|
25161 | }
|
25162 | }, {
|
25163 | key: 'key',
|
25164 | get: function get() {
|
25165 | var nodeKey = this.store.key;
|
25166 | if (this.data) return this.data[nodeKey];
|
25167 | return null;
|
25168 | }
|
25169 | }, {
|
25170 | key: 'disabled',
|
25171 | get: function get() {
|
25172 | return getPropertyFromData(this, 'disabled');
|
25173 | }
|
25174 | }, {
|
25175 | key: 'nextSibling',
|
25176 | get: function get() {
|
25177 | var parent = this.parent;
|
25178 | if (parent) {
|
25179 | var index = parent.childNodes.indexOf(this);
|
25180 | if (index > -1) {
|
25181 | return parent.childNodes[index + 1];
|
25182 | }
|
25183 | }
|
25184 | return null;
|
25185 | }
|
25186 | }, {
|
25187 | key: 'previousSibling',
|
25188 | get: function get() {
|
25189 | var parent = this.parent;
|
25190 | if (parent) {
|
25191 | var index = parent.childNodes.indexOf(this);
|
25192 | if (index > -1) {
|
25193 | return index > 0 ? parent.childNodes[index - 1] : null;
|
25194 | }
|
25195 | }
|
25196 | return null;
|
25197 | }
|
25198 | }]);
|
25199 |
|
25200 | return Node;
|
25201 | }();
|
25202 |
|
25203 | var model_node = (node_Node);
|
25204 |
|
25205 | var tree_store_typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
25206 |
|
25207 | function tree_store_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
25208 |
|
25209 |
|
25210 |
|
25211 |
|
25212 | var tree_store_TreeStore = function () {
|
25213 | function TreeStore(options) {
|
25214 | var _this = this;
|
25215 |
|
25216 | tree_store_classCallCheck(this, TreeStore);
|
25217 |
|
25218 | this.currentNode = null;
|
25219 | this.currentNodeKey = null;
|
25220 |
|
25221 | for (var option in options) {
|
25222 | if (options.hasOwnProperty(option)) {
|
25223 | this[option] = options[option];
|
25224 | }
|
25225 | }
|
25226 |
|
25227 | this.nodesMap = {};
|
25228 |
|
25229 | this.root = new model_node({
|
25230 | data: this.data,
|
25231 | store: this
|
25232 | });
|
25233 |
|
25234 | if (this.lazy && this.load) {
|
25235 | var loadFn = this.load;
|
25236 | loadFn(this.root, function (data) {
|
25237 | _this.root.doCreateChildren(data);
|
25238 | _this._initDefaultCheckedNodes();
|
25239 | });
|
25240 | } else {
|
25241 | this._initDefaultCheckedNodes();
|
25242 | }
|
25243 | }
|
25244 |
|
25245 | TreeStore.prototype.filter = function filter(value) {
|
25246 | var filterNodeMethod = this.filterNodeMethod;
|
25247 | var lazy = this.lazy;
|
25248 | var traverse = function traverse(node) {
|
25249 | var childNodes = node.root ? node.root.childNodes : node.childNodes;
|
25250 |
|
25251 | childNodes.forEach(function (child) {
|
25252 | child.visible = filterNodeMethod.call(child, value, child.data, child);
|
25253 |
|
25254 | traverse(child);
|
25255 | });
|
25256 |
|
25257 | if (!node.visible && childNodes.length) {
|
25258 | var allHidden = true;
|
25259 | allHidden = !childNodes.some(function (child) {
|
25260 | return child.visible;
|
25261 | });
|
25262 |
|
25263 | if (node.root) {
|
25264 | node.root.visible = allHidden === false;
|
25265 | } else {
|
25266 | node.visible = allHidden === false;
|
25267 | }
|
25268 | }
|
25269 | if (!value) return;
|
25270 |
|
25271 | if (node.visible && !node.isLeaf && !lazy) node.expand();
|
25272 | };
|
25273 |
|
25274 | traverse(this);
|
25275 | };
|
25276 |
|
25277 | TreeStore.prototype.setData = function setData(newVal) {
|
25278 | var instanceChanged = newVal !== this.root.data;
|
25279 | if (instanceChanged) {
|
25280 | this.root.setData(newVal);
|
25281 | this._initDefaultCheckedNodes();
|
25282 | } else {
|
25283 | this.root.updateChildren();
|
25284 | }
|
25285 | };
|
25286 |
|
25287 | TreeStore.prototype.getNode = function getNode(data) {
|
25288 | if (data instanceof model_node) return data;
|
25289 | var key = (typeof data === 'undefined' ? 'undefined' : tree_store_typeof(data)) !== 'object' ? data : util_getNodeKey(this.key, data);
|
25290 | return this.nodesMap[key] || null;
|
25291 | };
|
25292 |
|
25293 | TreeStore.prototype.insertBefore = function insertBefore(data, refData) {
|
25294 | var refNode = this.getNode(refData);
|
25295 | refNode.parent.insertBefore({ data: data }, refNode);
|
25296 | };
|
25297 |
|
25298 | TreeStore.prototype.insertAfter = function insertAfter(data, refData) {
|
25299 | var refNode = this.getNode(refData);
|
25300 | refNode.parent.insertAfter({ data: data }, refNode);
|
25301 | };
|
25302 |
|
25303 | TreeStore.prototype.remove = function remove(data) {
|
25304 | var node = this.getNode(data);
|
25305 |
|
25306 | if (node && node.parent) {
|
25307 | if (node === this.currentNode) {
|
25308 | this.currentNode = null;
|
25309 | }
|
25310 | node.parent.removeChild(node);
|
25311 | }
|
25312 | };
|
25313 |
|
25314 | TreeStore.prototype.append = function append(data, parentData) {
|
25315 | var parentNode = parentData ? this.getNode(parentData) : this.root;
|
25316 |
|
25317 | if (parentNode) {
|
25318 | parentNode.insertChild({ data: data });
|
25319 | }
|
25320 | };
|
25321 |
|
25322 | TreeStore.prototype._initDefaultCheckedNodes = function _initDefaultCheckedNodes() {
|
25323 | var _this2 = this;
|
25324 |
|
25325 | var defaultCheckedKeys = this.defaultCheckedKeys || [];
|
25326 | var nodesMap = this.nodesMap;
|
25327 |
|
25328 | defaultCheckedKeys.forEach(function (checkedKey) {
|
25329 | var node = nodesMap[checkedKey];
|
25330 |
|
25331 | if (node) {
|
25332 | node.setChecked(true, !_this2.checkStrictly);
|
25333 | }
|
25334 | });
|
25335 | };
|
25336 |
|
25337 | TreeStore.prototype._initDefaultCheckedNode = function _initDefaultCheckedNode(node) {
|
25338 | var defaultCheckedKeys = this.defaultCheckedKeys || [];
|
25339 |
|
25340 | if (defaultCheckedKeys.indexOf(node.key) !== -1) {
|
25341 | node.setChecked(true, !this.checkStrictly);
|
25342 | }
|
25343 | };
|
25344 |
|
25345 | TreeStore.prototype.setDefaultCheckedKey = function setDefaultCheckedKey(newVal) {
|
25346 | if (newVal !== this.defaultCheckedKeys) {
|
25347 | this.defaultCheckedKeys = newVal;
|
25348 | this._initDefaultCheckedNodes();
|
25349 | }
|
25350 | };
|
25351 |
|
25352 | TreeStore.prototype.registerNode = function registerNode(node) {
|
25353 | var key = this.key;
|
25354 | if (!key || !node || !node.data) return;
|
25355 |
|
25356 | var nodeKey = node.key;
|
25357 | if (nodeKey !== undefined) this.nodesMap[node.key] = node;
|
25358 | };
|
25359 |
|
25360 | TreeStore.prototype.deregisterNode = function deregisterNode(node) {
|
25361 | var _this3 = this;
|
25362 |
|
25363 | var key = this.key;
|
25364 | if (!key || !node || !node.data) return;
|
25365 |
|
25366 | node.childNodes.forEach(function (child) {
|
25367 | _this3.deregisterNode(child);
|
25368 | });
|
25369 |
|
25370 | delete this.nodesMap[node.key];
|
25371 | };
|
25372 |
|
25373 | TreeStore.prototype.getCheckedNodes = function getCheckedNodes() {
|
25374 | var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
25375 | var includeHalfChecked = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
25376 |
|
25377 | var checkedNodes = [];
|
25378 | var traverse = function traverse(node) {
|
25379 | var childNodes = node.root ? node.root.childNodes : node.childNodes;
|
25380 |
|
25381 | childNodes.forEach(function (child) {
|
25382 | if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
|
25383 | checkedNodes.push(child.data);
|
25384 | }
|
25385 |
|
25386 | traverse(child);
|
25387 | });
|
25388 | };
|
25389 |
|
25390 | traverse(this);
|
25391 |
|
25392 | return checkedNodes;
|
25393 | };
|
25394 |
|
25395 | TreeStore.prototype.getCheckedKeys = function getCheckedKeys() {
|
25396 | var _this4 = this;
|
25397 |
|
25398 | var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
25399 |
|
25400 | return this.getCheckedNodes(leafOnly).map(function (data) {
|
25401 | return (data || {})[_this4.key];
|
25402 | });
|
25403 | };
|
25404 |
|
25405 | TreeStore.prototype.getHalfCheckedNodes = function getHalfCheckedNodes() {
|
25406 | var nodes = [];
|
25407 | var traverse = function traverse(node) {
|
25408 | var childNodes = node.root ? node.root.childNodes : node.childNodes;
|
25409 |
|
25410 | childNodes.forEach(function (child) {
|
25411 | if (child.indeterminate) {
|
25412 | nodes.push(child.data);
|
25413 | }
|
25414 |
|
25415 | traverse(child);
|
25416 | });
|
25417 | };
|
25418 |
|
25419 | traverse(this);
|
25420 |
|
25421 | return nodes;
|
25422 | };
|
25423 |
|
25424 | TreeStore.prototype.getHalfCheckedKeys = function getHalfCheckedKeys() {
|
25425 | var _this5 = this;
|
25426 |
|
25427 | return this.getHalfCheckedNodes().map(function (data) {
|
25428 | return (data || {})[_this5.key];
|
25429 | });
|
25430 | };
|
25431 |
|
25432 | TreeStore.prototype._getAllNodes = function _getAllNodes() {
|
25433 | var allNodes = [];
|
25434 | var nodesMap = this.nodesMap;
|
25435 | for (var nodeKey in nodesMap) {
|
25436 | if (nodesMap.hasOwnProperty(nodeKey)) {
|
25437 | allNodes.push(nodesMap[nodeKey]);
|
25438 | }
|
25439 | }
|
25440 |
|
25441 | return allNodes;
|
25442 | };
|
25443 |
|
25444 | TreeStore.prototype.updateChildren = function updateChildren(key, data) {
|
25445 | var node = this.nodesMap[key];
|
25446 | if (!node) return;
|
25447 | var childNodes = node.childNodes;
|
25448 | for (var i = childNodes.length - 1; i >= 0; i--) {
|
25449 | var child = childNodes[i];
|
25450 | this.remove(child.data);
|
25451 | }
|
25452 | for (var _i = 0, j = data.length; _i < j; _i++) {
|
25453 | var _child = data[_i];
|
25454 | this.append(_child, node.data);
|
25455 | }
|
25456 | };
|
25457 |
|
25458 | TreeStore.prototype._setCheckedKeys = function _setCheckedKeys(key) {
|
25459 | var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
25460 | var checkedKeys = arguments[2];
|
25461 |
|
25462 | var allNodes = this._getAllNodes().sort(function (a, b) {
|
25463 | return b.level - a.level;
|
25464 | });
|
25465 | var cache = Object.create(null);
|
25466 | var keys = Object.keys(checkedKeys);
|
25467 | allNodes.forEach(function (node) {
|
25468 | return node.setChecked(false, false);
|
25469 | });
|
25470 | for (var i = 0, j = allNodes.length; i < j; i++) {
|
25471 | var node = allNodes[i];
|
25472 | var nodeKey = node.data[key].toString();
|
25473 | var checked = keys.indexOf(nodeKey) > -1;
|
25474 | if (!checked) {
|
25475 | if (node.checked && !cache[nodeKey]) {
|
25476 | node.setChecked(false, false);
|
25477 | }
|
25478 | continue;
|
25479 | }
|
25480 |
|
25481 | var parent = node.parent;
|
25482 | while (parent && parent.level > 0) {
|
25483 | cache[parent.data[key]] = true;
|
25484 | parent = parent.parent;
|
25485 | }
|
25486 |
|
25487 | if (node.isLeaf || this.checkStrictly) {
|
25488 | node.setChecked(true, false);
|
25489 | continue;
|
25490 | }
|
25491 | node.setChecked(true, true);
|
25492 |
|
25493 | if (leafOnly) {
|
25494 | (function () {
|
25495 | node.setChecked(false, false);
|
25496 | var traverse = function traverse(node) {
|
25497 | var childNodes = node.childNodes;
|
25498 | childNodes.forEach(function (child) {
|
25499 | if (!child.isLeaf) {
|
25500 | child.setChecked(false, false);
|
25501 | }
|
25502 | traverse(child);
|
25503 | });
|
25504 | };
|
25505 | traverse(node);
|
25506 | })();
|
25507 | }
|
25508 | }
|
25509 | };
|
25510 |
|
25511 | TreeStore.prototype.setCheckedNodes = function setCheckedNodes(array) {
|
25512 | var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
25513 |
|
25514 | var key = this.key;
|
25515 | var checkedKeys = {};
|
25516 | array.forEach(function (item) {
|
25517 | checkedKeys[(item || {})[key]] = true;
|
25518 | });
|
25519 |
|
25520 | this._setCheckedKeys(key, leafOnly, checkedKeys);
|
25521 | };
|
25522 |
|
25523 | TreeStore.prototype.setCheckedKeys = function setCheckedKeys(keys) {
|
25524 | var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
25525 |
|
25526 | this.defaultCheckedKeys = keys;
|
25527 | var key = this.key;
|
25528 | var checkedKeys = {};
|
25529 | keys.forEach(function (key) {
|
25530 | checkedKeys[key] = true;
|
25531 | });
|
25532 |
|
25533 | this._setCheckedKeys(key, leafOnly, checkedKeys);
|
25534 | };
|
25535 |
|
25536 | TreeStore.prototype.setDefaultExpandedKeys = function setDefaultExpandedKeys(keys) {
|
25537 | var _this6 = this;
|
25538 |
|
25539 | keys = keys || [];
|
25540 | this.defaultExpandedKeys = keys;
|
25541 |
|
25542 | keys.forEach(function (key) {
|
25543 | var node = _this6.getNode(key);
|
25544 | if (node) node.expand(null, _this6.autoExpandParent);
|
25545 | });
|
25546 | };
|
25547 |
|
25548 | TreeStore.prototype.setChecked = function setChecked(data, checked, deep) {
|
25549 | var node = this.getNode(data);
|
25550 |
|
25551 | if (node) {
|
25552 | node.setChecked(!!checked, deep);
|
25553 | }
|
25554 | };
|
25555 |
|
25556 | TreeStore.prototype.getCurrentNode = function getCurrentNode() {
|
25557 | return this.currentNode;
|
25558 | };
|
25559 |
|
25560 | TreeStore.prototype.setCurrentNode = function setCurrentNode(currentNode) {
|
25561 | var prevCurrentNode = this.currentNode;
|
25562 | if (prevCurrentNode) {
|
25563 | prevCurrentNode.isCurrent = false;
|
25564 | }
|
25565 | this.currentNode = currentNode;
|
25566 | this.currentNode.isCurrent = true;
|
25567 | };
|
25568 |
|
25569 | TreeStore.prototype.setUserCurrentNode = function setUserCurrentNode(node) {
|
25570 | var key = node[this.key];
|
25571 | var currNode = this.nodesMap[key];
|
25572 | this.setCurrentNode(currNode);
|
25573 | };
|
25574 |
|
25575 | TreeStore.prototype.setCurrentNodeKey = function setCurrentNodeKey(key) {
|
25576 | if (key === null || key === undefined) {
|
25577 | this.currentNode && (this.currentNode.isCurrent = false);
|
25578 | this.currentNode = null;
|
25579 | return;
|
25580 | }
|
25581 | var node = this.getNode(key);
|
25582 | if (node) {
|
25583 | this.setCurrentNode(node);
|
25584 | }
|
25585 | };
|
25586 |
|
25587 | return TreeStore;
|
25588 | }();
|
25589 |
|
25590 | var tree_store = (tree_store_TreeStore);
|
25591 | ;
|
25592 |
|
25593 | var tree_nodevue_type_template_id_3ba3ef0e_render = function() {
|
25594 | var this$1 = this
|
25595 | var _vm = this
|
25596 | var _h = _vm.$createElement
|
25597 | var _c = _vm._self._c || _h
|
25598 | return _c(
|
25599 | "div",
|
25600 | {
|
25601 | directives: [
|
25602 | {
|
25603 | name: "show",
|
25604 | rawName: "v-show",
|
25605 | value: _vm.node.visible,
|
25606 | expression: "node.visible"
|
25607 | }
|
25608 | ],
|
25609 | ref: "node",
|
25610 | staticClass: "el-tree-node",
|
25611 | class: {
|
25612 | "is-expanded": _vm.expanded,
|
25613 | "is-current": _vm.node.isCurrent,
|
25614 | "is-hidden": !_vm.node.visible,
|
25615 | "is-focusable": !_vm.node.disabled,
|
25616 | "is-checked": !_vm.node.disabled && _vm.node.checked
|
25617 | },
|
25618 | attrs: {
|
25619 | role: "treeitem",
|
25620 | tabindex: "-1",
|
25621 | "aria-expanded": _vm.expanded,
|
25622 | "aria-disabled": _vm.node.disabled,
|
25623 | "aria-checked": _vm.node.checked,
|
25624 | draggable: _vm.tree.draggable
|
25625 | },
|
25626 | on: {
|
25627 | click: function($event) {
|
25628 | $event.stopPropagation()
|
25629 | return _vm.handleClick($event)
|
25630 | },
|
25631 | contextmenu: function($event) {
|
25632 | return this$1.handleContextMenu($event)
|
25633 | },
|
25634 | dragstart: function($event) {
|
25635 | $event.stopPropagation()
|
25636 | return _vm.handleDragStart($event)
|
25637 | },
|
25638 | dragover: function($event) {
|
25639 | $event.stopPropagation()
|
25640 | return _vm.handleDragOver($event)
|
25641 | },
|
25642 | dragend: function($event) {
|
25643 | $event.stopPropagation()
|
25644 | return _vm.handleDragEnd($event)
|
25645 | },
|
25646 | drop: function($event) {
|
25647 | $event.stopPropagation()
|
25648 | return _vm.handleDrop($event)
|
25649 | }
|
25650 | }
|
25651 | },
|
25652 | [
|
25653 | _c(
|
25654 | "div",
|
25655 | {
|
25656 | staticClass: "el-tree-node__content",
|
25657 | style: {
|
25658 | "padding-left": (_vm.node.level - 1) * _vm.tree.indent + "px"
|
25659 | }
|
25660 | },
|
25661 | [
|
25662 | _c("span", {
|
25663 | class: [
|
25664 | {
|
25665 | "is-leaf": _vm.node.isLeaf,
|
25666 | expanded: !_vm.node.isLeaf && _vm.expanded
|
25667 | },
|
25668 | "el-tree-node__expand-icon",
|
25669 | _vm.tree.iconClass ? _vm.tree.iconClass : "el-icon-caret-right"
|
25670 | ],
|
25671 | on: {
|
25672 | click: function($event) {
|
25673 | $event.stopPropagation()
|
25674 | return _vm.handleExpandIconClick($event)
|
25675 | }
|
25676 | }
|
25677 | }),
|
25678 | _vm.showCheckbox
|
25679 | ? _c("el-checkbox", {
|
25680 | attrs: {
|
25681 | indeterminate: _vm.node.indeterminate,
|
25682 | disabled: !!_vm.node.disabled
|
25683 | },
|
25684 | on: { change: _vm.handleCheckChange },
|
25685 | nativeOn: {
|
25686 | click: function($event) {
|
25687 | $event.stopPropagation()
|
25688 | }
|
25689 | },
|
25690 | model: {
|
25691 | value: _vm.node.checked,
|
25692 | callback: function($$v) {
|
25693 | _vm.$set(_vm.node, "checked", $$v)
|
25694 | },
|
25695 | expression: "node.checked"
|
25696 | }
|
25697 | })
|
25698 | : _vm._e(),
|
25699 | _vm.node.loading
|
25700 | ? _c("span", {
|
25701 | staticClass: "el-tree-node__loading-icon el-icon-loading"
|
25702 | })
|
25703 | : _vm._e(),
|
25704 | _c("node-content", { attrs: { node: _vm.node } })
|
25705 | ],
|
25706 | 1
|
25707 | ),
|
25708 | _c("el-collapse-transition", [
|
25709 | !_vm.renderAfterExpand || _vm.childNodeRendered
|
25710 | ? _c(
|
25711 | "div",
|
25712 | {
|
25713 | directives: [
|
25714 | {
|
25715 | name: "show",
|
25716 | rawName: "v-show",
|
25717 | value: _vm.expanded,
|
25718 | expression: "expanded"
|
25719 | }
|
25720 | ],
|
25721 | staticClass: "el-tree-node__children",
|
25722 | attrs: { role: "group", "aria-expanded": _vm.expanded }
|
25723 | },
|
25724 | _vm._l(_vm.node.childNodes, function(child) {
|
25725 | return _c("el-tree-node", {
|
25726 | key: _vm.getNodeKey(child),
|
25727 | attrs: {
|
25728 | "render-content": _vm.renderContent,
|
25729 | "render-after-expand": _vm.renderAfterExpand,
|
25730 | "show-checkbox": _vm.showCheckbox,
|
25731 | node: child
|
25732 | },
|
25733 | on: { "node-expand": _vm.handleChildNodeExpand }
|
25734 | })
|
25735 | }),
|
25736 | 1
|
25737 | )
|
25738 | : _vm._e()
|
25739 | ])
|
25740 | ],
|
25741 | 1
|
25742 | )
|
25743 | }
|
25744 | var tree_nodevue_type_template_id_3ba3ef0e_staticRenderFns = []
|
25745 | tree_nodevue_type_template_id_3ba3ef0e_render._withStripped = true
|
25746 |
|
25747 |
|
25748 |
|
25749 |
|
25750 |
|
25751 |
|
25752 |
|
25753 |
|
25754 |
|
25755 |
|
25756 |
|
25757 |
|
25758 |
|
25759 |
|
25760 |
|
25761 |
|
25762 |
|
25763 |
|
25764 |
|
25765 |
|
25766 |
|
25767 |
|
25768 |
|
25769 |
|
25770 |
|
25771 |
|
25772 |
|
25773 |
|
25774 |
|
25775 |
|
25776 |
|
25777 |
|
25778 |
|
25779 |
|
25780 |
|
25781 |
|
25782 |
|
25783 |
|
25784 |
|
25785 |
|
25786 |
|
25787 |
|
25788 |
|
25789 |
|
25790 |
|
25791 |
|
25792 |
|
25793 |
|
25794 |
|
25795 |
|
25796 |
|
25797 |
|
25798 |
|
25799 |
|
25800 |
|
25801 |
|
25802 |
|
25803 |
|
25804 |
|
25805 |
|
25806 |
|
25807 |
|
25808 |
|
25809 |
|
25810 |
|
25811 |
|
25812 |
|
25813 |
|
25814 |
|
25815 |
|
25816 |
|
25817 |
|
25818 |
|
25819 |
|
25820 |
|
25821 |
|
25822 |
|
25823 |
|
25824 |
|
25825 |
|
25826 |
|
25827 |
|
25828 |
|
25829 |
|
25830 | var tree_nodevue_type_script_lang_js_ = ({
|
25831 | name: 'ElTreeNode',
|
25832 |
|
25833 | componentName: 'ElTreeNode',
|
25834 |
|
25835 | mixins: [emitter_default.a],
|
25836 |
|
25837 | props: {
|
25838 | node: {
|
25839 | default: function _default() {
|
25840 | return {};
|
25841 | }
|
25842 | },
|
25843 | props: {},
|
25844 | renderContent: Function,
|
25845 | renderAfterExpand: {
|
25846 | type: Boolean,
|
25847 | default: true
|
25848 | },
|
25849 | showCheckbox: {
|
25850 | type: Boolean,
|
25851 | default: false
|
25852 | }
|
25853 | },
|
25854 |
|
25855 | components: {
|
25856 | ElCollapseTransition: collapse_transition_default.a,
|
25857 | ElCheckbox: checkbox_default.a,
|
25858 | NodeContent: {
|
25859 | props: {
|
25860 | node: {
|
25861 | required: true
|
25862 | }
|
25863 | },
|
25864 | render: function render(h) {
|
25865 | var parent = this.$parent;
|
25866 | var tree = parent.tree;
|
25867 | var node = this.node;
|
25868 | var data = node.data,
|
25869 | store = node.store;
|
25870 |
|
25871 | return parent.renderContent ? parent.renderContent.call(parent._renderProxy, h, { _self: tree.$vnode.context, node: node, data: data, store: store }) : tree.$scopedSlots.default ? tree.$scopedSlots.default({ node: node, data: data }) : h(
|
25872 | 'span',
|
25873 | { 'class': 'el-tree-node__label' },
|
25874 | [node.label]
|
25875 | );
|
25876 | }
|
25877 | }
|
25878 | },
|
25879 |
|
25880 | data: function data() {
|
25881 | return {
|
25882 | tree: null,
|
25883 | expanded: false,
|
25884 | childNodeRendered: false,
|
25885 | oldChecked: null,
|
25886 | oldIndeterminate: null
|
25887 | };
|
25888 | },
|
25889 |
|
25890 |
|
25891 | watch: {
|
25892 | 'node.indeterminate': function nodeIndeterminate(val) {
|
25893 | this.handleSelectChange(this.node.checked, val);
|
25894 | },
|
25895 | 'node.checked': function nodeChecked(val) {
|
25896 | this.handleSelectChange(val, this.node.indeterminate);
|
25897 | },
|
25898 | 'node.expanded': function nodeExpanded(val) {
|
25899 | var _this = this;
|
25900 |
|
25901 | this.$nextTick(function () {
|
25902 | return _this.expanded = val;
|
25903 | });
|
25904 | if (val) {
|
25905 | this.childNodeRendered = true;
|
25906 | }
|
25907 | }
|
25908 | },
|
25909 |
|
25910 | methods: {
|
25911 | getNodeKey: function getNodeKey(node) {
|
25912 | return util_getNodeKey(this.tree.nodeKey, node.data);
|
25913 | },
|
25914 | handleSelectChange: function handleSelectChange(checked, indeterminate) {
|
25915 | if (this.oldChecked !== checked && this.oldIndeterminate !== indeterminate) {
|
25916 | this.tree.$emit('check-change', this.node.data, checked, indeterminate);
|
25917 | }
|
25918 | this.oldChecked = checked;
|
25919 | this.indeterminate = indeterminate;
|
25920 | },
|
25921 | handleClick: function handleClick() {
|
25922 | var store = this.tree.store;
|
25923 | store.setCurrentNode(this.node);
|
25924 | this.tree.$emit('current-change', store.currentNode ? store.currentNode.data : null, store.currentNode);
|
25925 | this.tree.currentNode = this;
|
25926 | if (this.tree.expandOnClickNode) {
|
25927 | this.handleExpandIconClick();
|
25928 | }
|
25929 | if (this.tree.checkOnClickNode && !this.node.disabled) {
|
25930 | this.handleCheckChange(null, {
|
25931 | target: { checked: !this.node.checked }
|
25932 | });
|
25933 | }
|
25934 | this.tree.$emit('node-click', this.node.data, this.node, this);
|
25935 | },
|
25936 | handleContextMenu: function handleContextMenu(event) {
|
25937 | if (this.tree._events['node-contextmenu'] && this.tree._events['node-contextmenu'].length > 0) {
|
25938 | event.stopPropagation();
|
25939 | event.preventDefault();
|
25940 | }
|
25941 | this.tree.$emit('node-contextmenu', event, this.node.data, this.node, this);
|
25942 | },
|
25943 | handleExpandIconClick: function handleExpandIconClick() {
|
25944 | if (this.node.isLeaf) return;
|
25945 | if (this.expanded) {
|
25946 | this.tree.$emit('node-collapse', this.node.data, this.node, this);
|
25947 | this.node.collapse();
|
25948 | } else {
|
25949 | this.node.expand();
|
25950 | this.$emit('node-expand', this.node.data, this.node, this);
|
25951 | }
|
25952 | },
|
25953 | handleCheckChange: function handleCheckChange(value, ev) {
|
25954 | var _this2 = this;
|
25955 |
|
25956 | this.node.setChecked(ev.target.checked, !this.tree.checkStrictly);
|
25957 | this.$nextTick(function () {
|
25958 | var store = _this2.tree.store;
|
25959 | _this2.tree.$emit('check', _this2.node.data, {
|
25960 | checkedNodes: store.getCheckedNodes(),
|
25961 | checkedKeys: store.getCheckedKeys(),
|
25962 | halfCheckedNodes: store.getHalfCheckedNodes(),
|
25963 | halfCheckedKeys: store.getHalfCheckedKeys()
|
25964 | });
|
25965 | });
|
25966 | },
|
25967 | handleChildNodeExpand: function handleChildNodeExpand(nodeData, node, instance) {
|
25968 | this.broadcast('ElTreeNode', 'tree-node-expand', node);
|
25969 | this.tree.$emit('node-expand', nodeData, node, instance);
|
25970 | },
|
25971 | handleDragStart: function handleDragStart(event) {
|
25972 | if (!this.tree.draggable) return;
|
25973 | this.tree.$emit('tree-node-drag-start', event, this);
|
25974 | },
|
25975 | handleDragOver: function handleDragOver(event) {
|
25976 | if (!this.tree.draggable) return;
|
25977 | this.tree.$emit('tree-node-drag-over', event, this);
|
25978 | event.preventDefault();
|
25979 | },
|
25980 | handleDrop: function handleDrop(event) {
|
25981 | event.preventDefault();
|
25982 | },
|
25983 | handleDragEnd: function handleDragEnd(event) {
|
25984 | if (!this.tree.draggable) return;
|
25985 | this.tree.$emit('tree-node-drag-end', event, this);
|
25986 | }
|
25987 | },
|
25988 |
|
25989 | created: function created() {
|
25990 | var _this3 = this;
|
25991 |
|
25992 | var parent = this.$parent;
|
25993 |
|
25994 | if (parent.isTree) {
|
25995 | this.tree = parent;
|
25996 | } else {
|
25997 | this.tree = parent.tree;
|
25998 | }
|
25999 |
|
26000 | var tree = this.tree;
|
26001 | if (!tree) {
|
26002 | console.warn('Can not find node\'s tree.');
|
26003 | }
|
26004 |
|
26005 | var props = tree.props || {};
|
26006 | var childrenKey = props['children'] || 'children';
|
26007 |
|
26008 | this.$watch('node.data.' + childrenKey, function () {
|
26009 | _this3.node.updateChildren();
|
26010 | });
|
26011 |
|
26012 | if (this.node.expanded) {
|
26013 | this.expanded = true;
|
26014 | this.childNodeRendered = true;
|
26015 | }
|
26016 |
|
26017 | if (this.tree.accordion) {
|
26018 | this.$on('tree-node-expand', function (node) {
|
26019 | if (_this3.node !== node) {
|
26020 | _this3.node.collapse();
|
26021 | }
|
26022 | });
|
26023 | }
|
26024 | }
|
26025 | });
|
26026 |
|
26027 | var src_tree_nodevue_type_script_lang_js_ = (tree_nodevue_type_script_lang_js_);
|
26028 |
|
26029 |
|
26030 |
|
26031 |
|
26032 |
|
26033 |
|
26034 |
|
26035 |
|
26036 | var tree_node_component = normalizeComponent(
|
26037 | src_tree_nodevue_type_script_lang_js_,
|
26038 | tree_nodevue_type_template_id_3ba3ef0e_render,
|
26039 | tree_nodevue_type_template_id_3ba3ef0e_staticRenderFns,
|
26040 | false,
|
26041 | null,
|
26042 | null,
|
26043 | null
|
26044 |
|
26045 | )
|
26046 |
|
26047 |
|
26048 | if (false) { var tree_node_api; }
|
26049 | tree_node_component.options.__file = "packages/tree/src/tree-node.vue"
|
26050 | var tree_node = (tree_node_component.exports);
|
26051 |
|
26052 |
|
26053 |
|
26054 |
|
26055 |
|
26056 |
|
26057 |
|
26058 |
|
26059 |
|
26060 |
|
26061 |
|
26062 |
|
26063 |
|
26064 |
|
26065 |
|
26066 |
|
26067 |
|
26068 |
|
26069 |
|
26070 |
|
26071 |
|
26072 |
|
26073 |
|
26074 |
|
26075 |
|
26076 |
|
26077 |
|
26078 |
|
26079 |
|
26080 |
|
26081 |
|
26082 |
|
26083 |
|
26084 |
|
26085 |
|
26086 |
|
26087 |
|
26088 |
|
26089 |
|
26090 |
|
26091 |
|
26092 | var treevue_type_script_lang_js_ = ({
|
26093 | name: 'ElTree',
|
26094 |
|
26095 | mixins: [emitter_default.a],
|
26096 |
|
26097 | components: {
|
26098 | ElTreeNode: tree_node
|
26099 | },
|
26100 |
|
26101 | data: function data() {
|
26102 | return {
|
26103 | store: null,
|
26104 | root: null,
|
26105 | currentNode: null,
|
26106 | treeItems: null,
|
26107 | checkboxItems: [],
|
26108 | dragState: {
|
26109 | showDropIndicator: false,
|
26110 | draggingNode: null,
|
26111 | dropNode: null,
|
26112 | allowDrop: true
|
26113 | }
|
26114 | };
|
26115 | },
|
26116 |
|
26117 |
|
26118 | props: {
|
26119 | data: {
|
26120 | type: Array
|
26121 | },
|
26122 | emptyText: {
|
26123 | type: String,
|
26124 | default: function _default() {
|
26125 | return Object(lib_locale_["t"])('el.tree.emptyText');
|
26126 | }
|
26127 | },
|
26128 | renderAfterExpand: {
|
26129 | type: Boolean,
|
26130 | default: true
|
26131 | },
|
26132 | nodeKey: String,
|
26133 | checkStrictly: Boolean,
|
26134 | defaultExpandAll: Boolean,
|
26135 | expandOnClickNode: {
|
26136 | type: Boolean,
|
26137 | default: true
|
26138 | },
|
26139 | checkOnClickNode: Boolean,
|
26140 | checkDescendants: {
|
26141 | type: Boolean,
|
26142 | default: false
|
26143 | },
|
26144 | autoExpandParent: {
|
26145 | type: Boolean,
|
26146 | default: true
|
26147 | },
|
26148 | defaultCheckedKeys: Array,
|
26149 | defaultExpandedKeys: Array,
|
26150 | currentNodeKey: [String, Number],
|
26151 | renderContent: Function,
|
26152 | showCheckbox: {
|
26153 | type: Boolean,
|
26154 | default: false
|
26155 | },
|
26156 | draggable: {
|
26157 | type: Boolean,
|
26158 | default: false
|
26159 | },
|
26160 | allowDrag: Function,
|
26161 | allowDrop: Function,
|
26162 | props: {
|
26163 | default: function _default() {
|
26164 | return {
|
26165 | children: 'children',
|
26166 | label: 'label',
|
26167 | disabled: 'disabled'
|
26168 | };
|
26169 | }
|
26170 | },
|
26171 | lazy: {
|
26172 | type: Boolean,
|
26173 | default: false
|
26174 | },
|
26175 | highlightCurrent: Boolean,
|
26176 | load: Function,
|
26177 | filterNodeMethod: Function,
|
26178 | accordion: Boolean,
|
26179 | indent: {
|
26180 | type: Number,
|
26181 | default: 18
|
26182 | },
|
26183 | iconClass: String
|
26184 | },
|
26185 |
|
26186 | computed: {
|
26187 | children: {
|
26188 | set: function set(value) {
|
26189 | this.data = value;
|
26190 | },
|
26191 | get: function get() {
|
26192 | return this.data;
|
26193 | }
|
26194 | },
|
26195 |
|
26196 | treeItemArray: function treeItemArray() {
|
26197 | return Array.prototype.slice.call(this.treeItems);
|
26198 | },
|
26199 | isEmpty: function isEmpty() {
|
26200 | var childNodes = this.root.childNodes;
|
26201 |
|
26202 | return !childNodes || childNodes.length === 0 || childNodes.every(function (_ref) {
|
26203 | var visible = _ref.visible;
|
26204 | return !visible;
|
26205 | });
|
26206 | }
|
26207 | },
|
26208 |
|
26209 | watch: {
|
26210 | defaultCheckedKeys: function defaultCheckedKeys(newVal) {
|
26211 | this.store.setDefaultCheckedKey(newVal);
|
26212 | },
|
26213 | defaultExpandedKeys: function defaultExpandedKeys(newVal) {
|
26214 | this.store.defaultExpandedKeys = newVal;
|
26215 | this.store.setDefaultExpandedKeys(newVal);
|
26216 | },
|
26217 | data: function data(newVal) {
|
26218 | this.store.setData(newVal);
|
26219 | },
|
26220 | checkboxItems: function checkboxItems(val) {
|
26221 | Array.prototype.forEach.call(val, function (checkbox) {
|
26222 | checkbox.setAttribute('tabindex', -1);
|
26223 | });
|
26224 | },
|
26225 | checkStrictly: function checkStrictly(newVal) {
|
26226 | this.store.checkStrictly = newVal;
|
26227 | }
|
26228 | },
|
26229 |
|
26230 | methods: {
|
26231 | filter: function filter(value) {
|
26232 | if (!this.filterNodeMethod) throw new Error('[Tree] filterNodeMethod is required when filter');
|
26233 | this.store.filter(value);
|
26234 | },
|
26235 | getNodeKey: function getNodeKey(node) {
|
26236 | return util_getNodeKey(this.nodeKey, node.data);
|
26237 | },
|
26238 | getNodePath: function getNodePath(data) {
|
26239 | if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in getNodePath');
|
26240 | var node = this.store.getNode(data);
|
26241 | if (!node) return [];
|
26242 | var path = [node.data];
|
26243 | var parent = node.parent;
|
26244 | while (parent && parent !== this.root) {
|
26245 | path.push(parent.data);
|
26246 | parent = parent.parent;
|
26247 | }
|
26248 | return path.reverse();
|
26249 | },
|
26250 | getCheckedNodes: function getCheckedNodes(leafOnly, includeHalfChecked) {
|
26251 | return this.store.getCheckedNodes(leafOnly, includeHalfChecked);
|
26252 | },
|
26253 | getCheckedKeys: function getCheckedKeys(leafOnly) {
|
26254 | return this.store.getCheckedKeys(leafOnly);
|
26255 | },
|
26256 | getCurrentNode: function getCurrentNode() {
|
26257 | var currentNode = this.store.getCurrentNode();
|
26258 | return currentNode ? currentNode.data : null;
|
26259 | },
|
26260 | getCurrentKey: function getCurrentKey() {
|
26261 | if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in getCurrentKey');
|
26262 | var currentNode = this.getCurrentNode();
|
26263 | return currentNode ? currentNode[this.nodeKey] : null;
|
26264 | },
|
26265 | setCheckedNodes: function setCheckedNodes(nodes, leafOnly) {
|
26266 | if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedNodes');
|
26267 | this.store.setCheckedNodes(nodes, leafOnly);
|
26268 | },
|
26269 | setCheckedKeys: function setCheckedKeys(keys, leafOnly) {
|
26270 | if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedKeys');
|
26271 | this.store.setCheckedKeys(keys, leafOnly);
|
26272 | },
|
26273 | setChecked: function setChecked(data, checked, deep) {
|
26274 | this.store.setChecked(data, checked, deep);
|
26275 | },
|
26276 | getHalfCheckedNodes: function getHalfCheckedNodes() {
|
26277 | return this.store.getHalfCheckedNodes();
|
26278 | },
|
26279 | getHalfCheckedKeys: function getHalfCheckedKeys() {
|
26280 | return this.store.getHalfCheckedKeys();
|
26281 | },
|
26282 | setCurrentNode: function setCurrentNode(node) {
|
26283 | if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCurrentNode');
|
26284 | this.store.setUserCurrentNode(node);
|
26285 | },
|
26286 | setCurrentKey: function setCurrentKey(key) {
|
26287 | if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCurrentKey');
|
26288 | this.store.setCurrentNodeKey(key);
|
26289 | },
|
26290 | getNode: function getNode(data) {
|
26291 | return this.store.getNode(data);
|
26292 | },
|
26293 | remove: function remove(data) {
|
26294 | this.store.remove(data);
|
26295 | },
|
26296 | append: function append(data, parentNode) {
|
26297 | this.store.append(data, parentNode);
|
26298 | },
|
26299 | insertBefore: function insertBefore(data, refNode) {
|
26300 | this.store.insertBefore(data, refNode);
|
26301 | },
|
26302 | insertAfter: function insertAfter(data, refNode) {
|
26303 | this.store.insertAfter(data, refNode);
|
26304 | },
|
26305 | handleNodeExpand: function handleNodeExpand(nodeData, node, instance) {
|
26306 | this.broadcast('ElTreeNode', 'tree-node-expand', node);
|
26307 | this.$emit('node-expand', nodeData, node, instance);
|
26308 | },
|
26309 | updateKeyChildren: function updateKeyChildren(key, data) {
|
26310 | if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in updateKeyChild');
|
26311 | this.store.updateChildren(key, data);
|
26312 | },
|
26313 | initTabIndex: function initTabIndex() {
|
26314 | this.treeItems = this.$el.querySelectorAll('.is-focusable[role=treeitem]');
|
26315 | this.checkboxItems = this.$el.querySelectorAll('input[type=checkbox]');
|
26316 | var checkedItem = this.$el.querySelectorAll('.is-checked[role=treeitem]');
|
26317 | if (checkedItem.length) {
|
26318 | checkedItem[0].setAttribute('tabindex', 0);
|
26319 | return;
|
26320 | }
|
26321 | this.treeItems[0] && this.treeItems[0].setAttribute('tabindex', 0);
|
26322 | },
|
26323 | handleKeydown: function handleKeydown(ev) {
|
26324 | var currentItem = ev.target;
|
26325 | if (currentItem.className.indexOf('el-tree-node') === -1) return;
|
26326 | var keyCode = ev.keyCode;
|
26327 | this.treeItems = this.$el.querySelectorAll('.is-focusable[role=treeitem]');
|
26328 | var currentIndex = this.treeItemArray.indexOf(currentItem);
|
26329 | var nextIndex = void 0;
|
26330 | if ([38, 40].indexOf(keyCode) > -1) {
|
26331 |
|
26332 | ev.preventDefault();
|
26333 | if (keyCode === 38) {
|
26334 |
|
26335 | nextIndex = currentIndex !== 0 ? currentIndex - 1 : 0;
|
26336 | } else {
|
26337 | nextIndex = currentIndex < this.treeItemArray.length - 1 ? currentIndex + 1 : 0;
|
26338 | }
|
26339 | this.treeItemArray[nextIndex].focus();
|
26340 | }
|
26341 | if ([37, 39].indexOf(keyCode) > -1) {
|
26342 |
|
26343 | ev.preventDefault();
|
26344 | currentItem.click();
|
26345 | }
|
26346 | var hasInput = currentItem.querySelector('[type="checkbox"]');
|
26347 | if ([13, 32].indexOf(keyCode) > -1 && hasInput) {
|
26348 |
|
26349 | ev.preventDefault();
|
26350 | hasInput.click();
|
26351 | }
|
26352 | }
|
26353 | },
|
26354 |
|
26355 | created: function created() {
|
26356 | var _this = this;
|
26357 |
|
26358 | this.isTree = true;
|
26359 |
|
26360 | this.store = new tree_store({
|
26361 | key: this.nodeKey,
|
26362 | data: this.data,
|
26363 | lazy: this.lazy,
|
26364 | props: this.props,
|
26365 | load: this.load,
|
26366 | currentNodeKey: this.currentNodeKey,
|
26367 | checkStrictly: this.checkStrictly,
|
26368 | checkDescendants: this.checkDescendants,
|
26369 | defaultCheckedKeys: this.defaultCheckedKeys,
|
26370 | defaultExpandedKeys: this.defaultExpandedKeys,
|
26371 | autoExpandParent: this.autoExpandParent,
|
26372 | defaultExpandAll: this.defaultExpandAll,
|
26373 | filterNodeMethod: this.filterNodeMethod
|
26374 | });
|
26375 |
|
26376 | this.root = this.store.root;
|
26377 |
|
26378 | var dragState = this.dragState;
|
26379 | this.$on('tree-node-drag-start', function (event, treeNode) {
|
26380 | if (typeof _this.allowDrag === 'function' && !_this.allowDrag(treeNode.node)) {
|
26381 | event.preventDefault();
|
26382 | return false;
|
26383 | }
|
26384 | event.dataTransfer.effectAllowed = 'move';
|
26385 |
|
26386 |
|
26387 | try {
|
26388 |
|
26389 |
|
26390 | event.dataTransfer.setData('text/plain', '');
|
26391 | } catch (e) {}
|
26392 | dragState.draggingNode = treeNode;
|
26393 | _this.$emit('node-drag-start', treeNode.node, event);
|
26394 | });
|
26395 |
|
26396 | this.$on('tree-node-drag-over', function (event, treeNode) {
|
26397 | var dropNode = findNearestComponent(event.target, 'ElTreeNode');
|
26398 | var oldDropNode = dragState.dropNode;
|
26399 | if (oldDropNode && oldDropNode !== dropNode) {
|
26400 | Object(dom_["removeClass"])(oldDropNode.$el, 'is-drop-inner');
|
26401 | }
|
26402 | var draggingNode = dragState.draggingNode;
|
26403 | if (!draggingNode || !dropNode) return;
|
26404 |
|
26405 | var dropPrev = true;
|
26406 | var dropInner = true;
|
26407 | var dropNext = true;
|
26408 | var userAllowDropInner = true;
|
26409 | if (typeof _this.allowDrop === 'function') {
|
26410 | dropPrev = _this.allowDrop(draggingNode.node, dropNode.node, 'prev');
|
26411 | userAllowDropInner = dropInner = _this.allowDrop(draggingNode.node, dropNode.node, 'inner');
|
26412 | dropNext = _this.allowDrop(draggingNode.node, dropNode.node, 'next');
|
26413 | }
|
26414 | event.dataTransfer.dropEffect = dropInner ? 'move' : 'none';
|
26415 | if ((dropPrev || dropInner || dropNext) && oldDropNode !== dropNode) {
|
26416 | if (oldDropNode) {
|
26417 | _this.$emit('node-drag-leave', draggingNode.node, oldDropNode.node, event);
|
26418 | }
|
26419 | _this.$emit('node-drag-enter', draggingNode.node, dropNode.node, event);
|
26420 | }
|
26421 |
|
26422 | if (dropPrev || dropInner || dropNext) {
|
26423 | dragState.dropNode = dropNode;
|
26424 | }
|
26425 |
|
26426 | if (dropNode.node.nextSibling === draggingNode.node) {
|
26427 | dropNext = false;
|
26428 | }
|
26429 | if (dropNode.node.previousSibling === draggingNode.node) {
|
26430 | dropPrev = false;
|
26431 | }
|
26432 | if (dropNode.node.contains(draggingNode.node, false)) {
|
26433 | dropInner = false;
|
26434 | }
|
26435 | if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
|
26436 | dropPrev = false;
|
26437 | dropInner = false;
|
26438 | dropNext = false;
|
26439 | }
|
26440 |
|
26441 | var targetPosition = dropNode.$el.getBoundingClientRect();
|
26442 | var treePosition = _this.$el.getBoundingClientRect();
|
26443 |
|
26444 | var dropType = void 0;
|
26445 | var prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1;
|
26446 | var nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1;
|
26447 |
|
26448 | var indicatorTop = -9999;
|
26449 | var distance = event.clientY - targetPosition.top;
|
26450 | if (distance < targetPosition.height * prevPercent) {
|
26451 | dropType = 'before';
|
26452 | } else if (distance > targetPosition.height * nextPercent) {
|
26453 | dropType = 'after';
|
26454 | } else if (dropInner) {
|
26455 | dropType = 'inner';
|
26456 | } else {
|
26457 | dropType = 'none';
|
26458 | }
|
26459 |
|
26460 | var iconPosition = dropNode.$el.querySelector('.el-tree-node__expand-icon').getBoundingClientRect();
|
26461 | var dropIndicator = _this.$refs.dropIndicator;
|
26462 | if (dropType === 'before') {
|
26463 | indicatorTop = iconPosition.top - treePosition.top;
|
26464 | } else if (dropType === 'after') {
|
26465 | indicatorTop = iconPosition.bottom - treePosition.top;
|
26466 | }
|
26467 | dropIndicator.style.top = indicatorTop + 'px';
|
26468 | dropIndicator.style.left = iconPosition.right - treePosition.left + 'px';
|
26469 |
|
26470 | if (dropType === 'inner') {
|
26471 | Object(dom_["addClass"])(dropNode.$el, 'is-drop-inner');
|
26472 | } else {
|
26473 | Object(dom_["removeClass"])(dropNode.$el, 'is-drop-inner');
|
26474 | }
|
26475 |
|
26476 | dragState.showDropIndicator = dropType === 'before' || dropType === 'after';
|
26477 | dragState.allowDrop = dragState.showDropIndicator || userAllowDropInner;
|
26478 | dragState.dropType = dropType;
|
26479 | _this.$emit('node-drag-over', draggingNode.node, dropNode.node, event);
|
26480 | });
|
26481 |
|
26482 | this.$on('tree-node-drag-end', function (event) {
|
26483 | var draggingNode = dragState.draggingNode,
|
26484 | dropType = dragState.dropType,
|
26485 | dropNode = dragState.dropNode;
|
26486 |
|
26487 | event.preventDefault();
|
26488 | event.dataTransfer.dropEffect = 'move';
|
26489 |
|
26490 | if (draggingNode && dropNode) {
|
26491 | var draggingNodeCopy = { data: draggingNode.node.data };
|
26492 | if (dropType !== 'none') {
|
26493 | draggingNode.node.remove();
|
26494 | }
|
26495 | if (dropType === 'before') {
|
26496 | dropNode.node.parent.insertBefore(draggingNodeCopy, dropNode.node);
|
26497 | } else if (dropType === 'after') {
|
26498 | dropNode.node.parent.insertAfter(draggingNodeCopy, dropNode.node);
|
26499 | } else if (dropType === 'inner') {
|
26500 | dropNode.node.insertChild(draggingNodeCopy);
|
26501 | }
|
26502 | if (dropType !== 'none') {
|
26503 | _this.store.registerNode(draggingNodeCopy);
|
26504 | }
|
26505 |
|
26506 | Object(dom_["removeClass"])(dropNode.$el, 'is-drop-inner');
|
26507 |
|
26508 | _this.$emit('node-drag-end', draggingNode.node, dropNode.node, dropType, event);
|
26509 | if (dropType !== 'none') {
|
26510 | _this.$emit('node-drop', draggingNode.node, dropNode.node, dropType, event);
|
26511 | }
|
26512 | }
|
26513 | if (draggingNode && !dropNode) {
|
26514 | _this.$emit('node-drag-end', draggingNode.node, null, dropType, event);
|
26515 | }
|
26516 |
|
26517 | dragState.showDropIndicator = false;
|
26518 | dragState.draggingNode = null;
|
26519 | dragState.dropNode = null;
|
26520 | dragState.allowDrop = true;
|
26521 | });
|
26522 | },
|
26523 | mounted: function mounted() {
|
26524 | this.initTabIndex();
|
26525 | this.$el.addEventListener('keydown', this.handleKeydown);
|
26526 | },
|
26527 | updated: function updated() {
|
26528 | this.treeItems = this.$el.querySelectorAll('[role=treeitem]');
|
26529 | this.checkboxItems = this.$el.querySelectorAll('input[type=checkbox]');
|
26530 | }
|
26531 | });
|
26532 |
|
26533 | var src_treevue_type_script_lang_js_ = (treevue_type_script_lang_js_);
|
26534 |
|
26535 |
|
26536 |
|
26537 |
|
26538 |
|
26539 |
|
26540 |
|
26541 |
|
26542 | var tree_component = normalizeComponent(
|
26543 | src_treevue_type_script_lang_js_,
|
26544 | treevue_type_template_id_547575a6_render,
|
26545 | treevue_type_template_id_547575a6_staticRenderFns,
|
26546 | false,
|
26547 | null,
|
26548 | null,
|
26549 | null
|
26550 |
|
26551 | )
|
26552 |
|
26553 |
|
26554 | if (false) { var tree_api; }
|
26555 | tree_component.options.__file = "packages/tree/src/tree.vue"
|
26556 | var src_tree = (tree_component.exports);
|
26557 |
|
26558 |
|
26559 |
|
26560 |
|
26561 | src_tree.install = function (Vue) {
|
26562 | Vue.component(src_tree.name, src_tree);
|
26563 | };
|
26564 |
|
26565 | var packages_tree = (src_tree);
|
26566 |
|
26567 | var mainvue_type_template_id_6e53341b_render = function() {
|
26568 | var _vm = this
|
26569 | var _h = _vm.$createElement
|
26570 | var _c = _vm._self._c || _h
|
26571 | return _c("transition", { attrs: { name: "el-alert-fade" } }, [
|
26572 | _c(
|
26573 | "div",
|
26574 | {
|
26575 | directives: [
|
26576 | {
|
26577 | name: "show",
|
26578 | rawName: "v-show",
|
26579 | value: _vm.visible,
|
26580 | expression: "visible"
|
26581 | }
|
26582 | ],
|
26583 | staticClass: "el-alert",
|
26584 | class: [
|
26585 | _vm.typeClass,
|
26586 | _vm.center ? "is-center" : "",
|
26587 | "is-" + _vm.effect
|
26588 | ],
|
26589 | attrs: { role: "alert" }
|
26590 | },
|
26591 | [
|
26592 | _vm.showIcon
|
26593 | ? _c("i", {
|
26594 | staticClass: "el-alert__icon",
|
26595 | class: [_vm.iconClass, _vm.isBigIcon]
|
26596 | })
|
26597 | : _vm._e(),
|
26598 | _c("div", { staticClass: "el-alert__content" }, [
|
26599 | _vm.title || _vm.$slots.title
|
26600 | ? _c(
|
26601 | "span",
|
26602 | { staticClass: "el-alert__title", class: [_vm.isBoldTitle] },
|
26603 | [_vm._t("title", [_vm._v(_vm._s(_vm.title))])],
|
26604 | 2
|
26605 | )
|
26606 | : _vm._e(),
|
26607 | _vm.$slots.default && !_vm.description
|
26608 | ? _c(
|
26609 | "p",
|
26610 | { staticClass: "el-alert__description" },
|
26611 | [_vm._t("default")],
|
26612 | 2
|
26613 | )
|
26614 | : _vm._e(),
|
26615 | _vm.description && !_vm.$slots.default
|
26616 | ? _c("p", { staticClass: "el-alert__description" }, [
|
26617 | _vm._v(_vm._s(_vm.description))
|
26618 | ])
|
26619 | : _vm._e(),
|
26620 | _c(
|
26621 | "i",
|
26622 | {
|
26623 | directives: [
|
26624 | {
|
26625 | name: "show",
|
26626 | rawName: "v-show",
|
26627 | value: _vm.closable,
|
26628 | expression: "closable"
|
26629 | }
|
26630 | ],
|
26631 | staticClass: "el-alert__closebtn",
|
26632 | class: {
|
26633 | "is-customed": _vm.closeText !== "",
|
26634 | "el-icon-close": _vm.closeText === ""
|
26635 | },
|
26636 | on: {
|
26637 | click: function($event) {
|
26638 | _vm.close()
|
26639 | }
|
26640 | }
|
26641 | },
|
26642 | [_vm._v(_vm._s(_vm.closeText))]
|
26643 | )
|
26644 | ])
|
26645 | ]
|
26646 | )
|
26647 | ])
|
26648 | }
|
26649 | var mainvue_type_template_id_6e53341b_staticRenderFns = []
|
26650 | mainvue_type_template_id_6e53341b_render._withStripped = true
|
26651 |
|
26652 |
|
26653 |
|
26654 |
|
26655 |
|
26656 |
|
26657 |
|
26658 |
|
26659 |
|
26660 |
|
26661 |
|
26662 |
|
26663 |
|
26664 |
|
26665 |
|
26666 |
|
26667 |
|
26668 |
|
26669 |
|
26670 |
|
26671 |
|
26672 |
|
26673 |
|
26674 |
|
26675 |
|
26676 |
|
26677 |
|
26678 | var TYPE_CLASSES_MAP = {
|
26679 | 'success': 'el-icon-success',
|
26680 | 'warning': 'el-icon-warning',
|
26681 | 'error': 'el-icon-error'
|
26682 | };
|
26683 | var alert_src_mainvue_type_script_lang_js_ = ({
|
26684 | name: 'ElAlert',
|
26685 |
|
26686 | props: {
|
26687 | title: {
|
26688 | type: String,
|
26689 | default: ''
|
26690 | },
|
26691 | description: {
|
26692 | type: String,
|
26693 | default: ''
|
26694 | },
|
26695 | type: {
|
26696 | type: String,
|
26697 | default: 'info'
|
26698 | },
|
26699 | closable: {
|
26700 | type: Boolean,
|
26701 | default: true
|
26702 | },
|
26703 | closeText: {
|
26704 | type: String,
|
26705 | default: ''
|
26706 | },
|
26707 | showIcon: Boolean,
|
26708 | center: Boolean,
|
26709 | effect: {
|
26710 | type: String,
|
26711 | default: 'light',
|
26712 | validator: function validator(value) {
|
26713 | return ['light', 'dark'].indexOf(value) !== -1;
|
26714 | }
|
26715 | }
|
26716 | },
|
26717 |
|
26718 | data: function data() {
|
26719 | return {
|
26720 | visible: true
|
26721 | };
|
26722 | },
|
26723 |
|
26724 |
|
26725 | methods: {
|
26726 | close: function close() {
|
26727 | this.visible = false;
|
26728 | this.$emit('close');
|
26729 | }
|
26730 | },
|
26731 |
|
26732 | computed: {
|
26733 | typeClass: function typeClass() {
|
26734 | return 'el-alert--' + this.type;
|
26735 | },
|
26736 | iconClass: function iconClass() {
|
26737 | return TYPE_CLASSES_MAP[this.type] || 'el-icon-info';
|
26738 | },
|
26739 | isBigIcon: function isBigIcon() {
|
26740 | return this.description || this.$slots.default ? 'is-big' : '';
|
26741 | },
|
26742 | isBoldTitle: function isBoldTitle() {
|
26743 | return this.description || this.$slots.default ? 'is-bold' : '';
|
26744 | }
|
26745 | }
|
26746 | });
|
26747 |
|
26748 | var packages_alert_src_mainvue_type_script_lang_js_ = (alert_src_mainvue_type_script_lang_js_);
|
26749 |
|
26750 |
|
26751 |
|
26752 |
|
26753 |
|
26754 |
|
26755 |
|
26756 |
|
26757 | var alert_src_main_component = normalizeComponent(
|
26758 | packages_alert_src_mainvue_type_script_lang_js_,
|
26759 | mainvue_type_template_id_6e53341b_render,
|
26760 | mainvue_type_template_id_6e53341b_staticRenderFns,
|
26761 | false,
|
26762 | null,
|
26763 | null,
|
26764 | null
|
26765 |
|
26766 | )
|
26767 |
|
26768 |
|
26769 | if (false) { var alert_src_main_api; }
|
26770 | alert_src_main_component.options.__file = "packages/alert/src/main.vue"
|
26771 | var alert_src_main = (alert_src_main_component.exports);
|
26772 |
|
26773 |
|
26774 |
|
26775 |
|
26776 | alert_src_main.install = function (Vue) {
|
26777 | Vue.component(alert_src_main.name, alert_src_main);
|
26778 | };
|
26779 |
|
26780 | var packages_alert = (alert_src_main);
|
26781 |
|
26782 | var mainvue_type_template_id_43dbc3d8_render = function() {
|
26783 | var _vm = this
|
26784 | var _h = _vm.$createElement
|
26785 | var _c = _vm._self._c || _h
|
26786 | return _c("transition", { attrs: { name: "el-notification-fade" } }, [
|
26787 | _c(
|
26788 | "div",
|
26789 | {
|
26790 | directives: [
|
26791 | {
|
26792 | name: "show",
|
26793 | rawName: "v-show",
|
26794 | value: _vm.visible,
|
26795 | expression: "visible"
|
26796 | }
|
26797 | ],
|
26798 | class: ["el-notification", _vm.customClass, _vm.horizontalClass],
|
26799 | style: _vm.positionStyle,
|
26800 | attrs: { role: "alert" },
|
26801 | on: {
|
26802 | mouseenter: function($event) {
|
26803 | _vm.clearTimer()
|
26804 | },
|
26805 | mouseleave: function($event) {
|
26806 | _vm.startTimer()
|
26807 | },
|
26808 | click: _vm.click
|
26809 | }
|
26810 | },
|
26811 | [
|
26812 | _vm.type || _vm.iconClass
|
26813 | ? _c("i", {
|
26814 | staticClass: "el-notification__icon",
|
26815 | class: [_vm.typeClass, _vm.iconClass]
|
26816 | })
|
26817 | : _vm._e(),
|
26818 | _c(
|
26819 | "div",
|
26820 | {
|
26821 | staticClass: "el-notification__group",
|
26822 | class: { "is-with-icon": _vm.typeClass || _vm.iconClass }
|
26823 | },
|
26824 | [
|
26825 | _c("h2", {
|
26826 | staticClass: "el-notification__title",
|
26827 | domProps: { textContent: _vm._s(_vm.title) }
|
26828 | }),
|
26829 | _c(
|
26830 | "div",
|
26831 | {
|
26832 | directives: [
|
26833 | {
|
26834 | name: "show",
|
26835 | rawName: "v-show",
|
26836 | value: _vm.message,
|
26837 | expression: "message"
|
26838 | }
|
26839 | ],
|
26840 | staticClass: "el-notification__content"
|
26841 | },
|
26842 | [
|
26843 | _vm._t("default", [
|
26844 | !_vm.dangerouslyUseHTMLString
|
26845 | ? _c("p", [_vm._v(_vm._s(_vm.message))])
|
26846 | : _c("p", { domProps: { innerHTML: _vm._s(_vm.message) } })
|
26847 | ])
|
26848 | ],
|
26849 | 2
|
26850 | ),
|
26851 | _vm.showClose
|
26852 | ? _c("div", {
|
26853 | staticClass: "el-notification__closeBtn el-icon-close",
|
26854 | on: {
|
26855 | click: function($event) {
|
26856 | $event.stopPropagation()
|
26857 | return _vm.close($event)
|
26858 | }
|
26859 | }
|
26860 | })
|
26861 | : _vm._e()
|
26862 | ]
|
26863 | )
|
26864 | ]
|
26865 | )
|
26866 | ])
|
26867 | }
|
26868 | var mainvue_type_template_id_43dbc3d8_staticRenderFns = []
|
26869 | mainvue_type_template_id_43dbc3d8_render._withStripped = true
|
26870 |
|
26871 |
|
26872 |
|
26873 |
|
26874 |
|
26875 |
|
26876 |
|
26877 |
|
26878 |
|
26879 |
|
26880 |
|
26881 |
|
26882 |
|
26883 |
|
26884 |
|
26885 |
|
26886 |
|
26887 |
|
26888 |
|
26889 |
|
26890 |
|
26891 |
|
26892 |
|
26893 |
|
26894 |
|
26895 |
|
26896 |
|
26897 |
|
26898 |
|
26899 |
|
26900 |
|
26901 |
|
26902 |
|
26903 |
|
26904 |
|
26905 |
|
26906 |
|
26907 |
|
26908 |
|
26909 | var mainvue_type_script_lang_js_typeMap = {
|
26910 | success: 'success',
|
26911 | info: 'info',
|
26912 | warning: 'warning',
|
26913 | error: 'error'
|
26914 | };
|
26915 |
|
26916 | var notification_src_mainvue_type_script_lang_js_ = ({
|
26917 | data: function data() {
|
26918 | return {
|
26919 | visible: false,
|
26920 | title: '',
|
26921 | message: '',
|
26922 | duration: 4500,
|
26923 | type: '',
|
26924 | showClose: true,
|
26925 | customClass: '',
|
26926 | iconClass: '',
|
26927 | onClose: null,
|
26928 | onClick: null,
|
26929 | closed: false,
|
26930 | verticalOffset: 0,
|
26931 | timer: null,
|
26932 | dangerouslyUseHTMLString: false,
|
26933 | position: 'top-right'
|
26934 | };
|
26935 | },
|
26936 |
|
26937 |
|
26938 | computed: {
|
26939 | typeClass: function typeClass() {
|
26940 | return this.type && mainvue_type_script_lang_js_typeMap[this.type] ? 'el-icon-' + mainvue_type_script_lang_js_typeMap[this.type] : '';
|
26941 | },
|
26942 | horizontalClass: function horizontalClass() {
|
26943 | return this.position.indexOf('right') > -1 ? 'right' : 'left';
|
26944 | },
|
26945 | verticalProperty: function verticalProperty() {
|
26946 | return (/^top-/.test(this.position) ? 'top' : 'bottom'
|
26947 | );
|
26948 | },
|
26949 | positionStyle: function positionStyle() {
|
26950 | var _ref;
|
26951 |
|
26952 | return _ref = {}, _ref[this.verticalProperty] = this.verticalOffset + 'px', _ref;
|
26953 | }
|
26954 | },
|
26955 |
|
26956 | watch: {
|
26957 | closed: function closed(newVal) {
|
26958 | if (newVal) {
|
26959 | this.visible = false;
|
26960 | this.$el.addEventListener('transitionend', this.destroyElement);
|
26961 | }
|
26962 | }
|
26963 | },
|
26964 |
|
26965 | methods: {
|
26966 | destroyElement: function destroyElement() {
|
26967 | this.$el.removeEventListener('transitionend', this.destroyElement);
|
26968 | this.$destroy(true);
|
26969 | this.$el.parentNode.removeChild(this.$el);
|
26970 | },
|
26971 | click: function click() {
|
26972 | if (typeof this.onClick === 'function') {
|
26973 | this.onClick();
|
26974 | }
|
26975 | },
|
26976 | close: function close() {
|
26977 | this.closed = true;
|
26978 | if (typeof this.onClose === 'function') {
|
26979 | this.onClose();
|
26980 | }
|
26981 | },
|
26982 | clearTimer: function clearTimer() {
|
26983 | clearTimeout(this.timer);
|
26984 | },
|
26985 | startTimer: function startTimer() {
|
26986 | var _this = this;
|
26987 |
|
26988 | if (this.duration > 0) {
|
26989 | this.timer = setTimeout(function () {
|
26990 | if (!_this.closed) {
|
26991 | _this.close();
|
26992 | }
|
26993 | }, this.duration);
|
26994 | }
|
26995 | },
|
26996 | keydown: function keydown(e) {
|
26997 | if (e.keyCode === 46 || e.keyCode === 8) {
|
26998 | this.clearTimer();
|
26999 | } else if (e.keyCode === 27) {
|
27000 |
|
27001 | if (!this.closed) {
|
27002 | this.close();
|
27003 | }
|
27004 | } else {
|
27005 | this.startTimer();
|
27006 | }
|
27007 | }
|
27008 | },
|
27009 | mounted: function mounted() {
|
27010 | var _this2 = this;
|
27011 |
|
27012 | if (this.duration > 0) {
|
27013 | this.timer = setTimeout(function () {
|
27014 | if (!_this2.closed) {
|
27015 | _this2.close();
|
27016 | }
|
27017 | }, this.duration);
|
27018 | }
|
27019 | document.addEventListener('keydown', this.keydown);
|
27020 | },
|
27021 | beforeDestroy: function beforeDestroy() {
|
27022 | document.removeEventListener('keydown', this.keydown);
|
27023 | }
|
27024 | });
|
27025 |
|
27026 | var packages_notification_src_mainvue_type_script_lang_js_ = (notification_src_mainvue_type_script_lang_js_);
|
27027 |
|
27028 |
|
27029 |
|
27030 |
|
27031 |
|
27032 |
|
27033 |
|
27034 |
|
27035 | var notification_src_main_component = normalizeComponent(
|
27036 | packages_notification_src_mainvue_type_script_lang_js_,
|
27037 | mainvue_type_template_id_43dbc3d8_render,
|
27038 | mainvue_type_template_id_43dbc3d8_staticRenderFns,
|
27039 | false,
|
27040 | null,
|
27041 | null,
|
27042 | null
|
27043 |
|
27044 | )
|
27045 |
|
27046 |
|
27047 | if (false) { var notification_src_main_api; }
|
27048 | notification_src_main_component.options.__file = "packages/notification/src/main.vue"
|
27049 | var notification_src_main = (notification_src_main_component.exports);
|
27050 |
|
27051 |
|
27052 |
|
27053 |
|
27054 |
|
27055 |
|
27056 | var NotificationConstructor = external_vue_default.a.extend(notification_src_main);
|
27057 |
|
27058 | var src_main_instance = void 0;
|
27059 | var instances = [];
|
27060 | var seed = 1;
|
27061 |
|
27062 | var main_Notification = function Notification(options) {
|
27063 | if (external_vue_default.a.prototype.$isServer) return;
|
27064 | options = merge_default()({}, options);
|
27065 | var userOnClose = options.onClose;
|
27066 | var id = 'notification_' + seed++;
|
27067 | var position = options.position || 'top-right';
|
27068 |
|
27069 | options.onClose = function () {
|
27070 | Notification.close(id, userOnClose);
|
27071 | };
|
27072 |
|
27073 | src_main_instance = new NotificationConstructor({
|
27074 | data: options
|
27075 | });
|
27076 |
|
27077 | if (Object(vdom_["isVNode"])(options.message)) {
|
27078 | src_main_instance.$slots.default = [options.message];
|
27079 | options.message = 'REPLACED_BY_VNODE';
|
27080 | }
|
27081 | src_main_instance.id = id;
|
27082 | src_main_instance.$mount();
|
27083 | document.body.appendChild(src_main_instance.$el);
|
27084 | src_main_instance.visible = true;
|
27085 | src_main_instance.dom = src_main_instance.$el;
|
27086 | src_main_instance.dom.style.zIndex = popup_["PopupManager"].nextZIndex();
|
27087 |
|
27088 | var verticalOffset = options.offset || 0;
|
27089 | instances.filter(function (item) {
|
27090 | return item.position === position;
|
27091 | }).forEach(function (item) {
|
27092 | verticalOffset += item.$el.offsetHeight + 16;
|
27093 | });
|
27094 | verticalOffset += 16;
|
27095 | src_main_instance.verticalOffset = verticalOffset;
|
27096 | instances.push(src_main_instance);
|
27097 | return src_main_instance;
|
27098 | };
|
27099 |
|
27100 | ['success', 'warning', 'info', 'error'].forEach(function (type) {
|
27101 | main_Notification[type] = function (options) {
|
27102 | if (typeof options === 'string' || Object(vdom_["isVNode"])(options)) {
|
27103 | options = {
|
27104 | message: options
|
27105 | };
|
27106 | }
|
27107 | options.type = type;
|
27108 | return main_Notification(options);
|
27109 | };
|
27110 | });
|
27111 |
|
27112 | main_Notification.close = function (id, userOnClose) {
|
27113 | var index = -1;
|
27114 | var len = instances.length;
|
27115 | var instance = instances.filter(function (instance, i) {
|
27116 | if (instance.id === id) {
|
27117 | index = i;
|
27118 | return true;
|
27119 | }
|
27120 | return false;
|
27121 | })[0];
|
27122 | if (!instance) return;
|
27123 |
|
27124 | if (typeof userOnClose === 'function') {
|
27125 | userOnClose(instance);
|
27126 | }
|
27127 | instances.splice(index, 1);
|
27128 |
|
27129 | if (len <= 1) return;
|
27130 | var position = instance.position;
|
27131 | var removedHeight = instance.dom.offsetHeight;
|
27132 | for (var i = index; i < len - 1; i++) {
|
27133 | if (instances[i].position === position) {
|
27134 | instances[i].dom.style[instance.verticalProperty] = parseInt(instances[i].dom.style[instance.verticalProperty], 10) - removedHeight - 16 + 'px';
|
27135 | }
|
27136 | }
|
27137 | };
|
27138 |
|
27139 | main_Notification.closeAll = function () {
|
27140 | for (var i = instances.length - 1; i >= 0; i--) {
|
27141 | instances[i].close();
|
27142 | }
|
27143 | };
|
27144 |
|
27145 | var packages_notification_src_main = (main_Notification);
|
27146 |
|
27147 |
|
27148 | var notification = (packages_notification_src_main);
|
27149 |
|
27150 | var mainvue_type_template_id_32708644_render = function() {
|
27151 | var _vm = this
|
27152 | var _h = _vm.$createElement
|
27153 | var _c = _vm._self._c || _h
|
27154 | return _c(
|
27155 | "div",
|
27156 | {
|
27157 | staticClass: "el-slider",
|
27158 | class: {
|
27159 | "is-vertical": _vm.vertical,
|
27160 | "el-slider--with-input": _vm.showInput
|
27161 | },
|
27162 | attrs: {
|
27163 | role: "slider",
|
27164 | "aria-valuemin": _vm.min,
|
27165 | "aria-valuemax": _vm.max,
|
27166 | "aria-orientation": _vm.vertical ? "vertical" : "horizontal",
|
27167 | "aria-disabled": _vm.sliderDisabled
|
27168 | }
|
27169 | },
|
27170 | [
|
27171 | _vm.showInput && !_vm.range
|
27172 | ? _c("el-input-number", {
|
27173 | ref: "input",
|
27174 | staticClass: "el-slider__input",
|
27175 | attrs: {
|
27176 | step: _vm.step,
|
27177 | disabled: _vm.sliderDisabled,
|
27178 | controls: _vm.showInputControls,
|
27179 | min: _vm.min,
|
27180 | max: _vm.max,
|
27181 | debounce: _vm.debounce,
|
27182 | size: _vm.inputSize
|
27183 | },
|
27184 | on: { change: _vm.emitChange },
|
27185 | model: {
|
27186 | value: _vm.firstValue,
|
27187 | callback: function($$v) {
|
27188 | _vm.firstValue = $$v
|
27189 | },
|
27190 | expression: "firstValue"
|
27191 | }
|
27192 | })
|
27193 | : _vm._e(),
|
27194 | _c(
|
27195 | "div",
|
27196 | {
|
27197 | ref: "slider",
|
27198 | staticClass: "el-slider__runway",
|
27199 | class: { "show-input": _vm.showInput, disabled: _vm.sliderDisabled },
|
27200 | style: _vm.runwayStyle,
|
27201 | on: { click: _vm.onSliderClick }
|
27202 | },
|
27203 | [
|
27204 | _c("div", { staticClass: "el-slider__bar", style: _vm.barStyle }),
|
27205 | _c("slider-button", {
|
27206 | ref: "button1",
|
27207 | attrs: {
|
27208 | vertical: _vm.vertical,
|
27209 | "tooltip-class": _vm.tooltipClass
|
27210 | },
|
27211 | model: {
|
27212 | value: _vm.firstValue,
|
27213 | callback: function($$v) {
|
27214 | _vm.firstValue = $$v
|
27215 | },
|
27216 | expression: "firstValue"
|
27217 | }
|
27218 | }),
|
27219 | _vm.range
|
27220 | ? _c("slider-button", {
|
27221 | ref: "button2",
|
27222 | attrs: {
|
27223 | vertical: _vm.vertical,
|
27224 | "tooltip-class": _vm.tooltipClass
|
27225 | },
|
27226 | model: {
|
27227 | value: _vm.secondValue,
|
27228 | callback: function($$v) {
|
27229 | _vm.secondValue = $$v
|
27230 | },
|
27231 | expression: "secondValue"
|
27232 | }
|
27233 | })
|
27234 | : _vm._e(),
|
27235 | _vm._l(_vm.stops, function(item, key) {
|
27236 | return _vm.showStops
|
27237 | ? _c("div", {
|
27238 | key: key,
|
27239 | staticClass: "el-slider__stop",
|
27240 | style: _vm.getStopStyle(item)
|
27241 | })
|
27242 | : _vm._e()
|
27243 | }),
|
27244 | _vm.markList.length > 0
|
27245 | ? [
|
27246 | _c(
|
27247 | "div",
|
27248 | _vm._l(_vm.markList, function(item, key) {
|
27249 | return _c("div", {
|
27250 | key: key,
|
27251 | staticClass: "el-slider__stop el-slider__marks-stop",
|
27252 | style: _vm.getStopStyle(item.position)
|
27253 | })
|
27254 | }),
|
27255 | 0
|
27256 | ),
|
27257 | _c(
|
27258 | "div",
|
27259 | { staticClass: "el-slider__marks" },
|
27260 | _vm._l(_vm.markList, function(item, key) {
|
27261 | return _c("slider-marker", {
|
27262 | key: key,
|
27263 | style: _vm.getStopStyle(item.position),
|
27264 | attrs: { mark: item.mark }
|
27265 | })
|
27266 | }),
|
27267 | 1
|
27268 | )
|
27269 | ]
|
27270 | : _vm._e()
|
27271 | ],
|
27272 | 2
|
27273 | )
|
27274 | ],
|
27275 | 1
|
27276 | )
|
27277 | }
|
27278 | var mainvue_type_template_id_32708644_staticRenderFns = []
|
27279 | mainvue_type_template_id_32708644_render._withStripped = true
|
27280 |
|
27281 |
|
27282 |
|
27283 |
|
27284 |
|
27285 | var input_number_ = __webpack_require__(41);
|
27286 | var input_number_default = __webpack_require__.n(input_number_);
|
27287 |
|
27288 |
|
27289 | var buttonvue_type_template_id_e72d2ad2_render = function() {
|
27290 | var _vm = this
|
27291 | var _h = _vm.$createElement
|
27292 | var _c = _vm._self._c || _h
|
27293 | return _c(
|
27294 | "div",
|
27295 | {
|
27296 | ref: "button",
|
27297 | staticClass: "el-slider__button-wrapper",
|
27298 | class: { hover: _vm.hovering, dragging: _vm.dragging },
|
27299 | style: _vm.wrapperStyle,
|
27300 | attrs: { tabindex: "0" },
|
27301 | on: {
|
27302 | mouseenter: _vm.handleMouseEnter,
|
27303 | mouseleave: _vm.handleMouseLeave,
|
27304 | mousedown: _vm.onButtonDown,
|
27305 | touchstart: _vm.onButtonDown,
|
27306 | focus: _vm.handleMouseEnter,
|
27307 | blur: _vm.handleMouseLeave,
|
27308 | keydown: [
|
27309 | function($event) {
|
27310 | if (
|
27311 | !("button" in $event) &&
|
27312 | _vm._k($event.keyCode, "left", 37, $event.key, [
|
27313 | "Left",
|
27314 | "ArrowLeft"
|
27315 | ])
|
27316 | ) {
|
27317 | return null
|
27318 | }
|
27319 | if ("button" in $event && $event.button !== 0) {
|
27320 | return null
|
27321 | }
|
27322 | return _vm.onLeftKeyDown($event)
|
27323 | },
|
27324 | function($event) {
|
27325 | if (
|
27326 | !("button" in $event) &&
|
27327 | _vm._k($event.keyCode, "right", 39, $event.key, [
|
27328 | "Right",
|
27329 | "ArrowRight"
|
27330 | ])
|
27331 | ) {
|
27332 | return null
|
27333 | }
|
27334 | if ("button" in $event && $event.button !== 2) {
|
27335 | return null
|
27336 | }
|
27337 | return _vm.onRightKeyDown($event)
|
27338 | },
|
27339 | function($event) {
|
27340 | if (
|
27341 | !("button" in $event) &&
|
27342 | _vm._k($event.keyCode, "down", 40, $event.key, [
|
27343 | "Down",
|
27344 | "ArrowDown"
|
27345 | ])
|
27346 | ) {
|
27347 | return null
|
27348 | }
|
27349 | $event.preventDefault()
|
27350 | return _vm.onLeftKeyDown($event)
|
27351 | },
|
27352 | function($event) {
|
27353 | if (
|
27354 | !("button" in $event) &&
|
27355 | _vm._k($event.keyCode, "up", 38, $event.key, ["Up", "ArrowUp"])
|
27356 | ) {
|
27357 | return null
|
27358 | }
|
27359 | $event.preventDefault()
|
27360 | return _vm.onRightKeyDown($event)
|
27361 | }
|
27362 | ]
|
27363 | }
|
27364 | },
|
27365 | [
|
27366 | _c(
|
27367 | "el-tooltip",
|
27368 | {
|
27369 | ref: "tooltip",
|
27370 | attrs: {
|
27371 | placement: "top",
|
27372 | "popper-class": _vm.tooltipClass,
|
27373 | disabled: !_vm.showTooltip
|
27374 | }
|
27375 | },
|
27376 | [
|
27377 | _c("span", { attrs: { slot: "content" }, slot: "content" }, [
|
27378 | _vm._v(_vm._s(_vm.formatValue))
|
27379 | ]),
|
27380 | _c("div", {
|
27381 | staticClass: "el-slider__button",
|
27382 | class: { hover: _vm.hovering, dragging: _vm.dragging }
|
27383 | })
|
27384 | ]
|
27385 | )
|
27386 | ],
|
27387 | 1
|
27388 | )
|
27389 | }
|
27390 | var buttonvue_type_template_id_e72d2ad2_staticRenderFns = []
|
27391 | buttonvue_type_template_id_e72d2ad2_render._withStripped = true
|
27392 |
|
27393 |
|
27394 |
|
27395 |
|
27396 |
|
27397 |
|
27398 |
|
27399 |
|
27400 |
|
27401 |
|
27402 |
|
27403 |
|
27404 |
|
27405 |
|
27406 |
|
27407 |
|
27408 |
|
27409 |
|
27410 |
|
27411 |
|
27412 |
|
27413 |
|
27414 |
|
27415 |
|
27416 |
|
27417 |
|
27418 |
|
27419 |
|
27420 |
|
27421 |
|
27422 |
|
27423 |
|
27424 |
|
27425 |
|
27426 |
|
27427 |
|
27428 |
|
27429 | var slider_src_buttonvue_type_script_lang_js_ = ({
|
27430 | name: 'ElSliderButton',
|
27431 |
|
27432 | components: {
|
27433 | ElTooltip: tooltip_default.a
|
27434 | },
|
27435 |
|
27436 | props: {
|
27437 | value: {
|
27438 | type: Number,
|
27439 | default: 0
|
27440 | },
|
27441 | vertical: {
|
27442 | type: Boolean,
|
27443 | default: false
|
27444 | },
|
27445 | tooltipClass: String
|
27446 | },
|
27447 |
|
27448 | data: function data() {
|
27449 | return {
|
27450 | hovering: false,
|
27451 | dragging: false,
|
27452 | isClick: false,
|
27453 | startX: 0,
|
27454 | currentX: 0,
|
27455 | startY: 0,
|
27456 | currentY: 0,
|
27457 | startPosition: 0,
|
27458 | newPosition: null,
|
27459 | oldValue: this.value
|
27460 | };
|
27461 | },
|
27462 |
|
27463 |
|
27464 | computed: {
|
27465 | disabled: function disabled() {
|
27466 | return this.$parent.sliderDisabled;
|
27467 | },
|
27468 | max: function max() {
|
27469 | return this.$parent.max;
|
27470 | },
|
27471 | min: function min() {
|
27472 | return this.$parent.min;
|
27473 | },
|
27474 | step: function step() {
|
27475 | return this.$parent.step;
|
27476 | },
|
27477 | showTooltip: function showTooltip() {
|
27478 | return this.$parent.showTooltip;
|
27479 | },
|
27480 | precision: function precision() {
|
27481 | return this.$parent.precision;
|
27482 | },
|
27483 | currentPosition: function currentPosition() {
|
27484 | return (this.value - this.min) / (this.max - this.min) * 100 + '%';
|
27485 | },
|
27486 | enableFormat: function enableFormat() {
|
27487 | return this.$parent.formatTooltip instanceof Function;
|
27488 | },
|
27489 | formatValue: function formatValue() {
|
27490 | return this.enableFormat && this.$parent.formatTooltip(this.value) || this.value;
|
27491 | },
|
27492 | wrapperStyle: function wrapperStyle() {
|
27493 | return this.vertical ? { bottom: this.currentPosition } : { left: this.currentPosition };
|
27494 | }
|
27495 | },
|
27496 |
|
27497 | watch: {
|
27498 | dragging: function dragging(val) {
|
27499 | this.$parent.dragging = val;
|
27500 | }
|
27501 | },
|
27502 |
|
27503 | methods: {
|
27504 | displayTooltip: function displayTooltip() {
|
27505 | this.$refs.tooltip && (this.$refs.tooltip.showPopper = true);
|
27506 | },
|
27507 | hideTooltip: function hideTooltip() {
|
27508 | this.$refs.tooltip && (this.$refs.tooltip.showPopper = false);
|
27509 | },
|
27510 | handleMouseEnter: function handleMouseEnter() {
|
27511 | this.hovering = true;
|
27512 | this.displayTooltip();
|
27513 | },
|
27514 | handleMouseLeave: function handleMouseLeave() {
|
27515 | this.hovering = false;
|
27516 | this.hideTooltip();
|
27517 | },
|
27518 | onButtonDown: function onButtonDown(event) {
|
27519 | if (this.disabled) return;
|
27520 | event.preventDefault();
|
27521 | this.onDragStart(event);
|
27522 | window.addEventListener('mousemove', this.onDragging);
|
27523 | window.addEventListener('touchmove', this.onDragging);
|
27524 | window.addEventListener('mouseup', this.onDragEnd);
|
27525 | window.addEventListener('touchend', this.onDragEnd);
|
27526 | window.addEventListener('contextmenu', this.onDragEnd);
|
27527 | },
|
27528 | onLeftKeyDown: function onLeftKeyDown() {
|
27529 | if (this.disabled) return;
|
27530 | this.newPosition = parseFloat(this.currentPosition) - this.step / (this.max - this.min) * 100;
|
27531 | this.setPosition(this.newPosition);
|
27532 | this.$parent.emitChange();
|
27533 | },
|
27534 | onRightKeyDown: function onRightKeyDown() {
|
27535 | if (this.disabled) return;
|
27536 | this.newPosition = parseFloat(this.currentPosition) + this.step / (this.max - this.min) * 100;
|
27537 | this.setPosition(this.newPosition);
|
27538 | this.$parent.emitChange();
|
27539 | },
|
27540 | onDragStart: function onDragStart(event) {
|
27541 | this.dragging = true;
|
27542 | this.isClick = true;
|
27543 | if (event.type === 'touchstart') {
|
27544 | event.clientY = event.touches[0].clientY;
|
27545 | event.clientX = event.touches[0].clientX;
|
27546 | }
|
27547 | if (this.vertical) {
|
27548 | this.startY = event.clientY;
|
27549 | } else {
|
27550 | this.startX = event.clientX;
|
27551 | }
|
27552 | this.startPosition = parseFloat(this.currentPosition);
|
27553 | this.newPosition = this.startPosition;
|
27554 | },
|
27555 | onDragging: function onDragging(event) {
|
27556 | if (this.dragging) {
|
27557 | this.isClick = false;
|
27558 | this.displayTooltip();
|
27559 | this.$parent.resetSize();
|
27560 | var diff = 0;
|
27561 | if (event.type === 'touchmove') {
|
27562 | event.clientY = event.touches[0].clientY;
|
27563 | event.clientX = event.touches[0].clientX;
|
27564 | }
|
27565 | if (this.vertical) {
|
27566 | this.currentY = event.clientY;
|
27567 | diff = (this.startY - this.currentY) / this.$parent.sliderSize * 100;
|
27568 | } else {
|
27569 | this.currentX = event.clientX;
|
27570 | diff = (this.currentX - this.startX) / this.$parent.sliderSize * 100;
|
27571 | }
|
27572 | this.newPosition = this.startPosition + diff;
|
27573 | this.setPosition(this.newPosition);
|
27574 | }
|
27575 | },
|
27576 | onDragEnd: function onDragEnd() {
|
27577 | var _this = this;
|
27578 |
|
27579 | if (this.dragging) {
|
27580 | |
27581 |
|
27582 |
|
27583 |
|
27584 | setTimeout(function () {
|
27585 | _this.dragging = false;
|
27586 | _this.hideTooltip();
|
27587 | if (!_this.isClick) {
|
27588 | _this.setPosition(_this.newPosition);
|
27589 | _this.$parent.emitChange();
|
27590 | }
|
27591 | }, 0);
|
27592 | window.removeEventListener('mousemove', this.onDragging);
|
27593 | window.removeEventListener('touchmove', this.onDragging);
|
27594 | window.removeEventListener('mouseup', this.onDragEnd);
|
27595 | window.removeEventListener('touchend', this.onDragEnd);
|
27596 | window.removeEventListener('contextmenu', this.onDragEnd);
|
27597 | }
|
27598 | },
|
27599 | setPosition: function setPosition(newPosition) {
|
27600 | var _this2 = this;
|
27601 |
|
27602 | if (newPosition === null || isNaN(newPosition)) return;
|
27603 | if (newPosition < 0) {
|
27604 | newPosition = 0;
|
27605 | } else if (newPosition > 100) {
|
27606 | newPosition = 100;
|
27607 | }
|
27608 | var lengthPerStep = 100 / ((this.max - this.min) / this.step);
|
27609 | var steps = Math.round(newPosition / lengthPerStep);
|
27610 | var value = steps * lengthPerStep * (this.max - this.min) * 0.01 + this.min;
|
27611 | value = parseFloat(value.toFixed(this.precision));
|
27612 | this.$emit('input', value);
|
27613 | this.$nextTick(function () {
|
27614 | _this2.displayTooltip();
|
27615 | _this2.$refs.tooltip && _this2.$refs.tooltip.updatePopper();
|
27616 | });
|
27617 | if (!this.dragging && this.value !== this.oldValue) {
|
27618 | this.oldValue = this.value;
|
27619 | }
|
27620 | }
|
27621 | }
|
27622 | });
|
27623 |
|
27624 | var packages_slider_src_buttonvue_type_script_lang_js_ = (slider_src_buttonvue_type_script_lang_js_);
|
27625 |
|
27626 |
|
27627 |
|
27628 |
|
27629 |
|
27630 |
|
27631 |
|
27632 |
|
27633 | var src_button_component = normalizeComponent(
|
27634 | packages_slider_src_buttonvue_type_script_lang_js_,
|
27635 | buttonvue_type_template_id_e72d2ad2_render,
|
27636 | buttonvue_type_template_id_e72d2ad2_staticRenderFns,
|
27637 | false,
|
27638 | null,
|
27639 | null,
|
27640 | null
|
27641 |
|
27642 | )
|
27643 |
|
27644 |
|
27645 | if (false) { var src_button_api; }
|
27646 | src_button_component.options.__file = "packages/slider/src/button.vue"
|
27647 | var slider_src_button = (src_button_component.exports);
|
27648 |
|
27649 | var marker = ({
|
27650 | name: 'ElMarker',
|
27651 |
|
27652 | props: {
|
27653 | mark: {
|
27654 | type: [String, Object]
|
27655 | }
|
27656 | },
|
27657 | render: function render() {
|
27658 | var h = arguments[0];
|
27659 |
|
27660 | var label = typeof this.mark === 'string' ? this.mark : this.mark.label;
|
27661 |
|
27662 | return h(
|
27663 | 'div',
|
27664 | { 'class': 'el-slider__marks-text', style: this.mark.style || {} },
|
27665 | [label]
|
27666 | );
|
27667 | }
|
27668 | });
|
27669 |
|
27670 |
|
27671 |
|
27672 |
|
27673 |
|
27674 |
|
27675 |
|
27676 |
|
27677 |
|
27678 |
|
27679 |
|
27680 |
|
27681 |
|
27682 |
|
27683 |
|
27684 |
|
27685 |
|
27686 |
|
27687 |
|
27688 |
|
27689 |
|
27690 |
|
27691 |
|
27692 |
|
27693 |
|
27694 |
|
27695 |
|
27696 |
|
27697 |
|
27698 |
|
27699 |
|
27700 |
|
27701 |
|
27702 |
|
27703 |
|
27704 |
|
27705 |
|
27706 |
|
27707 |
|
27708 |
|
27709 |
|
27710 |
|
27711 |
|
27712 |
|
27713 |
|
27714 |
|
27715 |
|
27716 |
|
27717 |
|
27718 |
|
27719 |
|
27720 |
|
27721 |
|
27722 |
|
27723 |
|
27724 |
|
27725 |
|
27726 |
|
27727 |
|
27728 |
|
27729 |
|
27730 |
|
27731 |
|
27732 |
|
27733 |
|
27734 |
|
27735 |
|
27736 |
|
27737 |
|
27738 |
|
27739 |
|
27740 |
|
27741 |
|
27742 |
|
27743 |
|
27744 |
|
27745 |
|
27746 |
|
27747 |
|
27748 |
|
27749 |
|
27750 |
|
27751 | var slider_src_mainvue_type_script_lang_js_ = ({
|
27752 | name: 'ElSlider',
|
27753 |
|
27754 | mixins: [emitter_default.a],
|
27755 |
|
27756 | inject: {
|
27757 | elForm: {
|
27758 | default: ''
|
27759 | }
|
27760 | },
|
27761 |
|
27762 | props: {
|
27763 | min: {
|
27764 | type: Number,
|
27765 | default: 0
|
27766 | },
|
27767 | max: {
|
27768 | type: Number,
|
27769 | default: 100
|
27770 | },
|
27771 | step: {
|
27772 | type: Number,
|
27773 | default: 1
|
27774 | },
|
27775 | value: {
|
27776 | type: [Number, Array],
|
27777 | default: 0
|
27778 | },
|
27779 | showInput: {
|
27780 | type: Boolean,
|
27781 | default: false
|
27782 | },
|
27783 | showInputControls: {
|
27784 | type: Boolean,
|
27785 | default: true
|
27786 | },
|
27787 | inputSize: {
|
27788 | type: String,
|
27789 | default: 'small'
|
27790 | },
|
27791 | showStops: {
|
27792 | type: Boolean,
|
27793 | default: false
|
27794 | },
|
27795 | showTooltip: {
|
27796 | type: Boolean,
|
27797 | default: true
|
27798 | },
|
27799 | formatTooltip: Function,
|
27800 | disabled: {
|
27801 | type: Boolean,
|
27802 | default: false
|
27803 | },
|
27804 | range: {
|
27805 | type: Boolean,
|
27806 | default: false
|
27807 | },
|
27808 | vertical: {
|
27809 | type: Boolean,
|
27810 | default: false
|
27811 | },
|
27812 | height: {
|
27813 | type: String
|
27814 | },
|
27815 | debounce: {
|
27816 | type: Number,
|
27817 | default: 300
|
27818 | },
|
27819 | label: {
|
27820 | type: String
|
27821 | },
|
27822 | tooltipClass: String,
|
27823 | marks: Object
|
27824 | },
|
27825 |
|
27826 | components: {
|
27827 | ElInputNumber: input_number_default.a,
|
27828 | SliderButton: slider_src_button,
|
27829 | SliderMarker: marker
|
27830 | },
|
27831 |
|
27832 | data: function data() {
|
27833 | return {
|
27834 | firstValue: null,
|
27835 | secondValue: null,
|
27836 | oldValue: null,
|
27837 | dragging: false,
|
27838 | sliderSize: 1
|
27839 | };
|
27840 | },
|
27841 |
|
27842 |
|
27843 | watch: {
|
27844 | value: function value(val, oldVal) {
|
27845 | if (this.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every(function (item, index) {
|
27846 | return item === oldVal[index];
|
27847 | })) {
|
27848 | return;
|
27849 | }
|
27850 | this.setValues();
|
27851 | },
|
27852 | dragging: function dragging(val) {
|
27853 | if (!val) {
|
27854 | this.setValues();
|
27855 | }
|
27856 | },
|
27857 | firstValue: function firstValue(val) {
|
27858 | if (this.range) {
|
27859 | this.$emit('input', [this.minValue, this.maxValue]);
|
27860 | } else {
|
27861 | this.$emit('input', val);
|
27862 | }
|
27863 | },
|
27864 | secondValue: function secondValue() {
|
27865 | if (this.range) {
|
27866 | this.$emit('input', [this.minValue, this.maxValue]);
|
27867 | }
|
27868 | },
|
27869 | min: function min() {
|
27870 | this.setValues();
|
27871 | },
|
27872 | max: function max() {
|
27873 | this.setValues();
|
27874 | }
|
27875 | },
|
27876 |
|
27877 | methods: {
|
27878 | valueChanged: function valueChanged() {
|
27879 | var _this = this;
|
27880 |
|
27881 | if (this.range) {
|
27882 | return ![this.minValue, this.maxValue].every(function (item, index) {
|
27883 | return item === _this.oldValue[index];
|
27884 | });
|
27885 | } else {
|
27886 | return this.value !== this.oldValue;
|
27887 | }
|
27888 | },
|
27889 | setValues: function setValues() {
|
27890 | if (this.min > this.max) {
|
27891 | console.error('[Element Error][Slider]min should not be greater than max.');
|
27892 | return;
|
27893 | }
|
27894 | var val = this.value;
|
27895 | if (this.range && Array.isArray(val)) {
|
27896 | if (val[1] < this.min) {
|
27897 | this.$emit('input', [this.min, this.min]);
|
27898 | } else if (val[0] > this.max) {
|
27899 | this.$emit('input', [this.max, this.max]);
|
27900 | } else if (val[0] < this.min) {
|
27901 | this.$emit('input', [this.min, val[1]]);
|
27902 | } else if (val[1] > this.max) {
|
27903 | this.$emit('input', [val[0], this.max]);
|
27904 | } else {
|
27905 | this.firstValue = val[0];
|
27906 | this.secondValue = val[1];
|
27907 | if (this.valueChanged()) {
|
27908 | this.dispatch('ElFormItem', 'el.form.change', [this.minValue, this.maxValue]);
|
27909 | this.oldValue = val.slice();
|
27910 | }
|
27911 | }
|
27912 | } else if (!this.range && typeof val === 'number' && !isNaN(val)) {
|
27913 | if (val < this.min) {
|
27914 | this.$emit('input', this.min);
|
27915 | } else if (val > this.max) {
|
27916 | this.$emit('input', this.max);
|
27917 | } else {
|
27918 | this.firstValue = val;
|
27919 | if (this.valueChanged()) {
|
27920 | this.dispatch('ElFormItem', 'el.form.change', val);
|
27921 | this.oldValue = val;
|
27922 | }
|
27923 | }
|
27924 | }
|
27925 | },
|
27926 | setPosition: function setPosition(percent) {
|
27927 | var targetValue = this.min + percent * (this.max - this.min) / 100;
|
27928 | if (!this.range) {
|
27929 | this.$refs.button1.setPosition(percent);
|
27930 | return;
|
27931 | }
|
27932 | var button = void 0;
|
27933 | if (Math.abs(this.minValue - targetValue) < Math.abs(this.maxValue - targetValue)) {
|
27934 | button = this.firstValue < this.secondValue ? 'button1' : 'button2';
|
27935 | } else {
|
27936 | button = this.firstValue > this.secondValue ? 'button1' : 'button2';
|
27937 | }
|
27938 | this.$refs[button].setPosition(percent);
|
27939 | },
|
27940 | onSliderClick: function onSliderClick(event) {
|
27941 | if (this.sliderDisabled || this.dragging) return;
|
27942 | this.resetSize();
|
27943 | if (this.vertical) {
|
27944 | var sliderOffsetBottom = this.$refs.slider.getBoundingClientRect().bottom;
|
27945 | this.setPosition((sliderOffsetBottom - event.clientY) / this.sliderSize * 100);
|
27946 | } else {
|
27947 | var sliderOffsetLeft = this.$refs.slider.getBoundingClientRect().left;
|
27948 | this.setPosition((event.clientX - sliderOffsetLeft) / this.sliderSize * 100);
|
27949 | }
|
27950 | this.emitChange();
|
27951 | },
|
27952 | resetSize: function resetSize() {
|
27953 | if (this.$refs.slider) {
|
27954 | this.sliderSize = this.$refs.slider['client' + (this.vertical ? 'Height' : 'Width')];
|
27955 | }
|
27956 | },
|
27957 | emitChange: function emitChange() {
|
27958 | var _this2 = this;
|
27959 |
|
27960 | this.$nextTick(function () {
|
27961 | _this2.$emit('change', _this2.range ? [_this2.minValue, _this2.maxValue] : _this2.value);
|
27962 | });
|
27963 | },
|
27964 | getStopStyle: function getStopStyle(position) {
|
27965 | return this.vertical ? { 'bottom': position + '%' } : { 'left': position + '%' };
|
27966 | }
|
27967 | },
|
27968 |
|
27969 | computed: {
|
27970 | stops: function stops() {
|
27971 | var _this3 = this;
|
27972 |
|
27973 | if (!this.showStops || this.min > this.max) return [];
|
27974 | if (this.step === 0) {
|
27975 | false && false;
|
27976 | return [];
|
27977 | }
|
27978 | var stopCount = (this.max - this.min) / this.step;
|
27979 | var stepWidth = 100 * this.step / (this.max - this.min);
|
27980 | var result = [];
|
27981 | for (var i = 1; i < stopCount; i++) {
|
27982 | result.push(i * stepWidth);
|
27983 | }
|
27984 | if (this.range) {
|
27985 | return result.filter(function (step) {
|
27986 | return step < 100 * (_this3.minValue - _this3.min) / (_this3.max - _this3.min) || step > 100 * (_this3.maxValue - _this3.min) / (_this3.max - _this3.min);
|
27987 | });
|
27988 | } else {
|
27989 | return result.filter(function (step) {
|
27990 | return step > 100 * (_this3.firstValue - _this3.min) / (_this3.max - _this3.min);
|
27991 | });
|
27992 | }
|
27993 | },
|
27994 | markList: function markList() {
|
27995 | var _this4 = this;
|
27996 |
|
27997 | if (!this.marks) {
|
27998 | return [];
|
27999 | }
|
28000 |
|
28001 | var marksKeys = Object.keys(this.marks);
|
28002 | return marksKeys.map(parseFloat).sort(function (a, b) {
|
28003 | return a - b;
|
28004 | }).filter(function (point) {
|
28005 | return point <= _this4.max && point >= _this4.min;
|
28006 | }).map(function (point) {
|
28007 | return {
|
28008 | point: point,
|
28009 | position: (point - _this4.min) * 100 / (_this4.max - _this4.min),
|
28010 | mark: _this4.marks[point]
|
28011 | };
|
28012 | });
|
28013 | },
|
28014 | minValue: function minValue() {
|
28015 | return Math.min(this.firstValue, this.secondValue);
|
28016 | },
|
28017 | maxValue: function maxValue() {
|
28018 | return Math.max(this.firstValue, this.secondValue);
|
28019 | },
|
28020 | barSize: function barSize() {
|
28021 | return this.range ? 100 * (this.maxValue - this.minValue) / (this.max - this.min) + '%' : 100 * (this.firstValue - this.min) / (this.max - this.min) + '%';
|
28022 | },
|
28023 | barStart: function barStart() {
|
28024 | return this.range ? 100 * (this.minValue - this.min) / (this.max - this.min) + '%' : '0%';
|
28025 | },
|
28026 | precision: function precision() {
|
28027 | var precisions = [this.min, this.max, this.step].map(function (item) {
|
28028 | var decimal = ('' + item).split('.')[1];
|
28029 | return decimal ? decimal.length : 0;
|
28030 | });
|
28031 | return Math.max.apply(null, precisions);
|
28032 | },
|
28033 | runwayStyle: function runwayStyle() {
|
28034 | return this.vertical ? { height: this.height } : {};
|
28035 | },
|
28036 | barStyle: function barStyle() {
|
28037 | return this.vertical ? {
|
28038 | height: this.barSize,
|
28039 | bottom: this.barStart
|
28040 | } : {
|
28041 | width: this.barSize,
|
28042 | left: this.barStart
|
28043 | };
|
28044 | },
|
28045 | sliderDisabled: function sliderDisabled() {
|
28046 | return this.disabled || (this.elForm || {}).disabled;
|
28047 | }
|
28048 | },
|
28049 |
|
28050 | mounted: function mounted() {
|
28051 | var valuetext = void 0;
|
28052 | if (this.range) {
|
28053 | if (Array.isArray(this.value)) {
|
28054 | this.firstValue = Math.max(this.min, this.value[0]);
|
28055 | this.secondValue = Math.min(this.max, this.value[1]);
|
28056 | } else {
|
28057 | this.firstValue = this.min;
|
28058 | this.secondValue = this.max;
|
28059 | }
|
28060 | this.oldValue = [this.firstValue, this.secondValue];
|
28061 | valuetext = this.firstValue + '-' + this.secondValue;
|
28062 | } else {
|
28063 | if (typeof this.value !== 'number' || isNaN(this.value)) {
|
28064 | this.firstValue = this.min;
|
28065 | } else {
|
28066 | this.firstValue = Math.min(this.max, Math.max(this.min, this.value));
|
28067 | }
|
28068 | this.oldValue = this.firstValue;
|
28069 | valuetext = this.firstValue;
|
28070 | }
|
28071 | this.$el.setAttribute('aria-valuetext', valuetext);
|
28072 |
|
28073 |
|
28074 | this.$el.setAttribute('aria-label', this.label ? this.label : 'slider between ' + this.min + ' and ' + this.max);
|
28075 |
|
28076 | this.resetSize();
|
28077 | window.addEventListener('resize', this.resetSize);
|
28078 | },
|
28079 | beforeDestroy: function beforeDestroy() {
|
28080 | window.removeEventListener('resize', this.resetSize);
|
28081 | }
|
28082 | });
|
28083 |
|
28084 | var packages_slider_src_mainvue_type_script_lang_js_ = (slider_src_mainvue_type_script_lang_js_);
|
28085 |
|
28086 |
|
28087 |
|
28088 |
|
28089 |
|
28090 |
|
28091 |
|
28092 |
|
28093 | var slider_src_main_component = normalizeComponent(
|
28094 | packages_slider_src_mainvue_type_script_lang_js_,
|
28095 | mainvue_type_template_id_32708644_render,
|
28096 | mainvue_type_template_id_32708644_staticRenderFns,
|
28097 | false,
|
28098 | null,
|
28099 | null,
|
28100 | null
|
28101 |
|
28102 | )
|
28103 |
|
28104 |
|
28105 | if (false) { var slider_src_main_api; }
|
28106 | slider_src_main_component.options.__file = "packages/slider/src/main.vue"
|
28107 | var slider_src_main = (slider_src_main_component.exports);
|
28108 |
|
28109 |
|
28110 |
|
28111 |
|
28112 | slider_src_main.install = function (Vue) {
|
28113 | Vue.component(slider_src_main.name, slider_src_main);
|
28114 | };
|
28115 |
|
28116 | var slider = (slider_src_main);
|
28117 |
|
28118 | var loadingvue_type_template_id_eee0a7ac_render = function() {
|
28119 | var _vm = this
|
28120 | var _h = _vm.$createElement
|
28121 | var _c = _vm._self._c || _h
|
28122 | return _c(
|
28123 | "transition",
|
28124 | {
|
28125 | attrs: { name: "el-loading-fade" },
|
28126 | on: { "after-leave": _vm.handleAfterLeave }
|
28127 | },
|
28128 | [
|
28129 | _c(
|
28130 | "div",
|
28131 | {
|
28132 | directives: [
|
28133 | {
|
28134 | name: "show",
|
28135 | rawName: "v-show",
|
28136 | value: _vm.visible,
|
28137 | expression: "visible"
|
28138 | }
|
28139 | ],
|
28140 | staticClass: "el-loading-mask",
|
28141 | class: [_vm.customClass, { "is-fullscreen": _vm.fullscreen }],
|
28142 | style: { backgroundColor: _vm.background || "" }
|
28143 | },
|
28144 | [
|
28145 | _c("div", { staticClass: "el-loading-spinner" }, [
|
28146 | !_vm.spinner
|
28147 | ? _c(
|
28148 | "svg",
|
28149 | {
|
28150 | staticClass: "circular",
|
28151 | attrs: { viewBox: "25 25 50 50" }
|
28152 | },
|
28153 | [
|
28154 | _c("circle", {
|
28155 | staticClass: "path",
|
28156 | attrs: { cx: "50", cy: "50", r: "20", fill: "none" }
|
28157 | })
|
28158 | ]
|
28159 | )
|
28160 | : _c("i", { class: _vm.spinner }),
|
28161 | _vm.text
|
28162 | ? _c("p", { staticClass: "el-loading-text" }, [
|
28163 | _vm._v(_vm._s(_vm.text))
|
28164 | ])
|
28165 | : _vm._e()
|
28166 | ])
|
28167 | ]
|
28168 | )
|
28169 | ]
|
28170 | )
|
28171 | }
|
28172 | var loadingvue_type_template_id_eee0a7ac_staticRenderFns = []
|
28173 | loadingvue_type_template_id_eee0a7ac_render._withStripped = true
|
28174 |
|
28175 |
|
28176 |
|
28177 |
|
28178 |
|
28179 |
|
28180 |
|
28181 |
|
28182 |
|
28183 |
|
28184 |
|
28185 |
|
28186 |
|
28187 |
|
28188 |
|
28189 |
|
28190 |
|
28191 |
|
28192 |
|
28193 |
|
28194 |
|
28195 |
|
28196 |
|
28197 |
|
28198 | var loadingvue_type_script_lang_js_ = ({
|
28199 | data: function data() {
|
28200 | return {
|
28201 | text: null,
|
28202 | spinner: null,
|
28203 | background: null,
|
28204 | fullscreen: true,
|
28205 | visible: false,
|
28206 | customClass: ''
|
28207 | };
|
28208 | },
|
28209 |
|
28210 |
|
28211 | methods: {
|
28212 | handleAfterLeave: function handleAfterLeave() {
|
28213 | this.$emit('after-leave');
|
28214 | },
|
28215 | setText: function setText(text) {
|
28216 | this.text = text;
|
28217 | }
|
28218 | }
|
28219 | });
|
28220 |
|
28221 | var src_loadingvue_type_script_lang_js_ = (loadingvue_type_script_lang_js_);
|
28222 |
|
28223 |
|
28224 |
|
28225 |
|
28226 |
|
28227 |
|
28228 |
|
28229 |
|
28230 | var loading_component = normalizeComponent(
|
28231 | src_loadingvue_type_script_lang_js_,
|
28232 | loadingvue_type_template_id_eee0a7ac_render,
|
28233 | loadingvue_type_template_id_eee0a7ac_staticRenderFns,
|
28234 | false,
|
28235 | null,
|
28236 | null,
|
28237 | null
|
28238 |
|
28239 | )
|
28240 |
|
28241 |
|
28242 | if (false) { var loading_api; }
|
28243 | loading_component.options.__file = "packages/loading/src/loading.vue"
|
28244 | var loading = (loading_component.exports);
|
28245 |
|
28246 | var after_leave_ = __webpack_require__(33);
|
28247 | var after_leave_default = __webpack_require__.n(after_leave_);
|
28248 |
|
28249 |
|
28250 |
|
28251 |
|
28252 |
|
28253 |
|
28254 |
|
28255 | var Mask = external_vue_default.a.extend(loading);
|
28256 |
|
28257 | var loadingDirective = {};
|
28258 | loadingDirective.install = function (Vue) {
|
28259 | if (Vue.prototype.$isServer) return;
|
28260 | var toggleLoading = function toggleLoading(el, binding) {
|
28261 | if (binding.value) {
|
28262 | Vue.nextTick(function () {
|
28263 | if (binding.modifiers.fullscreen) {
|
28264 | el.originalPosition = Object(dom_["getStyle"])(document.body, 'position');
|
28265 | el.originalOverflow = Object(dom_["getStyle"])(document.body, 'overflow');
|
28266 | el.maskStyle.zIndex = popup_["PopupManager"].nextZIndex();
|
28267 |
|
28268 | Object(dom_["addClass"])(el.mask, 'is-fullscreen');
|
28269 | insertDom(document.body, el, binding);
|
28270 | } else {
|
28271 | Object(dom_["removeClass"])(el.mask, 'is-fullscreen');
|
28272 |
|
28273 | if (binding.modifiers.body) {
|
28274 | el.originalPosition = Object(dom_["getStyle"])(document.body, 'position');
|
28275 |
|
28276 | ['top', 'left'].forEach(function (property) {
|
28277 | var scroll = property === 'top' ? 'scrollTop' : 'scrollLeft';
|
28278 | el.maskStyle[property] = el.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - parseInt(Object(dom_["getStyle"])(document.body, 'margin-' + property), 10) + 'px';
|
28279 | });
|
28280 | ['height', 'width'].forEach(function (property) {
|
28281 | el.maskStyle[property] = el.getBoundingClientRect()[property] + 'px';
|
28282 | });
|
28283 |
|
28284 | insertDom(document.body, el, binding);
|
28285 | } else {
|
28286 | el.originalPosition = Object(dom_["getStyle"])(el, 'position');
|
28287 | insertDom(el, el, binding);
|
28288 | }
|
28289 | }
|
28290 | });
|
28291 | } else {
|
28292 | after_leave_default()(el.instance, function (_) {
|
28293 | if (!el.instance.hiding) return;
|
28294 | el.domVisible = false;
|
28295 | var target = binding.modifiers.fullscreen || binding.modifiers.body ? document.body : el;
|
28296 | Object(dom_["removeClass"])(target, 'el-loading-parent--relative');
|
28297 | Object(dom_["removeClass"])(target, 'el-loading-parent--hidden');
|
28298 | el.instance.hiding = false;
|
28299 | }, 300, true);
|
28300 | el.instance.visible = false;
|
28301 | el.instance.hiding = true;
|
28302 | }
|
28303 | };
|
28304 | var insertDom = function insertDom(parent, el, binding) {
|
28305 | if (!el.domVisible && Object(dom_["getStyle"])(el, 'display') !== 'none' && Object(dom_["getStyle"])(el, 'visibility') !== 'hidden') {
|
28306 | Object.keys(el.maskStyle).forEach(function (property) {
|
28307 | el.mask.style[property] = el.maskStyle[property];
|
28308 | });
|
28309 |
|
28310 | if (el.originalPosition !== 'absolute' && el.originalPosition !== 'fixed') {
|
28311 | Object(dom_["addClass"])(parent, 'el-loading-parent--relative');
|
28312 | }
|
28313 | if (binding.modifiers.fullscreen && binding.modifiers.lock) {
|
28314 | Object(dom_["addClass"])(parent, 'el-loading-parent--hidden');
|
28315 | }
|
28316 | el.domVisible = true;
|
28317 |
|
28318 | parent.appendChild(el.mask);
|
28319 | Vue.nextTick(function () {
|
28320 | if (el.instance.hiding) {
|
28321 | el.instance.$emit('after-leave');
|
28322 | } else {
|
28323 | el.instance.visible = true;
|
28324 | }
|
28325 | });
|
28326 | el.domInserted = true;
|
28327 | } else if (el.domVisible && el.instance.hiding === true) {
|
28328 | el.instance.visible = true;
|
28329 | el.instance.hiding = false;
|
28330 | }
|
28331 | };
|
28332 |
|
28333 | Vue.directive('loading', {
|
28334 | bind: function bind(el, binding, vnode) {
|
28335 | var textExr = el.getAttribute('element-loading-text');
|
28336 | var spinnerExr = el.getAttribute('element-loading-spinner');
|
28337 | var backgroundExr = el.getAttribute('element-loading-background');
|
28338 | var customClassExr = el.getAttribute('element-loading-custom-class');
|
28339 | var vm = vnode.context;
|
28340 | var mask = new Mask({
|
28341 | el: document.createElement('div'),
|
28342 | data: {
|
28343 | text: vm && vm[textExr] || textExr,
|
28344 | spinner: vm && vm[spinnerExr] || spinnerExr,
|
28345 | background: vm && vm[backgroundExr] || backgroundExr,
|
28346 | customClass: vm && vm[customClassExr] || customClassExr,
|
28347 | fullscreen: !!binding.modifiers.fullscreen
|
28348 | }
|
28349 | });
|
28350 | el.instance = mask;
|
28351 | el.mask = mask.$el;
|
28352 | el.maskStyle = {};
|
28353 |
|
28354 | binding.value && toggleLoading(el, binding);
|
28355 | },
|
28356 |
|
28357 | update: function update(el, binding) {
|
28358 | el.instance.setText(el.getAttribute('element-loading-text'));
|
28359 | if (binding.oldValue !== binding.value) {
|
28360 | toggleLoading(el, binding);
|
28361 | }
|
28362 | },
|
28363 |
|
28364 | unbind: function unbind(el, binding) {
|
28365 | if (el.domInserted) {
|
28366 | el.mask && el.mask.parentNode && el.mask.parentNode.removeChild(el.mask);
|
28367 | toggleLoading(el, { value: false, modifiers: binding.modifiers });
|
28368 | }
|
28369 | el.instance && el.instance.$destroy();
|
28370 | }
|
28371 | });
|
28372 | };
|
28373 |
|
28374 | var src_directive = (loadingDirective);
|
28375 |
|
28376 |
|
28377 |
|
28378 |
|
28379 |
|
28380 |
|
28381 |
|
28382 |
|
28383 | var LoadingConstructor = external_vue_default.a.extend(loading);
|
28384 |
|
28385 | var src_defaults = {
|
28386 | text: null,
|
28387 | fullscreen: true,
|
28388 | body: false,
|
28389 | lock: false,
|
28390 | customClass: ''
|
28391 | };
|
28392 |
|
28393 | var fullscreenLoading = void 0;
|
28394 |
|
28395 | LoadingConstructor.prototype.originalPosition = '';
|
28396 | LoadingConstructor.prototype.originalOverflow = '';
|
28397 |
|
28398 | LoadingConstructor.prototype.close = function () {
|
28399 | var _this = this;
|
28400 |
|
28401 | if (this.fullscreen) {
|
28402 | fullscreenLoading = undefined;
|
28403 | }
|
28404 | after_leave_default()(this, function (_) {
|
28405 | var target = _this.fullscreen || _this.body ? document.body : _this.target;
|
28406 | Object(dom_["removeClass"])(target, 'el-loading-parent--relative');
|
28407 | Object(dom_["removeClass"])(target, 'el-loading-parent--hidden');
|
28408 | if (_this.$el && _this.$el.parentNode) {
|
28409 | _this.$el.parentNode.removeChild(_this.$el);
|
28410 | }
|
28411 | _this.$destroy();
|
28412 | }, 300);
|
28413 | this.visible = false;
|
28414 | };
|
28415 |
|
28416 | var src_addStyle = function addStyle(options, parent, instance) {
|
28417 | var maskStyle = {};
|
28418 | if (options.fullscreen) {
|
28419 | instance.originalPosition = Object(dom_["getStyle"])(document.body, 'position');
|
28420 | instance.originalOverflow = Object(dom_["getStyle"])(document.body, 'overflow');
|
28421 | maskStyle.zIndex = popup_["PopupManager"].nextZIndex();
|
28422 | } else if (options.body) {
|
28423 | instance.originalPosition = Object(dom_["getStyle"])(document.body, 'position');
|
28424 | ['top', 'left'].forEach(function (property) {
|
28425 | var scroll = property === 'top' ? 'scrollTop' : 'scrollLeft';
|
28426 | maskStyle[property] = options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] + 'px';
|
28427 | });
|
28428 | ['height', 'width'].forEach(function (property) {
|
28429 | maskStyle[property] = options.target.getBoundingClientRect()[property] + 'px';
|
28430 | });
|
28431 | } else {
|
28432 | instance.originalPosition = Object(dom_["getStyle"])(parent, 'position');
|
28433 | }
|
28434 | Object.keys(maskStyle).forEach(function (property) {
|
28435 | instance.$el.style[property] = maskStyle[property];
|
28436 | });
|
28437 | };
|
28438 |
|
28439 | var src_Loading = function Loading() {
|
28440 | var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
28441 |
|
28442 | if (external_vue_default.a.prototype.$isServer) return;
|
28443 | options = merge_default()({}, src_defaults, options);
|
28444 | if (typeof options.target === 'string') {
|
28445 | options.target = document.querySelector(options.target);
|
28446 | }
|
28447 | options.target = options.target || document.body;
|
28448 | if (options.target !== document.body) {
|
28449 | options.fullscreen = false;
|
28450 | } else {
|
28451 | options.body = true;
|
28452 | }
|
28453 | if (options.fullscreen && fullscreenLoading) {
|
28454 | return fullscreenLoading;
|
28455 | }
|
28456 |
|
28457 | var parent = options.body ? document.body : options.target;
|
28458 | var instance = new LoadingConstructor({
|
28459 | el: document.createElement('div'),
|
28460 | data: options
|
28461 | });
|
28462 |
|
28463 | src_addStyle(options, parent, instance);
|
28464 | if (instance.originalPosition !== 'absolute' && instance.originalPosition !== 'fixed') {
|
28465 | Object(dom_["addClass"])(parent, 'el-loading-parent--relative');
|
28466 | }
|
28467 | if (options.fullscreen && options.lock) {
|
28468 | Object(dom_["addClass"])(parent, 'el-loading-parent--hidden');
|
28469 | }
|
28470 | parent.appendChild(instance.$el);
|
28471 | external_vue_default.a.nextTick(function () {
|
28472 | instance.visible = true;
|
28473 | });
|
28474 | if (options.fullscreen) {
|
28475 | fullscreenLoading = instance;
|
28476 | }
|
28477 | return instance;
|
28478 | };
|
28479 |
|
28480 | var src = (src_Loading);
|
28481 |
|
28482 |
|
28483 |
|
28484 |
|
28485 | var packages_loading = ({
|
28486 | install: function install(Vue) {
|
28487 | Vue.use(src_directive);
|
28488 | Vue.prototype.$loading = src;
|
28489 | },
|
28490 |
|
28491 | directive: src_directive,
|
28492 | service: src
|
28493 | });
|
28494 |
|
28495 | var iconvue_type_template_id_cb3fe7f4_render = function() {
|
28496 | var _vm = this
|
28497 | var _h = _vm.$createElement
|
28498 | var _c = _vm._self._c || _h
|
28499 | return _c("i", { class: "el-icon-" + _vm.name })
|
28500 | }
|
28501 | var iconvue_type_template_id_cb3fe7f4_staticRenderFns = []
|
28502 | iconvue_type_template_id_cb3fe7f4_render._withStripped = true
|
28503 |
|
28504 |
|
28505 |
|
28506 |
|
28507 |
|
28508 |
|
28509 |
|
28510 |
|
28511 |
|
28512 |
|
28513 | var iconvue_type_script_lang_js_ = ({
|
28514 | name: 'ElIcon',
|
28515 |
|
28516 | props: {
|
28517 | name: String
|
28518 | }
|
28519 | });
|
28520 |
|
28521 | var src_iconvue_type_script_lang_js_ = (iconvue_type_script_lang_js_);
|
28522 |
|
28523 |
|
28524 |
|
28525 |
|
28526 |
|
28527 |
|
28528 |
|
28529 |
|
28530 | var icon_component = normalizeComponent(
|
28531 | src_iconvue_type_script_lang_js_,
|
28532 | iconvue_type_template_id_cb3fe7f4_render,
|
28533 | iconvue_type_template_id_cb3fe7f4_staticRenderFns,
|
28534 | false,
|
28535 | null,
|
28536 | null,
|
28537 | null
|
28538 |
|
28539 | )
|
28540 |
|
28541 |
|
28542 | if (false) { var icon_api; }
|
28543 | icon_component.options.__file = "packages/icon/src/icon.vue"
|
28544 | var icon = (icon_component.exports);
|
28545 |
|
28546 |
|
28547 |
|
28548 |
|
28549 | icon.install = function (Vue) {
|
28550 | Vue.component(icon.name, icon);
|
28551 | };
|
28552 |
|
28553 | var packages_icon = (icon);
|
28554 |
|
28555 | var src_row = ({
|
28556 | name: 'ElRow',
|
28557 |
|
28558 | componentName: 'ElRow',
|
28559 |
|
28560 | props: {
|
28561 | tag: {
|
28562 | type: String,
|
28563 | default: 'div'
|
28564 | },
|
28565 | gutter: Number,
|
28566 | type: String,
|
28567 | justify: {
|
28568 | type: String,
|
28569 | default: 'start'
|
28570 | },
|
28571 | align: {
|
28572 | type: String,
|
28573 | default: 'top'
|
28574 | }
|
28575 | },
|
28576 |
|
28577 | computed: {
|
28578 | style: function style() {
|
28579 | var ret = {};
|
28580 |
|
28581 | if (this.gutter) {
|
28582 | ret.marginLeft = '-' + this.gutter / 2 + 'px';
|
28583 | ret.marginRight = ret.marginLeft;
|
28584 | }
|
28585 |
|
28586 | return ret;
|
28587 | }
|
28588 | },
|
28589 |
|
28590 | render: function render(h) {
|
28591 | return h(this.tag, {
|
28592 | class: ['el-row', this.justify !== 'start' ? 'is-justify-' + this.justify : '', this.align !== 'top' ? 'is-align-' + this.align : '', { 'el-row--flex': this.type === 'flex' }],
|
28593 | style: this.style
|
28594 | }, this.$slots.default);
|
28595 | }
|
28596 | });
|
28597 |
|
28598 |
|
28599 |
|
28600 |
|
28601 | src_row.install = function (Vue) {
|
28602 | Vue.component(src_row.name, src_row);
|
28603 | };
|
28604 |
|
28605 | var packages_row = (src_row);
|
28606 |
|
28607 | var col_typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
28608 |
|
28609 | var col = ({
|
28610 | name: 'ElCol',
|
28611 |
|
28612 | props: {
|
28613 | span: {
|
28614 | type: Number,
|
28615 | default: 24
|
28616 | },
|
28617 | tag: {
|
28618 | type: String,
|
28619 | default: 'div'
|
28620 | },
|
28621 | offset: Number,
|
28622 | pull: Number,
|
28623 | push: Number,
|
28624 | xs: [Number, Object],
|
28625 | sm: [Number, Object],
|
28626 | md: [Number, Object],
|
28627 | lg: [Number, Object],
|
28628 | xl: [Number, Object]
|
28629 | },
|
28630 |
|
28631 | computed: {
|
28632 | gutter: function gutter() {
|
28633 | var parent = this.$parent;
|
28634 | while (parent && parent.$options.componentName !== 'ElRow') {
|
28635 | parent = parent.$parent;
|
28636 | }
|
28637 | return parent ? parent.gutter : 0;
|
28638 | }
|
28639 | },
|
28640 | render: function render(h) {
|
28641 | var _this = this;
|
28642 |
|
28643 | var classList = [];
|
28644 | var style = {};
|
28645 |
|
28646 | if (this.gutter) {
|
28647 | style.paddingLeft = this.gutter / 2 + 'px';
|
28648 | style.paddingRight = style.paddingLeft;
|
28649 | }
|
28650 |
|
28651 | ['span', 'offset', 'pull', 'push'].forEach(function (prop) {
|
28652 | if (_this[prop] || _this[prop] === 0) {
|
28653 | classList.push(prop !== 'span' ? 'el-col-' + prop + '-' + _this[prop] : 'el-col-' + _this[prop]);
|
28654 | }
|
28655 | });
|
28656 |
|
28657 | ['xs', 'sm', 'md', 'lg', 'xl'].forEach(function (size) {
|
28658 | if (typeof _this[size] === 'number') {
|
28659 | classList.push('el-col-' + size + '-' + _this[size]);
|
28660 | } else if (col_typeof(_this[size]) === 'object') {
|
28661 | var props = _this[size];
|
28662 | Object.keys(props).forEach(function (prop) {
|
28663 | classList.push(prop !== 'span' ? 'el-col-' + size + '-' + prop + '-' + props[prop] : 'el-col-' + size + '-' + props[prop]);
|
28664 | });
|
28665 | }
|
28666 | });
|
28667 |
|
28668 | return h(this.tag, {
|
28669 | class: ['el-col', classList],
|
28670 | style: style
|
28671 | }, this.$slots.default);
|
28672 | }
|
28673 | });
|
28674 |
|
28675 |
|
28676 |
|
28677 |
|
28678 | col.install = function (Vue) {
|
28679 | Vue.component(col.name, col);
|
28680 | };
|
28681 |
|
28682 | var packages_col = (col);
|
28683 |
|
28684 | var upload_listvue_type_template_id_173fedf5_render = function() {
|
28685 | var _vm = this
|
28686 | var _h = _vm.$createElement
|
28687 | var _c = _vm._self._c || _h
|
28688 | return _c(
|
28689 | "transition-group",
|
28690 | {
|
28691 | class: [
|
28692 | "el-upload-list",
|
28693 | "el-upload-list--" + _vm.listType,
|
28694 | { "is-disabled": _vm.disabled }
|
28695 | ],
|
28696 | attrs: { tag: "ul", name: "el-list" }
|
28697 | },
|
28698 | _vm._l(_vm.files, function(file) {
|
28699 | return _c(
|
28700 | "li",
|
28701 | {
|
28702 | key: file.uid,
|
28703 | class: [
|
28704 | "el-upload-list__item",
|
28705 | "is-" + file.status,
|
28706 | _vm.focusing ? "focusing" : ""
|
28707 | ],
|
28708 | attrs: { tabindex: "0" },
|
28709 | on: {
|
28710 | keydown: function($event) {
|
28711 | if (
|
28712 | !("button" in $event) &&
|
28713 | _vm._k($event.keyCode, "delete", [8, 46], $event.key, [
|
28714 | "Backspace",
|
28715 | "Delete",
|
28716 | "Del"
|
28717 | ])
|
28718 | ) {
|
28719 | return null
|
28720 | }
|
28721 | !_vm.disabled && _vm.$emit("remove", file)
|
28722 | },
|
28723 | focus: function($event) {
|
28724 | _vm.focusing = true
|
28725 | },
|
28726 | blur: function($event) {
|
28727 | _vm.focusing = false
|
28728 | },
|
28729 | click: function($event) {
|
28730 | _vm.focusing = false
|
28731 | }
|
28732 | }
|
28733 | },
|
28734 | [
|
28735 | _vm._t(
|
28736 | "default",
|
28737 | [
|
28738 | file.status !== "uploading" &&
|
28739 | ["picture-card", "picture"].indexOf(_vm.listType) > -1
|
28740 | ? _c("img", {
|
28741 | staticClass: "el-upload-list__item-thumbnail",
|
28742 | attrs: { src: file.url, alt: "" }
|
28743 | })
|
28744 | : _vm._e(),
|
28745 | _c(
|
28746 | "a",
|
28747 | {
|
28748 | staticClass: "el-upload-list__item-name",
|
28749 | on: {
|
28750 | click: function($event) {
|
28751 | _vm.handleClick(file)
|
28752 | }
|
28753 | }
|
28754 | },
|
28755 | [
|
28756 | _c("i", { staticClass: "el-icon-document" }),
|
28757 | _vm._v(_vm._s(file.name) + "\n ")
|
28758 | ]
|
28759 | ),
|
28760 | _c(
|
28761 | "label",
|
28762 | { staticClass: "el-upload-list__item-status-label" },
|
28763 | [
|
28764 | _c("i", {
|
28765 | class: {
|
28766 | "el-icon-upload-success": true,
|
28767 | "el-icon-circle-check": _vm.listType === "text",
|
28768 | "el-icon-check":
|
28769 | ["picture-card", "picture"].indexOf(_vm.listType) > -1
|
28770 | }
|
28771 | })
|
28772 | ]
|
28773 | ),
|
28774 | !_vm.disabled
|
28775 | ? _c("i", {
|
28776 | staticClass: "el-icon-close",
|
28777 | on: {
|
28778 | click: function($event) {
|
28779 | _vm.$emit("remove", file)
|
28780 | }
|
28781 | }
|
28782 | })
|
28783 | : _vm._e(),
|
28784 | !_vm.disabled
|
28785 | ? _c("i", { staticClass: "el-icon-close-tip" }, [
|
28786 | _vm._v(_vm._s(_vm.t("el.upload.deleteTip")))
|
28787 | ])
|
28788 | : _vm._e(),
|
28789 | file.status === "uploading"
|
28790 | ? _c("el-progress", {
|
28791 | attrs: {
|
28792 | type: _vm.listType === "picture-card" ? "circle" : "line",
|
28793 | "stroke-width": _vm.listType === "picture-card" ? 6 : 2,
|
28794 | percentage: _vm.parsePercentage(file.percentage)
|
28795 | }
|
28796 | })
|
28797 | : _vm._e(),
|
28798 | _vm.listType === "picture-card"
|
28799 | ? _c("span", { staticClass: "el-upload-list__item-actions" }, [
|
28800 | _vm.handlePreview && _vm.listType === "picture-card"
|
28801 | ? _c(
|
28802 | "span",
|
28803 | {
|
28804 | staticClass: "el-upload-list__item-preview",
|
28805 | on: {
|
28806 | click: function($event) {
|
28807 | _vm.handlePreview(file)
|
28808 | }
|
28809 | }
|
28810 | },
|
28811 | [_c("i", { staticClass: "el-icon-zoom-in" })]
|
28812 | )
|
28813 | : _vm._e(),
|
28814 | !_vm.disabled
|
28815 | ? _c(
|
28816 | "span",
|
28817 | {
|
28818 | staticClass: "el-upload-list__item-delete",
|
28819 | on: {
|
28820 | click: function($event) {
|
28821 | _vm.$emit("remove", file)
|
28822 | }
|
28823 | }
|
28824 | },
|
28825 | [_c("i", { staticClass: "el-icon-delete" })]
|
28826 | )
|
28827 | : _vm._e()
|
28828 | ])
|
28829 | : _vm._e()
|
28830 | ],
|
28831 | { file: file }
|
28832 | )
|
28833 | ],
|
28834 | 2
|
28835 | )
|
28836 | }),
|
28837 | 0
|
28838 | )
|
28839 | }
|
28840 | var upload_listvue_type_template_id_173fedf5_staticRenderFns = []
|
28841 | upload_listvue_type_template_id_173fedf5_render._withStripped = true
|
28842 |
|
28843 |
|
28844 |
|
28845 |
|
28846 |
|
28847 | var progress_ = __webpack_require__(34);
|
28848 | var progress_default = __webpack_require__.n(progress_);
|
28849 |
|
28850 |
|
28851 |
|
28852 |
|
28853 |
|
28854 |
|
28855 |
|
28856 |
|
28857 |
|
28858 |
|
28859 |
|
28860 |
|
28861 |
|
28862 |
|
28863 |
|
28864 |
|
28865 |
|
28866 |
|
28867 |
|
28868 |
|
28869 |
|
28870 |
|
28871 |
|
28872 |
|
28873 |
|
28874 |
|
28875 |
|
28876 |
|
28877 |
|
28878 |
|
28879 |
|
28880 |
|
28881 |
|
28882 |
|
28883 |
|
28884 |
|
28885 |
|
28886 |
|
28887 |
|
28888 |
|
28889 |
|
28890 |
|
28891 |
|
28892 |
|
28893 |
|
28894 |
|
28895 |
|
28896 |
|
28897 |
|
28898 |
|
28899 |
|
28900 |
|
28901 |
|
28902 |
|
28903 |
|
28904 |
|
28905 |
|
28906 |
|
28907 |
|
28908 |
|
28909 |
|
28910 |
|
28911 |
|
28912 |
|
28913 |
|
28914 |
|
28915 |
|
28916 |
|
28917 |
|
28918 |
|
28919 | var upload_listvue_type_script_lang_js_ = ({
|
28920 |
|
28921 | name: 'ElUploadList',
|
28922 |
|
28923 | mixins: [locale_default.a],
|
28924 |
|
28925 | data: function data() {
|
28926 | return {
|
28927 | focusing: false
|
28928 | };
|
28929 | },
|
28930 |
|
28931 | components: { ElProgress: progress_default.a },
|
28932 |
|
28933 | props: {
|
28934 | files: {
|
28935 | type: Array,
|
28936 | default: function _default() {
|
28937 | return [];
|
28938 | }
|
28939 | },
|
28940 | disabled: {
|
28941 | type: Boolean,
|
28942 | default: false
|
28943 | },
|
28944 | handlePreview: Function,
|
28945 | listType: String
|
28946 | },
|
28947 | methods: {
|
28948 | parsePercentage: function parsePercentage(val) {
|
28949 | return parseInt(val, 10);
|
28950 | },
|
28951 | handleClick: function handleClick(file) {
|
28952 | this.handlePreview && this.handlePreview(file);
|
28953 | }
|
28954 | }
|
28955 | });
|
28956 |
|
28957 | var src_upload_listvue_type_script_lang_js_ = (upload_listvue_type_script_lang_js_);
|
28958 |
|
28959 |
|
28960 |
|
28961 |
|
28962 |
|
28963 |
|
28964 |
|
28965 |
|
28966 | var upload_list_component = normalizeComponent(
|
28967 | src_upload_listvue_type_script_lang_js_,
|
28968 | upload_listvue_type_template_id_173fedf5_render,
|
28969 | upload_listvue_type_template_id_173fedf5_staticRenderFns,
|
28970 | false,
|
28971 | null,
|
28972 | null,
|
28973 | null
|
28974 |
|
28975 | )
|
28976 |
|
28977 |
|
28978 | if (false) { var upload_list_api; }
|
28979 | upload_list_component.options.__file = "packages/upload/src/upload-list.vue"
|
28980 | var upload_list = (upload_list_component.exports);
|
28981 |
|
28982 | var external_babel_helper_vue_jsx_merge_props_ = __webpack_require__(24);
|
28983 | var external_babel_helper_vue_jsx_merge_props_default = __webpack_require__.n(external_babel_helper_vue_jsx_merge_props_);
|
28984 |
|
28985 |
|
28986 | function getError(action, option, xhr) {
|
28987 | var msg = void 0;
|
28988 | if (xhr.response) {
|
28989 | msg = '' + (xhr.response.error || xhr.response);
|
28990 | } else if (xhr.responseText) {
|
28991 | msg = '' + xhr.responseText;
|
28992 | } else {
|
28993 | msg = 'fail to post ' + action + ' ' + xhr.status;
|
28994 | }
|
28995 |
|
28996 | var err = new Error(msg);
|
28997 | err.status = xhr.status;
|
28998 | err.method = 'post';
|
28999 | err.url = action;
|
29000 | return err;
|
29001 | }
|
29002 |
|
29003 | function getBody(xhr) {
|
29004 | var text = xhr.responseText || xhr.response;
|
29005 | if (!text) {
|
29006 | return text;
|
29007 | }
|
29008 |
|
29009 | try {
|
29010 | return JSON.parse(text);
|
29011 | } catch (e) {
|
29012 | return text;
|
29013 | }
|
29014 | }
|
29015 |
|
29016 | function upload(option) {
|
29017 | if (typeof XMLHttpRequest === 'undefined') {
|
29018 | return;
|
29019 | }
|
29020 |
|
29021 | var xhr = new XMLHttpRequest();
|
29022 | var action = option.action;
|
29023 |
|
29024 | if (xhr.upload) {
|
29025 | xhr.upload.onprogress = function progress(e) {
|
29026 | if (e.total > 0) {
|
29027 | e.percent = e.loaded / e.total * 100;
|
29028 | }
|
29029 | option.onProgress(e);
|
29030 | };
|
29031 | }
|
29032 |
|
29033 | var formData = new FormData();
|
29034 |
|
29035 | if (option.data) {
|
29036 | Object.keys(option.data).forEach(function (key) {
|
29037 | formData.append(key, option.data[key]);
|
29038 | });
|
29039 | }
|
29040 |
|
29041 | formData.append(option.filename, option.file, option.file.name);
|
29042 |
|
29043 | xhr.onerror = function error(e) {
|
29044 | option.onError(e);
|
29045 | };
|
29046 |
|
29047 | xhr.onload = function onload() {
|
29048 | if (xhr.status < 200 || xhr.status >= 300) {
|
29049 | return option.onError(getError(action, option, xhr));
|
29050 | }
|
29051 |
|
29052 | option.onSuccess(getBody(xhr));
|
29053 | };
|
29054 |
|
29055 | xhr.open('post', action, true);
|
29056 |
|
29057 | if (option.withCredentials && 'withCredentials' in xhr) {
|
29058 | xhr.withCredentials = true;
|
29059 | }
|
29060 |
|
29061 | var headers = option.headers || {};
|
29062 |
|
29063 | for (var item in headers) {
|
29064 | if (headers.hasOwnProperty(item) && headers[item] !== null) {
|
29065 | xhr.setRequestHeader(item, headers[item]);
|
29066 | }
|
29067 | }
|
29068 | xhr.send(formData);
|
29069 | return xhr;
|
29070 | }
|
29071 |
|
29072 | var upload_draggervue_type_template_id_7ebbf219_render = function() {
|
29073 | var _vm = this
|
29074 | var _h = _vm.$createElement
|
29075 | var _c = _vm._self._c || _h
|
29076 | return _c(
|
29077 | "div",
|
29078 | {
|
29079 | staticClass: "el-upload-dragger",
|
29080 | class: {
|
29081 | "is-dragover": _vm.dragover
|
29082 | },
|
29083 | on: {
|
29084 | drop: function($event) {
|
29085 | $event.preventDefault()
|
29086 | return _vm.onDrop($event)
|
29087 | },
|
29088 | dragover: function($event) {
|
29089 | $event.preventDefault()
|
29090 | return _vm.onDragover($event)
|
29091 | },
|
29092 | dragleave: function($event) {
|
29093 | $event.preventDefault()
|
29094 | _vm.dragover = false
|
29095 | }
|
29096 | }
|
29097 | },
|
29098 | [_vm._t("default")],
|
29099 | 2
|
29100 | )
|
29101 | }
|
29102 | var upload_draggervue_type_template_id_7ebbf219_staticRenderFns = []
|
29103 | upload_draggervue_type_template_id_7ebbf219_render._withStripped = true
|
29104 |
|
29105 |
|
29106 |
|
29107 |
|
29108 |
|
29109 |
|
29110 |
|
29111 |
|
29112 |
|
29113 |
|
29114 |
|
29115 |
|
29116 |
|
29117 |
|
29118 |
|
29119 |
|
29120 |
|
29121 |
|
29122 |
|
29123 | var upload_draggervue_type_script_lang_js_ = ({
|
29124 | name: 'ElUploadDrag',
|
29125 | props: {
|
29126 | disabled: Boolean
|
29127 | },
|
29128 | inject: {
|
29129 | uploader: {
|
29130 | default: ''
|
29131 | }
|
29132 | },
|
29133 | data: function data() {
|
29134 | return {
|
29135 | dragover: false
|
29136 | };
|
29137 | },
|
29138 |
|
29139 | methods: {
|
29140 | onDragover: function onDragover() {
|
29141 | if (!this.disabled) {
|
29142 | this.dragover = true;
|
29143 | }
|
29144 | },
|
29145 | onDrop: function onDrop(e) {
|
29146 | if (this.disabled || !this.uploader) return;
|
29147 | var accept = this.uploader.accept;
|
29148 | this.dragover = false;
|
29149 | if (!accept) {
|
29150 | this.$emit('file', e.dataTransfer.files);
|
29151 | return;
|
29152 | }
|
29153 | this.$emit('file', [].slice.call(e.dataTransfer.files).filter(function (file) {
|
29154 | var type = file.type,
|
29155 | name = file.name;
|
29156 |
|
29157 | var extension = name.indexOf('.') > -1 ? '.' + name.split('.').pop() : '';
|
29158 | var baseType = type.replace(/\/.*$/, '');
|
29159 | return accept.split(',').map(function (type) {
|
29160 | return type.trim();
|
29161 | }).filter(function (type) {
|
29162 | return type;
|
29163 | }).some(function (acceptedType) {
|
29164 | if (/\..+$/.test(acceptedType)) {
|
29165 | return extension === acceptedType;
|
29166 | }
|
29167 | if (/\/\*$/.test(acceptedType)) {
|
29168 | return baseType === acceptedType.replace(/\/\*$/, '');
|
29169 | }
|
29170 | if (/^[^\/]+\/[^\/]+$/.test(acceptedType)) {
|
29171 | return type === acceptedType;
|
29172 | }
|
29173 | return false;
|
29174 | });
|
29175 | }));
|
29176 | }
|
29177 | }
|
29178 | });
|
29179 |
|
29180 | var src_upload_draggervue_type_script_lang_js_ = (upload_draggervue_type_script_lang_js_);
|
29181 |
|
29182 |
|
29183 |
|
29184 |
|
29185 |
|
29186 |
|
29187 |
|
29188 |
|
29189 | var upload_dragger_component = normalizeComponent(
|
29190 | src_upload_draggervue_type_script_lang_js_,
|
29191 | upload_draggervue_type_template_id_7ebbf219_render,
|
29192 | upload_draggervue_type_template_id_7ebbf219_staticRenderFns,
|
29193 | false,
|
29194 | null,
|
29195 | null,
|
29196 | null
|
29197 |
|
29198 | )
|
29199 |
|
29200 |
|
29201 | if (false) { var upload_dragger_api; }
|
29202 | upload_dragger_component.options.__file = "packages/upload/src/upload-dragger.vue"
|
29203 | var upload_dragger = (upload_dragger_component.exports);
|
29204 |
|
29205 |
|
29206 |
|
29207 |
|
29208 |
|
29209 |
|
29210 | var uploadvue_type_script_lang_js_ = ({
|
29211 | inject: ['uploader'],
|
29212 | components: {
|
29213 | UploadDragger: upload_dragger
|
29214 | },
|
29215 | props: {
|
29216 | type: String,
|
29217 | action: {
|
29218 | type: String,
|
29219 | required: true
|
29220 | },
|
29221 | name: {
|
29222 | type: String,
|
29223 | default: 'file'
|
29224 | },
|
29225 | data: Object,
|
29226 | headers: Object,
|
29227 | withCredentials: Boolean,
|
29228 | multiple: Boolean,
|
29229 | accept: String,
|
29230 | onStart: Function,
|
29231 | onProgress: Function,
|
29232 | onSuccess: Function,
|
29233 | onError: Function,
|
29234 | beforeUpload: Function,
|
29235 | drag: Boolean,
|
29236 | onPreview: {
|
29237 | type: Function,
|
29238 | default: function _default() {}
|
29239 | },
|
29240 | onRemove: {
|
29241 | type: Function,
|
29242 | default: function _default() {}
|
29243 | },
|
29244 | fileList: Array,
|
29245 | autoUpload: Boolean,
|
29246 | listType: String,
|
29247 | httpRequest: {
|
29248 | type: Function,
|
29249 | default: upload
|
29250 | },
|
29251 | disabled: Boolean,
|
29252 | limit: Number,
|
29253 | onExceed: Function
|
29254 | },
|
29255 |
|
29256 | data: function data() {
|
29257 | return {
|
29258 | mouseover: false,
|
29259 | reqs: {}
|
29260 | };
|
29261 | },
|
29262 |
|
29263 |
|
29264 | methods: {
|
29265 | isImage: function isImage(str) {
|
29266 | return str.indexOf('image') !== -1;
|
29267 | },
|
29268 | handleChange: function handleChange(ev) {
|
29269 | var files = ev.target.files;
|
29270 |
|
29271 | if (!files) return;
|
29272 | this.uploadFiles(files);
|
29273 | },
|
29274 | uploadFiles: function uploadFiles(files) {
|
29275 | var _this = this;
|
29276 |
|
29277 | if (this.limit && this.fileList.length + files.length > this.limit) {
|
29278 | this.onExceed && this.onExceed(files, this.fileList);
|
29279 | return;
|
29280 | }
|
29281 |
|
29282 | var postFiles = Array.prototype.slice.call(files);
|
29283 | if (!this.multiple) {
|
29284 | postFiles = postFiles.slice(0, 1);
|
29285 | }
|
29286 |
|
29287 | if (postFiles.length === 0) {
|
29288 | return;
|
29289 | }
|
29290 |
|
29291 | postFiles.forEach(function (rawFile) {
|
29292 | _this.onStart(rawFile);
|
29293 | if (_this.autoUpload) _this.upload(rawFile);
|
29294 | });
|
29295 | },
|
29296 | upload: function upload(rawFile) {
|
29297 | var _this2 = this;
|
29298 |
|
29299 | this.$refs.input.value = null;
|
29300 |
|
29301 | if (!this.beforeUpload) {
|
29302 | return this.post(rawFile);
|
29303 | }
|
29304 |
|
29305 | var before = this.beforeUpload(rawFile);
|
29306 | if (before && before.then) {
|
29307 | before.then(function (processedFile) {
|
29308 | var fileType = Object.prototype.toString.call(processedFile);
|
29309 |
|
29310 | if (fileType === '[object File]' || fileType === '[object Blob]') {
|
29311 | if (fileType === '[object Blob]') {
|
29312 | processedFile = new File([processedFile], rawFile.name, {
|
29313 | type: rawFile.type
|
29314 | });
|
29315 | }
|
29316 | for (var p in rawFile) {
|
29317 | if (rawFile.hasOwnProperty(p)) {
|
29318 | processedFile[p] = rawFile[p];
|
29319 | }
|
29320 | }
|
29321 | _this2.post(processedFile);
|
29322 | } else {
|
29323 | _this2.post(rawFile);
|
29324 | }
|
29325 | }, function () {
|
29326 | _this2.onRemove(null, rawFile);
|
29327 | });
|
29328 | } else if (before !== false) {
|
29329 | this.post(rawFile);
|
29330 | } else {
|
29331 | this.onRemove(null, rawFile);
|
29332 | }
|
29333 | },
|
29334 | abort: function abort(file) {
|
29335 | var reqs = this.reqs;
|
29336 |
|
29337 | if (file) {
|
29338 | var uid = file;
|
29339 | if (file.uid) uid = file.uid;
|
29340 | if (reqs[uid]) {
|
29341 | reqs[uid].abort();
|
29342 | }
|
29343 | } else {
|
29344 | Object.keys(reqs).forEach(function (uid) {
|
29345 | if (reqs[uid]) reqs[uid].abort();
|
29346 | delete reqs[uid];
|
29347 | });
|
29348 | }
|
29349 | },
|
29350 | post: function post(rawFile) {
|
29351 | var _this3 = this;
|
29352 |
|
29353 | var uid = rawFile.uid;
|
29354 |
|
29355 | var options = {
|
29356 | headers: this.headers,
|
29357 | withCredentials: this.withCredentials,
|
29358 | file: rawFile,
|
29359 | data: this.data,
|
29360 | filename: this.name,
|
29361 | action: this.action,
|
29362 | onProgress: function onProgress(e) {
|
29363 | _this3.onProgress(e, rawFile);
|
29364 | },
|
29365 | onSuccess: function onSuccess(res) {
|
29366 | _this3.onSuccess(res, rawFile);
|
29367 | delete _this3.reqs[uid];
|
29368 | },
|
29369 | onError: function onError(err) {
|
29370 | _this3.onError(err, rawFile);
|
29371 | delete _this3.reqs[uid];
|
29372 | }
|
29373 | };
|
29374 | var req = this.httpRequest(options);
|
29375 | this.reqs[uid] = req;
|
29376 | if (req && req.then) {
|
29377 | req.then(options.onSuccess, options.onError);
|
29378 | }
|
29379 | },
|
29380 | handleClick: function handleClick() {
|
29381 | if (!this.disabled) {
|
29382 | this.$refs.input.value = null;
|
29383 | this.$refs.input.click();
|
29384 | }
|
29385 | },
|
29386 | handleKeydown: function handleKeydown(e) {
|
29387 | if (e.target !== e.currentTarget) return;
|
29388 | if (e.keyCode === 13 || e.keyCode === 32) {
|
29389 | this.handleClick();
|
29390 | }
|
29391 | }
|
29392 | },
|
29393 |
|
29394 | render: function render(h) {
|
29395 | var handleClick = this.handleClick,
|
29396 | drag = this.drag,
|
29397 | name = this.name,
|
29398 | handleChange = this.handleChange,
|
29399 | multiple = this.multiple,
|
29400 | accept = this.accept,
|
29401 | listType = this.listType,
|
29402 | uploadFiles = this.uploadFiles,
|
29403 | disabled = this.disabled,
|
29404 | handleKeydown = this.handleKeydown;
|
29405 |
|
29406 | var data = {
|
29407 | class: {
|
29408 | 'el-upload': true
|
29409 | },
|
29410 | on: {
|
29411 | click: handleClick,
|
29412 | keydown: handleKeydown
|
29413 | }
|
29414 | };
|
29415 | data.class['el-upload--' + listType] = true;
|
29416 | return h(
|
29417 | 'div',
|
29418 | external_babel_helper_vue_jsx_merge_props_default()([data, {
|
29419 | attrs: { tabindex: '0' }
|
29420 | }]),
|
29421 | [drag ? h(
|
29422 | 'upload-dragger',
|
29423 | {
|
29424 | attrs: { disabled: disabled },
|
29425 | on: {
|
29426 | 'file': uploadFiles
|
29427 | }
|
29428 | },
|
29429 | [this.$slots.default]
|
29430 | ) : this.$slots.default, h('input', { 'class': 'el-upload__input', attrs: { type: 'file', name: name, multiple: multiple, accept: accept },
|
29431 | ref: 'input', on: {
|
29432 | 'change': handleChange
|
29433 | }
|
29434 | })]
|
29435 | );
|
29436 | }
|
29437 | });
|
29438 |
|
29439 | var src_uploadvue_type_script_lang_js_ = (uploadvue_type_script_lang_js_);
|
29440 |
|
29441 | var upload_render, upload_staticRenderFns
|
29442 |
|
29443 |
|
29444 |
|
29445 |
|
29446 |
|
29447 |
|
29448 | var upload_component = normalizeComponent(
|
29449 | src_uploadvue_type_script_lang_js_,
|
29450 | upload_render,
|
29451 | upload_staticRenderFns,
|
29452 | false,
|
29453 | null,
|
29454 | null,
|
29455 | null
|
29456 |
|
29457 | )
|
29458 |
|
29459 |
|
29460 | if (false) { var upload_api; }
|
29461 | upload_component.options.__file = "packages/upload/src/upload.vue"
|
29462 | var src_upload = (upload_component.exports);
|
29463 |
|
29464 |
|
29465 |
|
29466 |
|
29467 |
|
29468 |
|
29469 |
|
29470 | function srcvue_type_script_lang_js_noop() {}
|
29471 |
|
29472 | var srcvue_type_script_lang_js_ = ({
|
29473 | name: 'ElUpload',
|
29474 |
|
29475 | mixins: [migrating_default.a],
|
29476 |
|
29477 | components: {
|
29478 | ElProgress: progress_default.a,
|
29479 | UploadList: upload_list,
|
29480 | Upload: src_upload
|
29481 | },
|
29482 |
|
29483 | provide: function provide() {
|
29484 | return {
|
29485 | uploader: this
|
29486 | };
|
29487 | },
|
29488 |
|
29489 |
|
29490 | inject: {
|
29491 | elForm: {
|
29492 | default: ''
|
29493 | }
|
29494 | },
|
29495 |
|
29496 | props: {
|
29497 | action: {
|
29498 | type: String,
|
29499 | required: true
|
29500 | },
|
29501 | headers: {
|
29502 | type: Object,
|
29503 | default: function _default() {
|
29504 | return {};
|
29505 | }
|
29506 | },
|
29507 | data: Object,
|
29508 | multiple: Boolean,
|
29509 | name: {
|
29510 | type: String,
|
29511 | default: 'file'
|
29512 | },
|
29513 | drag: Boolean,
|
29514 | dragger: Boolean,
|
29515 | withCredentials: Boolean,
|
29516 | showFileList: {
|
29517 | type: Boolean,
|
29518 | default: true
|
29519 | },
|
29520 | accept: String,
|
29521 | type: {
|
29522 | type: String,
|
29523 | default: 'select'
|
29524 | },
|
29525 | beforeUpload: Function,
|
29526 | beforeRemove: Function,
|
29527 | onRemove: {
|
29528 | type: Function,
|
29529 | default: srcvue_type_script_lang_js_noop
|
29530 | },
|
29531 | onChange: {
|
29532 | type: Function,
|
29533 | default: srcvue_type_script_lang_js_noop
|
29534 | },
|
29535 | onPreview: {
|
29536 | type: Function
|
29537 | },
|
29538 | onSuccess: {
|
29539 | type: Function,
|
29540 | default: srcvue_type_script_lang_js_noop
|
29541 | },
|
29542 | onProgress: {
|
29543 | type: Function,
|
29544 | default: srcvue_type_script_lang_js_noop
|
29545 | },
|
29546 | onError: {
|
29547 | type: Function,
|
29548 | default: srcvue_type_script_lang_js_noop
|
29549 | },
|
29550 | fileList: {
|
29551 | type: Array,
|
29552 | default: function _default() {
|
29553 | return [];
|
29554 | }
|
29555 | },
|
29556 | autoUpload: {
|
29557 | type: Boolean,
|
29558 | default: true
|
29559 | },
|
29560 | listType: {
|
29561 | type: String,
|
29562 | default: 'text'
|
29563 | },
|
29564 | httpRequest: Function,
|
29565 | disabled: Boolean,
|
29566 | limit: Number,
|
29567 | onExceed: {
|
29568 | type: Function,
|
29569 | default: srcvue_type_script_lang_js_noop
|
29570 | }
|
29571 | },
|
29572 |
|
29573 | data: function data() {
|
29574 | return {
|
29575 | uploadFiles: [],
|
29576 | dragOver: false,
|
29577 | draging: false,
|
29578 | tempIndex: 1
|
29579 | };
|
29580 | },
|
29581 |
|
29582 |
|
29583 | computed: {
|
29584 | uploadDisabled: function uploadDisabled() {
|
29585 | return this.disabled || (this.elForm || {}).disabled;
|
29586 | }
|
29587 | },
|
29588 |
|
29589 | watch: {
|
29590 | listType: function listType(type) {
|
29591 | if (type === 'picture-card' || type === 'picture') {
|
29592 | this.uploadFiles = this.uploadFiles.map(function (file) {
|
29593 | if (!file.url && file.raw) {
|
29594 | try {
|
29595 | file.url = URL.createObjectURL(file.raw);
|
29596 | } catch (err) {
|
29597 | console.error('[Element Error][Upload]', err);
|
29598 | }
|
29599 | }
|
29600 | return file;
|
29601 | });
|
29602 | }
|
29603 | },
|
29604 |
|
29605 | fileList: {
|
29606 | immediate: true,
|
29607 | handler: function handler(fileList) {
|
29608 | var _this = this;
|
29609 |
|
29610 | this.uploadFiles = fileList.map(function (item) {
|
29611 | item.uid = item.uid || Date.now() + _this.tempIndex++;
|
29612 | item.status = item.status || 'success';
|
29613 | return item;
|
29614 | });
|
29615 | }
|
29616 | }
|
29617 | },
|
29618 |
|
29619 | methods: {
|
29620 | handleStart: function handleStart(rawFile) {
|
29621 | rawFile.uid = Date.now() + this.tempIndex++;
|
29622 | var file = {
|
29623 | status: 'ready',
|
29624 | name: rawFile.name,
|
29625 | size: rawFile.size,
|
29626 | percentage: 0,
|
29627 | uid: rawFile.uid,
|
29628 | raw: rawFile
|
29629 | };
|
29630 |
|
29631 | if (this.listType === 'picture-card' || this.listType === 'picture') {
|
29632 | try {
|
29633 | file.url = URL.createObjectURL(rawFile);
|
29634 | } catch (err) {
|
29635 | console.error('[Element Error][Upload]', err);
|
29636 | return;
|
29637 | }
|
29638 | }
|
29639 |
|
29640 | this.uploadFiles.push(file);
|
29641 | this.onChange(file, this.uploadFiles);
|
29642 | },
|
29643 | handleProgress: function handleProgress(ev, rawFile) {
|
29644 | var file = this.getFile(rawFile);
|
29645 | this.onProgress(ev, file, this.uploadFiles);
|
29646 | file.status = 'uploading';
|
29647 | file.percentage = ev.percent || 0;
|
29648 | },
|
29649 | handleSuccess: function handleSuccess(res, rawFile) {
|
29650 | var file = this.getFile(rawFile);
|
29651 |
|
29652 | if (file) {
|
29653 | file.status = 'success';
|
29654 | file.response = res;
|
29655 |
|
29656 | this.onSuccess(res, file, this.uploadFiles);
|
29657 | this.onChange(file, this.uploadFiles);
|
29658 | }
|
29659 | },
|
29660 | handleError: function handleError(err, rawFile) {
|
29661 | var file = this.getFile(rawFile);
|
29662 | var fileList = this.uploadFiles;
|
29663 |
|
29664 | file.status = 'fail';
|
29665 |
|
29666 | fileList.splice(fileList.indexOf(file), 1);
|
29667 |
|
29668 | this.onError(err, file, this.uploadFiles);
|
29669 | this.onChange(file, this.uploadFiles);
|
29670 | },
|
29671 | handleRemove: function handleRemove(file, raw) {
|
29672 | var _this2 = this;
|
29673 |
|
29674 | if (raw) {
|
29675 | file = this.getFile(raw);
|
29676 | }
|
29677 | var doRemove = function doRemove() {
|
29678 | _this2.abort(file);
|
29679 | var fileList = _this2.uploadFiles;
|
29680 | fileList.splice(fileList.indexOf(file), 1);
|
29681 | _this2.onRemove(file, fileList);
|
29682 | };
|
29683 |
|
29684 | if (!this.beforeRemove) {
|
29685 | doRemove();
|
29686 | } else if (typeof this.beforeRemove === 'function') {
|
29687 | var before = this.beforeRemove(file, this.uploadFiles);
|
29688 | if (before && before.then) {
|
29689 | before.then(function () {
|
29690 | doRemove();
|
29691 | }, srcvue_type_script_lang_js_noop);
|
29692 | } else if (before !== false) {
|
29693 | doRemove();
|
29694 | }
|
29695 | }
|
29696 | },
|
29697 | getFile: function getFile(rawFile) {
|
29698 | var fileList = this.uploadFiles;
|
29699 | var target = void 0;
|
29700 | fileList.every(function (item) {
|
29701 | target = rawFile.uid === item.uid ? item : null;
|
29702 | return !target;
|
29703 | });
|
29704 | return target;
|
29705 | },
|
29706 | abort: function abort(file) {
|
29707 | this.$refs['upload-inner'].abort(file);
|
29708 | },
|
29709 | clearFiles: function clearFiles() {
|
29710 | this.uploadFiles = [];
|
29711 | },
|
29712 | submit: function submit() {
|
29713 | var _this3 = this;
|
29714 |
|
29715 | this.uploadFiles.filter(function (file) {
|
29716 | return file.status === 'ready';
|
29717 | }).forEach(function (file) {
|
29718 | _this3.$refs['upload-inner'].upload(file.raw);
|
29719 | });
|
29720 | },
|
29721 | getMigratingConfig: function getMigratingConfig() {
|
29722 | return {
|
29723 | props: {
|
29724 | 'default-file-list': 'default-file-list is renamed to file-list.',
|
29725 | 'show-upload-list': 'show-upload-list is renamed to show-file-list.',
|
29726 | 'thumbnail-mode': 'thumbnail-mode has been deprecated, you can implement the same effect according to this case: http://element.eleme.io/#/zh-CN/component/upload#yong-hu-tou-xiang-shang-chuan'
|
29727 | }
|
29728 | };
|
29729 | }
|
29730 | },
|
29731 |
|
29732 | beforeDestroy: function beforeDestroy() {
|
29733 | this.uploadFiles.forEach(function (file) {
|
29734 | if (file.url && file.url.indexOf('blob:') === 0) {
|
29735 | URL.revokeObjectURL(file.url);
|
29736 | }
|
29737 | });
|
29738 | },
|
29739 | render: function render(h) {
|
29740 | var _this4 = this;
|
29741 |
|
29742 | var uploadList = void 0;
|
29743 |
|
29744 | if (this.showFileList) {
|
29745 | uploadList = h(
|
29746 | upload_list,
|
29747 | {
|
29748 | attrs: {
|
29749 | disabled: this.uploadDisabled,
|
29750 | listType: this.listType,
|
29751 | files: this.uploadFiles,
|
29752 |
|
29753 | handlePreview: this.onPreview },
|
29754 | on: {
|
29755 | 'remove': this.handleRemove
|
29756 | }
|
29757 | },
|
29758 | [function (props) {
|
29759 | if (_this4.$scopedSlots.file) {
|
29760 | return _this4.$scopedSlots.file({
|
29761 | file: props.file
|
29762 | });
|
29763 | }
|
29764 | }]
|
29765 | );
|
29766 | }
|
29767 |
|
29768 | var uploadData = {
|
29769 | props: {
|
29770 | type: this.type,
|
29771 | drag: this.drag,
|
29772 | action: this.action,
|
29773 | multiple: this.multiple,
|
29774 | 'before-upload': this.beforeUpload,
|
29775 | 'with-credentials': this.withCredentials,
|
29776 | headers: this.headers,
|
29777 | name: this.name,
|
29778 | data: this.data,
|
29779 | accept: this.accept,
|
29780 | fileList: this.uploadFiles,
|
29781 | autoUpload: this.autoUpload,
|
29782 | listType: this.listType,
|
29783 | disabled: this.uploadDisabled,
|
29784 | limit: this.limit,
|
29785 | 'on-exceed': this.onExceed,
|
29786 | 'on-start': this.handleStart,
|
29787 | 'on-progress': this.handleProgress,
|
29788 | 'on-success': this.handleSuccess,
|
29789 | 'on-error': this.handleError,
|
29790 | 'on-preview': this.onPreview,
|
29791 | 'on-remove': this.handleRemove,
|
29792 | 'http-request': this.httpRequest
|
29793 | },
|
29794 | ref: 'upload-inner'
|
29795 | };
|
29796 |
|
29797 | var trigger = this.$slots.trigger || this.$slots.default;
|
29798 | var uploadComponent = h(
|
29799 | 'upload',
|
29800 | uploadData,
|
29801 | [trigger]
|
29802 | );
|
29803 |
|
29804 | return h('div', [this.listType === 'picture-card' ? uploadList : '', this.$slots.trigger ? [uploadComponent, this.$slots.default] : uploadComponent, this.$slots.tip, this.listType !== 'picture-card' ? uploadList : '']);
|
29805 | }
|
29806 | });
|
29807 |
|
29808 | var upload_srcvue_type_script_lang_js_ = (srcvue_type_script_lang_js_);
|
29809 |
|
29810 | var src_render, src_staticRenderFns
|
29811 |
|
29812 |
|
29813 |
|
29814 |
|
29815 |
|
29816 |
|
29817 | var upload_src_component = normalizeComponent(
|
29818 | upload_srcvue_type_script_lang_js_,
|
29819 | src_render,
|
29820 | src_staticRenderFns,
|
29821 | false,
|
29822 | null,
|
29823 | null,
|
29824 | null
|
29825 |
|
29826 | )
|
29827 |
|
29828 |
|
29829 | if (false) { var src_api; }
|
29830 | upload_src_component.options.__file = "packages/upload/src/index.vue"
|
29831 | var upload_src = (upload_src_component.exports);
|
29832 |
|
29833 |
|
29834 |
|
29835 |
|
29836 | upload_src.install = function (Vue) {
|
29837 | Vue.component(upload_src.name, upload_src);
|
29838 | };
|
29839 |
|
29840 | var packages_upload = (upload_src);
|
29841 |
|
29842 | var progressvue_type_template_id_229ee406_render = function() {
|
29843 | var _vm = this
|
29844 | var _h = _vm.$createElement
|
29845 | var _c = _vm._self._c || _h
|
29846 | return _c(
|
29847 | "div",
|
29848 | {
|
29849 | staticClass: "el-progress",
|
29850 | class: [
|
29851 | "el-progress--" + _vm.type,
|
29852 | _vm.status ? "is-" + _vm.status : "",
|
29853 | {
|
29854 | "el-progress--without-text": !_vm.showText,
|
29855 | "el-progress--text-inside": _vm.textInside
|
29856 | }
|
29857 | ],
|
29858 | attrs: {
|
29859 | role: "progressbar",
|
29860 | "aria-valuenow": _vm.percentage,
|
29861 | "aria-valuemin": "0",
|
29862 | "aria-valuemax": "100"
|
29863 | }
|
29864 | },
|
29865 | [
|
29866 | _vm.type === "line"
|
29867 | ? _c("div", { staticClass: "el-progress-bar" }, [
|
29868 | _c(
|
29869 | "div",
|
29870 | {
|
29871 | staticClass: "el-progress-bar__outer",
|
29872 | style: { height: _vm.strokeWidth + "px" }
|
29873 | },
|
29874 | [
|
29875 | _c(
|
29876 | "div",
|
29877 | {
|
29878 | staticClass: "el-progress-bar__inner",
|
29879 | style: _vm.barStyle
|
29880 | },
|
29881 | [
|
29882 | _vm.showText && _vm.textInside
|
29883 | ? _c(
|
29884 | "div",
|
29885 | { staticClass: "el-progress-bar__innerText" },
|
29886 | [_vm._v(_vm._s(_vm.content))]
|
29887 | )
|
29888 | : _vm._e()
|
29889 | ]
|
29890 | )
|
29891 | ]
|
29892 | )
|
29893 | ])
|
29894 | : _c(
|
29895 | "div",
|
29896 | {
|
29897 | staticClass: "el-progress-circle",
|
29898 | style: { height: _vm.width + "px", width: _vm.width + "px" }
|
29899 | },
|
29900 | [
|
29901 | _c("svg", { attrs: { viewBox: "0 0 100 100" } }, [
|
29902 | _c("path", {
|
29903 | staticClass: "el-progress-circle__track",
|
29904 | style: _vm.trailPathStyle,
|
29905 | attrs: {
|
29906 | d: _vm.trackPath,
|
29907 | stroke: "#e5e9f2",
|
29908 | "stroke-width": _vm.relativeStrokeWidth,
|
29909 | fill: "none"
|
29910 | }
|
29911 | }),
|
29912 | _c("path", {
|
29913 | staticClass: "el-progress-circle__path",
|
29914 | style: _vm.circlePathStyle,
|
29915 | attrs: {
|
29916 | d: _vm.trackPath,
|
29917 | stroke: _vm.stroke,
|
29918 | fill: "none",
|
29919 | "stroke-linecap": _vm.strokeLinecap,
|
29920 | "stroke-width": _vm.percentage ? _vm.relativeStrokeWidth : 0
|
29921 | }
|
29922 | })
|
29923 | ])
|
29924 | ]
|
29925 | ),
|
29926 | _vm.showText && !_vm.textInside
|
29927 | ? _c(
|
29928 | "div",
|
29929 | {
|
29930 | staticClass: "el-progress__text",
|
29931 | style: { fontSize: _vm.progressTextSize + "px" }
|
29932 | },
|
29933 | [
|
29934 | !_vm.status
|
29935 | ? [_vm._v(_vm._s(_vm.content))]
|
29936 | : _c("i", { class: _vm.iconClass })
|
29937 | ],
|
29938 | 2
|
29939 | )
|
29940 | : _vm._e()
|
29941 | ]
|
29942 | )
|
29943 | }
|
29944 | var progressvue_type_template_id_229ee406_staticRenderFns = []
|
29945 | progressvue_type_template_id_229ee406_render._withStripped = true
|
29946 |
|
29947 |
|
29948 |
|
29949 |
|
29950 |
|
29951 |
|
29952 |
|
29953 |
|
29954 |
|
29955 |
|
29956 |
|
29957 |
|
29958 |
|
29959 |
|
29960 |
|
29961 |
|
29962 |
|
29963 |
|
29964 |
|
29965 |
|
29966 |
|
29967 |
|
29968 |
|
29969 |
|
29970 |
|
29971 |
|
29972 |
|
29973 |
|
29974 |
|
29975 |
|
29976 |
|
29977 |
|
29978 |
|
29979 |
|
29980 |
|
29981 |
|
29982 |
|
29983 |
|
29984 |
|
29985 |
|
29986 |
|
29987 |
|
29988 |
|
29989 |
|
29990 |
|
29991 |
|
29992 |
|
29993 |
|
29994 |
|
29995 |
|
29996 |
|
29997 |
|
29998 |
|
29999 |
|
30000 |
|
30001 |
|
30002 |
|
30003 |
|
30004 | var progressvue_type_script_lang_js_ = ({
|
30005 | name: 'ElProgress',
|
30006 | props: {
|
30007 | type: {
|
30008 | type: String,
|
30009 | default: 'line',
|
30010 | validator: function validator(val) {
|
30011 | return ['line', 'circle', 'dashboard'].indexOf(val) > -1;
|
30012 | }
|
30013 | },
|
30014 | percentage: {
|
30015 | type: Number,
|
30016 | default: 0,
|
30017 | required: true,
|
30018 | validator: function validator(val) {
|
30019 | return val >= 0 && val <= 100;
|
30020 | }
|
30021 | },
|
30022 | status: {
|
30023 | type: String,
|
30024 | validator: function validator(val) {
|
30025 | return ['success', 'exception', 'warning'].indexOf(val) > -1;
|
30026 | }
|
30027 | },
|
30028 | strokeWidth: {
|
30029 | type: Number,
|
30030 | default: 6
|
30031 | },
|
30032 | strokeLinecap: {
|
30033 | type: String,
|
30034 | default: 'round'
|
30035 | },
|
30036 | textInside: {
|
30037 | type: Boolean,
|
30038 | default: false
|
30039 | },
|
30040 | width: {
|
30041 | type: Number,
|
30042 | default: 126
|
30043 | },
|
30044 | showText: {
|
30045 | type: Boolean,
|
30046 | default: true
|
30047 | },
|
30048 | color: {
|
30049 | type: [String, Array, Function],
|
30050 | default: ''
|
30051 | },
|
30052 | format: Function
|
30053 | },
|
30054 | computed: {
|
30055 | barStyle: function barStyle() {
|
30056 | var style = {};
|
30057 | style.width = this.percentage + '%';
|
30058 | style.backgroundColor = this.getCurrentColor(this.percentage);
|
30059 | return style;
|
30060 | },
|
30061 | relativeStrokeWidth: function relativeStrokeWidth() {
|
30062 | return (this.strokeWidth / this.width * 100).toFixed(1);
|
30063 | },
|
30064 | radius: function radius() {
|
30065 | if (this.type === 'circle' || this.type === 'dashboard') {
|
30066 | return parseInt(50 - parseFloat(this.relativeStrokeWidth) / 2, 10);
|
30067 | } else {
|
30068 | return 0;
|
30069 | }
|
30070 | },
|
30071 | trackPath: function trackPath() {
|
30072 | var radius = this.radius;
|
30073 | var isDashboard = this.type === 'dashboard';
|
30074 | return '\n M 50 50\n m 0 ' + (isDashboard ? '' : '-') + radius + '\n a ' + radius + ' ' + radius + ' 0 1 1 0 ' + (isDashboard ? '-' : '') + radius * 2 + '\n a ' + radius + ' ' + radius + ' 0 1 1 0 ' + (isDashboard ? '' : '-') + radius * 2 + '\n ';
|
30075 | },
|
30076 | perimeter: function perimeter() {
|
30077 | return 2 * Math.PI * this.radius;
|
30078 | },
|
30079 | rate: function rate() {
|
30080 | return this.type === 'dashboard' ? 0.75 : 1;
|
30081 | },
|
30082 | strokeDashoffset: function strokeDashoffset() {
|
30083 | var offset = -1 * this.perimeter * (1 - this.rate) / 2;
|
30084 | return offset + 'px';
|
30085 | },
|
30086 | trailPathStyle: function trailPathStyle() {
|
30087 | return {
|
30088 | strokeDasharray: this.perimeter * this.rate + 'px, ' + this.perimeter + 'px',
|
30089 | strokeDashoffset: this.strokeDashoffset
|
30090 | };
|
30091 | },
|
30092 | circlePathStyle: function circlePathStyle() {
|
30093 | return {
|
30094 | strokeDasharray: this.perimeter * this.rate * (this.percentage / 100) + 'px, ' + this.perimeter + 'px',
|
30095 | strokeDashoffset: this.strokeDashoffset,
|
30096 | transition: 'stroke-dasharray 0.6s ease 0s, stroke 0.6s ease'
|
30097 | };
|
30098 | },
|
30099 | stroke: function stroke() {
|
30100 | var ret = void 0;
|
30101 | if (this.color) {
|
30102 | ret = this.getCurrentColor(this.percentage);
|
30103 | } else {
|
30104 | switch (this.status) {
|
30105 | case 'success':
|
30106 | ret = '#13ce66';
|
30107 | break;
|
30108 | case 'exception':
|
30109 | ret = '#ff4949';
|
30110 | break;
|
30111 | case 'warning':
|
30112 | ret = '#e6a23c';
|
30113 | break;
|
30114 | default:
|
30115 | ret = '#20a0ff';
|
30116 | }
|
30117 | }
|
30118 | return ret;
|
30119 | },
|
30120 | iconClass: function iconClass() {
|
30121 | if (this.status === 'warning') {
|
30122 | return 'el-icon-warning';
|
30123 | }
|
30124 | if (this.type === 'line') {
|
30125 | return this.status === 'success' ? 'el-icon-circle-check' : 'el-icon-circle-close';
|
30126 | } else {
|
30127 | return this.status === 'success' ? 'el-icon-check' : 'el-icon-close';
|
30128 | }
|
30129 | },
|
30130 | progressTextSize: function progressTextSize() {
|
30131 | return this.type === 'line' ? 12 + this.strokeWidth * 0.4 : this.width * 0.111111 + 2;
|
30132 | },
|
30133 | content: function content() {
|
30134 | if (typeof this.format === 'function') {
|
30135 | return this.format(this.percentage) || '';
|
30136 | } else {
|
30137 | return this.percentage + '%';
|
30138 | }
|
30139 | }
|
30140 | },
|
30141 | methods: {
|
30142 | getCurrentColor: function getCurrentColor(percentage) {
|
30143 | if (typeof this.color === 'function') {
|
30144 | return this.color(percentage);
|
30145 | } else if (typeof this.color === 'string') {
|
30146 | return this.color;
|
30147 | } else {
|
30148 | return this.getLevelColor(percentage);
|
30149 | }
|
30150 | },
|
30151 | getLevelColor: function getLevelColor(percentage) {
|
30152 | var colorArray = this.getColorArray().sort(function (a, b) {
|
30153 | return a.percentage - b.percentage;
|
30154 | });
|
30155 |
|
30156 | for (var i = 0; i < colorArray.length; i++) {
|
30157 | if (colorArray[i].percentage > percentage) {
|
30158 | return colorArray[i].color;
|
30159 | }
|
30160 | }
|
30161 | return colorArray[colorArray.length - 1].color;
|
30162 | },
|
30163 | getColorArray: function getColorArray() {
|
30164 | var color = this.color;
|
30165 | var span = 100 / color.length;
|
30166 | return color.map(function (seriesColor, index) {
|
30167 | if (typeof seriesColor === 'string') {
|
30168 | return {
|
30169 | color: seriesColor,
|
30170 | progress: (index + 1) * span
|
30171 | };
|
30172 | }
|
30173 | return seriesColor;
|
30174 | });
|
30175 | }
|
30176 | }
|
30177 | });
|
30178 |
|
30179 | var src_progressvue_type_script_lang_js_ = (progressvue_type_script_lang_js_);
|
30180 |
|
30181 |
|
30182 |
|
30183 |
|
30184 |
|
30185 |
|
30186 |
|
30187 |
|
30188 | var progress_component = normalizeComponent(
|
30189 | src_progressvue_type_script_lang_js_,
|
30190 | progressvue_type_template_id_229ee406_render,
|
30191 | progressvue_type_template_id_229ee406_staticRenderFns,
|
30192 | false,
|
30193 | null,
|
30194 | null,
|
30195 | null
|
30196 |
|
30197 | )
|
30198 |
|
30199 |
|
30200 | if (false) { var progress_api; }
|
30201 | progress_component.options.__file = "packages/progress/src/progress.vue"
|
30202 | var progress = (progress_component.exports);
|
30203 |
|
30204 |
|
30205 |
|
30206 |
|
30207 | progress.install = function (Vue) {
|
30208 | Vue.component(progress.name, progress);
|
30209 | };
|
30210 |
|
30211 | var packages_progress = (progress);
|
30212 |
|
30213 | var spinnervue_type_template_id_697b8538_render = function() {
|
30214 | var _vm = this
|
30215 | var _h = _vm.$createElement
|
30216 | var _c = _vm._self._c || _h
|
30217 | return _c("span", { staticClass: "el-spinner" }, [
|
30218 | _c(
|
30219 | "svg",
|
30220 | {
|
30221 | staticClass: "el-spinner-inner",
|
30222 | style: { width: _vm.radius / 2 + "px", height: _vm.radius / 2 + "px" },
|
30223 | attrs: { viewBox: "0 0 50 50" }
|
30224 | },
|
30225 | [
|
30226 | _c("circle", {
|
30227 | staticClass: "path",
|
30228 | attrs: {
|
30229 | cx: "25",
|
30230 | cy: "25",
|
30231 | r: "20",
|
30232 | fill: "none",
|
30233 | stroke: _vm.strokeColor,
|
30234 | "stroke-width": _vm.strokeWidth
|
30235 | }
|
30236 | })
|
30237 | ]
|
30238 | )
|
30239 | ])
|
30240 | }
|
30241 | var spinnervue_type_template_id_697b8538_staticRenderFns = []
|
30242 | spinnervue_type_template_id_697b8538_render._withStripped = true
|
30243 |
|
30244 |
|
30245 |
|
30246 |
|
30247 |
|
30248 |
|
30249 |
|
30250 |
|
30251 |
|
30252 |
|
30253 |
|
30254 |
|
30255 |
|
30256 | var spinnervue_type_script_lang_js_ = ({
|
30257 | name: 'ElSpinner',
|
30258 | props: {
|
30259 | type: String,
|
30260 | radius: {
|
30261 | type: Number,
|
30262 | default: 100
|
30263 | },
|
30264 | strokeWidth: {
|
30265 | type: Number,
|
30266 | default: 5
|
30267 | },
|
30268 | strokeColor: {
|
30269 | type: String,
|
30270 | default: '#efefef'
|
30271 | }
|
30272 | }
|
30273 | });
|
30274 |
|
30275 | var src_spinnervue_type_script_lang_js_ = (spinnervue_type_script_lang_js_);
|
30276 |
|
30277 |
|
30278 |
|
30279 |
|
30280 |
|
30281 |
|
30282 |
|
30283 |
|
30284 | var spinner_component = normalizeComponent(
|
30285 | src_spinnervue_type_script_lang_js_,
|
30286 | spinnervue_type_template_id_697b8538_render,
|
30287 | spinnervue_type_template_id_697b8538_staticRenderFns,
|
30288 | false,
|
30289 | null,
|
30290 | null,
|
30291 | null
|
30292 |
|
30293 | )
|
30294 |
|
30295 |
|
30296 | if (false) { var spinner_api; }
|
30297 | spinner_component.options.__file = "packages/spinner/src/spinner.vue"
|
30298 | var spinner = (spinner_component.exports);
|
30299 |
|
30300 |
|
30301 |
|
30302 |
|
30303 | spinner.install = function (Vue) {
|
30304 | Vue.component(spinner.name, spinner);
|
30305 | };
|
30306 |
|
30307 | var packages_spinner = (spinner);
|
30308 |
|
30309 | var mainvue_type_template_id_455b9f60_render = function() {
|
30310 | var _vm = this
|
30311 | var _h = _vm.$createElement
|
30312 | var _c = _vm._self._c || _h
|
30313 | return _c(
|
30314 | "transition",
|
30315 | {
|
30316 | attrs: { name: "el-message-fade" },
|
30317 | on: { "after-leave": _vm.handleAfterLeave }
|
30318 | },
|
30319 | [
|
30320 | _c(
|
30321 | "div",
|
30322 | {
|
30323 | directives: [
|
30324 | {
|
30325 | name: "show",
|
30326 | rawName: "v-show",
|
30327 | value: _vm.visible,
|
30328 | expression: "visible"
|
30329 | }
|
30330 | ],
|
30331 | class: [
|
30332 | "el-message",
|
30333 | _vm.type && !_vm.iconClass ? "el-message--" + _vm.type : "",
|
30334 | _vm.center ? "is-center" : "",
|
30335 | _vm.showClose ? "is-closable" : "",
|
30336 | _vm.customClass
|
30337 | ],
|
30338 | style: _vm.positionStyle,
|
30339 | attrs: { role: "alert" },
|
30340 | on: { mouseenter: _vm.clearTimer, mouseleave: _vm.startTimer }
|
30341 | },
|
30342 | [
|
30343 | _vm.iconClass
|
30344 | ? _c("i", { class: _vm.iconClass })
|
30345 | : _c("i", { class: _vm.typeClass }),
|
30346 | _vm._t("default", [
|
30347 | !_vm.dangerouslyUseHTMLString
|
30348 | ? _c("p", { staticClass: "el-message__content" }, [
|
30349 | _vm._v(_vm._s(_vm.message))
|
30350 | ])
|
30351 | : _c("p", {
|
30352 | staticClass: "el-message__content",
|
30353 | domProps: { innerHTML: _vm._s(_vm.message) }
|
30354 | })
|
30355 | ]),
|
30356 | _vm.showClose
|
30357 | ? _c("i", {
|
30358 | staticClass: "el-message__closeBtn el-icon-close",
|
30359 | on: { click: _vm.close }
|
30360 | })
|
30361 | : _vm._e()
|
30362 | ],
|
30363 | 2
|
30364 | )
|
30365 | ]
|
30366 | )
|
30367 | }
|
30368 | var mainvue_type_template_id_455b9f60_staticRenderFns = []
|
30369 | mainvue_type_template_id_455b9f60_render._withStripped = true
|
30370 |
|
30371 |
|
30372 |
|
30373 |
|
30374 |
|
30375 |
|
30376 |
|
30377 |
|
30378 |
|
30379 |
|
30380 |
|
30381 |
|
30382 |
|
30383 |
|
30384 |
|
30385 |
|
30386 |
|
30387 |
|
30388 |
|
30389 |
|
30390 |
|
30391 |
|
30392 |
|
30393 |
|
30394 |
|
30395 |
|
30396 |
|
30397 |
|
30398 |
|
30399 |
|
30400 |
|
30401 |
|
30402 | var src_mainvue_type_script_lang_js_typeMap = {
|
30403 | success: 'success',
|
30404 | info: 'info',
|
30405 | warning: 'warning',
|
30406 | error: 'error'
|
30407 | };
|
30408 |
|
30409 | var message_src_mainvue_type_script_lang_js_ = ({
|
30410 | data: function data() {
|
30411 | return {
|
30412 | visible: false,
|
30413 | message: '',
|
30414 | duration: 3000,
|
30415 | type: 'info',
|
30416 | iconClass: '',
|
30417 | customClass: '',
|
30418 | onClose: null,
|
30419 | showClose: false,
|
30420 | closed: false,
|
30421 | verticalOffset: 20,
|
30422 | timer: null,
|
30423 | dangerouslyUseHTMLString: false,
|
30424 | center: false
|
30425 | };
|
30426 | },
|
30427 |
|
30428 |
|
30429 | computed: {
|
30430 | typeClass: function typeClass() {
|
30431 | return this.type && !this.iconClass ? 'el-message__icon el-icon-' + src_mainvue_type_script_lang_js_typeMap[this.type] : '';
|
30432 | },
|
30433 | positionStyle: function positionStyle() {
|
30434 | return {
|
30435 | 'top': this.verticalOffset + 'px'
|
30436 | };
|
30437 | }
|
30438 | },
|
30439 |
|
30440 | watch: {
|
30441 | closed: function closed(newVal) {
|
30442 | if (newVal) {
|
30443 | this.visible = false;
|
30444 | }
|
30445 | }
|
30446 | },
|
30447 |
|
30448 | methods: {
|
30449 | handleAfterLeave: function handleAfterLeave() {
|
30450 | this.$destroy(true);
|
30451 | this.$el.parentNode.removeChild(this.$el);
|
30452 | },
|
30453 | close: function close() {
|
30454 | this.closed = true;
|
30455 | if (typeof this.onClose === 'function') {
|
30456 | this.onClose(this);
|
30457 | }
|
30458 | },
|
30459 | clearTimer: function clearTimer() {
|
30460 | clearTimeout(this.timer);
|
30461 | },
|
30462 | startTimer: function startTimer() {
|
30463 | var _this = this;
|
30464 |
|
30465 | if (this.duration > 0) {
|
30466 | this.timer = setTimeout(function () {
|
30467 | if (!_this.closed) {
|
30468 | _this.close();
|
30469 | }
|
30470 | }, this.duration);
|
30471 | }
|
30472 | },
|
30473 | keydown: function keydown(e) {
|
30474 | if (e.keyCode === 27) {
|
30475 |
|
30476 | if (!this.closed) {
|
30477 | this.close();
|
30478 | }
|
30479 | }
|
30480 | }
|
30481 | },
|
30482 | mounted: function mounted() {
|
30483 | this.startTimer();
|
30484 | document.addEventListener('keydown', this.keydown);
|
30485 | },
|
30486 | beforeDestroy: function beforeDestroy() {
|
30487 | document.removeEventListener('keydown', this.keydown);
|
30488 | }
|
30489 | });
|
30490 |
|
30491 | var packages_message_src_mainvue_type_script_lang_js_ = (message_src_mainvue_type_script_lang_js_);
|
30492 |
|
30493 |
|
30494 |
|
30495 |
|
30496 |
|
30497 |
|
30498 |
|
30499 |
|
30500 | var message_src_main_component = normalizeComponent(
|
30501 | packages_message_src_mainvue_type_script_lang_js_,
|
30502 | mainvue_type_template_id_455b9f60_render,
|
30503 | mainvue_type_template_id_455b9f60_staticRenderFns,
|
30504 | false,
|
30505 | null,
|
30506 | null,
|
30507 | null
|
30508 |
|
30509 | )
|
30510 |
|
30511 |
|
30512 | if (false) { var message_src_main_api; }
|
30513 | message_src_main_component.options.__file = "packages/message/src/main.vue"
|
30514 | var message_src_main = (message_src_main_component.exports);
|
30515 |
|
30516 |
|
30517 |
|
30518 |
|
30519 |
|
30520 | var MessageConstructor = external_vue_default.a.extend(message_src_main);
|
30521 |
|
30522 | var message_src_main_instance = void 0;
|
30523 | var main_instances = [];
|
30524 | var main_seed = 1;
|
30525 |
|
30526 | var main_Message = function Message(options) {
|
30527 | if (external_vue_default.a.prototype.$isServer) return;
|
30528 | options = options || {};
|
30529 | if (typeof options === 'string') {
|
30530 | options = {
|
30531 | message: options
|
30532 | };
|
30533 | }
|
30534 | var userOnClose = options.onClose;
|
30535 | var id = 'message_' + main_seed++;
|
30536 |
|
30537 | options.onClose = function () {
|
30538 | Message.close(id, userOnClose);
|
30539 | };
|
30540 | message_src_main_instance = new MessageConstructor({
|
30541 | data: options
|
30542 | });
|
30543 | message_src_main_instance.id = id;
|
30544 | if (Object(vdom_["isVNode"])(message_src_main_instance.message)) {
|
30545 | message_src_main_instance.$slots.default = [message_src_main_instance.message];
|
30546 | message_src_main_instance.message = null;
|
30547 | }
|
30548 | message_src_main_instance.$mount();
|
30549 | document.body.appendChild(message_src_main_instance.$el);
|
30550 | var verticalOffset = options.offset || 20;
|
30551 | main_instances.forEach(function (item) {
|
30552 | verticalOffset += item.$el.offsetHeight + 16;
|
30553 | });
|
30554 | message_src_main_instance.verticalOffset = verticalOffset;
|
30555 | message_src_main_instance.visible = true;
|
30556 | message_src_main_instance.$el.style.zIndex = popup_["PopupManager"].nextZIndex();
|
30557 | main_instances.push(message_src_main_instance);
|
30558 | return message_src_main_instance;
|
30559 | };
|
30560 |
|
30561 | ['success', 'warning', 'info', 'error'].forEach(function (type) {
|
30562 | main_Message[type] = function (options) {
|
30563 | if (typeof options === 'string') {
|
30564 | options = {
|
30565 | message: options
|
30566 | };
|
30567 | }
|
30568 | options.type = type;
|
30569 | return main_Message(options);
|
30570 | };
|
30571 | });
|
30572 |
|
30573 | main_Message.close = function (id, userOnClose) {
|
30574 | var len = main_instances.length;
|
30575 | var index = -1;
|
30576 | var removedHeight = void 0;
|
30577 | for (var i = 0; i < len; i++) {
|
30578 | if (id === main_instances[i].id) {
|
30579 | removedHeight = main_instances[i].$el.offsetHeight;
|
30580 | index = i;
|
30581 | if (typeof userOnClose === 'function') {
|
30582 | userOnClose(main_instances[i]);
|
30583 | }
|
30584 | main_instances.splice(i, 1);
|
30585 | break;
|
30586 | }
|
30587 | }
|
30588 | if (len <= 1 || index === -1 || index > main_instances.length - 1) return;
|
30589 | for (var _i = index; _i < len - 1; _i++) {
|
30590 | var dom = main_instances[_i].$el;
|
30591 | dom.style['top'] = parseInt(dom.style['top'], 10) - removedHeight - 16 + 'px';
|
30592 | }
|
30593 | };
|
30594 |
|
30595 | main_Message.closeAll = function () {
|
30596 | for (var i = main_instances.length - 1; i >= 0; i--) {
|
30597 | main_instances[i].close();
|
30598 | }
|
30599 | };
|
30600 |
|
30601 | var packages_message_src_main = (main_Message);
|
30602 |
|
30603 |
|
30604 | var packages_message = (packages_message_src_main);
|
30605 |
|
30606 | var mainvue_type_template_id_7ccb6598_render = function() {
|
30607 | var _vm = this
|
30608 | var _h = _vm.$createElement
|
30609 | var _c = _vm._self._c || _h
|
30610 | return _c(
|
30611 | "div",
|
30612 | { staticClass: "el-badge" },
|
30613 | [
|
30614 | _vm._t("default"),
|
30615 | _c("transition", { attrs: { name: "el-zoom-in-center" } }, [
|
30616 | _c("sup", {
|
30617 | directives: [
|
30618 | {
|
30619 | name: "show",
|
30620 | rawName: "v-show",
|
30621 | value:
|
30622 | !_vm.hidden && (_vm.content || _vm.content === 0 || _vm.isDot),
|
30623 | expression: "!hidden && (content || content === 0 || isDot)"
|
30624 | }
|
30625 | ],
|
30626 | staticClass: "el-badge__content",
|
30627 | class: [
|
30628 | "el-badge__content--" + _vm.type,
|
30629 | {
|
30630 | "is-fixed": _vm.$slots.default,
|
30631 | "is-dot": _vm.isDot
|
30632 | }
|
30633 | ],
|
30634 | domProps: { textContent: _vm._s(_vm.content) }
|
30635 | })
|
30636 | ])
|
30637 | ],
|
30638 | 2
|
30639 | )
|
30640 | }
|
30641 | var mainvue_type_template_id_7ccb6598_staticRenderFns = []
|
30642 | mainvue_type_template_id_7ccb6598_render._withStripped = true
|
30643 |
|
30644 |
|
30645 |
|
30646 |
|
30647 |
|
30648 |
|
30649 |
|
30650 |
|
30651 |
|
30652 |
|
30653 |
|
30654 |
|
30655 |
|
30656 |
|
30657 |
|
30658 |
|
30659 |
|
30660 |
|
30661 |
|
30662 |
|
30663 |
|
30664 |
|
30665 |
|
30666 |
|
30667 |
|
30668 |
|
30669 | var badge_src_mainvue_type_script_lang_js_ = ({
|
30670 | name: 'ElBadge',
|
30671 |
|
30672 | props: {
|
30673 | value: [String, Number],
|
30674 | max: Number,
|
30675 | isDot: Boolean,
|
30676 | hidden: Boolean,
|
30677 | type: {
|
30678 | type: String,
|
30679 | validator: function validator(val) {
|
30680 | return ['primary', 'success', 'warning', 'info', 'danger'].indexOf(val) > -1;
|
30681 | }
|
30682 | }
|
30683 | },
|
30684 |
|
30685 | computed: {
|
30686 | content: function content() {
|
30687 | if (this.isDot) return;
|
30688 |
|
30689 | var value = this.value;
|
30690 | var max = this.max;
|
30691 |
|
30692 | if (typeof value === 'number' && typeof max === 'number') {
|
30693 | return max < value ? max + '+' : value;
|
30694 | }
|
30695 |
|
30696 | return value;
|
30697 | }
|
30698 | }
|
30699 | });
|
30700 |
|
30701 | var packages_badge_src_mainvue_type_script_lang_js_ = (badge_src_mainvue_type_script_lang_js_);
|
30702 |
|
30703 |
|
30704 |
|
30705 |
|
30706 |
|
30707 |
|
30708 |
|
30709 |
|
30710 | var badge_src_main_component = normalizeComponent(
|
30711 | packages_badge_src_mainvue_type_script_lang_js_,
|
30712 | mainvue_type_template_id_7ccb6598_render,
|
30713 | mainvue_type_template_id_7ccb6598_staticRenderFns,
|
30714 | false,
|
30715 | null,
|
30716 | null,
|
30717 | null
|
30718 |
|
30719 | )
|
30720 |
|
30721 |
|
30722 | if (false) { var badge_src_main_api; }
|
30723 | badge_src_main_component.options.__file = "packages/badge/src/main.vue"
|
30724 | var badge_src_main = (badge_src_main_component.exports);
|
30725 |
|
30726 |
|
30727 |
|
30728 |
|
30729 | badge_src_main.install = function (Vue) {
|
30730 | Vue.component(badge_src_main.name, badge_src_main);
|
30731 | };
|
30732 |
|
30733 | var badge = (badge_src_main);
|
30734 |
|
30735 | var mainvue_type_template_id_59a4a40f_render = function() {
|
30736 | var _vm = this
|
30737 | var _h = _vm.$createElement
|
30738 | var _c = _vm._self._c || _h
|
30739 | return _c(
|
30740 | "div",
|
30741 | {
|
30742 | staticClass: "el-card",
|
30743 | class: _vm.shadow ? "is-" + _vm.shadow + "-shadow" : "is-always-shadow"
|
30744 | },
|
30745 | [
|
30746 | _vm.$slots.header || _vm.header
|
30747 | ? _c(
|
30748 | "div",
|
30749 | { staticClass: "el-card__header" },
|
30750 | [_vm._t("header", [_vm._v(_vm._s(_vm.header))])],
|
30751 | 2
|
30752 | )
|
30753 | : _vm._e(),
|
30754 | _c(
|
30755 | "div",
|
30756 | { staticClass: "el-card__body", style: _vm.bodyStyle },
|
30757 | [_vm._t("default")],
|
30758 | 2
|
30759 | )
|
30760 | ]
|
30761 | )
|
30762 | }
|
30763 | var mainvue_type_template_id_59a4a40f_staticRenderFns = []
|
30764 | mainvue_type_template_id_59a4a40f_render._withStripped = true
|
30765 |
|
30766 |
|
30767 |
|
30768 |
|
30769 |
|
30770 |
|
30771 |
|
30772 |
|
30773 |
|
30774 |
|
30775 |
|
30776 |
|
30777 |
|
30778 |
|
30779 |
|
30780 |
|
30781 |
|
30782 | var card_src_mainvue_type_script_lang_js_ = ({
|
30783 | name: 'ElCard',
|
30784 | props: {
|
30785 | header: {},
|
30786 | bodyStyle: {},
|
30787 | shadow: {
|
30788 | type: String
|
30789 | }
|
30790 | }
|
30791 | });
|
30792 |
|
30793 | var packages_card_src_mainvue_type_script_lang_js_ = (card_src_mainvue_type_script_lang_js_);
|
30794 |
|
30795 |
|
30796 |
|
30797 |
|
30798 |
|
30799 |
|
30800 |
|
30801 |
|
30802 | var card_src_main_component = normalizeComponent(
|
30803 | packages_card_src_mainvue_type_script_lang_js_,
|
30804 | mainvue_type_template_id_59a4a40f_render,
|
30805 | mainvue_type_template_id_59a4a40f_staticRenderFns,
|
30806 | false,
|
30807 | null,
|
30808 | null,
|
30809 | null
|
30810 |
|
30811 | )
|
30812 |
|
30813 |
|
30814 | if (false) { var card_src_main_api; }
|
30815 | card_src_main_component.options.__file = "packages/card/src/main.vue"
|
30816 | var card_src_main = (card_src_main_component.exports);
|
30817 |
|
30818 |
|
30819 |
|
30820 |
|
30821 | card_src_main.install = function (Vue) {
|
30822 | Vue.component(card_src_main.name, card_src_main);
|
30823 | };
|
30824 |
|
30825 | var card = (card_src_main);
|
30826 |
|
30827 | var mainvue_type_template_id_ada57782_render = function() {
|
30828 | var _vm = this
|
30829 | var _h = _vm.$createElement
|
30830 | var _c = _vm._self._c || _h
|
30831 | return _c(
|
30832 | "div",
|
30833 | {
|
30834 | staticClass: "el-rate",
|
30835 | attrs: {
|
30836 | role: "slider",
|
30837 | "aria-valuenow": _vm.currentValue,
|
30838 | "aria-valuetext": _vm.text,
|
30839 | "aria-valuemin": "0",
|
30840 | "aria-valuemax": _vm.max,
|
30841 | tabindex: "0"
|
30842 | },
|
30843 | on: { keydown: _vm.handleKey }
|
30844 | },
|
30845 | [
|
30846 | _vm._l(_vm.max, function(item, key) {
|
30847 | return _c(
|
30848 | "span",
|
30849 | {
|
30850 | key: key,
|
30851 | staticClass: "el-rate__item",
|
30852 | style: { cursor: _vm.rateDisabled ? "auto" : "pointer" },
|
30853 | on: {
|
30854 | mousemove: function($event) {
|
30855 | _vm.setCurrentValue(item, $event)
|
30856 | },
|
30857 | mouseleave: _vm.resetCurrentValue,
|
30858 | click: function($event) {
|
30859 | _vm.selectValue(item)
|
30860 | }
|
30861 | }
|
30862 | },
|
30863 | [
|
30864 | _c(
|
30865 | "i",
|
30866 | {
|
30867 | staticClass: "el-rate__icon",
|
30868 | class: [
|
30869 | _vm.classes[item - 1],
|
30870 | { hover: _vm.hoverIndex === item }
|
30871 | ],
|
30872 | style: _vm.getIconStyle(item)
|
30873 | },
|
30874 | [
|
30875 | _vm.showDecimalIcon(item)
|
30876 | ? _c("i", {
|
30877 | staticClass: "el-rate__decimal",
|
30878 | class: _vm.decimalIconClass,
|
30879 | style: _vm.decimalStyle
|
30880 | })
|
30881 | : _vm._e()
|
30882 | ]
|
30883 | )
|
30884 | ]
|
30885 | )
|
30886 | }),
|
30887 | _vm.showText || _vm.showScore
|
30888 | ? _c(
|
30889 | "span",
|
30890 | { staticClass: "el-rate__text", style: { color: _vm.textColor } },
|
30891 | [_vm._v(_vm._s(_vm.text))]
|
30892 | )
|
30893 | : _vm._e()
|
30894 | ],
|
30895 | 2
|
30896 | )
|
30897 | }
|
30898 | var mainvue_type_template_id_ada57782_staticRenderFns = []
|
30899 | mainvue_type_template_id_ada57782_render._withStripped = true
|
30900 |
|
30901 |
|
30902 |
|
30903 |
|
30904 |
|
30905 | var types_ = __webpack_require__(18);
|
30906 |
|
30907 |
|
30908 |
|
30909 |
|
30910 |
|
30911 |
|
30912 |
|
30913 |
|
30914 |
|
30915 |
|
30916 |
|
30917 |
|
30918 |
|
30919 |
|
30920 |
|
30921 |
|
30922 |
|
30923 |
|
30924 |
|
30925 |
|
30926 |
|
30927 |
|
30928 |
|
30929 |
|
30930 |
|
30931 |
|
30932 |
|
30933 |
|
30934 |
|
30935 |
|
30936 |
|
30937 |
|
30938 |
|
30939 |
|
30940 |
|
30941 |
|
30942 |
|
30943 |
|
30944 |
|
30945 |
|
30946 |
|
30947 | var rate_src_mainvue_type_script_lang_js_ = ({
|
30948 | name: 'ElRate',
|
30949 |
|
30950 | mixins: [migrating_default.a],
|
30951 |
|
30952 | inject: {
|
30953 | elForm: {
|
30954 | default: ''
|
30955 | }
|
30956 | },
|
30957 |
|
30958 | data: function data() {
|
30959 | return {
|
30960 | pointerAtLeftHalf: true,
|
30961 | currentValue: this.value,
|
30962 | hoverIndex: -1
|
30963 | };
|
30964 | },
|
30965 |
|
30966 |
|
30967 | props: {
|
30968 | value: {
|
30969 | type: Number,
|
30970 | default: 0
|
30971 | },
|
30972 | lowThreshold: {
|
30973 | type: Number,
|
30974 | default: 2
|
30975 | },
|
30976 | highThreshold: {
|
30977 | type: Number,
|
30978 | default: 4
|
30979 | },
|
30980 | max: {
|
30981 | type: Number,
|
30982 | default: 5
|
30983 | },
|
30984 | colors: {
|
30985 | type: [Array, Object],
|
30986 | default: function _default() {
|
30987 | return ['#F7BA2A', '#F7BA2A', '#F7BA2A'];
|
30988 | }
|
30989 | },
|
30990 | voidColor: {
|
30991 | type: String,
|
30992 | default: '#C6D1DE'
|
30993 | },
|
30994 | disabledVoidColor: {
|
30995 | type: String,
|
30996 | default: '#EFF2F7'
|
30997 | },
|
30998 | iconClasses: {
|
30999 | type: [Array, Object],
|
31000 | default: function _default() {
|
31001 | return ['el-icon-star-on', 'el-icon-star-on', 'el-icon-star-on'];
|
31002 | }
|
31003 | },
|
31004 | voidIconClass: {
|
31005 | type: String,
|
31006 | default: 'el-icon-star-off'
|
31007 | },
|
31008 | disabledVoidIconClass: {
|
31009 | type: String,
|
31010 | default: 'el-icon-star-on'
|
31011 | },
|
31012 | disabled: {
|
31013 | type: Boolean,
|
31014 | default: false
|
31015 | },
|
31016 | allowHalf: {
|
31017 | type: Boolean,
|
31018 | default: false
|
31019 | },
|
31020 | showText: {
|
31021 | type: Boolean,
|
31022 | default: false
|
31023 | },
|
31024 | showScore: {
|
31025 | type: Boolean,
|
31026 | default: false
|
31027 | },
|
31028 | textColor: {
|
31029 | type: String,
|
31030 | default: '#1f2d3d'
|
31031 | },
|
31032 | texts: {
|
31033 | type: Array,
|
31034 | default: function _default() {
|
31035 | return ['极差', '失望', '一般', '满意', '惊喜'];
|
31036 | }
|
31037 | },
|
31038 | scoreTemplate: {
|
31039 | type: String,
|
31040 | default: '{value}'
|
31041 | }
|
31042 | },
|
31043 |
|
31044 | computed: {
|
31045 | text: function text() {
|
31046 | var result = '';
|
31047 | if (this.showScore) {
|
31048 | result = this.scoreTemplate.replace(/\{\s*value\s*\}/, this.rateDisabled ? this.value : this.currentValue);
|
31049 | } else if (this.showText) {
|
31050 | result = this.texts[Math.ceil(this.currentValue) - 1];
|
31051 | }
|
31052 | return result;
|
31053 | },
|
31054 | decimalStyle: function decimalStyle() {
|
31055 | var width = '';
|
31056 | if (this.rateDisabled) {
|
31057 | width = this.valueDecimal + '%';
|
31058 | } else if (this.allowHalf) {
|
31059 | width = '50%';
|
31060 | }
|
31061 | return {
|
31062 | color: this.activeColor,
|
31063 | width: width
|
31064 | };
|
31065 | },
|
31066 | valueDecimal: function valueDecimal() {
|
31067 | return this.value * 100 - Math.floor(this.value) * 100;
|
31068 | },
|
31069 | classMap: function classMap() {
|
31070 | var _ref;
|
31071 |
|
31072 | return Array.isArray(this.iconClasses) ? (_ref = {}, _ref[this.lowThreshold] = this.iconClasses[0], _ref[this.highThreshold] = { value: this.iconClasses[1], excluded: true }, _ref[this.max] = this.iconClasses[2], _ref) : this.iconClasses;
|
31073 | },
|
31074 | decimalIconClass: function decimalIconClass() {
|
31075 | return this.getValueFromMap(this.value, this.classMap);
|
31076 | },
|
31077 | voidClass: function voidClass() {
|
31078 | return this.rateDisabled ? this.disabledVoidIconClass : this.voidIconClass;
|
31079 | },
|
31080 | activeClass: function activeClass() {
|
31081 | return this.getValueFromMap(this.currentValue, this.classMap);
|
31082 | },
|
31083 | colorMap: function colorMap() {
|
31084 | var _ref2;
|
31085 |
|
31086 | return Array.isArray(this.colors) ? (_ref2 = {}, _ref2[this.lowThreshold] = this.colors[0], _ref2[this.highThreshold] = { value: this.colors[1], excluded: true }, _ref2[this.max] = this.colors[2], _ref2) : this.colors;
|
31087 | },
|
31088 | activeColor: function activeColor() {
|
31089 | return this.getValueFromMap(this.currentValue, this.colorMap);
|
31090 | },
|
31091 | classes: function classes() {
|
31092 | var result = [];
|
31093 | var i = 0;
|
31094 | var threshold = this.currentValue;
|
31095 | if (this.allowHalf && this.currentValue !== Math.floor(this.currentValue)) {
|
31096 | threshold--;
|
31097 | }
|
31098 | for (; i < threshold; i++) {
|
31099 | result.push(this.activeClass);
|
31100 | }
|
31101 | for (; i < this.max; i++) {
|
31102 | result.push(this.voidClass);
|
31103 | }
|
31104 | return result;
|
31105 | },
|
31106 | rateDisabled: function rateDisabled() {
|
31107 | return this.disabled || (this.elForm || {}).disabled;
|
31108 | }
|
31109 | },
|
31110 |
|
31111 | watch: {
|
31112 | value: function value(val) {
|
31113 | this.currentValue = val;
|
31114 | this.pointerAtLeftHalf = this.value !== Math.floor(this.value);
|
31115 | }
|
31116 | },
|
31117 |
|
31118 | methods: {
|
31119 | getMigratingConfig: function getMigratingConfig() {
|
31120 | return {
|
31121 | props: {
|
31122 | 'text-template': 'text-template is renamed to score-template.'
|
31123 | }
|
31124 | };
|
31125 | },
|
31126 | getValueFromMap: function getValueFromMap(value, map) {
|
31127 | var matchedKeys = Object.keys(map).filter(function (key) {
|
31128 | var val = map[key];
|
31129 | var excluded = Object(types_["isObject"])(val) ? val.excluded : false;
|
31130 | return excluded ? value < key : value <= key;
|
31131 | }).sort(function (a, b) {
|
31132 | return a - b;
|
31133 | });
|
31134 | var matchedValue = map[matchedKeys[0]];
|
31135 | return Object(types_["isObject"])(matchedValue) ? matchedValue.value : matchedValue || '';
|
31136 | },
|
31137 | showDecimalIcon: function showDecimalIcon(item) {
|
31138 | var showWhenDisabled = this.rateDisabled && this.valueDecimal > 0 && item - 1 < this.value && item > this.value;
|
31139 |
|
31140 | var showWhenAllowHalf = this.allowHalf && this.pointerAtLeftHalf && item - 0.5 <= this.currentValue && item > this.currentValue;
|
31141 | return showWhenDisabled || showWhenAllowHalf;
|
31142 | },
|
31143 | getIconStyle: function getIconStyle(item) {
|
31144 | var voidColor = this.rateDisabled ? this.disabledVoidColor : this.voidColor;
|
31145 | return {
|
31146 | color: item <= this.currentValue ? this.activeColor : voidColor
|
31147 | };
|
31148 | },
|
31149 | selectValue: function selectValue(value) {
|
31150 | if (this.rateDisabled) {
|
31151 | return;
|
31152 | }
|
31153 | if (this.allowHalf && this.pointerAtLeftHalf) {
|
31154 | this.$emit('input', this.currentValue);
|
31155 | this.$emit('change', this.currentValue);
|
31156 | } else {
|
31157 | this.$emit('input', value);
|
31158 | this.$emit('change', value);
|
31159 | }
|
31160 | },
|
31161 | handleKey: function handleKey(e) {
|
31162 | if (this.rateDisabled) {
|
31163 | return;
|
31164 | }
|
31165 | var currentValue = this.currentValue;
|
31166 | var keyCode = e.keyCode;
|
31167 | if (keyCode === 38 || keyCode === 39) {
|
31168 |
|
31169 | if (this.allowHalf) {
|
31170 | currentValue += 0.5;
|
31171 | } else {
|
31172 | currentValue += 1;
|
31173 | }
|
31174 | e.stopPropagation();
|
31175 | e.preventDefault();
|
31176 | } else if (keyCode === 37 || keyCode === 40) {
|
31177 | if (this.allowHalf) {
|
31178 | currentValue -= 0.5;
|
31179 | } else {
|
31180 | currentValue -= 1;
|
31181 | }
|
31182 | e.stopPropagation();
|
31183 | e.preventDefault();
|
31184 | }
|
31185 | currentValue = currentValue < 0 ? 0 : currentValue;
|
31186 | currentValue = currentValue > this.max ? this.max : currentValue;
|
31187 |
|
31188 | this.$emit('input', currentValue);
|
31189 | this.$emit('change', currentValue);
|
31190 | },
|
31191 | setCurrentValue: function setCurrentValue(value, event) {
|
31192 | if (this.rateDisabled) {
|
31193 | return;
|
31194 | }
|
31195 |
|
31196 | if (this.allowHalf) {
|
31197 | var target = event.target;
|
31198 | if (Object(dom_["hasClass"])(target, 'el-rate__item')) {
|
31199 | target = target.querySelector('.el-rate__icon');
|
31200 | }
|
31201 | if (Object(dom_["hasClass"])(target, 'el-rate__decimal')) {
|
31202 | target = target.parentNode;
|
31203 | }
|
31204 | this.pointerAtLeftHalf = event.offsetX * 2 <= target.clientWidth;
|
31205 | this.currentValue = this.pointerAtLeftHalf ? value - 0.5 : value;
|
31206 | } else {
|
31207 | this.currentValue = value;
|
31208 | }
|
31209 | this.hoverIndex = value;
|
31210 | },
|
31211 | resetCurrentValue: function resetCurrentValue() {
|
31212 | if (this.rateDisabled) {
|
31213 | return;
|
31214 | }
|
31215 | if (this.allowHalf) {
|
31216 | this.pointerAtLeftHalf = this.value !== Math.floor(this.value);
|
31217 | }
|
31218 | this.currentValue = this.value;
|
31219 | this.hoverIndex = -1;
|
31220 | }
|
31221 | },
|
31222 |
|
31223 | created: function created() {
|
31224 | if (!this.value) {
|
31225 | this.$emit('input', 0);
|
31226 | }
|
31227 | }
|
31228 | });
|
31229 |
|
31230 | var packages_rate_src_mainvue_type_script_lang_js_ = (rate_src_mainvue_type_script_lang_js_);
|
31231 |
|
31232 |
|
31233 |
|
31234 |
|
31235 |
|
31236 |
|
31237 |
|
31238 |
|
31239 | var rate_src_main_component = normalizeComponent(
|
31240 | packages_rate_src_mainvue_type_script_lang_js_,
|
31241 | mainvue_type_template_id_ada57782_render,
|
31242 | mainvue_type_template_id_ada57782_staticRenderFns,
|
31243 | false,
|
31244 | null,
|
31245 | null,
|
31246 | null
|
31247 |
|
31248 | )
|
31249 |
|
31250 |
|
31251 | if (false) { var rate_src_main_api; }
|
31252 | rate_src_main_component.options.__file = "packages/rate/src/main.vue"
|
31253 | var rate_src_main = (rate_src_main_component.exports);
|
31254 |
|
31255 |
|
31256 |
|
31257 |
|
31258 | rate_src_main.install = function (Vue) {
|
31259 | Vue.component(rate_src_main.name, rate_src_main);
|
31260 | };
|
31261 |
|
31262 | var rate = (rate_src_main);
|
31263 |
|
31264 | var stepsvue_type_template_id_3c6b6dc0_render = function() {
|
31265 | var _vm = this
|
31266 | var _h = _vm.$createElement
|
31267 | var _c = _vm._self._c || _h
|
31268 | return _c(
|
31269 | "div",
|
31270 | {
|
31271 | staticClass: "el-steps",
|
31272 | class: [
|
31273 | !_vm.simple && "el-steps--" + _vm.direction,
|
31274 | _vm.simple && "el-steps--simple"
|
31275 | ]
|
31276 | },
|
31277 | [_vm._t("default")],
|
31278 | 2
|
31279 | )
|
31280 | }
|
31281 | var stepsvue_type_template_id_3c6b6dc0_staticRenderFns = []
|
31282 | stepsvue_type_template_id_3c6b6dc0_render._withStripped = true
|
31283 |
|
31284 |
|
31285 |
|
31286 |
|
31287 |
|
31288 |
|
31289 |
|
31290 |
|
31291 |
|
31292 |
|
31293 |
|
31294 |
|
31295 |
|
31296 |
|
31297 |
|
31298 |
|
31299 |
|
31300 |
|
31301 |
|
31302 | var stepsvue_type_script_lang_js_ = ({
|
31303 | name: 'ElSteps',
|
31304 |
|
31305 | mixins: [migrating_default.a],
|
31306 |
|
31307 | props: {
|
31308 | space: [Number, String],
|
31309 | active: Number,
|
31310 | direction: {
|
31311 | type: String,
|
31312 | default: 'horizontal'
|
31313 | },
|
31314 | alignCenter: Boolean,
|
31315 | simple: Boolean,
|
31316 | finishStatus: {
|
31317 | type: String,
|
31318 | default: 'finish'
|
31319 | },
|
31320 | processStatus: {
|
31321 | type: String,
|
31322 | default: 'process'
|
31323 | }
|
31324 | },
|
31325 |
|
31326 | data: function data() {
|
31327 | return {
|
31328 | steps: [],
|
31329 | stepOffset: 0
|
31330 | };
|
31331 | },
|
31332 |
|
31333 |
|
31334 | methods: {
|
31335 | getMigratingConfig: function getMigratingConfig() {
|
31336 | return {
|
31337 | props: {
|
31338 | 'center': 'center is removed.'
|
31339 | }
|
31340 | };
|
31341 | }
|
31342 | },
|
31343 |
|
31344 | watch: {
|
31345 | active: function active(newVal, oldVal) {
|
31346 | this.$emit('change', newVal, oldVal);
|
31347 | },
|
31348 | steps: function steps(_steps) {
|
31349 | _steps.forEach(function (child, index) {
|
31350 | child.index = index;
|
31351 | });
|
31352 | }
|
31353 | }
|
31354 | });
|
31355 |
|
31356 | var src_stepsvue_type_script_lang_js_ = (stepsvue_type_script_lang_js_);
|
31357 |
|
31358 |
|
31359 |
|
31360 |
|
31361 |
|
31362 |
|
31363 |
|
31364 |
|
31365 | var steps_component = normalizeComponent(
|
31366 | src_stepsvue_type_script_lang_js_,
|
31367 | stepsvue_type_template_id_3c6b6dc0_render,
|
31368 | stepsvue_type_template_id_3c6b6dc0_staticRenderFns,
|
31369 | false,
|
31370 | null,
|
31371 | null,
|
31372 | null
|
31373 |
|
31374 | )
|
31375 |
|
31376 |
|
31377 | if (false) { var steps_api; }
|
31378 | steps_component.options.__file = "packages/steps/src/steps.vue"
|
31379 | var steps = (steps_component.exports);
|
31380 |
|
31381 |
|
31382 |
|
31383 |
|
31384 | steps.install = function (Vue) {
|
31385 | Vue.component(steps.name, steps);
|
31386 | };
|
31387 |
|
31388 | var packages_steps = (steps);
|
31389 |
|
31390 | var stepvue_type_template_id_f414a87a_render = function() {
|
31391 | var _vm = this
|
31392 | var _h = _vm.$createElement
|
31393 | var _c = _vm._self._c || _h
|
31394 | return _c(
|
31395 | "div",
|
31396 | {
|
31397 | staticClass: "el-step",
|
31398 | class: [
|
31399 | !_vm.isSimple && "is-" + _vm.$parent.direction,
|
31400 | _vm.isSimple && "is-simple",
|
31401 | _vm.isLast && !_vm.space && !_vm.isCenter && "is-flex",
|
31402 | _vm.isCenter && !_vm.isVertical && !_vm.isSimple && "is-center"
|
31403 | ],
|
31404 | style: _vm.style
|
31405 | },
|
31406 | [
|
31407 | _c(
|
31408 | "div",
|
31409 | { staticClass: "el-step__head", class: "is-" + _vm.currentStatus },
|
31410 | [
|
31411 | _c(
|
31412 | "div",
|
31413 | {
|
31414 | staticClass: "el-step__line",
|
31415 | style: _vm.isLast
|
31416 | ? ""
|
31417 | : { marginRight: _vm.$parent.stepOffset + "px" }
|
31418 | },
|
31419 | [
|
31420 | _c("i", {
|
31421 | staticClass: "el-step__line-inner",
|
31422 | style: _vm.lineStyle
|
31423 | })
|
31424 | ]
|
31425 | ),
|
31426 | _c(
|
31427 | "div",
|
31428 | {
|
31429 | staticClass: "el-step__icon",
|
31430 | class: "is-" + (_vm.icon ? "icon" : "text")
|
31431 | },
|
31432 | [
|
31433 | _vm.currentStatus !== "success" && _vm.currentStatus !== "error"
|
31434 | ? _vm._t("icon", [
|
31435 | _vm.icon
|
31436 | ? _c("i", {
|
31437 | staticClass: "el-step__icon-inner",
|
31438 | class: [_vm.icon]
|
31439 | })
|
31440 | : _vm._e(),
|
31441 | !_vm.icon && !_vm.isSimple
|
31442 | ? _c("div", { staticClass: "el-step__icon-inner" }, [
|
31443 | _vm._v(_vm._s(_vm.index + 1))
|
31444 | ])
|
31445 | : _vm._e()
|
31446 | ])
|
31447 | : _c("i", {
|
31448 | staticClass: "el-step__icon-inner is-status",
|
31449 | class: [
|
31450 | "el-icon-" +
|
31451 | (_vm.currentStatus === "success" ? "check" : "close")
|
31452 | ]
|
31453 | })
|
31454 | ],
|
31455 | 2
|
31456 | )
|
31457 | ]
|
31458 | ),
|
31459 | _c("div", { staticClass: "el-step__main" }, [
|
31460 | _c(
|
31461 | "div",
|
31462 | {
|
31463 | ref: "title",
|
31464 | staticClass: "el-step__title",
|
31465 | class: ["is-" + _vm.currentStatus]
|
31466 | },
|
31467 | [_vm._t("title", [_vm._v(_vm._s(_vm.title))])],
|
31468 | 2
|
31469 | ),
|
31470 | _vm.isSimple
|
31471 | ? _c("div", { staticClass: "el-step__arrow" })
|
31472 | : _c(
|
31473 | "div",
|
31474 | {
|
31475 | staticClass: "el-step__description",
|
31476 | class: ["is-" + _vm.currentStatus]
|
31477 | },
|
31478 | [_vm._t("description", [_vm._v(_vm._s(_vm.description))])],
|
31479 | 2
|
31480 | )
|
31481 | ])
|
31482 | ]
|
31483 | )
|
31484 | }
|
31485 | var stepvue_type_template_id_f414a87a_staticRenderFns = []
|
31486 | stepvue_type_template_id_f414a87a_render._withStripped = true
|
31487 |
|
31488 |
|
31489 |
|
31490 |
|
31491 |
|
31492 |
|
31493 |
|
31494 |
|
31495 |
|
31496 |
|
31497 |
|
31498 |
|
31499 |
|
31500 |
|
31501 |
|
31502 |
|
31503 |
|
31504 |
|
31505 |
|
31506 |
|
31507 |
|
31508 |
|
31509 |
|
31510 |
|
31511 |
|
31512 |
|
31513 |
|
31514 |
|
31515 |
|
31516 |
|
31517 |
|
31518 |
|
31519 |
|
31520 |
|
31521 |
|
31522 |
|
31523 |
|
31524 |
|
31525 |
|
31526 |
|
31527 |
|
31528 |
|
31529 |
|
31530 |
|
31531 |
|
31532 |
|
31533 |
|
31534 |
|
31535 |
|
31536 |
|
31537 |
|
31538 |
|
31539 |
|
31540 |
|
31541 |
|
31542 |
|
31543 |
|
31544 |
|
31545 |
|
31546 |
|
31547 |
|
31548 | var stepvue_type_script_lang_js_ = ({
|
31549 | name: 'ElStep',
|
31550 |
|
31551 | props: {
|
31552 | title: String,
|
31553 | icon: String,
|
31554 | description: String,
|
31555 | status: String
|
31556 | },
|
31557 |
|
31558 | data: function data() {
|
31559 | return {
|
31560 | index: -1,
|
31561 | lineStyle: {},
|
31562 | internalStatus: ''
|
31563 | };
|
31564 | },
|
31565 | beforeCreate: function beforeCreate() {
|
31566 | this.$parent.steps.push(this);
|
31567 | },
|
31568 | beforeDestroy: function beforeDestroy() {
|
31569 | var steps = this.$parent.steps;
|
31570 | var index = steps.indexOf(this);
|
31571 | if (index >= 0) {
|
31572 | steps.splice(index, 1);
|
31573 | }
|
31574 | },
|
31575 |
|
31576 |
|
31577 | computed: {
|
31578 | currentStatus: function currentStatus() {
|
31579 | return this.status || this.internalStatus;
|
31580 | },
|
31581 | prevStatus: function prevStatus() {
|
31582 | var prevStep = this.$parent.steps[this.index - 1];
|
31583 | return prevStep ? prevStep.currentStatus : 'wait';
|
31584 | },
|
31585 | isCenter: function isCenter() {
|
31586 | return this.$parent.alignCenter;
|
31587 | },
|
31588 | isVertical: function isVertical() {
|
31589 | return this.$parent.direction === 'vertical';
|
31590 | },
|
31591 | isSimple: function isSimple() {
|
31592 | return this.$parent.simple;
|
31593 | },
|
31594 | isLast: function isLast() {
|
31595 | var parent = this.$parent;
|
31596 | return parent.steps[parent.steps.length - 1] === this;
|
31597 | },
|
31598 | stepsCount: function stepsCount() {
|
31599 | return this.$parent.steps.length;
|
31600 | },
|
31601 | space: function space() {
|
31602 | var isSimple = this.isSimple,
|
31603 | space = this.$parent.space;
|
31604 |
|
31605 | return isSimple ? '' : space;
|
31606 | },
|
31607 |
|
31608 | style: function style() {
|
31609 | var style = {};
|
31610 | var parent = this.$parent;
|
31611 | var len = parent.steps.length;
|
31612 |
|
31613 | var space = typeof this.space === 'number' ? this.space + 'px' : this.space ? this.space : 100 / (len - (this.isCenter ? 0 : 1)) + '%';
|
31614 | style.flexBasis = space;
|
31615 | if (this.isVertical) return style;
|
31616 | if (this.isLast) {
|
31617 | style.maxWidth = 100 / this.stepsCount + '%';
|
31618 | } else {
|
31619 | style.marginRight = -this.$parent.stepOffset + 'px';
|
31620 | }
|
31621 |
|
31622 | return style;
|
31623 | }
|
31624 | },
|
31625 |
|
31626 | methods: {
|
31627 | updateStatus: function updateStatus(val) {
|
31628 | var prevChild = this.$parent.$children[this.index - 1];
|
31629 |
|
31630 | if (val > this.index) {
|
31631 | this.internalStatus = this.$parent.finishStatus;
|
31632 | } else if (val === this.index && this.prevStatus !== 'error') {
|
31633 | this.internalStatus = this.$parent.processStatus;
|
31634 | } else {
|
31635 | this.internalStatus = 'wait';
|
31636 | }
|
31637 |
|
31638 | if (prevChild) prevChild.calcProgress(this.internalStatus);
|
31639 | },
|
31640 | calcProgress: function calcProgress(status) {
|
31641 | var step = 100;
|
31642 | var style = {};
|
31643 |
|
31644 | style.transitionDelay = 150 * this.index + 'ms';
|
31645 | if (status === this.$parent.processStatus) {
|
31646 | step = this.currentStatus !== 'error' ? 0 : 0;
|
31647 | } else if (status === 'wait') {
|
31648 | step = 0;
|
31649 | style.transitionDelay = -150 * this.index + 'ms';
|
31650 | }
|
31651 |
|
31652 | style.borderWidth = step && !this.isSimple ? '1px' : 0;
|
31653 | this.$parent.direction === 'vertical' ? style.height = step + '%' : style.width = step + '%';
|
31654 |
|
31655 | this.lineStyle = style;
|
31656 | }
|
31657 | },
|
31658 |
|
31659 | mounted: function mounted() {
|
31660 | var _this = this;
|
31661 |
|
31662 | var unwatch = this.$watch('index', function (val) {
|
31663 | _this.$watch('$parent.active', _this.updateStatus, { immediate: true });
|
31664 | _this.$watch('$parent.processStatus', function () {
|
31665 | var activeIndex = _this.$parent.active;
|
31666 | _this.updateStatus(activeIndex);
|
31667 | }, { immediate: true });
|
31668 | unwatch();
|
31669 | });
|
31670 | }
|
31671 | });
|
31672 |
|
31673 | var src_stepvue_type_script_lang_js_ = (stepvue_type_script_lang_js_);
|
31674 |
|
31675 |
|
31676 |
|
31677 |
|
31678 |
|
31679 |
|
31680 |
|
31681 |
|
31682 | var step_component = normalizeComponent(
|
31683 | src_stepvue_type_script_lang_js_,
|
31684 | stepvue_type_template_id_f414a87a_render,
|
31685 | stepvue_type_template_id_f414a87a_staticRenderFns,
|
31686 | false,
|
31687 | null,
|
31688 | null,
|
31689 | null
|
31690 |
|
31691 | )
|
31692 |
|
31693 |
|
31694 | if (false) { var step_api; }
|
31695 | step_component.options.__file = "packages/steps/src/step.vue"
|
31696 | var step = (step_component.exports);
|
31697 |
|
31698 |
|
31699 |
|
31700 |
|
31701 | step.install = function (Vue) {
|
31702 | Vue.component(step.name, step);
|
31703 | };
|
31704 |
|
31705 | var packages_step = (step);
|
31706 |
|
31707 | var mainvue_type_template_id_5d5d1482_render = function() {
|
31708 | var _vm = this
|
31709 | var _h = _vm.$createElement
|
31710 | var _c = _vm._self._c || _h
|
31711 | return _c(
|
31712 | "div",
|
31713 | {
|
31714 | class: _vm.carouselClasses,
|
31715 | on: {
|
31716 | mouseenter: function($event) {
|
31717 | $event.stopPropagation()
|
31718 | return _vm.handleMouseEnter($event)
|
31719 | },
|
31720 | mouseleave: function($event) {
|
31721 | $event.stopPropagation()
|
31722 | return _vm.handleMouseLeave($event)
|
31723 | }
|
31724 | }
|
31725 | },
|
31726 | [
|
31727 | _c(
|
31728 | "div",
|
31729 | {
|
31730 | staticClass: "el-carousel__container",
|
31731 | style: { height: _vm.height }
|
31732 | },
|
31733 | [
|
31734 | _vm.arrowDisplay
|
31735 | ? _c("transition", { attrs: { name: "carousel-arrow-left" } }, [
|
31736 | _c(
|
31737 | "button",
|
31738 | {
|
31739 | directives: [
|
31740 | {
|
31741 | name: "show",
|
31742 | rawName: "v-show",
|
31743 | value:
|
31744 | (_vm.arrow === "always" || _vm.hover) &&
|
31745 | (_vm.loop || _vm.activeIndex > 0),
|
31746 | expression:
|
31747 | "(arrow === 'always' || hover) && (loop || activeIndex > 0)"
|
31748 | }
|
31749 | ],
|
31750 | staticClass: "el-carousel__arrow el-carousel__arrow--left",
|
31751 | attrs: { type: "button" },
|
31752 | on: {
|
31753 | mouseenter: function($event) {
|
31754 | _vm.handleButtonEnter("left")
|
31755 | },
|
31756 | mouseleave: _vm.handleButtonLeave,
|
31757 | click: function($event) {
|
31758 | $event.stopPropagation()
|
31759 | _vm.throttledArrowClick(_vm.activeIndex - 1)
|
31760 | }
|
31761 | }
|
31762 | },
|
31763 | [_c("i", { staticClass: "el-icon-arrow-left" })]
|
31764 | )
|
31765 | ])
|
31766 | : _vm._e(),
|
31767 | _vm.arrowDisplay
|
31768 | ? _c("transition", { attrs: { name: "carousel-arrow-right" } }, [
|
31769 | _c(
|
31770 | "button",
|
31771 | {
|
31772 | directives: [
|
31773 | {
|
31774 | name: "show",
|
31775 | rawName: "v-show",
|
31776 | value:
|
31777 | (_vm.arrow === "always" || _vm.hover) &&
|
31778 | (_vm.loop || _vm.activeIndex < _vm.items.length - 1),
|
31779 | expression:
|
31780 | "(arrow === 'always' || hover) && (loop || activeIndex < items.length - 1)"
|
31781 | }
|
31782 | ],
|
31783 | staticClass: "el-carousel__arrow el-carousel__arrow--right",
|
31784 | attrs: { type: "button" },
|
31785 | on: {
|
31786 | mouseenter: function($event) {
|
31787 | _vm.handleButtonEnter("right")
|
31788 | },
|
31789 | mouseleave: _vm.handleButtonLeave,
|
31790 | click: function($event) {
|
31791 | $event.stopPropagation()
|
31792 | _vm.throttledArrowClick(_vm.activeIndex + 1)
|
31793 | }
|
31794 | }
|
31795 | },
|
31796 | [_c("i", { staticClass: "el-icon-arrow-right" })]
|
31797 | )
|
31798 | ])
|
31799 | : _vm._e(),
|
31800 | _vm._t("default")
|
31801 | ],
|
31802 | 2
|
31803 | ),
|
31804 | _vm.indicatorPosition !== "none"
|
31805 | ? _c(
|
31806 | "ul",
|
31807 | { class: _vm.indicatorsClasses },
|
31808 | _vm._l(_vm.items, function(item, index) {
|
31809 | return _c(
|
31810 | "li",
|
31811 | {
|
31812 | key: index,
|
31813 | class: [
|
31814 | "el-carousel__indicator",
|
31815 | "el-carousel__indicator--" + _vm.direction,
|
31816 | { "is-active": index === _vm.activeIndex }
|
31817 | ],
|
31818 | on: {
|
31819 | mouseenter: function($event) {
|
31820 | _vm.throttledIndicatorHover(index)
|
31821 | },
|
31822 | click: function($event) {
|
31823 | $event.stopPropagation()
|
31824 | _vm.handleIndicatorClick(index)
|
31825 | }
|
31826 | }
|
31827 | },
|
31828 | [
|
31829 | _c("button", { staticClass: "el-carousel__button" }, [
|
31830 | _vm.hasLabel
|
31831 | ? _c("span", [_vm._v(_vm._s(item.label))])
|
31832 | : _vm._e()
|
31833 | ])
|
31834 | ]
|
31835 | )
|
31836 | }),
|
31837 | 0
|
31838 | )
|
31839 | : _vm._e()
|
31840 | ]
|
31841 | )
|
31842 | }
|
31843 | var mainvue_type_template_id_5d5d1482_staticRenderFns = []
|
31844 | mainvue_type_template_id_5d5d1482_render._withStripped = true
|
31845 |
|
31846 |
|
31847 |
|
31848 |
|
31849 |
|
31850 | var throttle_ = __webpack_require__(25);
|
31851 | var throttle_default = __webpack_require__.n(throttle_);
|
31852 |
|
31853 |
|
31854 |
|
31855 |
|
31856 |
|
31857 |
|
31858 |
|
31859 |
|
31860 |
|
31861 |
|
31862 |
|
31863 |
|
31864 |
|
31865 |
|
31866 |
|
31867 |
|
31868 |
|
31869 |
|
31870 |
|
31871 |
|
31872 |
|
31873 |
|
31874 |
|
31875 |
|
31876 |
|
31877 |
|
31878 |
|
31879 |
|
31880 |
|
31881 |
|
31882 |
|
31883 |
|
31884 |
|
31885 |
|
31886 |
|
31887 |
|
31888 |
|
31889 |
|
31890 |
|
31891 |
|
31892 |
|
31893 |
|
31894 |
|
31895 |
|
31896 |
|
31897 |
|
31898 |
|
31899 |
|
31900 |
|
31901 |
|
31902 |
|
31903 |
|
31904 |
|
31905 |
|
31906 |
|
31907 |
|
31908 |
|
31909 |
|
31910 |
|
31911 |
|
31912 |
|
31913 |
|
31914 | var carousel_src_mainvue_type_script_lang_js_ = ({
|
31915 | name: 'ElCarousel',
|
31916 |
|
31917 | props: {
|
31918 | initialIndex: {
|
31919 | type: Number,
|
31920 | default: 0
|
31921 | },
|
31922 | height: String,
|
31923 | trigger: {
|
31924 | type: String,
|
31925 | default: 'hover'
|
31926 | },
|
31927 | autoplay: {
|
31928 | type: Boolean,
|
31929 | default: true
|
31930 | },
|
31931 | interval: {
|
31932 | type: Number,
|
31933 | default: 3000
|
31934 | },
|
31935 | indicatorPosition: String,
|
31936 | indicator: {
|
31937 | type: Boolean,
|
31938 | default: true
|
31939 | },
|
31940 | arrow: {
|
31941 | type: String,
|
31942 | default: 'hover'
|
31943 | },
|
31944 | type: String,
|
31945 | loop: {
|
31946 | type: Boolean,
|
31947 | default: true
|
31948 | },
|
31949 | direction: {
|
31950 | type: String,
|
31951 | default: 'horizontal',
|
31952 | validator: function validator(val) {
|
31953 | return ['horizontal', 'vertical'].indexOf(val) !== -1;
|
31954 | }
|
31955 | }
|
31956 | },
|
31957 |
|
31958 | data: function data() {
|
31959 | return {
|
31960 | items: [],
|
31961 | activeIndex: -1,
|
31962 | containerWidth: 0,
|
31963 | timer: null,
|
31964 | hover: false
|
31965 | };
|
31966 | },
|
31967 |
|
31968 |
|
31969 | computed: {
|
31970 | arrowDisplay: function arrowDisplay() {
|
31971 | return this.arrow !== 'never' && this.direction !== 'vertical';
|
31972 | },
|
31973 | hasLabel: function hasLabel() {
|
31974 | return this.items.some(function (item) {
|
31975 | return item.label.toString().length > 0;
|
31976 | });
|
31977 | },
|
31978 | carouselClasses: function carouselClasses() {
|
31979 | var classes = ['el-carousel', 'el-carousel--' + this.direction];
|
31980 | if (this.type === 'card') {
|
31981 | classes.push('el-carousel--card');
|
31982 | }
|
31983 | return classes;
|
31984 | },
|
31985 | indicatorsClasses: function indicatorsClasses() {
|
31986 | var classes = ['el-carousel__indicators', 'el-carousel__indicators--' + this.direction];
|
31987 | if (this.hasLabel) {
|
31988 | classes.push('el-carousel__indicators--labels');
|
31989 | }
|
31990 | if (this.indicatorPosition === 'outside' || this.type === 'card') {
|
31991 | classes.push('el-carousel__indicators--outside');
|
31992 | }
|
31993 | return classes;
|
31994 | }
|
31995 | },
|
31996 |
|
31997 | watch: {
|
31998 | items: function items(val) {
|
31999 | if (val.length > 0) this.setActiveItem(this.initialIndex);
|
32000 | },
|
32001 | activeIndex: function activeIndex(val, oldVal) {
|
32002 | this.resetItemPosition(oldVal);
|
32003 | if (oldVal > -1) {
|
32004 | this.$emit('change', val, oldVal);
|
32005 | }
|
32006 | },
|
32007 | autoplay: function autoplay(val) {
|
32008 | val ? this.startTimer() : this.pauseTimer();
|
32009 | },
|
32010 | loop: function loop() {
|
32011 | this.setActiveItem(this.activeIndex);
|
32012 | }
|
32013 | },
|
32014 |
|
32015 | methods: {
|
32016 | handleMouseEnter: function handleMouseEnter() {
|
32017 | this.hover = true;
|
32018 | this.pauseTimer();
|
32019 | },
|
32020 | handleMouseLeave: function handleMouseLeave() {
|
32021 | this.hover = false;
|
32022 | this.startTimer();
|
32023 | },
|
32024 | itemInStage: function itemInStage(item, index) {
|
32025 | var length = this.items.length;
|
32026 | if (index === length - 1 && item.inStage && this.items[0].active || item.inStage && this.items[index + 1] && this.items[index + 1].active) {
|
32027 | return 'left';
|
32028 | } else if (index === 0 && item.inStage && this.items[length - 1].active || item.inStage && this.items[index - 1] && this.items[index - 1].active) {
|
32029 | return 'right';
|
32030 | }
|
32031 | return false;
|
32032 | },
|
32033 | handleButtonEnter: function handleButtonEnter(arrow) {
|
32034 | var _this = this;
|
32035 |
|
32036 | if (this.direction === 'vertical') return;
|
32037 | this.items.forEach(function (item, index) {
|
32038 | if (arrow === _this.itemInStage(item, index)) {
|
32039 | item.hover = true;
|
32040 | }
|
32041 | });
|
32042 | },
|
32043 | handleButtonLeave: function handleButtonLeave() {
|
32044 | if (this.direction === 'vertical') return;
|
32045 | this.items.forEach(function (item) {
|
32046 | item.hover = false;
|
32047 | });
|
32048 | },
|
32049 | updateItems: function updateItems() {
|
32050 | this.items = this.$children.filter(function (child) {
|
32051 | return child.$options.name === 'ElCarouselItem';
|
32052 | });
|
32053 | },
|
32054 | resetItemPosition: function resetItemPosition(oldIndex) {
|
32055 | var _this2 = this;
|
32056 |
|
32057 | this.items.forEach(function (item, index) {
|
32058 | item.translateItem(index, _this2.activeIndex, oldIndex);
|
32059 | });
|
32060 | },
|
32061 | playSlides: function playSlides() {
|
32062 | if (this.activeIndex < this.items.length - 1) {
|
32063 | this.activeIndex++;
|
32064 | } else if (this.loop) {
|
32065 | this.activeIndex = 0;
|
32066 | }
|
32067 | },
|
32068 | pauseTimer: function pauseTimer() {
|
32069 | if (this.timer) {
|
32070 | clearInterval(this.timer);
|
32071 | this.timer = null;
|
32072 | }
|
32073 | },
|
32074 | startTimer: function startTimer() {
|
32075 | if (this.interval <= 0 || !this.autoplay || this.timer) return;
|
32076 | this.timer = setInterval(this.playSlides, this.interval);
|
32077 | },
|
32078 | setActiveItem: function setActiveItem(index) {
|
32079 | if (typeof index === 'string') {
|
32080 | var filteredItems = this.items.filter(function (item) {
|
32081 | return item.name === index;
|
32082 | });
|
32083 | if (filteredItems.length > 0) {
|
32084 | index = this.items.indexOf(filteredItems[0]);
|
32085 | }
|
32086 | }
|
32087 | index = Number(index);
|
32088 | if (isNaN(index) || index !== Math.floor(index)) {
|
32089 | console.warn('[Element Warn][Carousel]index must be an integer.');
|
32090 | return;
|
32091 | }
|
32092 | var length = this.items.length;
|
32093 | var oldIndex = this.activeIndex;
|
32094 | if (index < 0) {
|
32095 | this.activeIndex = this.loop ? length - 1 : 0;
|
32096 | } else if (index >= length) {
|
32097 | this.activeIndex = this.loop ? 0 : length - 1;
|
32098 | } else {
|
32099 | this.activeIndex = index;
|
32100 | }
|
32101 | if (oldIndex === this.activeIndex) {
|
32102 | this.resetItemPosition(oldIndex);
|
32103 | }
|
32104 | },
|
32105 | prev: function prev() {
|
32106 | this.setActiveItem(this.activeIndex - 1);
|
32107 | },
|
32108 | next: function next() {
|
32109 | this.setActiveItem(this.activeIndex + 1);
|
32110 | },
|
32111 | handleIndicatorClick: function handleIndicatorClick(index) {
|
32112 | this.activeIndex = index;
|
32113 | },
|
32114 | handleIndicatorHover: function handleIndicatorHover(index) {
|
32115 | if (this.trigger === 'hover' && index !== this.activeIndex) {
|
32116 | this.activeIndex = index;
|
32117 | }
|
32118 | }
|
32119 | },
|
32120 |
|
32121 | created: function created() {
|
32122 | var _this3 = this;
|
32123 |
|
32124 | this.throttledArrowClick = throttle_default()(300, true, function (index) {
|
32125 | _this3.setActiveItem(index);
|
32126 | });
|
32127 | this.throttledIndicatorHover = throttle_default()(300, function (index) {
|
32128 | _this3.handleIndicatorHover(index);
|
32129 | });
|
32130 | },
|
32131 | mounted: function mounted() {
|
32132 | var _this4 = this;
|
32133 |
|
32134 | this.updateItems();
|
32135 | this.$nextTick(function () {
|
32136 | Object(resize_event_["addResizeListener"])(_this4.$el, _this4.resetItemPosition);
|
32137 | if (_this4.initialIndex < _this4.items.length && _this4.initialIndex >= 0) {
|
32138 | _this4.activeIndex = _this4.initialIndex;
|
32139 | }
|
32140 | _this4.startTimer();
|
32141 | });
|
32142 | },
|
32143 | beforeDestroy: function beforeDestroy() {
|
32144 | if (this.$el) Object(resize_event_["removeResizeListener"])(this.$el, this.resetItemPosition);
|
32145 | this.pauseTimer();
|
32146 | }
|
32147 | });
|
32148 |
|
32149 | var packages_carousel_src_mainvue_type_script_lang_js_ = (carousel_src_mainvue_type_script_lang_js_);
|
32150 |
|
32151 |
|
32152 |
|
32153 |
|
32154 |
|
32155 |
|
32156 |
|
32157 |
|
32158 | var carousel_src_main_component = normalizeComponent(
|
32159 | packages_carousel_src_mainvue_type_script_lang_js_,
|
32160 | mainvue_type_template_id_5d5d1482_render,
|
32161 | mainvue_type_template_id_5d5d1482_staticRenderFns,
|
32162 | false,
|
32163 | null,
|
32164 | null,
|
32165 | null
|
32166 |
|
32167 | )
|
32168 |
|
32169 |
|
32170 | if (false) { var carousel_src_main_api; }
|
32171 | carousel_src_main_component.options.__file = "packages/carousel/src/main.vue"
|
32172 | var carousel_src_main = (carousel_src_main_component.exports);
|
32173 |
|
32174 |
|
32175 |
|
32176 |
|
32177 | carousel_src_main.install = function (Vue) {
|
32178 | Vue.component(carousel_src_main.name, carousel_src_main);
|
32179 | };
|
32180 |
|
32181 | var carousel = (carousel_src_main);
|
32182 |
|
32183 | var BAR_MAP = {
|
32184 | vertical: {
|
32185 | offset: 'offsetHeight',
|
32186 | scroll: 'scrollTop',
|
32187 | scrollSize: 'scrollHeight',
|
32188 | size: 'height',
|
32189 | key: 'vertical',
|
32190 | axis: 'Y',
|
32191 | client: 'clientY',
|
32192 | direction: 'top'
|
32193 | },
|
32194 | horizontal: {
|
32195 | offset: 'offsetWidth',
|
32196 | scroll: 'scrollLeft',
|
32197 | scrollSize: 'scrollWidth',
|
32198 | size: 'width',
|
32199 | key: 'horizontal',
|
32200 | axis: 'X',
|
32201 | client: 'clientX',
|
32202 | direction: 'left'
|
32203 | }
|
32204 | };
|
32205 |
|
32206 | function renderThumbStyle(_ref) {
|
32207 | var move = _ref.move,
|
32208 | size = _ref.size,
|
32209 | bar = _ref.bar;
|
32210 |
|
32211 | var style = {};
|
32212 | var translate = 'translate' + bar.axis + '(' + move + '%)';
|
32213 |
|
32214 | style[bar.size] = size;
|
32215 | style.transform = translate;
|
32216 | style.msTransform = translate;
|
32217 | style.webkitTransform = translate;
|
32218 |
|
32219 | return style;
|
32220 | };
|
32221 |
|
32222 |
|
32223 |
|
32224 |
|
32225 |
|
32226 | var src_bar = ({
|
32227 | name: 'Bar',
|
32228 |
|
32229 | props: {
|
32230 | vertical: Boolean,
|
32231 | size: String,
|
32232 | move: Number
|
32233 | },
|
32234 |
|
32235 | computed: {
|
32236 | bar: function bar() {
|
32237 | return BAR_MAP[this.vertical ? 'vertical' : 'horizontal'];
|
32238 | },
|
32239 | wrap: function wrap() {
|
32240 | return this.$parent.wrap;
|
32241 | }
|
32242 | },
|
32243 |
|
32244 | render: function render(h) {
|
32245 | var size = this.size,
|
32246 | move = this.move,
|
32247 | bar = this.bar;
|
32248 |
|
32249 |
|
32250 | return h(
|
32251 | 'div',
|
32252 | {
|
32253 | 'class': ['el-scrollbar__bar', 'is-' + bar.key],
|
32254 | on: {
|
32255 | 'mousedown': this.clickTrackHandler
|
32256 | }
|
32257 | },
|
32258 | [h('div', {
|
32259 | ref: 'thumb',
|
32260 | 'class': 'el-scrollbar__thumb',
|
32261 | on: {
|
32262 | 'mousedown': this.clickThumbHandler
|
32263 | },
|
32264 |
|
32265 | style: renderThumbStyle({ size: size, move: move, bar: bar }) })]
|
32266 | );
|
32267 | },
|
32268 |
|
32269 |
|
32270 | methods: {
|
32271 | clickThumbHandler: function clickThumbHandler(e) {
|
32272 |
|
32273 | if (e.ctrlKey || e.button === 2) {
|
32274 | return;
|
32275 | }
|
32276 | this.startDrag(e);
|
32277 | this[this.bar.axis] = e.currentTarget[this.bar.offset] - (e[this.bar.client] - e.currentTarget.getBoundingClientRect()[this.bar.direction]);
|
32278 | },
|
32279 | clickTrackHandler: function clickTrackHandler(e) {
|
32280 | var offset = Math.abs(e.target.getBoundingClientRect()[this.bar.direction] - e[this.bar.client]);
|
32281 | var thumbHalf = this.$refs.thumb[this.bar.offset] / 2;
|
32282 | var thumbPositionPercentage = (offset - thumbHalf) * 100 / this.$el[this.bar.offset];
|
32283 |
|
32284 | this.wrap[this.bar.scroll] = thumbPositionPercentage * this.wrap[this.bar.scrollSize] / 100;
|
32285 | },
|
32286 | startDrag: function startDrag(e) {
|
32287 | e.stopImmediatePropagation();
|
32288 | this.cursorDown = true;
|
32289 |
|
32290 | Object(dom_["on"])(document, 'mousemove', this.mouseMoveDocumentHandler);
|
32291 | Object(dom_["on"])(document, 'mouseup', this.mouseUpDocumentHandler);
|
32292 | document.onselectstart = function () {
|
32293 | return false;
|
32294 | };
|
32295 | },
|
32296 | mouseMoveDocumentHandler: function mouseMoveDocumentHandler(e) {
|
32297 | if (this.cursorDown === false) return;
|
32298 | var prevPage = this[this.bar.axis];
|
32299 |
|
32300 | if (!prevPage) return;
|
32301 |
|
32302 | var offset = (this.$el.getBoundingClientRect()[this.bar.direction] - e[this.bar.client]) * -1;
|
32303 | var thumbClickPosition = this.$refs.thumb[this.bar.offset] - prevPage;
|
32304 | var thumbPositionPercentage = (offset - thumbClickPosition) * 100 / this.$el[this.bar.offset];
|
32305 |
|
32306 | this.wrap[this.bar.scroll] = thumbPositionPercentage * this.wrap[this.bar.scrollSize] / 100;
|
32307 | },
|
32308 | mouseUpDocumentHandler: function mouseUpDocumentHandler(e) {
|
32309 | this.cursorDown = false;
|
32310 | this[this.bar.axis] = 0;
|
32311 | Object(dom_["off"])(document, 'mousemove', this.mouseMoveDocumentHandler);
|
32312 | document.onselectstart = null;
|
32313 | }
|
32314 | },
|
32315 |
|
32316 | destroyed: function destroyed() {
|
32317 | Object(dom_["off"])(document, 'mouseup', this.mouseUpDocumentHandler);
|
32318 | }
|
32319 | });
|
32320 |
|
32321 |
|
32322 |
|
32323 |
|
32324 |
|
32325 |
|
32326 |
|
32327 |
|
32328 |
|
32329 | var scrollbar_src_main = ({
|
32330 | name: 'ElScrollbar',
|
32331 |
|
32332 | components: { Bar: src_bar },
|
32333 |
|
32334 | props: {
|
32335 | native: Boolean,
|
32336 | wrapStyle: {},
|
32337 | wrapClass: {},
|
32338 | viewClass: {},
|
32339 | viewStyle: {},
|
32340 | noresize: Boolean,
|
32341 | tag: {
|
32342 | type: String,
|
32343 | default: 'div'
|
32344 | }
|
32345 | },
|
32346 |
|
32347 | data: function data() {
|
32348 | return {
|
32349 | sizeWidth: '0',
|
32350 | sizeHeight: '0',
|
32351 | moveX: 0,
|
32352 | moveY: 0
|
32353 | };
|
32354 | },
|
32355 |
|
32356 |
|
32357 | computed: {
|
32358 | wrap: function wrap() {
|
32359 | return this.$refs.wrap;
|
32360 | }
|
32361 | },
|
32362 |
|
32363 | render: function render(h) {
|
32364 | var gutter = scrollbar_width_default()();
|
32365 | var style = this.wrapStyle;
|
32366 |
|
32367 | if (gutter) {
|
32368 | var gutterWith = '-' + gutter + 'px';
|
32369 | var gutterStyle = 'margin-bottom: ' + gutterWith + '; margin-right: ' + gutterWith + ';';
|
32370 |
|
32371 | if (Array.isArray(this.wrapStyle)) {
|
32372 | style = Object(util_["toObject"])(this.wrapStyle);
|
32373 | style.marginRight = style.marginBottom = gutterWith;
|
32374 | } else if (typeof this.wrapStyle === 'string') {
|
32375 | style += gutterStyle;
|
32376 | } else {
|
32377 | style = gutterStyle;
|
32378 | }
|
32379 | }
|
32380 | var view = h(this.tag, {
|
32381 | class: ['el-scrollbar__view', this.viewClass],
|
32382 | style: this.viewStyle,
|
32383 | ref: 'resize'
|
32384 | }, this.$slots.default);
|
32385 | var wrap = h(
|
32386 | 'div',
|
32387 | {
|
32388 | ref: 'wrap',
|
32389 | style: style,
|
32390 | on: {
|
32391 | 'scroll': this.handleScroll
|
32392 | },
|
32393 |
|
32394 | 'class': [this.wrapClass, 'el-scrollbar__wrap', gutter ? '' : 'el-scrollbar__wrap--hidden-default'] },
|
32395 | [[view]]
|
32396 | );
|
32397 | var nodes = void 0;
|
32398 |
|
32399 | if (!this.native) {
|
32400 | nodes = [wrap, h(src_bar, {
|
32401 | attrs: {
|
32402 | move: this.moveX,
|
32403 | size: this.sizeWidth }
|
32404 | }), h(src_bar, {
|
32405 | attrs: {
|
32406 | vertical: true,
|
32407 | move: this.moveY,
|
32408 | size: this.sizeHeight }
|
32409 | })];
|
32410 | } else {
|
32411 | nodes = [h(
|
32412 | 'div',
|
32413 | {
|
32414 | ref: 'wrap',
|
32415 | 'class': [this.wrapClass, 'el-scrollbar__wrap'],
|
32416 | style: style },
|
32417 | [[view]]
|
32418 | )];
|
32419 | }
|
32420 | return h('div', { class: 'el-scrollbar' }, nodes);
|
32421 | },
|
32422 |
|
32423 |
|
32424 | methods: {
|
32425 | handleScroll: function handleScroll() {
|
32426 | var wrap = this.wrap;
|
32427 |
|
32428 | this.moveY = wrap.scrollTop * 100 / wrap.clientHeight;
|
32429 | this.moveX = wrap.scrollLeft * 100 / wrap.clientWidth;
|
32430 | },
|
32431 | update: function update() {
|
32432 | var heightPercentage = void 0,
|
32433 | widthPercentage = void 0;
|
32434 | var wrap = this.wrap;
|
32435 | if (!wrap) return;
|
32436 |
|
32437 | heightPercentage = wrap.clientHeight * 100 / wrap.scrollHeight;
|
32438 | widthPercentage = wrap.clientWidth * 100 / wrap.scrollWidth;
|
32439 |
|
32440 | this.sizeHeight = heightPercentage < 100 ? heightPercentage + '%' : '';
|
32441 | this.sizeWidth = widthPercentage < 100 ? widthPercentage + '%' : '';
|
32442 | }
|
32443 | },
|
32444 |
|
32445 | mounted: function mounted() {
|
32446 | if (this.native) return;
|
32447 | this.$nextTick(this.update);
|
32448 | !this.noresize && Object(resize_event_["addResizeListener"])(this.$refs.resize, this.update);
|
32449 | },
|
32450 | beforeDestroy: function beforeDestroy() {
|
32451 | if (this.native) return;
|
32452 | !this.noresize && Object(resize_event_["removeResizeListener"])(this.$refs.resize, this.update);
|
32453 | }
|
32454 | });
|
32455 |
|
32456 |
|
32457 |
|
32458 |
|
32459 | scrollbar_src_main.install = function (Vue) {
|
32460 | Vue.component(scrollbar_src_main.name, scrollbar_src_main);
|
32461 | };
|
32462 |
|
32463 | var scrollbar = (scrollbar_src_main);
|
32464 |
|
32465 | var itemvue_type_template_id_1801ae19_render = function() {
|
32466 | var _vm = this
|
32467 | var _h = _vm.$createElement
|
32468 | var _c = _vm._self._c || _h
|
32469 | return _c(
|
32470 | "div",
|
32471 | {
|
32472 | directives: [
|
32473 | {
|
32474 | name: "show",
|
32475 | rawName: "v-show",
|
32476 | value: _vm.ready,
|
32477 | expression: "ready"
|
32478 | }
|
32479 | ],
|
32480 | staticClass: "el-carousel__item",
|
32481 | class: {
|
32482 | "is-active": _vm.active,
|
32483 | "el-carousel__item--card": _vm.$parent.type === "card",
|
32484 | "is-in-stage": _vm.inStage,
|
32485 | "is-hover": _vm.hover,
|
32486 | "is-animating": _vm.animating
|
32487 | },
|
32488 | style: _vm.itemStyle,
|
32489 | on: { click: _vm.handleItemClick }
|
32490 | },
|
32491 | [
|
32492 | _vm.$parent.type === "card"
|
32493 | ? _c("div", {
|
32494 | directives: [
|
32495 | {
|
32496 | name: "show",
|
32497 | rawName: "v-show",
|
32498 | value: !_vm.active,
|
32499 | expression: "!active"
|
32500 | }
|
32501 | ],
|
32502 | staticClass: "el-carousel__mask"
|
32503 | })
|
32504 | : _vm._e(),
|
32505 | _vm._t("default")
|
32506 | ],
|
32507 | 2
|
32508 | )
|
32509 | }
|
32510 | var itemvue_type_template_id_1801ae19_staticRenderFns = []
|
32511 | itemvue_type_template_id_1801ae19_render._withStripped = true
|
32512 |
|
32513 |
|
32514 |
|
32515 |
|
32516 |
|
32517 |
|
32518 |
|
32519 |
|
32520 |
|
32521 |
|
32522 |
|
32523 |
|
32524 |
|
32525 |
|
32526 |
|
32527 |
|
32528 |
|
32529 |
|
32530 |
|
32531 |
|
32532 |
|
32533 |
|
32534 |
|
32535 |
|
32536 |
|
32537 |
|
32538 |
|
32539 |
|
32540 |
|
32541 | var CARD_SCALE = 0.83;
|
32542 | var itemvue_type_script_lang_js_ = ({
|
32543 | name: 'ElCarouselItem',
|
32544 |
|
32545 | props: {
|
32546 | name: String,
|
32547 | label: {
|
32548 | type: [String, Number],
|
32549 | default: ''
|
32550 | }
|
32551 | },
|
32552 |
|
32553 | data: function data() {
|
32554 | return {
|
32555 | hover: false,
|
32556 | translate: 0,
|
32557 | scale: 1,
|
32558 | active: false,
|
32559 | ready: false,
|
32560 | inStage: false,
|
32561 | animating: false
|
32562 | };
|
32563 | },
|
32564 |
|
32565 |
|
32566 | methods: {
|
32567 | processIndex: function processIndex(index, activeIndex, length) {
|
32568 | if (activeIndex === 0 && index === length - 1) {
|
32569 | return -1;
|
32570 | } else if (activeIndex === length - 1 && index === 0) {
|
32571 | return length;
|
32572 | } else if (index < activeIndex - 1 && activeIndex - index >= length / 2) {
|
32573 | return length + 1;
|
32574 | } else if (index > activeIndex + 1 && index - activeIndex >= length / 2) {
|
32575 | return -2;
|
32576 | }
|
32577 | return index;
|
32578 | },
|
32579 | calcCardTranslate: function calcCardTranslate(index, activeIndex) {
|
32580 | var parentWidth = this.$parent.$el.offsetWidth;
|
32581 | if (this.inStage) {
|
32582 | return parentWidth * ((2 - CARD_SCALE) * (index - activeIndex) + 1) / 4;
|
32583 | } else if (index < activeIndex) {
|
32584 | return -(1 + CARD_SCALE) * parentWidth / 4;
|
32585 | } else {
|
32586 | return (3 + CARD_SCALE) * parentWidth / 4;
|
32587 | }
|
32588 | },
|
32589 | calcTranslate: function calcTranslate(index, activeIndex, isVertical) {
|
32590 | var distance = this.$parent.$el[isVertical ? 'offsetHeight' : 'offsetWidth'];
|
32591 | return distance * (index - activeIndex);
|
32592 | },
|
32593 | translateItem: function translateItem(index, activeIndex, oldIndex) {
|
32594 | var parentType = this.$parent.type;
|
32595 | var parentDirection = this.parentDirection;
|
32596 | var length = this.$parent.items.length;
|
32597 | if (parentType !== 'card' && oldIndex !== undefined) {
|
32598 | this.animating = index === activeIndex || index === oldIndex;
|
32599 | }
|
32600 | if (index !== activeIndex && length > 2 && this.$parent.loop) {
|
32601 | index = this.processIndex(index, activeIndex, length);
|
32602 | }
|
32603 | if (parentType === 'card') {
|
32604 | if (parentDirection === 'vertical') {
|
32605 | console.warn('[Element Warn][Carousel]vertical direction is not supported in card mode');
|
32606 | }
|
32607 | this.inStage = Math.round(Math.abs(index - activeIndex)) <= 1;
|
32608 | this.active = index === activeIndex;
|
32609 | this.translate = this.calcCardTranslate(index, activeIndex);
|
32610 | this.scale = this.active ? 1 : CARD_SCALE;
|
32611 | } else {
|
32612 | this.active = index === activeIndex;
|
32613 | var isVertical = parentDirection === 'vertical';
|
32614 | this.translate = this.calcTranslate(index, activeIndex, isVertical);
|
32615 | }
|
32616 | this.ready = true;
|
32617 | },
|
32618 | handleItemClick: function handleItemClick() {
|
32619 | var parent = this.$parent;
|
32620 | if (parent && parent.type === 'card') {
|
32621 | var index = parent.items.indexOf(this);
|
32622 | parent.setActiveItem(index);
|
32623 | }
|
32624 | }
|
32625 | },
|
32626 |
|
32627 | computed: {
|
32628 | parentDirection: function parentDirection() {
|
32629 | return this.$parent.direction;
|
32630 | },
|
32631 | itemStyle: function itemStyle() {
|
32632 | var translateType = this.parentDirection === 'vertical' ? 'translateY' : 'translateX';
|
32633 | var value = translateType + '(' + this.translate + 'px) scale(' + this.scale + ')';
|
32634 | var style = {
|
32635 | transform: value
|
32636 | };
|
32637 | return Object(util_["autoprefixer"])(style);
|
32638 | }
|
32639 | },
|
32640 |
|
32641 | created: function created() {
|
32642 | this.$parent && this.$parent.updateItems();
|
32643 | },
|
32644 | destroyed: function destroyed() {
|
32645 | this.$parent && this.$parent.updateItems();
|
32646 | }
|
32647 | });
|
32648 |
|
32649 | var src_itemvue_type_script_lang_js_ = (itemvue_type_script_lang_js_);
|
32650 |
|
32651 |
|
32652 |
|
32653 |
|
32654 |
|
32655 |
|
32656 |
|
32657 |
|
32658 | var item_component = normalizeComponent(
|
32659 | src_itemvue_type_script_lang_js_,
|
32660 | itemvue_type_template_id_1801ae19_render,
|
32661 | itemvue_type_template_id_1801ae19_staticRenderFns,
|
32662 | false,
|
32663 | null,
|
32664 | null,
|
32665 | null
|
32666 |
|
32667 | )
|
32668 |
|
32669 |
|
32670 | if (false) { var item_api; }
|
32671 | item_component.options.__file = "packages/carousel/src/item.vue"
|
32672 | var src_item = (item_component.exports);
|
32673 |
|
32674 |
|
32675 |
|
32676 |
|
32677 | src_item.install = function (Vue) {
|
32678 | Vue.component(src_item.name, src_item);
|
32679 | };
|
32680 |
|
32681 | var carousel_item = (src_item);
|
32682 |
|
32683 | var collapsevue_type_template_id_461d57f4_render = function() {
|
32684 | var _vm = this
|
32685 | var _h = _vm.$createElement
|
32686 | var _c = _vm._self._c || _h
|
32687 | return _c(
|
32688 | "div",
|
32689 | {
|
32690 | staticClass: "el-collapse",
|
32691 | attrs: { role: "tablist", "aria-multiselectable": "true" }
|
32692 | },
|
32693 | [_vm._t("default")],
|
32694 | 2
|
32695 | )
|
32696 | }
|
32697 | var collapsevue_type_template_id_461d57f4_staticRenderFns = []
|
32698 | collapsevue_type_template_id_461d57f4_render._withStripped = true
|
32699 |
|
32700 |
|
32701 |
|
32702 |
|
32703 |
|
32704 |
|
32705 |
|
32706 |
|
32707 |
|
32708 |
|
32709 |
|
32710 | var collapsevue_type_script_lang_js_ = ({
|
32711 | name: 'ElCollapse',
|
32712 |
|
32713 | componentName: 'ElCollapse',
|
32714 |
|
32715 | props: {
|
32716 | accordion: Boolean,
|
32717 | value: {
|
32718 | type: [Array, String, Number],
|
32719 | default: function _default() {
|
32720 | return [];
|
32721 | }
|
32722 | }
|
32723 | },
|
32724 |
|
32725 | data: function data() {
|
32726 | return {
|
32727 | activeNames: [].concat(this.value)
|
32728 | };
|
32729 | },
|
32730 | provide: function provide() {
|
32731 | return {
|
32732 | collapse: this
|
32733 | };
|
32734 | },
|
32735 |
|
32736 |
|
32737 | watch: {
|
32738 | value: function value(_value) {
|
32739 | this.activeNames = [].concat(_value);
|
32740 | }
|
32741 | },
|
32742 |
|
32743 | methods: {
|
32744 | setActiveNames: function setActiveNames(activeNames) {
|
32745 | activeNames = [].concat(activeNames);
|
32746 | var value = this.accordion ? activeNames[0] : activeNames;
|
32747 | this.activeNames = activeNames;
|
32748 | this.$emit('input', value);
|
32749 | this.$emit('change', value);
|
32750 | },
|
32751 | handleItemClick: function handleItemClick(item) {
|
32752 | if (this.accordion) {
|
32753 | this.setActiveNames((this.activeNames[0] || this.activeNames[0] === 0) && this.activeNames[0] === item.name ? '' : item.name);
|
32754 | } else {
|
32755 | var activeNames = this.activeNames.slice(0);
|
32756 | var index = activeNames.indexOf(item.name);
|
32757 |
|
32758 | if (index > -1) {
|
32759 | activeNames.splice(index, 1);
|
32760 | } else {
|
32761 | activeNames.push(item.name);
|
32762 | }
|
32763 | this.setActiveNames(activeNames);
|
32764 | }
|
32765 | }
|
32766 | },
|
32767 |
|
32768 | created: function created() {
|
32769 | this.$on('item-click', this.handleItemClick);
|
32770 | }
|
32771 | });
|
32772 |
|
32773 | var src_collapsevue_type_script_lang_js_ = (collapsevue_type_script_lang_js_);
|
32774 |
|
32775 |
|
32776 |
|
32777 |
|
32778 |
|
32779 |
|
32780 |
|
32781 |
|
32782 | var collapse_component = normalizeComponent(
|
32783 | src_collapsevue_type_script_lang_js_,
|
32784 | collapsevue_type_template_id_461d57f4_render,
|
32785 | collapsevue_type_template_id_461d57f4_staticRenderFns,
|
32786 | false,
|
32787 | null,
|
32788 | null,
|
32789 | null
|
32790 |
|
32791 | )
|
32792 |
|
32793 |
|
32794 | if (false) { var collapse_api; }
|
32795 | collapse_component.options.__file = "packages/collapse/src/collapse.vue"
|
32796 | var collapse = (collapse_component.exports);
|
32797 |
|
32798 |
|
32799 |
|
32800 |
|
32801 | collapse.install = function (Vue) {
|
32802 | Vue.component(collapse.name, collapse);
|
32803 | };
|
32804 |
|
32805 | var packages_collapse = (collapse);
|
32806 |
|
32807 | var collapse_itemvue_type_template_id_2d05faac_render = function() {
|
32808 | var _vm = this
|
32809 | var _h = _vm.$createElement
|
32810 | var _c = _vm._self._c || _h
|
32811 | return _c(
|
32812 | "div",
|
32813 | {
|
32814 | staticClass: "el-collapse-item",
|
32815 | class: { "is-active": _vm.isActive, "is-disabled": _vm.disabled }
|
32816 | },
|
32817 | [
|
32818 | _c(
|
32819 | "div",
|
32820 | {
|
32821 | attrs: {
|
32822 | role: "tab",
|
32823 | "aria-expanded": _vm.isActive,
|
32824 | "aria-controls": "el-collapse-content-" + _vm.id,
|
32825 | "aria-describedby": "el-collapse-content-" + _vm.id
|
32826 | }
|
32827 | },
|
32828 | [
|
32829 | _c(
|
32830 | "div",
|
32831 | {
|
32832 | staticClass: "el-collapse-item__header",
|
32833 | class: {
|
32834 | focusing: _vm.focusing,
|
32835 | "is-active": _vm.isActive
|
32836 | },
|
32837 | attrs: {
|
32838 | role: "button",
|
32839 | id: "el-collapse-head-" + _vm.id,
|
32840 | tabindex: _vm.disabled ? undefined : 0
|
32841 | },
|
32842 | on: {
|
32843 | click: _vm.handleHeaderClick,
|
32844 | keyup: function($event) {
|
32845 | if (
|
32846 | !("button" in $event) &&
|
32847 | _vm._k($event.keyCode, "space", 32, $event.key, [
|
32848 | " ",
|
32849 | "Spacebar"
|
32850 | ]) &&
|
32851 | _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")
|
32852 | ) {
|
32853 | return null
|
32854 | }
|
32855 | $event.stopPropagation()
|
32856 | return _vm.handleEnterClick($event)
|
32857 | },
|
32858 | focus: _vm.handleFocus,
|
32859 | blur: function($event) {
|
32860 | _vm.focusing = false
|
32861 | }
|
32862 | }
|
32863 | },
|
32864 | [
|
32865 | _vm._t("title", [_vm._v(_vm._s(_vm.title))]),
|
32866 | _c("i", {
|
32867 | staticClass: "el-collapse-item__arrow el-icon-arrow-right",
|
32868 | class: { "is-active": _vm.isActive }
|
32869 | })
|
32870 | ],
|
32871 | 2
|
32872 | )
|
32873 | ]
|
32874 | ),
|
32875 | _c("el-collapse-transition", [
|
32876 | _c(
|
32877 | "div",
|
32878 | {
|
32879 | directives: [
|
32880 | {
|
32881 | name: "show",
|
32882 | rawName: "v-show",
|
32883 | value: _vm.isActive,
|
32884 | expression: "isActive"
|
32885 | }
|
32886 | ],
|
32887 | staticClass: "el-collapse-item__wrap",
|
32888 | attrs: {
|
32889 | role: "tabpanel",
|
32890 | "aria-hidden": !_vm.isActive,
|
32891 | "aria-labelledby": "el-collapse-head-" + _vm.id,
|
32892 | id: "el-collapse-content-" + _vm.id
|
32893 | }
|
32894 | },
|
32895 | [
|
32896 | _c(
|
32897 | "div",
|
32898 | { staticClass: "el-collapse-item__content" },
|
32899 | [_vm._t("default")],
|
32900 | 2
|
32901 | )
|
32902 | ]
|
32903 | )
|
32904 | ])
|
32905 | ],
|
32906 | 1
|
32907 | )
|
32908 | }
|
32909 | var collapse_itemvue_type_template_id_2d05faac_staticRenderFns = []
|
32910 | collapse_itemvue_type_template_id_2d05faac_render._withStripped = true
|
32911 |
|
32912 |
|
32913 |
|
32914 |
|
32915 |
|
32916 |
|
32917 |
|
32918 |
|
32919 |
|
32920 |
|
32921 |
|
32922 |
|
32923 |
|
32924 |
|
32925 |
|
32926 |
|
32927 |
|
32928 |
|
32929 |
|
32930 |
|
32931 |
|
32932 |
|
32933 |
|
32934 |
|
32935 |
|
32936 |
|
32937 |
|
32938 |
|
32939 |
|
32940 |
|
32941 |
|
32942 |
|
32943 |
|
32944 |
|
32945 |
|
32946 |
|
32947 |
|
32948 |
|
32949 |
|
32950 |
|
32951 |
|
32952 |
|
32953 |
|
32954 |
|
32955 |
|
32956 |
|
32957 |
|
32958 |
|
32959 |
|
32960 |
|
32961 |
|
32962 |
|
32963 |
|
32964 |
|
32965 |
|
32966 |
|
32967 | var collapse_itemvue_type_script_lang_js_ = ({
|
32968 | name: 'ElCollapseItem',
|
32969 |
|
32970 | componentName: 'ElCollapseItem',
|
32971 |
|
32972 | mixins: [emitter_default.a],
|
32973 |
|
32974 | components: { ElCollapseTransition: collapse_transition_default.a },
|
32975 |
|
32976 | data: function data() {
|
32977 | return {
|
32978 | contentWrapStyle: {
|
32979 | height: 'auto',
|
32980 | display: 'block'
|
32981 | },
|
32982 | contentHeight: 0,
|
32983 | focusing: false,
|
32984 | isClick: false,
|
32985 | id: Object(util_["generateId"])()
|
32986 | };
|
32987 | },
|
32988 |
|
32989 |
|
32990 | inject: ['collapse'],
|
32991 |
|
32992 | props: {
|
32993 | title: String,
|
32994 | name: {
|
32995 | type: [String, Number],
|
32996 | default: function _default() {
|
32997 | return this._uid;
|
32998 | }
|
32999 | },
|
33000 | disabled: Boolean
|
33001 | },
|
33002 |
|
33003 | computed: {
|
33004 | isActive: function isActive() {
|
33005 | return this.collapse.activeNames.indexOf(this.name) > -1;
|
33006 | }
|
33007 | },
|
33008 |
|
33009 | methods: {
|
33010 | handleFocus: function handleFocus() {
|
33011 | var _this = this;
|
33012 |
|
33013 | setTimeout(function () {
|
33014 | if (!_this.isClick) {
|
33015 | _this.focusing = true;
|
33016 | } else {
|
33017 | _this.isClick = false;
|
33018 | }
|
33019 | }, 50);
|
33020 | },
|
33021 | handleHeaderClick: function handleHeaderClick() {
|
33022 | if (this.disabled) return;
|
33023 | this.dispatch('ElCollapse', 'item-click', this);
|
33024 | this.focusing = false;
|
33025 | this.isClick = true;
|
33026 | },
|
33027 | handleEnterClick: function handleEnterClick() {
|
33028 | this.dispatch('ElCollapse', 'item-click', this);
|
33029 | }
|
33030 | }
|
33031 | });
|
33032 |
|
33033 | var src_collapse_itemvue_type_script_lang_js_ = (collapse_itemvue_type_script_lang_js_);
|
33034 |
|
33035 |
|
33036 |
|
33037 |
|
33038 |
|
33039 |
|
33040 |
|
33041 |
|
33042 | var collapse_item_component = normalizeComponent(
|
33043 | src_collapse_itemvue_type_script_lang_js_,
|
33044 | collapse_itemvue_type_template_id_2d05faac_render,
|
33045 | collapse_itemvue_type_template_id_2d05faac_staticRenderFns,
|
33046 | false,
|
33047 | null,
|
33048 | null,
|
33049 | null
|
33050 |
|
33051 | )
|
33052 |
|
33053 |
|
33054 | if (false) { var collapse_item_api; }
|
33055 | collapse_item_component.options.__file = "packages/collapse/src/collapse-item.vue"
|
33056 | var collapse_item = (collapse_item_component.exports);
|
33057 |
|
33058 |
|
33059 |
|
33060 |
|
33061 | collapse_item.install = function (Vue) {
|
33062 | Vue.component(collapse_item.name, collapse_item);
|
33063 | };
|
33064 |
|
33065 | var packages_collapse_item = (collapse_item);
|
33066 |
|
33067 | var cascadervue_type_template_id_032537a6_render = function() {
|
33068 | var _vm = this
|
33069 | var _h = _vm.$createElement
|
33070 | var _c = _vm._self._c || _h
|
33071 | return _c(
|
33072 | "div",
|
33073 | {
|
33074 | directives: [
|
33075 | {
|
33076 | name: "clickoutside",
|
33077 | rawName: "v-clickoutside",
|
33078 | value: function() {
|
33079 | return _vm.toggleDropDownVisible(false)
|
33080 | },
|
33081 | expression: "() => toggleDropDownVisible(false)"
|
33082 | }
|
33083 | ],
|
33084 | ref: "reference",
|
33085 | class: [
|
33086 | "el-cascader",
|
33087 | _vm.realSize && "el-cascader--" + _vm.realSize,
|
33088 | { "is-disabled": _vm.isDisabled }
|
33089 | ],
|
33090 | on: {
|
33091 | mouseenter: function($event) {
|
33092 | _vm.inputHover = true
|
33093 | },
|
33094 | mouseleave: function($event) {
|
33095 | _vm.inputHover = false
|
33096 | },
|
33097 | click: function() {
|
33098 | return _vm.toggleDropDownVisible(_vm.readonly ? undefined : true)
|
33099 | },
|
33100 | keydown: _vm.handleKeyDown
|
33101 | }
|
33102 | },
|
33103 | [
|
33104 | _c(
|
33105 | "el-input",
|
33106 | {
|
33107 | ref: "input",
|
33108 | class: { "is-focus": _vm.dropDownVisible },
|
33109 | attrs: {
|
33110 | size: _vm.realSize,
|
33111 | placeholder: _vm.placeholder,
|
33112 | readonly: _vm.readonly,
|
33113 | disabled: _vm.isDisabled,
|
33114 | "validate-event": false
|
33115 | },
|
33116 | on: {
|
33117 | focus: _vm.handleFocus,
|
33118 | blur: _vm.handleBlur,
|
33119 | input: _vm.handleInput
|
33120 | },
|
33121 | model: {
|
33122 | value: _vm.multiple ? _vm.presentText : _vm.inputValue,
|
33123 | callback: function($$v) {
|
33124 | _vm.multiple ? _vm.presentText : (_vm.inputValue = $$v)
|
33125 | },
|
33126 | expression: "multiple ? presentText : inputValue"
|
33127 | }
|
33128 | },
|
33129 | [
|
33130 | _c("template", { slot: "suffix" }, [
|
33131 | _vm.clearBtnVisible
|
33132 | ? _c("i", {
|
33133 | key: "clear",
|
33134 | staticClass: "el-input__icon el-icon-circle-close",
|
33135 | on: {
|
33136 | click: function($event) {
|
33137 | $event.stopPropagation()
|
33138 | return _vm.handleClear($event)
|
33139 | }
|
33140 | }
|
33141 | })
|
33142 | : _c("i", {
|
33143 | key: "arrow-down",
|
33144 | class: [
|
33145 | "el-input__icon",
|
33146 | "el-icon-arrow-down",
|
33147 | _vm.dropDownVisible && "is-reverse"
|
33148 | ],
|
33149 | on: {
|
33150 | click: function($event) {
|
33151 | $event.stopPropagation()
|
33152 | _vm.toggleDropDownVisible()
|
33153 | }
|
33154 | }
|
33155 | })
|
33156 | ])
|
33157 | ],
|
33158 | 2
|
33159 | ),
|
33160 | _vm.multiple
|
33161 | ? _c(
|
33162 | "div",
|
33163 | { staticClass: "el-cascader__tags" },
|
33164 | [
|
33165 | _vm._l(_vm.presentTags, function(tag, index) {
|
33166 | return _c(
|
33167 | "el-tag",
|
33168 | {
|
33169 | key: tag.key,
|
33170 | attrs: {
|
33171 | type: "info",
|
33172 | size: _vm.tagSize,
|
33173 | hit: tag.hitState,
|
33174 | closable: tag.closable,
|
33175 | "disable-transitions": ""
|
33176 | },
|
33177 | on: {
|
33178 | close: function($event) {
|
33179 | _vm.deleteTag(index)
|
33180 | }
|
33181 | }
|
33182 | },
|
33183 | [_c("span", [_vm._v(_vm._s(tag.text))])]
|
33184 | )
|
33185 | }),
|
33186 | _vm.filterable && !_vm.isDisabled
|
33187 | ? _c("input", {
|
33188 | directives: [
|
33189 | {
|
33190 | name: "model",
|
33191 | rawName: "v-model.trim",
|
33192 | value: _vm.inputValue,
|
33193 | expression: "inputValue",
|
33194 | modifiers: { trim: true }
|
33195 | }
|
33196 | ],
|
33197 | staticClass: "el-cascader__search-input",
|
33198 | attrs: {
|
33199 | type: "text",
|
33200 | placeholder: _vm.presentTags.length ? "" : _vm.placeholder
|
33201 | },
|
33202 | domProps: { value: _vm.inputValue },
|
33203 | on: {
|
33204 | input: [
|
33205 | function($event) {
|
33206 | if ($event.target.composing) {
|
33207 | return
|
33208 | }
|
33209 | _vm.inputValue = $event.target.value.trim()
|
33210 | },
|
33211 | function(e) {
|
33212 | return _vm.handleInput(_vm.inputValue, e)
|
33213 | }
|
33214 | ],
|
33215 | click: function($event) {
|
33216 | $event.stopPropagation()
|
33217 | _vm.toggleDropDownVisible(true)
|
33218 | },
|
33219 | keydown: function($event) {
|
33220 | if (
|
33221 | !("button" in $event) &&
|
33222 | _vm._k(
|
33223 | $event.keyCode,
|
33224 | "delete",
|
33225 | [8, 46],
|
33226 | $event.key,
|
33227 | ["Backspace", "Delete", "Del"]
|
33228 | )
|
33229 | ) {
|
33230 | return null
|
33231 | }
|
33232 | return _vm.handleDelete($event)
|
33233 | },
|
33234 | blur: function($event) {
|
33235 | _vm.$forceUpdate()
|
33236 | }
|
33237 | }
|
33238 | })
|
33239 | : _vm._e()
|
33240 | ],
|
33241 | 2
|
33242 | )
|
33243 | : _vm._e(),
|
33244 | _c(
|
33245 | "transition",
|
33246 | {
|
33247 | attrs: { name: "el-zoom-in-top" },
|
33248 | on: { "after-leave": _vm.handleDropdownLeave }
|
33249 | },
|
33250 | [
|
33251 | _c(
|
33252 | "div",
|
33253 | {
|
33254 | directives: [
|
33255 | {
|
33256 | name: "show",
|
33257 | rawName: "v-show",
|
33258 | value: _vm.dropDownVisible,
|
33259 | expression: "dropDownVisible"
|
33260 | }
|
33261 | ],
|
33262 | ref: "popper",
|
33263 | class: ["el-popper", "el-cascader__dropdown", _vm.popperClass]
|
33264 | },
|
33265 | [
|
33266 | _c("el-cascader-panel", {
|
33267 | directives: [
|
33268 | {
|
33269 | name: "show",
|
33270 | rawName: "v-show",
|
33271 | value: !_vm.filtering,
|
33272 | expression: "!filtering"
|
33273 | }
|
33274 | ],
|
33275 | ref: "panel",
|
33276 | attrs: {
|
33277 | options: _vm.options,
|
33278 | props: _vm.config,
|
33279 | border: false,
|
33280 | "render-label": _vm.$scopedSlots.default
|
33281 | },
|
33282 | on: {
|
33283 | "expand-change": _vm.handleExpandChange,
|
33284 | close: function($event) {
|
33285 | _vm.toggleDropDownVisible(false)
|
33286 | }
|
33287 | },
|
33288 | model: {
|
33289 | value: _vm.checkedValue,
|
33290 | callback: function($$v) {
|
33291 | _vm.checkedValue = $$v
|
33292 | },
|
33293 | expression: "checkedValue"
|
33294 | }
|
33295 | }),
|
33296 | _vm.filterable
|
33297 | ? _c(
|
33298 | "el-scrollbar",
|
33299 | {
|
33300 | directives: [
|
33301 | {
|
33302 | name: "show",
|
33303 | rawName: "v-show",
|
33304 | value: _vm.filtering,
|
33305 | expression: "filtering"
|
33306 | }
|
33307 | ],
|
33308 | ref: "suggestionPanel",
|
33309 | staticClass: "el-cascader__suggestion-panel",
|
33310 | attrs: {
|
33311 | tag: "ul",
|
33312 | "view-class": "el-cascader__suggestion-list"
|
33313 | },
|
33314 | nativeOn: {
|
33315 | keydown: function($event) {
|
33316 | return _vm.handleSuggestionKeyDown($event)
|
33317 | }
|
33318 | }
|
33319 | },
|
33320 | [
|
33321 | _vm.suggestions.length
|
33322 | ? _vm._l(_vm.suggestions, function(item, index) {
|
33323 | return _c(
|
33324 | "li",
|
33325 | {
|
33326 | key: item.uid,
|
33327 | class: [
|
33328 | "el-cascader__suggestion-item",
|
33329 | item.checked && "is-checked"
|
33330 | ],
|
33331 | attrs: { tabindex: -1 },
|
33332 | on: {
|
33333 | click: function($event) {
|
33334 | _vm.handleSuggestionClick(index)
|
33335 | }
|
33336 | }
|
33337 | },
|
33338 | [
|
33339 | _c("span", [_vm._v(_vm._s(item.text))]),
|
33340 | item.checked
|
33341 | ? _c("i", { staticClass: "el-icon-check" })
|
33342 | : _vm._e()
|
33343 | ]
|
33344 | )
|
33345 | })
|
33346 | : _vm._t("empty", [
|
33347 | _c(
|
33348 | "li",
|
33349 | { staticClass: "el-cascader__empty-text" },
|
33350 | [_vm._v(_vm._s(_vm.t("el.cascader.noMatch")))]
|
33351 | )
|
33352 | ])
|
33353 | ],
|
33354 | 2
|
33355 | )
|
33356 | : _vm._e()
|
33357 | ],
|
33358 | 1
|
33359 | )
|
33360 | ]
|
33361 | )
|
33362 | ],
|
33363 | 1
|
33364 | )
|
33365 | }
|
33366 | var cascadervue_type_template_id_032537a6_staticRenderFns = []
|
33367 | cascadervue_type_template_id_032537a6_render._withStripped = true
|
33368 |
|
33369 |
|
33370 |
|
33371 |
|
33372 |
|
33373 | var cascader_panel_ = __webpack_require__(42);
|
33374 | var cascader_panel_default = __webpack_require__.n(cascader_panel_);
|
33375 |
|
33376 |
|
33377 | var aria_utils_ = __webpack_require__(28);
|
33378 | var aria_utils_default = __webpack_require__.n(aria_utils_);
|
33379 |
|
33380 |
|
33381 |
|
33382 |
|
33383 |
|
33384 |
|
33385 |
|
33386 |
|
33387 |
|
33388 |
|
33389 |
|
33390 |
|
33391 |
|
33392 |
|
33393 |
|
33394 |
|
33395 |
|
33396 |
|
33397 |
|
33398 |
|
33399 |
|
33400 |
|
33401 |
|
33402 |
|
33403 |
|
33404 |
|
33405 |
|
33406 |
|
33407 |
|
33408 |
|
33409 |
|
33410 |
|
33411 |
|
33412 |
|
33413 |
|
33414 |
|
33415 |
|
33416 |
|
33417 |
|
33418 |
|
33419 |
|
33420 |
|
33421 |
|
33422 |
|
33423 |
|
33424 |
|
33425 |
|
33426 |
|
33427 |
|
33428 |
|
33429 |
|
33430 |
|
33431 |
|
33432 |
|
33433 |
|
33434 |
|
33435 |
|
33436 |
|
33437 |
|
33438 |
|
33439 |
|
33440 |
|
33441 |
|
33442 |
|
33443 |
|
33444 |
|
33445 |
|
33446 |
|
33447 |
|
33448 |
|
33449 |
|
33450 |
|
33451 |
|
33452 |
|
33453 |
|
33454 |
|
33455 |
|
33456 |
|
33457 |
|
33458 |
|
33459 |
|
33460 |
|
33461 |
|
33462 |
|
33463 |
|
33464 |
|
33465 |
|
33466 |
|
33467 |
|
33468 |
|
33469 |
|
33470 |
|
33471 |
|
33472 |
|
33473 |
|
33474 |
|
33475 |
|
33476 |
|
33477 |
|
33478 |
|
33479 |
|
33480 |
|
33481 |
|
33482 |
|
33483 |
|
33484 |
|
33485 |
|
33486 |
|
33487 |
|
33488 |
|
33489 |
|
33490 |
|
33491 |
|
33492 |
|
33493 |
|
33494 |
|
33495 |
|
33496 |
|
33497 |
|
33498 |
|
33499 |
|
33500 |
|
33501 |
|
33502 |
|
33503 |
|
33504 |
|
33505 |
|
33506 |
|
33507 |
|
33508 |
|
33509 |
|
33510 |
|
33511 |
|
33512 | var KeyCode = aria_utils_default.a.keys;
|
33513 |
|
33514 | var MigratingProps = {
|
33515 | expandTrigger: {
|
33516 | newProp: 'expandTrigger',
|
33517 | type: String
|
33518 | },
|
33519 | changeOnSelect: {
|
33520 | newProp: 'checkStrictly',
|
33521 | type: Boolean
|
33522 | },
|
33523 | hoverThreshold: {
|
33524 | newProp: 'hoverThreshold',
|
33525 | type: Number
|
33526 | }
|
33527 | };
|
33528 |
|
33529 | var PopperMixin = {
|
33530 | props: {
|
33531 | placement: {
|
33532 | type: String,
|
33533 | default: 'bottom-start'
|
33534 | },
|
33535 | appendToBody: vue_popper_default.a.props.appendToBody,
|
33536 | visibleArrow: {
|
33537 | type: Boolean,
|
33538 | default: true
|
33539 | },
|
33540 | arrowOffset: vue_popper_default.a.props.arrowOffset,
|
33541 | offset: vue_popper_default.a.props.offset,
|
33542 | boundariesPadding: vue_popper_default.a.props.boundariesPadding,
|
33543 | popperOptions: vue_popper_default.a.props.popperOptions
|
33544 | },
|
33545 | methods: vue_popper_default.a.methods,
|
33546 | data: vue_popper_default.a.data,
|
33547 | beforeDestroy: vue_popper_default.a.beforeDestroy
|
33548 | };
|
33549 |
|
33550 | var InputSizeMap = {
|
33551 | medium: 36,
|
33552 | small: 32,
|
33553 | mini: 28
|
33554 | };
|
33555 |
|
33556 | var cascadervue_type_script_lang_js_ = ({
|
33557 | name: 'ElCascader',
|
33558 |
|
33559 | directives: { Clickoutside: clickoutside_default.a },
|
33560 |
|
33561 | mixins: [PopperMixin, emitter_default.a, locale_default.a, migrating_default.a],
|
33562 |
|
33563 | inject: {
|
33564 | elForm: {
|
33565 | default: ''
|
33566 | },
|
33567 | elFormItem: {
|
33568 | default: ''
|
33569 | }
|
33570 | },
|
33571 |
|
33572 | components: {
|
33573 | ElInput: input_default.a,
|
33574 | ElTag: tag_default.a,
|
33575 | ElScrollbar: scrollbar_default.a,
|
33576 | ElCascaderPanel: cascader_panel_default.a
|
33577 | },
|
33578 |
|
33579 | props: {
|
33580 | value: {},
|
33581 | options: Array,
|
33582 | props: Object,
|
33583 | size: String,
|
33584 | placeholder: {
|
33585 | type: String,
|
33586 | default: function _default() {
|
33587 | return Object(lib_locale_["t"])('el.cascader.placeholder');
|
33588 | }
|
33589 | },
|
33590 | disabled: Boolean,
|
33591 | clearable: Boolean,
|
33592 | filterable: Boolean,
|
33593 | filterMethod: Function,
|
33594 | separator: {
|
33595 | type: String,
|
33596 | default: ' / '
|
33597 | },
|
33598 | showAllLevels: {
|
33599 | type: Boolean,
|
33600 | default: true
|
33601 | },
|
33602 | collapseTags: Boolean,
|
33603 | debounce: {
|
33604 | type: Number,
|
33605 | default: 300
|
33606 | },
|
33607 | beforeFilter: {
|
33608 | type: Function,
|
33609 | default: function _default() {
|
33610 | return function () {};
|
33611 | }
|
33612 | },
|
33613 | popperClass: String
|
33614 | },
|
33615 |
|
33616 | data: function data() {
|
33617 | return {
|
33618 | dropDownVisible: false,
|
33619 | checkedValue: this.value || null,
|
33620 | inputHover: false,
|
33621 | inputValue: null,
|
33622 | presentText: null,
|
33623 | presentTags: [],
|
33624 | checkedNodes: [],
|
33625 | filtering: false,
|
33626 | suggestions: [],
|
33627 | inputInitialHeight: 0,
|
33628 | pressDeleteCount: 0
|
33629 | };
|
33630 | },
|
33631 |
|
33632 |
|
33633 | computed: {
|
33634 | realSize: function realSize() {
|
33635 | var _elFormItemSize = (this.elFormItem || {}).elFormItemSize;
|
33636 | return this.size || _elFormItemSize || (this.$ELEMENT || {}).size;
|
33637 | },
|
33638 | tagSize: function tagSize() {
|
33639 | return ['small', 'mini'].indexOf(this.realSize) > -1 ? 'mini' : 'small';
|
33640 | },
|
33641 | isDisabled: function isDisabled() {
|
33642 | return this.disabled || (this.elForm || {}).disabled;
|
33643 | },
|
33644 | config: function config() {
|
33645 | var config = this.props || {};
|
33646 | var $attrs = this.$attrs;
|
33647 |
|
33648 |
|
33649 | Object.keys(MigratingProps).forEach(function (oldProp) {
|
33650 | var _MigratingProps$oldPr = MigratingProps[oldProp],
|
33651 | newProp = _MigratingProps$oldPr.newProp,
|
33652 | type = _MigratingProps$oldPr.type;
|
33653 |
|
33654 | var oldValue = $attrs[oldProp] || $attrs[Object(util_["kebabCase"])(oldProp)];
|
33655 | if (Object(shared_["isDef"])(oldProp) && !Object(shared_["isDef"])(config[newProp])) {
|
33656 | if (type === Boolean && oldValue === '') {
|
33657 | oldValue = true;
|
33658 | }
|
33659 | config[newProp] = oldValue;
|
33660 | }
|
33661 | });
|
33662 |
|
33663 | return config;
|
33664 | },
|
33665 | multiple: function multiple() {
|
33666 | return this.config.multiple;
|
33667 | },
|
33668 | leafOnly: function leafOnly() {
|
33669 | return !this.config.checkStrictly;
|
33670 | },
|
33671 | readonly: function readonly() {
|
33672 | return !this.filterable || this.multiple;
|
33673 | },
|
33674 | clearBtnVisible: function clearBtnVisible() {
|
33675 | if (!this.clearable || this.isDisabled || this.filtering || !this.inputHover) {
|
33676 | return false;
|
33677 | }
|
33678 |
|
33679 | return this.multiple ? !!this.checkedNodes.filter(function (node) {
|
33680 | return !node.isDisabled;
|
33681 | }).length : !!this.presentText;
|
33682 | },
|
33683 | panel: function panel() {
|
33684 | return this.$refs.panel;
|
33685 | }
|
33686 | },
|
33687 |
|
33688 | watch: {
|
33689 | disabled: function disabled() {
|
33690 | this.computePresentContent();
|
33691 | },
|
33692 | value: function value(val) {
|
33693 | if (!Object(util_["isEqual"])(val, this.checkedValue)) {
|
33694 | this.checkedValue = val;
|
33695 | this.computePresentContent();
|
33696 | }
|
33697 | },
|
33698 | checkedValue: function checkedValue(val) {
|
33699 | var value = this.value,
|
33700 | dropDownVisible = this.dropDownVisible;
|
33701 | var _config = this.config,
|
33702 | checkStrictly = _config.checkStrictly,
|
33703 | multiple = _config.multiple;
|
33704 |
|
33705 |
|
33706 | if (!Object(util_["isEqual"])(val, value) || Object(types_["isUndefined"])(value)) {
|
33707 | this.computePresentContent();
|
33708 |
|
33709 | if (!multiple && !checkStrictly && dropDownVisible) {
|
33710 | this.toggleDropDownVisible(false);
|
33711 | }
|
33712 |
|
33713 | this.$emit('input', val);
|
33714 | this.$emit('change', val);
|
33715 | this.dispatch('ElFormItem', 'el.form.change', [val]);
|
33716 | }
|
33717 | },
|
33718 |
|
33719 | options: {
|
33720 | handler: function handler() {
|
33721 | this.$nextTick(this.computePresentContent);
|
33722 | },
|
33723 | deep: true
|
33724 | },
|
33725 | presentText: function presentText(val) {
|
33726 | this.inputValue = val;
|
33727 | },
|
33728 | presentTags: function presentTags(val, oldVal) {
|
33729 | if (this.multiple && (val.length || oldVal.length)) {
|
33730 | this.$nextTick(this.updateStyle);
|
33731 | }
|
33732 | },
|
33733 | filtering: function filtering(val) {
|
33734 | this.$nextTick(this.updatePopper);
|
33735 | }
|
33736 | },
|
33737 |
|
33738 | mounted: function mounted() {
|
33739 | var _this = this;
|
33740 |
|
33741 | var input = this.$refs.input;
|
33742 |
|
33743 | if (input && input.$el) {
|
33744 | this.inputInitialHeight = input.$el.offsetHeight || InputSizeMap[this.realSize] || 40;
|
33745 | }
|
33746 |
|
33747 | if (!Object(util_["isEmpty"])(this.value)) {
|
33748 | this.computePresentContent();
|
33749 | }
|
33750 |
|
33751 | this.filterHandler = debounce_default()(this.debounce, function () {
|
33752 | var inputValue = _this.inputValue;
|
33753 |
|
33754 |
|
33755 | if (!inputValue) {
|
33756 | _this.filtering = false;
|
33757 | return;
|
33758 | }
|
33759 |
|
33760 | var before = _this.beforeFilter(inputValue);
|
33761 | if (before && before.then) {
|
33762 | before.then(_this.getSuggestions);
|
33763 | } else if (before !== false) {
|
33764 | _this.getSuggestions();
|
33765 | } else {
|
33766 | _this.filtering = false;
|
33767 | }
|
33768 | });
|
33769 |
|
33770 | Object(resize_event_["addResizeListener"])(this.$el, this.updateStyle);
|
33771 | },
|
33772 | beforeDestroy: function beforeDestroy() {
|
33773 | Object(resize_event_["removeResizeListener"])(this.$el, this.updateStyle);
|
33774 | },
|
33775 |
|
33776 |
|
33777 | methods: {
|
33778 | getMigratingConfig: function getMigratingConfig() {
|
33779 | return {
|
33780 | props: {
|
33781 | 'expand-trigger': 'expand-trigger is removed, use `props.expandTrigger` instead.',
|
33782 | 'change-on-select': 'change-on-select is removed, use `props.checkStrictly` instead.',
|
33783 | 'hover-threshold': 'hover-threshold is removed, use `props.hoverThreshold` instead'
|
33784 | },
|
33785 | events: {
|
33786 | 'active-item-change': 'active-item-change is renamed to expand-change'
|
33787 | }
|
33788 | };
|
33789 | },
|
33790 | toggleDropDownVisible: function toggleDropDownVisible(visible) {
|
33791 | var _this2 = this;
|
33792 |
|
33793 | if (this.isDisabled) return;
|
33794 |
|
33795 | var dropDownVisible = this.dropDownVisible;
|
33796 | var input = this.$refs.input;
|
33797 |
|
33798 | visible = Object(shared_["isDef"])(visible) ? visible : !dropDownVisible;
|
33799 | if (visible !== dropDownVisible) {
|
33800 | this.dropDownVisible = visible;
|
33801 | if (visible) {
|
33802 | this.$nextTick(function () {
|
33803 | _this2.updatePopper();
|
33804 | _this2.panel.scrollIntoView();
|
33805 | });
|
33806 | }
|
33807 | input.$refs.input.setAttribute('aria-expanded', visible);
|
33808 | this.$emit('visible-change', visible);
|
33809 | }
|
33810 | },
|
33811 | handleDropdownLeave: function handleDropdownLeave() {
|
33812 | this.filtering = false;
|
33813 | this.inputValue = this.presentText;
|
33814 | },
|
33815 | handleKeyDown: function handleKeyDown(event) {
|
33816 | switch (event.keyCode) {
|
33817 | case KeyCode.enter:
|
33818 | this.toggleDropDownVisible();
|
33819 | break;
|
33820 | case KeyCode.down:
|
33821 | this.toggleDropDownVisible(true);
|
33822 | this.focusFirstNode();
|
33823 | event.preventDefault();
|
33824 | break;
|
33825 | case KeyCode.esc:
|
33826 | case KeyCode.tab:
|
33827 | this.toggleDropDownVisible(false);
|
33828 | break;
|
33829 | }
|
33830 | },
|
33831 | handleFocus: function handleFocus(e) {
|
33832 | this.$emit('focus', e);
|
33833 | },
|
33834 | handleBlur: function handleBlur(e) {
|
33835 | this.$emit('blur', e);
|
33836 | },
|
33837 | handleInput: function handleInput(val, event) {
|
33838 | !this.dropDownVisible && this.toggleDropDownVisible(true);
|
33839 |
|
33840 | if (event && event.isComposing) return;
|
33841 | if (val) {
|
33842 | this.filterHandler();
|
33843 | } else {
|
33844 | this.filtering = false;
|
33845 | }
|
33846 | },
|
33847 | handleClear: function handleClear() {
|
33848 | this.presentText = '';
|
33849 | this.panel.clearCheckedNodes();
|
33850 | },
|
33851 | handleExpandChange: function handleExpandChange(value) {
|
33852 | this.$nextTick(this.updatePopper.bind(this));
|
33853 | this.$emit('expand-change', value);
|
33854 | this.$emit('active-item-change', value);
|
33855 | },
|
33856 | focusFirstNode: function focusFirstNode() {
|
33857 | var _this3 = this;
|
33858 |
|
33859 | this.$nextTick(function () {
|
33860 | var filtering = _this3.filtering;
|
33861 | var _$refs = _this3.$refs,
|
33862 | popper = _$refs.popper,
|
33863 | suggestionPanel = _$refs.suggestionPanel;
|
33864 |
|
33865 | var firstNode = null;
|
33866 |
|
33867 | if (filtering && suggestionPanel) {
|
33868 | firstNode = suggestionPanel.$el.querySelector('.el-cascader__suggestion-item');
|
33869 | } else {
|
33870 | var firstMenu = popper.querySelector('.el-cascader-menu');
|
33871 | firstNode = firstMenu.querySelector('.el-cascader-node[tabindex="-1"]');
|
33872 | }
|
33873 |
|
33874 | if (firstNode) {
|
33875 | firstNode.focus();
|
33876 | !filtering && firstNode.click();
|
33877 | }
|
33878 | });
|
33879 | },
|
33880 | computePresentContent: function computePresentContent() {
|
33881 | var _this4 = this;
|
33882 |
|
33883 |
|
33884 | this.$nextTick(function () {
|
33885 | if (_this4.config.multiple) {
|
33886 | _this4.computePresentTags();
|
33887 | _this4.presentText = _this4.presentTags.length ? ' ' : null;
|
33888 | } else {
|
33889 | _this4.computePresentText();
|
33890 | }
|
33891 | });
|
33892 | },
|
33893 | computePresentText: function computePresentText() {
|
33894 | var checkedValue = this.checkedValue,
|
33895 | config = this.config;
|
33896 |
|
33897 | if (!Object(util_["isEmpty"])(checkedValue)) {
|
33898 | var node = this.panel.getNodeByValue(checkedValue);
|
33899 | if (node && (config.checkStrictly || node.isLeaf)) {
|
33900 | this.presentText = node.getText(this.showAllLevels, this.separator);
|
33901 | return;
|
33902 | }
|
33903 | }
|
33904 | this.presentText = null;
|
33905 | },
|
33906 | computePresentTags: function computePresentTags() {
|
33907 | var isDisabled = this.isDisabled,
|
33908 | leafOnly = this.leafOnly,
|
33909 | showAllLevels = this.showAllLevels,
|
33910 | separator = this.separator,
|
33911 | collapseTags = this.collapseTags;
|
33912 |
|
33913 | var checkedNodes = this.getCheckedNodes(leafOnly);
|
33914 | var tags = [];
|
33915 |
|
33916 | var genTag = function genTag(node) {
|
33917 | return {
|
33918 | node: node,
|
33919 | key: node.uid,
|
33920 | text: node.getText(showAllLevels, separator),
|
33921 | hitState: false,
|
33922 | closable: !isDisabled && !node.isDisabled
|
33923 | };
|
33924 | };
|
33925 |
|
33926 | if (checkedNodes.length) {
|
33927 | var first = checkedNodes[0],
|
33928 | rest = checkedNodes.slice(1);
|
33929 |
|
33930 | var restCount = rest.length;
|
33931 | tags.push(genTag(first));
|
33932 |
|
33933 | if (restCount) {
|
33934 | if (collapseTags) {
|
33935 | tags.push({
|
33936 | key: -1,
|
33937 | text: '+ ' + restCount,
|
33938 | closable: false
|
33939 | });
|
33940 | } else {
|
33941 | rest.forEach(function (node) {
|
33942 | return tags.push(genTag(node));
|
33943 | });
|
33944 | }
|
33945 | }
|
33946 | }
|
33947 |
|
33948 | this.checkedNodes = checkedNodes;
|
33949 | this.presentTags = tags;
|
33950 | },
|
33951 | getSuggestions: function getSuggestions() {
|
33952 | var _this5 = this;
|
33953 |
|
33954 | var filterMethod = this.filterMethod;
|
33955 |
|
33956 |
|
33957 | if (!Object(types_["isFunction"])(filterMethod)) {
|
33958 | filterMethod = function filterMethod(node, keyword) {
|
33959 | return node.text.includes(keyword);
|
33960 | };
|
33961 | }
|
33962 |
|
33963 | var suggestions = this.panel.getFlattedNodes(this.leafOnly).filter(function (node) {
|
33964 | if (node.isDisabled) return false;
|
33965 | node.text = node.getText(_this5.showAllLevels, _this5.separator) || '';
|
33966 | return filterMethod(node, _this5.inputValue);
|
33967 | });
|
33968 |
|
33969 | if (this.multiple) {
|
33970 | this.presentTags.forEach(function (tag) {
|
33971 | tag.hitState = false;
|
33972 | });
|
33973 | } else {
|
33974 | suggestions.forEach(function (node) {
|
33975 | node.checked = Object(util_["isEqual"])(_this5.checkedValue, node.getValueByOption());
|
33976 | });
|
33977 | }
|
33978 |
|
33979 | this.filtering = true;
|
33980 | this.suggestions = suggestions;
|
33981 | this.$nextTick(this.updatePopper);
|
33982 | },
|
33983 | handleSuggestionKeyDown: function handleSuggestionKeyDown(event) {
|
33984 | var keyCode = event.keyCode,
|
33985 | target = event.target;
|
33986 |
|
33987 | switch (keyCode) {
|
33988 | case KeyCode.enter:
|
33989 | target.click();
|
33990 | break;
|
33991 | case KeyCode.up:
|
33992 | var prev = target.previousElementSibling;
|
33993 | prev && prev.focus();
|
33994 | break;
|
33995 | case KeyCode.down:
|
33996 | var next = target.nextElementSibling;
|
33997 | next && next.focus();
|
33998 | break;
|
33999 | case KeyCode.esc:
|
34000 | case KeyCode.tab:
|
34001 | this.toggleDropDownVisible(false);
|
34002 | break;
|
34003 | }
|
34004 | },
|
34005 | handleDelete: function handleDelete() {
|
34006 | var inputValue = this.inputValue,
|
34007 | pressDeleteCount = this.pressDeleteCount,
|
34008 | presentTags = this.presentTags;
|
34009 |
|
34010 | var lastIndex = presentTags.length - 1;
|
34011 | var lastTag = presentTags[lastIndex];
|
34012 | this.pressDeleteCount = inputValue ? 0 : pressDeleteCount + 1;
|
34013 |
|
34014 | if (!lastTag) return;
|
34015 |
|
34016 | if (this.pressDeleteCount) {
|
34017 | if (lastTag.hitState) {
|
34018 | this.deleteTag(lastIndex);
|
34019 | } else {
|
34020 | lastTag.hitState = true;
|
34021 | }
|
34022 | }
|
34023 | },
|
34024 | handleSuggestionClick: function handleSuggestionClick(index) {
|
34025 | var multiple = this.multiple;
|
34026 |
|
34027 | var targetNode = this.suggestions[index];
|
34028 |
|
34029 | if (multiple) {
|
34030 | var checked = targetNode.checked;
|
34031 |
|
34032 | targetNode.doCheck(!checked);
|
34033 | this.panel.calculateMultiCheckedValue();
|
34034 | } else {
|
34035 | this.checkedValue = targetNode.getValueByOption();
|
34036 | this.toggleDropDownVisible(false);
|
34037 | }
|
34038 | },
|
34039 | deleteTag: function deleteTag(index) {
|
34040 | var checkedValue = this.checkedValue;
|
34041 |
|
34042 | var val = checkedValue[index];
|
34043 | this.checkedValue = checkedValue.filter(function (n, i) {
|
34044 | return i !== index;
|
34045 | });
|
34046 | this.$emit('remove-tag', val);
|
34047 | },
|
34048 | updateStyle: function updateStyle() {
|
34049 | var $el = this.$el,
|
34050 | inputInitialHeight = this.inputInitialHeight;
|
34051 |
|
34052 | if (this.$isServer || !$el) return;
|
34053 |
|
34054 | var suggestionPanel = this.$refs.suggestionPanel;
|
34055 |
|
34056 | var inputInner = $el.querySelector('.el-input__inner');
|
34057 |
|
34058 | if (!inputInner) return;
|
34059 |
|
34060 | var tags = $el.querySelector('.el-cascader__tags');
|
34061 | var suggestionPanelEl = null;
|
34062 |
|
34063 | if (suggestionPanel && (suggestionPanelEl = suggestionPanel.$el)) {
|
34064 | var suggestionList = suggestionPanelEl.querySelector('.el-cascader__suggestion-list');
|
34065 | suggestionList.style.minWidth = inputInner.offsetWidth + 'px';
|
34066 | }
|
34067 |
|
34068 | if (tags) {
|
34069 | var offsetHeight = tags.offsetHeight;
|
34070 |
|
34071 | var height = Math.max(offsetHeight + 6, inputInitialHeight) + 'px';
|
34072 | inputInner.style.height = height;
|
34073 | this.updatePopper();
|
34074 | }
|
34075 | },
|
34076 |
|
34077 |
|
34078 | |
34079 |
|
34080 |
|
34081 | getCheckedNodes: function getCheckedNodes(leafOnly) {
|
34082 | return this.panel.getCheckedNodes(leafOnly);
|
34083 | }
|
34084 | }
|
34085 | });
|
34086 |
|
34087 | var src_cascadervue_type_script_lang_js_ = (cascadervue_type_script_lang_js_);
|
34088 |
|
34089 |
|
34090 |
|
34091 |
|
34092 |
|
34093 |
|
34094 |
|
34095 |
|
34096 | var cascader_component = normalizeComponent(
|
34097 | src_cascadervue_type_script_lang_js_,
|
34098 | cascadervue_type_template_id_032537a6_render,
|
34099 | cascadervue_type_template_id_032537a6_staticRenderFns,
|
34100 | false,
|
34101 | null,
|
34102 | null,
|
34103 | null
|
34104 |
|
34105 | )
|
34106 |
|
34107 |
|
34108 | if (false) { var cascader_api; }
|
34109 | cascader_component.options.__file = "packages/cascader/src/cascader.vue"
|
34110 | var cascader = (cascader_component.exports);
|
34111 |
|
34112 |
|
34113 |
|
34114 |
|
34115 | cascader.install = function (Vue) {
|
34116 | Vue.component(cascader.name, cascader);
|
34117 | };
|
34118 |
|
34119 | var packages_cascader = (cascader);
|
34120 |
|
34121 | var mainvue_type_template_id_55c8ade7_render = function() {
|
34122 | var _vm = this
|
34123 | var _h = _vm.$createElement
|
34124 | var _c = _vm._self._c || _h
|
34125 | return _c(
|
34126 | "div",
|
34127 | {
|
34128 | directives: [
|
34129 | {
|
34130 | name: "clickoutside",
|
34131 | rawName: "v-clickoutside",
|
34132 | value: _vm.hide,
|
34133 | expression: "hide"
|
34134 | }
|
34135 | ],
|
34136 | class: [
|
34137 | "el-color-picker",
|
34138 | _vm.colorDisabled ? "is-disabled" : "",
|
34139 | _vm.colorSize ? "el-color-picker--" + _vm.colorSize : ""
|
34140 | ]
|
34141 | },
|
34142 | [
|
34143 | _vm.colorDisabled
|
34144 | ? _c("div", { staticClass: "el-color-picker__mask" })
|
34145 | : _vm._e(),
|
34146 | _c(
|
34147 | "div",
|
34148 | {
|
34149 | staticClass: "el-color-picker__trigger",
|
34150 | on: { click: _vm.handleTrigger }
|
34151 | },
|
34152 | [
|
34153 | _c(
|
34154 | "span",
|
34155 | {
|
34156 | staticClass: "el-color-picker__color",
|
34157 | class: { "is-alpha": _vm.showAlpha }
|
34158 | },
|
34159 | [
|
34160 | _c("span", {
|
34161 | staticClass: "el-color-picker__color-inner",
|
34162 | style: {
|
34163 | backgroundColor: _vm.displayedColor
|
34164 | }
|
34165 | }),
|
34166 | !_vm.value && !_vm.showPanelColor
|
34167 | ? _c("span", {
|
34168 | staticClass: "el-color-picker__empty el-icon-close"
|
34169 | })
|
34170 | : _vm._e()
|
34171 | ]
|
34172 | ),
|
34173 | _c("span", {
|
34174 | directives: [
|
34175 | {
|
34176 | name: "show",
|
34177 | rawName: "v-show",
|
34178 | value: _vm.value || _vm.showPanelColor,
|
34179 | expression: "value || showPanelColor"
|
34180 | }
|
34181 | ],
|
34182 | staticClass: "el-color-picker__icon el-icon-arrow-down"
|
34183 | })
|
34184 | ]
|
34185 | ),
|
34186 | _c("picker-dropdown", {
|
34187 | ref: "dropdown",
|
34188 | class: ["el-color-picker__panel", _vm.popperClass || ""],
|
34189 | attrs: {
|
34190 | color: _vm.color,
|
34191 | "show-alpha": _vm.showAlpha,
|
34192 | predefine: _vm.predefine
|
34193 | },
|
34194 | on: { pick: _vm.confirmValue, clear: _vm.clearValue },
|
34195 | model: {
|
34196 | value: _vm.showPicker,
|
34197 | callback: function($$v) {
|
34198 | _vm.showPicker = $$v
|
34199 | },
|
34200 | expression: "showPicker"
|
34201 | }
|
34202 | })
|
34203 | ],
|
34204 | 1
|
34205 | )
|
34206 | }
|
34207 | var mainvue_type_template_id_55c8ade7_staticRenderFns = []
|
34208 | mainvue_type_template_id_55c8ade7_render._withStripped = true
|
34209 |
|
34210 |
|
34211 |
|
34212 |
|
34213 |
|
34214 | var color_typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
34215 |
|
34216 | function color_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
34217 |
|
34218 | var hsv2hsl = function hsv2hsl(hue, sat, val) {
|
34219 | return [hue, sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0, hue / 2];
|
34220 | };
|
34221 |
|
34222 |
|
34223 |
|
34224 | var isOnePointZero = function isOnePointZero(n) {
|
34225 | return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1;
|
34226 | };
|
34227 |
|
34228 | var isPercentage = function isPercentage(n) {
|
34229 | return typeof n === 'string' && n.indexOf('%') !== -1;
|
34230 | };
|
34231 |
|
34232 |
|
34233 | var bound01 = function bound01(value, max) {
|
34234 | if (isOnePointZero(value)) value = '100%';
|
34235 |
|
34236 | var processPercent = isPercentage(value);
|
34237 | value = Math.min(max, Math.max(0, parseFloat(value)));
|
34238 |
|
34239 |
|
34240 | if (processPercent) {
|
34241 | value = parseInt(value * max, 10) / 100;
|
34242 | }
|
34243 |
|
34244 |
|
34245 | if (Math.abs(value - max) < 0.000001) {
|
34246 | return 1;
|
34247 | }
|
34248 |
|
34249 |
|
34250 | return value % max / parseFloat(max);
|
34251 | };
|
34252 |
|
34253 | var INT_HEX_MAP = { 10: 'A', 11: 'B', 12: 'C', 13: 'D', 14: 'E', 15: 'F' };
|
34254 |
|
34255 | var toHex = function toHex(_ref) {
|
34256 | var r = _ref.r,
|
34257 | g = _ref.g,
|
34258 | b = _ref.b;
|
34259 |
|
34260 | var hexOne = function hexOne(value) {
|
34261 | value = Math.min(Math.round(value), 255);
|
34262 | var high = Math.floor(value / 16);
|
34263 | var low = value % 16;
|
34264 | return '' + (INT_HEX_MAP[high] || high) + (INT_HEX_MAP[low] || low);
|
34265 | };
|
34266 |
|
34267 | if (isNaN(r) || isNaN(g) || isNaN(b)) return '';
|
34268 |
|
34269 | return '#' + hexOne(r) + hexOne(g) + hexOne(b);
|
34270 | };
|
34271 |
|
34272 | var HEX_INT_MAP = { A: 10, B: 11, C: 12, D: 13, E: 14, F: 15 };
|
34273 |
|
34274 | var parseHexChannel = function parseHexChannel(hex) {
|
34275 | if (hex.length === 2) {
|
34276 | return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
|
34277 | }
|
34278 |
|
34279 | return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
|
34280 | };
|
34281 |
|
34282 | var hsl2hsv = function hsl2hsv(hue, sat, light) {
|
34283 | sat = sat / 100;
|
34284 | light = light / 100;
|
34285 | var smin = sat;
|
34286 | var lmin = Math.max(light, 0.01);
|
34287 | var sv = void 0;
|
34288 | var v = void 0;
|
34289 |
|
34290 | light *= 2;
|
34291 | sat *= light <= 1 ? light : 2 - light;
|
34292 | smin *= lmin <= 1 ? lmin : 2 - lmin;
|
34293 | v = (light + sat) / 2;
|
34294 | sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
|
34295 |
|
34296 | return {
|
34297 | h: hue,
|
34298 | s: sv * 100,
|
34299 | v: v * 100
|
34300 | };
|
34301 | };
|
34302 |
|
34303 |
|
34304 |
|
34305 |
|
34306 |
|
34307 | var rgb2hsv = function rgb2hsv(r, g, b) {
|
34308 | r = bound01(r, 255);
|
34309 | g = bound01(g, 255);
|
34310 | b = bound01(b, 255);
|
34311 |
|
34312 | var max = Math.max(r, g, b);
|
34313 | var min = Math.min(r, g, b);
|
34314 | var h = void 0,
|
34315 | s = void 0;
|
34316 | var v = max;
|
34317 |
|
34318 | var d = max - min;
|
34319 | s = max === 0 ? 0 : d / max;
|
34320 |
|
34321 | if (max === min) {
|
34322 | h = 0;
|
34323 | } else {
|
34324 | switch (max) {
|
34325 | case r:
|
34326 | h = (g - b) / d + (g < b ? 6 : 0);
|
34327 | break;
|
34328 | case g:
|
34329 | h = (b - r) / d + 2;
|
34330 | break;
|
34331 | case b:
|
34332 | h = (r - g) / d + 4;
|
34333 | break;
|
34334 | }
|
34335 | h /= 6;
|
34336 | }
|
34337 |
|
34338 | return { h: h * 360, s: s * 100, v: v * 100 };
|
34339 | };
|
34340 |
|
34341 |
|
34342 |
|
34343 |
|
34344 |
|
34345 | var hsv2rgb = function hsv2rgb(h, s, v) {
|
34346 | h = bound01(h, 360) * 6;
|
34347 | s = bound01(s, 100);
|
34348 | v = bound01(v, 100);
|
34349 |
|
34350 | var i = Math.floor(h);
|
34351 | var f = h - i;
|
34352 | var p = v * (1 - s);
|
34353 | var q = v * (1 - f * s);
|
34354 | var t = v * (1 - (1 - f) * s);
|
34355 | var mod = i % 6;
|
34356 | var r = [v, q, p, p, t, v][mod];
|
34357 | var g = [t, v, v, q, p, p][mod];
|
34358 | var b = [p, p, t, v, v, q][mod];
|
34359 |
|
34360 | return {
|
34361 | r: Math.round(r * 255),
|
34362 | g: Math.round(g * 255),
|
34363 | b: Math.round(b * 255)
|
34364 | };
|
34365 | };
|
34366 |
|
34367 | var Color = function () {
|
34368 | function Color(options) {
|
34369 | color_classCallCheck(this, Color);
|
34370 |
|
34371 | this._hue = 0;
|
34372 | this._saturation = 100;
|
34373 | this._value = 100;
|
34374 | this._alpha = 100;
|
34375 |
|
34376 | this.enableAlpha = false;
|
34377 | this.format = 'hex';
|
34378 | this.value = '';
|
34379 |
|
34380 | options = options || {};
|
34381 |
|
34382 | for (var option in options) {
|
34383 | if (options.hasOwnProperty(option)) {
|
34384 | this[option] = options[option];
|
34385 | }
|
34386 | }
|
34387 |
|
34388 | this.doOnChange();
|
34389 | }
|
34390 |
|
34391 | Color.prototype.set = function set(prop, value) {
|
34392 | if (arguments.length === 1 && (typeof prop === 'undefined' ? 'undefined' : color_typeof(prop)) === 'object') {
|
34393 | for (var p in prop) {
|
34394 | if (prop.hasOwnProperty(p)) {
|
34395 | this.set(p, prop[p]);
|
34396 | }
|
34397 | }
|
34398 |
|
34399 | return;
|
34400 | }
|
34401 |
|
34402 | this['_' + prop] = value;
|
34403 | this.doOnChange();
|
34404 | };
|
34405 |
|
34406 | Color.prototype.get = function get(prop) {
|
34407 | return this['_' + prop];
|
34408 | };
|
34409 |
|
34410 | Color.prototype.toRgb = function toRgb() {
|
34411 | return hsv2rgb(this._hue, this._saturation, this._value);
|
34412 | };
|
34413 |
|
34414 | Color.prototype.fromString = function fromString(value) {
|
34415 | var _this = this;
|
34416 |
|
34417 | if (!value) {
|
34418 | this._hue = 0;
|
34419 | this._saturation = 100;
|
34420 | this._value = 100;
|
34421 |
|
34422 | this.doOnChange();
|
34423 | return;
|
34424 | }
|
34425 |
|
34426 | var fromHSV = function fromHSV(h, s, v) {
|
34427 | _this._hue = Math.max(0, Math.min(360, h));
|
34428 | _this._saturation = Math.max(0, Math.min(100, s));
|
34429 | _this._value = Math.max(0, Math.min(100, v));
|
34430 |
|
34431 | _this.doOnChange();
|
34432 | };
|
34433 |
|
34434 | if (value.indexOf('hsl') !== -1) {
|
34435 | var parts = value.replace(/hsla|hsl|\(|\)/gm, '').split(/\s|,/g).filter(function (val) {
|
34436 | return val !== '';
|
34437 | }).map(function (val, index) {
|
34438 | return index > 2 ? parseFloat(val) : parseInt(val, 10);
|
34439 | });
|
34440 |
|
34441 | if (parts.length === 4) {
|
34442 | this._alpha = Math.floor(parseFloat(parts[3]) * 100);
|
34443 | } else if (parts.length === 3) {
|
34444 | this._alpha = 100;
|
34445 | }
|
34446 | if (parts.length >= 3) {
|
34447 | var _hsl2hsv = hsl2hsv(parts[0], parts[1], parts[2]),
|
34448 | h = _hsl2hsv.h,
|
34449 | s = _hsl2hsv.s,
|
34450 | v = _hsl2hsv.v;
|
34451 |
|
34452 | fromHSV(h, s, v);
|
34453 | }
|
34454 | } else if (value.indexOf('hsv') !== -1) {
|
34455 | var _parts = value.replace(/hsva|hsv|\(|\)/gm, '').split(/\s|,/g).filter(function (val) {
|
34456 | return val !== '';
|
34457 | }).map(function (val, index) {
|
34458 | return index > 2 ? parseFloat(val) : parseInt(val, 10);
|
34459 | });
|
34460 |
|
34461 | if (_parts.length === 4) {
|
34462 | this._alpha = Math.floor(parseFloat(_parts[3]) * 100);
|
34463 | } else if (_parts.length === 3) {
|
34464 | this._alpha = 100;
|
34465 | }
|
34466 | if (_parts.length >= 3) {
|
34467 | fromHSV(_parts[0], _parts[1], _parts[2]);
|
34468 | }
|
34469 | } else if (value.indexOf('rgb') !== -1) {
|
34470 | var _parts2 = value.replace(/rgba|rgb|\(|\)/gm, '').split(/\s|,/g).filter(function (val) {
|
34471 | return val !== '';
|
34472 | }).map(function (val, index) {
|
34473 | return index > 2 ? parseFloat(val) : parseInt(val, 10);
|
34474 | });
|
34475 |
|
34476 | if (_parts2.length === 4) {
|
34477 | this._alpha = Math.floor(parseFloat(_parts2[3]) * 100);
|
34478 | } else if (_parts2.length === 3) {
|
34479 | this._alpha = 100;
|
34480 | }
|
34481 | if (_parts2.length >= 3) {
|
34482 | var _rgb2hsv = rgb2hsv(_parts2[0], _parts2[1], _parts2[2]),
|
34483 | _h = _rgb2hsv.h,
|
34484 | _s = _rgb2hsv.s,
|
34485 | _v = _rgb2hsv.v;
|
34486 |
|
34487 | fromHSV(_h, _s, _v);
|
34488 | }
|
34489 | } else if (value.indexOf('#') !== -1) {
|
34490 | var hex = value.replace('#', '').trim();
|
34491 | if (!/^(?:[0-9a-fA-F]{3}){1,2}$/.test(hex)) return;
|
34492 | var r = void 0,
|
34493 | g = void 0,
|
34494 | b = void 0;
|
34495 |
|
34496 | if (hex.length === 3) {
|
34497 | r = parseHexChannel(hex[0] + hex[0]);
|
34498 | g = parseHexChannel(hex[1] + hex[1]);
|
34499 | b = parseHexChannel(hex[2] + hex[2]);
|
34500 | } else if (hex.length === 6 || hex.length === 8) {
|
34501 | r = parseHexChannel(hex.substring(0, 2));
|
34502 | g = parseHexChannel(hex.substring(2, 4));
|
34503 | b = parseHexChannel(hex.substring(4, 6));
|
34504 | }
|
34505 |
|
34506 | if (hex.length === 8) {
|
34507 | this._alpha = Math.floor(parseHexChannel(hex.substring(6)) / 255 * 100);
|
34508 | } else if (hex.length === 3 || hex.length === 6) {
|
34509 | this._alpha = 100;
|
34510 | }
|
34511 |
|
34512 | var _rgb2hsv2 = rgb2hsv(r, g, b),
|
34513 | _h2 = _rgb2hsv2.h,
|
34514 | _s2 = _rgb2hsv2.s,
|
34515 | _v2 = _rgb2hsv2.v;
|
34516 |
|
34517 | fromHSV(_h2, _s2, _v2);
|
34518 | }
|
34519 | };
|
34520 |
|
34521 | Color.prototype.compare = function compare(color) {
|
34522 | return Math.abs(color._hue - this._hue) < 2 && Math.abs(color._saturation - this._saturation) < 1 && Math.abs(color._value - this._value) < 1 && Math.abs(color._alpha - this._alpha) < 1;
|
34523 | };
|
34524 |
|
34525 | Color.prototype.doOnChange = function doOnChange() {
|
34526 | var _hue = this._hue,
|
34527 | _saturation = this._saturation,
|
34528 | _value = this._value,
|
34529 | _alpha = this._alpha,
|
34530 | format = this.format;
|
34531 |
|
34532 |
|
34533 | if (this.enableAlpha) {
|
34534 | switch (format) {
|
34535 | case 'hsl':
|
34536 | var hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
|
34537 | this.value = 'hsla(' + _hue + ', ' + Math.round(hsl[1] * 100) + '%, ' + Math.round(hsl[2] * 100) + '%, ' + _alpha / 100 + ')';
|
34538 | break;
|
34539 | case 'hsv':
|
34540 | this.value = 'hsva(' + _hue + ', ' + Math.round(_saturation) + '%, ' + Math.round(_value) + '%, ' + _alpha / 100 + ')';
|
34541 | break;
|
34542 | default:
|
34543 | var _hsv2rgb = hsv2rgb(_hue, _saturation, _value),
|
34544 | r = _hsv2rgb.r,
|
34545 | g = _hsv2rgb.g,
|
34546 | b = _hsv2rgb.b;
|
34547 |
|
34548 | this.value = 'rgba(' + r + ', ' + g + ', ' + b + ', ' + _alpha / 100 + ')';
|
34549 | }
|
34550 | } else {
|
34551 | switch (format) {
|
34552 | case 'hsl':
|
34553 | var _hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
|
34554 | this.value = 'hsl(' + _hue + ', ' + Math.round(_hsl[1] * 100) + '%, ' + Math.round(_hsl[2] * 100) + '%)';
|
34555 | break;
|
34556 | case 'hsv':
|
34557 | this.value = 'hsv(' + _hue + ', ' + Math.round(_saturation) + '%, ' + Math.round(_value) + '%)';
|
34558 | break;
|
34559 | case 'rgb':
|
34560 | var _hsv2rgb2 = hsv2rgb(_hue, _saturation, _value),
|
34561 | _r = _hsv2rgb2.r,
|
34562 | _g = _hsv2rgb2.g,
|
34563 | _b = _hsv2rgb2.b;
|
34564 |
|
34565 | this.value = 'rgb(' + _r + ', ' + _g + ', ' + _b + ')';
|
34566 | break;
|
34567 | default:
|
34568 | this.value = toHex(hsv2rgb(_hue, _saturation, _value));
|
34569 | }
|
34570 | }
|
34571 | };
|
34572 |
|
34573 | return Color;
|
34574 | }();
|
34575 |
|
34576 | var src_color = (Color);
|
34577 | ;
|
34578 |
|
34579 | var picker_dropdownvue_type_template_id_06601625_render = function() {
|
34580 | var _vm = this
|
34581 | var _h = _vm.$createElement
|
34582 | var _c = _vm._self._c || _h
|
34583 | return _c(
|
34584 | "transition",
|
34585 | { attrs: { name: "el-zoom-in-top" }, on: { "after-leave": _vm.doDestroy } },
|
34586 | [
|
34587 | _c(
|
34588 | "div",
|
34589 | {
|
34590 | directives: [
|
34591 | {
|
34592 | name: "show",
|
34593 | rawName: "v-show",
|
34594 | value: _vm.showPopper,
|
34595 | expression: "showPopper"
|
34596 | }
|
34597 | ],
|
34598 | staticClass: "el-color-dropdown"
|
34599 | },
|
34600 | [
|
34601 | _c(
|
34602 | "div",
|
34603 | { staticClass: "el-color-dropdown__main-wrapper" },
|
34604 | [
|
34605 | _c("hue-slider", {
|
34606 | ref: "hue",
|
34607 | staticStyle: { float: "right" },
|
34608 | attrs: { color: _vm.color, vertical: "" }
|
34609 | }),
|
34610 | _c("sv-panel", { ref: "sl", attrs: { color: _vm.color } })
|
34611 | ],
|
34612 | 1
|
34613 | ),
|
34614 | _vm.showAlpha
|
34615 | ? _c("alpha-slider", { ref: "alpha", attrs: { color: _vm.color } })
|
34616 | : _vm._e(),
|
34617 | _vm.predefine
|
34618 | ? _c("predefine", {
|
34619 | attrs: { color: _vm.color, colors: _vm.predefine }
|
34620 | })
|
34621 | : _vm._e(),
|
34622 | _c(
|
34623 | "div",
|
34624 | { staticClass: "el-color-dropdown__btns" },
|
34625 | [
|
34626 | _c(
|
34627 | "span",
|
34628 | { staticClass: "el-color-dropdown__value" },
|
34629 | [
|
34630 | _c("el-input", {
|
34631 | attrs: { "validate-event": false, size: "mini" },
|
34632 | on: { blur: _vm.handleConfirm },
|
34633 | nativeOn: {
|
34634 | keyup: function($event) {
|
34635 | if (
|
34636 | !("button" in $event) &&
|
34637 | _vm._k(
|
34638 | $event.keyCode,
|
34639 | "enter",
|
34640 | 13,
|
34641 | $event.key,
|
34642 | "Enter"
|
34643 | )
|
34644 | ) {
|
34645 | return null
|
34646 | }
|
34647 | return _vm.handleConfirm($event)
|
34648 | }
|
34649 | },
|
34650 | model: {
|
34651 | value: _vm.customInput,
|
34652 | callback: function($$v) {
|
34653 | _vm.customInput = $$v
|
34654 | },
|
34655 | expression: "customInput"
|
34656 | }
|
34657 | })
|
34658 | ],
|
34659 | 1
|
34660 | ),
|
34661 | _c(
|
34662 | "el-button",
|
34663 | {
|
34664 | staticClass: "el-color-dropdown__link-btn",
|
34665 | attrs: { size: "mini", type: "text" },
|
34666 | on: {
|
34667 | click: function($event) {
|
34668 | _vm.$emit("clear")
|
34669 | }
|
34670 | }
|
34671 | },
|
34672 | [
|
34673 | _vm._v(
|
34674 | "\n " +
|
34675 | _vm._s(_vm.t("el.colorpicker.clear")) +
|
34676 | "\n "
|
34677 | )
|
34678 | ]
|
34679 | ),
|
34680 | _c(
|
34681 | "el-button",
|
34682 | {
|
34683 | staticClass: "el-color-dropdown__btn",
|
34684 | attrs: { plain: "", size: "mini" },
|
34685 | on: { click: _vm.confirmValue }
|
34686 | },
|
34687 | [
|
34688 | _vm._v(
|
34689 | "\n " +
|
34690 | _vm._s(_vm.t("el.colorpicker.confirm")) +
|
34691 | "\n "
|
34692 | )
|
34693 | ]
|
34694 | )
|
34695 | ],
|
34696 | 1
|
34697 | )
|
34698 | ],
|
34699 | 1
|
34700 | )
|
34701 | ]
|
34702 | )
|
34703 | }
|
34704 | var picker_dropdownvue_type_template_id_06601625_staticRenderFns = []
|
34705 | picker_dropdownvue_type_template_id_06601625_render._withStripped = true
|
34706 |
|
34707 |
|
34708 |
|
34709 |
|
34710 |
|
34711 | var sv_panelvue_type_template_id_d8583596_render = function() {
|
34712 | var _vm = this
|
34713 | var _h = _vm.$createElement
|
34714 | var _c = _vm._self._c || _h
|
34715 | return _c(
|
34716 | "div",
|
34717 | {
|
34718 | staticClass: "el-color-svpanel",
|
34719 | style: {
|
34720 | backgroundColor: _vm.background
|
34721 | }
|
34722 | },
|
34723 | [
|
34724 | _c("div", { staticClass: "el-color-svpanel__white" }),
|
34725 | _c("div", { staticClass: "el-color-svpanel__black" }),
|
34726 | _c(
|
34727 | "div",
|
34728 | {
|
34729 | staticClass: "el-color-svpanel__cursor",
|
34730 | style: {
|
34731 | top: _vm.cursorTop + "px",
|
34732 | left: _vm.cursorLeft + "px"
|
34733 | }
|
34734 | },
|
34735 | [_c("div")]
|
34736 | )
|
34737 | ]
|
34738 | )
|
34739 | }
|
34740 | var sv_panelvue_type_template_id_d8583596_staticRenderFns = []
|
34741 | sv_panelvue_type_template_id_d8583596_render._withStripped = true
|
34742 |
|
34743 |
|
34744 |
|
34745 |
|
34746 |
|
34747 |
|
34748 | var isDragging = false;
|
34749 |
|
34750 | var draggable = (function (element, options) {
|
34751 | if (external_vue_default.a.prototype.$isServer) return;
|
34752 | var moveFn = function moveFn(event) {
|
34753 | if (options.drag) {
|
34754 | options.drag(event);
|
34755 | }
|
34756 | };
|
34757 | var upFn = function upFn(event) {
|
34758 | document.removeEventListener('mousemove', moveFn);
|
34759 | document.removeEventListener('mouseup', upFn);
|
34760 | document.onselectstart = null;
|
34761 | document.ondragstart = null;
|
34762 |
|
34763 | isDragging = false;
|
34764 |
|
34765 | if (options.end) {
|
34766 | options.end(event);
|
34767 | }
|
34768 | };
|
34769 | element.addEventListener('mousedown', function (event) {
|
34770 | if (isDragging) return;
|
34771 | document.onselectstart = function () {
|
34772 | return false;
|
34773 | };
|
34774 | document.ondragstart = function () {
|
34775 | return false;
|
34776 | };
|
34777 |
|
34778 | document.addEventListener('mousemove', moveFn);
|
34779 | document.addEventListener('mouseup', upFn);
|
34780 | isDragging = true;
|
34781 |
|
34782 | if (options.start) {
|
34783 | options.start(event);
|
34784 | }
|
34785 | });
|
34786 | });
|
34787 |
|
34788 |
|
34789 |
|
34790 |
|
34791 |
|
34792 |
|
34793 |
|
34794 |
|
34795 |
|
34796 |
|
34797 |
|
34798 |
|
34799 |
|
34800 |
|
34801 |
|
34802 |
|
34803 |
|
34804 |
|
34805 |
|
34806 |
|
34807 |
|
34808 | var sv_panelvue_type_script_lang_js_ = ({
|
34809 | name: 'el-sl-panel',
|
34810 |
|
34811 | props: {
|
34812 | color: {
|
34813 | required: true
|
34814 | }
|
34815 | },
|
34816 |
|
34817 | computed: {
|
34818 | colorValue: function colorValue() {
|
34819 | var hue = this.color.get('hue');
|
34820 | var value = this.color.get('value');
|
34821 | return { hue: hue, value: value };
|
34822 | }
|
34823 | },
|
34824 |
|
34825 | watch: {
|
34826 | colorValue: function colorValue() {
|
34827 | this.update();
|
34828 | }
|
34829 | },
|
34830 |
|
34831 | methods: {
|
34832 | update: function update() {
|
34833 | var saturation = this.color.get('saturation');
|
34834 | var value = this.color.get('value');
|
34835 |
|
34836 | var el = this.$el;
|
34837 | var width = el.clientWidth,
|
34838 | height = el.clientHeight;
|
34839 |
|
34840 |
|
34841 | this.cursorLeft = saturation * width / 100;
|
34842 | this.cursorTop = (100 - value) * height / 100;
|
34843 |
|
34844 | this.background = 'hsl(' + this.color.get('hue') + ', 100%, 50%)';
|
34845 | },
|
34846 | handleDrag: function handleDrag(event) {
|
34847 | var el = this.$el;
|
34848 | var rect = el.getBoundingClientRect();
|
34849 |
|
34850 | var left = event.clientX - rect.left;
|
34851 | var top = event.clientY - rect.top;
|
34852 | left = Math.max(0, left);
|
34853 | left = Math.min(left, rect.width);
|
34854 |
|
34855 | top = Math.max(0, top);
|
34856 | top = Math.min(top, rect.height);
|
34857 |
|
34858 | this.cursorLeft = left;
|
34859 | this.cursorTop = top;
|
34860 | this.color.set({
|
34861 | saturation: left / rect.width * 100,
|
34862 | value: 100 - top / rect.height * 100
|
34863 | });
|
34864 | }
|
34865 | },
|
34866 |
|
34867 | mounted: function mounted() {
|
34868 | var _this = this;
|
34869 |
|
34870 | draggable(this.$el, {
|
34871 | drag: function drag(event) {
|
34872 | _this.handleDrag(event);
|
34873 | },
|
34874 | end: function end(event) {
|
34875 | _this.handleDrag(event);
|
34876 | }
|
34877 | });
|
34878 |
|
34879 | this.update();
|
34880 | },
|
34881 | data: function data() {
|
34882 | return {
|
34883 | cursorTop: 0,
|
34884 | cursorLeft: 0,
|
34885 | background: 'hsl(0, 100%, 50%)'
|
34886 | };
|
34887 | }
|
34888 | });
|
34889 |
|
34890 | var components_sv_panelvue_type_script_lang_js_ = (sv_panelvue_type_script_lang_js_);
|
34891 |
|
34892 |
|
34893 |
|
34894 |
|
34895 |
|
34896 |
|
34897 |
|
34898 |
|
34899 | var sv_panel_component = normalizeComponent(
|
34900 | components_sv_panelvue_type_script_lang_js_,
|
34901 | sv_panelvue_type_template_id_d8583596_render,
|
34902 | sv_panelvue_type_template_id_d8583596_staticRenderFns,
|
34903 | false,
|
34904 | null,
|
34905 | null,
|
34906 | null
|
34907 |
|
34908 | )
|
34909 |
|
34910 |
|
34911 | if (false) { var sv_panel_api; }
|
34912 | sv_panel_component.options.__file = "packages/color-picker/src/components/sv-panel.vue"
|
34913 | var sv_panel = (sv_panel_component.exports);
|
34914 |
|
34915 | var hue_slidervue_type_template_id_5cdc43b1_render = function() {
|
34916 | var _vm = this
|
34917 | var _h = _vm.$createElement
|
34918 | var _c = _vm._self._c || _h
|
34919 | return _c(
|
34920 | "div",
|
34921 | {
|
34922 | staticClass: "el-color-hue-slider",
|
34923 | class: { "is-vertical": _vm.vertical }
|
34924 | },
|
34925 | [
|
34926 | _c("div", {
|
34927 | ref: "bar",
|
34928 | staticClass: "el-color-hue-slider__bar",
|
34929 | on: { click: _vm.handleClick }
|
34930 | }),
|
34931 | _c("div", {
|
34932 | ref: "thumb",
|
34933 | staticClass: "el-color-hue-slider__thumb",
|
34934 | style: {
|
34935 | left: _vm.thumbLeft + "px",
|
34936 | top: _vm.thumbTop + "px"
|
34937 | }
|
34938 | })
|
34939 | ]
|
34940 | )
|
34941 | }
|
34942 | var hue_slidervue_type_template_id_5cdc43b1_staticRenderFns = []
|
34943 | hue_slidervue_type_template_id_5cdc43b1_render._withStripped = true
|
34944 |
|
34945 |
|
34946 |
|
34947 |
|
34948 |
|
34949 |
|
34950 |
|
34951 |
|
34952 |
|
34953 |
|
34954 |
|
34955 |
|
34956 |
|
34957 |
|
34958 |
|
34959 |
|
34960 |
|
34961 |
|
34962 |
|
34963 |
|
34964 |
|
34965 | var hue_slidervue_type_script_lang_js_ = ({
|
34966 | name: 'el-color-hue-slider',
|
34967 |
|
34968 | props: {
|
34969 | color: {
|
34970 | required: true
|
34971 | },
|
34972 |
|
34973 | vertical: Boolean
|
34974 | },
|
34975 |
|
34976 | data: function data() {
|
34977 | return {
|
34978 | thumbLeft: 0,
|
34979 | thumbTop: 0
|
34980 | };
|
34981 | },
|
34982 |
|
34983 |
|
34984 | computed: {
|
34985 | hueValue: function hueValue() {
|
34986 | var hue = this.color.get('hue');
|
34987 | return hue;
|
34988 | }
|
34989 | },
|
34990 |
|
34991 | watch: {
|
34992 | hueValue: function hueValue() {
|
34993 | this.update();
|
34994 | }
|
34995 | },
|
34996 |
|
34997 | methods: {
|
34998 | handleClick: function handleClick(event) {
|
34999 | var thumb = this.$refs.thumb;
|
35000 | var target = event.target;
|
35001 |
|
35002 | if (target !== thumb) {
|
35003 | this.handleDrag(event);
|
35004 | }
|
35005 | },
|
35006 | handleDrag: function handleDrag(event) {
|
35007 | var rect = this.$el.getBoundingClientRect();
|
35008 | var thumb = this.$refs.thumb;
|
35009 |
|
35010 | var hue = void 0;
|
35011 |
|
35012 | if (!this.vertical) {
|
35013 | var left = event.clientX - rect.left;
|
35014 | left = Math.min(left, rect.width - thumb.offsetWidth / 2);
|
35015 | left = Math.max(thumb.offsetWidth / 2, left);
|
35016 |
|
35017 | hue = Math.round((left - thumb.offsetWidth / 2) / (rect.width - thumb.offsetWidth) * 360);
|
35018 | } else {
|
35019 | var top = event.clientY - rect.top;
|
35020 | top = Math.min(top, rect.height - thumb.offsetHeight / 2);
|
35021 | top = Math.max(thumb.offsetHeight / 2, top);
|
35022 |
|
35023 | hue = Math.round((top - thumb.offsetHeight / 2) / (rect.height - thumb.offsetHeight) * 360);
|
35024 | }
|
35025 |
|
35026 | this.color.set('hue', hue);
|
35027 | },
|
35028 | getThumbLeft: function getThumbLeft() {
|
35029 | if (this.vertical) return 0;
|
35030 | var el = this.$el;
|
35031 | var hue = this.color.get('hue');
|
35032 |
|
35033 | if (!el) return 0;
|
35034 | var thumb = this.$refs.thumb;
|
35035 | return Math.round(hue * (el.offsetWidth - thumb.offsetWidth / 2) / 360);
|
35036 | },
|
35037 | getThumbTop: function getThumbTop() {
|
35038 | if (!this.vertical) return 0;
|
35039 | var el = this.$el;
|
35040 | var hue = this.color.get('hue');
|
35041 |
|
35042 | if (!el) return 0;
|
35043 | var thumb = this.$refs.thumb;
|
35044 | return Math.round(hue * (el.offsetHeight - thumb.offsetHeight / 2) / 360);
|
35045 | },
|
35046 | update: function update() {
|
35047 | this.thumbLeft = this.getThumbLeft();
|
35048 | this.thumbTop = this.getThumbTop();
|
35049 | }
|
35050 | },
|
35051 |
|
35052 | mounted: function mounted() {
|
35053 | var _this = this;
|
35054 |
|
35055 | var _$refs = this.$refs,
|
35056 | bar = _$refs.bar,
|
35057 | thumb = _$refs.thumb;
|
35058 |
|
35059 |
|
35060 | var dragConfig = {
|
35061 | drag: function drag(event) {
|
35062 | _this.handleDrag(event);
|
35063 | },
|
35064 | end: function end(event) {
|
35065 | _this.handleDrag(event);
|
35066 | }
|
35067 | };
|
35068 |
|
35069 | draggable(bar, dragConfig);
|
35070 | draggable(thumb, dragConfig);
|
35071 | this.update();
|
35072 | }
|
35073 | });
|
35074 |
|
35075 | var components_hue_slidervue_type_script_lang_js_ = (hue_slidervue_type_script_lang_js_);
|
35076 |
|
35077 |
|
35078 |
|
35079 |
|
35080 |
|
35081 |
|
35082 |
|
35083 |
|
35084 | var hue_slider_component = normalizeComponent(
|
35085 | components_hue_slidervue_type_script_lang_js_,
|
35086 | hue_slidervue_type_template_id_5cdc43b1_render,
|
35087 | hue_slidervue_type_template_id_5cdc43b1_staticRenderFns,
|
35088 | false,
|
35089 | null,
|
35090 | null,
|
35091 | null
|
35092 |
|
35093 | )
|
35094 |
|
35095 |
|
35096 | if (false) { var hue_slider_api; }
|
35097 | hue_slider_component.options.__file = "packages/color-picker/src/components/hue-slider.vue"
|
35098 | var hue_slider = (hue_slider_component.exports);
|
35099 |
|
35100 | var alpha_slidervue_type_template_id_068c66cb_render = function() {
|
35101 | var _vm = this
|
35102 | var _h = _vm.$createElement
|
35103 | var _c = _vm._self._c || _h
|
35104 | return _c(
|
35105 | "div",
|
35106 | {
|
35107 | staticClass: "el-color-alpha-slider",
|
35108 | class: { "is-vertical": _vm.vertical }
|
35109 | },
|
35110 | [
|
35111 | _c("div", {
|
35112 | ref: "bar",
|
35113 | staticClass: "el-color-alpha-slider__bar",
|
35114 | style: {
|
35115 | background: _vm.background
|
35116 | },
|
35117 | on: { click: _vm.handleClick }
|
35118 | }),
|
35119 | _c("div", {
|
35120 | ref: "thumb",
|
35121 | staticClass: "el-color-alpha-slider__thumb",
|
35122 | style: {
|
35123 | left: _vm.thumbLeft + "px",
|
35124 | top: _vm.thumbTop + "px"
|
35125 | }
|
35126 | })
|
35127 | ]
|
35128 | )
|
35129 | }
|
35130 | var alpha_slidervue_type_template_id_068c66cb_staticRenderFns = []
|
35131 | alpha_slidervue_type_template_id_068c66cb_render._withStripped = true
|
35132 |
|
35133 |
|
35134 |
|
35135 |
|
35136 |
|
35137 |
|
35138 |
|
35139 |
|
35140 |
|
35141 |
|
35142 |
|
35143 |
|
35144 |
|
35145 |
|
35146 |
|
35147 |
|
35148 |
|
35149 |
|
35150 |
|
35151 |
|
35152 |
|
35153 |
|
35154 |
|
35155 |
|
35156 |
|
35157 |
|
35158 |
|
35159 | var alpha_slidervue_type_script_lang_js_ = ({
|
35160 | name: 'el-color-alpha-slider',
|
35161 |
|
35162 | props: {
|
35163 | color: {
|
35164 | required: true
|
35165 | },
|
35166 | vertical: Boolean
|
35167 | },
|
35168 |
|
35169 | watch: {
|
35170 | 'color._alpha': function color_alpha() {
|
35171 | this.update();
|
35172 | },
|
35173 | 'color.value': function colorValue() {
|
35174 | this.update();
|
35175 | }
|
35176 | },
|
35177 |
|
35178 | methods: {
|
35179 | handleClick: function handleClick(event) {
|
35180 | var thumb = this.$refs.thumb;
|
35181 | var target = event.target;
|
35182 |
|
35183 | if (target !== thumb) {
|
35184 | this.handleDrag(event);
|
35185 | }
|
35186 | },
|
35187 | handleDrag: function handleDrag(event) {
|
35188 | var rect = this.$el.getBoundingClientRect();
|
35189 | var thumb = this.$refs.thumb;
|
35190 |
|
35191 |
|
35192 | if (!this.vertical) {
|
35193 | var left = event.clientX - rect.left;
|
35194 | left = Math.max(thumb.offsetWidth / 2, left);
|
35195 | left = Math.min(left, rect.width - thumb.offsetWidth / 2);
|
35196 |
|
35197 | this.color.set('alpha', Math.round((left - thumb.offsetWidth / 2) / (rect.width - thumb.offsetWidth) * 100));
|
35198 | } else {
|
35199 | var top = event.clientY - rect.top;
|
35200 | top = Math.max(thumb.offsetHeight / 2, top);
|
35201 | top = Math.min(top, rect.height - thumb.offsetHeight / 2);
|
35202 |
|
35203 | this.color.set('alpha', Math.round((top - thumb.offsetHeight / 2) / (rect.height - thumb.offsetHeight) * 100));
|
35204 | }
|
35205 | },
|
35206 | getThumbLeft: function getThumbLeft() {
|
35207 | if (this.vertical) return 0;
|
35208 | var el = this.$el;
|
35209 | var alpha = this.color._alpha;
|
35210 |
|
35211 | if (!el) return 0;
|
35212 | var thumb = this.$refs.thumb;
|
35213 | return Math.round(alpha * (el.offsetWidth - thumb.offsetWidth / 2) / 100);
|
35214 | },
|
35215 | getThumbTop: function getThumbTop() {
|
35216 | if (!this.vertical) return 0;
|
35217 | var el = this.$el;
|
35218 | var alpha = this.color._alpha;
|
35219 |
|
35220 | if (!el) return 0;
|
35221 | var thumb = this.$refs.thumb;
|
35222 | return Math.round(alpha * (el.offsetHeight - thumb.offsetHeight / 2) / 100);
|
35223 | },
|
35224 | getBackground: function getBackground() {
|
35225 | if (this.color && this.color.value) {
|
35226 | var _color$toRgb = this.color.toRgb(),
|
35227 | r = _color$toRgb.r,
|
35228 | g = _color$toRgb.g,
|
35229 | b = _color$toRgb.b;
|
35230 |
|
35231 | return 'linear-gradient(to right, rgba(' + r + ', ' + g + ', ' + b + ', 0) 0%, rgba(' + r + ', ' + g + ', ' + b + ', 1) 100%)';
|
35232 | }
|
35233 | return null;
|
35234 | },
|
35235 | update: function update() {
|
35236 | this.thumbLeft = this.getThumbLeft();
|
35237 | this.thumbTop = this.getThumbTop();
|
35238 | this.background = this.getBackground();
|
35239 | }
|
35240 | },
|
35241 |
|
35242 | data: function data() {
|
35243 | return {
|
35244 | thumbLeft: 0,
|
35245 | thumbTop: 0,
|
35246 | background: null
|
35247 | };
|
35248 | },
|
35249 | mounted: function mounted() {
|
35250 | var _this = this;
|
35251 |
|
35252 | var _$refs = this.$refs,
|
35253 | bar = _$refs.bar,
|
35254 | thumb = _$refs.thumb;
|
35255 |
|
35256 |
|
35257 | var dragConfig = {
|
35258 | drag: function drag(event) {
|
35259 | _this.handleDrag(event);
|
35260 | },
|
35261 | end: function end(event) {
|
35262 | _this.handleDrag(event);
|
35263 | }
|
35264 | };
|
35265 |
|
35266 | draggable(bar, dragConfig);
|
35267 | draggable(thumb, dragConfig);
|
35268 | this.update();
|
35269 | }
|
35270 | });
|
35271 |
|
35272 | var components_alpha_slidervue_type_script_lang_js_ = (alpha_slidervue_type_script_lang_js_);
|
35273 |
|
35274 |
|
35275 |
|
35276 |
|
35277 |
|
35278 |
|
35279 |
|
35280 |
|
35281 | var alpha_slider_component = normalizeComponent(
|
35282 | components_alpha_slidervue_type_script_lang_js_,
|
35283 | alpha_slidervue_type_template_id_068c66cb_render,
|
35284 | alpha_slidervue_type_template_id_068c66cb_staticRenderFns,
|
35285 | false,
|
35286 | null,
|
35287 | null,
|
35288 | null
|
35289 |
|
35290 | )
|
35291 |
|
35292 |
|
35293 | if (false) { var alpha_slider_api; }
|
35294 | alpha_slider_component.options.__file = "packages/color-picker/src/components/alpha-slider.vue"
|
35295 | var alpha_slider = (alpha_slider_component.exports);
|
35296 |
|
35297 | var predefinevue_type_template_id_06e03093_render = function() {
|
35298 | var _vm = this
|
35299 | var _h = _vm.$createElement
|
35300 | var _c = _vm._self._c || _h
|
35301 | return _c("div", { staticClass: "el-color-predefine" }, [
|
35302 | _c(
|
35303 | "div",
|
35304 | { staticClass: "el-color-predefine__colors" },
|
35305 | _vm._l(_vm.rgbaColors, function(item, index) {
|
35306 | return _c(
|
35307 | "div",
|
35308 | {
|
35309 | key: _vm.colors[index],
|
35310 | staticClass: "el-color-predefine__color-selector",
|
35311 | class: { selected: item.selected, "is-alpha": item._alpha < 100 },
|
35312 | on: {
|
35313 | click: function($event) {
|
35314 | _vm.handleSelect(index)
|
35315 | }
|
35316 | }
|
35317 | },
|
35318 | [_c("div", { style: { "background-color": item.value } })]
|
35319 | )
|
35320 | }),
|
35321 | 0
|
35322 | )
|
35323 | ])
|
35324 | }
|
35325 | var predefinevue_type_template_id_06e03093_staticRenderFns = []
|
35326 | predefinevue_type_template_id_06e03093_render._withStripped = true
|
35327 |
|
35328 |
|
35329 |
|
35330 |
|
35331 |
|
35332 |
|
35333 |
|
35334 |
|
35335 |
|
35336 |
|
35337 |
|
35338 |
|
35339 |
|
35340 |
|
35341 |
|
35342 |
|
35343 |
|
35344 |
|
35345 |
|
35346 |
|
35347 |
|
35348 |
|
35349 |
|
35350 | var predefinevue_type_script_lang_js_ = ({
|
35351 | props: {
|
35352 | colors: { type: Array, required: true },
|
35353 | color: { required: true }
|
35354 | },
|
35355 | data: function data() {
|
35356 | return {
|
35357 | rgbaColors: this.parseColors(this.colors, this.color)
|
35358 | };
|
35359 | },
|
35360 |
|
35361 | methods: {
|
35362 | handleSelect: function handleSelect(index) {
|
35363 | this.color.fromString(this.colors[index]);
|
35364 | },
|
35365 | parseColors: function parseColors(colors, color) {
|
35366 | return colors.map(function (value) {
|
35367 | var c = new src_color();
|
35368 | c.enableAlpha = true;
|
35369 | c.format = 'rgba';
|
35370 | c.fromString(value);
|
35371 | c.selected = c.value === color.value;
|
35372 | return c;
|
35373 | });
|
35374 | }
|
35375 | },
|
35376 | watch: {
|
35377 | '$parent.currentColor': function $parentCurrentColor(val) {
|
35378 | var color = new src_color();
|
35379 | color.fromString(val);
|
35380 |
|
35381 | this.rgbaColors.forEach(function (item) {
|
35382 | item.selected = color.compare(item);
|
35383 | });
|
35384 | },
|
35385 | colors: function colors(newVal) {
|
35386 | this.rgbaColors = this.parseColors(newVal, this.color);
|
35387 | },
|
35388 | color: function color(newVal) {
|
35389 | this.rgbaColors = this.parseColors(this.colors, newVal);
|
35390 | }
|
35391 | }
|
35392 | });
|
35393 |
|
35394 | var components_predefinevue_type_script_lang_js_ = (predefinevue_type_script_lang_js_);
|
35395 |
|
35396 |
|
35397 |
|
35398 |
|
35399 |
|
35400 |
|
35401 |
|
35402 |
|
35403 | var predefine_component = normalizeComponent(
|
35404 | components_predefinevue_type_script_lang_js_,
|
35405 | predefinevue_type_template_id_06e03093_render,
|
35406 | predefinevue_type_template_id_06e03093_staticRenderFns,
|
35407 | false,
|
35408 | null,
|
35409 | null,
|
35410 | null
|
35411 |
|
35412 | )
|
35413 |
|
35414 |
|
35415 | if (false) { var predefine_api; }
|
35416 | predefine_component.options.__file = "packages/color-picker/src/components/predefine.vue"
|
35417 | var predefine = (predefine_component.exports);
|
35418 |
|
35419 |
|
35420 |
|
35421 |
|
35422 |
|
35423 |
|
35424 |
|
35425 |
|
35426 |
|
35427 |
|
35428 |
|
35429 |
|
35430 |
|
35431 |
|
35432 |
|
35433 |
|
35434 |
|
35435 |
|
35436 |
|
35437 |
|
35438 |
|
35439 |
|
35440 |
|
35441 |
|
35442 |
|
35443 |
|
35444 |
|
35445 |
|
35446 |
|
35447 |
|
35448 |
|
35449 |
|
35450 |
|
35451 |
|
35452 |
|
35453 |
|
35454 |
|
35455 |
|
35456 |
|
35457 |
|
35458 |
|
35459 |
|
35460 |
|
35461 |
|
35462 |
|
35463 |
|
35464 |
|
35465 |
|
35466 |
|
35467 |
|
35468 |
|
35469 | var picker_dropdownvue_type_script_lang_js_ = ({
|
35470 | name: 'el-color-picker-dropdown',
|
35471 |
|
35472 | mixins: [vue_popper_default.a, locale_default.a],
|
35473 |
|
35474 | components: {
|
35475 | SvPanel: sv_panel,
|
35476 | HueSlider: hue_slider,
|
35477 | AlphaSlider: alpha_slider,
|
35478 | ElInput: input_default.a,
|
35479 | ElButton: button_default.a,
|
35480 | Predefine: predefine
|
35481 | },
|
35482 |
|
35483 | props: {
|
35484 | color: {
|
35485 | required: true
|
35486 | },
|
35487 | showAlpha: Boolean,
|
35488 | predefine: Array
|
35489 | },
|
35490 |
|
35491 | data: function data() {
|
35492 | return {
|
35493 | customInput: ''
|
35494 | };
|
35495 | },
|
35496 |
|
35497 |
|
35498 | computed: {
|
35499 | currentColor: function currentColor() {
|
35500 | var parent = this.$parent;
|
35501 | return !parent.value && !parent.showPanelColor ? '' : parent.color.value;
|
35502 | }
|
35503 | },
|
35504 |
|
35505 | methods: {
|
35506 | confirmValue: function confirmValue() {
|
35507 | this.$emit('pick');
|
35508 | },
|
35509 | handleConfirm: function handleConfirm() {
|
35510 | this.color.fromString(this.customInput);
|
35511 | }
|
35512 | },
|
35513 |
|
35514 | mounted: function mounted() {
|
35515 | this.$parent.popperElm = this.popperElm = this.$el;
|
35516 | this.referenceElm = this.$parent.$el;
|
35517 | },
|
35518 |
|
35519 |
|
35520 | watch: {
|
35521 | showPopper: function showPopper(val) {
|
35522 | var _this = this;
|
35523 |
|
35524 | if (val === true) {
|
35525 | this.$nextTick(function () {
|
35526 | var _$refs = _this.$refs,
|
35527 | sl = _$refs.sl,
|
35528 | hue = _$refs.hue,
|
35529 | alpha = _$refs.alpha;
|
35530 |
|
35531 | sl && sl.update();
|
35532 | hue && hue.update();
|
35533 | alpha && alpha.update();
|
35534 | });
|
35535 | }
|
35536 | },
|
35537 |
|
35538 |
|
35539 | currentColor: {
|
35540 | immediate: true,
|
35541 | handler: function handler(val) {
|
35542 | this.customInput = val;
|
35543 | }
|
35544 | }
|
35545 | }
|
35546 | });
|
35547 |
|
35548 | var components_picker_dropdownvue_type_script_lang_js_ = (picker_dropdownvue_type_script_lang_js_);
|
35549 |
|
35550 |
|
35551 |
|
35552 |
|
35553 |
|
35554 |
|
35555 |
|
35556 |
|
35557 | var picker_dropdown_component = normalizeComponent(
|
35558 | components_picker_dropdownvue_type_script_lang_js_,
|
35559 | picker_dropdownvue_type_template_id_06601625_render,
|
35560 | picker_dropdownvue_type_template_id_06601625_staticRenderFns,
|
35561 | false,
|
35562 | null,
|
35563 | null,
|
35564 | null
|
35565 |
|
35566 | )
|
35567 |
|
35568 |
|
35569 | if (false) { var picker_dropdown_api; }
|
35570 | picker_dropdown_component.options.__file = "packages/color-picker/src/components/picker-dropdown.vue"
|
35571 | var picker_dropdown = (picker_dropdown_component.exports);
|
35572 |
|
35573 |
|
35574 |
|
35575 |
|
35576 |
|
35577 |
|
35578 |
|
35579 |
|
35580 |
|
35581 |
|
35582 |
|
35583 |
|
35584 |
|
35585 |
|
35586 |
|
35587 |
|
35588 |
|
35589 |
|
35590 |
|
35591 |
|
35592 |
|
35593 |
|
35594 |
|
35595 |
|
35596 |
|
35597 |
|
35598 |
|
35599 |
|
35600 |
|
35601 |
|
35602 |
|
35603 |
|
35604 |
|
35605 |
|
35606 |
|
35607 |
|
35608 |
|
35609 |
|
35610 |
|
35611 | var color_picker_src_mainvue_type_script_lang_js_ = ({
|
35612 | name: 'ElColorPicker',
|
35613 |
|
35614 | mixins: [emitter_default.a],
|
35615 |
|
35616 | props: {
|
35617 | value: String,
|
35618 | showAlpha: Boolean,
|
35619 | colorFormat: String,
|
35620 | disabled: Boolean,
|
35621 | size: String,
|
35622 | popperClass: String,
|
35623 | predefine: Array
|
35624 | },
|
35625 |
|
35626 | inject: {
|
35627 | elForm: {
|
35628 | default: ''
|
35629 | },
|
35630 | elFormItem: {
|
35631 | default: ''
|
35632 | }
|
35633 | },
|
35634 |
|
35635 | directives: { Clickoutside: clickoutside_default.a },
|
35636 |
|
35637 | computed: {
|
35638 | displayedColor: function displayedColor() {
|
35639 | if (!this.value && !this.showPanelColor) {
|
35640 | return 'transparent';
|
35641 | }
|
35642 |
|
35643 | return this.displayedRgb(this.color, this.showAlpha);
|
35644 | },
|
35645 | _elFormItemSize: function _elFormItemSize() {
|
35646 | return (this.elFormItem || {}).elFormItemSize;
|
35647 | },
|
35648 | colorSize: function colorSize() {
|
35649 | return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
35650 | },
|
35651 | colorDisabled: function colorDisabled() {
|
35652 | return this.disabled || (this.elForm || {}).disabled;
|
35653 | }
|
35654 | },
|
35655 |
|
35656 | watch: {
|
35657 | value: function value(val) {
|
35658 | if (!val) {
|
35659 | this.showPanelColor = false;
|
35660 | } else if (val && val !== this.color.value) {
|
35661 | this.color.fromString(val);
|
35662 | }
|
35663 | },
|
35664 |
|
35665 | color: {
|
35666 | deep: true,
|
35667 | handler: function handler() {
|
35668 | this.showPanelColor = true;
|
35669 | }
|
35670 | },
|
35671 | displayedColor: function displayedColor(val) {
|
35672 | if (!this.showPicker) return;
|
35673 | var currentValueColor = new src_color({
|
35674 | enableAlpha: this.showAlpha,
|
35675 | format: this.colorFormat
|
35676 | });
|
35677 | currentValueColor.fromString(this.value);
|
35678 |
|
35679 | var currentValueColorRgb = this.displayedRgb(currentValueColor, this.showAlpha);
|
35680 | if (val !== currentValueColorRgb) {
|
35681 | this.$emit('active-change', val);
|
35682 | }
|
35683 | }
|
35684 | },
|
35685 |
|
35686 | methods: {
|
35687 | handleTrigger: function handleTrigger() {
|
35688 | if (this.colorDisabled) return;
|
35689 | this.showPicker = !this.showPicker;
|
35690 | },
|
35691 | confirmValue: function confirmValue() {
|
35692 | var value = this.color.value;
|
35693 | this.$emit('input', value);
|
35694 | this.$emit('change', value);
|
35695 | this.dispatch('ElFormItem', 'el.form.change', value);
|
35696 | this.showPicker = false;
|
35697 | },
|
35698 | clearValue: function clearValue() {
|
35699 | this.$emit('input', null);
|
35700 | this.$emit('change', null);
|
35701 | if (this.value !== null) {
|
35702 | this.dispatch('ElFormItem', 'el.form.change', null);
|
35703 | }
|
35704 | this.showPanelColor = false;
|
35705 | this.showPicker = false;
|
35706 | this.resetColor();
|
35707 | },
|
35708 | hide: function hide() {
|
35709 | this.showPicker = false;
|
35710 | this.resetColor();
|
35711 | },
|
35712 | resetColor: function resetColor() {
|
35713 | var _this = this;
|
35714 |
|
35715 | this.$nextTick(function (_) {
|
35716 | if (_this.value) {
|
35717 | _this.color.fromString(_this.value);
|
35718 | } else {
|
35719 | _this.showPanelColor = false;
|
35720 | }
|
35721 | });
|
35722 | },
|
35723 | displayedRgb: function displayedRgb(color, showAlpha) {
|
35724 | if (!(color instanceof src_color)) {
|
35725 | throw Error('color should be instance of Color Class');
|
35726 | }
|
35727 |
|
35728 | var _color$toRgb = color.toRgb(),
|
35729 | r = _color$toRgb.r,
|
35730 | g = _color$toRgb.g,
|
35731 | b = _color$toRgb.b;
|
35732 |
|
35733 | return showAlpha ? 'rgba(' + r + ', ' + g + ', ' + b + ', ' + color.get('alpha') / 100 + ')' : 'rgb(' + r + ', ' + g + ', ' + b + ')';
|
35734 | }
|
35735 | },
|
35736 |
|
35737 | mounted: function mounted() {
|
35738 | var value = this.value;
|
35739 | if (value) {
|
35740 | this.color.fromString(value);
|
35741 | }
|
35742 | this.popperElm = this.$refs.dropdown.$el;
|
35743 | },
|
35744 | data: function data() {
|
35745 | var color = new src_color({
|
35746 | enableAlpha: this.showAlpha,
|
35747 | format: this.colorFormat
|
35748 | });
|
35749 |
|
35750 | return {
|
35751 | color: color,
|
35752 | showPicker: false,
|
35753 | showPanelColor: false
|
35754 | };
|
35755 | },
|
35756 |
|
35757 |
|
35758 | components: {
|
35759 | PickerDropdown: picker_dropdown
|
35760 | }
|
35761 | });
|
35762 |
|
35763 | var packages_color_picker_src_mainvue_type_script_lang_js_ = (color_picker_src_mainvue_type_script_lang_js_);
|
35764 |
|
35765 |
|
35766 |
|
35767 |
|
35768 |
|
35769 |
|
35770 |
|
35771 |
|
35772 | var color_picker_src_main_component = normalizeComponent(
|
35773 | packages_color_picker_src_mainvue_type_script_lang_js_,
|
35774 | mainvue_type_template_id_55c8ade7_render,
|
35775 | mainvue_type_template_id_55c8ade7_staticRenderFns,
|
35776 | false,
|
35777 | null,
|
35778 | null,
|
35779 | null
|
35780 |
|
35781 | )
|
35782 |
|
35783 |
|
35784 | if (false) { var color_picker_src_main_api; }
|
35785 | color_picker_src_main_component.options.__file = "packages/color-picker/src/main.vue"
|
35786 | var color_picker_src_main = (color_picker_src_main_component.exports);
|
35787 |
|
35788 |
|
35789 |
|
35790 |
|
35791 | color_picker_src_main.install = function (Vue) {
|
35792 | Vue.component(color_picker_src_main.name, color_picker_src_main);
|
35793 | };
|
35794 |
|
35795 | var color_picker = (color_picker_src_main);
|
35796 |
|
35797 | var mainvue_type_template_id_5c654dd8_render = function() {
|
35798 | var _vm = this
|
35799 | var _h = _vm.$createElement
|
35800 | var _c = _vm._self._c || _h
|
35801 | return _c(
|
35802 | "div",
|
35803 | { staticClass: "el-transfer" },
|
35804 | [
|
35805 | _c(
|
35806 | "transfer-panel",
|
35807 | _vm._b(
|
35808 | {
|
35809 | ref: "leftPanel",
|
35810 | attrs: {
|
35811 | data: _vm.sourceData,
|
35812 | title: _vm.titles[0] || _vm.t("el.transfer.titles.0"),
|
35813 | "default-checked": _vm.leftDefaultChecked,
|
35814 | placeholder:
|
35815 | _vm.filterPlaceholder || _vm.t("el.transfer.filterPlaceholder")
|
35816 | },
|
35817 | on: { "checked-change": _vm.onSourceCheckedChange }
|
35818 | },
|
35819 | "transfer-panel",
|
35820 | _vm.$props,
|
35821 | false
|
35822 | ),
|
35823 | [_vm._t("left-footer")],
|
35824 | 2
|
35825 | ),
|
35826 | _c(
|
35827 | "div",
|
35828 | { staticClass: "el-transfer__buttons" },
|
35829 | [
|
35830 | _c(
|
35831 | "el-button",
|
35832 | {
|
35833 | class: [
|
35834 | "el-transfer__button",
|
35835 | _vm.hasButtonTexts ? "is-with-texts" : ""
|
35836 | ],
|
35837 | attrs: {
|
35838 | type: "primary",
|
35839 | disabled: _vm.rightChecked.length === 0
|
35840 | },
|
35841 | nativeOn: {
|
35842 | click: function($event) {
|
35843 | return _vm.addToLeft($event)
|
35844 | }
|
35845 | }
|
35846 | },
|
35847 | [
|
35848 | _c("i", { staticClass: "el-icon-arrow-left" }),
|
35849 | _vm.buttonTexts[0] !== undefined
|
35850 | ? _c("span", [_vm._v(_vm._s(_vm.buttonTexts[0]))])
|
35851 | : _vm._e()
|
35852 | ]
|
35853 | ),
|
35854 | _c(
|
35855 | "el-button",
|
35856 | {
|
35857 | class: [
|
35858 | "el-transfer__button",
|
35859 | _vm.hasButtonTexts ? "is-with-texts" : ""
|
35860 | ],
|
35861 | attrs: {
|
35862 | type: "primary",
|
35863 | disabled: _vm.leftChecked.length === 0
|
35864 | },
|
35865 | nativeOn: {
|
35866 | click: function($event) {
|
35867 | return _vm.addToRight($event)
|
35868 | }
|
35869 | }
|
35870 | },
|
35871 | [
|
35872 | _vm.buttonTexts[1] !== undefined
|
35873 | ? _c("span", [_vm._v(_vm._s(_vm.buttonTexts[1]))])
|
35874 | : _vm._e(),
|
35875 | _c("i", { staticClass: "el-icon-arrow-right" })
|
35876 | ]
|
35877 | )
|
35878 | ],
|
35879 | 1
|
35880 | ),
|
35881 | _c(
|
35882 | "transfer-panel",
|
35883 | _vm._b(
|
35884 | {
|
35885 | ref: "rightPanel",
|
35886 | attrs: {
|
35887 | data: _vm.targetData,
|
35888 | title: _vm.titles[1] || _vm.t("el.transfer.titles.1"),
|
35889 | "default-checked": _vm.rightDefaultChecked,
|
35890 | placeholder:
|
35891 | _vm.filterPlaceholder || _vm.t("el.transfer.filterPlaceholder")
|
35892 | },
|
35893 | on: { "checked-change": _vm.onTargetCheckedChange }
|
35894 | },
|
35895 | "transfer-panel",
|
35896 | _vm.$props,
|
35897 | false
|
35898 | ),
|
35899 | [_vm._t("right-footer")],
|
35900 | 2
|
35901 | )
|
35902 | ],
|
35903 | 1
|
35904 | )
|
35905 | }
|
35906 | var mainvue_type_template_id_5c654dd8_staticRenderFns = []
|
35907 | mainvue_type_template_id_5c654dd8_render._withStripped = true
|
35908 |
|
35909 |
|
35910 |
|
35911 |
|
35912 |
|
35913 | var transfer_panelvue_type_template_id_2ddab8bd_render = function() {
|
35914 | var _vm = this
|
35915 | var _h = _vm.$createElement
|
35916 | var _c = _vm._self._c || _h
|
35917 | return _c("div", { staticClass: "el-transfer-panel" }, [
|
35918 | _c(
|
35919 | "p",
|
35920 | { staticClass: "el-transfer-panel__header" },
|
35921 | [
|
35922 | _c(
|
35923 | "el-checkbox",
|
35924 | {
|
35925 | attrs: { indeterminate: _vm.isIndeterminate },
|
35926 | on: { change: _vm.handleAllCheckedChange },
|
35927 | model: {
|
35928 | value: _vm.allChecked,
|
35929 | callback: function($$v) {
|
35930 | _vm.allChecked = $$v
|
35931 | },
|
35932 | expression: "allChecked"
|
35933 | }
|
35934 | },
|
35935 | [
|
35936 | _vm._v("\n " + _vm._s(_vm.title) + "\n "),
|
35937 | _c("span", [_vm._v(_vm._s(_vm.checkedSummary))])
|
35938 | ]
|
35939 | )
|
35940 | ],
|
35941 | 1
|
35942 | ),
|
35943 | _c(
|
35944 | "div",
|
35945 | {
|
35946 | class: [
|
35947 | "el-transfer-panel__body",
|
35948 | _vm.hasFooter ? "is-with-footer" : ""
|
35949 | ]
|
35950 | },
|
35951 | [
|
35952 | _vm.filterable
|
35953 | ? _c(
|
35954 | "el-input",
|
35955 | {
|
35956 | staticClass: "el-transfer-panel__filter",
|
35957 | attrs: { size: "small", placeholder: _vm.placeholder },
|
35958 | nativeOn: {
|
35959 | mouseenter: function($event) {
|
35960 | _vm.inputHover = true
|
35961 | },
|
35962 | mouseleave: function($event) {
|
35963 | _vm.inputHover = false
|
35964 | }
|
35965 | },
|
35966 | model: {
|
35967 | value: _vm.query,
|
35968 | callback: function($$v) {
|
35969 | _vm.query = $$v
|
35970 | },
|
35971 | expression: "query"
|
35972 | }
|
35973 | },
|
35974 | [
|
35975 | _c("i", {
|
35976 | class: ["el-input__icon", "el-icon-" + _vm.inputIcon],
|
35977 | attrs: { slot: "prefix" },
|
35978 | on: { click: _vm.clearQuery },
|
35979 | slot: "prefix"
|
35980 | })
|
35981 | ]
|
35982 | )
|
35983 | : _vm._e(),
|
35984 | _c(
|
35985 | "el-checkbox-group",
|
35986 | {
|
35987 | directives: [
|
35988 | {
|
35989 | name: "show",
|
35990 | rawName: "v-show",
|
35991 | value: !_vm.hasNoMatch && _vm.data.length > 0,
|
35992 | expression: "!hasNoMatch && data.length > 0"
|
35993 | }
|
35994 | ],
|
35995 | staticClass: "el-transfer-panel__list",
|
35996 | class: { "is-filterable": _vm.filterable },
|
35997 | model: {
|
35998 | value: _vm.checked,
|
35999 | callback: function($$v) {
|
36000 | _vm.checked = $$v
|
36001 | },
|
36002 | expression: "checked"
|
36003 | }
|
36004 | },
|
36005 | _vm._l(_vm.filteredData, function(item) {
|
36006 | return _c(
|
36007 | "el-checkbox",
|
36008 | {
|
36009 | key: item[_vm.keyProp],
|
36010 | staticClass: "el-transfer-panel__item",
|
36011 | attrs: {
|
36012 | label: item[_vm.keyProp],
|
36013 | disabled: item[_vm.disabledProp]
|
36014 | }
|
36015 | },
|
36016 | [_c("option-content", { attrs: { option: item } })],
|
36017 | 1
|
36018 | )
|
36019 | }),
|
36020 | 1
|
36021 | ),
|
36022 | _c(
|
36023 | "p",
|
36024 | {
|
36025 | directives: [
|
36026 | {
|
36027 | name: "show",
|
36028 | rawName: "v-show",
|
36029 | value: _vm.hasNoMatch,
|
36030 | expression: "hasNoMatch"
|
36031 | }
|
36032 | ],
|
36033 | staticClass: "el-transfer-panel__empty"
|
36034 | },
|
36035 | [_vm._v(_vm._s(_vm.t("el.transfer.noMatch")))]
|
36036 | ),
|
36037 | _c(
|
36038 | "p",
|
36039 | {
|
36040 | directives: [
|
36041 | {
|
36042 | name: "show",
|
36043 | rawName: "v-show",
|
36044 | value: _vm.data.length === 0 && !_vm.hasNoMatch,
|
36045 | expression: "data.length === 0 && !hasNoMatch"
|
36046 | }
|
36047 | ],
|
36048 | staticClass: "el-transfer-panel__empty"
|
36049 | },
|
36050 | [_vm._v(_vm._s(_vm.t("el.transfer.noData")))]
|
36051 | )
|
36052 | ],
|
36053 | 1
|
36054 | ),
|
36055 | _vm.hasFooter
|
36056 | ? _c(
|
36057 | "p",
|
36058 | { staticClass: "el-transfer-panel__footer" },
|
36059 | [_vm._t("default")],
|
36060 | 2
|
36061 | )
|
36062 | : _vm._e()
|
36063 | ])
|
36064 | }
|
36065 | var transfer_panelvue_type_template_id_2ddab8bd_staticRenderFns = []
|
36066 | transfer_panelvue_type_template_id_2ddab8bd_render._withStripped = true
|
36067 |
|
36068 |
|
36069 |
|
36070 |
|
36071 |
|
36072 |
|
36073 |
|
36074 |
|
36075 |
|
36076 |
|
36077 |
|
36078 |
|
36079 |
|
36080 |
|
36081 |
|
36082 |
|
36083 |
|
36084 |
|
36085 |
|
36086 |
|
36087 |
|
36088 |
|
36089 |
|
36090 |
|
36091 |
|
36092 |
|
36093 |
|
36094 |
|
36095 |
|
36096 |
|
36097 |
|
36098 |
|
36099 |
|
36100 |
|
36101 |
|
36102 |
|
36103 |
|
36104 |
|
36105 |
|
36106 |
|
36107 |
|
36108 |
|
36109 |
|
36110 |
|
36111 |
|
36112 |
|
36113 |
|
36114 |
|
36115 |
|
36116 |
|
36117 |
|
36118 |
|
36119 |
|
36120 |
|
36121 |
|
36122 |
|
36123 |
|
36124 |
|
36125 |
|
36126 |
|
36127 |
|
36128 |
|
36129 |
|
36130 |
|
36131 | var transfer_panelvue_type_script_lang_js_ = ({
|
36132 | mixins: [locale_default.a],
|
36133 |
|
36134 | name: 'ElTransferPanel',
|
36135 |
|
36136 | componentName: 'ElTransferPanel',
|
36137 |
|
36138 | components: {
|
36139 | ElCheckboxGroup: checkbox_group_default.a,
|
36140 | ElCheckbox: checkbox_default.a,
|
36141 | ElInput: input_default.a,
|
36142 | OptionContent: {
|
36143 | props: {
|
36144 | option: Object
|
36145 | },
|
36146 | render: function render(h) {
|
36147 | var getParent = function getParent(vm) {
|
36148 | if (vm.$options.componentName === 'ElTransferPanel') {
|
36149 | return vm;
|
36150 | } else if (vm.$parent) {
|
36151 | return getParent(vm.$parent);
|
36152 | } else {
|
36153 | return vm;
|
36154 | }
|
36155 | };
|
36156 | var panel = getParent(this);
|
36157 | var transfer = panel.$parent || panel;
|
36158 | return panel.renderContent ? panel.renderContent(h, this.option) : transfer.$scopedSlots.default ? transfer.$scopedSlots.default({ option: this.option }) : h('span', [this.option[panel.labelProp] || this.option[panel.keyProp]]);
|
36159 | }
|
36160 | }
|
36161 | },
|
36162 |
|
36163 | props: {
|
36164 | data: {
|
36165 | type: Array,
|
36166 | default: function _default() {
|
36167 | return [];
|
36168 | }
|
36169 | },
|
36170 | renderContent: Function,
|
36171 | placeholder: String,
|
36172 | title: String,
|
36173 | filterable: Boolean,
|
36174 | format: Object,
|
36175 | filterMethod: Function,
|
36176 | defaultChecked: Array,
|
36177 | props: Object
|
36178 | },
|
36179 |
|
36180 | data: function data() {
|
36181 | return {
|
36182 | checked: [],
|
36183 | allChecked: false,
|
36184 | query: '',
|
36185 | inputHover: false,
|
36186 | checkChangeByUser: true
|
36187 | };
|
36188 | },
|
36189 |
|
36190 |
|
36191 | watch: {
|
36192 | checked: function checked(val, oldVal) {
|
36193 | this.updateAllChecked();
|
36194 | if (this.checkChangeByUser) {
|
36195 | var movedKeys = val.concat(oldVal).filter(function (v) {
|
36196 | return val.indexOf(v) === -1 || oldVal.indexOf(v) === -1;
|
36197 | });
|
36198 | this.$emit('checked-change', val, movedKeys);
|
36199 | } else {
|
36200 | this.$emit('checked-change', val);
|
36201 | this.checkChangeByUser = true;
|
36202 | }
|
36203 | },
|
36204 | data: function data() {
|
36205 | var _this = this;
|
36206 |
|
36207 | var checked = [];
|
36208 | var filteredDataKeys = this.filteredData.map(function (item) {
|
36209 | return item[_this.keyProp];
|
36210 | });
|
36211 | this.checked.forEach(function (item) {
|
36212 | if (filteredDataKeys.indexOf(item) > -1) {
|
36213 | checked.push(item);
|
36214 | }
|
36215 | });
|
36216 | this.checkChangeByUser = false;
|
36217 | this.checked = checked;
|
36218 | },
|
36219 | checkableData: function checkableData() {
|
36220 | this.updateAllChecked();
|
36221 | },
|
36222 |
|
36223 |
|
36224 | defaultChecked: {
|
36225 | immediate: true,
|
36226 | handler: function handler(val, oldVal) {
|
36227 | var _this2 = this;
|
36228 |
|
36229 | if (oldVal && val.length === oldVal.length && val.every(function (item) {
|
36230 | return oldVal.indexOf(item) > -1;
|
36231 | })) return;
|
36232 | var checked = [];
|
36233 | var checkableDataKeys = this.checkableData.map(function (item) {
|
36234 | return item[_this2.keyProp];
|
36235 | });
|
36236 | val.forEach(function (item) {
|
36237 | if (checkableDataKeys.indexOf(item) > -1) {
|
36238 | checked.push(item);
|
36239 | }
|
36240 | });
|
36241 | this.checkChangeByUser = false;
|
36242 | this.checked = checked;
|
36243 | }
|
36244 | }
|
36245 | },
|
36246 |
|
36247 | computed: {
|
36248 | filteredData: function filteredData() {
|
36249 | var _this3 = this;
|
36250 |
|
36251 | return this.data.filter(function (item) {
|
36252 | if (typeof _this3.filterMethod === 'function') {
|
36253 | return _this3.filterMethod(_this3.query, item);
|
36254 | } else {
|
36255 | var label = item[_this3.labelProp] || item[_this3.keyProp].toString();
|
36256 | return label.toLowerCase().indexOf(_this3.query.toLowerCase()) > -1;
|
36257 | }
|
36258 | });
|
36259 | },
|
36260 | checkableData: function checkableData() {
|
36261 | var _this4 = this;
|
36262 |
|
36263 | return this.filteredData.filter(function (item) {
|
36264 | return !item[_this4.disabledProp];
|
36265 | });
|
36266 | },
|
36267 | checkedSummary: function checkedSummary() {
|
36268 | var checkedLength = this.checked.length;
|
36269 | var dataLength = this.data.length;
|
36270 | var _format = this.format,
|
36271 | noChecked = _format.noChecked,
|
36272 | hasChecked = _format.hasChecked;
|
36273 |
|
36274 | if (noChecked && hasChecked) {
|
36275 | return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength).replace(/\${total}/g, dataLength) : noChecked.replace(/\${total}/g, dataLength);
|
36276 | } else {
|
36277 | return checkedLength + '/' + dataLength;
|
36278 | }
|
36279 | },
|
36280 | isIndeterminate: function isIndeterminate() {
|
36281 | var checkedLength = this.checked.length;
|
36282 | return checkedLength > 0 && checkedLength < this.checkableData.length;
|
36283 | },
|
36284 | hasNoMatch: function hasNoMatch() {
|
36285 | return this.query.length > 0 && this.filteredData.length === 0;
|
36286 | },
|
36287 | inputIcon: function inputIcon() {
|
36288 | return this.query.length > 0 && this.inputHover ? 'circle-close' : 'search';
|
36289 | },
|
36290 | labelProp: function labelProp() {
|
36291 | return this.props.label || 'label';
|
36292 | },
|
36293 | keyProp: function keyProp() {
|
36294 | return this.props.key || 'key';
|
36295 | },
|
36296 | disabledProp: function disabledProp() {
|
36297 | return this.props.disabled || 'disabled';
|
36298 | },
|
36299 | hasFooter: function hasFooter() {
|
36300 | return !!this.$slots.default;
|
36301 | }
|
36302 | },
|
36303 |
|
36304 | methods: {
|
36305 | updateAllChecked: function updateAllChecked() {
|
36306 | var _this5 = this;
|
36307 |
|
36308 | var checkableDataKeys = this.checkableData.map(function (item) {
|
36309 | return item[_this5.keyProp];
|
36310 | });
|
36311 | this.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every(function (item) {
|
36312 | return _this5.checked.indexOf(item) > -1;
|
36313 | });
|
36314 | },
|
36315 | handleAllCheckedChange: function handleAllCheckedChange(value) {
|
36316 | var _this6 = this;
|
36317 |
|
36318 | this.checked = value ? this.checkableData.map(function (item) {
|
36319 | return item[_this6.keyProp];
|
36320 | }) : [];
|
36321 | },
|
36322 | clearQuery: function clearQuery() {
|
36323 | if (this.inputIcon === 'circle-close') {
|
36324 | this.query = '';
|
36325 | }
|
36326 | }
|
36327 | }
|
36328 | });
|
36329 |
|
36330 | var src_transfer_panelvue_type_script_lang_js_ = (transfer_panelvue_type_script_lang_js_);
|
36331 |
|
36332 |
|
36333 |
|
36334 |
|
36335 |
|
36336 |
|
36337 |
|
36338 |
|
36339 | var transfer_panel_component = normalizeComponent(
|
36340 | src_transfer_panelvue_type_script_lang_js_,
|
36341 | transfer_panelvue_type_template_id_2ddab8bd_render,
|
36342 | transfer_panelvue_type_template_id_2ddab8bd_staticRenderFns,
|
36343 | false,
|
36344 | null,
|
36345 | null,
|
36346 | null
|
36347 |
|
36348 | )
|
36349 |
|
36350 |
|
36351 | if (false) { var transfer_panel_api; }
|
36352 | transfer_panel_component.options.__file = "packages/transfer/src/transfer-panel.vue"
|
36353 | var transfer_panel = (transfer_panel_component.exports);
|
36354 |
|
36355 |
|
36356 |
|
36357 |
|
36358 |
|
36359 |
|
36360 |
|
36361 |
|
36362 |
|
36363 |
|
36364 |
|
36365 |
|
36366 |
|
36367 |
|
36368 |
|
36369 |
|
36370 |
|
36371 |
|
36372 |
|
36373 |
|
36374 |
|
36375 |
|
36376 |
|
36377 |
|
36378 |
|
36379 |
|
36380 |
|
36381 |
|
36382 |
|
36383 |
|
36384 |
|
36385 |
|
36386 |
|
36387 |
|
36388 |
|
36389 |
|
36390 |
|
36391 |
|
36392 |
|
36393 |
|
36394 |
|
36395 |
|
36396 |
|
36397 |
|
36398 |
|
36399 |
|
36400 |
|
36401 |
|
36402 |
|
36403 |
|
36404 |
|
36405 | var transfer_src_mainvue_type_script_lang_js_ = ({
|
36406 | name: 'ElTransfer',
|
36407 |
|
36408 | mixins: [emitter_default.a, locale_default.a, migrating_default.a],
|
36409 |
|
36410 | components: {
|
36411 | TransferPanel: transfer_panel,
|
36412 | ElButton: button_default.a
|
36413 | },
|
36414 |
|
36415 | props: {
|
36416 | data: {
|
36417 | type: Array,
|
36418 | default: function _default() {
|
36419 | return [];
|
36420 | }
|
36421 | },
|
36422 | titles: {
|
36423 | type: Array,
|
36424 | default: function _default() {
|
36425 | return [];
|
36426 | }
|
36427 | },
|
36428 | buttonTexts: {
|
36429 | type: Array,
|
36430 | default: function _default() {
|
36431 | return [];
|
36432 | }
|
36433 | },
|
36434 | filterPlaceholder: {
|
36435 | type: String,
|
36436 | default: ''
|
36437 | },
|
36438 | filterMethod: Function,
|
36439 | leftDefaultChecked: {
|
36440 | type: Array,
|
36441 | default: function _default() {
|
36442 | return [];
|
36443 | }
|
36444 | },
|
36445 | rightDefaultChecked: {
|
36446 | type: Array,
|
36447 | default: function _default() {
|
36448 | return [];
|
36449 | }
|
36450 | },
|
36451 | renderContent: Function,
|
36452 | value: {
|
36453 | type: Array,
|
36454 | default: function _default() {
|
36455 | return [];
|
36456 | }
|
36457 | },
|
36458 | format: {
|
36459 | type: Object,
|
36460 | default: function _default() {
|
36461 | return {};
|
36462 | }
|
36463 | },
|
36464 | filterable: Boolean,
|
36465 | props: {
|
36466 | type: Object,
|
36467 | default: function _default() {
|
36468 | return {
|
36469 | label: 'label',
|
36470 | key: 'key',
|
36471 | disabled: 'disabled'
|
36472 | };
|
36473 | }
|
36474 | },
|
36475 | targetOrder: {
|
36476 | type: String,
|
36477 | default: 'original'
|
36478 | }
|
36479 | },
|
36480 |
|
36481 | data: function data() {
|
36482 | return {
|
36483 | leftChecked: [],
|
36484 | rightChecked: []
|
36485 | };
|
36486 | },
|
36487 |
|
36488 |
|
36489 | computed: {
|
36490 | dataObj: function dataObj() {
|
36491 | var key = this.props.key;
|
36492 | return this.data.reduce(function (o, cur) {
|
36493 | return (o[cur[key]] = cur) && o;
|
36494 | }, {});
|
36495 | },
|
36496 | sourceData: function sourceData() {
|
36497 | var _this = this;
|
36498 |
|
36499 | return this.data.filter(function (item) {
|
36500 | return _this.value.indexOf(item[_this.props.key]) === -1;
|
36501 | });
|
36502 | },
|
36503 | targetData: function targetData() {
|
36504 | var _this2 = this;
|
36505 |
|
36506 | if (this.targetOrder === 'original') {
|
36507 | return this.data.filter(function (item) {
|
36508 | return _this2.value.indexOf(item[_this2.props.key]) > -1;
|
36509 | });
|
36510 | } else {
|
36511 | return this.value.reduce(function (arr, cur) {
|
36512 | var val = _this2.dataObj[cur];
|
36513 | if (val) {
|
36514 | arr.push(val);
|
36515 | }
|
36516 | return arr;
|
36517 | }, []);
|
36518 | }
|
36519 | },
|
36520 | hasButtonTexts: function hasButtonTexts() {
|
36521 | return this.buttonTexts.length === 2;
|
36522 | }
|
36523 | },
|
36524 |
|
36525 | watch: {
|
36526 | value: function value(val) {
|
36527 | this.dispatch('ElFormItem', 'el.form.change', val);
|
36528 | }
|
36529 | },
|
36530 |
|
36531 | methods: {
|
36532 | getMigratingConfig: function getMigratingConfig() {
|
36533 | return {
|
36534 | props: {
|
36535 | 'footer-format': 'footer-format is renamed to format.'
|
36536 | }
|
36537 | };
|
36538 | },
|
36539 | onSourceCheckedChange: function onSourceCheckedChange(val, movedKeys) {
|
36540 | this.leftChecked = val;
|
36541 | if (movedKeys === undefined) return;
|
36542 | this.$emit('left-check-change', val, movedKeys);
|
36543 | },
|
36544 | onTargetCheckedChange: function onTargetCheckedChange(val, movedKeys) {
|
36545 | this.rightChecked = val;
|
36546 | if (movedKeys === undefined) return;
|
36547 | this.$emit('right-check-change', val, movedKeys);
|
36548 | },
|
36549 | addToLeft: function addToLeft() {
|
36550 | var currentValue = this.value.slice();
|
36551 | this.rightChecked.forEach(function (item) {
|
36552 | var index = currentValue.indexOf(item);
|
36553 | if (index > -1) {
|
36554 | currentValue.splice(index, 1);
|
36555 | }
|
36556 | });
|
36557 | this.$emit('input', currentValue);
|
36558 | this.$emit('change', currentValue, 'left', this.rightChecked);
|
36559 | },
|
36560 | addToRight: function addToRight() {
|
36561 | var _this3 = this;
|
36562 |
|
36563 | var currentValue = this.value.slice();
|
36564 | var itemsToBeMoved = [];
|
36565 | var key = this.props.key;
|
36566 | this.data.forEach(function (item) {
|
36567 | var itemKey = item[key];
|
36568 | if (_this3.leftChecked.indexOf(itemKey) > -1 && _this3.value.indexOf(itemKey) === -1) {
|
36569 | itemsToBeMoved.push(itemKey);
|
36570 | }
|
36571 | });
|
36572 | currentValue = this.targetOrder === 'unshift' ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
|
36573 | this.$emit('input', currentValue);
|
36574 | this.$emit('change', currentValue, 'right', this.leftChecked);
|
36575 | },
|
36576 | clearQuery: function clearQuery(which) {
|
36577 | if (which === 'left') {
|
36578 | this.$refs.leftPanel.query = '';
|
36579 | } else if (which === 'right') {
|
36580 | this.$refs.rightPanel.query = '';
|
36581 | }
|
36582 | }
|
36583 | }
|
36584 | });
|
36585 |
|
36586 | var packages_transfer_src_mainvue_type_script_lang_js_ = (transfer_src_mainvue_type_script_lang_js_);
|
36587 |
|
36588 |
|
36589 |
|
36590 |
|
36591 |
|
36592 |
|
36593 |
|
36594 |
|
36595 | var transfer_src_main_component = normalizeComponent(
|
36596 | packages_transfer_src_mainvue_type_script_lang_js_,
|
36597 | mainvue_type_template_id_5c654dd8_render,
|
36598 | mainvue_type_template_id_5c654dd8_staticRenderFns,
|
36599 | false,
|
36600 | null,
|
36601 | null,
|
36602 | null
|
36603 |
|
36604 | )
|
36605 |
|
36606 |
|
36607 | if (false) { var transfer_src_main_api; }
|
36608 | transfer_src_main_component.options.__file = "packages/transfer/src/main.vue"
|
36609 | var transfer_src_main = (transfer_src_main_component.exports);
|
36610 |
|
36611 |
|
36612 |
|
36613 |
|
36614 | transfer_src_main.install = function (Vue) {
|
36615 | Vue.component(transfer_src_main.name, transfer_src_main);
|
36616 | };
|
36617 |
|
36618 | var transfer = (transfer_src_main);
|
36619 |
|
36620 | var mainvue_type_template_id_5bf181d4_render = function() {
|
36621 | var _vm = this
|
36622 | var _h = _vm.$createElement
|
36623 | var _c = _vm._self._c || _h
|
36624 | return _c(
|
36625 | "section",
|
36626 | { staticClass: "el-container", class: { "is-vertical": _vm.isVertical } },
|
36627 | [_vm._t("default")],
|
36628 | 2
|
36629 | )
|
36630 | }
|
36631 | var mainvue_type_template_id_5bf181d4_staticRenderFns = []
|
36632 | mainvue_type_template_id_5bf181d4_render._withStripped = true
|
36633 |
|
36634 |
|
36635 |
|
36636 |
|
36637 |
|
36638 |
|
36639 |
|
36640 |
|
36641 |
|
36642 |
|
36643 |
|
36644 |
|
36645 | var container_src_mainvue_type_script_lang_js_ = ({
|
36646 | name: 'ElContainer',
|
36647 |
|
36648 | componentName: 'ElContainer',
|
36649 |
|
36650 | props: {
|
36651 | direction: String
|
36652 | },
|
36653 |
|
36654 | computed: {
|
36655 | isVertical: function isVertical() {
|
36656 | if (this.direction === 'vertical') {
|
36657 | return true;
|
36658 | } else if (this.direction === 'horizontal') {
|
36659 | return false;
|
36660 | }
|
36661 | return this.$slots && this.$slots.default ? this.$slots.default.some(function (vnode) {
|
36662 | var tag = vnode.componentOptions && vnode.componentOptions.tag;
|
36663 | return tag === 'el-header' || tag === 'el-footer';
|
36664 | }) : false;
|
36665 | }
|
36666 | }
|
36667 | });
|
36668 |
|
36669 | var packages_container_src_mainvue_type_script_lang_js_ = (container_src_mainvue_type_script_lang_js_);
|
36670 |
|
36671 |
|
36672 |
|
36673 |
|
36674 |
|
36675 |
|
36676 |
|
36677 |
|
36678 | var container_src_main_component = normalizeComponent(
|
36679 | packages_container_src_mainvue_type_script_lang_js_,
|
36680 | mainvue_type_template_id_5bf181d4_render,
|
36681 | mainvue_type_template_id_5bf181d4_staticRenderFns,
|
36682 | false,
|
36683 | null,
|
36684 | null,
|
36685 | null
|
36686 |
|
36687 | )
|
36688 |
|
36689 |
|
36690 | if (false) { var container_src_main_api; }
|
36691 | container_src_main_component.options.__file = "packages/container/src/main.vue"
|
36692 | var container_src_main = (container_src_main_component.exports);
|
36693 |
|
36694 |
|
36695 |
|
36696 |
|
36697 | container_src_main.install = function (Vue) {
|
36698 | Vue.component(container_src_main.name, container_src_main);
|
36699 | };
|
36700 |
|
36701 | var packages_container = (container_src_main);
|
36702 |
|
36703 | var mainvue_type_template_id_2b296ab2_render = function() {
|
36704 | var _vm = this
|
36705 | var _h = _vm.$createElement
|
36706 | var _c = _vm._self._c || _h
|
36707 | return _c(
|
36708 | "header",
|
36709 | { staticClass: "el-header", style: { height: _vm.height } },
|
36710 | [_vm._t("default")],
|
36711 | 2
|
36712 | )
|
36713 | }
|
36714 | var mainvue_type_template_id_2b296ab2_staticRenderFns = []
|
36715 | mainvue_type_template_id_2b296ab2_render._withStripped = true
|
36716 |
|
36717 |
|
36718 |
|
36719 |
|
36720 |
|
36721 |
|
36722 |
|
36723 |
|
36724 |
|
36725 |
|
36726 |
|
36727 |
|
36728 | var header_src_mainvue_type_script_lang_js_ = ({
|
36729 | name: 'ElHeader',
|
36730 |
|
36731 | componentName: 'ElHeader',
|
36732 |
|
36733 | props: {
|
36734 | height: {
|
36735 | type: String,
|
36736 | default: '60px'
|
36737 | }
|
36738 | }
|
36739 | });
|
36740 |
|
36741 | var packages_header_src_mainvue_type_script_lang_js_ = (header_src_mainvue_type_script_lang_js_);
|
36742 |
|
36743 |
|
36744 |
|
36745 |
|
36746 |
|
36747 |
|
36748 |
|
36749 |
|
36750 | var header_src_main_component = normalizeComponent(
|
36751 | packages_header_src_mainvue_type_script_lang_js_,
|
36752 | mainvue_type_template_id_2b296ab2_render,
|
36753 | mainvue_type_template_id_2b296ab2_staticRenderFns,
|
36754 | false,
|
36755 | null,
|
36756 | null,
|
36757 | null
|
36758 |
|
36759 | )
|
36760 |
|
36761 |
|
36762 | if (false) { var header_src_main_api; }
|
36763 | header_src_main_component.options.__file = "packages/header/src/main.vue"
|
36764 | var header_src_main = (header_src_main_component.exports);
|
36765 |
|
36766 |
|
36767 |
|
36768 |
|
36769 | header_src_main.install = function (Vue) {
|
36770 | Vue.component(header_src_main.name, header_src_main);
|
36771 | };
|
36772 |
|
36773 | var header = (header_src_main);
|
36774 |
|
36775 | var mainvue_type_template_id_03411dbf_render = function() {
|
36776 | var _vm = this
|
36777 | var _h = _vm.$createElement
|
36778 | var _c = _vm._self._c || _h
|
36779 | return _c(
|
36780 | "aside",
|
36781 | { staticClass: "el-aside", style: { width: _vm.width } },
|
36782 | [_vm._t("default")],
|
36783 | 2
|
36784 | )
|
36785 | }
|
36786 | var mainvue_type_template_id_03411dbf_staticRenderFns = []
|
36787 | mainvue_type_template_id_03411dbf_render._withStripped = true
|
36788 |
|
36789 |
|
36790 |
|
36791 |
|
36792 |
|
36793 |
|
36794 |
|
36795 |
|
36796 |
|
36797 |
|
36798 |
|
36799 |
|
36800 | var aside_src_mainvue_type_script_lang_js_ = ({
|
36801 | name: 'ElAside',
|
36802 |
|
36803 | componentName: 'ElAside',
|
36804 |
|
36805 | props: {
|
36806 | width: {
|
36807 | type: String,
|
36808 | default: '300px'
|
36809 | }
|
36810 | }
|
36811 | });
|
36812 |
|
36813 | var packages_aside_src_mainvue_type_script_lang_js_ = (aside_src_mainvue_type_script_lang_js_);
|
36814 |
|
36815 |
|
36816 |
|
36817 |
|
36818 |
|
36819 |
|
36820 |
|
36821 |
|
36822 | var aside_src_main_component = normalizeComponent(
|
36823 | packages_aside_src_mainvue_type_script_lang_js_,
|
36824 | mainvue_type_template_id_03411dbf_render,
|
36825 | mainvue_type_template_id_03411dbf_staticRenderFns,
|
36826 | false,
|
36827 | null,
|
36828 | null,
|
36829 | null
|
36830 |
|
36831 | )
|
36832 |
|
36833 |
|
36834 | if (false) { var aside_src_main_api; }
|
36835 | aside_src_main_component.options.__file = "packages/aside/src/main.vue"
|
36836 | var aside_src_main = (aside_src_main_component.exports);
|
36837 |
|
36838 |
|
36839 |
|
36840 |
|
36841 | aside_src_main.install = function (Vue) {
|
36842 | Vue.component(aside_src_main.name, aside_src_main);
|
36843 | };
|
36844 |
|
36845 | var aside = (aside_src_main);
|
36846 |
|
36847 | var mainvue_type_template_id_2a3a7406_render = function() {
|
36848 | var _vm = this
|
36849 | var _h = _vm.$createElement
|
36850 | var _c = _vm._self._c || _h
|
36851 | return _c("main", { staticClass: "el-main" }, [_vm._t("default")], 2)
|
36852 | }
|
36853 | var mainvue_type_template_id_2a3a7406_staticRenderFns = []
|
36854 | mainvue_type_template_id_2a3a7406_render._withStripped = true
|
36855 |
|
36856 |
|
36857 |
|
36858 |
|
36859 |
|
36860 |
|
36861 |
|
36862 |
|
36863 |
|
36864 |
|
36865 |
|
36866 |
|
36867 | var main_src_mainvue_type_script_lang_js_ = ({
|
36868 | name: 'ElMain',
|
36869 | componentName: 'ElMain'
|
36870 | });
|
36871 |
|
36872 | var packages_main_src_mainvue_type_script_lang_js_ = (main_src_mainvue_type_script_lang_js_);
|
36873 |
|
36874 |
|
36875 |
|
36876 |
|
36877 |
|
36878 |
|
36879 |
|
36880 |
|
36881 | var main_src_main_component = normalizeComponent(
|
36882 | packages_main_src_mainvue_type_script_lang_js_,
|
36883 | mainvue_type_template_id_2a3a7406_render,
|
36884 | mainvue_type_template_id_2a3a7406_staticRenderFns,
|
36885 | false,
|
36886 | null,
|
36887 | null,
|
36888 | null
|
36889 |
|
36890 | )
|
36891 |
|
36892 |
|
36893 | if (false) { var main_src_main_api; }
|
36894 | main_src_main_component.options.__file = "packages/main/src/main.vue"
|
36895 | var main_src_main = (main_src_main_component.exports);
|
36896 |
|
36897 |
|
36898 |
|
36899 |
|
36900 | main_src_main.install = function (Vue) {
|
36901 | Vue.component(main_src_main.name, main_src_main);
|
36902 | };
|
36903 |
|
36904 | var packages_main = (main_src_main);
|
36905 |
|
36906 | var mainvue_type_template_id_80210338_render = function() {
|
36907 | var _vm = this
|
36908 | var _h = _vm.$createElement
|
36909 | var _c = _vm._self._c || _h
|
36910 | return _c(
|
36911 | "footer",
|
36912 | { staticClass: "el-footer", style: { height: _vm.height } },
|
36913 | [_vm._t("default")],
|
36914 | 2
|
36915 | )
|
36916 | }
|
36917 | var mainvue_type_template_id_80210338_staticRenderFns = []
|
36918 | mainvue_type_template_id_80210338_render._withStripped = true
|
36919 |
|
36920 |
|
36921 |
|
36922 |
|
36923 |
|
36924 |
|
36925 |
|
36926 |
|
36927 |
|
36928 |
|
36929 |
|
36930 |
|
36931 | var footer_src_mainvue_type_script_lang_js_ = ({
|
36932 | name: 'ElFooter',
|
36933 |
|
36934 | componentName: 'ElFooter',
|
36935 |
|
36936 | props: {
|
36937 | height: {
|
36938 | type: String,
|
36939 | default: '60px'
|
36940 | }
|
36941 | }
|
36942 | });
|
36943 |
|
36944 | var packages_footer_src_mainvue_type_script_lang_js_ = (footer_src_mainvue_type_script_lang_js_);
|
36945 |
|
36946 |
|
36947 |
|
36948 |
|
36949 |
|
36950 |
|
36951 |
|
36952 |
|
36953 | var footer_src_main_component = normalizeComponent(
|
36954 | packages_footer_src_mainvue_type_script_lang_js_,
|
36955 | mainvue_type_template_id_80210338_render,
|
36956 | mainvue_type_template_id_80210338_staticRenderFns,
|
36957 | false,
|
36958 | null,
|
36959 | null,
|
36960 | null
|
36961 |
|
36962 | )
|
36963 |
|
36964 |
|
36965 | if (false) { var footer_src_main_api; }
|
36966 | footer_src_main_component.options.__file = "packages/footer/src/main.vue"
|
36967 | var footer_src_main = (footer_src_main_component.exports);
|
36968 |
|
36969 |
|
36970 |
|
36971 |
|
36972 | footer_src_main.install = function (Vue) {
|
36973 | Vue.component(footer_src_main.name, footer_src_main);
|
36974 | };
|
36975 |
|
36976 | var footer = (footer_src_main);
|
36977 |
|
36978 |
|
36979 | var timeline_src_mainvue_type_script_lang_js_ = ({
|
36980 | name: 'ElTimeline',
|
36981 |
|
36982 | props: {
|
36983 | reverse: {
|
36984 | type: Boolean,
|
36985 | default: false
|
36986 | }
|
36987 | },
|
36988 |
|
36989 | provide: function provide() {
|
36990 | return {
|
36991 | timeline: this
|
36992 | };
|
36993 | },
|
36994 | render: function render() {
|
36995 | var h = arguments[0];
|
36996 |
|
36997 | var reverse = this.reverse;
|
36998 | var classes = {
|
36999 | 'el-timeline': true,
|
37000 | 'is-reverse': reverse
|
37001 | };
|
37002 | var slots = this.$slots.default || [];
|
37003 | if (reverse) {
|
37004 | slots = slots.reverse();
|
37005 | }
|
37006 | return h(
|
37007 | 'ul',
|
37008 | { 'class': classes },
|
37009 | [slots]
|
37010 | );
|
37011 | }
|
37012 | });
|
37013 |
|
37014 | var packages_timeline_src_mainvue_type_script_lang_js_ = (timeline_src_mainvue_type_script_lang_js_);
|
37015 |
|
37016 | var main_render, main_staticRenderFns
|
37017 |
|
37018 |
|
37019 |
|
37020 |
|
37021 |
|
37022 |
|
37023 | var timeline_src_main_component = normalizeComponent(
|
37024 | packages_timeline_src_mainvue_type_script_lang_js_,
|
37025 | main_render,
|
37026 | main_staticRenderFns,
|
37027 | false,
|
37028 | null,
|
37029 | null,
|
37030 | null
|
37031 |
|
37032 | )
|
37033 |
|
37034 |
|
37035 | if (false) { var timeline_src_main_api; }
|
37036 | timeline_src_main_component.options.__file = "packages/timeline/src/main.vue"
|
37037 | var timeline_src_main = (timeline_src_main_component.exports);
|
37038 |
|
37039 |
|
37040 |
|
37041 |
|
37042 | timeline_src_main.install = function (Vue) {
|
37043 | Vue.component(timeline_src_main.name, timeline_src_main);
|
37044 | };
|
37045 |
|
37046 | var timeline = (timeline_src_main);
|
37047 |
|
37048 | var itemvue_type_template_id_61a69e50_render = function() {
|
37049 | var _vm = this
|
37050 | var _h = _vm.$createElement
|
37051 | var _c = _vm._self._c || _h
|
37052 | return _c("li", { staticClass: "el-timeline-item" }, [
|
37053 | _c("div", { staticClass: "el-timeline-item__tail" }),
|
37054 | !_vm.$slots.dot
|
37055 | ? _c(
|
37056 | "div",
|
37057 | {
|
37058 | staticClass: "el-timeline-item__node",
|
37059 | class: [
|
37060 | "el-timeline-item__node--" + (_vm.size || ""),
|
37061 | "el-timeline-item__node--" + (_vm.type || "")
|
37062 | ],
|
37063 | style: {
|
37064 | backgroundColor: _vm.color
|
37065 | }
|
37066 | },
|
37067 | [
|
37068 | _vm.icon
|
37069 | ? _c("i", {
|
37070 | staticClass: "el-timeline-item__icon",
|
37071 | class: _vm.icon
|
37072 | })
|
37073 | : _vm._e()
|
37074 | ]
|
37075 | )
|
37076 | : _vm._e(),
|
37077 | _vm.$slots.dot
|
37078 | ? _c("div", { staticClass: "el-timeline-item__dot" }, [_vm._t("dot")], 2)
|
37079 | : _vm._e(),
|
37080 | _c("div", { staticClass: "el-timeline-item__wrapper" }, [
|
37081 | !_vm.hideTimestamp && _vm.placement === "top"
|
37082 | ? _c("div", { staticClass: "el-timeline-item__timestamp is-top" }, [
|
37083 | _vm._v("\n " + _vm._s(_vm.timestamp) + "\n ")
|
37084 | ])
|
37085 | : _vm._e(),
|
37086 | _c(
|
37087 | "div",
|
37088 | { staticClass: "el-timeline-item__content" },
|
37089 | [_vm._t("default")],
|
37090 | 2
|
37091 | ),
|
37092 | !_vm.hideTimestamp && _vm.placement === "bottom"
|
37093 | ? _c("div", { staticClass: "el-timeline-item__timestamp is-bottom" }, [
|
37094 | _vm._v("\n " + _vm._s(_vm.timestamp) + "\n ")
|
37095 | ])
|
37096 | : _vm._e()
|
37097 | ])
|
37098 | ])
|
37099 | }
|
37100 | var itemvue_type_template_id_61a69e50_staticRenderFns = []
|
37101 | itemvue_type_template_id_61a69e50_render._withStripped = true
|
37102 |
|
37103 |
|
37104 |
|
37105 |
|
37106 |
|
37107 |
|
37108 |
|
37109 |
|
37110 |
|
37111 |
|
37112 |
|
37113 |
|
37114 |
|
37115 |
|
37116 |
|
37117 |
|
37118 |
|
37119 |
|
37120 |
|
37121 |
|
37122 |
|
37123 |
|
37124 |
|
37125 |
|
37126 |
|
37127 |
|
37128 |
|
37129 |
|
37130 |
|
37131 |
|
37132 |
|
37133 |
|
37134 |
|
37135 |
|
37136 |
|
37137 |
|
37138 |
|
37139 |
|
37140 |
|
37141 |
|
37142 |
|
37143 |
|
37144 |
|
37145 |
|
37146 |
|
37147 |
|
37148 |
|
37149 | var timeline_src_itemvue_type_script_lang_js_ = ({
|
37150 | name: 'ElTimelineItem',
|
37151 |
|
37152 | inject: ['timeline'],
|
37153 |
|
37154 | props: {
|
37155 | timestamp: String,
|
37156 |
|
37157 | hideTimestamp: {
|
37158 | type: Boolean,
|
37159 | default: false
|
37160 | },
|
37161 |
|
37162 | placement: {
|
37163 | type: String,
|
37164 | default: 'bottom'
|
37165 | },
|
37166 |
|
37167 | type: String,
|
37168 |
|
37169 | color: String,
|
37170 |
|
37171 | size: {
|
37172 | type: String,
|
37173 | default: 'normal'
|
37174 | },
|
37175 |
|
37176 | icon: String
|
37177 | }
|
37178 | });
|
37179 |
|
37180 | var packages_timeline_src_itemvue_type_script_lang_js_ = (timeline_src_itemvue_type_script_lang_js_);
|
37181 |
|
37182 |
|
37183 |
|
37184 |
|
37185 |
|
37186 |
|
37187 |
|
37188 |
|
37189 | var src_item_component = normalizeComponent(
|
37190 | packages_timeline_src_itemvue_type_script_lang_js_,
|
37191 | itemvue_type_template_id_61a69e50_render,
|
37192 | itemvue_type_template_id_61a69e50_staticRenderFns,
|
37193 | false,
|
37194 | null,
|
37195 | null,
|
37196 | null
|
37197 |
|
37198 | )
|
37199 |
|
37200 |
|
37201 | if (false) { var src_item_api; }
|
37202 | src_item_component.options.__file = "packages/timeline/src/item.vue"
|
37203 | var timeline_src_item = (src_item_component.exports);
|
37204 |
|
37205 |
|
37206 |
|
37207 |
|
37208 | timeline_src_item.install = function (Vue) {
|
37209 | Vue.component(timeline_src_item.name, timeline_src_item);
|
37210 | };
|
37211 |
|
37212 | var timeline_item = (timeline_src_item);
|
37213 |
|
37214 | var mainvue_type_template_id_01cf3b65_render = function() {
|
37215 | var _vm = this
|
37216 | var _h = _vm.$createElement
|
37217 | var _c = _vm._self._c || _h
|
37218 | return _c(
|
37219 | "a",
|
37220 | _vm._b(
|
37221 | {
|
37222 | class: [
|
37223 | "el-link",
|
37224 | _vm.type ? "el-link--" + _vm.type : "",
|
37225 | _vm.disabled && "is-disabled",
|
37226 | _vm.underline && !_vm.disabled && "is-underline"
|
37227 | ],
|
37228 | attrs: { href: _vm.disabled ? null : _vm.href },
|
37229 | on: { click: _vm.handleClick }
|
37230 | },
|
37231 | "a",
|
37232 | _vm.$attrs,
|
37233 | false
|
37234 | ),
|
37235 | [
|
37236 | _vm.icon ? _c("i", { class: _vm.icon }) : _vm._e(),
|
37237 | _vm.$slots.default
|
37238 | ? _c("span", { staticClass: "el-link--inner" }, [_vm._t("default")], 2)
|
37239 | : _vm._e(),
|
37240 | _vm.$slots.icon ? [_vm.$slots.icon ? _vm._t("icon") : _vm._e()] : _vm._e()
|
37241 | ],
|
37242 | 2
|
37243 | )
|
37244 | }
|
37245 | var mainvue_type_template_id_01cf3b65_staticRenderFns = []
|
37246 | mainvue_type_template_id_01cf3b65_render._withStripped = true
|
37247 |
|
37248 |
|
37249 |
|
37250 |
|
37251 |
|
37252 |
|
37253 |
|
37254 |
|
37255 |
|
37256 |
|
37257 |
|
37258 |
|
37259 |
|
37260 |
|
37261 |
|
37262 |
|
37263 |
|
37264 |
|
37265 |
|
37266 |
|
37267 |
|
37268 |
|
37269 |
|
37270 |
|
37271 |
|
37272 |
|
37273 |
|
37274 |
|
37275 |
|
37276 |
|
37277 | var link_src_mainvue_type_script_lang_js_ = ({
|
37278 | name: 'ElLink',
|
37279 |
|
37280 | props: {
|
37281 | type: {
|
37282 | type: String,
|
37283 | default: 'default'
|
37284 | },
|
37285 | underline: {
|
37286 | type: Boolean,
|
37287 | default: true
|
37288 | },
|
37289 | disabled: Boolean,
|
37290 | href: String,
|
37291 | icon: String
|
37292 | },
|
37293 |
|
37294 | methods: {
|
37295 | handleClick: function handleClick(event) {
|
37296 | if (!this.disabled) {
|
37297 | if (!this.href) {
|
37298 | this.$emit('click', event);
|
37299 | }
|
37300 | }
|
37301 | }
|
37302 | }
|
37303 | });
|
37304 |
|
37305 | var packages_link_src_mainvue_type_script_lang_js_ = (link_src_mainvue_type_script_lang_js_);
|
37306 |
|
37307 |
|
37308 |
|
37309 |
|
37310 |
|
37311 |
|
37312 |
|
37313 |
|
37314 | var link_src_main_component = normalizeComponent(
|
37315 | packages_link_src_mainvue_type_script_lang_js_,
|
37316 | mainvue_type_template_id_01cf3b65_render,
|
37317 | mainvue_type_template_id_01cf3b65_staticRenderFns,
|
37318 | false,
|
37319 | null,
|
37320 | null,
|
37321 | null
|
37322 |
|
37323 | )
|
37324 |
|
37325 |
|
37326 | if (false) { var link_src_main_api; }
|
37327 | link_src_main_component.options.__file = "packages/link/src/main.vue"
|
37328 | var link_src_main = (link_src_main_component.exports);
|
37329 |
|
37330 |
|
37331 |
|
37332 |
|
37333 | link_src_main.install = function (Vue) {
|
37334 | Vue.component(link_src_main.name, link_src_main);
|
37335 | };
|
37336 |
|
37337 | var packages_link = (link_src_main);
|
37338 |
|
37339 | var mainvue_type_template_id_7fa02a7e_functional_true_render = function(_h, _vm) {
|
37340 | var _c = _vm._c
|
37341 | return _c(
|
37342 | "div",
|
37343 | _vm._g(
|
37344 | _vm._b(
|
37345 | {
|
37346 | class: [
|
37347 | _vm.data.staticClass,
|
37348 | "el-divider",
|
37349 | "el-divider--" + _vm.props.direction
|
37350 | ]
|
37351 | },
|
37352 | "div",
|
37353 | _vm.data.attrs,
|
37354 | false
|
37355 | ),
|
37356 | _vm.listeners
|
37357 | ),
|
37358 | [
|
37359 | _vm.slots().default && _vm.props.direction !== "vertical"
|
37360 | ? _c(
|
37361 | "div",
|
37362 | { class: ["el-divider__text", "is-" + _vm.props.contentPosition] },
|
37363 | [_vm._t("default")],
|
37364 | 2
|
37365 | )
|
37366 | : _vm._e()
|
37367 | ]
|
37368 | )
|
37369 | }
|
37370 | var mainvue_type_template_id_7fa02a7e_functional_true_staticRenderFns = []
|
37371 | mainvue_type_template_id_7fa02a7e_functional_true_render._withStripped = true
|
37372 |
|
37373 |
|
37374 |
|
37375 |
|
37376 |
|
37377 |
|
37378 |
|
37379 |
|
37380 |
|
37381 |
|
37382 |
|
37383 |
|
37384 |
|
37385 |
|
37386 |
|
37387 |
|
37388 |
|
37389 |
|
37390 |
|
37391 |
|
37392 |
|
37393 | var divider_src_mainvue_type_script_lang_js_ = ({
|
37394 | name: 'ElDivider',
|
37395 | props: {
|
37396 | direction: {
|
37397 | type: String,
|
37398 | default: 'horizontal',
|
37399 | validator: function validator(val) {
|
37400 | return ['horizontal', 'vertical'].indexOf(val) !== -1;
|
37401 | }
|
37402 | },
|
37403 | contentPosition: {
|
37404 | type: String,
|
37405 | default: 'center',
|
37406 | validator: function validator(val) {
|
37407 | return ['left', 'center', 'right'].indexOf(val) !== -1;
|
37408 | }
|
37409 | }
|
37410 | }
|
37411 | });
|
37412 |
|
37413 | var packages_divider_src_mainvue_type_script_lang_js_ = (divider_src_mainvue_type_script_lang_js_);
|
37414 |
|
37415 |
|
37416 |
|
37417 |
|
37418 |
|
37419 |
|
37420 |
|
37421 |
|
37422 | var divider_src_main_component = normalizeComponent(
|
37423 | packages_divider_src_mainvue_type_script_lang_js_,
|
37424 | mainvue_type_template_id_7fa02a7e_functional_true_render,
|
37425 | mainvue_type_template_id_7fa02a7e_functional_true_staticRenderFns,
|
37426 | true,
|
37427 | null,
|
37428 | null,
|
37429 | null
|
37430 |
|
37431 | )
|
37432 |
|
37433 |
|
37434 | if (false) { var divider_src_main_api; }
|
37435 | divider_src_main_component.options.__file = "packages/divider/src/main.vue"
|
37436 | var divider_src_main = (divider_src_main_component.exports);
|
37437 |
|
37438 |
|
37439 |
|
37440 |
|
37441 | divider_src_main.install = function (Vue) {
|
37442 | Vue.component(divider_src_main.name, divider_src_main);
|
37443 | };
|
37444 |
|
37445 | var divider = (divider_src_main);
|
37446 |
|
37447 | var mainvue_type_template_id_44d84a7c_render = function() {
|
37448 | var _vm = this
|
37449 | var _h = _vm.$createElement
|
37450 | var _c = _vm._self._c || _h
|
37451 | return _c(
|
37452 | "div",
|
37453 | { staticClass: "el-image" },
|
37454 | [
|
37455 | _vm.loading
|
37456 | ? _vm._t("placeholder", [
|
37457 | _c("div", { staticClass: "el-image__placeholder" })
|
37458 | ])
|
37459 | : _vm.error
|
37460 | ? _vm._t("error", [
|
37461 | _c("div", { staticClass: "el-image__error" }, [
|
37462 | _vm._v(_vm._s(_vm.t("el.image.error")))
|
37463 | ])
|
37464 | ])
|
37465 | : _c(
|
37466 | "img",
|
37467 | _vm._g(
|
37468 | _vm._b(
|
37469 | {
|
37470 | staticClass: "el-image__inner",
|
37471 | class: {
|
37472 | "el-image__inner--center": _vm.alignCenter,
|
37473 | "el-image__preview": _vm.preview
|
37474 | },
|
37475 | style: _vm.imageStyle,
|
37476 | attrs: { src: _vm.src },
|
37477 | on: { click: _vm.clickHandler }
|
37478 | },
|
37479 | "img",
|
37480 | _vm.$attrs,
|
37481 | false
|
37482 | ),
|
37483 | _vm.$listeners
|
37484 | )
|
37485 | ),
|
37486 | _vm.preview
|
37487 | ? [
|
37488 | _vm.showViewer
|
37489 | ? _c("image-viewer", {
|
37490 | attrs: {
|
37491 | "z-index": _vm.zIndex,
|
37492 | "initial-index": _vm.imageIndex,
|
37493 | "on-close": _vm.closeViewer,
|
37494 | "url-list": _vm.previewSrcList
|
37495 | }
|
37496 | })
|
37497 | : _vm._e()
|
37498 | ]
|
37499 | : _vm._e()
|
37500 | ],
|
37501 | 2
|
37502 | )
|
37503 | }
|
37504 | var mainvue_type_template_id_44d84a7c_staticRenderFns = []
|
37505 | mainvue_type_template_id_44d84a7c_render._withStripped = true
|
37506 |
|
37507 |
|
37508 |
|
37509 |
|
37510 |
|
37511 | var image_viewervue_type_template_id_5e73b307_render = function() {
|
37512 | var _vm = this
|
37513 | var _h = _vm.$createElement
|
37514 | var _c = _vm._self._c || _h
|
37515 | return _c("transition", { attrs: { name: "viewer-fade" } }, [
|
37516 | _c(
|
37517 | "div",
|
37518 | {
|
37519 | ref: "el-image-viewer__wrapper",
|
37520 | staticClass: "el-image-viewer__wrapper",
|
37521 | style: { "z-index": _vm.zIndex },
|
37522 | attrs: { tabindex: "-1" }
|
37523 | },
|
37524 | [
|
37525 | _c("div", { staticClass: "el-image-viewer__mask" }),
|
37526 | _c(
|
37527 | "span",
|
37528 | {
|
37529 | staticClass: "el-image-viewer__btn el-image-viewer__close",
|
37530 | on: { click: _vm.hide }
|
37531 | },
|
37532 | [_c("i", { staticClass: "el-icon-circle-close" })]
|
37533 | ),
|
37534 | !_vm.isSingle
|
37535 | ? [
|
37536 | _c(
|
37537 | "span",
|
37538 | {
|
37539 | staticClass: "el-image-viewer__btn el-image-viewer__prev",
|
37540 | class: { "is-disabled": !_vm.infinite && _vm.isFirst },
|
37541 | on: { click: _vm.prev }
|
37542 | },
|
37543 | [_c("i", { staticClass: "el-icon-arrow-left" })]
|
37544 | ),
|
37545 | _c(
|
37546 | "span",
|
37547 | {
|
37548 | staticClass: "el-image-viewer__btn el-image-viewer__next",
|
37549 | class: { "is-disabled": !_vm.infinite && _vm.isLast },
|
37550 | on: { click: _vm.next }
|
37551 | },
|
37552 | [_c("i", { staticClass: "el-icon-arrow-right" })]
|
37553 | )
|
37554 | ]
|
37555 | : _vm._e(),
|
37556 | _c(
|
37557 | "div",
|
37558 | { staticClass: "el-image-viewer__btn el-image-viewer__actions" },
|
37559 | [
|
37560 | _c("div", { staticClass: "el-image-viewer__actions__inner" }, [
|
37561 | _c("i", {
|
37562 | staticClass: "el-icon-zoom-out",
|
37563 | on: {
|
37564 | click: function($event) {
|
37565 | _vm.handleActions("zoomOut")
|
37566 | }
|
37567 | }
|
37568 | }),
|
37569 | _c("i", {
|
37570 | staticClass: "el-icon-zoom-in",
|
37571 | on: {
|
37572 | click: function($event) {
|
37573 | _vm.handleActions("zoomIn")
|
37574 | }
|
37575 | }
|
37576 | }),
|
37577 | _c("i", { staticClass: "el-image-viewer__actions__divider" }),
|
37578 | _c("i", { class: _vm.mode.icon, on: { click: _vm.toggleMode } }),
|
37579 | _c("i", { staticClass: "el-image-viewer__actions__divider" }),
|
37580 | _c("i", {
|
37581 | staticClass: "el-icon-refresh-left",
|
37582 | on: {
|
37583 | click: function($event) {
|
37584 | _vm.handleActions("anticlocelise")
|
37585 | }
|
37586 | }
|
37587 | }),
|
37588 | _c("i", {
|
37589 | staticClass: "el-icon-refresh-right",
|
37590 | on: {
|
37591 | click: function($event) {
|
37592 | _vm.handleActions("clocelise")
|
37593 | }
|
37594 | }
|
37595 | })
|
37596 | ])
|
37597 | ]
|
37598 | ),
|
37599 | _c(
|
37600 | "div",
|
37601 | { staticClass: "el-image-viewer__canvas" },
|
37602 | _vm._l(_vm.urlList, function(url, i) {
|
37603 | return i === _vm.index
|
37604 | ? _c("img", {
|
37605 | key: url,
|
37606 | ref: "img",
|
37607 | refInFor: true,
|
37608 | staticClass: "el-image-viewer__img",
|
37609 | style: _vm.imgStyle,
|
37610 | attrs: { src: _vm.currentImg },
|
37611 | on: {
|
37612 | load: _vm.handleImgLoad,
|
37613 | error: _vm.handleImgError,
|
37614 | mousedown: _vm.handleMouseDown
|
37615 | }
|
37616 | })
|
37617 | : _vm._e()
|
37618 | }),
|
37619 | 0
|
37620 | )
|
37621 | ],
|
37622 | 2
|
37623 | )
|
37624 | ])
|
37625 | }
|
37626 | var image_viewervue_type_template_id_5e73b307_staticRenderFns = []
|
37627 | image_viewervue_type_template_id_5e73b307_render._withStripped = true
|
37628 |
|
37629 |
|
37630 |
|
37631 |
|
37632 |
|
37633 | var image_viewervue_type_script_lang_js_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
37634 |
|
37635 |
|
37636 |
|
37637 |
|
37638 |
|
37639 |
|
37640 |
|
37641 |
|
37642 |
|
37643 |
|
37644 |
|
37645 |
|
37646 |
|
37647 |
|
37648 |
|
37649 |
|
37650 |
|
37651 |
|
37652 |
|
37653 |
|
37654 |
|
37655 |
|
37656 |
|
37657 |
|
37658 |
|
37659 |
|
37660 |
|
37661 |
|
37662 |
|
37663 |
|
37664 |
|
37665 |
|
37666 |
|
37667 |
|
37668 |
|
37669 |
|
37670 |
|
37671 |
|
37672 |
|
37673 |
|
37674 |
|
37675 |
|
37676 |
|
37677 |
|
37678 |
|
37679 |
|
37680 |
|
37681 |
|
37682 |
|
37683 |
|
37684 |
|
37685 |
|
37686 |
|
37687 |
|
37688 |
|
37689 |
|
37690 |
|
37691 |
|
37692 | var Mode = {
|
37693 | CONTAIN: {
|
37694 | name: 'contain',
|
37695 | icon: 'el-icon-full-screen'
|
37696 | },
|
37697 | ORIGINAL: {
|
37698 | name: 'original',
|
37699 | icon: 'el-icon-c-scale-to-original'
|
37700 | }
|
37701 | };
|
37702 |
|
37703 | var mousewheelEventName = Object(util_["isFirefox"])() ? 'DOMMouseScroll' : 'mousewheel';
|
37704 |
|
37705 | var image_viewervue_type_script_lang_js_ = ({
|
37706 | name: 'elImageViewer',
|
37707 |
|
37708 | props: {
|
37709 | urlList: {
|
37710 | type: Array,
|
37711 | default: function _default() {
|
37712 | return [];
|
37713 | }
|
37714 | },
|
37715 | zIndex: {
|
37716 | type: Number,
|
37717 | default: 2000
|
37718 | },
|
37719 | onSwitch: {
|
37720 | type: Function,
|
37721 | default: function _default() {}
|
37722 | },
|
37723 | onClose: {
|
37724 | type: Function,
|
37725 | default: function _default() {}
|
37726 | },
|
37727 | initialIndex: {
|
37728 | type: Number,
|
37729 | default: 0
|
37730 | }
|
37731 | },
|
37732 |
|
37733 | data: function data() {
|
37734 | return {
|
37735 | index: this.initialIndex,
|
37736 | isShow: false,
|
37737 | infinite: true,
|
37738 | loading: false,
|
37739 | mode: Mode.CONTAIN,
|
37740 | transform: {
|
37741 | scale: 1,
|
37742 | deg: 0,
|
37743 | offsetX: 0,
|
37744 | offsetY: 0,
|
37745 | enableTransition: false
|
37746 | }
|
37747 | };
|
37748 | },
|
37749 |
|
37750 | computed: {
|
37751 | isSingle: function isSingle() {
|
37752 | return this.urlList.length <= 1;
|
37753 | },
|
37754 | isFirst: function isFirst() {
|
37755 | return this.index === 0;
|
37756 | },
|
37757 | isLast: function isLast() {
|
37758 | return this.index === this.urlList.length - 1;
|
37759 | },
|
37760 | currentImg: function currentImg() {
|
37761 | return this.urlList[this.index];
|
37762 | },
|
37763 | imgStyle: function imgStyle() {
|
37764 | var _transform = this.transform,
|
37765 | scale = _transform.scale,
|
37766 | deg = _transform.deg,
|
37767 | offsetX = _transform.offsetX,
|
37768 | offsetY = _transform.offsetY,
|
37769 | enableTransition = _transform.enableTransition;
|
37770 |
|
37771 | var style = {
|
37772 | transform: 'scale(' + scale + ') rotate(' + deg + 'deg)',
|
37773 | transition: enableTransition ? 'transform .3s' : '',
|
37774 | 'margin-left': offsetX + 'px',
|
37775 | 'margin-top': offsetY + 'px'
|
37776 | };
|
37777 | if (this.mode === Mode.CONTAIN) {
|
37778 | style.maxWidth = style.maxHeight = '100%';
|
37779 | }
|
37780 | return style;
|
37781 | }
|
37782 | },
|
37783 | watch: {
|
37784 | index: {
|
37785 | handler: function handler(val) {
|
37786 | this.reset();
|
37787 | this.onSwitch(val);
|
37788 | }
|
37789 | },
|
37790 | currentImg: function currentImg(val) {
|
37791 | var _this = this;
|
37792 |
|
37793 | this.$nextTick(function (_) {
|
37794 | var $img = _this.$refs.img[0];
|
37795 | if (!$img.complete) {
|
37796 | _this.loading = true;
|
37797 | }
|
37798 | });
|
37799 | }
|
37800 | },
|
37801 | methods: {
|
37802 | hide: function hide() {
|
37803 | this.deviceSupportUninstall();
|
37804 | this.onClose();
|
37805 | },
|
37806 | deviceSupportInstall: function deviceSupportInstall() {
|
37807 | var _this2 = this;
|
37808 |
|
37809 | this._keyDownHandler = Object(util_["rafThrottle"])(function (e) {
|
37810 | var keyCode = e.keyCode;
|
37811 | switch (keyCode) {
|
37812 |
|
37813 | case 27:
|
37814 | _this2.hide();
|
37815 | break;
|
37816 |
|
37817 | case 32:
|
37818 | _this2.toggleMode();
|
37819 | break;
|
37820 |
|
37821 | case 37:
|
37822 | _this2.prev();
|
37823 | break;
|
37824 |
|
37825 | case 38:
|
37826 | _this2.handleActions('zoomIn');
|
37827 | break;
|
37828 |
|
37829 | case 39:
|
37830 | _this2.next();
|
37831 | break;
|
37832 |
|
37833 | case 40:
|
37834 | _this2.handleActions('zoomOut');
|
37835 | break;
|
37836 | }
|
37837 | });
|
37838 | this._mouseWheelHandler = Object(util_["rafThrottle"])(function (e) {
|
37839 | var delta = e.wheelDelta ? e.wheelDelta : -e.detail;
|
37840 | if (delta > 0) {
|
37841 | _this2.handleActions('zoomIn', {
|
37842 | zoomRate: 0.015,
|
37843 | enableTransition: false
|
37844 | });
|
37845 | } else {
|
37846 | _this2.handleActions('zoomOut', {
|
37847 | zoomRate: 0.015,
|
37848 | enableTransition: false
|
37849 | });
|
37850 | }
|
37851 | });
|
37852 | Object(dom_["on"])(document, 'keydown', this._keyDownHandler);
|
37853 | Object(dom_["on"])(document, mousewheelEventName, this._mouseWheelHandler);
|
37854 | },
|
37855 | deviceSupportUninstall: function deviceSupportUninstall() {
|
37856 | Object(dom_["off"])(document, 'keydown', this._keyDownHandler);
|
37857 | Object(dom_["off"])(document, mousewheelEventName, this._mouseWheelHandler);
|
37858 | this._keyDownHandler = null;
|
37859 | this._mouseWheelHandler = null;
|
37860 | },
|
37861 | handleImgLoad: function handleImgLoad(e) {
|
37862 | this.loading = false;
|
37863 | },
|
37864 | handleImgError: function handleImgError(e) {
|
37865 | this.loading = false;
|
37866 | e.target.alt = '加载失败';
|
37867 | },
|
37868 | handleMouseDown: function handleMouseDown(e) {
|
37869 | var _this3 = this;
|
37870 |
|
37871 | if (this.loading || e.button !== 0) return;
|
37872 |
|
37873 | var _transform2 = this.transform,
|
37874 | offsetX = _transform2.offsetX,
|
37875 | offsetY = _transform2.offsetY;
|
37876 |
|
37877 | var startX = e.pageX;
|
37878 | var startY = e.pageY;
|
37879 | this._dragHandler = Object(util_["rafThrottle"])(function (ev) {
|
37880 | _this3.transform.offsetX = offsetX + ev.pageX - startX;
|
37881 | _this3.transform.offsetY = offsetY + ev.pageY - startY;
|
37882 | });
|
37883 | Object(dom_["on"])(document, 'mousemove', this._dragHandler);
|
37884 | Object(dom_["on"])(document, 'mouseup', function (ev) {
|
37885 | Object(dom_["off"])(document, 'mousemove', _this3._dragHandler);
|
37886 | });
|
37887 |
|
37888 | e.preventDefault();
|
37889 | },
|
37890 | reset: function reset() {
|
37891 | this.transform = {
|
37892 | scale: 1,
|
37893 | deg: 0,
|
37894 | offsetX: 0,
|
37895 | offsetY: 0,
|
37896 | enableTransition: false
|
37897 | };
|
37898 | },
|
37899 | toggleMode: function toggleMode() {
|
37900 | if (this.loading) return;
|
37901 |
|
37902 | var modeNames = Object.keys(Mode);
|
37903 | var modeValues = Object.values(Mode);
|
37904 | var index = modeValues.indexOf(this.mode);
|
37905 | var nextIndex = (index + 1) % modeNames.length;
|
37906 | this.mode = Mode[modeNames[nextIndex]];
|
37907 | this.reset();
|
37908 | },
|
37909 | prev: function prev() {
|
37910 | if (this.isFirst && !this.infinite) return;
|
37911 | var len = this.urlList.length;
|
37912 | this.index = (this.index - 1 + len) % len;
|
37913 | },
|
37914 | next: function next() {
|
37915 | if (this.isLast && !this.infinite) return;
|
37916 | var len = this.urlList.length;
|
37917 | this.index = (this.index + 1) % len;
|
37918 | },
|
37919 | handleActions: function handleActions(action) {
|
37920 | var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
37921 |
|
37922 | if (this.loading) return;
|
37923 |
|
37924 | var _zoomRate$rotateDeg$e = image_viewervue_type_script_lang_js_extends({
|
37925 | zoomRate: 0.2,
|
37926 | rotateDeg: 90,
|
37927 | enableTransition: true
|
37928 | }, options),
|
37929 | zoomRate = _zoomRate$rotateDeg$e.zoomRate,
|
37930 | rotateDeg = _zoomRate$rotateDeg$e.rotateDeg,
|
37931 | enableTransition = _zoomRate$rotateDeg$e.enableTransition;
|
37932 |
|
37933 | var transform = this.transform;
|
37934 |
|
37935 | switch (action) {
|
37936 | case 'zoomOut':
|
37937 | if (transform.scale > 0.2) {
|
37938 | transform.scale = parseFloat((transform.scale - zoomRate).toFixed(3));
|
37939 | }
|
37940 | break;
|
37941 | case 'zoomIn':
|
37942 | transform.scale = parseFloat((transform.scale + zoomRate).toFixed(3));
|
37943 | break;
|
37944 | case 'clocelise':
|
37945 | transform.deg += rotateDeg;
|
37946 | break;
|
37947 | case 'anticlocelise':
|
37948 | transform.deg -= rotateDeg;
|
37949 | break;
|
37950 | }
|
37951 | transform.enableTransition = enableTransition;
|
37952 | }
|
37953 | },
|
37954 | mounted: function mounted() {
|
37955 | this.deviceSupportInstall();
|
37956 |
|
37957 |
|
37958 | this.$refs['el-image-viewer__wrapper'].focus();
|
37959 | }
|
37960 | });
|
37961 |
|
37962 | var src_image_viewervue_type_script_lang_js_ = (image_viewervue_type_script_lang_js_);
|
37963 |
|
37964 |
|
37965 |
|
37966 |
|
37967 |
|
37968 |
|
37969 |
|
37970 |
|
37971 | var image_viewer_component = normalizeComponent(
|
37972 | src_image_viewervue_type_script_lang_js_,
|
37973 | image_viewervue_type_template_id_5e73b307_render,
|
37974 | image_viewervue_type_template_id_5e73b307_staticRenderFns,
|
37975 | false,
|
37976 | null,
|
37977 | null,
|
37978 | null
|
37979 |
|
37980 | )
|
37981 |
|
37982 |
|
37983 | if (false) { var image_viewer_api; }
|
37984 | image_viewer_component.options.__file = "packages/image/src/image-viewer.vue"
|
37985 | var image_viewer = (image_viewer_component.exports);
|
37986 |
|
37987 |
|
37988 |
|
37989 |
|
37990 |
|
37991 |
|
37992 |
|
37993 |
|
37994 |
|
37995 |
|
37996 |
|
37997 |
|
37998 |
|
37999 |
|
38000 |
|
38001 |
|
38002 |
|
38003 |
|
38004 |
|
38005 |
|
38006 |
|
38007 |
|
38008 |
|
38009 |
|
38010 |
|
38011 |
|
38012 |
|
38013 |
|
38014 |
|
38015 |
|
38016 |
|
38017 | var isSupportObjectFit = function isSupportObjectFit() {
|
38018 | return document.documentElement.style.objectFit !== undefined;
|
38019 | };
|
38020 |
|
38021 | var ObjectFit = {
|
38022 | NONE: 'none',
|
38023 | CONTAIN: 'contain',
|
38024 | COVER: 'cover',
|
38025 | FILL: 'fill',
|
38026 | SCALE_DOWN: 'scale-down'
|
38027 | };
|
38028 |
|
38029 | var prevOverflow = '';
|
38030 |
|
38031 | var image_src_mainvue_type_script_lang_js_ = ({
|
38032 | name: 'ElImage',
|
38033 |
|
38034 | mixins: [locale_default.a],
|
38035 | inheritAttrs: false,
|
38036 |
|
38037 | components: {
|
38038 | ImageViewer: image_viewer
|
38039 | },
|
38040 |
|
38041 | props: {
|
38042 | src: String,
|
38043 | fit: String,
|
38044 | lazy: Boolean,
|
38045 | scrollContainer: {},
|
38046 | previewSrcList: {
|
38047 | type: Array,
|
38048 | default: function _default() {
|
38049 | return [];
|
38050 | }
|
38051 | },
|
38052 | zIndex: {
|
38053 | type: Number,
|
38054 | default: 2000
|
38055 | }
|
38056 | },
|
38057 |
|
38058 | data: function data() {
|
38059 | return {
|
38060 | loading: true,
|
38061 | error: false,
|
38062 | show: !this.lazy,
|
38063 | imageWidth: 0,
|
38064 | imageHeight: 0,
|
38065 | showViewer: false
|
38066 | };
|
38067 | },
|
38068 |
|
38069 |
|
38070 | computed: {
|
38071 | imageStyle: function imageStyle() {
|
38072 | var fit = this.fit;
|
38073 |
|
38074 | if (!this.$isServer && fit) {
|
38075 | return isSupportObjectFit() ? { 'object-fit': fit } : this.getImageStyle(fit);
|
38076 | }
|
38077 | return {};
|
38078 | },
|
38079 | alignCenter: function alignCenter() {
|
38080 | return !this.$isServer && !isSupportObjectFit() && this.fit !== ObjectFit.FILL;
|
38081 | },
|
38082 | preview: function preview() {
|
38083 | var previewSrcList = this.previewSrcList;
|
38084 |
|
38085 | return Array.isArray(previewSrcList) && previewSrcList.length > 0;
|
38086 | },
|
38087 | imageIndex: function imageIndex() {
|
38088 | var previewIndex = 0;
|
38089 | var srcIndex = this.previewSrcList.indexOf(this.src);
|
38090 | if (srcIndex >= 0) {
|
38091 | previewIndex = srcIndex;
|
38092 | }
|
38093 | return previewIndex;
|
38094 | }
|
38095 | },
|
38096 |
|
38097 | watch: {
|
38098 | src: function src(val) {
|
38099 | this.show && this.loadImage();
|
38100 | },
|
38101 | show: function show(val) {
|
38102 | val && this.loadImage();
|
38103 | }
|
38104 | },
|
38105 |
|
38106 | mounted: function mounted() {
|
38107 | if (this.lazy) {
|
38108 | this.addLazyLoadListener();
|
38109 | } else {
|
38110 | this.loadImage();
|
38111 | }
|
38112 | },
|
38113 | beforeDestroy: function beforeDestroy() {
|
38114 | this.lazy && this.removeLazyLoadListener();
|
38115 | },
|
38116 |
|
38117 |
|
38118 | methods: {
|
38119 | loadImage: function loadImage() {
|
38120 | var _this = this;
|
38121 |
|
38122 | if (this.$isServer) return;
|
38123 |
|
38124 |
|
38125 | this.loading = true;
|
38126 | this.error = false;
|
38127 |
|
38128 | var img = new Image();
|
38129 | img.onload = function (e) {
|
38130 | return _this.handleLoad(e, img);
|
38131 | };
|
38132 | img.onerror = this.handleError.bind(this);
|
38133 |
|
38134 |
|
38135 |
|
38136 | Object.keys(this.$attrs).forEach(function (key) {
|
38137 | var value = _this.$attrs[key];
|
38138 | img.setAttribute(key, value);
|
38139 | });
|
38140 | img.src = this.src;
|
38141 | },
|
38142 | handleLoad: function handleLoad(e, img) {
|
38143 | this.imageWidth = img.width;
|
38144 | this.imageHeight = img.height;
|
38145 | this.loading = false;
|
38146 | this.error = false;
|
38147 | },
|
38148 | handleError: function handleError(e) {
|
38149 | this.loading = false;
|
38150 | this.error = true;
|
38151 | this.$emit('error', e);
|
38152 | },
|
38153 | handleLazyLoad: function handleLazyLoad() {
|
38154 | if (Object(dom_["isInContainer"])(this.$el, this._scrollContainer)) {
|
38155 | this.show = true;
|
38156 | this.removeLazyLoadListener();
|
38157 | }
|
38158 | },
|
38159 | addLazyLoadListener: function addLazyLoadListener() {
|
38160 | if (this.$isServer) return;
|
38161 |
|
38162 | var scrollContainer = this.scrollContainer;
|
38163 |
|
38164 | var _scrollContainer = null;
|
38165 |
|
38166 | if (Object(types_["isHtmlElement"])(scrollContainer)) {
|
38167 | _scrollContainer = scrollContainer;
|
38168 | } else if (Object(types_["isString"])(scrollContainer)) {
|
38169 | _scrollContainer = document.querySelector(scrollContainer);
|
38170 | } else {
|
38171 | _scrollContainer = Object(dom_["getScrollContainer"])(this.$el);
|
38172 | }
|
38173 |
|
38174 | if (_scrollContainer) {
|
38175 | this._scrollContainer = _scrollContainer;
|
38176 | this._lazyLoadHandler = throttle_default()(200, this.handleLazyLoad);
|
38177 | Object(dom_["on"])(_scrollContainer, 'scroll', this._lazyLoadHandler);
|
38178 | this.handleLazyLoad();
|
38179 | }
|
38180 | },
|
38181 | removeLazyLoadListener: function removeLazyLoadListener() {
|
38182 | var _scrollContainer = this._scrollContainer,
|
38183 | _lazyLoadHandler = this._lazyLoadHandler;
|
38184 |
|
38185 |
|
38186 | if (this.$isServer || !_scrollContainer || !_lazyLoadHandler) return;
|
38187 |
|
38188 | Object(dom_["off"])(_scrollContainer, 'scroll', _lazyLoadHandler);
|
38189 | this._scrollContainer = null;
|
38190 | this._lazyLoadHandler = null;
|
38191 | },
|
38192 |
|
38193 | |
38194 |
|
38195 |
|
38196 | getImageStyle: function getImageStyle(fit) {
|
38197 | var imageWidth = this.imageWidth,
|
38198 | imageHeight = this.imageHeight;
|
38199 | var _$el = this.$el,
|
38200 | containerWidth = _$el.clientWidth,
|
38201 | containerHeight = _$el.clientHeight;
|
38202 |
|
38203 |
|
38204 | if (!imageWidth || !imageHeight || !containerWidth || !containerHeight) return {};
|
38205 |
|
38206 | var vertical = imageWidth / imageHeight < 1;
|
38207 |
|
38208 | if (fit === ObjectFit.SCALE_DOWN) {
|
38209 | var isSmaller = imageWidth < containerWidth && imageHeight < containerHeight;
|
38210 | fit = isSmaller ? ObjectFit.NONE : ObjectFit.CONTAIN;
|
38211 | }
|
38212 |
|
38213 | switch (fit) {
|
38214 | case ObjectFit.NONE:
|
38215 | return { width: 'auto', height: 'auto' };
|
38216 | case ObjectFit.CONTAIN:
|
38217 | return vertical ? { width: 'auto' } : { height: 'auto' };
|
38218 | case ObjectFit.COVER:
|
38219 | return vertical ? { height: 'auto' } : { width: 'auto' };
|
38220 | default:
|
38221 | return {};
|
38222 | }
|
38223 | },
|
38224 | clickHandler: function clickHandler() {
|
38225 |
|
38226 | if (!this.preview) {
|
38227 | return;
|
38228 | }
|
38229 |
|
38230 | prevOverflow = document.body.style.overflow;
|
38231 | document.body.style.overflow = 'hidden';
|
38232 | this.showViewer = true;
|
38233 | },
|
38234 | closeViewer: function closeViewer() {
|
38235 | document.body.style.overflow = prevOverflow;
|
38236 | this.showViewer = false;
|
38237 | }
|
38238 | }
|
38239 | });
|
38240 |
|
38241 | var packages_image_src_mainvue_type_script_lang_js_ = (image_src_mainvue_type_script_lang_js_);
|
38242 |
|
38243 |
|
38244 |
|
38245 |
|
38246 |
|
38247 |
|
38248 |
|
38249 |
|
38250 | var image_src_main_component = normalizeComponent(
|
38251 | packages_image_src_mainvue_type_script_lang_js_,
|
38252 | mainvue_type_template_id_44d84a7c_render,
|
38253 | mainvue_type_template_id_44d84a7c_staticRenderFns,
|
38254 | false,
|
38255 | null,
|
38256 | null,
|
38257 | null
|
38258 |
|
38259 | )
|
38260 |
|
38261 |
|
38262 | if (false) { var image_src_main_api; }
|
38263 | image_src_main_component.options.__file = "packages/image/src/main.vue"
|
38264 | var image_src_main = (image_src_main_component.exports);
|
38265 |
|
38266 |
|
38267 |
|
38268 |
|
38269 | image_src_main.install = function (Vue) {
|
38270 | Vue.component(image_src_main.name, image_src_main);
|
38271 | };
|
38272 |
|
38273 | var packages_image = (image_src_main);
|
38274 |
|
38275 | var mainvue_type_template_id_6d9756be_render = function() {
|
38276 | var _vm = this
|
38277 | var _h = _vm.$createElement
|
38278 | var _c = _vm._self._c || _h
|
38279 | return _c("div", { staticClass: "el-calendar" }, [
|
38280 | _c("div", { staticClass: "el-calendar__header" }, [
|
38281 | _c("div", { staticClass: "el-calendar__title" }, [
|
38282 | _vm._v("\n " + _vm._s(_vm.i18nDate) + "\n ")
|
38283 | ]),
|
38284 | _vm.validatedRange.length === 0
|
38285 | ? _c(
|
38286 | "div",
|
38287 | { staticClass: "el-calendar__button-group" },
|
38288 | [
|
38289 | _c(
|
38290 | "el-button-group",
|
38291 | [
|
38292 | _c(
|
38293 | "el-button",
|
38294 | {
|
38295 | attrs: { type: "plain", size: "mini" },
|
38296 | on: {
|
38297 | click: function($event) {
|
38298 | _vm.selectDate("prev-month")
|
38299 | }
|
38300 | }
|
38301 | },
|
38302 | [
|
38303 | _vm._v(
|
38304 | "\n " +
|
38305 | _vm._s(_vm.t("el.datepicker.prevMonth")) +
|
38306 | "\n "
|
38307 | )
|
38308 | ]
|
38309 | ),
|
38310 | _c(
|
38311 | "el-button",
|
38312 | {
|
38313 | attrs: { type: "plain", size: "mini" },
|
38314 | on: {
|
38315 | click: function($event) {
|
38316 | _vm.selectDate("today")
|
38317 | }
|
38318 | }
|
38319 | },
|
38320 | [
|
38321 | _vm._v(
|
38322 | "\n " +
|
38323 | _vm._s(_vm.t("el.datepicker.today")) +
|
38324 | "\n "
|
38325 | )
|
38326 | ]
|
38327 | ),
|
38328 | _c(
|
38329 | "el-button",
|
38330 | {
|
38331 | attrs: { type: "plain", size: "mini" },
|
38332 | on: {
|
38333 | click: function($event) {
|
38334 | _vm.selectDate("next-month")
|
38335 | }
|
38336 | }
|
38337 | },
|
38338 | [
|
38339 | _vm._v(
|
38340 | "\n " +
|
38341 | _vm._s(_vm.t("el.datepicker.nextMonth")) +
|
38342 | "\n "
|
38343 | )
|
38344 | ]
|
38345 | )
|
38346 | ],
|
38347 | 1
|
38348 | )
|
38349 | ],
|
38350 | 1
|
38351 | )
|
38352 | : _vm._e()
|
38353 | ]),
|
38354 | _vm.validatedRange.length === 0
|
38355 | ? _c(
|
38356 | "div",
|
38357 | { key: "no-range", staticClass: "el-calendar__body" },
|
38358 | [
|
38359 | _c("date-table", {
|
38360 | attrs: {
|
38361 | date: _vm.date,
|
38362 | "selected-day": _vm.realSelectedDay,
|
38363 | "first-day-of-week": _vm.realFirstDayOfWeek
|
38364 | },
|
38365 | on: { pick: _vm.pickDay }
|
38366 | })
|
38367 | ],
|
38368 | 1
|
38369 | )
|
38370 | : _c(
|
38371 | "div",
|
38372 | { key: "has-range", staticClass: "el-calendar__body" },
|
38373 | _vm._l(_vm.validatedRange, function(range, index) {
|
38374 | return _c("date-table", {
|
38375 | key: index,
|
38376 | attrs: {
|
38377 | date: range[0],
|
38378 | "selected-day": _vm.realSelectedDay,
|
38379 | range: range,
|
38380 | "hide-header": index !== 0,
|
38381 | "first-day-of-week": _vm.realFirstDayOfWeek
|
38382 | },
|
38383 | on: { pick: _vm.pickDay }
|
38384 | })
|
38385 | }),
|
38386 | 1
|
38387 | )
|
38388 | ])
|
38389 | }
|
38390 | var mainvue_type_template_id_6d9756be_staticRenderFns = []
|
38391 | mainvue_type_template_id_6d9756be_render._withStripped = true
|
38392 |
|
38393 |
|
38394 |
|
38395 |
|
38396 |
|
38397 | var date_ = __webpack_require__(20);
|
38398 | var date_default = __webpack_require__.n(date_);
|
38399 |
|
38400 |
|
38401 |
|
38402 |
|
38403 |
|
38404 |
|
38405 | var src_date_tablevue_type_script_lang_js_ = ({
|
38406 | props: {
|
38407 | selectedDay: String,
|
38408 | range: {
|
38409 | type: Array,
|
38410 | validator: function validator(val) {
|
38411 | if (!(val && val.length)) return true;
|
38412 | var start = val[0],
|
38413 | end = val[1];
|
38414 |
|
38415 | return Object(date_util_["validateRangeInOneMonth"])(start, end);
|
38416 | }
|
38417 | },
|
38418 | date: Date,
|
38419 | hideHeader: Boolean,
|
38420 | firstDayOfWeek: Number
|
38421 | },
|
38422 |
|
38423 | inject: ['elCalendar'],
|
38424 |
|
38425 | data: function data() {
|
38426 | return {
|
38427 | WEEK_DAYS: Object(date_util_["getI18nSettings"])().dayNames
|
38428 | };
|
38429 | },
|
38430 |
|
38431 |
|
38432 | methods: {
|
38433 | toNestedArr: function toNestedArr(days) {
|
38434 | return Object(date_util_["range"])(days.length / 7).map(function (_, index) {
|
38435 | var start = index * 7;
|
38436 | return days.slice(start, start + 7);
|
38437 | });
|
38438 | },
|
38439 | getFormateDate: function getFormateDate(day, type) {
|
38440 | if (!day || ['prev', 'current', 'next'].indexOf(type) === -1) {
|
38441 | throw new Error('invalid day or type');
|
38442 | }
|
38443 | var prefix = this.curMonthDatePrefix;
|
38444 | if (type === 'prev') {
|
38445 | prefix = this.prevMonthDatePrefix;
|
38446 | } else if (type === 'next') {
|
38447 | prefix = this.nextMonthDatePrefix;
|
38448 | }
|
38449 | day = ('00' + day).slice(-2);
|
38450 | return prefix + '-' + day;
|
38451 | },
|
38452 | getCellClass: function getCellClass(_ref) {
|
38453 | var text = _ref.text,
|
38454 | type = _ref.type;
|
38455 |
|
38456 | var classes = [type];
|
38457 | if (type === 'current') {
|
38458 | var date = this.getFormateDate(text, type);
|
38459 | if (date === this.selectedDay) {
|
38460 | classes.push('is-selected');
|
38461 | }
|
38462 | if (date === this.formatedToday) {
|
38463 | classes.push('is-today');
|
38464 | }
|
38465 | }
|
38466 | return classes;
|
38467 | },
|
38468 | pickDay: function pickDay(_ref2) {
|
38469 | var text = _ref2.text,
|
38470 | type = _ref2.type;
|
38471 |
|
38472 | var date = this.getFormateDate(text, type);
|
38473 | this.$emit('pick', date);
|
38474 | },
|
38475 | cellRenderProxy: function cellRenderProxy(_ref3) {
|
38476 | var text = _ref3.text,
|
38477 | type = _ref3.type;
|
38478 | var h = this.$createElement;
|
38479 |
|
38480 | var render = this.elCalendar.$scopedSlots.dateCell;
|
38481 | if (!render) return h('span', [text]);
|
38482 |
|
38483 | var day = this.getFormateDate(text, type);
|
38484 | var date = new Date(day);
|
38485 | var data = {
|
38486 | isSelected: this.selectedDay === day,
|
38487 | type: type + '-month',
|
38488 | day: day
|
38489 | };
|
38490 | return render({ date: date, data: data });
|
38491 | }
|
38492 | },
|
38493 |
|
38494 | computed: {
|
38495 | prevMonthDatePrefix: function prevMonthDatePrefix() {
|
38496 | var temp = new Date(this.date.getTime());
|
38497 | temp.setDate(0);
|
38498 | return date_default.a.format(temp, 'yyyy-MM');
|
38499 | },
|
38500 | curMonthDatePrefix: function curMonthDatePrefix() {
|
38501 | return date_default.a.format(this.date, 'yyyy-MM');
|
38502 | },
|
38503 | nextMonthDatePrefix: function nextMonthDatePrefix() {
|
38504 | var temp = new Date(this.date.getFullYear(), this.date.getMonth() + 1, 1);
|
38505 | return date_default.a.format(temp, 'yyyy-MM');
|
38506 | },
|
38507 | formatedToday: function formatedToday() {
|
38508 | return this.elCalendar.formatedToday;
|
38509 | },
|
38510 | isInRange: function isInRange() {
|
38511 | return this.range && this.range.length;
|
38512 | },
|
38513 | rows: function rows() {
|
38514 | var days = [];
|
38515 |
|
38516 | if (this.isInRange) {
|
38517 | var _range = this.range,
|
38518 | start = _range[0],
|
38519 | end = _range[1];
|
38520 |
|
38521 | var currentMonthRange = Object(date_util_["range"])(end.getDate() - start.getDate() + 1).map(function (_, index) {
|
38522 | return {
|
38523 | text: start.getDate() + index,
|
38524 | type: 'current'
|
38525 | };
|
38526 | });
|
38527 | var remaining = currentMonthRange.length % 7;
|
38528 | remaining = remaining === 0 ? 0 : 7 - remaining;
|
38529 | var nextMonthRange = Object(date_util_["range"])(remaining).map(function (_, index) {
|
38530 | return {
|
38531 | text: index + 1,
|
38532 | type: 'next'
|
38533 | };
|
38534 | });
|
38535 | days = currentMonthRange.concat(nextMonthRange);
|
38536 | } else {
|
38537 | var date = this.date;
|
38538 | var firstDay = Object(date_util_["getFirstDayOfMonth"])(date);
|
38539 | firstDay = firstDay === 0 ? 7 : firstDay;
|
38540 | var firstDayOfWeek = typeof this.firstDayOfWeek === 'number' ? this.firstDayOfWeek : 1;
|
38541 | var prevMonthDays = Object(date_util_["getPrevMonthLastDays"])(date, firstDay - firstDayOfWeek).map(function (day) {
|
38542 | return {
|
38543 | text: day,
|
38544 | type: 'prev'
|
38545 | };
|
38546 | });
|
38547 | var currentMonthDays = Object(date_util_["getMonthDays"])(date).map(function (day) {
|
38548 | return {
|
38549 | text: day,
|
38550 | type: 'current'
|
38551 | };
|
38552 | });
|
38553 | days = [].concat(prevMonthDays, currentMonthDays);
|
38554 | var nextMonthDays = Object(date_util_["range"])(42 - days.length).map(function (_, index) {
|
38555 | return {
|
38556 | text: index + 1,
|
38557 | type: 'next'
|
38558 | };
|
38559 | });
|
38560 | days = days.concat(nextMonthDays);
|
38561 | }
|
38562 | return this.toNestedArr(days);
|
38563 | },
|
38564 | weekDays: function weekDays() {
|
38565 | var start = this.firstDayOfWeek;
|
38566 | var WEEK_DAYS = this.WEEK_DAYS;
|
38567 |
|
38568 |
|
38569 | if (typeof start !== 'number' || start === 0) {
|
38570 | return WEEK_DAYS.slice();
|
38571 | } else {
|
38572 | return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start));
|
38573 | }
|
38574 | }
|
38575 | },
|
38576 |
|
38577 | render: function render() {
|
38578 | var _this = this;
|
38579 |
|
38580 | var h = arguments[0];
|
38581 |
|
38582 | var thead = this.hideHeader ? null : h('thead', [this.weekDays.map(function (day) {
|
38583 | return h(
|
38584 | 'th',
|
38585 | { key: day },
|
38586 | [day]
|
38587 | );
|
38588 | })]);
|
38589 | return h(
|
38590 | 'table',
|
38591 | {
|
38592 | 'class': {
|
38593 | 'el-calendar-table': true,
|
38594 | 'is-range': this.isInRange
|
38595 | },
|
38596 | attrs: { cellspacing: '0',
|
38597 | cellpadding: '0' }
|
38598 | },
|
38599 | [thead, h('tbody', [this.rows.map(function (row, index) {
|
38600 | return h(
|
38601 | 'tr',
|
38602 | {
|
38603 | 'class': {
|
38604 | 'el-calendar-table__row': true,
|
38605 | 'el-calendar-table__row--hide-border': index === 0 && _this.hideHeader
|
38606 | },
|
38607 | key: index },
|
38608 | [row.map(function (cell, key) {
|
38609 | return h(
|
38610 | 'td',
|
38611 | { key: key,
|
38612 | 'class': _this.getCellClass(cell),
|
38613 | on: {
|
38614 | 'click': _this.pickDay.bind(_this, cell)
|
38615 | }
|
38616 | },
|
38617 | [h(
|
38618 | 'div',
|
38619 | { 'class': 'el-calendar-day' },
|
38620 | [_this.cellRenderProxy(cell)]
|
38621 | )]
|
38622 | );
|
38623 | })]
|
38624 | );
|
38625 | })])]
|
38626 | );
|
38627 | }
|
38628 | });
|
38629 |
|
38630 | var calendar_src_date_tablevue_type_script_lang_js_ = (src_date_tablevue_type_script_lang_js_);
|
38631 |
|
38632 | var date_table_render, date_table_staticRenderFns
|
38633 |
|
38634 |
|
38635 |
|
38636 |
|
38637 |
|
38638 |
|
38639 | var src_date_table_component = normalizeComponent(
|
38640 | calendar_src_date_tablevue_type_script_lang_js_,
|
38641 | date_table_render,
|
38642 | date_table_staticRenderFns,
|
38643 | false,
|
38644 | null,
|
38645 | null,
|
38646 | null
|
38647 |
|
38648 | )
|
38649 |
|
38650 |
|
38651 | if (false) { var src_date_table_api; }
|
38652 | src_date_table_component.options.__file = "packages/calendar/src/date-table.vue"
|
38653 | var src_date_table = (src_date_table_component.exports);
|
38654 |
|
38655 |
|
38656 |
|
38657 |
|
38658 |
|
38659 |
|
38660 |
|
38661 |
|
38662 |
|
38663 |
|
38664 |
|
38665 |
|
38666 |
|
38667 |
|
38668 |
|
38669 |
|
38670 |
|
38671 |
|
38672 |
|
38673 |
|
38674 |
|
38675 |
|
38676 |
|
38677 |
|
38678 |
|
38679 |
|
38680 |
|
38681 |
|
38682 |
|
38683 |
|
38684 |
|
38685 |
|
38686 |
|
38687 |
|
38688 |
|
38689 |
|
38690 |
|
38691 |
|
38692 |
|
38693 |
|
38694 |
|
38695 |
|
38696 |
|
38697 |
|
38698 |
|
38699 |
|
38700 |
|
38701 |
|
38702 |
|
38703 |
|
38704 |
|
38705 |
|
38706 |
|
38707 |
|
38708 |
|
38709 |
|
38710 |
|
38711 |
|
38712 |
|
38713 |
|
38714 |
|
38715 |
|
38716 |
|
38717 |
|
38718 |
|
38719 |
|
38720 |
|
38721 | var validTypes = ['prev-month', 'today', 'next-month'];
|
38722 | var weekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
38723 | var oneDay = 86400000;
|
38724 |
|
38725 | var calendar_src_mainvue_type_script_lang_js_ = ({
|
38726 | name: 'ElCalendar',
|
38727 |
|
38728 | mixins: [locale_default.a],
|
38729 |
|
38730 | components: {
|
38731 | DateTable: src_date_table,
|
38732 | ElButton: button_default.a,
|
38733 | ElButtonGroup: button_group_default.a
|
38734 | },
|
38735 |
|
38736 | props: {
|
38737 | value: [Date, String, Number],
|
38738 | range: {
|
38739 | type: Array,
|
38740 | validator: function validator(range) {
|
38741 | if (Array.isArray(range)) {
|
38742 | return range.length === 2 && range.every(function (item) {
|
38743 | return typeof item === 'string' || typeof item === 'number' || item instanceof Date;
|
38744 | });
|
38745 | } else {
|
38746 | return true;
|
38747 | }
|
38748 | }
|
38749 | },
|
38750 | firstDayOfWeek: {
|
38751 | type: Number,
|
38752 | default: 1
|
38753 | }
|
38754 | },
|
38755 |
|
38756 | provide: function provide() {
|
38757 | return {
|
38758 | elCalendar: this
|
38759 | };
|
38760 | },
|
38761 |
|
38762 |
|
38763 | methods: {
|
38764 | pickDay: function pickDay(day) {
|
38765 | this.realSelectedDay = day;
|
38766 | },
|
38767 | selectDate: function selectDate(type) {
|
38768 | if (validTypes.indexOf(type) === -1) {
|
38769 | throw new Error('invalid type ' + type);
|
38770 | }
|
38771 | var day = '';
|
38772 | if (type === 'prev-month') {
|
38773 | day = this.prevMonthDatePrefix + '-01';
|
38774 | } else if (type === 'next-month') {
|
38775 | day = this.nextMonthDatePrefix + '-01';
|
38776 | } else {
|
38777 | day = this.formatedToday;
|
38778 | }
|
38779 |
|
38780 | if (day === this.formatedDate) return;
|
38781 | this.pickDay(day);
|
38782 | },
|
38783 | toDate: function toDate(val) {
|
38784 | if (!val) {
|
38785 | throw new Error('invalid val');
|
38786 | }
|
38787 | return val instanceof Date ? val : new Date(val);
|
38788 | },
|
38789 | rangeValidator: function rangeValidator(date, isStart) {
|
38790 | var firstDayOfWeek = this.realFirstDayOfWeek;
|
38791 | var expected = isStart ? firstDayOfWeek : firstDayOfWeek === 0 ? 6 : firstDayOfWeek - 1;
|
38792 | var message = (isStart ? 'start' : 'end') + ' of range should be ' + weekDays[expected] + '.';
|
38793 | if (date.getDay() !== expected) {
|
38794 | console.warn('[ElementCalendar]', message, 'Invalid range will be ignored.');
|
38795 | return false;
|
38796 | }
|
38797 | return true;
|
38798 | }
|
38799 | },
|
38800 |
|
38801 | computed: {
|
38802 | prevMonthDatePrefix: function prevMonthDatePrefix() {
|
38803 | var temp = new Date(this.date.getTime());
|
38804 | temp.setDate(0);
|
38805 | return date_default.a.format(temp, 'yyyy-MM');
|
38806 | },
|
38807 | curMonthDatePrefix: function curMonthDatePrefix() {
|
38808 | return date_default.a.format(this.date, 'yyyy-MM');
|
38809 | },
|
38810 | nextMonthDatePrefix: function nextMonthDatePrefix() {
|
38811 | var temp = new Date(this.date.getFullYear(), this.date.getMonth() + 1, 1);
|
38812 | return date_default.a.format(temp, 'yyyy-MM');
|
38813 | },
|
38814 | formatedDate: function formatedDate() {
|
38815 | return date_default.a.format(this.date, 'yyyy-MM-dd');
|
38816 | },
|
38817 | i18nDate: function i18nDate() {
|
38818 | var year = this.date.getFullYear();
|
38819 | var month = this.date.getMonth() + 1;
|
38820 | return year + ' ' + this.t('el.datepicker.year') + ' ' + this.t('el.datepicker.month' + month);
|
38821 | },
|
38822 | formatedToday: function formatedToday() {
|
38823 | return date_default.a.format(this.now, 'yyyy-MM-dd');
|
38824 | },
|
38825 |
|
38826 |
|
38827 | realSelectedDay: {
|
38828 | get: function get() {
|
38829 | if (!this.value) return this.selectedDay;
|
38830 | return this.formatedDate;
|
38831 | },
|
38832 | set: function set(val) {
|
38833 | this.selectedDay = val;
|
38834 | var date = new Date(val);
|
38835 | this.$emit('input', date);
|
38836 | }
|
38837 | },
|
38838 |
|
38839 | date: function date() {
|
38840 | if (!this.value) {
|
38841 | if (this.realSelectedDay) {
|
38842 | var d = this.selectedDay.split('-');
|
38843 | return new Date(d[0], d[1] - 1, d[2]);
|
38844 | } else if (this.validatedRange.length) {
|
38845 | return this.validatedRange[0][0];
|
38846 | }
|
38847 | return this.now;
|
38848 | } else {
|
38849 | return this.toDate(this.value);
|
38850 | }
|
38851 | },
|
38852 |
|
38853 |
|
38854 |
|
38855 | validatedRange: function validatedRange() {
|
38856 | var _this = this;
|
38857 |
|
38858 | var range = this.range;
|
38859 | if (!range) return [];
|
38860 | range = range.reduce(function (prev, val, index) {
|
38861 | var date = _this.toDate(val);
|
38862 | if (_this.rangeValidator(date, index === 0)) {
|
38863 | prev = prev.concat(date);
|
38864 | }
|
38865 | return prev;
|
38866 | }, []);
|
38867 | if (range.length === 2) {
|
38868 | var _range = range,
|
38869 | start = _range[0],
|
38870 | end = _range[1];
|
38871 |
|
38872 | if (start > end) {
|
38873 | console.warn('[ElementCalendar]end time should be greater than start time');
|
38874 | return [];
|
38875 | }
|
38876 |
|
38877 | if (Object(date_util_["validateRangeInOneMonth"])(start, end)) {
|
38878 | return [[start, end]];
|
38879 | }
|
38880 | var data = [];
|
38881 | var startDay = new Date(start.getFullYear(), start.getMonth() + 1, 1);
|
38882 | var lastDay = this.toDate(startDay.getTime() - oneDay);
|
38883 | if (!Object(date_util_["validateRangeInOneMonth"])(startDay, end)) {
|
38884 | console.warn('[ElementCalendar]start time and end time interval must not exceed two months');
|
38885 | return [];
|
38886 | }
|
38887 |
|
38888 | data.push([start, lastDay]);
|
38889 |
|
38890 | var firstDayOfWeek = this.realFirstDayOfWeek;
|
38891 | var nextMontFirstDay = startDay.getDay();
|
38892 | var interval = 0;
|
38893 | if (nextMontFirstDay !== firstDayOfWeek) {
|
38894 | if (firstDayOfWeek === 0) {
|
38895 | interval = 7 - nextMontFirstDay;
|
38896 | } else {
|
38897 | interval = firstDayOfWeek - nextMontFirstDay;
|
38898 | interval = interval > 0 ? interval : 7 + interval;
|
38899 | }
|
38900 | }
|
38901 | startDay = this.toDate(startDay.getTime() + interval * oneDay);
|
38902 | if (startDay.getDate() < end.getDate()) {
|
38903 | data.push([startDay, end]);
|
38904 | }
|
38905 | return data;
|
38906 | }
|
38907 | return [];
|
38908 | },
|
38909 | realFirstDayOfWeek: function realFirstDayOfWeek() {
|
38910 | if (this.firstDayOfWeek < 1 || this.firstDayOfWeek > 6) {
|
38911 | return 0;
|
38912 | }
|
38913 | return Math.floor(this.firstDayOfWeek);
|
38914 | }
|
38915 | },
|
38916 |
|
38917 | data: function data() {
|
38918 | return {
|
38919 | selectedDay: '',
|
38920 | now: new Date()
|
38921 | };
|
38922 | }
|
38923 | });
|
38924 |
|
38925 | var packages_calendar_src_mainvue_type_script_lang_js_ = (calendar_src_mainvue_type_script_lang_js_);
|
38926 |
|
38927 |
|
38928 |
|
38929 |
|
38930 |
|
38931 |
|
38932 |
|
38933 |
|
38934 | var calendar_src_main_component = normalizeComponent(
|
38935 | packages_calendar_src_mainvue_type_script_lang_js_,
|
38936 | mainvue_type_template_id_6d9756be_render,
|
38937 | mainvue_type_template_id_6d9756be_staticRenderFns,
|
38938 | false,
|
38939 | null,
|
38940 | null,
|
38941 | null
|
38942 |
|
38943 | )
|
38944 |
|
38945 |
|
38946 | if (false) { var calendar_src_main_api; }
|
38947 | calendar_src_main_component.options.__file = "packages/calendar/src/main.vue"
|
38948 | var calendar_src_main = (calendar_src_main_component.exports);
|
38949 |
|
38950 |
|
38951 |
|
38952 |
|
38953 | calendar_src_main.install = function (Vue) {
|
38954 | Vue.component(calendar_src_main.name, calendar_src_main);
|
38955 | };
|
38956 |
|
38957 | var calendar = (calendar_src_main);
|
38958 |
|
38959 | var mainvue_type_template_id_257dd4a9_render = function() {
|
38960 | var _vm = this
|
38961 | var _h = _vm.$createElement
|
38962 | var _c = _vm._self._c || _h
|
38963 | return _c("transition", { attrs: { name: "el-fade-in" } }, [
|
38964 | _vm.visible
|
38965 | ? _c(
|
38966 | "div",
|
38967 | {
|
38968 | staticClass: "el-backtop",
|
38969 | style: {
|
38970 | right: _vm.styleRight,
|
38971 | bottom: _vm.styleBottom
|
38972 | },
|
38973 | on: {
|
38974 | click: function($event) {
|
38975 | $event.stopPropagation()
|
38976 | return _vm.handleClick($event)
|
38977 | }
|
38978 | }
|
38979 | },
|
38980 | [
|
38981 | _vm._t("default", [_c("el-icon", { attrs: { name: "caret-top" } })])
|
38982 | ],
|
38983 | 2
|
38984 | )
|
38985 | : _vm._e()
|
38986 | ])
|
38987 | }
|
38988 | var mainvue_type_template_id_257dd4a9_staticRenderFns = []
|
38989 | mainvue_type_template_id_257dd4a9_render._withStripped = true
|
38990 |
|
38991 |
|
38992 |
|
38993 |
|
38994 |
|
38995 |
|
38996 |
|
38997 |
|
38998 |
|
38999 |
|
39000 |
|
39001 |
|
39002 |
|
39003 |
|
39004 |
|
39005 |
|
39006 |
|
39007 |
|
39008 |
|
39009 |
|
39010 |
|
39011 |
|
39012 |
|
39013 |
|
39014 |
|
39015 | var cubic = function cubic(value) {
|
39016 | return Math.pow(value, 3);
|
39017 | };
|
39018 | var easeInOutCubic = function easeInOutCubic(value) {
|
39019 | return value < 0.5 ? cubic(value * 2) / 2 : 1 - cubic((1 - value) * 2) / 2;
|
39020 | };
|
39021 |
|
39022 | var backtop_src_mainvue_type_script_lang_js_ = ({
|
39023 | name: 'ElBacktop',
|
39024 |
|
39025 | props: {
|
39026 | visibilityHeight: {
|
39027 | type: Number,
|
39028 | default: 200
|
39029 | },
|
39030 | target: [String],
|
39031 | right: {
|
39032 | type: Number,
|
39033 | default: 40
|
39034 | },
|
39035 | bottom: {
|
39036 | type: Number,
|
39037 | default: 40
|
39038 | }
|
39039 | },
|
39040 |
|
39041 | data: function data() {
|
39042 | return {
|
39043 | el: null,
|
39044 | container: null,
|
39045 | visible: false
|
39046 | };
|
39047 | },
|
39048 |
|
39049 |
|
39050 | computed: {
|
39051 | styleBottom: function styleBottom() {
|
39052 | return this.bottom + 'px';
|
39053 | },
|
39054 | styleRight: function styleRight() {
|
39055 | return this.right + 'px';
|
39056 | }
|
39057 | },
|
39058 |
|
39059 | mounted: function mounted() {
|
39060 | this.init();
|
39061 | this.throttledScrollHandler = throttle_default()(300, this.onScroll);
|
39062 | this.container.addEventListener('scroll', this.throttledScrollHandler);
|
39063 | },
|
39064 |
|
39065 |
|
39066 | methods: {
|
39067 | init: function init() {
|
39068 | this.container = document;
|
39069 | this.el = document.documentElement;
|
39070 | if (this.target) {
|
39071 | this.el = document.querySelector(this.target);
|
39072 | if (!this.el) {
|
39073 | throw new Error('target is not existed: ' + this.target);
|
39074 | }
|
39075 | this.container = this.el;
|
39076 | }
|
39077 | },
|
39078 | onScroll: function onScroll() {
|
39079 | var scrollTop = this.el.scrollTop;
|
39080 | this.visible = scrollTop >= this.visibilityHeight;
|
39081 | },
|
39082 | handleClick: function handleClick(e) {
|
39083 | this.scrollToTop();
|
39084 | this.$emit('click', e);
|
39085 | },
|
39086 | scrollToTop: function scrollToTop() {
|
39087 | var el = this.el;
|
39088 | var beginTime = Date.now();
|
39089 | var beginValue = el.scrollTop;
|
39090 | var rAF = window.requestAnimationFrame || function (func) {
|
39091 | return setTimeout(func, 16);
|
39092 | };
|
39093 | var frameFunc = function frameFunc() {
|
39094 | var progress = (Date.now() - beginTime) / 500;
|
39095 | if (progress < 1) {
|
39096 | el.scrollTop = beginValue * (1 - easeInOutCubic(progress));
|
39097 | rAF(frameFunc);
|
39098 | } else {
|
39099 | el.scrollTop = 0;
|
39100 | }
|
39101 | };
|
39102 | rAF(frameFunc);
|
39103 | }
|
39104 | },
|
39105 |
|
39106 | beforeDestroy: function beforeDestroy() {
|
39107 | this.container.removeEventListener('scroll', this.throttledScrollHandler);
|
39108 | }
|
39109 | });
|
39110 |
|
39111 | var packages_backtop_src_mainvue_type_script_lang_js_ = (backtop_src_mainvue_type_script_lang_js_);
|
39112 |
|
39113 |
|
39114 |
|
39115 |
|
39116 |
|
39117 |
|
39118 |
|
39119 |
|
39120 | var backtop_src_main_component = normalizeComponent(
|
39121 | packages_backtop_src_mainvue_type_script_lang_js_,
|
39122 | mainvue_type_template_id_257dd4a9_render,
|
39123 | mainvue_type_template_id_257dd4a9_staticRenderFns,
|
39124 | false,
|
39125 | null,
|
39126 | null,
|
39127 | null
|
39128 |
|
39129 | )
|
39130 |
|
39131 |
|
39132 | if (false) { var backtop_src_main_api; }
|
39133 | backtop_src_main_component.options.__file = "packages/backtop/src/main.vue"
|
39134 | var backtop_src_main = (backtop_src_main_component.exports);
|
39135 |
|
39136 |
|
39137 |
|
39138 |
|
39139 | backtop_src_main.install = function (Vue) {
|
39140 | Vue.component(backtop_src_main.name, backtop_src_main);
|
39141 | };
|
39142 |
|
39143 | var backtop = (backtop_src_main);
|
39144 |
|
39145 |
|
39146 |
|
39147 |
|
39148 |
|
39149 | var getStyleComputedProperty = function getStyleComputedProperty(element, property) {
|
39150 | if (element === window) {
|
39151 | element = document.documentElement;
|
39152 | }
|
39153 |
|
39154 | if (element.nodeType !== 1) {
|
39155 | return [];
|
39156 | }
|
39157 |
|
39158 | var css = window.getComputedStyle(element, null);
|
39159 | return property ? css[property] : css;
|
39160 | };
|
39161 |
|
39162 | var entries = function entries(obj) {
|
39163 | return Object.keys(obj || {}).map(function (key) {
|
39164 | return [key, obj[key]];
|
39165 | });
|
39166 | };
|
39167 |
|
39168 | var getPositionSize = function getPositionSize(el, prop) {
|
39169 | return el === window || el === document ? document.documentElement[prop] : el[prop];
|
39170 | };
|
39171 |
|
39172 | var getOffsetHeight = function getOffsetHeight(el) {
|
39173 | return getPositionSize(el, 'offsetHeight');
|
39174 | };
|
39175 |
|
39176 | var getClientHeight = function getClientHeight(el) {
|
39177 | return getPositionSize(el, 'clientHeight');
|
39178 | };
|
39179 |
|
39180 | var scope = 'ElInfiniteScroll';
|
39181 | var attributes = {
|
39182 | delay: {
|
39183 | type: Number,
|
39184 | default: 200
|
39185 | },
|
39186 | distance: {
|
39187 | type: Number,
|
39188 | default: 0
|
39189 | },
|
39190 | disabled: {
|
39191 | type: Boolean,
|
39192 | default: false
|
39193 | },
|
39194 | immediate: {
|
39195 | type: Boolean,
|
39196 | default: true
|
39197 | }
|
39198 | };
|
39199 |
|
39200 | var main_getScrollOptions = function getScrollOptions(el, vm) {
|
39201 | if (!Object(types_["isHtmlElement"])(el)) return {};
|
39202 |
|
39203 | return entries(attributes).reduce(function (map, _ref) {
|
39204 | var key = _ref[0],
|
39205 | option = _ref[1];
|
39206 | var type = option.type,
|
39207 | defaultValue = option.default;
|
39208 |
|
39209 | var value = el.getAttribute('infinite-scroll-' + key);
|
39210 | value = Object(types_["isUndefined"])(vm[value]) ? value : vm[value];
|
39211 | switch (type) {
|
39212 | case Number:
|
39213 | value = Number(value);
|
39214 | value = Number.isNaN(value) ? defaultValue : value;
|
39215 | break;
|
39216 | case Boolean:
|
39217 | value = Object(types_["isDefined"])(value) ? value === 'false' ? false : Boolean(value) : defaultValue;
|
39218 | break;
|
39219 | default:
|
39220 | value = type(value);
|
39221 | }
|
39222 | map[key] = value;
|
39223 | return map;
|
39224 | }, {});
|
39225 | };
|
39226 |
|
39227 | var getElementTop = function getElementTop(el) {
|
39228 | return el.getBoundingClientRect().top;
|
39229 | };
|
39230 |
|
39231 | var main_handleScroll = function handleScroll(cb) {
|
39232 | var _scope = this[scope],
|
39233 | el = _scope.el,
|
39234 | vm = _scope.vm,
|
39235 | container = _scope.container,
|
39236 | observer = _scope.observer;
|
39237 |
|
39238 | var _getScrollOptions = main_getScrollOptions(el, vm),
|
39239 | distance = _getScrollOptions.distance,
|
39240 | disabled = _getScrollOptions.disabled;
|
39241 |
|
39242 | if (disabled) return;
|
39243 |
|
39244 | var containerInfo = container.getBoundingClientRect();
|
39245 | if (!containerInfo.width && !containerInfo.height) return;
|
39246 |
|
39247 | var shouldTrigger = false;
|
39248 |
|
39249 | if (container === el) {
|
39250 |
|
39251 | var scrollBottom = container.scrollTop + getClientHeight(container);
|
39252 | shouldTrigger = container.scrollHeight - scrollBottom <= distance;
|
39253 | } else {
|
39254 | var heightBelowTop = getOffsetHeight(el) + getElementTop(el) - getElementTop(container);
|
39255 | var offsetHeight = getOffsetHeight(container);
|
39256 | var borderBottom = Number.parseFloat(getStyleComputedProperty(container, 'borderBottomWidth'));
|
39257 | shouldTrigger = heightBelowTop - offsetHeight + borderBottom <= distance;
|
39258 | }
|
39259 |
|
39260 | if (shouldTrigger && Object(types_["isFunction"])(cb)) {
|
39261 | cb.call(vm);
|
39262 | } else if (observer) {
|
39263 | observer.disconnect();
|
39264 | this[scope].observer = null;
|
39265 | }
|
39266 | };
|
39267 |
|
39268 | var infinite_scroll_src_main = ({
|
39269 | name: 'InfiniteScroll',
|
39270 | inserted: function inserted(el, binding, vnode) {
|
39271 | var cb = binding.value;
|
39272 |
|
39273 | var vm = vnode.context;
|
39274 |
|
39275 | var container = Object(dom_["getScrollContainer"])(el, true);
|
39276 |
|
39277 | var _getScrollOptions2 = main_getScrollOptions(el, vm),
|
39278 | delay = _getScrollOptions2.delay,
|
39279 | immediate = _getScrollOptions2.immediate;
|
39280 |
|
39281 | var onScroll = debounce_default()(delay, main_handleScroll.bind(el, cb));
|
39282 |
|
39283 | el[scope] = { el: el, vm: vm, container: container, onScroll: onScroll };
|
39284 |
|
39285 | if (container) {
|
39286 | container.addEventListener('scroll', onScroll);
|
39287 |
|
39288 | if (immediate) {
|
39289 | var observer = el[scope].observer = new MutationObserver(onScroll);
|
39290 | observer.observe(container, { childList: true, subtree: true });
|
39291 | onScroll();
|
39292 | }
|
39293 | }
|
39294 | },
|
39295 | unbind: function unbind(el) {
|
39296 | var _el$scope = el[scope],
|
39297 | container = _el$scope.container,
|
39298 | onScroll = _el$scope.onScroll;
|
39299 |
|
39300 | if (container) {
|
39301 | container.removeEventListener('scroll', onScroll);
|
39302 | }
|
39303 | }
|
39304 | });
|
39305 |
|
39306 |
|
39307 |
|
39308 |
|
39309 | infinite_scroll_src_main.install = function (Vue) {
|
39310 | Vue.directive(infinite_scroll_src_main.name, infinite_scroll_src_main);
|
39311 | };
|
39312 |
|
39313 | var infinite_scroll = (infinite_scroll_src_main);
|
39314 |
|
39315 | var mainvue_type_template_id_5070954c_render = function() {
|
39316 | var _vm = this
|
39317 | var _h = _vm.$createElement
|
39318 | var _c = _vm._self._c || _h
|
39319 | return _c("div", { staticClass: "el-page-header" }, [
|
39320 | _c(
|
39321 | "div",
|
39322 | {
|
39323 | staticClass: "el-page-header__left",
|
39324 | on: {
|
39325 | click: function($event) {
|
39326 | _vm.$emit("back")
|
39327 | }
|
39328 | }
|
39329 | },
|
39330 | [
|
39331 | _c("i", { staticClass: "el-icon-back" }),
|
39332 | _c(
|
39333 | "div",
|
39334 | { staticClass: "el-page-header__title" },
|
39335 | [_vm._t("title", [_vm._v(_vm._s(_vm.title))])],
|
39336 | 2
|
39337 | )
|
39338 | ]
|
39339 | ),
|
39340 | _c(
|
39341 | "div",
|
39342 | { staticClass: "el-page-header__content" },
|
39343 | [_vm._t("content", [_vm._v(_vm._s(_vm.content))])],
|
39344 | 2
|
39345 | )
|
39346 | ])
|
39347 | }
|
39348 | var mainvue_type_template_id_5070954c_staticRenderFns = []
|
39349 | mainvue_type_template_id_5070954c_render._withStripped = true
|
39350 |
|
39351 |
|
39352 |
|
39353 |
|
39354 |
|
39355 |
|
39356 |
|
39357 |
|
39358 |
|
39359 |
|
39360 |
|
39361 |
|
39362 |
|
39363 |
|
39364 |
|
39365 |
|
39366 |
|
39367 |
|
39368 |
|
39369 |
|
39370 |
|
39371 | var page_header_src_mainvue_type_script_lang_js_ = ({
|
39372 | name: 'ElPageHeader',
|
39373 |
|
39374 | props: {
|
39375 | title: {
|
39376 | type: String,
|
39377 | default: function _default() {
|
39378 | return Object(lib_locale_["t"])('el.pageHeader.title');
|
39379 | }
|
39380 | },
|
39381 | content: String
|
39382 | }
|
39383 | });
|
39384 |
|
39385 | var packages_page_header_src_mainvue_type_script_lang_js_ = (page_header_src_mainvue_type_script_lang_js_);
|
39386 |
|
39387 |
|
39388 |
|
39389 |
|
39390 |
|
39391 |
|
39392 |
|
39393 |
|
39394 | var page_header_src_main_component = normalizeComponent(
|
39395 | packages_page_header_src_mainvue_type_script_lang_js_,
|
39396 | mainvue_type_template_id_5070954c_render,
|
39397 | mainvue_type_template_id_5070954c_staticRenderFns,
|
39398 | false,
|
39399 | null,
|
39400 | null,
|
39401 | null
|
39402 |
|
39403 | )
|
39404 |
|
39405 |
|
39406 | if (false) { var page_header_src_main_api; }
|
39407 | page_header_src_main_component.options.__file = "packages/page-header/src/main.vue"
|
39408 | var page_header_src_main = (page_header_src_main_component.exports);
|
39409 |
|
39410 |
|
39411 |
|
39412 |
|
39413 | page_header_src_main.install = function (Vue) {
|
39414 | Vue.component(page_header_src_main.name, page_header_src_main);
|
39415 | };
|
39416 |
|
39417 | var page_header = (page_header_src_main);
|
39418 |
|
39419 | var cascader_panelvue_type_template_id_34932346_render = function() {
|
39420 | var _vm = this
|
39421 | var _h = _vm.$createElement
|
39422 | var _c = _vm._self._c || _h
|
39423 | return _c(
|
39424 | "div",
|
39425 | {
|
39426 | class: ["el-cascader-panel", _vm.border && "is-bordered"],
|
39427 | on: { keydown: _vm.handleKeyDown }
|
39428 | },
|
39429 | _vm._l(_vm.menus, function(menu, index) {
|
39430 | return _c("cascader-menu", {
|
39431 | key: index,
|
39432 | ref: "menu",
|
39433 | refInFor: true,
|
39434 | attrs: { index: index, nodes: menu }
|
39435 | })
|
39436 | }),
|
39437 | 1
|
39438 | )
|
39439 | }
|
39440 | var cascader_panelvue_type_template_id_34932346_staticRenderFns = []
|
39441 | cascader_panelvue_type_template_id_34932346_render._withStripped = true
|
39442 |
|
39443 |
|
39444 |
|
39445 |
|
39446 |
|
39447 | var radio_ = __webpack_require__(43);
|
39448 | var radio_default = __webpack_require__.n(radio_);
|
39449 |
|
39450 |
|
39451 |
|
39452 |
|
39453 |
|
39454 |
|
39455 |
|
39456 |
|
39457 | var stopPropagation = function stopPropagation(e) {
|
39458 | return e.stopPropagation();
|
39459 | };
|
39460 |
|
39461 | var cascader_nodevue_type_script_lang_js_ = ({
|
39462 | inject: ['panel'],
|
39463 |
|
39464 | components: {
|
39465 | ElCheckbox: checkbox_default.a,
|
39466 | ElRadio: radio_default.a
|
39467 | },
|
39468 |
|
39469 | props: {
|
39470 | node: {
|
39471 | required: true
|
39472 | },
|
39473 | nodeId: String
|
39474 | },
|
39475 |
|
39476 | computed: {
|
39477 | config: function config() {
|
39478 | return this.panel.config;
|
39479 | },
|
39480 | isLeaf: function isLeaf() {
|
39481 | return this.node.isLeaf;
|
39482 | },
|
39483 | isDisabled: function isDisabled() {
|
39484 | return this.node.isDisabled;
|
39485 | },
|
39486 | checkedValue: function checkedValue() {
|
39487 | return this.panel.checkedValue;
|
39488 | },
|
39489 | isChecked: function isChecked() {
|
39490 | return this.node.isSameNode(this.checkedValue);
|
39491 | },
|
39492 | inActivePath: function inActivePath() {
|
39493 | return this.isInPath(this.panel.activePath);
|
39494 | },
|
39495 | inCheckedPath: function inCheckedPath() {
|
39496 | var _this = this;
|
39497 |
|
39498 | if (!this.config.checkStrictly) return false;
|
39499 |
|
39500 | return this.panel.checkedNodePaths.some(function (checkedPath) {
|
39501 | return _this.isInPath(checkedPath);
|
39502 | });
|
39503 | },
|
39504 | value: function value() {
|
39505 | return this.node.getValueByOption();
|
39506 | }
|
39507 | },
|
39508 |
|
39509 | methods: {
|
39510 | handleExpand: function handleExpand() {
|
39511 | var _this2 = this;
|
39512 |
|
39513 | var panel = this.panel,
|
39514 | node = this.node,
|
39515 | isDisabled = this.isDisabled,
|
39516 | config = this.config;
|
39517 | var multiple = config.multiple,
|
39518 | checkStrictly = config.checkStrictly;
|
39519 |
|
39520 |
|
39521 | if (!checkStrictly && isDisabled || node.loading) return;
|
39522 |
|
39523 | if (config.lazy && !node.loaded) {
|
39524 | panel.lazyLoad(node, function () {
|
39525 |
|
39526 | var isLeaf = _this2.isLeaf;
|
39527 |
|
39528 |
|
39529 | if (!isLeaf) _this2.handleExpand();
|
39530 | if (multiple) {
|
39531 |
|
39532 | var checked = isLeaf ? node.checked : false;
|
39533 | _this2.handleMultiCheckChange(checked);
|
39534 | }
|
39535 | });
|
39536 | } else {
|
39537 | panel.handleExpand(node);
|
39538 | }
|
39539 | },
|
39540 | handleCheckChange: function handleCheckChange() {
|
39541 | var panel = this.panel,
|
39542 | value = this.value,
|
39543 | node = this.node;
|
39544 |
|
39545 | panel.handleCheckChange(value);
|
39546 | panel.handleExpand(node);
|
39547 | },
|
39548 | handleMultiCheckChange: function handleMultiCheckChange(checked) {
|
39549 | this.node.doCheck(checked);
|
39550 | this.panel.calculateMultiCheckedValue();
|
39551 | },
|
39552 | isInPath: function isInPath(pathNodes) {
|
39553 | var node = this.node;
|
39554 |
|
39555 | var selectedPathNode = pathNodes[node.level - 1] || {};
|
39556 | return selectedPathNode.uid === node.uid;
|
39557 | },
|
39558 | renderPrefix: function renderPrefix(h) {
|
39559 | var isLeaf = this.isLeaf,
|
39560 | isChecked = this.isChecked,
|
39561 | config = this.config;
|
39562 | var checkStrictly = config.checkStrictly,
|
39563 | multiple = config.multiple;
|
39564 |
|
39565 |
|
39566 | if (multiple) {
|
39567 | return this.renderCheckbox(h);
|
39568 | } else if (checkStrictly) {
|
39569 | return this.renderRadio(h);
|
39570 | } else if (isLeaf && isChecked) {
|
39571 | return this.renderCheckIcon(h);
|
39572 | }
|
39573 |
|
39574 | return null;
|
39575 | },
|
39576 | renderPostfix: function renderPostfix(h) {
|
39577 | var node = this.node,
|
39578 | isLeaf = this.isLeaf;
|
39579 |
|
39580 |
|
39581 | if (node.loading) {
|
39582 | return this.renderLoadingIcon(h);
|
39583 | } else if (!isLeaf) {
|
39584 | return this.renderExpandIcon(h);
|
39585 | }
|
39586 |
|
39587 | return null;
|
39588 | },
|
39589 | renderCheckbox: function renderCheckbox(h) {
|
39590 | var node = this.node,
|
39591 | config = this.config,
|
39592 | isDisabled = this.isDisabled;
|
39593 |
|
39594 | var events = {
|
39595 | on: { change: this.handleMultiCheckChange },
|
39596 | nativeOn: {}
|
39597 | };
|
39598 |
|
39599 | if (config.checkStrictly) {
|
39600 |
|
39601 | events.nativeOn.click = stopPropagation;
|
39602 | }
|
39603 |
|
39604 | return h('el-checkbox', external_babel_helper_vue_jsx_merge_props_default()([{
|
39605 | attrs: {
|
39606 | value: node.checked,
|
39607 | indeterminate: node.indeterminate,
|
39608 | disabled: isDisabled
|
39609 | }
|
39610 | }, events]));
|
39611 | },
|
39612 | renderRadio: function renderRadio(h) {
|
39613 | var checkedValue = this.checkedValue,
|
39614 | value = this.value,
|
39615 | isDisabled = this.isDisabled;
|
39616 |
|
39617 |
|
39618 |
|
39619 | if (Object(util_["isEqual"])(value, checkedValue)) {
|
39620 | value = checkedValue;
|
39621 | }
|
39622 |
|
39623 | return h(
|
39624 | 'el-radio',
|
39625 | {
|
39626 | attrs: {
|
39627 | value: checkedValue,
|
39628 | label: value,
|
39629 | disabled: isDisabled
|
39630 | },
|
39631 | on: {
|
39632 | 'change': this.handleCheckChange
|
39633 | },
|
39634 | nativeOn: {
|
39635 | 'click': stopPropagation
|
39636 | }
|
39637 | },
|
39638 | [h('span')]
|
39639 | );
|
39640 | },
|
39641 | renderCheckIcon: function renderCheckIcon(h) {
|
39642 | return h('i', { 'class': 'el-icon-check el-cascader-node__prefix' });
|
39643 | },
|
39644 | renderLoadingIcon: function renderLoadingIcon(h) {
|
39645 | return h('i', { 'class': 'el-icon-loading el-cascader-node__postfix' });
|
39646 | },
|
39647 | renderExpandIcon: function renderExpandIcon(h) {
|
39648 | return h('i', { 'class': 'el-icon-arrow-right el-cascader-node__postfix' });
|
39649 | },
|
39650 | renderContent: function renderContent(h) {
|
39651 | var panel = this.panel,
|
39652 | node = this.node;
|
39653 |
|
39654 | var render = panel.renderLabelFn;
|
39655 | var vnode = render ? render({ node: node, data: node.data }) : null;
|
39656 |
|
39657 | return h(
|
39658 | 'span',
|
39659 | { 'class': 'el-cascader-node__label' },
|
39660 | [vnode || node.label]
|
39661 | );
|
39662 | }
|
39663 | },
|
39664 |
|
39665 | render: function render(h) {
|
39666 | var _this3 = this;
|
39667 |
|
39668 | var inActivePath = this.inActivePath,
|
39669 | inCheckedPath = this.inCheckedPath,
|
39670 | isChecked = this.isChecked,
|
39671 | isLeaf = this.isLeaf,
|
39672 | isDisabled = this.isDisabled,
|
39673 | config = this.config,
|
39674 | nodeId = this.nodeId;
|
39675 | var expandTrigger = config.expandTrigger,
|
39676 | checkStrictly = config.checkStrictly,
|
39677 | multiple = config.multiple;
|
39678 |
|
39679 | var disabled = !checkStrictly && isDisabled;
|
39680 | var events = { on: {} };
|
39681 |
|
39682 | if (expandTrigger === 'click') {
|
39683 | events.on.click = this.handleExpand;
|
39684 | } else {
|
39685 | events.on.mouseenter = function (e) {
|
39686 | _this3.handleExpand();
|
39687 | _this3.$emit('expand', e);
|
39688 | };
|
39689 | events.on.focus = function (e) {
|
39690 | _this3.handleExpand();
|
39691 | _this3.$emit('expand', e);
|
39692 | };
|
39693 | }
|
39694 | if (isLeaf && !isDisabled && !checkStrictly && !multiple) {
|
39695 | events.on.click = this.handleCheckChange;
|
39696 | }
|
39697 |
|
39698 | return h(
|
39699 | 'li',
|
39700 | external_babel_helper_vue_jsx_merge_props_default()([{
|
39701 | attrs: {
|
39702 | role: 'menuitem',
|
39703 | id: nodeId,
|
39704 | 'aria-expanded': inActivePath,
|
39705 | tabindex: disabled ? null : -1
|
39706 | },
|
39707 | 'class': {
|
39708 | 'el-cascader-node': true,
|
39709 | 'is-selectable': checkStrictly,
|
39710 | 'in-active-path': inActivePath,
|
39711 | 'in-checked-path': inCheckedPath,
|
39712 | 'is-active': isChecked,
|
39713 | 'is-disabled': disabled
|
39714 | }
|
39715 | }, events]),
|
39716 | [this.renderPrefix(h), this.renderContent(h), this.renderPostfix(h)]
|
39717 | );
|
39718 | }
|
39719 | });
|
39720 |
|
39721 | var src_cascader_nodevue_type_script_lang_js_ = (cascader_nodevue_type_script_lang_js_);
|
39722 |
|
39723 | var cascader_node_render, cascader_node_staticRenderFns
|
39724 |
|
39725 |
|
39726 |
|
39727 |
|
39728 |
|
39729 |
|
39730 | var cascader_node_component = normalizeComponent(
|
39731 | src_cascader_nodevue_type_script_lang_js_,
|
39732 | cascader_node_render,
|
39733 | cascader_node_staticRenderFns,
|
39734 | false,
|
39735 | null,
|
39736 | null,
|
39737 | null
|
39738 |
|
39739 | )
|
39740 |
|
39741 |
|
39742 | if (false) { var cascader_node_api; }
|
39743 | cascader_node_component.options.__file = "packages/cascader-panel/src/cascader-node.vue"
|
39744 | var cascader_node = (cascader_node_component.exports);
|
39745 |
|
39746 |
|
39747 |
|
39748 |
|
39749 |
|
39750 |
|
39751 |
|
39752 |
|
39753 | var cascader_menuvue_type_script_lang_js_ = ({
|
39754 | name: 'ElCascaderMenu',
|
39755 |
|
39756 | mixins: [locale_default.a],
|
39757 |
|
39758 | inject: ['panel'],
|
39759 |
|
39760 | components: {
|
39761 | ElScrollbar: scrollbar_default.a,
|
39762 | CascaderNode: cascader_node
|
39763 | },
|
39764 |
|
39765 | props: {
|
39766 | nodes: {
|
39767 | type: Array,
|
39768 | required: true
|
39769 | },
|
39770 | index: Number
|
39771 | },
|
39772 |
|
39773 | data: function data() {
|
39774 | return {
|
39775 | activeNode: null,
|
39776 | hoverTimer: null,
|
39777 | id: Object(util_["generateId"])()
|
39778 | };
|
39779 | },
|
39780 |
|
39781 |
|
39782 | computed: {
|
39783 | isEmpty: function isEmpty() {
|
39784 | return !this.nodes.length;
|
39785 | },
|
39786 | menuId: function menuId() {
|
39787 | return 'cascader-menu-' + this.id + '-' + this.index;
|
39788 | }
|
39789 | },
|
39790 |
|
39791 | methods: {
|
39792 | handleExpand: function handleExpand(e) {
|
39793 | this.activeNode = e.target;
|
39794 | },
|
39795 | handleMouseMove: function handleMouseMove(e) {
|
39796 | var activeNode = this.activeNode,
|
39797 | hoverTimer = this.hoverTimer;
|
39798 | var hoverZone = this.$refs.hoverZone;
|
39799 |
|
39800 |
|
39801 | if (!activeNode || !hoverZone) return;
|
39802 |
|
39803 | if (activeNode.contains(e.target)) {
|
39804 | clearTimeout(hoverTimer);
|
39805 |
|
39806 | var _$el$getBoundingClien = this.$el.getBoundingClientRect(),
|
39807 | left = _$el$getBoundingClien.left;
|
39808 |
|
39809 | var startX = e.clientX - left;
|
39810 | var _$el = this.$el,
|
39811 | offsetWidth = _$el.offsetWidth,
|
39812 | offsetHeight = _$el.offsetHeight;
|
39813 |
|
39814 | var top = activeNode.offsetTop;
|
39815 | var bottom = top + activeNode.offsetHeight;
|
39816 |
|
39817 | hoverZone.innerHTML = '\n <path style="pointer-events: auto;" fill="transparent" d="M' + startX + ' ' + top + ' L' + offsetWidth + ' 0 V' + top + ' Z" />\n <path style="pointer-events: auto;" fill="transparent" d="M' + startX + ' ' + bottom + ' L' + offsetWidth + ' ' + offsetHeight + ' V' + bottom + ' Z" />\n ';
|
39818 | } else if (!hoverTimer) {
|
39819 | this.hoverTimer = setTimeout(this.clearHoverZone, this.panel.config.hoverThreshold);
|
39820 | }
|
39821 | },
|
39822 | clearHoverZone: function clearHoverZone() {
|
39823 | var hoverZone = this.$refs.hoverZone;
|
39824 |
|
39825 | if (!hoverZone) return;
|
39826 | hoverZone.innerHTML = '';
|
39827 | },
|
39828 | renderEmptyText: function renderEmptyText(h) {
|
39829 | return h(
|
39830 | 'div',
|
39831 | { 'class': 'el-cascader-menu__empty-text' },
|
39832 | [this.t('el.cascader.noData')]
|
39833 | );
|
39834 | },
|
39835 | renderNodeList: function renderNodeList(h) {
|
39836 | var menuId = this.menuId;
|
39837 | var isHoverMenu = this.panel.isHoverMenu;
|
39838 |
|
39839 | var events = { on: {} };
|
39840 |
|
39841 | if (isHoverMenu) {
|
39842 | events.on.expand = this.handleExpand;
|
39843 | }
|
39844 |
|
39845 | var nodes = this.nodes.map(function (node, index) {
|
39846 | var hasChildren = node.hasChildren;
|
39847 |
|
39848 | return h('cascader-node', external_babel_helper_vue_jsx_merge_props_default()([{
|
39849 | key: node.uid,
|
39850 | attrs: { node: node,
|
39851 | 'node-id': menuId + '-' + index,
|
39852 | 'aria-haspopup': hasChildren,
|
39853 | 'aria-owns': hasChildren ? menuId : null
|
39854 | }
|
39855 | }, events]));
|
39856 | });
|
39857 |
|
39858 | return [].concat(nodes, [isHoverMenu ? h('svg', { ref: 'hoverZone', 'class': 'el-cascader-menu__hover-zone' }) : null]);
|
39859 | }
|
39860 | },
|
39861 |
|
39862 | render: function render(h) {
|
39863 | var isEmpty = this.isEmpty,
|
39864 | menuId = this.menuId;
|
39865 |
|
39866 | var events = { nativeOn: {} };
|
39867 |
|
39868 |
|
39869 | if (this.panel.isHoverMenu) {
|
39870 | events.nativeOn.mousemove = this.handleMouseMove;
|
39871 |
|
39872 | }
|
39873 |
|
39874 | return h(
|
39875 | 'el-scrollbar',
|
39876 | external_babel_helper_vue_jsx_merge_props_default()([{
|
39877 | attrs: {
|
39878 | tag: 'ul',
|
39879 | role: 'menu',
|
39880 | id: menuId,
|
39881 |
|
39882 | 'wrap-class': 'el-cascader-menu__wrap',
|
39883 | 'view-class': {
|
39884 | 'el-cascader-menu__list': true,
|
39885 | 'is-empty': isEmpty
|
39886 | }
|
39887 | },
|
39888 | 'class': 'el-cascader-menu' }, events]),
|
39889 | [isEmpty ? this.renderEmptyText(h) : this.renderNodeList(h)]
|
39890 | );
|
39891 | }
|
39892 | });
|
39893 |
|
39894 | var src_cascader_menuvue_type_script_lang_js_ = (cascader_menuvue_type_script_lang_js_);
|
39895 |
|
39896 | var cascader_menu_render, cascader_menu_staticRenderFns
|
39897 |
|
39898 |
|
39899 |
|
39900 |
|
39901 |
|
39902 |
|
39903 | var cascader_menu_component = normalizeComponent(
|
39904 | src_cascader_menuvue_type_script_lang_js_,
|
39905 | cascader_menu_render,
|
39906 | cascader_menu_staticRenderFns,
|
39907 | false,
|
39908 | null,
|
39909 | null,
|
39910 | null
|
39911 |
|
39912 | )
|
39913 |
|
39914 |
|
39915 | if (false) { var cascader_menu_api; }
|
39916 | cascader_menu_component.options.__file = "packages/cascader-panel/src/cascader-menu.vue"
|
39917 | var cascader_menu = (cascader_menu_component.exports);
|
39918 |
|
39919 | var node_createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
39920 |
|
39921 | function src_node_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
39922 |
|
39923 |
|
39924 |
|
39925 |
|
39926 | var uid = 0;
|
39927 |
|
39928 | var src_node_Node = function () {
|
39929 | function Node(data, config, parentNode) {
|
39930 | src_node_classCallCheck(this, Node);
|
39931 |
|
39932 | this.data = data;
|
39933 | this.config = config;
|
39934 | this.parent = parentNode || null;
|
39935 | this.level = !this.parent ? 1 : this.parent.level + 1;
|
39936 | this.uid = uid++;
|
39937 |
|
39938 | this.initState();
|
39939 | this.initChildren();
|
39940 | }
|
39941 |
|
39942 | Node.prototype.initState = function initState() {
|
39943 | var _config = this.config,
|
39944 | valueKey = _config.value,
|
39945 | labelKey = _config.label;
|
39946 |
|
39947 |
|
39948 | this.value = this.data[valueKey];
|
39949 | this.label = this.data[labelKey];
|
39950 | this.pathNodes = this.calculatePathNodes();
|
39951 | this.path = this.pathNodes.map(function (node) {
|
39952 | return node.value;
|
39953 | });
|
39954 | this.pathLabels = this.pathNodes.map(function (node) {
|
39955 | return node.label;
|
39956 | });
|
39957 |
|
39958 |
|
39959 | this.loading = false;
|
39960 | this.loaded = false;
|
39961 | };
|
39962 |
|
39963 | Node.prototype.initChildren = function initChildren() {
|
39964 | var _this = this;
|
39965 |
|
39966 | var config = this.config;
|
39967 |
|
39968 | var childrenKey = config.children;
|
39969 | var childrenData = this.data[childrenKey];
|
39970 | this.hasChildren = Array.isArray(childrenData);
|
39971 | this.children = (childrenData || []).map(function (child) {
|
39972 | return new Node(child, config, _this);
|
39973 | });
|
39974 | };
|
39975 |
|
39976 | Node.prototype.calculatePathNodes = function calculatePathNodes() {
|
39977 | var nodes = [this];
|
39978 | var parent = this.parent;
|
39979 |
|
39980 | while (parent) {
|
39981 | nodes.unshift(parent);
|
39982 | parent = parent.parent;
|
39983 | }
|
39984 |
|
39985 | return nodes;
|
39986 | };
|
39987 |
|
39988 | Node.prototype.getPath = function getPath() {
|
39989 | return this.path;
|
39990 | };
|
39991 |
|
39992 | Node.prototype.getValue = function getValue() {
|
39993 | return this.value;
|
39994 | };
|
39995 |
|
39996 | Node.prototype.getValueByOption = function getValueByOption() {
|
39997 | return this.config.emitPath ? this.getPath() : this.getValue();
|
39998 | };
|
39999 |
|
40000 | Node.prototype.getText = function getText(allLevels, separator) {
|
40001 | return allLevels ? this.pathLabels.join(separator) : this.label;
|
40002 | };
|
40003 |
|
40004 | Node.prototype.isSameNode = function isSameNode(checkedValue) {
|
40005 | var value = this.getValueByOption();
|
40006 | return this.config.multiple && Array.isArray(checkedValue) ? checkedValue.some(function (val) {
|
40007 | return Object(util_["isEqual"])(val, value);
|
40008 | }) : Object(util_["isEqual"])(checkedValue, value);
|
40009 | };
|
40010 |
|
40011 | Node.prototype.broadcast = function broadcast(event) {
|
40012 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
40013 | args[_key - 1] = arguments[_key];
|
40014 | }
|
40015 |
|
40016 | var handlerName = 'onParent' + Object(util_["capitalize"])(event);
|
40017 |
|
40018 | this.children.forEach(function (child) {
|
40019 | if (child) {
|
40020 |
|
40021 | child.broadcast.apply(child, [event].concat(args));
|
40022 | child[handlerName] && child[handlerName].apply(child, args);
|
40023 | }
|
40024 | });
|
40025 | };
|
40026 |
|
40027 | Node.prototype.emit = function emit(event) {
|
40028 | var parent = this.parent;
|
40029 |
|
40030 | var handlerName = 'onChild' + Object(util_["capitalize"])(event);
|
40031 | if (parent) {
|
40032 | for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
40033 | args[_key2 - 1] = arguments[_key2];
|
40034 | }
|
40035 |
|
40036 | parent[handlerName] && parent[handlerName].apply(parent, args);
|
40037 | parent.emit.apply(parent, [event].concat(args));
|
40038 | }
|
40039 | };
|
40040 |
|
40041 | Node.prototype.onParentCheck = function onParentCheck(checked) {
|
40042 | if (!this.isDisabled) {
|
40043 | this.setCheckState(checked);
|
40044 | }
|
40045 | };
|
40046 |
|
40047 | Node.prototype.onChildCheck = function onChildCheck() {
|
40048 | var children = this.children;
|
40049 |
|
40050 | var validChildren = children.filter(function (child) {
|
40051 | return !child.isDisabled;
|
40052 | });
|
40053 | var checked = validChildren.length ? validChildren.every(function (child) {
|
40054 | return child.checked;
|
40055 | }) : false;
|
40056 |
|
40057 | this.setCheckState(checked);
|
40058 | };
|
40059 |
|
40060 | Node.prototype.setCheckState = function setCheckState(checked) {
|
40061 | var totalNum = this.children.length;
|
40062 | var checkedNum = this.children.reduce(function (c, p) {
|
40063 | var num = p.checked ? 1 : p.indeterminate ? 0.5 : 0;
|
40064 | return c + num;
|
40065 | }, 0);
|
40066 |
|
40067 | this.checked = checked;
|
40068 | this.indeterminate = checkedNum !== totalNum && checkedNum > 0;
|
40069 | };
|
40070 |
|
40071 | Node.prototype.syncCheckState = function syncCheckState(checkedValue) {
|
40072 | var value = this.getValueByOption();
|
40073 | var checked = this.isSameNode(checkedValue, value);
|
40074 |
|
40075 | this.doCheck(checked);
|
40076 | };
|
40077 |
|
40078 | Node.prototype.doCheck = function doCheck(checked) {
|
40079 | if (this.checked !== checked) {
|
40080 | if (this.config.checkStrictly) {
|
40081 | this.checked = checked;
|
40082 | } else {
|
40083 |
|
40084 | this.broadcast('check', checked);
|
40085 | this.setCheckState(checked);
|
40086 | this.emit('check');
|
40087 | }
|
40088 | }
|
40089 | };
|
40090 |
|
40091 | node_createClass(Node, [{
|
40092 | key: 'isDisabled',
|
40093 | get: function get() {
|
40094 | var data = this.data,
|
40095 | parent = this.parent,
|
40096 | config = this.config;
|
40097 |
|
40098 | var disabledKey = config.disabled;
|
40099 | var checkStrictly = config.checkStrictly;
|
40100 |
|
40101 | return data[disabledKey] || !checkStrictly && parent && parent.isDisabled;
|
40102 | }
|
40103 | }, {
|
40104 | key: 'isLeaf',
|
40105 | get: function get() {
|
40106 | var data = this.data,
|
40107 | loaded = this.loaded,
|
40108 | hasChildren = this.hasChildren,
|
40109 | children = this.children;
|
40110 | var _config2 = this.config,
|
40111 | lazy = _config2.lazy,
|
40112 | leafKey = _config2.leaf;
|
40113 |
|
40114 | if (lazy) {
|
40115 | var isLeaf = Object(shared_["isDef"])(data[leafKey]) ? data[leafKey] : loaded ? !children.length : false;
|
40116 | this.hasChildren = !isLeaf;
|
40117 | return isLeaf;
|
40118 | }
|
40119 | return !hasChildren;
|
40120 | }
|
40121 | }]);
|
40122 |
|
40123 | return Node;
|
40124 | }();
|
40125 |
|
40126 | var src_node = (src_node_Node);
|
40127 |
|
40128 | function store_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
40129 |
|
40130 |
|
40131 |
|
40132 |
|
40133 | var flatNodes = function flatNodes(data, leafOnly) {
|
40134 | return data.reduce(function (res, node) {
|
40135 | if (node.isLeaf) {
|
40136 | res.push(node);
|
40137 | } else {
|
40138 | !leafOnly && res.push(node);
|
40139 | res = res.concat(flatNodes(node.children, leafOnly));
|
40140 | }
|
40141 | return res;
|
40142 | }, []);
|
40143 | };
|
40144 |
|
40145 | var store_Store = function () {
|
40146 | function Store(data, config) {
|
40147 | store_classCallCheck(this, Store);
|
40148 |
|
40149 | this.config = config;
|
40150 | this.initNodes(data);
|
40151 | }
|
40152 |
|
40153 | Store.prototype.initNodes = function initNodes(data) {
|
40154 | var _this = this;
|
40155 |
|
40156 | data = Object(util_["coerceTruthyValueToArray"])(data);
|
40157 | this.nodes = data.map(function (nodeData) {
|
40158 | return new src_node(nodeData, _this.config);
|
40159 | });
|
40160 | this.flattedNodes = this.getFlattedNodes(false, false);
|
40161 | this.leafNodes = this.getFlattedNodes(true, false);
|
40162 | };
|
40163 |
|
40164 | Store.prototype.appendNode = function appendNode(nodeData, parentNode) {
|
40165 | var node = new src_node(nodeData, this.config, parentNode);
|
40166 | var children = parentNode ? parentNode.children : this.nodes;
|
40167 |
|
40168 | children.push(node);
|
40169 | };
|
40170 |
|
40171 | Store.prototype.appendNodes = function appendNodes(nodeDataList, parentNode) {
|
40172 | var _this2 = this;
|
40173 |
|
40174 | nodeDataList = Object(util_["coerceTruthyValueToArray"])(nodeDataList);
|
40175 | nodeDataList.forEach(function (nodeData) {
|
40176 | return _this2.appendNode(nodeData, parentNode);
|
40177 | });
|
40178 | };
|
40179 |
|
40180 | Store.prototype.getNodes = function getNodes() {
|
40181 | return this.nodes;
|
40182 | };
|
40183 |
|
40184 | Store.prototype.getFlattedNodes = function getFlattedNodes(leafOnly) {
|
40185 | var cached = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
40186 |
|
40187 | var cachedNodes = leafOnly ? this.leafNodes : this.flattedNodes;
|
40188 | return cached ? cachedNodes : flatNodes(this.nodes, leafOnly);
|
40189 | };
|
40190 |
|
40191 | Store.prototype.getNodeByValue = function getNodeByValue(value) {
|
40192 | if (value) {
|
40193 | var nodes = this.getFlattedNodes(false, !this.config.lazy).filter(function (node) {
|
40194 | return Object(util_["valueEquals"])(node.path, value) || node.value === value;
|
40195 | });
|
40196 | return nodes && nodes.length ? nodes[0] : null;
|
40197 | }
|
40198 | return null;
|
40199 | };
|
40200 |
|
40201 | return Store;
|
40202 | }();
|
40203 |
|
40204 | var cascader_panel_src_store = (store_Store);
|
40205 |
|
40206 | var cascader_panelvue_type_script_lang_js_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
40207 |
|
40208 |
|
40209 |
|
40210 |
|
40211 |
|
40212 |
|
40213 |
|
40214 |
|
40215 |
|
40216 |
|
40217 |
|
40218 |
|
40219 |
|
40220 |
|
40221 |
|
40222 |
|
40223 |
|
40224 |
|
40225 |
|
40226 |
|
40227 |
|
40228 |
|
40229 |
|
40230 |
|
40231 |
|
40232 | var cascader_panelvue_type_script_lang_js_KeyCode = aria_utils_default.a.keys;
|
40233 |
|
40234 | var DefaultProps = {
|
40235 | expandTrigger: 'click',
|
40236 | multiple: false,
|
40237 | checkStrictly: false,
|
40238 | emitPath: true,
|
40239 | lazy: false,
|
40240 | lazyLoad: util_["noop"],
|
40241 | value: 'value',
|
40242 | label: 'label',
|
40243 | children: 'children',
|
40244 | leaf: 'leaf',
|
40245 | disabled: 'disabled',
|
40246 | hoverThreshold: 500
|
40247 | };
|
40248 |
|
40249 | var cascader_panelvue_type_script_lang_js_isLeaf = function isLeaf(el) {
|
40250 | return !el.getAttribute('aria-owns');
|
40251 | };
|
40252 |
|
40253 | var getSibling = function getSibling(el, distance) {
|
40254 | var parentNode = el.parentNode;
|
40255 |
|
40256 | if (parentNode) {
|
40257 | var siblings = parentNode.querySelectorAll('.el-cascader-node[tabindex="-1"]');
|
40258 | var index = Array.prototype.indexOf.call(siblings, el);
|
40259 | return siblings[index + distance] || null;
|
40260 | }
|
40261 | return null;
|
40262 | };
|
40263 |
|
40264 | var getMenuIndex = function getMenuIndex(el, distance) {
|
40265 | if (!el) return;
|
40266 | var pieces = el.id.split('-');
|
40267 | return Number(pieces[pieces.length - 2]);
|
40268 | };
|
40269 |
|
40270 | var focusNode = function focusNode(el) {
|
40271 | if (!el) return;
|
40272 | el.focus();
|
40273 | !cascader_panelvue_type_script_lang_js_isLeaf(el) && el.click();
|
40274 | };
|
40275 |
|
40276 | var checkNode = function checkNode(el) {
|
40277 | if (!el) return;
|
40278 |
|
40279 | var input = el.querySelector('input');
|
40280 | if (input) {
|
40281 | input.click();
|
40282 | } else if (cascader_panelvue_type_script_lang_js_isLeaf(el)) {
|
40283 | el.click();
|
40284 | }
|
40285 | };
|
40286 |
|
40287 | var cascader_panelvue_type_script_lang_js_ = ({
|
40288 | name: 'ElCascaderPanel',
|
40289 |
|
40290 | components: {
|
40291 | CascaderMenu: cascader_menu
|
40292 | },
|
40293 |
|
40294 | props: {
|
40295 | value: {},
|
40296 | options: Array,
|
40297 | props: Object,
|
40298 | border: {
|
40299 | type: Boolean,
|
40300 | default: true
|
40301 | },
|
40302 | renderLabel: Function
|
40303 | },
|
40304 |
|
40305 | provide: function provide() {
|
40306 | return {
|
40307 | panel: this
|
40308 | };
|
40309 | },
|
40310 | data: function data() {
|
40311 | return {
|
40312 | checkedValue: null,
|
40313 | checkedNodePaths: [],
|
40314 | store: [],
|
40315 | menus: [],
|
40316 | activePath: [],
|
40317 | loadCount: 0
|
40318 | };
|
40319 | },
|
40320 |
|
40321 |
|
40322 | computed: {
|
40323 | config: function config() {
|
40324 | return merge_default()(cascader_panelvue_type_script_lang_js_extends({}, DefaultProps), this.props || {});
|
40325 | },
|
40326 | multiple: function multiple() {
|
40327 | return this.config.multiple;
|
40328 | },
|
40329 | checkStrictly: function checkStrictly() {
|
40330 | return this.config.checkStrictly;
|
40331 | },
|
40332 | leafOnly: function leafOnly() {
|
40333 | return !this.checkStrictly;
|
40334 | },
|
40335 | isHoverMenu: function isHoverMenu() {
|
40336 | return this.config.expandTrigger === 'hover';
|
40337 | },
|
40338 | renderLabelFn: function renderLabelFn() {
|
40339 | return this.renderLabel || this.$scopedSlots.default;
|
40340 | }
|
40341 | },
|
40342 |
|
40343 | watch: {
|
40344 | options: {
|
40345 | handler: function handler() {
|
40346 | this.initStore();
|
40347 | },
|
40348 | immediate: true,
|
40349 | deep: true
|
40350 | },
|
40351 | value: function value() {
|
40352 | this.syncCheckedValue();
|
40353 | this.checkStrictly && this.calculateCheckedNodePaths();
|
40354 | },
|
40355 | checkedValue: function checkedValue(val) {
|
40356 | if (!Object(util_["isEqual"])(val, this.value)) {
|
40357 | this.checkStrictly && this.calculateCheckedNodePaths();
|
40358 | this.$emit('input', val);
|
40359 | this.$emit('change', val);
|
40360 | }
|
40361 | }
|
40362 | },
|
40363 |
|
40364 | mounted: function mounted() {
|
40365 | if (!Object(util_["isEmpty"])(this.value)) {
|
40366 | this.syncCheckedValue();
|
40367 | }
|
40368 | },
|
40369 |
|
40370 |
|
40371 | methods: {
|
40372 | initStore: function initStore() {
|
40373 | var config = this.config,
|
40374 | options = this.options;
|
40375 |
|
40376 | if (config.lazy && Object(util_["isEmpty"])(options)) {
|
40377 | this.lazyLoad();
|
40378 | } else {
|
40379 | this.store = new cascader_panel_src_store(options, config);
|
40380 | this.menus = [this.store.getNodes()];
|
40381 | this.syncMenuState();
|
40382 | }
|
40383 | },
|
40384 | syncCheckedValue: function syncCheckedValue() {
|
40385 | var value = this.value,
|
40386 | checkedValue = this.checkedValue;
|
40387 |
|
40388 | if (!Object(util_["isEqual"])(value, checkedValue)) {
|
40389 | this.checkedValue = value;
|
40390 | this.syncMenuState();
|
40391 | }
|
40392 | },
|
40393 | syncMenuState: function syncMenuState() {
|
40394 | var multiple = this.multiple,
|
40395 | checkStrictly = this.checkStrictly;
|
40396 |
|
40397 | this.syncActivePath();
|
40398 | multiple && this.syncMultiCheckState();
|
40399 | checkStrictly && this.calculateCheckedNodePaths();
|
40400 | this.$nextTick(this.scrollIntoView);
|
40401 | },
|
40402 | syncMultiCheckState: function syncMultiCheckState() {
|
40403 | var _this = this;
|
40404 |
|
40405 | var nodes = this.getFlattedNodes(this.leafOnly);
|
40406 |
|
40407 | nodes.forEach(function (node) {
|
40408 | node.syncCheckState(_this.checkedValue);
|
40409 | });
|
40410 | },
|
40411 | syncActivePath: function syncActivePath() {
|
40412 | var _this2 = this;
|
40413 |
|
40414 | var store = this.store,
|
40415 | multiple = this.multiple,
|
40416 | activePath = this.activePath,
|
40417 | checkedValue = this.checkedValue;
|
40418 |
|
40419 |
|
40420 | if (!Object(util_["isEmpty"])(activePath)) {
|
40421 | var nodes = activePath.map(function (node) {
|
40422 | return _this2.getNodeByValue(node.getValue());
|
40423 | });
|
40424 | this.expandNodes(nodes);
|
40425 | } else if (!Object(util_["isEmpty"])(checkedValue)) {
|
40426 | var value = multiple ? checkedValue[0] : checkedValue;
|
40427 | var checkedNode = this.getNodeByValue(value) || {};
|
40428 | var _nodes = (checkedNode.pathNodes || []).slice(0, -1);
|
40429 | this.expandNodes(_nodes);
|
40430 | } else {
|
40431 | this.activePath = [];
|
40432 | this.menus = [store.getNodes()];
|
40433 | }
|
40434 | },
|
40435 | expandNodes: function expandNodes(nodes) {
|
40436 | var _this3 = this;
|
40437 |
|
40438 | nodes.forEach(function (node) {
|
40439 | return _this3.handleExpand(node, true );
|
40440 | });
|
40441 | },
|
40442 | calculateCheckedNodePaths: function calculateCheckedNodePaths() {
|
40443 | var _this4 = this;
|
40444 |
|
40445 | var checkedValue = this.checkedValue,
|
40446 | multiple = this.multiple;
|
40447 |
|
40448 | var checkedValues = multiple ? Object(util_["coerceTruthyValueToArray"])(checkedValue) : [checkedValue];
|
40449 | this.checkedNodePaths = checkedValues.map(function (v) {
|
40450 | var checkedNode = _this4.getNodeByValue(v);
|
40451 | return checkedNode ? checkedNode.pathNodes : [];
|
40452 | });
|
40453 | },
|
40454 | handleKeyDown: function handleKeyDown(e) {
|
40455 | var target = e.target,
|
40456 | keyCode = e.keyCode;
|
40457 |
|
40458 |
|
40459 | switch (keyCode) {
|
40460 | case cascader_panelvue_type_script_lang_js_KeyCode.up:
|
40461 | var prev = getSibling(target, -1);
|
40462 | focusNode(prev);
|
40463 | break;
|
40464 | case cascader_panelvue_type_script_lang_js_KeyCode.down:
|
40465 | var next = getSibling(target, 1);
|
40466 | focusNode(next);
|
40467 | break;
|
40468 | case cascader_panelvue_type_script_lang_js_KeyCode.left:
|
40469 | var preMenu = this.$refs.menu[getMenuIndex(target) - 1];
|
40470 | if (preMenu) {
|
40471 | var expandedNode = preMenu.$el.querySelector('.el-cascader-node[aria-expanded="true"]');
|
40472 | focusNode(expandedNode);
|
40473 | }
|
40474 | break;
|
40475 | case cascader_panelvue_type_script_lang_js_KeyCode.right:
|
40476 | var nextMenu = this.$refs.menu[getMenuIndex(target) + 1];
|
40477 | if (nextMenu) {
|
40478 | var firstNode = nextMenu.$el.querySelector('.el-cascader-node[tabindex="-1"]');
|
40479 | focusNode(firstNode);
|
40480 | }
|
40481 | break;
|
40482 | case cascader_panelvue_type_script_lang_js_KeyCode.enter:
|
40483 | checkNode(target);
|
40484 | break;
|
40485 | case cascader_panelvue_type_script_lang_js_KeyCode.esc:
|
40486 | case cascader_panelvue_type_script_lang_js_KeyCode.tab:
|
40487 | this.$emit('close');
|
40488 | break;
|
40489 | default:
|
40490 | return;
|
40491 | }
|
40492 | },
|
40493 | handleExpand: function handleExpand(node, silent) {
|
40494 | var activePath = this.activePath;
|
40495 | var level = node.level;
|
40496 |
|
40497 | var path = activePath.slice(0, level - 1);
|
40498 | var menus = this.menus.slice(0, level);
|
40499 |
|
40500 | if (!node.isLeaf) {
|
40501 | path.push(node);
|
40502 | menus.push(node.children);
|
40503 | }
|
40504 |
|
40505 | this.activePath = path;
|
40506 | this.menus = menus;
|
40507 |
|
40508 | if (!silent) {
|
40509 | var pathValues = path.map(function (node) {
|
40510 | return node.getValue();
|
40511 | });
|
40512 | var activePathValues = activePath.map(function (node) {
|
40513 | return node.getValue();
|
40514 | });
|
40515 | if (!Object(util_["valueEquals"])(pathValues, activePathValues)) {
|
40516 | this.$emit('active-item-change', pathValues);
|
40517 | this.$emit('expand-change', pathValues);
|
40518 | }
|
40519 | }
|
40520 | },
|
40521 | handleCheckChange: function handleCheckChange(value) {
|
40522 | this.checkedValue = value;
|
40523 | },
|
40524 | lazyLoad: function lazyLoad(node, onFullfiled) {
|
40525 | var _this5 = this;
|
40526 |
|
40527 | var config = this.config;
|
40528 |
|
40529 | if (!node) {
|
40530 | node = node || { root: true, level: 0 };
|
40531 | this.store = new cascader_panel_src_store([], config);
|
40532 | this.menus = [this.store.getNodes()];
|
40533 | }
|
40534 | node.loading = true;
|
40535 | var resolve = function resolve(dataList) {
|
40536 | var parent = node.root ? null : node;
|
40537 | dataList && dataList.length && _this5.store.appendNodes(dataList, parent);
|
40538 | node.loading = false;
|
40539 | node.loaded = true;
|
40540 |
|
40541 |
|
40542 | if (Array.isArray(_this5.checkedValue)) {
|
40543 | var nodeValue = _this5.checkedValue[_this5.loadCount++];
|
40544 | var valueKey = _this5.config.value;
|
40545 | var leafKey = _this5.config.leaf;
|
40546 |
|
40547 | if (Array.isArray(dataList) && dataList.filter(function (item) {
|
40548 | return item[valueKey] === nodeValue;
|
40549 | }).length > 0) {
|
40550 | var checkedNode = _this5.store.getNodeByValue(nodeValue);
|
40551 |
|
40552 | if (!checkedNode.data[leafKey]) {
|
40553 | _this5.lazyLoad(checkedNode, function () {
|
40554 | _this5.handleExpand(checkedNode);
|
40555 | });
|
40556 | }
|
40557 |
|
40558 | if (_this5.loadCount === _this5.checkedValue.length) {
|
40559 | _this5.$parent.computePresentText();
|
40560 | }
|
40561 | }
|
40562 | }
|
40563 |
|
40564 | onFullfiled && onFullfiled(dataList);
|
40565 | };
|
40566 | config.lazyLoad(node, resolve);
|
40567 | },
|
40568 |
|
40569 |
|
40570 | |
40571 |
|
40572 |
|
40573 | calculateMultiCheckedValue: function calculateMultiCheckedValue() {
|
40574 | this.checkedValue = this.getCheckedNodes(this.leafOnly).map(function (node) {
|
40575 | return node.getValueByOption();
|
40576 | });
|
40577 | },
|
40578 | scrollIntoView: function scrollIntoView() {
|
40579 | if (this.$isServer) return;
|
40580 |
|
40581 | var menus = this.$refs.menu || [];
|
40582 | menus.forEach(function (menu) {
|
40583 | var menuElement = menu.$el;
|
40584 | if (menuElement) {
|
40585 | var container = menuElement.querySelector('.el-scrollbar__wrap');
|
40586 | var activeNode = menuElement.querySelector('.el-cascader-node.is-active') || menuElement.querySelector('.el-cascader-node.in-active-path');
|
40587 | scroll_into_view_default()(container, activeNode);
|
40588 | }
|
40589 | });
|
40590 | },
|
40591 | getNodeByValue: function getNodeByValue(val) {
|
40592 | return this.store.getNodeByValue(val);
|
40593 | },
|
40594 | getFlattedNodes: function getFlattedNodes(leafOnly) {
|
40595 | var cached = !this.config.lazy;
|
40596 | return this.store.getFlattedNodes(leafOnly, cached);
|
40597 | },
|
40598 | getCheckedNodes: function getCheckedNodes(leafOnly) {
|
40599 | var checkedValue = this.checkedValue,
|
40600 | multiple = this.multiple;
|
40601 |
|
40602 | if (multiple) {
|
40603 | var nodes = this.getFlattedNodes(leafOnly);
|
40604 | return nodes.filter(function (node) {
|
40605 | return node.checked;
|
40606 | });
|
40607 | } else {
|
40608 | return Object(util_["isEmpty"])(checkedValue) ? [] : [this.getNodeByValue(checkedValue)];
|
40609 | }
|
40610 | },
|
40611 | clearCheckedNodes: function clearCheckedNodes() {
|
40612 | var config = this.config,
|
40613 | leafOnly = this.leafOnly;
|
40614 | var multiple = config.multiple,
|
40615 | emitPath = config.emitPath;
|
40616 |
|
40617 | if (multiple) {
|
40618 | this.getCheckedNodes(leafOnly).filter(function (node) {
|
40619 | return !node.isDisabled;
|
40620 | }).forEach(function (node) {
|
40621 | return node.doCheck(false);
|
40622 | });
|
40623 | this.calculateMultiCheckedValue();
|
40624 | } else {
|
40625 | this.checkedValue = emitPath ? [] : null;
|
40626 | }
|
40627 | }
|
40628 | }
|
40629 | });
|
40630 |
|
40631 | var src_cascader_panelvue_type_script_lang_js_ = (cascader_panelvue_type_script_lang_js_);
|
40632 |
|
40633 |
|
40634 |
|
40635 |
|
40636 |
|
40637 |
|
40638 |
|
40639 |
|
40640 | var cascader_panel_component = normalizeComponent(
|
40641 | src_cascader_panelvue_type_script_lang_js_,
|
40642 | cascader_panelvue_type_template_id_34932346_render,
|
40643 | cascader_panelvue_type_template_id_34932346_staticRenderFns,
|
40644 | false,
|
40645 | null,
|
40646 | null,
|
40647 | null
|
40648 |
|
40649 | )
|
40650 |
|
40651 |
|
40652 | if (false) { var cascader_panel_api; }
|
40653 | cascader_panel_component.options.__file = "packages/cascader-panel/src/cascader-panel.vue"
|
40654 | var cascader_panel = (cascader_panel_component.exports);
|
40655 |
|
40656 |
|
40657 |
|
40658 |
|
40659 | cascader_panel.install = function (Vue) {
|
40660 | Vue.component(cascader_panel.name, cascader_panel);
|
40661 | };
|
40662 |
|
40663 | var packages_cascader_panel = (cascader_panel);
|
40664 |
|
40665 |
|
40666 | var avatar_src_mainvue_type_script_lang_js_ = ({
|
40667 | name: 'ElAvatar',
|
40668 |
|
40669 | props: {
|
40670 | size: {
|
40671 | type: [Number, String],
|
40672 | validator: function validator(val) {
|
40673 | if (typeof val === 'string') {
|
40674 | return ['large', 'medium', 'small'].includes(val);
|
40675 | }
|
40676 | return typeof val === 'number';
|
40677 | }
|
40678 | },
|
40679 | shape: {
|
40680 | type: String,
|
40681 | default: 'circle',
|
40682 | validator: function validator(val) {
|
40683 | return ['circle', 'square'].includes(val);
|
40684 | }
|
40685 | },
|
40686 | icon: String,
|
40687 | src: String,
|
40688 | alt: String,
|
40689 | srcSet: String,
|
40690 | error: Function,
|
40691 | fit: {
|
40692 | type: String,
|
40693 | default: 'cover'
|
40694 | }
|
40695 | },
|
40696 |
|
40697 | data: function data() {
|
40698 | return {
|
40699 | isImageExist: true
|
40700 | };
|
40701 | },
|
40702 |
|
40703 |
|
40704 | computed: {
|
40705 | avatarClass: function avatarClass() {
|
40706 | var size = this.size,
|
40707 | icon = this.icon,
|
40708 | shape = this.shape;
|
40709 |
|
40710 | var classList = ['el-avatar'];
|
40711 |
|
40712 | if (size && typeof size === 'string') {
|
40713 | classList.push('el-avatar--' + size);
|
40714 | }
|
40715 |
|
40716 | if (icon) {
|
40717 | classList.push('el-avatar--icon');
|
40718 | }
|
40719 |
|
40720 | if (shape) {
|
40721 | classList.push('el-avatar--' + shape);
|
40722 | }
|
40723 |
|
40724 | return classList.join(' ');
|
40725 | }
|
40726 | },
|
40727 |
|
40728 | methods: {
|
40729 | handleError: function handleError() {
|
40730 | var error = this.error;
|
40731 |
|
40732 | var errorFlag = error ? error() : undefined;
|
40733 | if (errorFlag !== false) {
|
40734 | this.isImageExist = false;
|
40735 | }
|
40736 | },
|
40737 | renderAvatar: function renderAvatar() {
|
40738 | var h = this.$createElement;
|
40739 | var icon = this.icon,
|
40740 | src = this.src,
|
40741 | alt = this.alt,
|
40742 | isImageExist = this.isImageExist,
|
40743 | srcSet = this.srcSet,
|
40744 | fit = this.fit;
|
40745 |
|
40746 |
|
40747 | if (isImageExist && src) {
|
40748 | return h('img', {
|
40749 | attrs: {
|
40750 | src: src,
|
40751 |
|
40752 | alt: alt,
|
40753 | srcSet: srcSet
|
40754 | },
|
40755 | on: {
|
40756 | 'error': this.handleError
|
40757 | },
|
40758 | style: { 'object-fit': fit } });
|
40759 | }
|
40760 |
|
40761 | if (icon) {
|
40762 | return h('i', { 'class': icon });
|
40763 | }
|
40764 |
|
40765 | return this.$slots.default;
|
40766 | }
|
40767 | },
|
40768 |
|
40769 | render: function render() {
|
40770 | var h = arguments[0];
|
40771 | var avatarClass = this.avatarClass,
|
40772 | size = this.size;
|
40773 |
|
40774 |
|
40775 | var sizeStyle = typeof size === 'number' ? {
|
40776 | height: size + 'px',
|
40777 | width: size + 'px',
|
40778 | lineHeight: size + 'px'
|
40779 | } : {};
|
40780 |
|
40781 | return h(
|
40782 | 'span',
|
40783 | { 'class': avatarClass, style: sizeStyle },
|
40784 | [this.renderAvatar()]
|
40785 | );
|
40786 | }
|
40787 | });
|
40788 |
|
40789 | var packages_avatar_src_mainvue_type_script_lang_js_ = (avatar_src_mainvue_type_script_lang_js_);
|
40790 |
|
40791 | var src_main_render, src_main_staticRenderFns
|
40792 |
|
40793 |
|
40794 |
|
40795 |
|
40796 |
|
40797 |
|
40798 | var avatar_src_main_component = normalizeComponent(
|
40799 | packages_avatar_src_mainvue_type_script_lang_js_,
|
40800 | src_main_render,
|
40801 | src_main_staticRenderFns,
|
40802 | false,
|
40803 | null,
|
40804 | null,
|
40805 | null
|
40806 |
|
40807 | )
|
40808 |
|
40809 |
|
40810 | if (false) { var avatar_src_main_api; }
|
40811 | avatar_src_main_component.options.__file = "packages/avatar/src/main.vue"
|
40812 | var avatar_src_main = (avatar_src_main_component.exports);
|
40813 |
|
40814 |
|
40815 |
|
40816 |
|
40817 | avatar_src_main.install = function (Vue) {
|
40818 | Vue.component(avatar_src_main.name, avatar_src_main);
|
40819 | };
|
40820 |
|
40821 | var avatar = (avatar_src_main);
|
40822 |
|
40823 | var mainvue_type_template_id_a4885264_render = function() {
|
40824 | var _vm = this
|
40825 | var _h = _vm.$createElement
|
40826 | var _c = _vm._self._c || _h
|
40827 | return _c(
|
40828 | "transition",
|
40829 | {
|
40830 | attrs: { name: "el-drawer-fade" },
|
40831 | on: { "after-enter": _vm.afterEnter, "after-leave": _vm.afterLeave }
|
40832 | },
|
40833 | [
|
40834 | _c(
|
40835 | "div",
|
40836 | {
|
40837 | directives: [
|
40838 | {
|
40839 | name: "show",
|
40840 | rawName: "v-show",
|
40841 | value: _vm.visible,
|
40842 | expression: "visible"
|
40843 | }
|
40844 | ],
|
40845 | staticClass: "el-drawer__wrapper",
|
40846 | attrs: { tabindex: "-1" }
|
40847 | },
|
40848 | [
|
40849 | _c(
|
40850 | "div",
|
40851 | {
|
40852 | staticClass: "el-drawer__container",
|
40853 | class: _vm.visible && "el-drawer__open",
|
40854 | attrs: { role: "document", tabindex: "-1" },
|
40855 | on: {
|
40856 | click: function($event) {
|
40857 | if ($event.target !== $event.currentTarget) {
|
40858 | return null
|
40859 | }
|
40860 | return _vm.handleWrapperClick($event)
|
40861 | }
|
40862 | }
|
40863 | },
|
40864 | [
|
40865 | _c(
|
40866 | "div",
|
40867 | {
|
40868 | ref: "drawer",
|
40869 | staticClass: "el-drawer",
|
40870 | class: [_vm.direction, _vm.customClass],
|
40871 | style: _vm.isHorizontal
|
40872 | ? "width: " + _vm.size
|
40873 | : "height: " + _vm.size,
|
40874 | attrs: {
|
40875 | "aria-modal": "true",
|
40876 | "aria-labelledby": "el-drawer__title",
|
40877 | "aria-label": _vm.title,
|
40878 | role: "dialog",
|
40879 | tabindex: "-1"
|
40880 | }
|
40881 | },
|
40882 | [
|
40883 | _vm.withHeader
|
40884 | ? _c(
|
40885 | "header",
|
40886 | {
|
40887 | staticClass: "el-drawer__header",
|
40888 | attrs: { id: "el-drawer__title" }
|
40889 | },
|
40890 | [
|
40891 | _vm._t("title", [
|
40892 | _c(
|
40893 | "span",
|
40894 | {
|
40895 | attrs: {
|
40896 | role: "heading",
|
40897 | tabindex: "0",
|
40898 | title: _vm.title
|
40899 | }
|
40900 | },
|
40901 | [_vm._v(_vm._s(_vm.title))]
|
40902 | )
|
40903 | ]),
|
40904 | _vm.showClose
|
40905 | ? _c(
|
40906 | "button",
|
40907 | {
|
40908 | staticClass: "el-drawer__close-btn",
|
40909 | attrs: {
|
40910 | "aria-label":
|
40911 | "close " + (_vm.title || "drawer"),
|
40912 | type: "button"
|
40913 | },
|
40914 | on: { click: _vm.closeDrawer }
|
40915 | },
|
40916 | [
|
40917 | _c("i", {
|
40918 | staticClass:
|
40919 | "el-dialog__close el-icon el-icon-close"
|
40920 | })
|
40921 | ]
|
40922 | )
|
40923 | : _vm._e()
|
40924 | ],
|
40925 | 2
|
40926 | )
|
40927 | : _vm._e(),
|
40928 | _vm.rendered
|
40929 | ? _c(
|
40930 | "section",
|
40931 | { staticClass: "el-drawer__body" },
|
40932 | [_vm._t("default")],
|
40933 | 2
|
40934 | )
|
40935 | : _vm._e()
|
40936 | ]
|
40937 | )
|
40938 | ]
|
40939 | )
|
40940 | ]
|
40941 | )
|
40942 | ]
|
40943 | )
|
40944 | }
|
40945 | var mainvue_type_template_id_a4885264_staticRenderFns = []
|
40946 | mainvue_type_template_id_a4885264_render._withStripped = true
|
40947 |
|
40948 |
|
40949 |
|
40950 |
|
40951 |
|
40952 |
|
40953 |
|
40954 |
|
40955 |
|
40956 |
|
40957 |
|
40958 |
|
40959 |
|
40960 |
|
40961 |
|
40962 |
|
40963 |
|
40964 |
|
40965 |
|
40966 |
|
40967 |
|
40968 |
|
40969 |
|
40970 |
|
40971 |
|
40972 |
|
40973 |
|
40974 |
|
40975 |
|
40976 |
|
40977 |
|
40978 |
|
40979 |
|
40980 |
|
40981 |
|
40982 |
|
40983 |
|
40984 |
|
40985 |
|
40986 |
|
40987 |
|
40988 |
|
40989 |
|
40990 |
|
40991 |
|
40992 |
|
40993 |
|
40994 |
|
40995 |
|
40996 |
|
40997 |
|
40998 |
|
40999 |
|
41000 |
|
41001 |
|
41002 |
|
41003 |
|
41004 |
|
41005 | var drawer_src_mainvue_type_script_lang_js_ = ({
|
41006 | name: 'ElDrawer',
|
41007 | mixins: [popup_default.a, emitter_default.a],
|
41008 | props: {
|
41009 | appendToBody: {
|
41010 | type: Boolean,
|
41011 | default: false
|
41012 | },
|
41013 | beforeClose: {
|
41014 | type: Function
|
41015 | },
|
41016 | customClass: {
|
41017 | type: String,
|
41018 | default: ''
|
41019 | },
|
41020 | closeOnPressEscape: {
|
41021 | type: Boolean,
|
41022 | default: true
|
41023 | },
|
41024 | destroyOnClose: {
|
41025 | type: Boolean,
|
41026 | default: false
|
41027 | },
|
41028 | modal: {
|
41029 | type: Boolean,
|
41030 | default: true
|
41031 | },
|
41032 | direction: {
|
41033 | type: String,
|
41034 | default: 'rtl',
|
41035 | validator: function validator(val) {
|
41036 | return ['ltr', 'rtl', 'ttb', 'btt'].indexOf(val) !== -1;
|
41037 | }
|
41038 | },
|
41039 | modalAppendToBody: {
|
41040 | type: Boolean,
|
41041 | default: true
|
41042 | },
|
41043 | showClose: {
|
41044 | type: Boolean,
|
41045 | default: true
|
41046 | },
|
41047 | size: {
|
41048 | type: String,
|
41049 | default: '30%'
|
41050 | },
|
41051 | title: {
|
41052 | type: String,
|
41053 | default: ''
|
41054 | },
|
41055 | visible: {
|
41056 | type: Boolean
|
41057 | },
|
41058 | wrapperClosable: {
|
41059 | type: Boolean,
|
41060 | default: true
|
41061 | },
|
41062 | withHeader: {
|
41063 | type: Boolean,
|
41064 | default: true
|
41065 | }
|
41066 | },
|
41067 | computed: {
|
41068 | isHorizontal: function isHorizontal() {
|
41069 | return this.direction === 'rtl' || this.direction === 'ltr';
|
41070 | }
|
41071 | },
|
41072 | data: function data() {
|
41073 | return {
|
41074 | closed: false,
|
41075 | prevActiveElement: null
|
41076 | };
|
41077 | },
|
41078 |
|
41079 | watch: {
|
41080 | visible: function visible(val) {
|
41081 | var _this = this;
|
41082 |
|
41083 | if (val) {
|
41084 | this.closed = false;
|
41085 | this.$emit('open');
|
41086 | if (this.appendToBody) {
|
41087 | document.body.appendChild(this.$el);
|
41088 | }
|
41089 | this.prevActiveElement = document.activeElement;
|
41090 | this.$nextTick(function () {
|
41091 | aria_utils_default.a.focusFirstDescendant(_this.$refs.drawer);
|
41092 | });
|
41093 | } else {
|
41094 | if (!this.closed) this.$emit('close');
|
41095 | this.$nextTick(function () {
|
41096 | if (_this.prevActiveElement) {
|
41097 | _this.prevActiveElement.focus();
|
41098 | }
|
41099 | });
|
41100 | }
|
41101 | }
|
41102 | },
|
41103 | methods: {
|
41104 | afterEnter: function afterEnter() {
|
41105 | this.$emit('opened');
|
41106 | },
|
41107 | afterLeave: function afterLeave() {
|
41108 | this.$emit('closed');
|
41109 | },
|
41110 | hide: function hide(cancel) {
|
41111 | if (cancel !== false) {
|
41112 | this.$emit('update:visible', false);
|
41113 | this.$emit('close');
|
41114 | if (this.destroyOnClose === true) {
|
41115 | this.rendered = false;
|
41116 | }
|
41117 | this.closed = true;
|
41118 | }
|
41119 | },
|
41120 | handleWrapperClick: function handleWrapperClick() {
|
41121 | if (this.wrapperClosable) {
|
41122 | this.closeDrawer();
|
41123 | }
|
41124 | },
|
41125 | closeDrawer: function closeDrawer() {
|
41126 | if (typeof this.beforeClose === 'function') {
|
41127 | this.beforeClose(this.hide);
|
41128 | } else {
|
41129 | this.hide();
|
41130 | }
|
41131 | },
|
41132 | handleClose: function handleClose() {
|
41133 |
|
41134 |
|
41135 |
|
41136 | this.closeDrawer();
|
41137 | }
|
41138 | },
|
41139 | mounted: function mounted() {
|
41140 | if (this.visible) {
|
41141 | this.rendered = true;
|
41142 | this.open();
|
41143 | }
|
41144 | },
|
41145 | destroyed: function destroyed() {
|
41146 |
|
41147 | if (this.appendToBody && this.$el && this.$el.parentNode) {
|
41148 | this.$el.parentNode.removeChild(this.$el);
|
41149 | }
|
41150 | }
|
41151 | });
|
41152 |
|
41153 | var packages_drawer_src_mainvue_type_script_lang_js_ = (drawer_src_mainvue_type_script_lang_js_);
|
41154 |
|
41155 |
|
41156 |
|
41157 |
|
41158 |
|
41159 |
|
41160 |
|
41161 |
|
41162 | var drawer_src_main_component = normalizeComponent(
|
41163 | packages_drawer_src_mainvue_type_script_lang_js_,
|
41164 | mainvue_type_template_id_a4885264_render,
|
41165 | mainvue_type_template_id_a4885264_staticRenderFns,
|
41166 | false,
|
41167 | null,
|
41168 | null,
|
41169 | null
|
41170 |
|
41171 | )
|
41172 |
|
41173 |
|
41174 | if (false) { var drawer_src_main_api; }
|
41175 | drawer_src_main_component.options.__file = "packages/drawer/src/main.vue"
|
41176 | var drawer_src_main = (drawer_src_main_component.exports);
|
41177 |
|
41178 |
|
41179 |
|
41180 |
|
41181 | drawer_src_main.install = function (Vue) {
|
41182 | Vue.component(drawer_src_main.name, drawer_src_main);
|
41183 | };
|
41184 |
|
41185 | var drawer = (drawer_src_main);
|
41186 |
|
41187 | var mainvue_type_template_id_048de730_render = function() {
|
41188 | var _vm = this
|
41189 | var _h = _vm.$createElement
|
41190 | var _c = _vm._self._c || _h
|
41191 | return _c(
|
41192 | "el-popover",
|
41193 | _vm._b(
|
41194 | {
|
41195 | attrs: { trigger: "click" },
|
41196 | model: {
|
41197 | value: _vm.visible,
|
41198 | callback: function($$v) {
|
41199 | _vm.visible = $$v
|
41200 | },
|
41201 | expression: "visible"
|
41202 | }
|
41203 | },
|
41204 | "el-popover",
|
41205 | _vm.$attrs,
|
41206 | false
|
41207 | ),
|
41208 | [
|
41209 | _c("div", { staticClass: "el-popconfirm" }, [
|
41210 | _c("p", { staticClass: "el-popconfirm__main" }, [
|
41211 | !_vm.hideIcon
|
41212 | ? _c("i", {
|
41213 | staticClass: "el-popconfirm__icon",
|
41214 | class: _vm.icon,
|
41215 | style: { color: _vm.iconColor }
|
41216 | })
|
41217 | : _vm._e(),
|
41218 | _vm._v("\n " + _vm._s(_vm.title) + "\n ")
|
41219 | ]),
|
41220 | _c(
|
41221 | "div",
|
41222 | { staticClass: "el-popconfirm__action" },
|
41223 | [
|
41224 | _c(
|
41225 | "el-button",
|
41226 | {
|
41227 | attrs: { size: "mini", type: _vm.cancelButtonType },
|
41228 | on: { click: _vm.cancel }
|
41229 | },
|
41230 | [_vm._v("\n " + _vm._s(_vm.cancelButtonText) + "\n ")]
|
41231 | ),
|
41232 | _c(
|
41233 | "el-button",
|
41234 | {
|
41235 | attrs: { size: "mini", type: _vm.confirmButtonType },
|
41236 | on: { click: _vm.confirm }
|
41237 | },
|
41238 | [
|
41239 | _vm._v(
|
41240 | "\n " + _vm._s(_vm.confirmButtonText) + "\n "
|
41241 | )
|
41242 | ]
|
41243 | )
|
41244 | ],
|
41245 | 1
|
41246 | )
|
41247 | ]),
|
41248 | _vm._t("reference", null, { slot: "reference" })
|
41249 | ],
|
41250 | 2
|
41251 | )
|
41252 | }
|
41253 | var mainvue_type_template_id_048de730_staticRenderFns = []
|
41254 | mainvue_type_template_id_048de730_render._withStripped = true
|
41255 |
|
41256 |
|
41257 |
|
41258 |
|
41259 |
|
41260 | var popover_ = __webpack_require__(44);
|
41261 | var popover_default = __webpack_require__.n(popover_);
|
41262 |
|
41263 |
|
41264 |
|
41265 |
|
41266 |
|
41267 |
|
41268 |
|
41269 |
|
41270 |
|
41271 |
|
41272 |
|
41273 |
|
41274 |
|
41275 |
|
41276 |
|
41277 |
|
41278 |
|
41279 |
|
41280 |
|
41281 |
|
41282 |
|
41283 |
|
41284 |
|
41285 |
|
41286 |
|
41287 |
|
41288 |
|
41289 |
|
41290 |
|
41291 |
|
41292 |
|
41293 |
|
41294 |
|
41295 |
|
41296 |
|
41297 |
|
41298 |
|
41299 |
|
41300 |
|
41301 |
|
41302 |
|
41303 |
|
41304 |
|
41305 |
|
41306 | var popconfirm_src_mainvue_type_script_lang_js_ = ({
|
41307 | name: 'ElPopconfirm',
|
41308 | props: {
|
41309 | title: {
|
41310 | type: String
|
41311 | },
|
41312 | confirmButtonText: {
|
41313 | type: String,
|
41314 | default: Object(lib_locale_["t"])('el.popconfirm.confirmButtonText')
|
41315 | },
|
41316 | cancelButtonText: {
|
41317 | type: String,
|
41318 | default: Object(lib_locale_["t"])('el.popconfirm.cancelButtonText')
|
41319 | },
|
41320 | confirmButtonType: {
|
41321 | type: String,
|
41322 | default: 'primary'
|
41323 | },
|
41324 | cancelButtonType: {
|
41325 | type: String,
|
41326 | default: 'text'
|
41327 | },
|
41328 | icon: {
|
41329 | type: String,
|
41330 | default: 'el-icon-question'
|
41331 | },
|
41332 | iconColor: {
|
41333 | type: String,
|
41334 | default: '#f90'
|
41335 | },
|
41336 | hideIcon: {
|
41337 | type: Boolean,
|
41338 | default: false
|
41339 | }
|
41340 | },
|
41341 | components: {
|
41342 | ElPopover: popover_default.a,
|
41343 | ElButton: button_default.a
|
41344 | },
|
41345 | data: function data() {
|
41346 | return {
|
41347 | visible: false
|
41348 | };
|
41349 | },
|
41350 |
|
41351 | methods: {
|
41352 | confirm: function confirm() {
|
41353 | this.visible = false;
|
41354 | this.$emit('onConfirm');
|
41355 | },
|
41356 | cancel: function cancel() {
|
41357 | this.visible = false;
|
41358 | this.$emit('onCancel');
|
41359 | }
|
41360 | }
|
41361 | });
|
41362 |
|
41363 | var packages_popconfirm_src_mainvue_type_script_lang_js_ = (popconfirm_src_mainvue_type_script_lang_js_);
|
41364 |
|
41365 |
|
41366 |
|
41367 |
|
41368 |
|
41369 |
|
41370 |
|
41371 |
|
41372 | var popconfirm_src_main_component = normalizeComponent(
|
41373 | packages_popconfirm_src_mainvue_type_script_lang_js_,
|
41374 | mainvue_type_template_id_048de730_render,
|
41375 | mainvue_type_template_id_048de730_staticRenderFns,
|
41376 | false,
|
41377 | null,
|
41378 | null,
|
41379 | null
|
41380 |
|
41381 | )
|
41382 |
|
41383 |
|
41384 | if (false) { var popconfirm_src_main_api; }
|
41385 | popconfirm_src_main_component.options.__file = "packages/popconfirm/src/main.vue"
|
41386 | var popconfirm_src_main = (popconfirm_src_main_component.exports);
|
41387 |
|
41388 |
|
41389 |
|
41390 |
|
41391 | popconfirm_src_main.install = function (Vue) {
|
41392 | Vue.component(popconfirm_src_main.name, popconfirm_src_main);
|
41393 | };
|
41394 |
|
41395 | var popconfirm = (popconfirm_src_main);
|
41396 |
|
41397 |
|
41398 |
|
41399 |
|
41400 |
|
41401 |
|
41402 |
|
41403 |
|
41404 |
|
41405 |
|
41406 |
|
41407 |
|
41408 |
|
41409 |
|
41410 |
|
41411 |
|
41412 |
|
41413 |
|
41414 |
|
41415 |
|
41416 |
|
41417 |
|
41418 |
|
41419 |
|
41420 |
|
41421 |
|
41422 |
|
41423 |
|
41424 |
|
41425 |
|
41426 |
|
41427 |
|
41428 |
|
41429 |
|
41430 |
|
41431 |
|
41432 |
|
41433 |
|
41434 |
|
41435 |
|
41436 |
|
41437 |
|
41438 |
|
41439 |
|
41440 |
|
41441 |
|
41442 |
|
41443 |
|
41444 |
|
41445 |
|
41446 |
|
41447 |
|
41448 |
|
41449 |
|
41450 |
|
41451 |
|
41452 |
|
41453 |
|
41454 |
|
41455 |
|
41456 |
|
41457 |
|
41458 |
|
41459 |
|
41460 |
|
41461 |
|
41462 |
|
41463 |
|
41464 |
|
41465 |
|
41466 |
|
41467 |
|
41468 |
|
41469 |
|
41470 |
|
41471 |
|
41472 |
|
41473 |
|
41474 |
|
41475 |
|
41476 |
|
41477 |
|
41478 |
|
41479 |
|
41480 |
|
41481 |
|
41482 |
|
41483 |
|
41484 | var components = [packages_pagination, dialog, packages_autocomplete, packages_dropdown, packages_dropdown_menu, packages_dropdown_item, packages_menu, packages_submenu, packages_menu_item, packages_menu_item_group, packages_input, packages_input_number, packages_radio, packages_radio_group, packages_radio_button, packages_checkbox, packages_checkbox_button, packages_checkbox_group, packages_switch, packages_select, packages_option, packages_option_group, packages_button, packages_button_group, packages_table, packages_table_column, packages_date_picker, packages_time_select, packages_time_picker, popover, packages_tooltip, packages_breadcrumb, packages_breadcrumb_item, packages_form, packages_form_item, packages_tabs, packages_tab_pane, packages_tag, packages_tree, packages_alert, slider, packages_icon, packages_row, packages_col, packages_upload, packages_progress, packages_spinner, badge, card, rate, packages_steps, packages_step, carousel, scrollbar, carousel_item, packages_collapse, packages_collapse_item, packages_cascader, color_picker, transfer, packages_container, header, aside, packages_main, footer, timeline, timeline_item, packages_link, divider, packages_image, calendar, backtop, page_header, packages_cascader_panel, avatar, drawer, popconfirm, collapse_transition_default.a];
|
41485 |
|
41486 | var src_install = function install(Vue) {
|
41487 | var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
41488 |
|
41489 | lib_locale_default.a.use(opts.locale);
|
41490 | lib_locale_default.a.i18n(opts.i18n);
|
41491 |
|
41492 | components.forEach(function (component) {
|
41493 | Vue.component(component.name, component);
|
41494 | });
|
41495 |
|
41496 | Vue.use(infinite_scroll);
|
41497 | Vue.use(packages_loading.directive);
|
41498 |
|
41499 | Vue.prototype.$ELEMENT = {
|
41500 | size: opts.size || '',
|
41501 | zIndex: opts.zIndex || 2000
|
41502 | };
|
41503 |
|
41504 | Vue.prototype.$loading = packages_loading.service;
|
41505 | Vue.prototype.$msgbox = message_box;
|
41506 | Vue.prototype.$alert = message_box.alert;
|
41507 | Vue.prototype.$confirm = message_box.confirm;
|
41508 | Vue.prototype.$prompt = message_box.prompt;
|
41509 | Vue.prototype.$notify = notification;
|
41510 | Vue.prototype.$message = packages_message;
|
41511 | };
|
41512 |
|
41513 |
|
41514 | if (typeof window !== 'undefined' && window.Vue) {
|
41515 | src_install(window.Vue);
|
41516 | }
|
41517 |
|
41518 | var src_0 = __webpack_exports__["default"] = ({
|
41519 | version: '2.13.2',
|
41520 | locale: lib_locale_default.a.use,
|
41521 | i18n: lib_locale_default.a.i18n,
|
41522 | install: src_install,
|
41523 | CollapseTransition: collapse_transition_default.a,
|
41524 | Loading: packages_loading,
|
41525 | Pagination: packages_pagination,
|
41526 | Dialog: dialog,
|
41527 | Autocomplete: packages_autocomplete,
|
41528 | Dropdown: packages_dropdown,
|
41529 | DropdownMenu: packages_dropdown_menu,
|
41530 | DropdownItem: packages_dropdown_item,
|
41531 | Menu: packages_menu,
|
41532 | Submenu: packages_submenu,
|
41533 | MenuItem: packages_menu_item,
|
41534 | MenuItemGroup: packages_menu_item_group,
|
41535 | Input: packages_input,
|
41536 | InputNumber: packages_input_number,
|
41537 | Radio: packages_radio,
|
41538 | RadioGroup: packages_radio_group,
|
41539 | RadioButton: packages_radio_button,
|
41540 | Checkbox: packages_checkbox,
|
41541 | CheckboxButton: packages_checkbox_button,
|
41542 | CheckboxGroup: packages_checkbox_group,
|
41543 | Switch: packages_switch,
|
41544 | Select: packages_select,
|
41545 | Option: packages_option,
|
41546 | OptionGroup: packages_option_group,
|
41547 | Button: packages_button,
|
41548 | ButtonGroup: packages_button_group,
|
41549 | Table: packages_table,
|
41550 | TableColumn: packages_table_column,
|
41551 | DatePicker: packages_date_picker,
|
41552 | TimeSelect: packages_time_select,
|
41553 | TimePicker: packages_time_picker,
|
41554 | Popover: popover,
|
41555 | Tooltip: packages_tooltip,
|
41556 | MessageBox: message_box,
|
41557 | Breadcrumb: packages_breadcrumb,
|
41558 | BreadcrumbItem: packages_breadcrumb_item,
|
41559 | Form: packages_form,
|
41560 | FormItem: packages_form_item,
|
41561 | Tabs: packages_tabs,
|
41562 | TabPane: packages_tab_pane,
|
41563 | Tag: packages_tag,
|
41564 | Tree: packages_tree,
|
41565 | Alert: packages_alert,
|
41566 | Notification: notification,
|
41567 | Slider: slider,
|
41568 | Icon: packages_icon,
|
41569 | Row: packages_row,
|
41570 | Col: packages_col,
|
41571 | Upload: packages_upload,
|
41572 | Progress: packages_progress,
|
41573 | Spinner: packages_spinner,
|
41574 | Message: packages_message,
|
41575 | Badge: badge,
|
41576 | Card: card,
|
41577 | Rate: rate,
|
41578 | Steps: packages_steps,
|
41579 | Step: packages_step,
|
41580 | Carousel: carousel,
|
41581 | Scrollbar: scrollbar,
|
41582 | CarouselItem: carousel_item,
|
41583 | Collapse: packages_collapse,
|
41584 | CollapseItem: packages_collapse_item,
|
41585 | Cascader: packages_cascader,
|
41586 | ColorPicker: color_picker,
|
41587 | Transfer: transfer,
|
41588 | Container: packages_container,
|
41589 | Header: header,
|
41590 | Aside: aside,
|
41591 | Main: packages_main,
|
41592 | Footer: footer,
|
41593 | Timeline: timeline,
|
41594 | TimelineItem: timeline_item,
|
41595 | Link: packages_link,
|
41596 | Divider: divider,
|
41597 | Image: packages_image,
|
41598 | Calendar: calendar,
|
41599 | Backtop: backtop,
|
41600 | InfiniteScroll: infinite_scroll,
|
41601 | PageHeader: page_header,
|
41602 | CascaderPanel: packages_cascader_panel,
|
41603 | Avatar: avatar,
|
41604 | Drawer: drawer,
|
41605 | Popconfirm: popconfirm
|
41606 | });
|
41607 |
|
41608 | })
|
41609 | ])["default"]; |
\ | No newline at end of file |